终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

362 lines
13 KiB

  1. using BPASmartClient.FoodStationTest.Model.GVL;
  2. using BPASmartClient.FoodStationTest.Model.HK_PLC;
  3. using System;
  4. using System.Collections.Concurrent;
  5. namespace BPASmartClient.FoodStationTest.Model
  6. {
  7. public class GVL_SmallStation
  8. {
  9. private volatile static GVL_SmallStation SmallStation;
  10. public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation());
  11. private GVL_SmallStation() { }
  12. public PlcReadAddressDB3 plcReadDataDB3 { get; set; } = new PlcReadAddressDB3();
  13. /// <summary>
  14. /// 配料站料仓数目
  15. /// </summary>
  16. public const int Max_DosingSotckBinNum = 15;
  17. /// <summary>
  18. /// 风送料仓数目
  19. /// </summary>
  20. public const int Max_PowderSotckBinNum = 5;
  21. [VarComm("Global", "订单取消")]
  22. /// <summary>
  23. /// 订单取消
  24. /// </summary>
  25. public bool Order_Cancel { get; set; }
  26. [VarComm("Global", "订单取消的配方编号")]
  27. /// <summary>
  28. /// 订单取消的配方编号
  29. /// </summary>
  30. public string Order_CancelRecipeCode { get; set; } = "";
  31. [VarComm("Global", "柔性配料料仓配料下发情况")]
  32. /// <summary>
  33. /// 料仓配料情况
  34. /// </summary>
  35. public bool[] PlcAllowIssueRecipe { get; set; } = new bool[5] { false, false, false, false, false };
  36. [VarComm("Global", "柔性配料料仓,气缸顶起状态")]
  37. /// <summary>
  38. /// 柔性配料料仓,气缸顶起状态
  39. /// </summary>
  40. public ushort StockBinCylinderStatus { get; set; }
  41. [VarComm("Global", "柔性配料料仓配料下发情况")]
  42. /// <summary>
  43. /// 料仓配料情况
  44. /// </summary>
  45. public ushort[] StockBinDosingIssue { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 };
  46. [VarComm("Global", "柔性配料料仓配料下发情况")]
  47. /// <summary>
  48. /// 料仓配料情况
  49. /// </summary>
  50. public ushort[] RecipeStockBinDosing { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 };
  51. [VarComm("Global", "柔性配料料仓配料情况")]
  52. /// <summary>
  53. /// 料仓配料情况
  54. /// </summary>
  55. public ushort StockBinDosing { get; set; } = 0;
  56. [VarComm("Global", "托盘1托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")]
  57. /// <summary>
  58. /// 托盘1托盘到位情况
  59. /// </summary>
  60. public int Tray1LogicFinish { get; set; } = 0;
  61. [VarComm("Global", "托盘1托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")]
  62. /// <summary>
  63. /// 托盘1托盘到位情况
  64. /// </summary>
  65. public int[] Tray_AGVLogic { get; set; } = new int[5] { 0, 0, 0, 0, 0 };
  66. [VarComm("Global", "托盘2托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")]
  67. /// <summary>
  68. /// 托盘2托盘到位 逻辑完成
  69. /// </summary>
  70. public int Tray2LogicFinish { get; set; } = 0;
  71. [VarComm("Global", "托盘1有货架")]
  72. /// <summary>
  73. /// 托盘1有货架
  74. /// </summary>
  75. public bool Station1HaveTray { get; set; }
  76. [VarComm("Global", "托盘2有货架")]
  77. /// <summary>
  78. /// 托盘2有货架
  79. /// </summary>
  80. public bool Station2HaveTray { get; set; }
  81. [VarComm("Global", "托盘1传感器信号")]
  82. /// <summary>
  83. /// 托盘1传感器信号
  84. /// </summary>
  85. public bool Station1Sensor { get; set; }
  86. [VarComm("Global", "托盘2传感器信号")]
  87. /// <summary>
  88. /// 托盘2传感器信号
  89. /// </summary>
  90. public bool Station2Sensor { get; set; }
  91. [VarComm("Global", "托盘1气缸信号")]
  92. /// <summary>
  93. /// 托盘1气缸信号
  94. /// </summary>
  95. public bool Station1Cylinder { get; set; }
  96. [VarComm("Global", "托盘2气缸信号")]
  97. /// <summary>
  98. /// 托盘2气缸信号
  99. /// </summary>
  100. public bool Station2Cylinder { get; set; }
  101. [VarComm("Global", "AGV放托盘1完成")]
  102. /// <summary>
  103. /// AGV放托盘1完成
  104. /// </summary>
  105. public bool AGV_PutTray1Finish { get; set; }
  106. [VarComm("Global", "AGV取托盘1完成")]
  107. /// <summary>
  108. /// AGV取托盘1完成
  109. /// </summary>
  110. public bool AGV_GetTray1Finish { get; set; }
  111. [VarComm("Global", "AGV放托盘2完成")]
  112. /// <summary>
  113. /// AGV放托盘1完成
  114. /// </summary>
  115. public bool AGV_PutTray2Finish { get; set; }
  116. [VarComm("Global", "AGV取托盘2完成")]
  117. /// <summary>
  118. /// AGV取托盘2完成
  119. /// </summary>
  120. public bool AGV_GetTray2Finish { get; set; }
  121. [VarComm("Global", "托盘1气缸复位")]
  122. /// <summary>
  123. /// 托盘1气缸复位
  124. /// </summary>
  125. public bool CylinderReset { get; set; }
  126. [VarComm("Global", "发送给plc的心跳")]
  127. /// <summary>
  128. /// 发送给plc的心跳
  129. /// </summary>
  130. public bool HeartBeatToPlc { get; set; } = false;
  131. [VarComm("Global", "屏蔽小料站料仓不足15个报警")]
  132. public bool DisEnableStockAlarm { get; set; } = false;
  133. [VarComm("Global", "配方制作完成数量")]
  134. /// <summary>
  135. /// 配方制作完成数量
  136. /// </summary>
  137. public int RecipeDosingCompleNum { get; set; } = 0;
  138. [VarComm("Global", "来自plc的心跳")]
  139. /// <summary>
  140. /// 来自plc的心跳
  141. /// </summary>
  142. public bool HeartBeatFromPlc { get; set; } = false;
  143. [VarComm("Global", "是否允许西门子下发配方")]
  144. /// <summary>
  145. /// 是否允许西门子下发配方
  146. /// </summary>
  147. public bool IsAllowSiemensSendRecipe { get; set; } = false;
  148. [VarComm("Global", "西门子下发配方状态0=等待下发配方 1=请求下发配方 2=接收配方 3=配方接收配方完成 4=请求配料 5=西门子确认开始配料 6=西门子确认开始配料信号复位")]
  149. /// <summary>
  150. /// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收配方完成 4:上位机向西门子请求配料 5:西门子确认开始配料 6:西门子确认开始配料 信号复位
  151. /// </summary>
  152. public int SiemensSendRecipeStatus { get; set; } = 0;
  153. [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
  154. /// <summary>
  155. /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
  156. /// </summary>
  157. public int RecipeStatusIDTray1 { get; set; } = 0;
  158. [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
  159. /// <summary>
  160. /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
  161. /// </summary>
  162. public int[] RecipeProcessStatus { get; set; } = new int[5] { 0, 0, 0, 0, 0 };
  163. [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
  164. /// <summary>
  165. /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
  166. /// </summary>
  167. public bool AGVIsGetTray { get; set; } = false;
  168. [VarComm("Global", "配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
  169. /// <summary>
  170. /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
  171. /// </summary>
  172. public int RecipeStatusIDTray2 { get; set; } = 0;
  173. [VarComm("Global", "当前配方正在配料位置")]
  174. /// <summary>
  175. /// 当前料仓的位置
  176. /// </summary>
  177. public int StockInIsWork { get; set; } = 0;
  178. [VarComm("Global", "设置料仓配料完成")]
  179. /// <summary>
  180. /// 当前料仓的位置
  181. /// </summary>
  182. public bool[] StockInDosingComple { get; set; } = new bool[15];
  183. [VarComm("Global", "粉仓正在配料")]
  184. /// <summary>
  185. /// 粉仓正在配料
  186. /// </summary>
  187. public bool WindSendDosing { get; set; } = false;
  188. /// <summary>
  189. /// 所有气缸的信号
  190. /// </summary>
  191. public bool[] Cylinder_JackInfo { get; set; } = new bool[30];
  192. #region 本地模拟配方
  193. [VarComm("Global", "是否使用本地模拟配方")]
  194. /// <summary>
  195. /// 是否使用本地模拟配方
  196. /// </summary>
  197. public bool IsUseLocalRecipe { get; set; }
  198. [VarComm("Global", "是否使用本地模拟配方")]
  199. /// <summary>
  200. /// 是否使用本地模拟配方
  201. /// </summary>
  202. public bool NotUseSmallStation { get; set; }
  203. /// <summary>
  204. /// 配料时间
  205. /// </summary>
  206. public DateTime time1;
  207. /// <summary>
  208. /// 配料时间
  209. /// </summary>
  210. public DateTime[] DosingTime = new DateTime[5] { DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now };
  211. /// <summary>
  212. /// 原料的名称和原料编号对应,Mes提供的信息
  213. /// </summary>
  214. public ConcurrentDictionary<string, string> RawMaterialsNameCode { get; set; } = new ConcurrentDictionary<string, string>();
  215. [VarComm("Global", "风送是否允许AGV到工站")]
  216. /// <summary>
  217. /// 风送是否允许AGV到工站
  218. /// </summary>
  219. public bool WindSendAllowAGVPutGet { get; set; } = false;
  220. [VarComm("Global", "粉料仓配料完成")]
  221. /// <summary>
  222. /// 粉料仓配料完成
  223. /// </summary>
  224. public bool WindSendDosingComple { get; set; } = false;
  225. [VarComm("Global", "粉料仓配料状态")]
  226. /// <summary>
  227. /// 粉料仓配料状态(0:无意义,1:粉料仓下配方,2:plc接收配方完成,3:粉料仓配料完成,4:粉料仓配料完成信号复位,5:排料完成)
  228. /// </summary>
  229. public int WindSendDosingStatus { get; set; } = 0;
  230. [VarComm("Global", "PLC的系统模式 DB44.DBX0.1")]
  231. /// <summary>
  232. /// PLC的系统模式 DB44.DBX0.1
  233. /// </summary>
  234. public bool PlcSystemMode { get; set; } = false;
  235. [VarComm("Global", "PLC的系统模式 DB44.DBX0.1")]
  236. /// <summary>
  237. /// 不使用15个料仓报警
  238. /// </summary>
  239. public bool DisEnableStockBinAlarm { get; set; } = false;
  240. [VarComm("Global", "PLC的系统自动启停 DB44.DBX0.0")]
  241. /// <summary>
  242. /// PLC的系统自动启停 DB44.DBX0.0
  243. /// </summary>
  244. public bool PlcSystemIsAutoRun { get; set; } = false;
  245. [VarComm("Global", "PLC的系统自动暂停/开始 DB44.DBX0.2")]
  246. /// <summary>
  247. /// PLC的系统自动暂停/开始 DB44.DBX0.2
  248. /// </summary>
  249. public bool PlcSystemIsPause { get; set; } = false;
  250. [VarComm("Global", "延迟采集料仓的配料完成重量")]
  251. /// <summary>
  252. /// 延迟采集料仓的配料完成重量
  253. /// </summary>
  254. public int Time { get; set; } = 2000;
  255. [VarComm("Global", "取消订单的步骤号")]
  256. /// <summary>
  257. /// 取消订单的步骤: 1-9:配料过程中配方1取消配方 10-19:配料过程中配方2取消配方 20-29:下发订单的过程中取消订单(订单未到达上位机) 30-39:下发订单的过程中取消订单(订单未到达PLC)
  258. /// </summary>
  259. public int OrderCancelStep { get; set; } = 0;
  260. [VarComm("Global", "机器人的状态")]
  261. /// <summary>
  262. /// 机器人的状态
  263. /// </summary>
  264. public ushort RobotStatus { get; set; } = 0;
  265. [VarComm("Global", "机器人的程序号")]
  266. /// <summary>
  267. /// 机器人的程序号
  268. /// </summary>
  269. public byte RobotProgramNum { get; set; } = 0;
  270. /// <summary>
  271. /// 最近一次下发订单的时间
  272. /// </summary>
  273. public DateTime LatestIssueRecipe { get; set; } = new DateTime(2023, 5, 1, 00, 00, 00);
  274. #endregion
  275. }
  276. public enum IssueRecipeCondition
  277. {
  278. 等待小料站PLC允许下配方,
  279. 等待西门子下发配方,
  280. 等待西门子下发配方信号复位,
  281. 等待上位机请求配料,
  282. 等待西门子确认配料,
  283. 等待西门子确认配料信号复位,
  284. }
  285. public enum ProcessCondition
  286. {
  287. 等待AGV到位,
  288. 等待小料站PLC接受配方完成,
  289. 等待配方配料完成,
  290. 等待AGV取托盘完成
  291. }
  292. }