终端一体化运控平台
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

377 lignes
14 KiB

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