终端一体化运控平台
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.
 
 
 

1762 rivejä
108 KiB

  1. using BPASmartClient.CustomResource.Pages.Model;
  2. using BPA.Helper;
  3. using BPASmartClient.JXJFoodSmallStation.Model.GVL;
  4. using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
  5. using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;
  6. using BPASmartClient.JXJFoodSmallStation.Model.Siemens;
  7. using BPASmartClient.JXJFoodSmallStation.Model.WindSend;
  8. using BPASmartClient.Modbus;
  9. using System;
  10. using System.Collections.Concurrent;
  11. using System.Collections.Generic;
  12. using System.Collections.ObjectModel;
  13. using System.Configuration;
  14. using System.Linq;
  15. using System.Reflection;
  16. using System.Text;
  17. using System.Threading;
  18. using System.Threading.Tasks;
  19. namespace BPASmartClient.JXJFoodSmallStation.Model
  20. {
  21. public class ProcessControl
  22. {
  23. private volatile static ProcessControl _Instance;
  24. public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl());
  25. private ProcessControl() { }
  26. /// <summary>
  27. /// 配方数据
  28. /// </summary>
  29. public ObservableCollection<RecipeData> RemoteRecipes = new ObservableCollection<RecipeData>();
  30. /// <summary>
  31. /// 原料的名称和料仓的位置对应
  32. /// </summary>
  33. public Dictionary<string, short> RawMaterialsNamePos = new Dictionary<string, short>();
  34. public ObservableCollection<RawMaterialStockBin> RawMaterialsInfo => Json<DevicePar>.Data.rawMaterialStockBin;
  35. /// <summary>
  36. /// 配方队列
  37. /// </summary>
  38. public ConcurrentQueue<string> RecipeQueueTray1 = new ConcurrentQueue<string>();
  39. /// <summary>
  40. /// 物料集合(工位配方集合,五个键分别对应五个工位)
  41. /// </summary>
  42. public Dictionary<int, ConcurrentQueue<string>> RecipeQueueTray { get; set; } = new Dictionary<int, ConcurrentQueue<string>>();
  43. public ConcurrentQueue<string> RecipeQueueTray2 = new ConcurrentQueue<string>();
  44. //XL_Finish_DB RecipeFinishInfo = new XL_Finish_DB();
  45. //public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
  46. public HKDeviceStatus HKDevice = new HKDeviceStatus();
  47. public WindSendDeviceStatus WindSendDevice = new WindSendDeviceStatus();
  48. public ObservableCollection<PlcInfos> CommData { get; set; } = new ObservableCollection<PlcInfos>();
  49. public ObservableCollection<PlcInfos> ProcessVar { get; set; } = new ObservableCollection<PlcInfos>();
  50. /// <summary>
  51. /// 风送PLC的DB块
  52. /// </summary>
  53. WindSend_Write WindSendData = new WindSend_Write();
  54. public DateTime StockBinAlarmTime = DateTime.Now;
  55. public string? HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"];
  56. public string? Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"];
  57. public string? WindSend_PLC_IP = ConfigurationManager.AppSettings["WindSend_IP"];
  58. public void Init()
  59. {
  60. for (int i = 0; i < 5; i++)
  61. {
  62. RecipeQueueTray.TryAdd(i, new());
  63. }
  64. PlcVarMonitor();
  65. StockBinNameWithPos();
  66. RawMaterialNameWithCode();
  67. RegisterInit();
  68. DeviceConnect();
  69. //Json<RemoteRecipeDataColl>.Data.RemoteRecipes = TestData.GetInstance.RemoteRecipes;//添加测试数据
  70. TaskManage.GetInstance.StartLong(new Action(() =>
  71. {
  72. GVL_SmallStation.GetInstance.DisEnableStockAlarm = Json<DevicePar>.Data.deviceConnectPar.ShieldStockbinAlarm;
  73. if (HKDevice.IsConnected)
  74. {
  75. GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc;
  76. HKDevice.HK_PLC_S7.Write("DB4.DBX0.0", GVL_SmallStation.GetInstance.HeartBeatToPlc);
  77. GVL_SmallStation.GetInstance.HeartBeatFromPlc = HKDevice.HK_PLC_S7.Read<bool>("DB45.DBX0.0");
  78. if (DeviceInquire.GetInstance.devices.Count < 15 && HKDevice.IsConnected && Json<RemoteRecipeDataColl>.Data.RemoteRecipes.Count > 0 && GVL_SmallStation.GetInstance.DisEnableStockBinAlarm == false && DateTime.Now.Subtract(StockBinAlarmTime).TotalSeconds >= 60 & !GVL_SmallStation.GetInstance.DisEnableStockAlarm)
  79. {
  80. HKDevice.HK_PLC_S7.Write("DB44.DBX3.0", true);
  81. App.Current.Dispatcher.Invoke(() =>
  82. {
  83. MessageNotify.GetInstance.ShowDialog($"未读取到15个柔性味魔方料仓", DialogType.Error);
  84. StockBinAlarmTime = DateTime.Now;
  85. });
  86. HKDevice.HK_PLC_S7.Write("DB44.DBX3.0", false);
  87. }
  88. }
  89. Thread.Sleep(200);
  90. }), "海科plc通信心跳", true);
  91. TaskManage.GetInstance.StartLong(new Action(() =>
  92. {
  93. if (GVL_SmallStation.GetInstance.Order_Cancel)
  94. {
  95. CancelOrder();//订单取消,不执行配方流程
  96. }
  97. else
  98. {
  99. ReceviceData();//配方请求
  100. RecipeInfoToHKPLC();//配方配料
  101. }
  102. Thread.Sleep(10);
  103. }), "小料站流程控制", true);
  104. TaskManage.GetInstance.StartLong(new Action(() =>
  105. {
  106. RealTimeData();
  107. foreach (var item in Json<DevicePar>.Data.windSendRawMaterial)
  108. {
  109. if (GVL_SmallStation.GetInstance.RawMaterialsNameCode.ContainsKey(item.RawMaterialName))
  110. {
  111. item.RawMaterialChineseName = GVL_SmallStation.GetInstance.RawMaterialsNameCode[item.RawMaterialName];
  112. }
  113. else
  114. {
  115. item.RawMaterialChineseName = "";
  116. }
  117. }
  118. Thread.Sleep(10);
  119. }), "西门子PLC和小料站PLC的实时数据交互流程", true);
  120. TaskManage.GetInstance.StartLong(new Action(() =>
  121. {
  122. HKPlcRead();
  123. GetStatus();
  124. Thread.Sleep(10);
  125. }), "海科PLC实时数据", true);
  126. }
  127. /// <summary>
  128. /// 气缸的传感器值
  129. /// </summary>
  130. private void GetStatus()
  131. {
  132. for (int i = 0; i < 8; i++)
  133. {
  134. GVL_SmallStation.GetInstance.Cylinder_JackInfo[i] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX0." + i);
  135. }
  136. for (int i = 0; i < 7; i++)
  137. {
  138. GVL_SmallStation.GetInstance.Cylinder_JackInfo[i + 8] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX1." + i);
  139. }
  140. GVL_SmallStation.GetInstance.Cylinder_JackInfo[20] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX3.6");//进料桶气缸
  141. GVL_SmallStation.GetInstance.Cylinder_JackInfo[21] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX3.7");//出料筒气缸1
  142. GVL_SmallStation.GetInstance.Cylinder_JackInfo[22] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX4.0");//出料筒气缸2
  143. GVL_SmallStation.GetInstance.Cylinder_JackInfo[23] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX4.1");//出料筒气缸3
  144. GVL_SmallStation.GetInstance.Cylinder_JackInfo[24] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX4.2");//托盘1_1气缸
  145. GVL_SmallStation.GetInstance.Cylinder_JackInfo[25] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX4.3");//托盘1_2气缸
  146. GVL_SmallStation.GetInstance.Cylinder_JackInfo[26] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX4.4");//托盘2_1气缸
  147. GVL_SmallStation.GetInstance.Cylinder_JackInfo[27] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX4.5");//托盘2_2气缸
  148. }
  149. /// <summary>
  150. /// DB块的变量实时值
  151. /// </summary>
  152. private void HKPlcRead()
  153. {
  154. //读取配料PLC的DB3的值
  155. if (HKDevice.IsConnected)
  156. {
  157. foreach (PropertyInfo item in typeof(PlcReadAddressDB3).GetProperties())
  158. {
  159. int index = Array.FindIndex(CommData.ToArray(), p => p.Name == item.Name);
  160. if (index >= 0)
  161. {
  162. if (item.PropertyType.IsArray)
  163. {
  164. CommData.ElementAt(index).Value = "";
  165. Array array = (Array)item.GetValue(GVL_SmallStation.GetInstance.plcReadDataDB3, null);
  166. foreach (var values in array)
  167. {
  168. string data = values.ToString();
  169. if (data.ToLower() == "false")
  170. data = "0";
  171. if (data.ToLower() == "true")
  172. data = "1";
  173. CommData.ElementAt(index).Value = CommData.ElementAt(index).Value + data + ",";
  174. }
  175. }
  176. else
  177. {
  178. CommData.ElementAt(index).Value = GVL_SmallStation.GetInstance.plcReadDataDB3.GetType().GetProperty(item.Name).GetValue(GVL_SmallStation.GetInstance.plcReadDataDB3, null).ToString();
  179. }
  180. }
  181. }
  182. }
  183. if (WindSendDevice.IsConnected)
  184. {
  185. foreach (PropertyInfo item in typeof(WindSend_Write).GetProperties())
  186. {
  187. int index = Array.FindIndex(CommData.ToArray(), p => p.Name == item.Name);
  188. if (index >= 0)
  189. {
  190. if (item.PropertyType.IsArray)
  191. {
  192. CommData.ElementAt(index).Value = "";
  193. Array array = (Array)item.GetValue(GVL_SmallStation.GetInstance.plcReadDataDB3, null);
  194. foreach (var values in array)
  195. {
  196. string data = values.ToString();
  197. if (data.ToLower() == "false")
  198. data = "0";
  199. if (data.ToLower() == "true")
  200. data = "1";
  201. CommData.ElementAt(index).Value = CommData.ElementAt(index).Value + data + ",";
  202. }
  203. }
  204. else
  205. {
  206. CommData.ElementAt(index).Value = GVL_SmallStation.GetInstance.WindSendDB95.GetType().GetProperty(item.Name).GetValue(GVL_SmallStation.GetInstance.WindSendDB95, null).ToString();
  207. }
  208. }
  209. }
  210. foreach (PropertyInfo item in typeof(WindSend_Read).GetProperties())
  211. {
  212. int index = Array.FindIndex(CommData.ToArray(), p => p.Name == item.Name);
  213. if (index >= 0)
  214. {
  215. if (item.PropertyType.IsArray)
  216. {
  217. CommData.ElementAt(index).Value = "";
  218. Array array = (Array)item.GetValue(GVL_SmallStation.GetInstance.plcReadDataDB3, null);
  219. foreach (var values in array)
  220. {
  221. string data = values.ToString();
  222. if (data.ToLower() == "false")
  223. data = "0";
  224. if (data.ToLower() == "true")
  225. data = "1";
  226. CommData.ElementAt(index).Value = CommData.ElementAt(index).Value + data + ",";
  227. }
  228. }
  229. else
  230. {
  231. CommData.ElementAt(index).Value = GVL_SmallStation.GetInstance.WindSendDB94.GetType().GetProperty(item.Name).GetValue(GVL_SmallStation.GetInstance.WindSendDB94, null).ToString();
  232. }
  233. }
  234. }
  235. }
  236. foreach (PropertyInfo item in typeof(GVL_SmallStation).GetProperties())
  237. {
  238. int index = Array.FindIndex(ProcessVar.ToArray(), p => p.Name == item.Name);
  239. if (index >= 0)
  240. {
  241. if (item.PropertyType.IsArray)
  242. {
  243. ProcessVar.ElementAt(index).Value = "";
  244. Array array = (Array)item.GetValue(GVL_SmallStation.GetInstance, null);
  245. foreach (var values in array)
  246. {
  247. string data = values.ToString();
  248. if (data.ToLower() == "false")
  249. data = "0";
  250. if (data.ToLower() == "true")
  251. data = "1";
  252. ProcessVar.ElementAt(index).Value = ProcessVar.ElementAt(index).Value + data + ",";
  253. }
  254. }
  255. else
  256. {
  257. ProcessVar.ElementAt(index).Value = GVL_SmallStation.GetInstance.GetType().GetProperty(item.Name).GetValue(GVL_SmallStation.GetInstance, null).ToString();
  258. }
  259. }
  260. }
  261. }
  262. /// <summary>
  263. /// 小料站和西门子PLC之间的实时数据
  264. /// </summary>
  265. private void RealTimeData()
  266. {
  267. if (HKDevice.IsConnected)
  268. {
  269. //获取系统状态
  270. GVL_SmallStation.GetInstance.PlcSystemIsAutoRun = HKDevice.HK_PLC_S7.Read<bool>("DB44.DBX0.0");//系统启停
  271. GVL_SmallStation.GetInstance.PlcSystemMode = HKDevice.HK_PLC_S7.Read<bool>("DB44.DBX0.1");//系统模式
  272. GVL_SmallStation.GetInstance.PlcSystemIsPause = HKDevice.HK_PLC_S7.Read<bool>("DB44.DBX0.2");//系统暂停
  273. GVL_SmallStation.GetInstance.Station1HaveTray = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX40.0");//工站1 有货架
  274. GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[0] = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.0");
  275. GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[1] = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.1");
  276. GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[2] = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.2");
  277. GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[3] = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.3");
  278. GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[4] = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.4");
  279. if (GVL_SmallStation.GetInstance.WindSendDosingComple)
  280. {
  281. //HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX1.7", true);
  282. HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX4.0", true);
  283. GVL_SmallStation.GetInstance.WindSendDosingComple = false;
  284. MessageNotify.GetInstance.ShowRunLog("风送配料完成信号,发给产线plc信号");
  285. }
  286. //if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1"))
  287. //{
  288. // HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX1.7", false);
  289. //}
  290. /*if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.7"))//允许下配方1或者允许下配方2
  291. {
  292. GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe = true;
  293. }*/
  294. //for (int i = 0; i < 5; i++)
  295. //{
  296. // if (GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[i] && RecipeQueueTray[i].Count == 0)
  297. // {
  298. // GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe = true;
  299. // }
  300. //}
  301. //GVL_SmallStation.GetInstance.Station1Sensor = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.1");
  302. //GVL_SmallStation.GetInstance.Station2Sensor = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.2");
  303. //GVL_SmallStation.GetInstance.Station1Cylinder = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.3");
  304. //GVL_SmallStation.GetInstance.Station2Cylinder = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.4");
  305. //GVL_SmallStation.GetInstance.RobotStatus = HKDevice.HK_PLC_S7.Read<ushort>("DB3.DBW100");
  306. //GVL_SmallStation.GetInstance.RobotProgramNum = HKDevice.HK_PLC_S7.Read<byte>("DB3.DBB102");
  307. if (Json<RemoteRecipeDataColl>.Data.RemoteRecipes.Count <= 3)
  308. {
  309. GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe = true;
  310. }
  311. GVL_SmallStation.GetInstance.Station1Sensor = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX40.1");
  312. GVL_SmallStation.GetInstance.Station1Cylinder = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX40.2");
  313. GVL_SmallStation.GetInstance.RobotStatus = HKDevice.HK_PLC_S7.Read<byte>("DB3.DBB0");
  314. GVL_SmallStation.GetInstance.RobotProgramNum = HKDevice.HK_PLC_S7.Read<byte>("DB3.DBB1");
  315. }
  316. //if (SiemensDevice.IsConnected)
  317. //{
  318. ushort TrayCylinder = 0;
  319. ushort TraySensor = 0;
  320. if (GVL_SmallStation.GetInstance.Station1Sensor)
  321. {
  322. TraySensor = TraySensor.SetBitValue(1, true);
  323. }
  324. else
  325. {
  326. TraySensor = TraySensor.SetBitValue(0, false);
  327. }
  328. if (!GVL_SmallStation.GetInstance.Station1Cylinder)
  329. {
  330. TrayCylinder = TrayCylinder.SetBitValue(1, true);
  331. }
  332. else
  333. {
  334. TrayCylinder = TrayCylinder.SetBitValue(0, false);
  335. }
  336. //this.SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2231.DBX28.4", GVL_SmallStation.GetInstance.WindSendAllowAGVPutGet);
  337. //this.SiemensDevice.Siemens_PLC_S7.Write<ushort>("DB2231.DBW190", TraySensor);//添加工位传感器的信号
  338. //this.SiemensDevice.Siemens_PLC_S7.Write<ushort>("DB2231.DBW192", TrayCylinder);//添加工位气缸的信号
  339. ushort AGV_Put =0 /*(ushort)SiemensDevice.XL_Status.AgvFinishPut*/;
  340. if (AGV_Put.GetBitValue(1))
  341. {
  342. GVL_SmallStation.GetInstance.AGV_PutTray1Finish = true;
  343. }
  344. else
  345. {
  346. GVL_SmallStation.GetInstance.AGV_PutTray1Finish = false;
  347. }
  348. ushort AGV_Get =0/* (ushort)SiemensDevice.XL_Status.AgvFinishGet*/;
  349. if (AGV_Get.GetBitValue(1))
  350. {
  351. GVL_SmallStation.GetInstance.AGV_GetTray1Finish = true;
  352. }
  353. else
  354. {
  355. GVL_SmallStation.GetInstance.AGV_GetTray1Finish = false;
  356. }
  357. //}
  358. }
  359. public void CancelOrder()
  360. {
  361. if (GVL_SmallStation.GetInstance.Order_Cancel) //订单取消
  362. {
  363. if (!string.IsNullOrEmpty(GVL_SmallStation.GetInstance.Order_CancelRecipeCode))
  364. {
  365. string code = GVL_SmallStation.GetInstance.Order_CancelRecipeCode;
  366. int index = Array.FindIndex(Json<RemoteRecipeDataColl>.Data.RemoteRecipes.ToArray(), p => p.RecipeCode == code);
  367. int[] cnt = new int[5] { -1, -1, -1, -1, -1 };
  368. int index1 = -1;
  369. for (int i = 0; i < 5; i++)
  370. {
  371. cnt[i] = Array.FindIndex(RecipeQueueTray[i].ToArray(), p => p == code);
  372. if (cnt[i] >= 0)
  373. {
  374. index1 = i;
  375. }
  376. }
  377. switch (GVL_SmallStation.GetInstance.OrderCancelStep)
  378. {
  379. case 0://前提条件判断
  380. if (index == -1)
  381. {
  382. GVL_SmallStation.GetInstance.OrderCancelStep = 30;
  383. MessageNotify.GetInstance.ShowRunLog($"配方中并未找到订单{code}");
  384. }
  385. else
  386. {
  387. if (index1 >= 0)
  388. {
  389. GVL_SmallStation.GetInstance.OrderCancelStep = 1;
  390. }
  391. else
  392. {
  393. GVL_SmallStation.GetInstance.OrderCancelStep = 20;
  394. }
  395. }
  396. break;
  397. //Case 1-9为
  398. case 1:
  399. if (GVL_SmallStation.GetInstance.RecipeProcessStatus[index] != 0)
  400. {
  401. GVL_SmallStation.GetInstance.RecipeProcessStatus[index] = 0;
  402. HKDevice.HK_PLC_S7.Write("DB4.DBX6." + index1, true);
  403. MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,正在取消订单:{code}");
  404. GVL_SmallStation.GetInstance.OrderCancelStep = 2;
  405. }
  406. else
  407. {
  408. MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
  409. GVL_SmallStation.GetInstance.OrderCancelStep = 3;
  410. }
  411. break;
  412. case 2:
  413. if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX42." + index1))
  414. {
  415. if (GVL_SmallStation.GetInstance.Station1Cylinder == false)
  416. {
  417. GVL_SmallStation.GetInstance.OrderCancelStep = 3;
  418. MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}");
  419. }
  420. }
  421. break;
  422. case 3:
  423. //SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
  424. GVL_SmallStation.GetInstance.OrderCancelStep = 4;
  425. break;
  426. case 4:
  427. //if (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2201.DBX440.1") == false)
  428. //{
  429. // SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
  430. GVL_SmallStation.GetInstance.OrderCancelStep = 9;
  431. MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
  432. //}
  433. break;
  434. case 9:
  435. App.Current.Dispatcher.Invoke(() =>
  436. {
  437. Json<RemoteRecipeDataColl>.Data.RemoteRecipes.RemoveAt(index);
  438. });
  439. RecipeQueueTray1.TryDequeue(out code);
  440. GVL_SmallStation.GetInstance.RecipeProcessStatus[index] = 0;
  441. GVL_SmallStation.GetInstance.Order_Cancel = false;
  442. GVL_SmallStation.GetInstance.Order_CancelRecipeCode = "";
  443. GVL_SmallStation.GetInstance.OrderCancelStep = 0;
  444. break;
  445. case 20:
  446. //SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
  447. GVL_SmallStation.GetInstance.OrderCancelStep = 21;
  448. break;
  449. case 21:
  450. //if (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2201.DBX440.1") == false)
  451. //{
  452. // SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
  453. GVL_SmallStation.GetInstance.OrderCancelStep = 29;
  454. MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
  455. //}
  456. break;
  457. case 29:
  458. App.Current.Dispatcher.Invoke(() =>
  459. {
  460. Json<RemoteRecipeDataColl>.Data.RemoteRecipes.RemoveAt(index);
  461. });
  462. GVL_SmallStation.GetInstance.Order_Cancel = false;
  463. GVL_SmallStation.GetInstance.Order_CancelRecipeCode = "";
  464. GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 0;
  465. GVL_SmallStation.GetInstance.OrderCancelStep = 0;
  466. break;
  467. //30-39为订单还未下发至上位机
  468. case 30:
  469. //SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
  470. GVL_SmallStation.GetInstance.OrderCancelStep = 31;
  471. break;
  472. case 31:
  473. //if (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2201.DBX440.1") == false)
  474. //{
  475. // SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
  476. GVL_SmallStation.GetInstance.OrderCancelStep = 39;
  477. MessageNotify.GetInstance.ShowRunLog($"西门子取消订单完成,订单号:{code}");
  478. //}
  479. break;
  480. case 39:
  481. GVL_SmallStation.GetInstance.Order_Cancel = false;
  482. GVL_SmallStation.GetInstance.Order_CancelRecipeCode = "";
  483. GVL_SmallStation.GetInstance.OrderCancelStep = 0;
  484. break;
  485. }
  486. }
  487. }
  488. }
  489. /// <summary>
  490. /// 将配方添加到配方队列中
  491. /// </summary>
  492. private void ReceviceData()
  493. {
  494. if (!GVL_SmallStation.GetInstance.IsUseLocalRecipe)
  495. {
  496. RemoteRecipes = Json<RemoteRecipeDataColl>.Data.RemoteRecipes;
  497. if (RemoteRecipes.Count > 0)
  498. {
  499. foreach (var data in RemoteRecipes)
  500. {
  501. //if (data.TrayCode == 1)
  502. //{
  503. //if (SiemensDevice.XL_Status is XL_Status_DB status)
  504. //{
  505. switch (GVL_SmallStation.GetInstance.SiemensSendRecipeStatus)
  506. {
  507. case 3:
  508. // SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode, 10);
  509. //SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", true);
  510. GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 4;
  511. MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},请求配料");
  512. break;
  513. case 4:
  514. //if (SiemensDevice.XL_Status.Dosing_Confirm)
  515. //{
  516. // SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10);//复位字符串
  517. // SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false);
  518. GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 5;
  519. MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},西门子确认配料");
  520. // }
  521. break;
  522. case 5:
  523. //if (SiemensDevice.XL_Status.Dosing_Confirm == false)
  524. //{
  525. GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 6;
  526. MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},西门子确认配料信号复位完成");
  527. //}
  528. break;
  529. case 6:
  530. for (int i = 0; i < 5; i++)
  531. {
  532. if (GVL_SmallStation.GetInstance.NotUseSmallStation)
  533. {
  534. if (RecipeQueueTray[i].Count == 0 && !RecipeQueueTray[0].Contains(data.RecipeCode) && !RecipeQueueTray[1].Contains(data.RecipeCode) && !RecipeQueueTray[2].Contains(data.RecipeCode) && !RecipeQueueTray[3].Contains(data.RecipeCode) && !RecipeQueueTray[4].Contains(data.RecipeCode))
  535. {
  536. RecipeQueueTray[i].Enqueue(data.RecipeCode);
  537. GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 0;
  538. MessageNotify.GetInstance.ShowRunLog($"西门子配方配料 ,不使用小料配料,配方{data.RecipeCode},加入配方{i}");
  539. }
  540. }
  541. else if (GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[i])
  542. {
  543. if (RecipeQueueTray[i].Count == 0 && !RecipeQueueTray[0].Contains(data.RecipeCode) && !RecipeQueueTray[1].Contains(data.RecipeCode) && !RecipeQueueTray[2].Contains(data.RecipeCode) && !RecipeQueueTray[3].Contains(data.RecipeCode) && !RecipeQueueTray[4].Contains(data.RecipeCode))
  544. {
  545. RecipeQueueTray[i].Enqueue(data.RecipeCode);
  546. GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 0;
  547. MessageNotify.GetInstance.ShowRunLog($"西门子配方配料 ,等待plc允许配料,配方{data.RecipeCode},加入配方{i}");
  548. }
  549. }
  550. }
  551. break;
  552. default:
  553. break;
  554. //}
  555. }
  556. //}
  557. }
  558. }
  559. else
  560. {
  561. for (int i = 0; i < 5; i++)
  562. {
  563. RecipeQueueTray[i].Clear();
  564. GVL_SmallStation.GetInstance.RecipeProcessStatus[i] = 0;
  565. }
  566. GVL_SmallStation.GetInstance.WindSendDosingStatus = 0;
  567. GVL_SmallStation.GetInstance.WindSendDosing = false;
  568. }
  569. }
  570. else
  571. {
  572. RemoteRecipes = Json<RemoteRecipeDataColl>.Data.RemoteRecipes;
  573. if (RemoteRecipes.Count > 0)
  574. {
  575. foreach (var data in RemoteRecipes)
  576. {
  577. //if (data.TrayCode == 1)
  578. //{
  579. for (int i = 0; i < 5; i++)
  580. {
  581. if (GVL_SmallStation.GetInstance.NotUseSmallStation)
  582. {
  583. if (RecipeQueueTray[i].Count == 0 && !RecipeQueueTray[0].Contains(data.RecipeCode) && !RecipeQueueTray[1].Contains(data.RecipeCode) && !RecipeQueueTray[2].Contains(data.RecipeCode) && !RecipeQueueTray[3].Contains(data.RecipeCode) && !RecipeQueueTray[4].Contains(data.RecipeCode))
  584. {
  585. RecipeQueueTray[i].Enqueue(data.RecipeCode);
  586. MessageNotify.GetInstance.ShowRunLog($"本地配方配料 ,不使用小料配料,配方{data.RecipeCode},加入配方{i}");
  587. }
  588. }
  589. else if (GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[i])
  590. {
  591. if (RecipeQueueTray[i].Count == 0 && !RecipeQueueTray[0].Contains(data.RecipeCode) && !RecipeQueueTray[1].Contains(data.RecipeCode) && !RecipeQueueTray[2].Contains(data.RecipeCode) && !RecipeQueueTray[3].Contains(data.RecipeCode) && !RecipeQueueTray[4].Contains(data.RecipeCode))
  592. {
  593. RecipeQueueTray[i].Enqueue(data.RecipeCode);
  594. MessageNotify.GetInstance.ShowRunLog($"本地配方配料 ,等待plc允许配料,配方{data.RecipeCode},加入配方{i}");
  595. }
  596. }
  597. }
  598. //}
  599. }
  600. }
  601. else
  602. {
  603. for (int i = 0; i < 5; i++)
  604. {
  605. RecipeQueueTray[i].Clear();
  606. GVL_SmallStation.GetInstance.RecipeProcessStatus[i] = 0;
  607. }
  608. GVL_SmallStation.GetInstance.WindSendDosingStatus = 0;
  609. GVL_SmallStation.GetInstance.WindSendDosing = false;
  610. }
  611. }
  612. }
  613. /// <summary>
  614. /// 小料站配料
  615. /// </summary>
  616. private void RecipeInfoToHKPLC()
  617. {
  618. //五个工位AGV控制请求流程。
  619. if (!GVL_SmallStation.GetInstance.NotUseSmallStation)
  620. {
  621. for (int i = 0; i < 5; i++)
  622. {
  623. switch (GVL_SmallStation.GetInstance.Tray_AGVLogic[i])
  624. {
  625. case 0:
  626. if (GVL_SmallStation.GetInstance.AGV_PutTray1Finish && (RecipeQueueTray[i].Count > 0) && GVL_SmallStation.GetInstance.AGVIsGetTray == false)
  627. {
  628. GVL_SmallStation.GetInstance.AGVIsGetTray = true;
  629. HKDevice.HK_PLC_S7.Write("DB4.DBX8." + i, true);
  630. GVL_SmallStation.GetInstance.AGV_PutTray1Finish = false;
  631. GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 1;
  632. MessageNotify.GetInstance.ShowRunLog("AGV到位 发送到位信号给plc");
  633. }
  634. break;
  635. case 1:
  636. if (GVL_SmallStation.GetInstance.Station1HaveTray)
  637. {
  638. HKDevice.HK_PLC_S7.Write("DB4.DBX8." + i, false);
  639. GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 2;
  640. MessageNotify.GetInstance.ShowRunLog("托盘1有货架");
  641. }
  642. break;
  643. case 2:
  644. if (GVL_SmallStation.GetInstance.AGV_GetTray1Finish && GVL_SmallStation.GetInstance.RecipeProcessStatus[i] == 0)
  645. {
  646. GVL_SmallStation.GetInstance.AGVIsGetTray = false;
  647. HKDevice.HK_PLC_S7.Write("DB4.DBX10." + i, true);
  648. GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 3;
  649. MessageNotify.GetInstance.ShowRunLog("AGV取托盘1完成,发送给海科信号后1s后复位");
  650. }
  651. break;
  652. case 3:
  653. if (HKDevice.HK_PLC_S7.Read<bool>("DB4.DBX10." + i) == true)
  654. {
  655. Thread.Sleep(1000);
  656. HKDevice.HK_PLC_S7.Write("DB4.DBX10." + i, false);
  657. GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 0;
  658. GVL_SmallStation.GetInstance.AGV_GetTray1Finish = false;
  659. MessageNotify.GetInstance.ShowRunLog("AGV取托盘1完成,信号复位");
  660. }
  661. break;
  662. default:
  663. break;
  664. }
  665. }
  666. }
  667. //工位配料流程
  668. foreach (var recipe in RecipeQueueTray)
  669. {
  670. //recipeNum就是托盘号,也就是工位号。
  671. int recipeNum = recipe.Key;
  672. //判断工位是否有配方。
  673. if (RecipeQueueTray[recipeNum].Count > 0)
  674. {
  675. //从配方列表里根据配方号查找配方
  676. int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueueTray[recipeNum].ElementAt(0));
  677. if (index >= 0 && index < RemoteRecipes.Count)
  678. {
  679. string code = RemoteRecipes.ElementAt(index).RecipeCode;
  680. int trayCode = RemoteRecipes.ElementAt(index).TrayCode;
  681. string recipeName = RemoteRecipes.ElementAt(index).RecipeName;
  682. string windSend = RemoteRecipes.ElementAt(index).ToString();
  683. //当前只配托盘号为1 ,即工位1 的配方。
  684. if (trayCode == 1)
  685. {
  686. //如果不使用小料站配料,目前没有这种工作情况。
  687. if (GVL_SmallStation.GetInstance.NotUseSmallStation)
  688. {
  689. if (GVL_SmallStation.GetInstance.AGV_PutTray1Finish)
  690. {
  691. Thread.Sleep(5000);
  692. var res = Json<RemoteRecipeDataColl>.Data.RemoteRecipes.FirstOrDefault(p => p.RecipeCode == code);
  693. //if (SiemensDevice.IsConnected && !GVL_SmallStation.GetInstance.IsUseLocalRecipe)
  694. //{
  695. // RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
  696. // RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
  697. // RecipeFinishInfo.Job_No = (short)trayCode;
  698. // for (int i = 0; i < 20; i++)
  699. // {
  700. // RecipeFinishInfo.Material[i] = new UDT1();
  701. // }
  702. // for (int i = 0; i < 10; i++)
  703. // {
  704. // RecipeFinishInfo.Powder[i] = new UDT2();
  705. // }
  706. // for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
  707. // {
  708. // RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
  709. // RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
  710. // RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight * (float)0.001;
  711. // }
  712. // for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++)
  713. // {
  714. // RecipeFinishInfo.Powder[i].Powder_Weight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(i).DosingCompleWeight;
  715. // }
  716. // RecipeFinishInfo.Ask_For_Finish = true;
  717. // RecipeFinishInfo.DosingTime = Convert.ToInt16(0);
  718. // SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261);
  719. // MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据反馈给西门子");
  720. //}
  721. //else
  722. {
  723. MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方");
  724. }
  725. GVL_SmallStation.GetInstance.WindSendDosing = false;
  726. App.Current.Dispatcher.Invoke(() =>
  727. {
  728. Json<RemoteRecipeDataColl>.Data.RemoteRecipes.Remove(res);
  729. });
  730. RecipeQueueTray[recipeNum].TryDequeue(out code);
  731. GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = 0;
  732. GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 0;
  733. }
  734. }
  735. else
  736. {
  737. //粉料仓下发配方
  738. if (GVL_SmallStation.GetInstance.IsUseWindSend && GVL_SmallStation.GetInstance.WindSendDosing == false /*&& GVL_SmallStation.GetInstance.Tray_AGVLogic[recipeNum] == 2*/)
  739. {
  740. if (WindSendDevice.IsConnected)
  741. {
  742. if (GVL_SmallStation.GetInstance.WindSendDosingStatus == 1)
  743. {
  744. //清空风送配料数据
  745. WindSend_Write WindSendData111 = new WindSend_Write();
  746. WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData111, 95);
  747. Thread.Sleep(200);
  748. //设置DB95数据并下发。
  749. WindSendData111.TargetRecipeCode = code;
  750. WindSendData111.IsAllowDosing = true;
  751. foreach (var item in RemoteRecipes.ElementAt(index).WindSend)
  752. {
  753. if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(0).RawMaterialName || item.Location == 1)
  754. {
  755. WindSendData111.RawMaterial1_SetWeight = item.RawMaterialWeight;
  756. MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}");
  757. }
  758. if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(1).RawMaterialName || item.Location == 2)
  759. {
  760. WindSendData111.RawMaterial2_SetWeight = item.RawMaterialWeight;
  761. MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}");
  762. }
  763. if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(2).RawMaterialName || item.Location == 3)
  764. {
  765. WindSendData111.RawMaterial3_SetWeight = item.RawMaterialWeight;
  766. MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}");
  767. }
  768. if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(3).RawMaterialName || item.Location == 4)
  769. {
  770. WindSendData111.RawMaterial4_SetWeight = item.RawMaterialWeight;
  771. MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}");
  772. }
  773. if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(4).RawMaterialName || item.Location == 5)
  774. {
  775. WindSendData111.RawMaterial5_SetWeight = item.RawMaterialWeight;
  776. MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}");
  777. }
  778. }
  779. GVL_SmallStation.GetInstance.WindSendDosing = true;
  780. GVL_SmallStation.GetInstance.WindSendDosingStatus = 2;
  781. //下发配料数据
  782. WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData111, 95);
  783. }
  784. }
  785. else
  786. {
  787. if (Delay.GetInstance("delayTime").Start(true, 60))
  788. {
  789. Delay.GetInstance("delayTime").Start(false, 60);
  790. MessageNotify.GetInstance.ShowRunLog($"风送设备PLC未连接");
  791. }
  792. }
  793. }
  794. //如果小料仓配方下发状态为0(未下发),则下发配方。并清除该工位配方的配料情况信号。
  795. if (GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 0)
  796. {
  797. GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = 0;
  798. //下发工单,并置位工单下发确认。
  799. HKDevice.IssueRecipeToPlc(RemoteRecipes.ElementAt(index).RawMaterial, recipeNum);
  800. HKDevice.HK_PLC_S7.Write("DB4.DBX2." + recipeNum, true);
  801. //下发完成,等待开始制作。
  802. GVL_SmallStation.GetInstance.DosingTime[recipeNum] = DateTime.Now;
  803. GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 1;
  804. MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号{code},配方号{recipeNum + 1},下发完成");
  805. }
  806. //确认是否收到工单
  807. bool recipeReceviceFinish = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX4." + recipeNum);
  808. if (recipeReceviceFinish && GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 1)
  809. {
  810. //确认PLC收到工单后,复位下发确认信号。
  811. HKDevice.HK_PLC_S7.Write("DB4.DBX2." + recipeNum, false);
  812. GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 2;
  813. GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] = 0;
  814. MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号{code},配方号{recipeNum + 1},配方接收完成");
  815. }
  816. //粉料仓完毕,开始控制小料仓味魔方配料。
  817. if (GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 2)
  818. {
  819. //味魔方配料。
  820. for (byte i = 1; i < 16; i++)
  821. {
  822. //indexArr是各配方位置反馈。
  823. int indexArr = -1;
  824. if (GVL_SmallStation.GetInstance.plcReadDataDB3.StockBinAllowIssue[i - 1])
  825. {
  826. //根据配方号查找各配方的三个桶的位置反馈。位置反馈用的是ushort转16位2进制表示。
  827. switch (recipeNum)
  828. {
  829. case 0:
  830. indexArr = Array.FindIndex(GVL_SmallStation.GetInstance.plcReadDataDB3.Recipe1BarrelPosReserve.ToArray(), p => p == i);
  831. break;
  832. case 1:
  833. indexArr = Array.FindIndex(GVL_SmallStation.GetInstance.plcReadDataDB3.Recipe2BarrelPosReserve.ToArray(), p => p == i);
  834. break;
  835. case 2:
  836. indexArr = Array.FindIndex(GVL_SmallStation.GetInstance.plcReadDataDB3.Recipe3BarrelPosReserve.ToArray(), p => p == i);
  837. break;
  838. case 3:
  839. indexArr = Array.FindIndex(GVL_SmallStation.GetInstance.plcReadDataDB3.Recipe4BarrelPosReserve.ToArray(), p => p == i);
  840. break;
  841. case 4:
  842. indexArr = Array.FindIndex(GVL_SmallStation.GetInstance.plcReadDataDB3.Recipe5BarrelPosReserve.ToArray(), p => p == i);
  843. break;
  844. }
  845. //如果料桶已经到位但没有配料完成信号。
  846. if (indexArr >= 0 && GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum].GetBitValue((byte)i) == false)
  847. {
  848. int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
  849. float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight * 1000;//单位g转换kg
  850. //如果重量为0,即不需要配料。则直接设为配料完成。
  851. if (weight <= 0)
  852. {
  853. if (i >= 1 && i <= 8)
  854. {
  855. string commInfo = HKDevice.HK_PLC_S7.Write("DB4.DBX12." + (i - 1), true);
  856. MessageNotify.GetInstance.ShowRunLog(commInfo);
  857. }
  858. else if (i >= 9 && i <= 15)
  859. {
  860. string commInfo1 = HKDevice.HK_PLC_S7.Write("DB4.DBX13." + (i - 9), true);
  861. MessageNotify.GetInstance.ShowRunLog(commInfo1);
  862. }
  863. GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].SetBitValue((byte)i, false);//配料完成设备写成false
  864. GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] = GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum].SetBitValue((byte)i, true);//配料完成设备写成false
  865. }
  866. else
  867. {
  868. //下发小料仓味魔方配料指令。
  869. if (loc_index >= 0)
  870. {
  871. DeviceInquire.GetInstance.GetDevice((int)i)?.Start(weight);//根据料仓编号 启动并写入每个原料重量
  872. GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] = GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum].SetBitValue((byte)i, true);//配料完成设备写成false
  873. }
  874. else
  875. {
  876. MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号:{code},配方号{recipeNum + 1},{indexArr + 1}号桶,错误没有找到{(int)i}号仓的配方");
  877. }
  878. }
  879. MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号:{code},配方号{recipeNum + 1},{indexArr + 1}号桶,{(int)i}号仓,正在配料");
  880. }
  881. else
  882. {
  883. //MessageNotify.GetInstance.ShowRunLog($"错误,有允许配料信号,但没有相应的位置 和桶号");
  884. }
  885. //味魔方配料完成后处理。
  886. if ((DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3) && indexArr >= 0 && GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].GetBitValue((byte)i))
  887. {
  888. int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
  889. if (res < 0)
  890. {
  891. }
  892. else
  893. {
  894. //配料完成后,先延时一段时间再复位。
  895. Thread.Sleep(GVL_SmallStation.GetInstance.Time);
  896. //获取实际下料重量后复位配料完成状态。
  897. RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.NowWeightFeedback;
  898. bool info = DeviceInquire.GetInstance.GetDevice(i).StatusReset();
  899. MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成,下料完成重量:{RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight}");
  900. //计算误差范围是否在允许范围内,如果超出范围,则报警。
  901. float AlarmRange = Math.Abs(RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight - RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).RawMaterialWeight * 1000);
  902. int iIndex = Array.FindIndex(Json<DevicePar>.Data.deviceParModels.ToArray(), p => p.MaterialName == DeviceInquire.GetInstance.GetDevice(i).DeviceName);
  903. if (iIndex >= 0)
  904. {
  905. if (Math.Abs(Json<DevicePar>.Data.deviceParModels.ElementAt(iIndex).ErrorRange) < AlarmRange)
  906. {
  907. HKDevice.HK_PLC_S7.Write("DB44.DBX3.0", true);
  908. App.Current.Dispatcher.Invoke(() =>
  909. {
  910. MessageNotify.GetInstance.ShowDialog($"{i}号仓配料误差过大,设置出料重量{RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).RawMaterialWeight * 1000}g,实际出料重量{RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight}g,相差{AlarmRange}g,允许误差为{Math.Abs(Json<DevicePar>.Data.deviceParModels.ElementAt(iIndex).ErrorRange)}g,请联系人工处理", DialogType.Warning);
  911. HKDevice.HK_PLC_S7.Write("DB44.DBX3.0", false);
  912. });
  913. }
  914. }
  915. //置位味魔方配料完成信号。
  916. if (i >= 1 && i <= 8)
  917. {
  918. string commInfo = HKDevice.HK_PLC_S7.Write("DB4.DBX12." + (i - 1), true);
  919. MessageNotify.GetInstance.ShowRunLog(commInfo);
  920. }
  921. else if (i >= 9 && i <= 15)
  922. {
  923. string commInfo1 = HKDevice.HK_PLC_S7.Write("DB4.DBX13." + (i - 9), true);
  924. MessageNotify.GetInstance.ShowRunLog(commInfo1);
  925. }
  926. GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].SetBitValue((byte)i, false);//配料完成设备写成false
  927. MessageNotify.GetInstance.ShowRunLog($"配方{recipeNum},{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].ToBinString()}");
  928. }
  929. }
  930. }
  931. }
  932. //接收到工单配料完成上升沿后。
  933. bool DosingComple = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX6." + recipeNum);
  934. if ((RTrig.GetInstance("配方配料完成").Start(DosingComple)) || (GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] > 0 && DosingComple))
  935. {
  936. GVL_SmallStation.GetInstance.RecipeDosingCompleNum = GVL_SmallStation.GetInstance.RecipeDosingCompleNum + 1;
  937. GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] = 0;
  938. if (GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] > 0)
  939. {
  940. for (int i = 1; i < 17; i++)
  941. {//看不懂
  942. if (GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].GetBitValue((byte)i))
  943. {
  944. MessageNotify.GetInstance.ShowRunLog($"料仓配料完成,但存在料仓未配料:{i}号仓");
  945. }
  946. }
  947. }
  948. var res = Json<RemoteRecipeDataColl>.Data.RemoteRecipes.FirstOrDefault(p => p.RecipeCode == code);
  949. double a = DateTime.Now.Subtract(GVL_SmallStation.GetInstance.DosingTime[recipeNum]).TotalSeconds;
  950. foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
  951. {
  952. MessageNotify.GetInstance.ShowRunLog($"{item.RawMaterialName},下料重量:{item.Laying_Off_Weight}g");
  953. }
  954. //if (SiemensDevice.IsConnected && !GVL_SmallStation.GetInstance.IsUseLocalRecipe)
  955. //{
  956. // RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
  957. // RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
  958. // RecipeFinishInfo.Job_No = (short)trayCode;
  959. // for (int i = 0; i < 20; i++)
  960. // {
  961. // RecipeFinishInfo.Material[i] = new UDT1();
  962. // }
  963. // for (int i = 0; i < 10; i++)
  964. // {
  965. // RecipeFinishInfo.Powder[i] = new UDT2();
  966. // }
  967. // for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
  968. // {
  969. // RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
  970. // RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
  971. // RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight * (float)0.001;
  972. // }
  973. // for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++)
  974. // {
  975. // RecipeFinishInfo.Powder[i].Powder_Weight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(i).DosingCompleWeight;
  976. // }
  977. // RecipeFinishInfo.Ask_For_Finish = true;
  978. // RecipeFinishInfo.DosingTime = Convert.ToInt16(a);
  979. // SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261);
  980. // MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据反馈给西门子");
  981. // MessageNotify.GetInstance.ShowRecipeLog(res.RecipeName);
  982. //}
  983. //else
  984. //TODO:发送配方制作完成反馈到服务系统。
  985. {
  986. MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方");
  987. MessageNotify.GetInstance.ShowRecipeLog(res.RecipeName);
  988. }
  989. GVL_SmallStation.GetInstance.WindSendDosing = false;
  990. App.Current.Dispatcher.Invoke(() =>
  991. {
  992. Json<RemoteRecipeDataColl>.Data.RemoteRecipes.Remove(res);
  993. });
  994. RecipeQueueTray[recipeNum].TryDequeue(out code);
  995. GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = 0;
  996. GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 0;
  997. }
  998. }
  999. }
  1000. }
  1001. }
  1002. }
  1003. }
  1004. }
  1005. /// <summary>
  1006. /// 复位料仓状态。
  1007. /// </summary>
  1008. private void StockBinInit()
  1009. {
  1010. for (int i = 1; i < 16; i++)
  1011. {
  1012. if (DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)
  1013. {
  1014. DeviceInquire.GetInstance.GetDevice(i).StatusReset();
  1015. }
  1016. }
  1017. }
  1018. /// <summary>
  1019. /// 料仓的位置和原料名称的对应
  1020. /// </summary>
  1021. public void StockBinNameWithPos()
  1022. {
  1023. RawMaterialsNamePos.Clear();
  1024. foreach (var material in RawMaterialsInfo)
  1025. {
  1026. if (!string.IsNullOrEmpty(material.RawMaterialName))
  1027. {
  1028. if (!RawMaterialsNamePos.ContainsKey(material.RawMaterialName))
  1029. {
  1030. RawMaterialsNamePos.Add(material.RawMaterialName, (short)material.RawMaterialLocation);
  1031. }
  1032. }
  1033. }
  1034. }
  1035. /// <summary>
  1036. /// PLC的变量列表
  1037. /// </summary>
  1038. public void PlcVarMonitor()
  1039. {
  1040. //海科的DB3
  1041. foreach (PropertyInfo item in typeof(PlcReadAddressDB3).GetProperties())
  1042. {
  1043. if (Attribute.IsDefined(item, typeof(VarCommAttribute)))
  1044. {
  1045. string type = item.PropertyType.ToString();
  1046. CommData.Add(new PlcInfos()
  1047. {
  1048. Count = CommData.Count + 1,
  1049. Name = item.Name,
  1050. Address = item.GetCustomAttribute<VarCommAttribute>().Address,
  1051. Type = type.Substring(type.IndexOf(".") + 1),
  1052. Describe = item.GetCustomAttribute<VarCommAttribute>().Describe,
  1053. Value = item.GetValue(GVL_SmallStation.GetInstance.plcReadDataDB3).ToString(),
  1054. });
  1055. }
  1056. }
  1057. //风送PLC的DB94状态反馈
  1058. foreach (PropertyInfo item in typeof(WindSend_Read).GetProperties())
  1059. {
  1060. if (Attribute.IsDefined(item, typeof(VarCommAttribute)))
  1061. {
  1062. string type = item.PropertyType.ToString();
  1063. CommData.Add(new PlcInfos()
  1064. {
  1065. Count = CommData.Count + 1,
  1066. Name = item.Name,
  1067. Address = item.GetCustomAttribute<VarCommAttribute>().Address,
  1068. Type = type.Substring(type.IndexOf(".") + 1),
  1069. Describe = item.GetCustomAttribute<VarCommAttribute>().Describe,
  1070. Value = item.GetValue(GVL_SmallStation.GetInstance.WindSendDB94).ToString(),
  1071. });
  1072. }
  1073. }
  1074. foreach (PropertyInfo item in typeof(WindSend_Write).GetProperties())
  1075. {
  1076. if (Attribute.IsDefined(item, typeof(VarCommAttribute)))
  1077. {
  1078. string type = item.PropertyType.ToString();
  1079. CommData.Add(new PlcInfos()
  1080. {
  1081. Count = CommData.Count + 1,
  1082. Name = item.Name,
  1083. Address = item.GetCustomAttribute<VarCommAttribute>().Address,
  1084. Type = type.Substring(type.IndexOf(".") + 1),
  1085. Describe = item.GetCustomAttribute<VarCommAttribute>().Describe,
  1086. Value = item.GetValue(GVL_SmallStation.GetInstance.WindSendDB95).ToString(),
  1087. });
  1088. }
  1089. }
  1090. foreach (PropertyInfo item in typeof(GVL_SmallStation).GetProperties())
  1091. {
  1092. if (Attribute.IsDefined(item, typeof(VarCommAttribute)))
  1093. {
  1094. string type = item.PropertyType.ToString();
  1095. ProcessVar.Add(new PlcInfos()
  1096. {
  1097. Count = ProcessVar.Count + 1,
  1098. Name = item.Name,
  1099. Type = type.Substring(type.IndexOf(".") + 1),
  1100. Address = item.GetCustomAttribute<VarCommAttribute>().Address,
  1101. Describe = item.GetCustomAttribute<VarCommAttribute>().Describe,
  1102. Value = item.GetValue(GVL_SmallStation.GetInstance).ToString()
  1103. });
  1104. }
  1105. }
  1106. }
  1107. /// <summary>
  1108. /// 操作委托注册。
  1109. /// </summary>
  1110. public void RegisterInit()
  1111. {
  1112. //手动控制气缸 DB5.DBX0.0~DB5.DBX4.5
  1113. ActionManage.GetInstance.Register(new Action<object>((o) =>
  1114. {
  1115. if (o != null)
  1116. {
  1117. if (o.ToString().Contains("升降气缸"))
  1118. {
  1119. int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 2));
  1120. if (index >= 1 && index <= 15)
  1121. {
  1122. string address = "DB5.DBX" + (index / 8) + "." + (index % 8 - 1);
  1123. if (index == 8) address = "DB5.DBX0.7";
  1124. HKDevice.HK_PLC_S7.Write<bool>(address, true);
  1125. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:{address},值:true。");
  1126. }
  1127. }
  1128. else if (o.ToString().Contains("阻挡气缸"))
  1129. {
  1130. int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 2));
  1131. if (index >= 1 && index <= 15)
  1132. {
  1133. string address = "";
  1134. if (index == 1) address = "DB5.DBX1.7";
  1135. if (index == 2) address = "DB5.DBX2.0";
  1136. if (index == 3) address = "DB5.DBX2.1";
  1137. if (index == 4) address = "DB5.DBX2.2";
  1138. if (index == 5) address = "DB5.DBX2.3";
  1139. if (index == 6) address = "DB5.DBX2.4";
  1140. if (index == 7) address = "DB5.DBX2.5";
  1141. if (index == 8) address = "DB5.DBX2.6";
  1142. if (index == 9) address = "DB5.DBX2.7";
  1143. if (index == 10) address = "DB5.DBX3.0";
  1144. if (index == 11) address = "DB5.DBX3.1";
  1145. if (index == 12) address = "DB5.DBX3.2";
  1146. if (index == 13) address = "DB5.DBX3.3";
  1147. if (index == 14) address = "DB5.DBX3.4";
  1148. if (index == 15) address = "DB5.DBX3.5";
  1149. HKDevice.HK_PLC_S7.Write<bool>(address, true);
  1150. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:{address},值:true。");
  1151. }
  1152. }
  1153. else if (o.ToString().Contains("进料桶顶升气缸"))
  1154. {
  1155. HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", false);//默认顶升
  1156. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.6,值:false。");
  1157. }
  1158. else if (o.ToString().Contains("出料桶顶升气缸1"))
  1159. {
  1160. HKDevice.HK_PLC_S7.Write("DB5.DBX3.7", true);
  1161. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.7,值:true。");
  1162. }
  1163. else if (o.ToString().Contains("出料桶顶升气缸2"))
  1164. {
  1165. HKDevice.HK_PLC_S7.Write("DB5.DBX4.0", true);
  1166. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.0,值:true。");
  1167. }
  1168. else if (o.ToString().Contains("出料桶顶升气缸3"))
  1169. {
  1170. HKDevice.HK_PLC_S7.Write("DB5.DBX4.1", true);
  1171. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.1,值:true。");
  1172. }
  1173. else if (o.ToString().Contains("托盘气缸1_1"))
  1174. {
  1175. HKDevice.HK_PLC_S7.Write("DB5.DBX4.2", false);//默认伸出
  1176. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.2,值:false。");
  1177. }
  1178. else if (o.ToString().Contains("托盘气缸1_2"))
  1179. {
  1180. HKDevice.HK_PLC_S7.Write("DB5.DBX4.3", false);
  1181. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.3,值:false。");
  1182. }
  1183. else if (o.ToString().Contains("托盘气缸2_1"))
  1184. {
  1185. HKDevice.HK_PLC_S7.Write("DB5.DBX4.4", false);
  1186. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.4,值:false。");
  1187. }
  1188. else if (o.ToString().Contains("托盘气缸2_2"))
  1189. {
  1190. HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", false);
  1191. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.5,值:false。");
  1192. }
  1193. }
  1194. }), "ManualOpen", true);//根据下发的配方ID将 托盘的位置信息添加到配方中
  1195. ActionManage.GetInstance.Register(new Action<object>((o) =>
  1196. {
  1197. if (o != null)
  1198. {
  1199. if (o.ToString().Contains("升降气缸"))
  1200. {
  1201. int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 2));
  1202. if (index >= 1 && index <= 15)
  1203. {
  1204. string address = "DB5.DBX" + (index / 8) + "." + (index % 8 - 1);
  1205. if (index == 8) address = "DB5.DBX0.7";
  1206. HKDevice.HK_PLC_S7.Write<bool>(address, false);
  1207. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:{address},值:false。");
  1208. }
  1209. }
  1210. else if (o.ToString().Contains("阻挡气缸"))
  1211. {
  1212. int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 2));
  1213. if (index >= 1 && index <= 15)
  1214. {
  1215. string address = "";
  1216. if (index == 1) address = "DB5.DBX1.7";
  1217. if (index == 2) address = "DB5.DBX2.0";
  1218. if (index == 3) address = "DB5.DBX2.1";
  1219. if (index == 4) address = "DB5.DBX2.2";
  1220. if (index == 5) address = "DB5.DBX2.3";
  1221. if (index == 6) address = "DB5.DBX2.4";
  1222. if (index == 7) address = "DB5.DBX2.5";
  1223. if (index == 8) address = "DB5.DBX2.6";
  1224. if (index == 9) address = "DB5.DBX2.7";
  1225. if (index == 10) address = "DB5.DBX3.0";
  1226. if (index == 11) address = "DB5.DBX3.1";
  1227. if (index == 12) address = "DB5.DBX3.2";
  1228. if (index == 13) address = "DB5.DBX3.3";
  1229. if (index == 14) address = "DB5.DBX3.4";
  1230. if (index == 15) address = "DB5.DBX3.5";
  1231. HKDevice.HK_PLC_S7.Write<bool>(address, false);
  1232. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:{address},值:false。");
  1233. }
  1234. }
  1235. else if (o.ToString().Contains("进料桶顶升气缸"))
  1236. {
  1237. HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", true);
  1238. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.6,值:true。");
  1239. }
  1240. else if (o.ToString().Contains("出料桶顶升气缸1"))
  1241. {
  1242. HKDevice.HK_PLC_S7.Write("DB5.DBX3.7", false);
  1243. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.7,值:false。");
  1244. }
  1245. else if (o.ToString().Contains("出料桶顶升气缸2"))
  1246. {
  1247. HKDevice.HK_PLC_S7.Write("DB5.DBX4.0", false);
  1248. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.0,值:false。");
  1249. }
  1250. else if (o.ToString().Contains("出料桶顶升气缸3"))
  1251. {
  1252. HKDevice.HK_PLC_S7.Write("DB5.DBX4.1", false);
  1253. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.1,值:false。");
  1254. }
  1255. else if (o.ToString().Contains("托盘气缸1_1"))
  1256. {
  1257. HKDevice.HK_PLC_S7.Write("DB5.DBX4.2", true);
  1258. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.2,值:true。");
  1259. }
  1260. else if (o.ToString().Contains("托盘气缸1_2"))
  1261. {
  1262. HKDevice.HK_PLC_S7.Write("DB5.DBX4.3", true);
  1263. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.3,值:true。");
  1264. }
  1265. else if (o.ToString().Contains("托盘气缸2_1"))
  1266. {
  1267. HKDevice.HK_PLC_S7.Write("DB5.DBX4.4", true);
  1268. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.4,值:true。");
  1269. }
  1270. else if (o.ToString().Contains("托盘气缸2_2"))
  1271. {
  1272. HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", true);
  1273. MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.5,值:true。");
  1274. }
  1275. }
  1276. }), "ManualClose", true);//根据下发的配方ID将 托盘的位置信息添加到配方中
  1277. //手动控制电机轴 DB5.DBX4.6~DB5.DBX5.2
  1278. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX4.6", true); MessageNotify.GetInstance.ShowUserLog($"手动控制电机轴,地址:DB5.DBX4.6,值:true。"); }), "StartAxisLoadCommand", true);
  1279. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX4.6", false); MessageNotify.GetInstance.ShowUserLog($"手动控制电机轴,地址:DB5.DBX4.6,值:false。"); }), "StopAxisLoadCommand", true);
  1280. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX4.7", true); MessageNotify.GetInstance.ShowUserLog($"手动控制电机轴,地址:DB5.DBX4.7,值:true。"); }), "StartAxisMidCommand", true);
  1281. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX4.7", false); MessageNotify.GetInstance.ShowUserLog($"手动控制电机轴,地址:DB5.DBX4.7,值:false。"); }), "StopAxisMidCommand", true);
  1282. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.0", true); MessageNotify.GetInstance.ShowUserLog($"手动控制电机轴,地址:DB5.DBX5.0,值:true。"); }), "StartAxisUnLoadCommand", true);
  1283. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.0", false); MessageNotify.GetInstance.ShowUserLog($"手动控制电机轴,地址:DB5.DBX5.0,值:false。"); }), "StopAxisUnLoadCommand", true);
  1284. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.1", true); MessageNotify.GetInstance.ShowUserLog($"手动控制电机轴,地址:DB5.DBX5.1,值:true。"); }), "StartAxis1Command", true);
  1285. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.1", false); MessageNotify.GetInstance.ShowUserLog($"手动控制电机轴,地址:DB5.DBX5.1,值:false。"); }), "StopAxis1Command", true);
  1286. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.2", true); MessageNotify.GetInstance.ShowUserLog($"手动控制电机轴,地址:DB5.DBX5.2,值:true。"); }), "StartAxis2Command", true);
  1287. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.2", false); MessageNotify.GetInstance.ShowUserLog($"手动控制电机轴,地址:DB5.DBX5.2,值:false。"); }), "StopAxis2Command", true);
  1288. //西门子配方处理
  1289. ActionManage.GetInstance.Register(new Action<object>((res) =>
  1290. {
  1291. ObservableCollection<RemoteRecipeRawMaterial> RawMaterials = new ObservableCollection<RemoteRecipeRawMaterial>();
  1292. ObservableCollection<WindSendRawMaterial> WindSendData = new ObservableCollection<WindSendRawMaterial>();
  1293. //if (SiemensDevice.IsConnected)
  1294. //{
  1295. if (res != null && res is XL_Start_DB recipe)
  1296. {
  1297. if (!string.IsNullOrEmpty(recipe.RecipeCode))
  1298. {
  1299. RawMaterials.Clear();
  1300. for (int i = 0; i < GVL_SmallStation.Max_DosingSotckBinNum; i++)
  1301. {
  1302. if (!string.IsNullOrEmpty(recipe.Material[i].Material_Name))
  1303. {
  1304. if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name))
  1305. {
  1306. RawMaterials.Add(new RemoteRecipeRawMaterial()
  1307. {
  1308. RawMaterialName = recipe.Material[i].Material_Name,
  1309. RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum,
  1310. RawMaterialWeight = recipe.Material[i].Material_Weight,
  1311. RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name]
  1312. });
  1313. }
  1314. else
  1315. {
  1316. MessageNotify.GetInstance.ShowRunLog($"原料:{recipe.Material[i].Material_Name},不在配料表");
  1317. }
  1318. }
  1319. else
  1320. {
  1321. break;
  1322. }
  1323. }
  1324. for (int i = 0; i < GVL_SmallStation.Max_PowderSotckBinNum; i++)
  1325. {
  1326. if (!string.IsNullOrEmpty(recipe.Powder[i].Powder_Name))
  1327. {
  1328. WindSendData.Add(new WindSendRawMaterial()
  1329. {
  1330. RawMaterialName = recipe.Powder[i].Powder_Name,
  1331. RawMaterialWeight = recipe.Powder[i].Powder_Weight
  1332. });
  1333. }
  1334. else
  1335. {
  1336. break;
  1337. }
  1338. }
  1339. App.Current.Dispatcher.Invoke(() =>
  1340. {
  1341. Json<RemoteRecipeDataColl>.Data.RemoteRecipes.Add(new RecipeData()
  1342. {
  1343. RecipeName = recipe.RecipeName,
  1344. RecipeCode = recipe.RecipeCode,
  1345. RawMaterial = RawMaterials,
  1346. TrayCode = recipe.StockCode,
  1347. WindSend = WindSendData
  1348. });
  1349. });
  1350. }
  1351. }
  1352. //}
  1353. }), "SiemensRecipeRecive", true);
  1354. //将本地配方发送到西门子配方里,执行配料
  1355. ActionManage.GetInstance.Register(new Action<Object>((res) =>
  1356. {
  1357. if (res != null && res is RecipeData rm)
  1358. {
  1359. //Json<RemoteRecipeDataColl>.Data.RemoteRecipes.Add(rm);
  1360. var newRecipe = new RecipeData();
  1361. newRecipe.RecipeName = rm.RecipeName;
  1362. newRecipe.RecipeCode = rm.RecipeCode;
  1363. newRecipe.TrayCode = rm.TrayCode;
  1364. foreach (var item in rm.RawMaterial)
  1365. {
  1366. newRecipe.RawMaterial.Add(new RemoteRecipeRawMaterial()
  1367. {
  1368. DeviceIp = item.DeviceIp,
  1369. RawMaterialName = item.RawMaterialName,
  1370. RawMaterialBarrelNum = item.RawMaterialBarrelNum,
  1371. RawMaterialType = item.RawMaterialType,
  1372. RawMaterialWeight = item.RawMaterialWeight,
  1373. Laying_Off_Weight = item.Laying_Off_Weight,
  1374. StockBinRemainingWeight = item.StockBinRemainingWeight,
  1375. RawMaterialLocation = item.RawMaterialLocation,
  1376. IsDosingComple = item.IsDosingComple
  1377. });
  1378. }
  1379. foreach (var item in rm.WindSend)
  1380. {
  1381. newRecipe.WindSend.Add(new WindSendRawMaterial()
  1382. {
  1383. DeviceIp = item.DeviceIp,
  1384. Location = item.Location,
  1385. RawMaterialChineseName = item.RawMaterialChineseName,
  1386. RawMaterialName = item.RawMaterialName,
  1387. RawMaterialWeight = item.RawMaterialWeight,
  1388. DosingCompleWeight = item.DosingCompleWeight,
  1389. RawMaterialBarrelNum = item.RawMaterialBarrelNum,
  1390. RawMaterialType = item.RawMaterialType,
  1391. });
  1392. }
  1393. Json<RemoteRecipeDataColl>.Data.RemoteRecipes.Add(newRecipe);
  1394. }
  1395. }), "LocalSimulationRecipeIssue", true);
  1396. //手动控制系统模式
  1397. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", true); MessageNotify.GetInstance.ShowUserLog($"手动控制系统启动,地址:DB44.DBX0.0,值:true。"); }), "SystemStart", true);
  1398. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", false); MessageNotify.GetInstance.ShowUserLog($"手动控制系统停止,地址:DB44.DBX0.0,值:false。"); }), "SystemStop", true);
  1399. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.2", true); MessageNotify.GetInstance.ShowUserLog($"手动控制系统暂停,地址:DB44.DBX0.2,值:true。"); }), "SystemPause", true);
  1400. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.2", false); MessageNotify.GetInstance.ShowUserLog($"手动控制系统复位,地址:DB44.DBX0.2,值:false。"); }), "SystemReset", true);
  1401. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", false); MessageNotify.GetInstance.ShowUserLog($"手动切换为自动模式,地址:DB44.DBX0.1,值:false。"); }), "SystemAutoMode", true);
  1402. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", true); MessageNotify.GetInstance.ShowUserLog($"手动切换为手动模式,地址:DB44.DBX0.1,值:true。"); }), "SystemDebugMode", true);
  1403. //流程控制
  1404. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.3", true); }), "ManualSystemReset", true);
  1405. ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.4", true); }), "CLearRecipeInfo", true);
  1406. ActionManage.GetInstance.Register(new Action(() =>
  1407. {
  1408. Json<RemoteRecipeDataColl>.Data.RemoteRecipes.Clear();
  1409. GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 0;
  1410. GVL_SmallStation.GetInstance.WindSendDosingStatus = 0;
  1411. GVL_SmallStation.GetInstance.WindSendDosing = false;
  1412. GVL_SmallStation.GetInstance.Order_Cancel = false;
  1413. GVL_SmallStation.GetInstance.Order_CancelRecipeCode = "";
  1414. GVL_SmallStation.GetInstance.OrderCancelStep = 0;
  1415. for (int i = 0; i < 5; i++)
  1416. {
  1417. RecipeQueueTray[i].Clear();
  1418. GVL_SmallStation.GetInstance.RecipeProcessStatus[i] = 0;
  1419. GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 0;
  1420. }
  1421. StockBinInit();
  1422. WindSendReset();
  1423. //for (int i = 0; i < GVL_SmallStation.GetInstance.StockInDosingComple.Length; i++)
  1424. //{
  1425. // GVL_SmallStation.GetInstance.StockInDosingComple[i] = false;
  1426. //}
  1427. MessageNotify.GetInstance.ShowRunLog("系统流程复位,等待西门子重新下发订单");
  1428. }), "BPASystemReset", true);
  1429. //往海科PLC写值
  1430. ActionManage.GetInstance.Register(new Action<Object>((o) =>
  1431. {
  1432. if (o != null && o is HKDeviceWrite data)
  1433. {
  1434. if (data.PlcVarType == PlcVarType.Bool)
  1435. {
  1436. bool value = (bool)data.Value;
  1437. HKDevice.HK_PLC_S7.Write<bool>(data.Address, value);
  1438. }
  1439. else if (data.PlcVarType == PlcVarType.Byte)
  1440. {
  1441. byte value = (byte)data.Value;
  1442. HKDevice.HK_PLC_S7.Write<byte>(data.Address, value);
  1443. }
  1444. else if (data.PlcVarType == PlcVarType.Int)
  1445. {
  1446. short value = (short)data.Value;
  1447. HKDevice.HK_PLC_S7.Write<short>(data.Address, value);
  1448. }
  1449. else if (data.PlcVarType == PlcVarType.Dint)
  1450. {
  1451. int value = (int)data.Value;
  1452. HKDevice.HK_PLC_S7.Write<int>(data.Address, value);
  1453. }
  1454. else if (data.PlcVarType == PlcVarType.Real)
  1455. {
  1456. float value = (float)data.Value;
  1457. HKDevice.HK_PLC_S7.Write<float>(data.Address, value);
  1458. }
  1459. }
  1460. }), "PLCWrite", true);
  1461. //电机速度
  1462. ActionManage.GetInstance.Register(new Action<object>((o) =>
  1463. {
  1464. if (o != null && o is short value)
  1465. {
  1466. HKDevice.HK_PLC_S7.Write("DB47.DBW8", value);
  1467. }
  1468. }), "AxisLoadSpeedSet", true);
  1469. ActionManage.GetInstance.Register(new Action<object>((o) =>
  1470. {
  1471. if (o != null && o is short value)
  1472. {
  1473. HKDevice.HK_PLC_S7.Write("DB47.DBW10", value);
  1474. }
  1475. }), "AxisMidSpeedSet", true);
  1476. ActionManage.GetInstance.Register(new Action<object>((o) =>
  1477. {
  1478. if (o != null && o is short value)
  1479. {
  1480. HKDevice.HK_PLC_S7.Write("DB47.DBW12", value);
  1481. }
  1482. }), "AxisUnLoadSpeedSet", true);
  1483. ActionManage.GetInstance.Register(new Action<object>((o) =>
  1484. {
  1485. if (o != null && o is float value)
  1486. {
  1487. HKDevice.HK_PLC_S7.Write("DB47.DBD0", value);
  1488. }
  1489. }), "Axis1SpeedSet", true);
  1490. ActionManage.GetInstance.Register(new Action<object>((o) =>
  1491. {
  1492. if (o != null && o is float value)
  1493. {
  1494. HKDevice.HK_PLC_S7.Write("DB47.DBD4", value);
  1495. }
  1496. }), "Axis2SpeedSet", true);
  1497. //机器人的操作
  1498. ActionManage.GetInstance.Register(new Action<object>((o) =>
  1499. {
  1500. if (o != null && o is string address)
  1501. {
  1502. HKDevice.HK_PLC_S7.Write(address, true);
  1503. }
  1504. }), "RobotSendTrueCommand", true);
  1505. ActionManage.GetInstance.Register(new Action<object>((o) =>
  1506. {
  1507. if (o != null && o is string address)
  1508. {
  1509. HKDevice.HK_PLC_S7.Write(address, false);
  1510. }
  1511. }), "RobotSendFalseCommand", true);
  1512. ActionManage.GetInstance.Register(new Action<object>((o) =>
  1513. {
  1514. if (o != null && o is short Value)
  1515. {
  1516. HKDevice.HK_PLC_S7.Write("DB4.DBB1", (byte)Value);
  1517. }
  1518. }), "RobotSetProgramNum", true);
  1519. }
  1520. /// <summary>
  1521. /// 设备连接并开启重连线程。
  1522. /// </summary>
  1523. public void DeviceConnect()
  1524. {
  1525. try
  1526. {
  1527. if (Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect)
  1528. {
  1529. HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP);
  1530. if (HKDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("海科plc连接成功");
  1531. }
  1532. }
  1533. catch (Exception ex)
  1534. {
  1535. MessageNotify.GetInstance.ShowAlarmLog("海科plc连接失败,等待重新连接");
  1536. }
  1537. finally
  1538. {
  1539. HKDevice.Init();
  1540. MessageNotify.GetInstance.ShowRunLog("海科plc初始化完成");
  1541. }
  1542. //TODO:连接服务系统。
  1543. try
  1544. {
  1545. if (Json<DevicePar>.Data.deviceConnectPar.SiemensConnect)
  1546. {
  1547. //SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
  1548. //if (SiemensDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功");
  1549. }
  1550. }
  1551. catch (Exception ex)
  1552. {
  1553. MessageNotify.GetInstance.ShowAlarmLog("西门子plc连接失败,等待重新连接");
  1554. }
  1555. finally
  1556. {
  1557. // SiemensDevice.Init();
  1558. MessageNotify.GetInstance.ShowRunLog("西门子plc初始化完成");
  1559. }
  1560. //连接风送设备
  1561. try
  1562. {
  1563. if (Json<DevicePar>.Data.deviceConnectPar.WindSendConnect)
  1564. {
  1565. WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP);
  1566. if (WindSendDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("风送plc连接成功");
  1567. }
  1568. }
  1569. catch (Exception ex)
  1570. {
  1571. MessageNotify.GetInstance.ShowAlarmLog("粉料plc连接失败,等待重新连接");
  1572. }
  1573. finally
  1574. {
  1575. WindSendDevice.Init();
  1576. MessageNotify.GetInstance.ShowRunLog("风送粉料plc初始化完成");
  1577. }
  1578. //一直判断是否断开了连接, 断开就重连。
  1579. TaskManage.GetInstance.StartLong(new Action(() =>
  1580. {
  1581. //重连海科配料PLC
  1582. try
  1583. {
  1584. if (!HKDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect)
  1585. {
  1586. HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP);
  1587. if (HKDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接成功");
  1588. }
  1589. }
  1590. catch (Exception ex)
  1591. {
  1592. }
  1593. //TODO:重连服务系统
  1594. try
  1595. {
  1596. //if (!SiemensDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.SiemensConnect)
  1597. //{
  1598. // SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
  1599. // if (SiemensDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("西门子PLC重新连接成功");
  1600. //}
  1601. }
  1602. catch (Exception ex)
  1603. {
  1604. }
  1605. //重连风送
  1606. try
  1607. {
  1608. if (!WindSendDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.WindSendConnect)
  1609. {
  1610. WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP);
  1611. if (WindSendDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("风送plc重新连接成功");
  1612. }
  1613. }
  1614. catch (Exception ex)
  1615. {
  1616. }
  1617. Thread.Sleep(50);
  1618. }), "设备连接", true);
  1619. }
  1620. private void DosingDevice(int Index, int DeviceID)
  1621. {
  1622. if (RTrig.GetInstance("Tray2StatusDevice" + DeviceID).Start(DeviceInquire.GetInstance.GetDevice(DeviceID).deviceStatus.RunStatus == 3))
  1623. {
  1624. MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{RemoteRecipes.ElementAt(Index).RecipeName},{DeviceID}号仓,配料完成");
  1625. int res = Array.FindIndex(RemoteRecipes.ElementAt(Index).RawMaterial.ToArray(), p => p.RawMaterialLocation == DeviceID);
  1626. RemoteRecipes.ElementAt(Index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(DeviceID).deviceStatus.CutWeightFeedback;
  1627. DeviceInquire.GetInstance.GetDevice(DeviceID).StatusReset();
  1628. if (DeviceID >= 1 && DeviceID <= 8)
  1629. {
  1630. HKDevice.HK_PLC_S7.Write("DB4.DBX30." + (DeviceID - 1), true);
  1631. }
  1632. else if (DeviceID >= 9 && DeviceID <= 15)
  1633. {
  1634. HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (DeviceID - 9), true);
  1635. }
  1636. }
  1637. }
  1638. /// <summary>
  1639. /// 风送变量复位原料设定重量及配方制作完成接收。
  1640. /// </summary>
  1641. private void WindSendReset()
  1642. {
  1643. float weight = (float)0.0;
  1644. WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD0", weight);
  1645. WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD4", weight);
  1646. WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD8", weight);
  1647. WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD12", weight);
  1648. WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD16", weight);
  1649. WindSendDevice.Siemens_PLC_S7.Write("DB95.DBX38.1", false);
  1650. }
  1651. public void RawMaterialNameWithCode()
  1652. {
  1653. GVL_SmallStation.GetInstance.RawMaterialsNameCode.Clear();
  1654. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0001", "色拉油");
  1655. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0002", "一级菜油");
  1656. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0003", "菜籽油");
  1657. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0004", "青花椒油");
  1658. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0005", "卤牛肉丁");
  1659. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0006", "冻鸡肉丁");
  1660. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0007", "香菇丁");
  1661. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0008", "高水分糍粑海椒");
  1662. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0009", "低水分糍粑海椒");
  1663. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0010", "辣豆瓣");
  1664. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0011", "整豆豉");
  1665. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0012", "豆豉细粒");
  1666. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0013", "卤黄豆");
  1667. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0014", "野山椒粒");
  1668. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0015", "竹笋丁");
  1669. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0016", "香辣酱辣椒酱");
  1670. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0017", "芽菜粒");
  1671. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0018", "榨菜丁");
  1672. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0019", "盐菜");
  1673. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0020", "洋葱丁");
  1674. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0021", "番茄酱");
  1675. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0022", "甜豆瓣");
  1676. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0023", "甜面酱");
  1677. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0024", "芝麻酱");
  1678. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0025", "炸花生");
  1679. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0026", "盐渍青椒丁");
  1680. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0027", "备料剁红椒");
  1681. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0028", "萝卜丁");
  1682. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0029", "油芝麻");
  1683. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0030", "生姜");
  1684. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0031", "大蒜");
  1685. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0032", "榨菜酱");
  1686. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0033", "炸碗豆");
  1687. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0034", "大头菜丁");
  1688. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0035", "酱油");
  1689. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0036", "I+G");
  1690. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0037", "味精");
  1691. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0038", "白糖");
  1692. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0039", "食盐");
  1693. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0040", "花椒酱");
  1694. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0041", "调味膏2");
  1695. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0042", "调味膏5");
  1696. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0043", "十三香调味膏");
  1697. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0044", "酱香膏");
  1698. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0045", "芽菜香料粉");
  1699. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0046", "香料A");
  1700. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0047", "香料D");
  1701. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0048", "猪肉精膏");
  1702. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0049", "调味膏3");
  1703. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0050", "柠檬酸粉");
  1704. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0051", "辣椒红");
  1705. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0052", "辣椒油树脂");
  1706. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0053", "水态混和酸");
  1707. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0054", "加水稀释后防腐剂");
  1708. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0055", "异维C钠粉");
  1709. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0056", "琼脂粉");
  1710. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0057", "香葱油");
  1711. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0058", "水态甜味剂");
  1712. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0059", "孜然粉");
  1713. GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0060", "孜然油");
  1714. }
  1715. }
  1716. }