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

667 righe
25 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using BPA.Message.Enum;
  4. using BPASmartClient.Device;
  5. using BPASmartClient.EventBus;
  6. using BPASmartClient.Model;
  7. using BPASmartClient.Peripheral;
  8. using static BPASmartClient.EventBus.EventBus;
  9. using BPASmartClient.Helper;
  10. using System.Threading;
  11. using BPASmartClient.Message;
  12. using BPA.Message;
  13. using System.Linq;
  14. using BPASmartClient.Model.PLC;
  15. using System.Threading.Tasks;
  16. using System.Reflection;
  17. namespace BPASmartClient.MorkS
  18. {
  19. public class Control_Morks : BaseDevice
  20. {
  21. public override DeviceClientType DeviceType => DeviceClientType.MORKS;
  22. GVL_MORKS mORKS = new GVL_MORKS();
  23. Alarm alarm = new Alarm();
  24. public override void DoMain()
  25. {
  26. ServerInit();
  27. DataParse();
  28. ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice");
  29. }
  30. public override void ResetProgram()
  31. {
  32. mORKS = null;
  33. mORKS = new GVL_MORKS();
  34. }
  35. public override void Stop()
  36. {
  37. }
  38. private void ServerInit()
  39. {
  40. //物料信息
  41. EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
  42. {
  43. if (@event == null) return;
  44. if (@event is MaterialDeliveryEvent material)
  45. {
  46. orderMaterialDelivery = material.orderMaterialDelivery;
  47. }
  48. });
  49. //配方数据信息
  50. EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
  51. {
  52. if (@event == null) return;
  53. if (@event is RecipeBomEvent recipe)
  54. {
  55. recipeBoms = recipe.recipeBoms;
  56. WriteRecipeBoms();
  57. }
  58. });
  59. }
  60. private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
  61. {
  62. var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
  63. string goodName = string.Empty;
  64. if (res != null) goodName = res.MorkOrder.GoodsName;
  65. EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
  66. }
  67. private void ReadData(string address, ushort len = 1, Action<bool[]> action = null)
  68. {
  69. EventBus.EventBus.GetInstance().Publish(new ReadModel() { DeviceId = DeviceId, Address = address, Length = len }, (o) =>
  70. {
  71. if (o != null && o.Length > 0 && o[0] is bool[] bools)
  72. {
  73. action(bools);
  74. }
  75. });
  76. }
  77. private void GetStatus(string key, Action<bool[]> action)
  78. {
  79. if (peripheralStatus.ContainsKey(key))
  80. {
  81. action((bool[])peripheralStatus[key]);
  82. }
  83. }
  84. public override void ReadData()
  85. {
  86. GetStatus("M230.0", new Action<bool[]>((bools) =>
  87. {
  88. alarm.MachineLeftLowTemperature = bools[0];
  89. alarm.MachineRightLowTemperature = bools[1];
  90. alarm.Supply1_LossBowl = bools[2];
  91. alarm.Supply2_LossBowl = bools[3];
  92. alarm.Supply1_ErrorOutBowl = bools[4];
  93. alarm.Supply2_ErrorOutBowl = bools[5];
  94. alarm.PushBowlCylinderError = bools[6];
  95. alarm.NoodleMacCommunicateError = bools[7];
  96. alarm.DosingMacCommunicateError = bools[8];
  97. alarm.RobotMacCommunicateError = bools[9];
  98. alarm.RobotInitError = bools[11];
  99. alarm.RobotUrgentStop = bools[12];
  100. alarm.RobotNotInRemoteMode = bools[13];
  101. alarm.RobotNotInReady = bools[14];
  102. alarm.RobotSelfInException = bools[15];
  103. alarm.LeftLackWater = bools[16];
  104. alarm.RightLackWater = bools[17];
  105. }));
  106. GetStatus("M0.3", new Action<bool[]>((bools) =>
  107. {
  108. mORKS.RobotTakeNoodle = bools[0];
  109. mORKS.RobotOutMeal = bools[1];
  110. mORKS.MoveTurntable = bools[2];
  111. }));
  112. GetStatus("M100.0", new Action<bool[]>((bools) =>
  113. {
  114. mORKS.InitComplete = bools[0];
  115. mORKS.TakeBowlIdle = bools[1];
  116. mORKS.TemperatureReached = bools[2];
  117. mORKS.AllowFallNoodle = bools[3];
  118. mORKS.RbTakeNoodleComplete = bools[4];
  119. mORKS.RbFallNoodleComplete = bools[5];
  120. mORKS.RbOutMealComplete = bools[6];
  121. mORKS.RobotIdle = bools[7];
  122. mORKS.TakeMealDetect = bools[8];
  123. mORKS.MissingBowl = bools[9];
  124. Initing = bools[10];
  125. mORKS.TurntableLowerLimit = bools[11];
  126. mORKS.MissingBowlSignal2 = bools[12];
  127. mORKS.TurntableUpLimit = bools[13];
  128. mORKS.FeedComplete = bools[14];
  129. mORKS.TurntableMoveInPlace = bools[15];
  130. }));
  131. GetStatus("M235.0", new Action<bool[]>((bools) =>
  132. {
  133. mORKS.Error = bools[0];
  134. }));
  135. GetStatus("M102.0", new Action<bool[]>((bools) =>
  136. {
  137. for (int i = 0; i < 6; i++)
  138. {
  139. mORKS.NoodleCookerStatus[i] = bools[i];
  140. }
  141. mORKS.Feeding = bools[6];
  142. }));
  143. GetStatus("M103.0", new Action<bool[]>((bools) =>
  144. {
  145. for (int i = 0; i < 6; i++)
  146. {
  147. mORKS.CookNoodlesComplete[i] = bools[i];
  148. }
  149. }));
  150. EventBus.EventBus.GetInstance().Publish(new ReadModel() { DeviceId = DeviceId, Address = "VW372", Length = 1 }, (o) =>
  151. {
  152. if (o != null && o.Length > 0 && o[0] is ushort value)
  153. {
  154. mORKS.TurntableFeedbackloc = value;
  155. }
  156. });
  157. }
  158. /// <summary>
  159. /// 数据解析
  160. /// </summary>
  161. private void DataParse()
  162. {
  163. EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
  164. {
  165. if (@event == null) return;
  166. if (@event is DoOrderEvent order)
  167. {
  168. mORKS.doOrderEvents.Add(order);
  169. if (order.MorkOrder.GoodBatchings == null) return;
  170. OrderCount++;
  171. DeviceProcessLogShow($"接收到{OrderCount}次订单");
  172. foreach (var item in order.MorkOrder.GoodBatchings)
  173. {
  174. var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
  175. if (res != null)
  176. {
  177. if (ushort.TryParse(res.BatchingLoc, out ushort loc))
  178. {
  179. if (loc >= 1 && loc <= 5)
  180. {
  181. if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
  182. mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { GoodName = order.MorkOrder.GoodsName, Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId });
  183. }
  184. else if (loc >= 10 && loc <= 11)
  185. {
  186. int index = 0;
  187. if (recipeBoms != null)
  188. {
  189. index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId);
  190. index++;
  191. }
  192. if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
  193. mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
  194. {
  195. BatchingId = res.BatchingId,
  196. GoodName = order.MorkOrder.GoodsName,
  197. Loc = ushort.Parse(res.BatchingLoc),
  198. SuborderId = order.MorkOrder.SuborderId,
  199. RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
  200. });
  201. }
  202. }
  203. }
  204. }
  205. }
  206. });
  207. }
  208. public override void MainTask()
  209. {
  210. mORKS.AllowRun = mORKS.InitComplete;
  211. //IsHealth = mORKS.Error && mORKS.InitComplete;
  212. IsHealth = true;
  213. if (mORKS.AllowRun)
  214. {
  215. TakeBowlTask();
  216. TakeNoodleTask();
  217. OutNoodleTask();
  218. SingleDetect();
  219. TurntableControl();
  220. }
  221. }
  222. private void BowlControl(OrderLocInfo orderLocInfo)
  223. {
  224. if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11)
  225. {
  226. mORKS.TakeBowlId = orderLocInfo.SuborderId;
  227. TakeBowlControl(orderLocInfo.Loc);
  228. SetRecipeNumber(orderLocInfo.RecipeNumber);
  229. OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
  230. DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
  231. mORKS.TakeBowlInterlock = true;
  232. }
  233. }
  234. /// <summary>
  235. /// 取碗控制
  236. /// </summary>
  237. private void TakeBowlTask()
  238. {
  239. if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.TakeBowlIdle && !mORKS.TakeBowlInterlock)
  240. {
  241. //if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
  242. //{
  243. ushort BowLoc = 0;
  244. var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList();
  245. if (res == null || res?.Count == 0)
  246. {
  247. if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) BowlControl(orderLocInfo);
  248. }
  249. else
  250. {
  251. foreach (var item in res)
  252. {
  253. if (ushort.TryParse(item.BatchingLoc, out ushort loc))
  254. {
  255. DeviceProcessLogShow($"位置:={loc},检测开关1:{alarm.Supply1_LossBowl},检测开关1:{alarm.Supply2_LossBowl}");
  256. if (loc == 10 && !alarm.Supply1_LossBowl)
  257. {
  258. BowLoc = loc;
  259. break;
  260. }
  261. else if (loc == 11 && !alarm.Supply2_LossBowl)
  262. {
  263. BowLoc = loc;
  264. break;
  265. }
  266. }
  267. }
  268. if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
  269. {
  270. orderLocInfo.Loc = BowLoc;
  271. BowlControl(orderLocInfo);
  272. }
  273. }
  274. //if (BowLoc >= 10 && BowLoc <= 11)
  275. //{
  276. // mORKS.TakeBowlInterlock = true;
  277. // mORKS.TakeBowlId = orderLocInfo.SuborderId;
  278. // TakeBowlControl(BowLoc);
  279. // SetRecipeNumber(orderLocInfo.RecipeNumber);
  280. // OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
  281. // DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
  282. //}
  283. //之前版本
  284. //mORKS.TakeBowlId = orderLocInfo.SuborderId;
  285. //TakeBowlControl(orderLocInfo.Loc);
  286. //SetRecipeNumber(orderLocInfo.RecipeNumber);
  287. //OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
  288. //DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
  289. //mORKS.TakeBowlInterlock = true;
  290. //}
  291. }
  292. }
  293. /// <summary>
  294. /// 转台控制
  295. /// </summary>
  296. private void TurntableControl()
  297. {
  298. //if (GeneralConfig.EnableLocalSimOrder)
  299. //{
  300. // //不做轮询,直接取面,模拟订单使用
  301. // if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
  302. // {
  303. // if (mORKS.TurntableLowerLimit)
  304. // {
  305. // TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
  306. // mORKS.TurntableLocLists.Clear();
  307. // mORKS.AllowTakeNoodle = true;
  308. // DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
  309. // }
  310. // }
  311. //}
  312. //else
  313. {
  314. //正常轮询
  315. if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
  316. {
  317. var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList();
  318. if (result != null)
  319. {
  320. var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.TurntableFeedbackloc.ToString());
  321. if (mORKS.TurntableLowerLimit && res != null)
  322. {
  323. TurntableStart(mORKS.TurntableFeedbackloc);
  324. mORKS.TurntableLocLists.Clear();
  325. mORKS.AllowTakeNoodle = true;
  326. DeviceProcessLogShow($"控制机器人去转台【{mORKS.TurntableFeedbackloc}】号位置取面");
  327. }
  328. else
  329. {
  330. if (!mORKS.TurntableInterlock)
  331. {
  332. foreach (var item in result)
  333. {
  334. if (ushort.TryParse(item.BatchingLoc, out ushort loc))
  335. {
  336. if (mORKS.TurntableFeedbackloc != loc && !mORKS.TurntableLocLists.Contains(loc))
  337. {
  338. TurntableStart(loc);
  339. DeviceProcessLogShow($"没有物料检测的启动转台控制,转台位置:[{loc}]");
  340. break;
  341. }
  342. else if (mORKS.TurntableFeedbackloc == loc && !mORKS.TurntableLocLists.Contains(loc)) mORKS.TurntableLocLists.Add(loc);
  343. }
  344. }
  345. }
  346. }
  347. }
  348. else DeviceProcessLogShow("未找到可用的物料信息");
  349. }
  350. }
  351. //转台到位检测
  352. if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.TurntableMoveInPlace && mORKS.CurrentLoc == mORKS.TurntableFeedbackloc))
  353. {
  354. mORKS.CurrentLoc = 0;
  355. mORKS.TurntableInterlock = false;
  356. DeviceProcessLogShow("转台到位检测");
  357. }
  358. //补料完成检测
  359. if (RTrig.GetInstance("FeedComplete").Start(mORKS.FeedComplete))
  360. {
  361. if (!mORKS.AllowTakeNoodle && mORKS.TurntableLocLists.Count > 0)
  362. {
  363. mORKS.TurntableLocLists.Clear();
  364. mORKS.TurntableInterlock = false;
  365. DeviceProcessLogShow("补料完成检测");
  366. }
  367. }
  368. }
  369. /// <summary>
  370. /// 取面任务
  371. /// </summary>
  372. private void TakeNoodleTask()
  373. {
  374. //取面控制
  375. if (mORKS.AllowRun && mORKS.RobotIdle && !mORKS.Feeding && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.TurntableMoveInPlace && !mORKS.TakeNoodleInterlock && !mORKS.OutNoodleing && mORKS.RBTakeNoodleTask.Count > 0)
  376. {
  377. int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置
  378. if (loc >= 0 && loc <= 5)
  379. {
  380. if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo))
  381. {
  382. mORKS.CookNodelId[loc] = orderLocInfo.SuborderId;
  383. SetFallNoodleLoc((ushort)(loc + 1));
  384. //机器人开始取面
  385. RobotTakeNoodle();
  386. OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
  387. DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");
  388. //写入煮面时间
  389. //List<ushort> values = new List<ushort>();
  390. //values.Add(Json<KeepDataBase>.Data.parSets.ElementAt(loc).Minute);
  391. //values.Add(Json<KeepDataBase>.Data.parSets.ElementAt(loc).Second);
  392. //ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetWordAddress($"VW{116 + (loc * 6)}"), WriteType.HoldingRegisters, values.ToArray());
  393. mORKS.TakeNoodleInterlock = true;
  394. }
  395. }
  396. }
  397. }
  398. /// <summary>
  399. /// 出餐控制
  400. /// </summary>
  401. private void OutNoodleTask()
  402. {
  403. if (mORKS.AllowFallNoodle && mORKS.RobotTaskInterlock && !mORKS.TakeNoodleInterlock && mORKS.RobotIdle && !mORKS.TakeMealDetect)
  404. {
  405. int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0);
  406. if (loc >= 0 && loc <= 5)
  407. {
  408. if (mORKS.CookNoodlesComplete[loc])
  409. {
  410. SetTakeNoodleLoc((ushort)(loc + 1));
  411. RobotOutMeal();
  412. CookNoodleStatusReset((ushort)(loc + 1));
  413. ResetAllowFallNoodle();
  414. mORKS.OutMealId = mORKS.IngredientsCompleteId;
  415. mORKS.IngredientsCompleteId = string.Empty;
  416. mORKS.CookNodelId[loc] = string.Empty;
  417. DeviceProcessLogShow($"{loc + 1}号位置出餐控制");
  418. mORKS.OutNoodleing = true;
  419. }
  420. }
  421. }
  422. }
  423. /// <summary>
  424. /// 信号检测
  425. /// </summary>
  426. private void SingleDetect()
  427. {
  428. //允许倒面信号检测
  429. if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowFallNoodle))
  430. {
  431. mORKS.IngredientsCompleteId = mORKS.TakeBowlId;
  432. mORKS.TakeBowlId = string.Empty;
  433. DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}");
  434. mORKS.TakeBowlInterlock = false;
  435. }
  436. //出餐完成信号检测
  437. if (RTrig.GetInstance("CompleteChange").Start(mORKS.RbOutMealComplete))
  438. {
  439. OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK);
  440. DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成");
  441. mORKS.OutNoodleing = false;
  442. }
  443. //取餐完成逻辑处理
  444. if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.RbOutMealComplete && !mORKS.TakeMealDetect, 2))
  445. {
  446. OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
  447. DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
  448. ResetCookComplete();
  449. mORKS.OutMealId = string.Empty;
  450. }
  451. //机器人取面完成信号检测
  452. if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RbTakeNoodleComplete))
  453. {
  454. mORKS.TakeNoodleInterlock = false;
  455. mORKS.AllowTakeNoodle = false;
  456. mORKS.TurntableInterlock = false;
  457. DeviceProcessLogShow("机器人取面完成信号检测");
  458. TakeNoodleCompleteReset();
  459. }
  460. int OutMealRequstCount = mORKS.CookNoodlesComplete.Where(p => p == true).ToList().Count;
  461. int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count;
  462. mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0);
  463. }
  464. #region PLC 控制函数
  465. private void WriteData(string address, object value)
  466. {
  467. EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value });
  468. }
  469. /// <summary>
  470. /// 写入配方数据到 PLC
  471. /// </summary>
  472. private void WriteRecipeBoms()
  473. {
  474. List<ushort> recipeBoms = new List<ushort>();
  475. if (this.recipeBoms == null) return;
  476. foreach (var item in this.recipeBoms.RecipeIds)
  477. {
  478. foreach (var rec in item.Recipes)
  479. {
  480. recipeBoms.Add((ushort)rec);
  481. }
  482. }
  483. if (recipeBoms.Count > 0)
  484. {
  485. //配方数据地址范围:VW2000 - VW2278
  486. WriteData("VW2000", recipeBoms.ToArray());
  487. DeviceProcessLogShow("写配方成功");
  488. }
  489. else { DeviceProcessLogShow("配方数据为空"); }
  490. }
  491. /// <summary>
  492. /// 取面完成复位
  493. /// </summary>
  494. private void TakeNoodleCompleteReset()
  495. {
  496. WriteData("M100.4", false);
  497. }
  498. /// <summary>
  499. /// 指定煮面口状态复位
  500. /// </summary>
  501. /// <param name="num"></param>
  502. private void CookNoodleStatusReset(int num)
  503. {
  504. if (num >= 1 && num <= 6)
  505. {
  506. WriteData($"102.{num - 1}", false);
  507. DeviceProcessLogShow($"{num}号煮面口占用复位");
  508. }
  509. }
  510. /// <summary>
  511. /// 写配方编号
  512. /// </summary>
  513. /// <param name="num"></param>
  514. private void SetRecipeNumber(ushort num)
  515. {
  516. WriteData("VW0", num);
  517. }
  518. /// <summary>
  519. /// 启动转台
  520. /// </summary>
  521. /// <param name="loc"></param>
  522. private void TurntableStart(ushort loc)
  523. {
  524. mORKS.CurrentLoc = loc;
  525. mORKS.TurntableInterlock = true;
  526. mORKS.TurntableLocLists.Add(loc);
  527. WriteData("VW2", loc);
  528. WriteData("M0.5", true);
  529. }
  530. /// <summary>
  531. /// 设置倒面位置
  532. /// </summary>
  533. /// <param name="loc"></param>
  534. private void SetFallNoodleLoc(ushort loc)
  535. {
  536. WriteData("VW4", loc);
  537. }
  538. /// <summary>
  539. /// 设置取面位置
  540. /// </summary>
  541. /// <param name="loc"></param>
  542. private void SetTakeNoodleLoc(ushort loc)
  543. {
  544. WriteData("VW6", loc);
  545. }
  546. /// <summary>
  547. /// 取碗控制
  548. /// </summary>
  549. /// <param name="loc"></param>
  550. private void TakeBowlControl(ushort loc)
  551. {
  552. if (loc == 10)//小碗
  553. {
  554. WriteData("M0.1", true);
  555. }
  556. else if (loc == 11)//大碗
  557. {
  558. WriteData("M0.2", true);
  559. }
  560. }
  561. /// <summary>
  562. /// 机器人取面
  563. /// </summary>
  564. private void RobotTakeNoodle()
  565. {
  566. WriteData("M0.3", true);
  567. }
  568. /// <summary>
  569. /// 机器人取餐
  570. /// </summary>
  571. private void RobotOutMeal()
  572. {
  573. WriteData("M0.4", true);
  574. }
  575. /// <summary>
  576. /// 制作完成信号复位
  577. /// </summary>
  578. private void ResetCookComplete()
  579. {
  580. WriteData("M100.6", false);
  581. }
  582. /// <summary>
  583. /// 复位允许取面信号
  584. /// </summary>
  585. private void ResetAllowFallNoodle()
  586. {
  587. WriteData("M100.3", false);
  588. }
  589. /// <summary>
  590. /// 设备初始化
  591. /// </summary>
  592. public async void DeviceInit()
  593. {
  594. WriteData("M0.0", true);
  595. await Task.Delay(1000);
  596. WriteData("M0.0", false);
  597. }
  598. #endregion
  599. }
  600. }