终端一体化运控平台
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

378 satır
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. [VarComm("Global", "柔性配料料仓配料下发情况")]
  51. /// <summary>
  52. /// 料仓配料情况
  53. /// </summary>
  54. public ushort[] StockBinDosingIssue { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 };
  55. [VarComm("Global", "柔性配料料仓配料下发情况")]
  56. /// <summary>
  57. /// 料仓配料情况
  58. /// </summary>
  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. [VarComm("Global", "托盘1有货架")]
  81. /// <summary>
  82. /// 托盘1有货架
  83. /// </summary>
  84. public bool Station1HaveTray { get; set; }
  85. [VarComm("Global", "托盘2有货架")]
  86. /// <summary>
  87. /// 托盘2有货架
  88. /// </summary>
  89. public bool Station2HaveTray { get; set; }
  90. [VarComm("Global", "托盘1传感器信号")]
  91. /// <summary>
  92. /// 托盘1传感器信号
  93. /// </summary>
  94. public bool Station1Sensor { get; set; }
  95. [VarComm("Global", "托盘2传感器信号")]
  96. /// <summary>
  97. /// 托盘2传感器信号
  98. /// </summary>
  99. public bool Station2Sensor { get; set; }
  100. [VarComm("Global", "托盘1气缸信号")]
  101. /// <summary>
  102. /// 托盘1气缸信号
  103. /// </summary>
  104. public bool Station1Cylinder { get; set; }
  105. [VarComm("Global", "托盘2气缸信号")]
  106. /// <summary>
  107. /// 托盘2气缸信号
  108. /// </summary>
  109. public bool Station2Cylinder { get; set; }
  110. [VarComm("Global", "AGV放托盘1完成")]
  111. /// <summary>
  112. /// AGV放托盘1完成
  113. /// </summary>
  114. public bool AGV_PutTray1Finish { get; set; }
  115. [VarComm("Global", "AGV取托盘1完成")]
  116. /// <summary>
  117. /// AGV取托盘1完成
  118. /// </summary>
  119. public bool AGV_GetTray1Finish { get; set; }
  120. [VarComm("Global", "AGV放托盘2完成")]
  121. /// <summary>
  122. /// AGV放托盘1完成
  123. /// </summary>
  124. public bool AGV_PutTray2Finish { get; set; }
  125. [VarComm("Global", "AGV取托盘2完成")]
  126. /// <summary>
  127. /// AGV取托盘2完成
  128. /// </summary>
  129. public bool AGV_GetTray2Finish { get; set; }
  130. [VarComm("Global", "托盘1气缸复位")]
  131. /// <summary>
  132. /// 托盘1气缸复位
  133. /// </summary>
  134. public bool CylinderReset { get; set; }
  135. [VarComm("Global", "发送给plc的心跳")]
  136. /// <summary>
  137. /// 发送给plc的心跳
  138. /// </summary>
  139. public bool HeartBeatToPlc { get; set; } = false;
  140. [VarComm("Global", "屏蔽小料站料仓不足15个报警")]
  141. public bool DisEnableStockAlarm { get; set; } = false;
  142. [VarComm("Global", "配方制作完成数量")]
  143. /// <summary>
  144. /// 配方制作完成数量
  145. /// </summary>
  146. public int RecipeDosingCompleNum { get; set; } = 0;
  147. [VarComm("Global", "来自plc的心跳")]
  148. /// <summary>
  149. /// 来自plc的心跳
  150. /// </summary>
  151. public bool HeartBeatFromPlc { get; set; } = false;
  152. [VarComm("Global", "是否允许西门子下发配方")]
  153. /// <summary>
  154. /// 是否允许西门子下发配方
  155. /// </summary>
  156. public bool IsAllowSiemensSendRecipe { get; set; } = false;
  157. [VarComm("Global", "西门子下发配方状态0=等待下发配方 1=请求下发配方 2=接收配方 3=配方接收配方完成 4=请求配料 5=西门子确认开始配料 6=西门子确认开始配料信号复位")]
  158. /// <summary>
  159. /// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收配方完成 4:上位机向西门子请求配料 5:西门子确认开始配料 6:西门子确认开始配料 信号复位
  160. /// </summary>
  161. public int SiemensSendRecipeStatus { get; set; } = 0;
  162. [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
  163. /// <summary>
  164. /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
  165. /// </summary>
  166. public int RecipeStatusIDTray1 { get; set; } = 0;
  167. [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料,30:PLC配料完成,返回完成数据。")]
  168. /// <summary>
  169. /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料,30:PLC配料完成,返回完成数据。
  170. /// </summary>
  171. public int[] RecipeProcessStatus { get; set; } = new int[5] { 0, 0, 0, 0, 0 };
  172. [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
  173. /// <summary>
  174. /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
  175. /// </summary>
  176. public bool AGVIsGetTray { get; set; } = false;
  177. [VarComm("Global", "配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
  178. /// <summary>
  179. /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
  180. /// </summary>
  181. public int RecipeStatusIDTray2 { get; set; } = 0;
  182. [VarComm("Global", "当前配方正在配料位置")]
  183. /// <summary>
  184. /// 当前料仓的位置
  185. /// </summary>
  186. public int StockInIsWork { get; set; } = 0;
  187. [VarComm("Global", "设置料仓配料完成")]
  188. /// <summary>
  189. /// 当前料仓的位置
  190. /// </summary>
  191. public bool[] StockInDosingComple { get; set; } = new bool[15];
  192. [VarComm("Global", "是否使用粉仓配料")]
  193. /// <summary>
  194. /// 是否使用粉仓配料
  195. /// </summary>
  196. public bool IsUseWindSend { get; set; } = false;
  197. [VarComm("Global", "粉仓正在配料")]
  198. /// <summary>
  199. /// 粉仓正在配料
  200. /// </summary>
  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. [VarComm("Global", "是否使用本地模拟配方")]
  208. /// <summary>
  209. /// 是否使用本地模拟配方
  210. /// </summary>
  211. public bool IsUseLocalRecipe { get; set; }
  212. [VarComm("Global", "是否使用本地模拟配方")]
  213. /// <summary>
  214. /// 是否使用本地模拟配方
  215. /// </summary>
  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. [VarComm("Global", "粉料仓配料状态")]
  240. /// <summary>
  241. /// 粉料仓配料状态(0:无意义,1:粉料仓下配方,2:plc接收配方完成,3:粉料仓配料完成,4:粉料仓配料完成信号复位,5:排料完成)
  242. /// </summary>
  243. public int WindSendDosingStatus { get; set; } = 0;
  244. [VarComm("Global", "PLC的系统模式 DB44.DBX0.1")]
  245. /// <summary>
  246. /// PLC的系统模式 DB44.DBX0.1
  247. /// </summary>
  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. }