终端一体化运控平台
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

1402 righe
79 KiB

  1. using BPASmartClient.CustomResource.Pages.Model;
  2. using BPASmartClient.Helper;
  3. using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
  4. using BPASmartClient.JXJFoodBigStation.Model.Siemens;
  5. using BPASmartClient.Modbus;
  6. using System;
  7. using System.Collections.Concurrent;
  8. using System.Collections.Generic;
  9. using System.Collections.ObjectModel;
  10. using System.Configuration;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading;
  14. using System.Threading.Tasks;
  15. namespace BPASmartClient.JXJFoodBigStation.Model
  16. {
  17. public class ProcessControl
  18. {
  19. private volatile static ProcessControl _Instance;
  20. public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl());
  21. private ProcessControl() { }
  22. public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
  23. public HKDeviceStatus HKDevice = new HKDeviceStatus();
  24. DL_Finish_DB FinishData = new DL_Finish_DB();
  25. /// <summary>
  26. /// 西门子配方数据
  27. /// </summary>
  28. public ObservableCollection<RecipeData> SiemensRecipes = new ObservableCollection<RecipeData>();
  29. /// <summary>
  30. /// 本地配方数据
  31. /// </summary>
  32. public ObservableCollection<RecipeData> LocalRecipes = new ObservableCollection<RecipeData>();
  33. /// <summary>
  34. /// 配方等待执行
  35. /// </summary>
  36. public ObservableCollection<RecipeData> RecipeWaitExecute = new ObservableCollection<RecipeData>();
  37. /// <summary>
  38. /// 配方正在执行
  39. /// </summary>
  40. public ObservableCollection<RecipeData> RecipeExecuting = new ObservableCollection<RecipeData>();
  41. /// <summary>
  42. /// 配方执行完成
  43. /// </summary>
  44. public ObservableCollection<RecipeData> RecipeExecuteComple = new ObservableCollection<RecipeData>();
  45. /// <summary>
  46. /// 原料的名称和料仓的位置对应
  47. /// </summary>
  48. public Dictionary<string, short> RawMaterialsNamePos = new Dictionary<string, short>();
  49. /// <summary>
  50. /// 西门子配方队列
  51. /// </summary>
  52. public ConcurrentQueue<string> SiemensRecipeQueue1 = new ConcurrentQueue<string>();
  53. public ConcurrentQueue<string> SiemensRecipeQueue2 = new ConcurrentQueue<string>();
  54. public ConcurrentQueue<string> SiemensRecipeQueue3 = new ConcurrentQueue<string>();
  55. public ConcurrentQueue<string> SiemensRecipeQueue4 = new ConcurrentQueue<string>();
  56. /// <summary>
  57. /// 本地配方队列
  58. /// </summary>
  59. public ConcurrentQueue<string> LocalRecipeQueue1 = new ConcurrentQueue<string>();
  60. public ConcurrentQueue<string> LocalRecipeQueue2 = new ConcurrentQueue<string>();
  61. public ConcurrentQueue<string> LocalRecipeQueue3 = new ConcurrentQueue<string>();
  62. public ConcurrentQueue<string> LocalRecipeQueue4 = new ConcurrentQueue<string>();
  63. public void Init()
  64. {
  65. testRawMaterialNameData();//自定义料仓名称
  66. ActionManage.GetInstance.CancelRegister("SiemensSendRecipe");
  67. ActionManage.GetInstance.Register(new Action<object>((res) =>
  68. {
  69. ObservableCollection<RawMaterial> RawMaterials = new ObservableCollection<RawMaterial>();
  70. if (SiemensDevice.IsConnected)
  71. {
  72. if (res != null && res is DL_Start_DB recipe)
  73. {
  74. RawMaterials.Clear();
  75. for (int i = 0; i < GVL_BigStation.Max_DosingSotckBinNum; i++)
  76. {
  77. if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name))
  78. {
  79. RawMaterials.Add(new RawMaterial()
  80. {
  81. RawMaterialName = recipe.Material[i].Material_Name,
  82. RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum,
  83. RawMaterialWeight = recipe.Material[i].Material_Weight,
  84. RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name]
  85. });
  86. }
  87. else
  88. {
  89. MessageNotify.GetInstance.ShowAlarmLog($"本地原料名称和西门子下发的原料名称无法对应,原料位置:{i}");
  90. }
  91. }
  92. App.Current.Dispatcher.Invoke(() =>
  93. {
  94. Json<RemoteRecipe>.Data.Recipes.Add(new RecipeData()
  95. {
  96. RecipeName = recipe.RecipeName,
  97. RecipeCode = recipe.RecipeCode,
  98. RawMaterial = RawMaterials,
  99. TrayCode = recipe.Job_No,
  100. });
  101. });
  102. }
  103. }
  104. }), "SiemensSendRecipe", true);
  105. string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"];
  106. string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"];
  107. try
  108. {
  109. //HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP);
  110. //SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
  111. if (HKDevice.IsConnected)
  112. {
  113. HKDevice.Init();
  114. MessageNotify.GetInstance.ShowRunLog("海科plc连接成功");
  115. }
  116. if (SiemensDevice.IsConnected)
  117. {
  118. SiemensDevice.Init();
  119. MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功");
  120. }
  121. }
  122. catch (Exception ex)
  123. {
  124. }
  125. LocalRecipeQueue1.Clear();
  126. LocalRecipeQueue2.Clear();
  127. LocalRecipeQueue3.Clear();
  128. LocalRecipeQueue4.Clear();
  129. SiemensRecipeQueue1.Clear();
  130. SiemensRecipeQueue2.Clear();
  131. SiemensRecipeQueue3.Clear();
  132. SiemensRecipeQueue4.Clear();
  133. ThreadManage.GetInstance().StartLong(new Action(() =>
  134. {
  135. ReceviceData();
  136. RecipeInfoToHKPLC();
  137. Thread.Sleep(10);
  138. }), "西门子配方执行流程", true);
  139. ThreadManage.GetInstance().StartLong(new Action(() =>
  140. {
  141. if (GVL_BigStation.IsUseLocalRecipe)
  142. {
  143. LocalRecipeRecevice();
  144. LocalRecipeDosing();
  145. }
  146. Thread.Sleep(10);
  147. }), "本地配方执行流程", true);
  148. }
  149. private void LocalRecipeRecevice()
  150. {
  151. if (LocalRecipes.Count > 0)
  152. {
  153. foreach (var data in LocalRecipes)
  154. {
  155. if (LocalRecipeQueue1.Count == 0 && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
  156. {
  157. if (!(LocalRecipeQueue1.Contains(data.RecipeCode)))
  158. {
  159. LocalRecipeQueue1.Enqueue(data.RecipeCode);
  160. }
  161. }
  162. else if (LocalRecipeQueue2.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
  163. {
  164. if (!(LocalRecipeQueue2.Contains(data.RecipeCode)))
  165. {
  166. LocalRecipeQueue2.Enqueue(data.RecipeCode);
  167. }
  168. }
  169. else if (LocalRecipeQueue3.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
  170. {
  171. if (!(LocalRecipeQueue3.Contains(data.RecipeCode)))
  172. {
  173. LocalRecipeQueue3.Enqueue(data.RecipeCode);
  174. }
  175. }
  176. else if (LocalRecipeQueue4.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode))
  177. {
  178. if (!(LocalRecipeQueue4.Contains(data.RecipeCode)))
  179. {
  180. LocalRecipeQueue4.Enqueue(data.RecipeCode);
  181. }
  182. }
  183. }
  184. }
  185. else
  186. {
  187. LocalRecipeQueue1.Clear();
  188. LocalRecipeQueue2.Clear();
  189. LocalRecipeQueue3.Clear();
  190. LocalRecipeQueue4.Clear();
  191. GVL_BigStation.Recipe1DosingStatus = 0;
  192. GVL_BigStation.Recipe2DosingStatus = 0;
  193. GVL_BigStation.Recipe3DosingStatus = 0;
  194. GVL_BigStation.Recipe4DosingStatus = 0;
  195. }
  196. }
  197. private void LocalRecipeDosing()
  198. {
  199. if (LocalRecipeQueue1.Count > 0)
  200. {
  201. int index = Array.FindIndex(LocalRecipes.ToArray(), p => p.RecipeCode == LocalRecipeQueue1.ElementAt(0));
  202. if (index >= 0 && index < LocalRecipes.Count)
  203. {
  204. string code = LocalRecipes.ElementAt(index).RecipeCode;
  205. int trayCode = LocalRecipes.ElementAt(index).TrayCode;
  206. if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0)//配方1是否允许下发配发
  207. {
  208. HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
  209. HKDevice.PlcWrite.Recipe1IssuedFinish = true;
  210. GVL_BigStation.Recipe1DosingStatus = 1;
  211. MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
  212. }
  213. if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1)
  214. {
  215. GVL_BigStation.Recipe1DosingStatus = 2;
  216. HKDevice.PlcWrite.Recipe1IssuedFinish = false;
  217. StockBinParReset();
  218. MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
  219. }
  220. if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish)
  221. {
  222. GVL_BigStation.Recipe1DosingStatus = 3;
  223. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
  224. if (HKDevice.PlcRead.Recipe1TrayCode == 1)
  225. {
  226. foreach (var item in LocalRecipes.ElementAt(index).RawMaterial)
  227. {
  228. if (item.RawMaterialLocation == 1)
  229. {
  230. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
  231. }
  232. else if (item.RawMaterialLocation == 2)
  233. {
  234. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
  235. }
  236. else if (item.RawMaterialLocation == 3)
  237. {
  238. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
  239. }
  240. else if (item.RawMaterialLocation == 4)
  241. {
  242. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
  243. }
  244. else if (item.RawMaterialLocation == 5)
  245. {
  246. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
  247. }
  248. else if (item.RawMaterialLocation == 6)
  249. {
  250. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
  251. }
  252. else if (item.RawMaterialLocation == 7)
  253. {
  254. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
  255. }
  256. else if (item.RawMaterialLocation == 8)
  257. {
  258. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
  259. }
  260. else if (item.RawMaterialLocation == 9)
  261. {
  262. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
  263. }
  264. else if (item.RawMaterialLocation == 10)
  265. {
  266. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
  267. }
  268. else if (item.RawMaterialLocation == 11)
  269. {
  270. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
  271. }
  272. else if (item.RawMaterialLocation == 12)
  273. {
  274. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
  275. }
  276. else if (item.RawMaterialLocation == 13)
  277. {
  278. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
  279. }
  280. else if (item.RawMaterialLocation == 14)
  281. {
  282. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
  283. }
  284. }
  285. }
  286. LocalRecipeQueue1.TryDequeue(out code);
  287. RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将配方添加到完成列表
  288. //App.Current.Dispatcher.Invoke(() => {
  289. // Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  290. //});
  291. LocalRecipes.RemoveAt(index);
  292. GVL_BigStation.Recipe1DosingStatus = 0;
  293. }
  294. }
  295. }
  296. if (LocalRecipeQueue2.Count > 0)
  297. {
  298. int index = Array.FindIndex(LocalRecipes.ToArray(), p => p.RecipeCode == LocalRecipeQueue2.ElementAt(0));
  299. if (index >= 0 && index < LocalRecipes.Count)
  300. {
  301. string code = LocalRecipes.ElementAt(index).RecipeCode;
  302. int trayCode = LocalRecipes.ElementAt(index).TrayCode;
  303. if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0)//配方2是否允许下发配发
  304. {
  305. HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
  306. HKDevice.PlcWrite.Recipe2IssuedFinish = true;
  307. GVL_BigStation.Recipe2DosingStatus = 1;
  308. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
  309. }
  310. if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1)
  311. {
  312. GVL_BigStation.Recipe2DosingStatus = 2;
  313. HKDevice.PlcWrite.Recipe2IssuedFinish = false;
  314. StockBinParReset();
  315. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
  316. }
  317. if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish)
  318. {
  319. GVL_BigStation.Recipe2DosingStatus = 3;
  320. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
  321. if (HKDevice.PlcRead.Recipe2TrayCode > 0)
  322. {
  323. foreach (var item in LocalRecipes.ElementAt(index).RawMaterial)
  324. {
  325. if (item.RawMaterialLocation == 1)
  326. {
  327. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
  328. }
  329. else if (item.RawMaterialLocation == 2)
  330. {
  331. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
  332. }
  333. else if (item.RawMaterialLocation == 3)
  334. {
  335. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
  336. }
  337. else if (item.RawMaterialLocation == 4)
  338. {
  339. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
  340. }
  341. else if (item.RawMaterialLocation == 5)
  342. {
  343. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
  344. }
  345. else if (item.RawMaterialLocation == 6)
  346. {
  347. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
  348. }
  349. else if (item.RawMaterialLocation == 7)
  350. {
  351. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
  352. }
  353. else if (item.RawMaterialLocation == 8)
  354. {
  355. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
  356. }
  357. else if (item.RawMaterialLocation == 9)
  358. {
  359. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
  360. }
  361. else if (item.RawMaterialLocation == 10)
  362. {
  363. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
  364. }
  365. else if (item.RawMaterialLocation == 11)
  366. {
  367. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
  368. }
  369. else if (item.RawMaterialLocation == 12)
  370. {
  371. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
  372. }
  373. else if (item.RawMaterialLocation == 13)
  374. {
  375. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
  376. }
  377. else if (item.RawMaterialLocation == 14)
  378. {
  379. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
  380. }
  381. }
  382. }
  383. LocalRecipeQueue2.TryDequeue(out code);
  384. RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将该配方添加到下
  385. //App.Current.Dispatcher.Invoke(() => {
  386. // Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  387. //});
  388. LocalRecipes.RemoveAt(index);
  389. GVL_BigStation.Recipe2DosingStatus = 0;
  390. }
  391. }
  392. }
  393. if (LocalRecipeQueue3.Count > 0)
  394. {
  395. int index = Array.FindIndex(LocalRecipes.ToArray(), p => p.RecipeCode == LocalRecipeQueue3.ElementAt(0));
  396. if (index >= 0 && index < LocalRecipes.Count)
  397. {
  398. string code = LocalRecipes.ElementAt(index).RecipeCode;
  399. int trayCode = LocalRecipes.ElementAt(index).TrayCode;
  400. if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0)//配方3是否允许下发配发
  401. {
  402. HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
  403. HKDevice.PlcWrite.Recipe3IssuedFinish = true;
  404. GVL_BigStation.Recipe3DosingStatus = 1;
  405. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
  406. }
  407. if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1)
  408. {
  409. GVL_BigStation.Recipe3DosingStatus = 2;
  410. StockBinParReset();
  411. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
  412. }
  413. if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2)
  414. {
  415. GVL_BigStation.Recipe3DosingStatus = 3;
  416. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
  417. if (HKDevice.PlcRead.Recipe3TrayCode > 0)
  418. {
  419. foreach (var item in LocalRecipes.ElementAt(index).RawMaterial)
  420. {
  421. if (item.RawMaterialLocation == 1)
  422. {
  423. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
  424. }
  425. else if (item.RawMaterialLocation == 2)
  426. {
  427. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
  428. }
  429. else if (item.RawMaterialLocation == 3)
  430. {
  431. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
  432. }
  433. else if (item.RawMaterialLocation == 4)
  434. {
  435. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
  436. }
  437. else if (item.RawMaterialLocation == 5)
  438. {
  439. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
  440. }
  441. else if (item.RawMaterialLocation == 6)
  442. {
  443. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
  444. }
  445. else if (item.RawMaterialLocation == 7)
  446. {
  447. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
  448. }
  449. else if (item.RawMaterialLocation == 8)
  450. {
  451. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
  452. }
  453. else if (item.RawMaterialLocation == 9)
  454. {
  455. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
  456. }
  457. else if (item.RawMaterialLocation == 10)
  458. {
  459. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
  460. }
  461. else if (item.RawMaterialLocation == 11)
  462. {
  463. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
  464. }
  465. else if (item.RawMaterialLocation == 12)
  466. {
  467. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
  468. }
  469. else if (item.RawMaterialLocation == 13)
  470. {
  471. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
  472. }
  473. else if (item.RawMaterialLocation == 14)
  474. {
  475. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
  476. }
  477. }
  478. }
  479. HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.1", false);
  480. LocalRecipeQueue3.TryDequeue(out code);
  481. RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将该配方添加到下
  482. //App.Current.Dispatcher.Invoke(() => {
  483. // Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  484. //});
  485. LocalRecipes.RemoveAt(index);
  486. GVL_BigStation.Recipe3DosingStatus = 0;
  487. }
  488. }
  489. }
  490. if (LocalRecipeQueue4.Count > 0)
  491. {
  492. int index = Array.FindIndex(LocalRecipes.ToArray(), p => p.RecipeCode == LocalRecipeQueue4.ElementAt(0));
  493. if (index >= 0 && index < LocalRecipes.Count)
  494. {
  495. string code = LocalRecipes.ElementAt(index).RecipeCode;
  496. int trayCode = LocalRecipes.ElementAt(index).TrayCode;
  497. if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0)//配方4是否允许下发配发
  498. {
  499. HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
  500. HKDevice.PlcWrite.Recipe4IssuedFinish = true;
  501. GVL_BigStation.Recipe4DosingStatus = 1;
  502. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
  503. }
  504. if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1)
  505. {
  506. GVL_BigStation.Recipe4DosingStatus = 2;
  507. HKDevice.PlcWrite.Recipe4IssuedFinish = false;
  508. StockBinParReset();
  509. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
  510. }
  511. if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish)
  512. {
  513. GVL_BigStation.Recipe4DosingStatus = 3;
  514. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
  515. if (HKDevice.PlcRead.Recipe4TrayCode > 0)
  516. {
  517. foreach (var item in LocalRecipes.ElementAt(index).RawMaterial)
  518. {
  519. if (item.RawMaterialLocation == 1)
  520. {
  521. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
  522. }
  523. else if (item.RawMaterialLocation == 2)
  524. {
  525. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
  526. }
  527. else if (item.RawMaterialLocation == 3)
  528. {
  529. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
  530. }
  531. else if (item.RawMaterialLocation == 4)
  532. {
  533. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
  534. }
  535. else if (item.RawMaterialLocation == 5)
  536. {
  537. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
  538. }
  539. else if (item.RawMaterialLocation == 6)
  540. {
  541. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
  542. }
  543. else if (item.RawMaterialLocation == 7)
  544. {
  545. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
  546. }
  547. else if (item.RawMaterialLocation == 8)
  548. {
  549. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
  550. }
  551. else if (item.RawMaterialLocation == 9)
  552. {
  553. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
  554. }
  555. else if (item.RawMaterialLocation == 10)
  556. {
  557. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
  558. }
  559. else if (item.RawMaterialLocation == 11)
  560. {
  561. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
  562. }
  563. else if (item.RawMaterialLocation == 12)
  564. {
  565. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
  566. }
  567. else if (item.RawMaterialLocation == 13)
  568. {
  569. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
  570. }
  571. else if (item.RawMaterialLocation == 14)
  572. {
  573. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
  574. }
  575. }
  576. }
  577. HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.3", false);
  578. LocalRecipeQueue4.TryDequeue(out code);
  579. RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将该配方添加到下
  580. //App.Current.Dispatcher.Invoke(() => {
  581. // Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  582. //});
  583. LocalRecipes.RemoveAt(index);
  584. GVL_BigStation.Recipe4DosingStatus = 0;
  585. }
  586. }
  587. }
  588. }
  589. private void ReceviceData()
  590. {
  591. SiemensRecipes = Json<RemoteRecipe>.Data.Recipes;
  592. if (SiemensRecipes.Count > 0)
  593. {
  594. foreach (var data in SiemensRecipes)
  595. {
  596. if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
  597. {
  598. if (!(SiemensRecipeQueue1.Contains(data.RecipeCode)))
  599. {
  600. if (SiemensDevice.DL_Status is DL_Status_DB status)
  601. {
  602. if (GVL_BigStation.SiemensSendRecipeStatus == 3)
  603. {
  604. GVL_BigStation.SiemensSendRecipeStatus = 4;
  605. SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
  606. SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
  607. }
  608. if (GVL_BigStation.SiemensSendRecipeStatus == 4)
  609. {
  610. if (SiemensDevice.DL_Status.Dosing_Start_ACK)
  611. {
  612. GVL_BigStation.SiemensSendRecipeStatus = 5;
  613. SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
  614. SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
  615. }
  616. }
  617. if (GVL_BigStation.SiemensSendRecipeStatus == 5)
  618. {
  619. if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
  620. {
  621. GVL_BigStation.SiemensSendRecipeStatus = 6;
  622. SiemensRecipeQueue1.Enqueue(data.RecipeCode);
  623. }
  624. }
  625. }
  626. }
  627. }
  628. else if (SiemensRecipeQueue2.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
  629. {
  630. if (!(SiemensRecipeQueue2.Contains(data.RecipeCode)))
  631. {
  632. if (SiemensDevice.DL_Status is DL_Status_DB status)
  633. {
  634. if (GVL_BigStation.SiemensSendRecipeStatus == 3)
  635. {
  636. GVL_BigStation.SiemensSendRecipeStatus = 4;
  637. SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
  638. SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
  639. }
  640. if (GVL_BigStation.SiemensSendRecipeStatus == 4)
  641. {
  642. if (SiemensDevice.DL_Status.Dosing_Start_ACK)
  643. {
  644. GVL_BigStation.SiemensSendRecipeStatus = 5;
  645. SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
  646. SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false);
  647. }
  648. }
  649. if (GVL_BigStation.SiemensSendRecipeStatus == 5)
  650. {
  651. if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
  652. {
  653. GVL_BigStation.SiemensSendRecipeStatus = 6;
  654. SiemensRecipeQueue2.Enqueue(data.RecipeCode);
  655. }
  656. }
  657. }
  658. }
  659. }
  660. else if (SiemensRecipeQueue3.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
  661. {
  662. if (!(SiemensRecipeQueue3.Contains(data.RecipeCode)))
  663. {
  664. if (SiemensDevice.DL_Status is DL_Status_DB status)
  665. {
  666. if (GVL_BigStation.SiemensSendRecipeStatus == 3)
  667. {
  668. GVL_BigStation.SiemensSendRecipeStatus = 4;
  669. SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
  670. SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
  671. }
  672. if (GVL_BigStation.SiemensSendRecipeStatus == 4)
  673. {
  674. if (SiemensDevice.DL_Status.Dosing_Start_ACK)
  675. {
  676. GVL_BigStation.SiemensSendRecipeStatus = 5;
  677. SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
  678. SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false);
  679. }
  680. }
  681. if (GVL_BigStation.SiemensSendRecipeStatus == 5)
  682. {
  683. if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
  684. {
  685. GVL_BigStation.SiemensSendRecipeStatus = 6;
  686. SiemensRecipeQueue3.Enqueue(data.RecipeCode);
  687. }
  688. }
  689. }
  690. }
  691. }
  692. else if (SiemensRecipeQueue4.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode))
  693. {
  694. if (!(SiemensRecipeQueue4.Contains(data.RecipeCode)))
  695. {
  696. if (SiemensDevice.DL_Status is DL_Status_DB status)
  697. {
  698. if (GVL_BigStation.SiemensSendRecipeStatus == 3)
  699. {
  700. GVL_BigStation.SiemensSendRecipeStatus = 4;
  701. SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
  702. SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
  703. }
  704. if (GVL_BigStation.SiemensSendRecipeStatus == 4)
  705. {
  706. if (SiemensDevice.DL_Status.Dosing_Start_ACK)
  707. {
  708. GVL_BigStation.SiemensSendRecipeStatus = 5;
  709. SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
  710. SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false);
  711. }
  712. }
  713. if (GVL_BigStation.SiemensSendRecipeStatus == 5)
  714. {
  715. if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
  716. {
  717. GVL_BigStation.SiemensSendRecipeStatus = 6;
  718. SiemensRecipeQueue4.Enqueue(data.RecipeCode);
  719. }
  720. }
  721. }
  722. }
  723. }
  724. }
  725. }
  726. else
  727. {
  728. SiemensRecipeQueue1.Clear();
  729. SiemensRecipeQueue2.Clear();
  730. SiemensRecipeQueue3.Clear();
  731. SiemensRecipeQueue4.Clear();
  732. GVL_BigStation.Recipe1DosingStatus = 0;
  733. GVL_BigStation.Recipe2DosingStatus = 0;
  734. GVL_BigStation.Recipe3DosingStatus = 0;
  735. GVL_BigStation.Recipe4DosingStatus = 0;
  736. }
  737. }
  738. private void RecipeInfoToHKPLC()
  739. {
  740. if (SiemensRecipeQueue1.Count > 0)
  741. {
  742. int index = Array.FindIndex(SiemensRecipes.ToArray(), p => p.RecipeCode == SiemensRecipeQueue1.ElementAt(0));
  743. if (index >= 0 && index < SiemensRecipes.Count)
  744. {
  745. string code = SiemensRecipes.ElementAt(index).RecipeCode;
  746. int trayCode = SiemensRecipes.ElementAt(index).TrayCode;
  747. if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0)//配方1是否允许下发配发
  748. {
  749. HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
  750. HKDevice.PlcWrite.Recipe1IssuedFinish = true;
  751. GVL_BigStation.Recipe1DosingStatus = 1;
  752. MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
  753. }
  754. if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1)
  755. {
  756. GVL_BigStation.Recipe1DosingStatus = 2;
  757. HKDevice.PlcWrite.Recipe1IssuedFinish = false;
  758. StockBinParReset();
  759. MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
  760. }
  761. if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish)
  762. {
  763. GVL_BigStation.Recipe1DosingStatus = 3;
  764. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
  765. if (HKDevice.PlcRead.Recipe1TrayCode == 1)
  766. {
  767. foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
  768. {
  769. if (item.RawMaterialLocation == 1)
  770. {
  771. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
  772. }
  773. else if (item.RawMaterialLocation == 2)
  774. {
  775. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
  776. }
  777. else if (item.RawMaterialLocation == 3)
  778. {
  779. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
  780. }
  781. else if (item.RawMaterialLocation == 4)
  782. {
  783. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
  784. }
  785. else if (item.RawMaterialLocation == 5)
  786. {
  787. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
  788. }
  789. else if (item.RawMaterialLocation == 6)
  790. {
  791. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
  792. }
  793. else if (item.RawMaterialLocation == 7)
  794. {
  795. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
  796. }
  797. else if (item.RawMaterialLocation == 8)
  798. {
  799. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
  800. }
  801. else if (item.RawMaterialLocation == 9)
  802. {
  803. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
  804. }
  805. else if (item.RawMaterialLocation == 10)
  806. {
  807. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
  808. }
  809. else if (item.RawMaterialLocation == 11)
  810. {
  811. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
  812. }
  813. else if (item.RawMaterialLocation == 12)
  814. {
  815. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
  816. }
  817. else if (item.RawMaterialLocation == 13)
  818. {
  819. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
  820. }
  821. else if (item.RawMaterialLocation == 14)
  822. {
  823. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
  824. }
  825. }
  826. }
  827. if (SiemensDevice.IsConnected)
  828. {
  829. FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
  830. FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
  831. FinishData.job_No = (short)SiemensRecipes.ElementAt(index).TrayCode;
  832. for (int i = 0; i < FinishData.Material.Length; i++)
  833. {
  834. FinishData.Material[i] = new UDT1();
  835. }
  836. for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
  837. {
  838. FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
  839. FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
  840. FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
  841. }
  842. FinishData.Ask_For_Finish = true;
  843. GVL_BigStation.SiemensSendRecipeStatus = 7;
  844. SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
  845. }
  846. SiemensRecipeQueue1.TryDequeue(out code);
  847. RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将配方添加到完成列表
  848. if (!GVL_BigStation.IsUseLocalRecipe)
  849. {
  850. App.Current.Dispatcher.Invoke(() => {
  851. Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  852. });
  853. }
  854. else
  855. {
  856. App.Current.Dispatcher.Invoke(() => {
  857. Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  858. });
  859. }
  860. GVL_BigStation.Recipe1DosingStatus = 0;
  861. }
  862. }
  863. }
  864. if (SiemensRecipeQueue2.Count > 0)
  865. {
  866. int index = Array.FindIndex(SiemensRecipes.ToArray(), p => p.RecipeCode == SiemensRecipeQueue2.ElementAt(0));
  867. if (index >= 0 && index < SiemensRecipes.Count)
  868. {
  869. string code = SiemensRecipes.ElementAt(index).RecipeCode;
  870. int trayCode = SiemensRecipes.ElementAt(index).TrayCode;
  871. if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0)//配方2是否允许下发配发
  872. {
  873. HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
  874. HKDevice.PlcWrite.Recipe2IssuedFinish = true;
  875. GVL_BigStation.Recipe2DosingStatus = 1;
  876. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
  877. }
  878. if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1)
  879. {
  880. GVL_BigStation.Recipe2DosingStatus = 2;
  881. HKDevice.PlcWrite.Recipe2IssuedFinish = false;
  882. StockBinParReset();
  883. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
  884. }
  885. if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish)
  886. {
  887. GVL_BigStation.Recipe2DosingStatus = 3;
  888. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
  889. if (HKDevice.PlcRead.Recipe2TrayCode > 0)
  890. {
  891. foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
  892. {
  893. if (item.RawMaterialLocation == 1)
  894. {
  895. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
  896. }
  897. else if (item.RawMaterialLocation == 2)
  898. {
  899. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
  900. }
  901. else if (item.RawMaterialLocation == 3)
  902. {
  903. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
  904. }
  905. else if (item.RawMaterialLocation == 4)
  906. {
  907. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
  908. }
  909. else if (item.RawMaterialLocation == 5)
  910. {
  911. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
  912. }
  913. else if (item.RawMaterialLocation == 6)
  914. {
  915. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
  916. }
  917. else if (item.RawMaterialLocation == 7)
  918. {
  919. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
  920. }
  921. else if (item.RawMaterialLocation == 8)
  922. {
  923. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
  924. }
  925. else if (item.RawMaterialLocation == 9)
  926. {
  927. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
  928. }
  929. else if (item.RawMaterialLocation == 10)
  930. {
  931. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
  932. }
  933. else if (item.RawMaterialLocation == 11)
  934. {
  935. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
  936. }
  937. else if (item.RawMaterialLocation == 12)
  938. {
  939. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
  940. }
  941. else if (item.RawMaterialLocation == 13)
  942. {
  943. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
  944. }
  945. else if (item.RawMaterialLocation == 14)
  946. {
  947. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
  948. }
  949. }
  950. FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
  951. FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
  952. for (int i = 0; i < FinishData.Material.Length; i++)
  953. {
  954. FinishData.Material[i] = new UDT1();
  955. }
  956. for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
  957. {
  958. FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
  959. FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
  960. FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
  961. }
  962. }
  963. if (SiemensDevice.IsConnected)
  964. {
  965. SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
  966. MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子");
  967. }
  968. SiemensRecipeQueue2.TryDequeue(out code);
  969. RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));
  970. if (!GVL_BigStation.IsUseLocalRecipe)
  971. {
  972. Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  973. }
  974. else
  975. {
  976. Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  977. }
  978. GVL_BigStation.Recipe2DosingStatus = 0;
  979. }
  980. }
  981. }
  982. if (SiemensRecipeQueue3.Count > 0)
  983. {
  984. int index = Array.FindIndex(SiemensRecipes.ToArray(), p => p.RecipeCode == SiemensRecipeQueue3.ElementAt(0));
  985. if (index >= 0 && index < SiemensRecipes.Count)
  986. {
  987. string code = SiemensRecipes.ElementAt(index).RecipeCode;
  988. int trayCode = SiemensRecipes.ElementAt(index).TrayCode;
  989. if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0)//配方3是否允许下发配发
  990. {
  991. HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
  992. HKDevice.PlcWrite.Recipe3IssuedFinish = true;
  993. GVL_BigStation.Recipe3DosingStatus = 1;
  994. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
  995. }
  996. if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1)
  997. {
  998. GVL_BigStation.Recipe3DosingStatus = 2;
  999. StockBinParReset();
  1000. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
  1001. }
  1002. if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2)
  1003. {
  1004. GVL_BigStation.Recipe3DosingStatus = 3;
  1005. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
  1006. if (HKDevice.PlcRead.Recipe3TrayCode > 0)
  1007. {
  1008. foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
  1009. {
  1010. if (item.RawMaterialLocation == 1)
  1011. {
  1012. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
  1013. }
  1014. else if (item.RawMaterialLocation == 2)
  1015. {
  1016. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
  1017. }
  1018. else if (item.RawMaterialLocation == 3)
  1019. {
  1020. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
  1021. }
  1022. else if (item.RawMaterialLocation == 4)
  1023. {
  1024. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
  1025. }
  1026. else if (item.RawMaterialLocation == 5)
  1027. {
  1028. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
  1029. }
  1030. else if (item.RawMaterialLocation == 6)
  1031. {
  1032. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
  1033. }
  1034. else if (item.RawMaterialLocation == 7)
  1035. {
  1036. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
  1037. }
  1038. else if (item.RawMaterialLocation == 8)
  1039. {
  1040. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
  1041. }
  1042. else if (item.RawMaterialLocation == 9)
  1043. {
  1044. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
  1045. }
  1046. else if (item.RawMaterialLocation == 10)
  1047. {
  1048. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
  1049. }
  1050. else if (item.RawMaterialLocation == 11)
  1051. {
  1052. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
  1053. }
  1054. else if (item.RawMaterialLocation == 12)
  1055. {
  1056. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
  1057. }
  1058. else if (item.RawMaterialLocation == 13)
  1059. {
  1060. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
  1061. }
  1062. else if (item.RawMaterialLocation == 14)
  1063. {
  1064. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
  1065. }
  1066. }
  1067. FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
  1068. FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
  1069. for (int i = 0; i < FinishData.Material.Length; i++)
  1070. {
  1071. FinishData.Material[i] = new UDT1();
  1072. }
  1073. for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
  1074. {
  1075. FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
  1076. FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
  1077. FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
  1078. }
  1079. }
  1080. if (SiemensDevice.IsConnected)
  1081. {
  1082. SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
  1083. }
  1084. HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.1", false);
  1085. SiemensRecipeQueue3.TryDequeue(out code);
  1086. RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将该配方添加到下
  1087. if (!GVL_BigStation.IsUseLocalRecipe)
  1088. {
  1089. Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  1090. }
  1091. else
  1092. {
  1093. Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  1094. }
  1095. GVL_BigStation.Recipe3DosingStatus = 0;
  1096. }
  1097. }
  1098. }
  1099. if (SiemensRecipeQueue4.Count > 0)
  1100. {
  1101. int index = Array.FindIndex(SiemensRecipes.ToArray(), p => p.RecipeCode == SiemensRecipeQueue4.ElementAt(0));
  1102. if (index >= 0 && index < SiemensRecipes.Count)
  1103. {
  1104. string code = SiemensRecipes.ElementAt(index).RecipeCode;
  1105. int trayCode = SiemensRecipes.ElementAt(index).TrayCode;
  1106. if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0)//配方4是否允许下发配发
  1107. {
  1108. HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
  1109. HKDevice.PlcWrite.Recipe4IssuedFinish = true;
  1110. GVL_BigStation.Recipe4DosingStatus = 1;
  1111. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
  1112. }
  1113. if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1)
  1114. {
  1115. GVL_BigStation.Recipe4DosingStatus = 2;
  1116. HKDevice.PlcWrite.Recipe4IssuedFinish = false;
  1117. StockBinParReset();
  1118. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
  1119. }
  1120. if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish)
  1121. {
  1122. GVL_BigStation.Recipe4DosingStatus = 3;
  1123. MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
  1124. if (HKDevice.PlcRead.Recipe4TrayCode > 0)
  1125. {
  1126. foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
  1127. {
  1128. if (item.RawMaterialLocation == 1)
  1129. {
  1130. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
  1131. }
  1132. else if (item.RawMaterialLocation == 2)
  1133. {
  1134. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
  1135. }
  1136. else if (item.RawMaterialLocation == 3)
  1137. {
  1138. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
  1139. }
  1140. else if (item.RawMaterialLocation == 4)
  1141. {
  1142. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
  1143. }
  1144. else if (item.RawMaterialLocation == 5)
  1145. {
  1146. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
  1147. }
  1148. else if (item.RawMaterialLocation == 6)
  1149. {
  1150. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
  1151. }
  1152. else if (item.RawMaterialLocation == 7)
  1153. {
  1154. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
  1155. }
  1156. else if (item.RawMaterialLocation == 8)
  1157. {
  1158. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
  1159. }
  1160. else if (item.RawMaterialLocation == 9)
  1161. {
  1162. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
  1163. }
  1164. else if (item.RawMaterialLocation == 10)
  1165. {
  1166. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
  1167. }
  1168. else if (item.RawMaterialLocation == 11)
  1169. {
  1170. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
  1171. }
  1172. else if (item.RawMaterialLocation == 12)
  1173. {
  1174. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
  1175. }
  1176. else if (item.RawMaterialLocation == 13)
  1177. {
  1178. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
  1179. }
  1180. else if (item.RawMaterialLocation == 14)
  1181. {
  1182. item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
  1183. }
  1184. }
  1185. FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
  1186. FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
  1187. for (int i = 0; i < FinishData.Material.Length; i++)
  1188. {
  1189. FinishData.Material[i] = new UDT1();
  1190. }
  1191. for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
  1192. {
  1193. FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
  1194. FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
  1195. FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
  1196. }
  1197. }
  1198. if (SiemensDevice.IsConnected)
  1199. {
  1200. SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
  1201. }
  1202. HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.3", false);
  1203. SiemensRecipeQueue4.TryDequeue(out code);
  1204. RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将该配方添加到下
  1205. if (!GVL_BigStation.IsUseLocalRecipe)
  1206. {
  1207. Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  1208. }
  1209. else
  1210. {
  1211. Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
  1212. }
  1213. GVL_BigStation.Recipe4DosingStatus = 0;
  1214. }
  1215. }
  1216. }
  1217. }
  1218. /// <summary>
  1219. /// 下发plc的配方数据复位
  1220. /// </summary>
  1221. private void StockBinParReset()
  1222. {
  1223. HKDevice.PlcWrite.RecipeCode = 0;
  1224. HKDevice.PlcWrite.TrayCode = 0;
  1225. HKDevice.PlcWrite.Bareel1Bin1SetWeight = 0;
  1226. HKDevice.PlcWrite.Bareel1Bin2SetWeight = 0;
  1227. HKDevice.PlcWrite.Bareel1Bin3SetWeight = 0;
  1228. HKDevice.PlcWrite.Bareel1Bin4SetWeight = 0;
  1229. HKDevice.PlcWrite.Bareel1Bin5SetWeight = 0;
  1230. HKDevice.PlcWrite.Bareel1Bin6SetWeight = 0;
  1231. HKDevice.PlcWrite.Bareel1Bin7SetWeight = 0;
  1232. HKDevice.PlcWrite.Bareel1Bin8SetWeight = 0;
  1233. HKDevice.PlcWrite.Bareel1Bin9SetWeight = 0;
  1234. HKDevice.PlcWrite.Bareel1Bin10SetWeight = 0;
  1235. HKDevice.PlcWrite.Bareel1Bin11SetWeight = 0;
  1236. HKDevice.PlcWrite.Bareel1Bin12SetWeight = 0;
  1237. HKDevice.PlcWrite.Bareel1Bin13SetWeight = 0;
  1238. HKDevice.PlcWrite.Bareel1Bin14SetWeight = 0;
  1239. HKDevice.PlcWrite.Bareel2Bin1SetWeight = 0;
  1240. HKDevice.PlcWrite.Bareel2Bin2SetWeight = 0;
  1241. HKDevice.PlcWrite.Bareel2Bin3SetWeight = 0;
  1242. HKDevice.PlcWrite.Bareel2Bin4SetWeight = 0;
  1243. HKDevice.PlcWrite.Bareel2Bin5SetWeight = 0;
  1244. HKDevice.PlcWrite.Bareel2Bin6SetWeight = 0;
  1245. HKDevice.PlcWrite.Bareel2Bin7SetWeight = 0;
  1246. HKDevice.PlcWrite.Bareel2Bin8SetWeight = 0;
  1247. HKDevice.PlcWrite.Bareel2Bin9SetWeight = 0;
  1248. HKDevice.PlcWrite.Bareel2Bin10SetWeight = 0;
  1249. HKDevice.PlcWrite.Bareel2Bin11SetWeight = 0;
  1250. HKDevice.PlcWrite.Bareel2Bin12SetWeight = 0;
  1251. HKDevice.PlcWrite.Bareel2Bin13SetWeight = 0;
  1252. HKDevice.PlcWrite.Bareel2Bin14SetWeight = 0;
  1253. HKDevice.PlcWrite.Bareel4Bin1SetWeight = 0;
  1254. HKDevice.PlcWrite.Bareel4Bin2SetWeight = 0;
  1255. HKDevice.PlcWrite.Bareel4Bin3SetWeight = 0;
  1256. HKDevice.PlcWrite.Bareel4Bin4SetWeight = 0;
  1257. HKDevice.PlcWrite.Bareel4Bin5SetWeight = 0;
  1258. HKDevice.PlcWrite.Bareel4Bin6SetWeight = 0;
  1259. HKDevice.PlcWrite.Bareel4Bin7SetWeight = 0;
  1260. HKDevice.PlcWrite.Bareel4Bin8SetWeight = 0;
  1261. HKDevice.PlcWrite.Bareel4Bin9SetWeight = 0;
  1262. HKDevice.PlcWrite.Bareel4Bin10SetWeight = 0;
  1263. HKDevice.PlcWrite.Bareel4Bin11SetWeight = 0;
  1264. HKDevice.PlcWrite.Bareel4Bin12SetWeight = 0;
  1265. HKDevice.PlcWrite.Bareel4Bin13SetWeight = 0;
  1266. HKDevice.PlcWrite.Bareel4Bin14SetWeight = 0;
  1267. HKDevice.PlcWrite.Bareel5Bin1SetWeight = 0;
  1268. HKDevice.PlcWrite.Bareel5Bin2SetWeight = 0;
  1269. HKDevice.PlcWrite.Bareel5Bin3SetWeight = 0;
  1270. HKDevice.PlcWrite.Bareel5Bin4SetWeight = 0;
  1271. HKDevice.PlcWrite.Bareel5Bin5SetWeight = 0;
  1272. HKDevice.PlcWrite.Bareel5Bin6SetWeight = 0;
  1273. HKDevice.PlcWrite.Bareel5Bin7SetWeight = 0;
  1274. HKDevice.PlcWrite.Bareel5Bin8SetWeight = 0;
  1275. HKDevice.PlcWrite.Bareel5Bin9SetWeight = 0;
  1276. HKDevice.PlcWrite.Bareel5Bin10SetWeight = 0;
  1277. HKDevice.PlcWrite.Bareel5Bin11SetWeight = 0;
  1278. HKDevice.PlcWrite.Bareel5Bin12SetWeight = 0;
  1279. HKDevice.PlcWrite.Bareel5Bin13SetWeight = 0;
  1280. HKDevice.PlcWrite.Bareel5Bin14SetWeight = 0;
  1281. }
  1282. private void testRawMaterialNameData()
  1283. {
  1284. RawMaterialsNamePos.Clear();
  1285. if (!HKDevice.IsConnected)
  1286. {
  1287. RawMaterialsNamePos.Add("0005", 1);
  1288. RawMaterialsNamePos.Add("0006", 2);
  1289. RawMaterialsNamePos.Add("0007", 3);
  1290. RawMaterialsNamePos.Add("0008", 4);
  1291. RawMaterialsNamePos.Add("0009", 5);
  1292. RawMaterialsNamePos.Add("0010", 6);
  1293. RawMaterialsNamePos.Add("0011", 7);
  1294. RawMaterialsNamePos.Add("0012", 8);
  1295. RawMaterialsNamePos.Add("0013", 9);
  1296. RawMaterialsNamePos.Add("0014", 10);
  1297. RawMaterialsNamePos.Add("0015", 11);
  1298. RawMaterialsNamePos.Add("0016", 12);
  1299. RawMaterialsNamePos.Add("0017", 13);
  1300. RawMaterialsNamePos.Add("0018", 14);
  1301. RawMaterialsNamePos.Add("0019", 14);
  1302. RawMaterialsNamePos.Add("0020", 14);
  1303. RawMaterialsNamePos.Add("0021", 14);
  1304. RawMaterialsNamePos.Add("0022", 14);
  1305. RawMaterialsNamePos.Add("0023", 14);
  1306. RawMaterialsNamePos.Add("0024", 14);
  1307. RawMaterialsNamePos.Add("0025", 14);
  1308. RawMaterialsNamePos.Add("0026", 14);
  1309. RawMaterialsNamePos.Add("0027", 14);
  1310. RawMaterialsNamePos.Add("0028", 14);
  1311. RawMaterialsNamePos.Add("0029", 14);
  1312. RawMaterialsNamePos.Add("0030", 14);
  1313. RawMaterialsNamePos.Add("0031", 14);
  1314. RawMaterialsNamePos.Add("0032", 14);
  1315. RawMaterialsNamePos.Add("0033", 14);
  1316. RawMaterialsNamePos.Add("0034", 14);
  1317. RawMaterialsNamePos.Add("0035", 14);
  1318. RawMaterialsNamePos.Add("0040", 14);
  1319. }
  1320. /*
  1321. HKDevice.StockBinName.RawMaterialName1 = "1";
  1322. HKDevice.StockBinName.RawMaterialName2 = "2";
  1323. HKDevice.StockBinName.RawMaterialName3 = "3";
  1324. HKDevice.StockBinName.RawMaterialName4 = "4";
  1325. HKDevice.StockBinName.RawMaterialName5 = "5";
  1326. HKDevice.StockBinName.RawMaterialName6 = "6";
  1327. HKDevice.StockBinName.RawMaterialName7 = "7";
  1328. HKDevice.StockBinName.RawMaterialName8 = "8";
  1329. HKDevice.StockBinName.RawMaterialName9 = "9";
  1330. HKDevice.StockBinName.RawMaterialName10 = "10";
  1331. HKDevice.StockBinName.RawMaterialName11 = "11";
  1332. HKDevice.StockBinName.RawMaterialName12 = "12";
  1333. HKDevice.StockBinName.RawMaterialName13 = "13";
  1334. HKDevice.StockBinName.RawMaterialName14 = "14";
  1335. }
  1336. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName1))
  1337. {
  1338. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName1, 1);
  1339. }
  1340. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName2))
  1341. {
  1342. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName2, 2);
  1343. }
  1344. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName3))
  1345. {
  1346. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName3, 3);
  1347. }
  1348. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName4))
  1349. {
  1350. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName4, 4);
  1351. }
  1352. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName5))
  1353. {
  1354. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName5, 5);
  1355. }
  1356. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName6))
  1357. {
  1358. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName6, 6);
  1359. }
  1360. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName7))
  1361. {
  1362. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName7, 7);
  1363. }
  1364. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName8))
  1365. {
  1366. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName8, 8);
  1367. }
  1368. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName9))
  1369. {
  1370. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName9, 9);
  1371. }
  1372. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName10))
  1373. {
  1374. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName10, 10);
  1375. }
  1376. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName11))
  1377. {
  1378. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName11, 11);
  1379. }
  1380. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName12))
  1381. {
  1382. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName12, 12);
  1383. }
  1384. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName13))
  1385. {
  1386. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName13, 13);
  1387. }
  1388. if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName14))
  1389. {
  1390. RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName14, 14);
  1391. }*/
  1392. }
  1393. }
  1394. }