终端一体化运控平台
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

403 řádky
12 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Collections.Concurrent;
  7. using BPA.Message;
  8. using BPASmartClient.Device;
  9. using BPASmartClient.Model;
  10. namespace BPASmartClient.MorkM
  11. {
  12. /// <summary>
  13. /// MORKS 设备数据
  14. /// </summary>
  15. public class GVL_MORKM : IStatus
  16. {
  17. public GVL_MORKM()
  18. {
  19. for (int i = 0; i < 6; i++)
  20. {
  21. CookNodelId.Add(new CookNodleLocAndId() { CookNodelId = "", Loc = -1 });
  22. }
  23. }
  24. /// <summary>
  25. /// 机器人取面
  26. /// PLC -> M0.3
  27. /// ModbusTcp -> 323
  28. /// </summary>
  29. public bool RobotTakeNoodle { get; set; }
  30. /// <summary>
  31. /// 机器人出餐
  32. /// PLC -> M0.4
  33. /// ModbusTcp -> 324
  34. /// </summary>
  35. public bool RobotOutMeal { get; set; }
  36. /// <summary>
  37. /// 移动转台
  38. /// PLC -> M0.5
  39. /// ModbusTcp -> 325
  40. /// </summary>
  41. public bool MoveTurntable { get; set; }
  42. #region 临时变量
  43. /// <summary>
  44. /// 允许运行
  45. /// </summary>
  46. [VariableMonitor("允许运行")]
  47. public bool AllowRun { get; set; }
  48. /// <summary>
  49. /// //机器人任务互锁信号
  50. /// </summary>
  51. [VariableMonitor("机器人任务互锁信号")]
  52. public bool RobotTaskInterlock { get; set; }
  53. /// <summary>
  54. /// 取碗互锁信号
  55. /// </summary>
  56. [VariableMonitor("取碗互锁信号")]
  57. public bool TakeBowlInterlock { get; set; }
  58. /// <summary>
  59. /// 取面互锁信号
  60. /// </summary>
  61. [VariableMonitor("取面互锁信号")]
  62. public bool TakeNoodleInterlock { get; set; }
  63. /// <summary>
  64. /// 出面中
  65. /// </summary>
  66. [VariableMonitor("出面中")]
  67. public bool OutNoodleing { get; set; }
  68. /// <summary>
  69. /// 允许取面
  70. /// </summary>
  71. [VariableMonitor("允许取面")]
  72. public bool AllowTakeNoodle { get; set; }
  73. /// <summary>
  74. /// 转台互锁信号
  75. /// </summary>
  76. [VariableMonitor("转台互锁信号")]
  77. public bool TurntableInterlock { get; set; }
  78. /// <summary>
  79. /// 荤素出餐互锁
  80. /// </summary>
  81. [VariableMonitor("荤素出餐互锁")]
  82. public bool ERLoc { get; set; } = false;
  83. /// <summary>
  84. /// 当前取餐位置
  85. /// </summary>
  86. [VariableMonitor("当前取餐位置")]
  87. public int CurrentTakeMeakLoc { get; set; } = -1;
  88. #endregion
  89. /// <summary>
  90. /// 初始化完成
  91. /// PLC -> M100.0
  92. /// ModbusTcp -> 1120
  93. /// </summary>
  94. [VariableMonitor("初始化完成", "M100.0", "1120")]
  95. public bool InitComplete { get; set; }
  96. /// <summary>
  97. /// 取碗机构空闲,True:忙碌,false:空闲
  98. /// PLC -> M100.1
  99. /// ModbusTcp -> 1121
  100. /// </summary>
  101. [VariableMonitor("取碗机构空闲", "M100.1", "1121")]
  102. public bool TakeBowlIdle { get; set; }
  103. /// <summary>
  104. /// 温度到达,True:表示到达,false:未到达
  105. /// PLC -> M100.2
  106. /// ModbusTcp -> 1122
  107. /// </summary>
  108. [VariableMonitor("温度到达", "M100.2", "1122")]
  109. public bool TemperatureReached { get; set; }
  110. /// <summary>
  111. /// 允许到面,配料完成
  112. /// PLC -> M100.3
  113. /// ModbusTcp -> 1123
  114. /// </summary>
  115. [VariableMonitor("允许到面", "M100.3", "1123")]
  116. public bool AllowFallNoodle { get; set; }
  117. /// <summary>
  118. /// 机器人取面完成
  119. /// PLC -> M100.4
  120. /// ModbusTcp -> 1124
  121. /// </summary>
  122. [VariableMonitor("机器人取面完成", "M100.4", "1124")]
  123. public bool RbTakeNoodleComplete { get; set; }
  124. /// <summary>
  125. /// 机器人倒面完成
  126. /// PLC -> M100.5
  127. /// ModbusTcp -> 1125
  128. /// </summary>
  129. [VariableMonitor("机器人倒面完成", "M100.5", "1125")]
  130. public bool RbFallNoodleComplete { get; set; }
  131. /// <summary>
  132. /// 机器人出餐完成,上报取餐完成
  133. /// PLC -> M100.6
  134. /// ModbusTcp -> 1126
  135. /// </summary>
  136. [VariableMonitor("机器人出餐完成", "M100.6", "1126")]
  137. public bool RbOutMealComplete { get; set; }
  138. /// <summary>
  139. /// 机器人空闲
  140. /// PLC -> M100.7
  141. /// ModbusTcp -> 1127
  142. /// </summary>
  143. [VariableMonitor("机器人空闲", "M100.7", "1127")]
  144. public bool RobotIdle { get; set; }
  145. /// <summary>
  146. /// 取餐口检测
  147. /// PLC -> M101.0
  148. /// ModbusTcp -> 1128
  149. /// </summary>
  150. [VariableMonitor("取餐口检测", "M101.0", "1128")]
  151. public bool TakeMealDetect { get; set; }
  152. /// <summary>
  153. /// 缺碗信号,false:缺碗,true:有碗
  154. /// PLC -> M101.1
  155. /// ModbusTcp -> 1129
  156. /// </summary>
  157. [VariableMonitor("缺碗信号", "M101.1", "1129")]
  158. public bool MissingBowl { get; set; }
  159. /// <summary>
  160. /// 设备初始化中,执行中等于1,2秒后复位
  161. /// PLC -> M101.2
  162. /// ModbusTcp -> 1130
  163. /// </summary>
  164. [VariableMonitor("设备初始化中", "M101.2", "1130")]
  165. public bool DeviceIniting { get; set; }
  166. /// <summary>
  167. /// 转台下限检测
  168. /// PLC -> M101.3
  169. /// ModbusTcp -> 1131
  170. /// </summary>
  171. [VariableMonitor("转台下限检测", "M101.3", "1131")]
  172. public bool TurntableLowerLimit { get; set; }
  173. /// <summary>
  174. /// 缺碗信号 2
  175. /// PLC -> M101.4
  176. /// ModbusTcp -> 1132
  177. /// </summary>
  178. [VariableMonitor("缺碗信号 2", "M101.4", "1132")]
  179. public bool MissingBowlSignal2 { get; set; }
  180. /// <summary>
  181. /// 转台上限检测
  182. /// PLC -> M101.5
  183. /// ModbusTcp -> 1133
  184. /// </summary>
  185. [VariableMonitor("转台上限检测", "M101.5", "1133")]
  186. public bool TurntableUpLimit { get; set; }
  187. /// <summary>
  188. /// 补料完成
  189. /// PLC -> M101.6
  190. /// ModbusTcp -> 1134
  191. /// </summary>
  192. [VariableMonitor("补料完成", "M101.6", "1134")]
  193. public bool FeedComplete { get; set; }
  194. /// <summary>
  195. /// 转台移动到位
  196. /// PLC -> M101.7
  197. /// ModbusTcp -> 1135
  198. /// </summary>
  199. [VariableMonitor("转台移动到位", "M101.7", "1135")]
  200. public bool TurntableMoveInPlace { get; set; }
  201. /// <summary>
  202. /// 煮面炉状态,True:忙碌,false:空闲
  203. /// M102.0 - M102.5
  204. /// 1136 - 1141
  205. /// </summary>
  206. [VariableMonitor("煮面炉状态", "M102.0", "1136")]
  207. public bool[] NoodleCookerStatus { get; set; } = new bool[6] { false, false, false, false, false, false };
  208. /// <summary>
  209. /// 补料中
  210. /// M102.6
  211. /// 1142
  212. /// </summary>
  213. [VariableMonitor("补料中", "M102.6", "1142")]
  214. public bool Feeding { get; set; }
  215. /// <summary>
  216. /// 煮面完成,上升后给信号
  217. /// M103.0 - M103.5
  218. /// 1144 - 1149
  219. /// </summary>
  220. [VariableMonitor("煮面完成", "M103.0", "1144")]
  221. public bool[] CookNoodlesComplete { get; set; } = new bool[6] { false, false, false, false, false, false };
  222. /// <summary>
  223. /// 硬件设备异常
  224. /// PLC -> M235.0
  225. /// True:设备正常,False:设备异常
  226. /// </summary>
  227. [VariableMonitor("硬件设备异常", "M235.0", "")]
  228. public bool Error { get; set; } = false;
  229. /// <summary>
  230. /// 配方编号
  231. /// PLC -> VW0
  232. /// ModbusTcp -> 100
  233. /// </summary>
  234. [VariableMonitor("配方编号", "VW0", "100")]
  235. public ushort RecipeNumber { get; set; }
  236. /// <summary>
  237. /// 转台设置位置
  238. /// PLC -> VW2
  239. /// ModbusTcp -> 101
  240. /// </summary>
  241. [VariableMonitor("转台设置位置", "VW2", "101")]
  242. public ushort TurntableLoc { get; set; }
  243. /// <summary>
  244. /// 到面至煮面炉位置
  245. /// PLC -> VW4
  246. /// ModbusTcp -> 102
  247. /// </summary>
  248. [VariableMonitor("到面至煮面炉位置", "VW4", "102")]
  249. public ushort FallNoodleLoc { get; set; }
  250. /// <summary>
  251. /// 取面位置
  252. /// PLC -> VW6
  253. /// ModbusTcp -> 103
  254. /// </summary>
  255. [VariableMonitor("取面位置", "VW6", "103")]
  256. public ushort TakeNoodleLoc { get; set; }
  257. /// <summary>
  258. /// 转台反馈位置
  259. /// PLC -> VW372
  260. /// ModbusTcp -> 286
  261. /// </summary>
  262. [VariableMonitor("转台反馈位置", "VW372", "286")]
  263. public ushort TurntableFeedbackloc { get; set; }
  264. /// <summary>
  265. /// 机器人取面位置队列
  266. /// </summary>
  267. public ConcurrentQueue<OrderLocInfo> RBTakeNoodleTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();
  268. /// <summary>
  269. /// 出碗队列
  270. /// </summary>
  271. public ConcurrentQueue<OrderLocInfo> TakeBowlTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();
  272. /// <summary>
  273. /// 是否有面条
  274. /// </summary>
  275. public bool IsNoodles { get; set; } = true;
  276. public Dictionary<int, OrderLocInfo> ListOrder { get; set; } = new Dictionary<int, OrderLocInfo>(); //存放当前订单已做好素菜
  277. public Dictionary<int, OrderLocInfo> ListOrderMeat { get; set; } = new Dictionary<int, OrderLocInfo>(); //存放当前订单已做好荤菜
  278. public int DishNumber { set; get; } = 0; //当前订单中配菜的数量
  279. #region 订单ID记录
  280. /// <summary>
  281. /// 取碗订单ID
  282. /// </summary>
  283. public string TakeBowlId = string.Empty;
  284. /// <summary>
  285. /// 配料完成订单ID
  286. /// </summary>
  287. public string IngredientsCompleteId = string.Empty;
  288. /// <summary>
  289. /// 煮面口对应的订单ID
  290. /// </summary>
  291. //public string[] CookNodelId = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, };
  292. public List<CookNodleLocAndId> CookNodelId { get; set; } = new List<CookNodleLocAndId>();
  293. //public string[] CookNodelId = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, };
  294. public OrderLocInfo[] orderLocInfos = new OrderLocInfo[6] { null, null, null, null, null, null };
  295. /// <summary>
  296. /// 出餐订单ID
  297. /// </summary>
  298. public string OutMealId = string.Empty;
  299. /// <summary>
  300. /// 冒菜制作方式,true:加汤,false:不加汤
  301. /// </summary>
  302. public bool OutMealType { get; set; } = false;
  303. /// <summary>
  304. /// 转台位置轮询
  305. /// </summary>
  306. public List<ushort> TurntableLocLists = new List<ushort>();
  307. /// <summary>
  308. /// 转台当前启动位置
  309. /// </summary>
  310. [VariableMonitor("转台当前启动位置")]
  311. public ushort CurrentLoc { get; set; } = 0;
  312. public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>();
  313. public int Num { get; set; } //记录同一个订单是否所有配菜均已出锅
  314. public int Count { get; set; } = 0; //用于素菜的计数
  315. public int CountMeat { get; set; } = 0;//用于荤菜计数
  316. public int Vnum { get; set; } = 0; //单次订单素菜的总数
  317. public int VegtabNum { get; set; } = 0;//记录一个订单中素菜的数量
  318. public int TotalNum { get; set; } = 0; //单次订单的配菜总数
  319. public ConcurrentQueue<Dictionary<string, OrderInformation>> Conqueue = new ConcurrentQueue<Dictionary<string, OrderInformation>>(); //记录订单的ID 以及素菜数量
  320. public bool relock { get; set; } = false; //单次订单互锁
  321. public bool HasVeg { get; set; } //是否有素菜判断
  322. public bool VegNoodlesLock { get; set; } = false; //取面和取餐互锁
  323. public int VegN { get; set; } = 0; //素菜出餐计数
  324. #endregion
  325. }
  326. public class CookNodleLocAndId
  327. {
  328. public string CookNodelId { get; set; }
  329. public int Loc { get; set; }
  330. }
  331. }