终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 4 mēnešiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 4 mēnešiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 4 mēnešiem
pirms 2 gadiem
pirms 4 mēnešiem
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 4 mēnešiem
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. using BPA.Helper;
  2. using BPA.Message.Enum;
  3. using BPA.Models;
  4. using BPASmartClient.Device;
  5. using BPASmartClient.Modbus;
  6. using BPASmartClient.Model;
  7. using BPASmartClient.Model.PLC;
  8. using BPASmartClient.Model.;
  9. using BPASmartClient.Model.ƻ;
  10. using BPASmartClient.MorkMW.Model;
  11. using Newtonsoft.Json;
  12. using System;
  13. using System.Collections.Concurrent;
  14. using System.Collections.Generic;
  15. using System.Collections.ObjectModel;
  16. using System.Linq;
  17. using System.Net.Http.Json;
  18. using System.Reflection;
  19. using System.Threading;
  20. using System.Windows.Documents;
  21. using static BPA.Helper.EventBus;
  22. namespace BPASmartClient.MorkMW
  23. {
  24. public class Control_MorkMW : BaseDevice
  25. {
  26. int id = 0;
  27. ModbusTcp modbus;
  28. public override DeviceClientType DeviceType => DeviceClientType.MORKMW;
  29. GVL_MorkMW morkMW = new GVL_MorkMW();
  30. public override void DoMain()
  31. {
  32. Json<KeepDataBase>.Read();
  33. VaribleMonitorDis();
  34. ConnectKlpRobot("192.168.0.100", 8001);
  35. ServerInit();
  36. DataParse();
  37. TaskManage.GetInstance.StartLong(new Action(() => { VariableMonitor(); Thread.Sleep(5); }), "˱״̬߳", true);
  38. }
  39. private void VaribleMonitorDis()
  40. {
  41. PropertyInfo[] pros = morkMW.GetType().GetProperties();
  42. foreach (var item in pros)
  43. {
  44. var res = item.GetCustomAttribute<VariblesAttribute>();
  45. if (res != null)
  46. {
  47. GVL_MorkMW.varibleInfos.Add(new VaribleModel { Id = id + 1, VaribleName = res.VarName, RobotAddress = res.RobotAddress, ModbusAddress = res.ModbusTcpAddress, Notes = res.Notes });
  48. id++;
  49. }
  50. }
  51. }
  52. private void ServerInit()
  53. {
  54. //䷽Ϣ
  55. EventBus.GetInstance.Subscribe<MorkMWGoodsEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
  56. {
  57. if (@event == null) return;
  58. if (@event is MorkMWGoodsEvent recipe)
  59. {
  60. listMorkMWGoods = recipe.morkMWPushMessage?.MorkMWGoods;
  61. DeviceProcessLogShow($"յƻ{listMorkMWGoods?.Count}Ʒ䷽");
  62. }
  63. });
  64. }
  65. public override void MainTask()
  66. {
  67. if (Json<KeepDataBase>.Data.IsVerify)
  68. IsHealth = modbus.Connected;
  69. else
  70. IsHealth = true;//ϱ
  71. ToGetWink();
  72. ToMixWink();
  73. ToPourWink();
  74. SignalDetect();
  75. }
  76. /// <summary>
  77. /// Ӿƹ
  78. /// </summary>
  79. public void ToGetWink()
  80. {
  81. if (!GVL_MorkMW.AllowLocalSimOrder)
  82. {
  83. if (morkMW.RobotIdle && orderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal && modbus.Connected)
  84. {
  85. DeviceProcessLogShow("ʼ");
  86. morkMW.TaskLock = true;
  87. if (orderLocInfos.TryDequeue(out BPASmartClient.MorkMW.Model.OrderLocInfo res))
  88. {
  89. morkMW.CurrentSuborderId = res.SuborderId;
  90. OrderChange(res.SuborderId, ORDER_STATUS.COOKING);
  91. foreach (var item in res.mixWink)
  92. {
  93. switch (item.Loc)
  94. {
  95. // case 7: ToMixWink(); break;
  96. case 1: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break;
  97. case 2: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break;
  98. case 3: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break;
  99. case 4: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break;
  100. case 5: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break;
  101. case 6: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break;
  102. }
  103. switch (item.Loc)
  104. {
  105. //case 7: while (!morkMW.MixWinkComplte) { Thread.Sleep(5); } break;
  106. case 1: while (!morkMW.TakeWinkOneComplete) { Thread.Sleep(5); } break;
  107. case 2: while (!morkMW.TakeWinkTwoComplete) { Thread.Sleep(5); } break;
  108. case 3: while (!morkMW.TakeWinkThreeComplete) { Thread.Sleep(5); } break;
  109. case 4: while (!morkMW.TakeWinkFourComplete) { Thread.Sleep(5); } break;
  110. case 5: while (!morkMW.TakeWinkFiveComplete) { Thread.Sleep(5); } break;
  111. case 6: while (!morkMW.TakeWinkSixComplete) { Thread.Sleep(5); } break;
  112. }
  113. }
  114. morkMW.AllowMixWink = true;//Ӿɣ
  115. // morkMW.AllowPourWink = true;//ɣ
  116. }
  117. }
  118. }
  119. else
  120. {
  121. if (morkMW.RobotIdle && simOrderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal)
  122. {
  123. DeviceProcessLogShow("ʼ");
  124. morkMW.TaskLock = true;
  125. if (simOrderLocInfos.TryDequeue(out SimOrderLocInfo res))
  126. {
  127. foreach (var item in res.mixWink)
  128. {
  129. switch (item.Loc)
  130. {
  131. // case 7: ToMixWink(); break;
  132. case 1: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
  133. case 2: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
  134. case 3: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
  135. case 4: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
  136. case 5: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
  137. case 6: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
  138. }
  139. switch (item.Loc)
  140. {
  141. //case 7: while (!morkMW.MixWinkComplte) { Thread.Sleep(5); } break;
  142. case 1: while (!morkMW.TakeWinkOneComplete) { Thread.Sleep(5); } break;
  143. case 2: while (!morkMW.TakeWinkTwoComplete) { Thread.Sleep(5); } break;
  144. case 3: while (!morkMW.TakeWinkThreeComplete) { Thread.Sleep(5); } break;
  145. case 4: while (!morkMW.TakeWinkFourComplete) { Thread.Sleep(5); } break;
  146. case 5: while (!morkMW.TakeWinkFiveComplete) { Thread.Sleep(5); } break;
  147. case 6: while (!morkMW.TakeWinkSixComplete) { Thread.Sleep(5); } break;
  148. }
  149. }
  150. DeviceProcessLogShow($"λýӾ");
  151. morkMW.AllowMixWink = true;//Ӿɣ
  152. // morkMW.AllowPourWink = true;//ɣ
  153. }
  154. }
  155. }
  156. }
  157. /// <summary>
  158. /// ƹ
  159. /// </summary>
  160. public void ToMixWink()
  161. {
  162. // modbus.WriteSingleRegister(0000, 7);//˵
  163. if (morkMW.AllowMixWink && modbus.Connected)
  164. {
  165. DeviceProcessLogShow("ʼ");
  166. modbus.WriteSingleRegister(0000, 7);//˵
  167. morkMW.AllowMixWink = false;
  168. }
  169. }
  170. /// <summary>
  171. /// ȥӦλýӾ
  172. /// </summary>
  173. /// <param name="loc"></param>
  174. /// <param name="time"></param>
  175. public void ToSpecifiedLocTakeWink(int loc, int time)
  176. {
  177. //ͽӾź
  178. switch (loc)
  179. {
  180. case 1: modbus.WriteSingleRegister(0000, 1); DeviceProcessLogShow($"ʼӡ{loc}λԭ"); break;
  181. case 2: modbus.WriteSingleRegister(0000, 2); DeviceProcessLogShow($"ʼӡ{loc}λԭ"); break;
  182. case 3: modbus.WriteSingleRegister(0000, 3); DeviceProcessLogShow($"ʼӡ{loc}λԭ"); break;
  183. case 4: modbus.WriteSingleRegister(0000, 4); DeviceProcessLogShow($"ʼӡ{loc}λԭ"); break;
  184. case 5: modbus.WriteSingleRegister(0000, 5); DeviceProcessLogShow($"ʼӡ{loc}λԭ"); break;
  185. case 6: modbus.WriteSingleRegister(0000, 6); DeviceProcessLogShow($"ʼӡ{loc}λԭ"); break;
  186. }
  187. //ȴ˵Ӿλ
  188. switch (loc)
  189. {
  190. case 1: while (!morkMW.ArriveWinkOneLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"е۵{loc}ŽӾλ"); break;
  191. case 2: while (!morkMW.ArriveWinkTwoLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"е۵{loc}ŽӾλ"); break;
  192. case 3: while (!morkMW.ArriveWinkThreeLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"е۵{loc}ŽӾλ"); break;
  193. case 4: while (!morkMW.ArriveWinkFourLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"е۵{loc}ŽӾλ"); break;
  194. case 5: while (!morkMW.ArriveWinkFiveLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"е۵{loc}ŽӾλ"); break;
  195. case 6: while (!morkMW.ArriveWinkSixLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"е۵{loc}ŽӾλ"); break;
  196. }
  197. Thread.Sleep(time * 1000);//ӾƵȴʱ
  198. //ͽӾź
  199. switch (loc)
  200. {
  201. case 1: modbus.WriteSingleCoil(4596, true); DeviceProcessLogShow($"{loc}λýӾ"); break;
  202. case 2: modbus.WriteSingleCoil(4597, true); DeviceProcessLogShow($"{loc}λýӾ"); break;
  203. case 3: modbus.WriteSingleCoil(4598, true); DeviceProcessLogShow($"{loc}λýӾ"); break;
  204. case 4: modbus.WriteSingleCoil(4599, true); DeviceProcessLogShow($"{loc}λýӾ"); break;
  205. case 5: modbus.WriteSingleCoil(4600, true); DeviceProcessLogShow($"{loc}λýӾ"); break;
  206. case 6: modbus.WriteSingleCoil(4601, true); DeviceProcessLogShow($"{loc}λýӾ"); break;
  207. }
  208. }
  209. /// <summary>
  210. /// ƹ
  211. /// </summary>
  212. public void ToPourWink()
  213. {
  214. //if (morkMW.AllowPourWink && morkMW.CupSignal)
  215. //{
  216. // morkMW.AllowPourWink = false;
  217. // modbus.WriteSingleRegister(0000, 8);//
  218. //}
  219. if (morkMW.CupSignal && RTrig.GetInstance("AllowOut").Start(morkMW.MixWinkComplte) && modbus.Connected)
  220. {
  221. DeviceProcessLogShow("ʼ");
  222. modbus.WriteSingleRegister(0000, 8);//
  223. }
  224. }
  225. /// <summary>
  226. /// źż
  227. /// </summary>
  228. public void SignalDetect()
  229. {
  230. if (RTrig.GetInstance("AllComplete").Start(morkMW.ProcessComplete))
  231. {
  232. OrderChange(morkMW.CurrentSuborderId, ORDER_STATUS.COMPLETED_COOK);
  233. morkMW.PourWinkComplete = true;
  234. DeviceProcessLogShow("ɣȡߵþƱ");
  235. }
  236. if (morkMW.PourWinkComplete)
  237. {
  238. if (TTrig.GetInstance("PoutWinkCom").Start(morkMW.CupSignal))
  239. {
  240. OrderChange(morkMW.CurrentSuborderId, ORDER_STATUS.COMPLETED_TAKE);
  241. DeviceProcessLogShow("ͻȡߵþƱ,ÿվƱԴ´ζ");
  242. }
  243. if (RTrig.GetInstance("PoutWinkCom").Start(morkMW.CupSignal))
  244. {
  245. DeviceProcessLogShow("վƱλִһ");
  246. morkMW.PourWinkComplete = false;
  247. morkMW.TaskLock = false;
  248. Thread.Sleep(2000);
  249. }
  250. }
  251. }
  252. /// <summary>
  253. /// ջ״̬
  254. /// </summary>
  255. public override void ReadData()
  256. {
  257. //GetStatus("M230.0", new Action<object>((obj) =>
  258. //{
  259. //}));
  260. if (modbus.Connected)
  261. {
  262. morkMW.ArriveWinkOneLoc = modbus.ReadCoils(4616);
  263. morkMW.ArriveWinkTwoLoc = modbus.ReadCoils(4617);
  264. morkMW.ArriveWinkThreeLoc = modbus.ReadCoils(4618);
  265. morkMW.ArriveWinkFourLoc = modbus.ReadCoils(4619);
  266. morkMW.ArriveWinkFiveLoc = modbus.ReadCoils(4620);
  267. morkMW.ArriveWinkSixLoc = modbus.ReadCoils(4621);
  268. morkMW.RobotIdle = modbus.ReadCoils(4201);
  269. morkMW.CupSignal = modbus.ReadInputs(0);
  270. morkMW.TakeWinkOneComplete = modbus.ReadCoils(4606);
  271. morkMW.TakeWinkTwoComplete = modbus.ReadCoils(4607);
  272. morkMW.TakeWinkThreeComplete = modbus.ReadCoils(4608);
  273. morkMW.TakeWinkFourComplete = modbus.ReadCoils(4609);
  274. morkMW.TakeWinkFiveComplete = modbus.ReadCoils(4610);
  275. morkMW.TakeWinkSixComplete = modbus.ReadCoils(4611);
  276. morkMW.MixWinkComplte = modbus.ReadCoils(4612);
  277. morkMW.ProcessComplete = modbus.ReadCoils(4613);
  278. }
  279. else
  280. {
  281. modbus.ModbusTcpConnect("192.168.0.100", 8001);
  282. }
  283. }
  284. public void VariableMonitor()
  285. {
  286. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkOneLoc").CurrentValue = morkMW.ArriveWinkOneLoc;
  287. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkTwoLoc").CurrentValue = morkMW.ArriveWinkTwoLoc;
  288. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkThreeLoc").CurrentValue = morkMW.ArriveWinkThreeLoc;
  289. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkFourLoc").CurrentValue = morkMW.ArriveWinkFourLoc;
  290. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkFiveLoc").CurrentValue = morkMW.ArriveWinkFiveLoc;
  291. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkSixLoc").CurrentValue = morkMW.ArriveWinkSixLoc;
  292. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "RobotIdle").CurrentValue = morkMW.RobotIdle;
  293. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "CupSignal").CurrentValue = morkMW.CupSignal;
  294. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkOneComplete").CurrentValue = morkMW.TakeWinkOneComplete;
  295. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkTwoComplete").CurrentValue = morkMW.TakeWinkTwoComplete;
  296. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkThreeComplete").CurrentValue = morkMW.TakeWinkThreeComplete;
  297. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkFourComplete").CurrentValue = morkMW.TakeWinkFourComplete;
  298. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkFiveComplete").CurrentValue = morkMW.TakeWinkFiveComplete;
  299. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkSixComplete").CurrentValue = morkMW.TakeWinkSixComplete;
  300. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "MixWinkComplte").CurrentValue = morkMW.MixWinkComplte;
  301. GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ProcessComplete").CurrentValue = morkMW.ProcessComplete;
  302. }
  303. public override void ResetProgram()
  304. {
  305. morkMW = null;
  306. morkMW = new GVL_MorkMW();
  307. }
  308. public override void SimOrder()
  309. {
  310. EventBus.GetInstance.Subscribe<MorkMWSimOrder>(0, delegate (IEvent @event, EventCallBackHandle callBackHandle)
  311. {
  312. if (@event != null && @event is MorkMWSimOrder order)
  313. {
  314. if (order.mixWink.Count > 0)
  315. {
  316. string guid = Guid.NewGuid().ToString();
  317. simOrderLocInfos.Enqueue(new SimOrderLocInfo { mixWink = order.mixWink, SuborderId = guid });
  318. DeviceProcessLogShow("յģⶩ");
  319. }
  320. }
  321. });
  322. }
  323. public override void Stop()
  324. {
  325. }
  326. private void GetStatus(string key, Action<object> action)
  327. {
  328. if (peripheralStatus.ContainsKey(key))
  329. {
  330. if (peripheralStatus[key] != null)
  331. {
  332. action?.Invoke(peripheralStatus[key]);
  333. }
  334. }
  335. }
  336. /// <summary>
  337. /// д
  338. /// </summary>
  339. /// <param name="address"></param>
  340. /// <param name="value"></param>
  341. private void WriteData(string address, object value)
  342. {
  343. EventBus.GetInstance.Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value });
  344. }
  345. /// <summary>
  346. /// ݽ
  347. /// </summary>
  348. public void DataParse()
  349. {
  350. EventBus.GetInstance.Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
  351. {
  352. if (@event != null && @event is DoOrderEvent order)
  353. {
  354. morkMW.doOrderEvents.Add(order);
  355. if (listMorkMWGoods.Count == 0) return;
  356. if (morkMW.historySuborderId.FirstOrDefault(p => p == order.MorkOrder.SuborderId) != null) return;
  357. OrderCount++;
  358. var res = listMorkMWGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.GoodsKey);
  359. if (res != null)
  360. {
  361. string guid = Guid.NewGuid().ToString();
  362. orderLocInfos.Enqueue(new BPASmartClient.MorkMW.Model.OrderLocInfo { mixWink = res.MorkMWBoms, SuborderId = order.MorkOrder.SuborderId });
  363. morkMW.historySuborderId.Add(order.MorkOrder.SuborderId);
  364. OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
  365. DeviceProcessLogShow($"յ{OrderCount}С򶩵ǰ{order.MorkOrder.GoodsName},š{order.MorkOrder.SuborderId}");
  366. }
  367. else
  368. {
  369. DeviceProcessLogShow($"δҵӦƷš{order.MorkOrder.SuborderId}");
  370. }
  371. }
  372. });
  373. }
  374. /// <summary>
  375. /// ״̬ϱ
  376. /// </summary>
  377. /// <param name="subid"></param>
  378. /// <param name="oRDER_STATUS"></param>
  379. private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
  380. {
  381. try
  382. {
  383. var res = morkMW.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
  384. string goodName = string.Empty;
  385. string SortNum = string.Empty;
  386. if (res != null)
  387. {
  388. goodName = res.MorkOrder.GoodsName;
  389. SortNum = res.MorkOrder.SortNum.ToString();
  390. }
  391. EventBus.GetInstance.Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
  392. }
  393. catch (Exception)
  394. {
  395. DeviceProcessLogShow($"״̬ϱʧܣš{morkMW.CurrentSuborderId}");
  396. //throw;
  397. }
  398. }
  399. /// <summary>
  400. /// ӿջ
  401. /// </summary>
  402. /// <param name="ip"></param>
  403. /// <param name="port"></param>
  404. public void ConnectKlpRobot(string ip, int port)
  405. {
  406. modbus = new ModbusTcp();
  407. modbus.Show += new Action<string>((s) =>
  408. {
  409. if (s != null) DeviceProcessLogShow(s);
  410. });
  411. modbus.ShowEx += new Action<string>((s) =>
  412. {
  413. if ((s != null)) DeviceProcessLogShow(s);
  414. });
  415. modbus.ModbusTcpConnect(ip, port);
  416. }
  417. /// <summary>
  418. /// С򶩵
  419. /// </summary>
  420. public ConcurrentQueue<BPASmartClient.MorkMW.Model.OrderLocInfo> orderLocInfos = new ConcurrentQueue<BPASmartClient.MorkMW.Model.OrderLocInfo>();
  421. /// <summary>
  422. /// ģⶩ
  423. /// </summary>
  424. public ConcurrentQueue<SimOrderLocInfo> simOrderLocInfos = new ConcurrentQueue<SimOrderLocInfo>();
  425. /// <summary>
  426. /// ƻ䷽
  427. /// </summary>
  428. public List<MORKMWGoods> listMorkMWGoods = new List<MORKMWGoods>();
  429. }
  430. }