using BPASmartClient.CustomResource; using static BPA.Helper.EventBus; using System.Collections.Concurrent; using BPASmartClient.Model.煮面机; using BPASmartClient.ViewModel; using AlarModel = BPA.Message.AlarmModel; using Microsoft.VisualBasic.Logging; using System.Collections.ObjectModel; //using BPA.Helper; namespace BPASmartClient.MorkSUpgradedVer { public class Control_MorkSUpgradedVer : BaseDevice { public override DeviceClientType DeviceType => DeviceClientType.MORKS; private GVL_MorkSUpgradedVer mORKS = new GVL_MorkSUpgradedVer(); private Alarm alarm = new Alarm(); public override void DoMain() { base.IsConnected = false; base.stateAction = o => { if (o) NoodOrderCtrl.GetInstance.StateShow("设备正常运行"); else NoodOrderCtrl.GetInstance.StateShow("设备未连接"); }; MonitorViewModel.DeviceId = DeviceId; ServerInit(); DataParse(); Json.Read(); Json.Read(); if (Json.Data.parSets == null) Json.Data.parSets = new ObservableCollection(); if (Json.Data.parSets.Count < 6) { Json.Data.parSets.Clear(); for (int i = 0; i < 6; i++) { Json.Data.parSets.Add(new ParSet() { CheckBoxContext = $"煮面口{i + 1}屏蔽", Minute = 1, Second = 0, IsShield = false, TextBlockContext = $"煮面口{i + 1}时间设定" }); } } ActionManage.GetInstance.Register(new Action((obj) => { ObservableCollection morks = (ObservableCollection)obj; if (morks.Count > 0) { morks.ToList().ForEach(t => { var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o=>o.OrderPush.SortNum == t.OrderPush.SortNum); if (res != null) { if (string.IsNullOrEmpty(res.OrderPush.SuborderId)) { NoodOrderCtrl.GetInstance.WorkList(res); mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json.Data.localOrder[res.OrderPush.GoodsName].NoodleLoc, SuborderId = res.OrderPush.SuborderId }); MessageLog.GetInstance.Show($"添加订单:面条位置【{Json.Data.localOrder[res.OrderPush.GoodsName].NoodleLoc}】"); mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json.Data.localOrder[res.OrderPush.GoodsName].Bowloc, SuborderId = res.OrderPush.SuborderId }); MessageLog.GetInstance.Show($"添加订单:碗位置【{Json.Data.localOrder[res.OrderPush.GoodsName].Bowloc}】"); Global.EnableLocalSimOrder = true; } } }); //foreach (var item in FoodMenuViewModel.orderStatusLists) //{ // if (string.IsNullOrEmpty(item.OrderPush.SuborderId)) // { // item.OrderPush.SortNum = FoodMenuViewModel.SortNum++; // item.OrderPush.SuborderId = Guid.NewGuid().ToString(); // var res = mORKS.RBTakeNoodleTask.FirstOrDefault(o => o.SuborderId == item.OrderPush.SuborderId); // if (res == null) // { // mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json.Data.localOrder[item.OrderPush.GoodsName].NoodleLoc, SuborderId = item.OrderPush.SuborderId }); // MessageLog.GetInstance.Show($"添加订单:面条位置【{Json.Data.localOrder[item.OrderPush.GoodsName].NoodleLoc}】"); // mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json.Data.localOrder[item.OrderPush.GoodsName].Bowloc, SuborderId = item.OrderPush.SuborderId }); // MessageLog.GetInstance.Show($"添加订单:碗位置【{Json.Data.localOrder[item.OrderPush.GoodsName].Bowloc}】"); // Global.EnableLocalSimOrder = true; // } // } //} } }), "EnableForOrder"); //ActionManage.GetInstance.Register(new Action((o) => //{ // if (o.Length > 0) // { // Random rd = new Random(); // TaskManage.GetInstance.StartLong(new Action(() => // { // int NoodleLoc = (int)o[0] == 0 ? rd.Next(1, 6) : (int)o[0]; // int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1]; // string guid = Guid.NewGuid().ToString(); // mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid }); // MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】"); // mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid }); // MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】"); // Thread.Sleep(60000); // }), "ForOrder"); // } //}), "EnableForOrder"); ActionManage.GetInstance.Register(new Action((o) => { if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value); }), "WriteVW"); ActionManage.GetInstance.Register(new Action((o) => { if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value); }), "WriteBools"); ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice"); #region 单步控制 ActionManage.GetInstance.Register(new Action((o) => { if (o!=null&& o is int BowLoc) { if (!mORKS.DropBowlMechanismStatus&& BowLoc!=0) { TakeBowlControl((ushort)BowLoc); } else NoodOrderCtrl.GetInstance.Show("等待取碗未完成,请稍候重试!"); } }),"BowCtrl"); ActionManage.GetInstance.Register(new Action((o) => { if (o != null && o is int turn) { if (mORKS.SiloInPlace && !mORKS.FixedFlag && mORKS.InitComplete&&turn !=0) { TurntableStart((ushort)turn); var res = DeviceCtrlViewModel.CtrlTurns.FirstOrDefault(o => o.Set == $"{turn} 号位"); res.UnderSet = true; } else { NoodOrderCtrl.GetInstance.Show("转台工作中,请稍候重试!"); var res = DeviceCtrlViewModel.CtrlTurns.FirstOrDefault(o => o.Set == $"{turn} 号位"); res.UnderSet = false; } } }), "TurnableCtrl"); ActionManage.GetInstance.Register(new Action((o) => { if (o != null && o is DoNoodle doN) { List values = new List(); ushort s = 0; values.Add((ushort)doN.Min); values.Add((ushort)doN.Senc); WriteData($"VW{324 + ((doN.Reset - 1) * 4)}", values.ToArray()); WriteData($"VW4", s.SetBitValue(Convert.ToByte(doN.Reset + 6), true)); s = 0; WriteData($"VW4", s.SetBitValue(Convert.ToByte(doN.Reset), true)); } }), "Startset"); #endregion } public override void ResetProgram() { mORKS = null; mORKS = new GVL_MorkSUpgradedVer(); } public override void Stop() { } private void ServerInit() { //物料信息 EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) { if (@event == null) return; if (@event is MaterialDeliveryEvent material) { orderMaterialDelivery = material.orderMaterialDelivery; } }); //配方数据信息 EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) { if (@event == null) return; if (@event is RecipeBomEvent recipe) { recipeBoms = recipe.recipeBoms; } }); OrderNotifyInit(); } #region 接口通知任务处理 ConcurrentQueue osm = new ConcurrentQueue(); private void OrderNotifyInit() { TaskManage.GetInstance.StartLong(() => { while (osm.Count > 0) { TempOrderChange(osm.ElementAt(0).SubOrderId, osm.ElementAt(0).Status, () => { osm.TryDequeue(out OrderStatusModel tempOSM); DeviceProcessLogShow($"订单:【{tempOSM.SubOrderId}】, 状态:【{tempOSM.Status}】, API状态修改成功"); }); } Thread.Sleep(100); }, $"订单状态更新接口{DeviceId}", true); } private void TempOrderChange(string subid, ORDER_STATUS oRDER_STATUS, Action complete) { if (mORKS.doOrderEvents!=null&&mORKS.doOrderEvents.Count>0&&!string.IsNullOrEmpty(subid)) { var res = mORKS.doOrderEvents.Find(p => p.MorkOrder.SuborderId == subid); string goodName = string.Empty; string SortNum = string.Empty; if (res != null) { goodName = res.MorkOrder.GoodsName; SortNum = res.MorkOrder.SortNum.ToString(); } if (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum)) { EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }, e => { complete?.Invoke(); }); var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum); //如果订单信息已经存在,则修改状态,否则新增。 if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count) { if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) { DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index); DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel() { Status = oRDER_STATUS, GoodName = goodName, SortNum = SortNum, StopTime = DateTime.Now.ToString("HH:mm:ss") }); } else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE) { var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum); if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp); } else DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS; } else { DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel() { Status = oRDER_STATUS, GoodName = goodName, SortNum = SortNum, StartTime = DateTime.Now.ToString("HH:mm:ss") }); } } } } #endregion private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) { osm.Enqueue(new OrderStatusModel() { SubOrderId = subid, Status = oRDER_STATUS }); return; var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid); string goodName = string.Empty; string SortNum = string.Empty; if (res != null) { goodName = res.MorkOrder.GoodsName; SortNum = res.MorkOrder.SortNum.ToString(); } //if (mORKS.doe.ContainsKey(subid)) //{ // goodName = mORKS.doe[subid].MorkOrder.GoodsName; // SortNum = mORKS.doe[subid].MorkOrder.SortNum.ToString(); if (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum)) { EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum); //如果订单信息已经存在,则修改状态,否则新增。 if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count) { if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) { DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index); DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel() { Status = oRDER_STATUS, GoodName = goodName, SortNum = SortNum, StopTime = DateTime.Now.ToString("HH:mm:ss") }); } else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE) { var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum); if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp); } else { DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS; } } else { DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel() { Status = oRDER_STATUS, GoodName = goodName, SortNum = SortNum, StartTime = DateTime.Now.ToString("HH:mm:ss") }); } //mORKS.doe.Remove(subid, out _); } //} //var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid); //string goodName = string.Empty; //string SortNum = string.Empty; //if (res != null) //{ // goodName = res.MorkOrder.GoodsName; // SortNum = res.MorkOrder.SortNum.ToString(); //} //EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); //var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum); //if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count) //{ // if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) // { // DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index); // DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel() // { // Status = oRDER_STATUS, // GoodName = goodName, // SortNum = SortNum, // StopTime = DateTime.Now.ToString("HH:mm:ss") // }); // } // else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE) // { // var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum); // if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp); // } // else // { // DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS; // } //} //else //{ // DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel() // { // Status = oRDER_STATUS, // GoodName = goodName, // SortNum = SortNum, // StartTime = DateTime.Now.ToString("HH:mm:ss") // }); //} } private void GetStatus(string key, Action action) { if (peripheralStatus.ContainsKey(key)) { if (peripheralStatus[key] != null) { action?.Invoke(peripheralStatus[key]); } } } public override void ReadData() { #region 检测是否正常运行 if (DataServer.GetInstance.morkS.Alarm.Count > 0) { NoodOrderCtrl.GetInstance.StateShow("设备异常"); } #endregion DataServer.GetInstance.morkS.Alarm.Clear(); alarms.ForEach(item => { DataServer.GetInstance.morkS.Alarm.Add(new BPA.Message.AlarmModel() { AlarmTime = $"{item.Date} {item.Time}", AlarmMs = item.Info }); }); GetStatus("M0.1", new Action((obj) => { if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7) { Initing = !bools[0]; mORKS.InitComplete = bools[0]; mORKS.MoveScrewRodInitCom = bools[1]; mORKS.SacrificialVesselInitCom = bools[2]; mORKS.CylinderInitCom = bools[3]; mORKS.NoodleCookerInitCom = bools[4]; mORKS.RobotInitCom = bools[5]; mORKS.SiloInitCom = bools[6]; alarm.DeviceNoInit = !mORKS.InitComplete; alarm.MoveScrewRodNoInit = !mORKS.MoveScrewRodInitCom; alarm.SacrificialVesselNoInit = !mORKS.SacrificialVesselInitCom; alarm.CylinderNoInit = !mORKS.CylinderInitCom; alarm.NoodleCookerNoInit = !mORKS.NoodleCookerInitCom; alarm.RobotNoInit = !mORKS.RobotInitCom; alarm.SiloNoInit = !mORKS.SiloInitCom; } })); GetStatus("M20.0", new Action((obj) => { if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 6) { mORKS.Nsm = bools; for (int i = 0; i < bools.Length; i++) { var res = NoodOrderCtrl.GetInstance.doNoodles.FirstOrDefault(o => o.Reset == (i + 1)); if (bools[i]) { if (res.Docook) { res.Docook = false; res.BtnIsChecked = false; NoodOrderCtrl.GetInstance.Flush(res); } } else { if (!res.Docook) { res.Docook = true; res.BtnIsChecked = true; NoodOrderCtrl.GetInstance.Flush(res); } } } } })); GetStatus("M10.0", new Action((obj) => { if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 2) { mORKS.AllowInvertedFace = bools[0]; mORKS.DiningComplete = bools[1]; } })); GetStatus("M10.4", new Action((obj) => { if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) { mORKS.DropBowlMechanismStatus = bools[0]; } })); GetStatus("M12.2", new Action((obj) => { if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) { mORKS.FixedFlag = bools[0]; if (!mORKS.FixedFlag&& NoodOrderCtrl.GetInstance.stateInfo== "补料中") NoodOrderCtrl.GetInstance.StateShow("设备正常运行"); } })); GetStatus("M13.5", new Action((obj) => { if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) { mORKS.SiloInPlace = bools[0]; } })); GetStatus("M16.7", new Action((obj) => { if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) { mORKS.RobotTakeNoodleCom = bools[0]; } })); GetStatus("M17.4", new Action((obj) => { if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) { mORKS.RobotStatus = bools[0]; } })); GetStatus("M18.0", new Action((obj) => { if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 5) { mORKS.SmallBowlYesOrNoCheck = bools[0]; mORKS.LargeBowYesOrNoCheck = bools[1]; mORKS.TurntableLowPosition = bools[2]; mORKS.TurntableHighPosition = bools[3]; alarm.Supply2_LossBowl = !mORKS.SmallBowlYesOrNoCheck; alarm.Supply1_LossBowl = !mORKS.LargeBowYesOrNoCheck; } })); GetStatus("VW17", new Action((obj) => { if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1) { var tt = ushorts.ToBytes(true).ToUshorts(); for (byte i = 0; i < 6; i++) { if (RTrig.GetInstance($"CookNoodleCom{i + 1}").Start(tt[0].GetBitValue((byte)(i + 1)))) { if (!string.IsNullOrEmpty(mORKS.CookNodelId[i])) mORKS.CookNoodleCom[i] = true; } } //mORKS.CookNoodleCom[0] = tt[0].GetBitValue(1); //mORKS.CookNoodleCom[1] = tt[0].GetBitValue(2); //mORKS.CookNoodleCom[2] = tt[0].GetBitValue(3); //mORKS.CookNoodleCom[3] = tt[0].GetBitValue(4); //mORKS.CookNoodleCom[4] = tt[0].GetBitValue(5); //mORKS.CookNoodleCom[5] = tt[0].GetBitValue(6); mORKS.Heating = ushorts[0].GetBitValue(15); mORKS.TemperatureReaches = ushorts[0].GetBitValue(16); alarm.MachineLowTemperature = !mORKS.TemperatureReaches; } })); GetStatus("VW770", new Action((obj) => { if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1) { if (mORKS.CurrentFeedbackLoc != ushorts[0]) { var res = DeviceCtrlViewModel.CtrlTurns.FirstOrDefault(o => o.Set == $"{ushorts[0]} 号位"); if (res != null) { foreach (var value in DeviceCtrlViewModel.CtrlTurns) { if (value.Set!= $"{ushorts[0]} 号位"&&value.UnderSet) { value.UnderSet =false; } } res.UnderSet = true; NoodOrderCtrl.GetInstance.Show($"料仓当前位置:{res.Set}"); } } mORKS.CurrentFeedbackLoc = ushorts[0]; } })); mORKS.TakeBowlTaskCount = mORKS.TakeBowlTask.Count; mORKS.RBTakeNoodleTaskCount = mORKS.RBTakeNoodleTask.Count; for (int i = 0; i < Json.Data.parSets.Count; i++) { mORKS.nsm.ElementAt(i).IsShield = Json.Data.parSets.ElementAt(i).IsShield; mORKS.nsm.ElementAt(i).NoodleCookerStatus = mORKS.NoodleCookerStatus[i]; } } /// 数据解析 private void DataParse() { EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) { if (@event == null) return; if (@event is DoOrderEvent order) { mORKS.doOrderEvents.Add(order); //mORKS.doe.TryAdd(order.MorkOrder.SuborderId, order); if (order.MorkOrder.GoodBatchings == null) return; if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return; OrderCount++; if (DateTime.Now.Subtract(Json.Data.StatisticsTime).Days != 0) Json.Data.Count = 0; Json.Data.StatisticsTime = DateTime.Now; Json.Data.Count++; Json.Save(); OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT); DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}"); mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId); foreach (var item in order.MorkOrder.GoodBatchings) { var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); if (res != null) { if (ushort.TryParse(res.BatchingLoc, out ushort loc)) { //在此处处理网络订单(订单本地化) if (loc >= 1 && loc <= 5) { if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { GoodName = order.MorkOrder.GoodsName, Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, SortNum = order.MorkOrder.SortNum, IsLocal = false, BatchingId = res.BatchingId }); } else if (loc >= 10 && loc <= 11) { int index = 0; if (recipeBoms != null) { index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId); index++; } if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { BatchingId = res.BatchingId, GoodName = order.MorkOrder.GoodsName, Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, SortNum = order.MorkOrder.SortNum, IsLocal = false, RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0 }); } } } } } }); #region 添加网络订单至本地展示 //ActionManage.GetInstance.Register(new Action((o) => //{ // if (o is object[] obj) // { // if (o.Length == 2) // { // if (o[0] is MorkOrderPush morkOrderpush && o[1] is IDevice device) // { // ObservableCollection observableCollection = new ObservableCollection(); // MorkOrder morkOrder = new MorkOrder() // { // OrderPush = morkOrderpush, // OrderStatus = ORDER_STATUS.WAIT, // StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), // FoodMenuModel = new FoodMenuModel() { } // }; // FoodMenuViewModel.orderStatusLists.Add(morkOrder); // observableCollection.Add(morkOrder); // Application.Current?.Dispatcher.BeginInvoke((Action)delegate // { // int index = Array.FindIndex(Json.Data.orderLists.ToArray(), p => p.DeviceId == device.DeviceId.ToString()); // if (index < 0) // { // Json.Data.orderLists.Add(new OrderData() // { // DeviceId = device.DeviceId.ToString(), // IsAllSelect = true, // morkOrderPushes = observableCollection, // }); // } // else // { // Json.Data.orderLists.ElementAt(index).morkOrderPushes.Add(morkOrder); // } // orderStatusLists.Add(new MorkOrder() // { // OrderPush = morkOrderpush, // OrderStatus = ORDER_STATUS.WAIT, // StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), // }); // }); // } // } // } //}), "AddOrder"); #endregion } public override void MainTask() { if (mORKS.InitComplete&&NoodOrderCtrl.GetInstance.stateInfo== "设备未初始化") { NoodOrderCtrl.GetInstance.StateShow("设备正常运行"); } if (!mORKS.InitComplete) { NoodOrderCtrl.GetInstance.StateShow("设备未初始化"); } mORKS.AllowRun = mORKS.InitComplete; if (Json.Data.IsVerify) IsHealth = mORKS.InitComplete; else IsHealth = true; TakeBowlTask(); TakeNoodleTask(); OutNoodleTask(); SingleDetect(); TurntableControl(); } private void BowlControl(OrderLocInfo orderLocInfo) { if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11) { //mORKS.TakeBowlId = orderLocInfo.SuborderId; mORKS.TakeBowName = orderLocInfo.GoodName; mORKS.TakeBowSortNum = orderLocInfo.SortNum; TakeBowlControl(orderLocInfo.Loc); //OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING); OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == orderLocInfo.SuborderId ); if (res != null) res.OrderStatus = ORDER_STATUS.COOKING; else DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】异常"); //DeviceProcessLogShow($"订单【{mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); //2023-8-5修改修改取碗打印日志。 //DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); DeviceProcessLogShow($"执行取碗控制,位置:[{orderLocInfo.Loc}]"); mORKS.TakeBowlInterlock = true; } } /// 取碗控制 private void TakeBowlTask() { if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.DropBowlMechanismStatus && !mORKS.TakeBowlInterlock) { ushort BowLoc = 0; var re = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == mORKS.TakeBowlTask.ElementAt(0).SuborderId); if (re != null) { if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) { BowLoc = (ushort)re.FoodMenuModel.BowLoc; BowlControl(orderLocInfo); } } //var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList(); //if (res == null || res?.Count == 0) //{ // if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) // { // var re = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == orderLocInfo.SuborderId); // if (re!=null) // { // BowlControl(orderLocInfo); // } // } //} //else //{ // foreach (var item in res) // { // if (ushort.TryParse(item.BatchingLoc, out ushort loc)) // { // if (loc == 10 && mORKS.SmallBowlYesOrNoCheck) // { // BowLoc = loc; // break; // } // else if (loc == 11 && mORKS.LargeBowYesOrNoCheck) // { // BowLoc = loc; // break; // } // } // } // if (BowLoc >= 10 && BowLoc <= 11) // { // if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) // { // orderLocInfo.Loc = BowLoc; // var re = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == orderLocInfo.SuborderId); // if (re != null) // { // BowlControl(orderLocInfo); // } // } // } //} } } /// 转台控制 private void TurntableControl() { Global.EnableLocalSimOrder=true; if (Global.EnableLocalSimOrder) { //不做轮询,直接取面,本地订单使用 if (mORKS.SiloInPlace && !mORKS.FixedFlag && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0&& !mORKS.TurntableInterlock) { if (!mORKS.TurntableLowPosition) { if (mORKS.RBTakeNoodleTask.ElementAt(0).IsLocal) { if (mORKS.RBTakeNoodleTask.ElementAt(0).Loc != 0) { TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc); //if (!mORKS.TurntableLocLists.Contains(mORKS.RBTakeNoodleTask.ElementAt(0).Loc)) //{ // TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc); //} //else //{ // DeviceProcessLogShow("未找到可用的物料信息"); // mORKS.TurntableLocLists.Clear(); //} } else { if (mORKS.CurrentFeedbackLoc == 5) { TurntableStart((ushort)1); } else { TurntableStart((ushort)(mORKS.CurrentFeedbackLoc + 1)); } } } else { if (mORKS.CurrentFeedbackLoc == 5) { TurntableStart((ushort)1); } else { TurntableStart((ushort)(mORKS.CurrentFeedbackLoc + 1)); } } } else { if (mORKS.RBTakeNoodleTask.ElementAt(0).IsLocal) { if (mORKS.RBTakeNoodleTask.ElementAt(0).Loc == 0) { mORKS.RBTakeNoodleTask.ElementAt(0).Loc = mORKS.CurrentFeedbackLoc; } TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc); mORKS.AllowTakeNoodle = true; DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面"); } else { mORKS.RBTakeNoodleTask.ElementAt(0).Loc = mORKS.CurrentFeedbackLoc; TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc); mORKS.AllowTakeNoodle = true; DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面"); } } //if (mORKS.TurntableLowPosition) //{ // TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc); // mORKS.TurntableLocLists.Clear(); // mORKS.AllowTakeNoodle = true; // DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面"); //} } } else { //正常轮询 if (Delay.GetInstance("到位检测延时").Start(mORKS.SiloInPlace, 2)) { if (mORKS.SiloInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0) { var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList(); if (result != null) { var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.CurrentFeedbackLoc.ToString()); if (mORKS.TurntableLowPosition && res != null) { TurntableStart(mORKS.CurrentFeedbackLoc); mORKS.TurntableLocLists.Clear(); mORKS.AllowTakeNoodle = true; DeviceProcessLogShow($"控制机器人去转台【{mORKS.CurrentFeedbackLoc}】号位置取面"); } else { if (!mORKS.TurntableInterlock) { foreach (var item in result) { if (ushort.TryParse(item.BatchingLoc, out ushort loc)) { if (mORKS.CurrentFeedbackLoc != loc && !mORKS.TurntableLocLists.Contains(loc)) { if (!mORKS.TurntableLowPosition) { DeviceProcessLogShow($"执行了转台启动互锁信号复位"); } TurntableStart(loc); DeviceProcessLogShow($"没有物料检测的启动转台控制,转台位置:[{loc}]"); break; } else if (mORKS.CurrentFeedbackLoc == loc && !mORKS.TurntableLocLists.Contains(loc)) mORKS.TurntableLocLists.Add(loc); } } } } } else DeviceProcessLogShow("未找到可用的物料信息"); } } } //补料中检测 新版未用 if (RTrig.GetInstance("mORKS.Feeding").Start(mORKS.Feeding)) { NoodOrderCtrl.GetInstance.StateShow("补料中"); mORKS.AllowTakeNoodle = false; mORKS.TakeNoodleInterlock = false; } if (RTrig.GetInstance("mORKS.FixedFlag").Start(mORKS.FixedFlag)) { NoodOrderCtrl.GetInstance.StateShow("补料中"); mORKS.AllowTakeNoodle = false; mORKS.TakeNoodleInterlock = false; } //转台到位检测 if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.SiloInPlace && mORKS.CurrentLoc == mORKS.CurrentFeedbackLoc)) { mORKS.TurntableInterlock = false; DeviceProcessLogShow("转台到位检测"); } //补料完成检测 新版未用 if (RTrig.GetInstance("FeedComplete").Start(mORKS.FeedComplete)) { NoodOrderCtrl.GetInstance.StateShow("设备运行正常"); if (!mORKS.AllowTakeNoodle && mORKS.TurntableLocLists.Count > 0) { mORKS.TurntableLocLists.Clear(); mORKS.TurntableInterlock = false; DeviceProcessLogShow("补料完成检测"); } } } /// 取面任务 private void TakeNoodleTask() { //取面控制 if (mORKS.AllowRun && mORKS.RobotStatus && !mORKS.FixedFlag && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.SiloInPlace && !mORKS.TakeNoodleInterlock && mORKS.RBTakeNoodleTask.Count > 0) { if (mORKS.CurrentLoc == mORKS.CurrentFeedbackLoc) { //int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置r int loc = mORKS.nsm.ToList().FindIndex(p => p.NoodleCookerStatus == false && p.IsShield == false);//查找煮面炉空闲位置 if (loc >= 0 && loc <= 5) { //if (!Json.Data.parSets.ElementAt(loc).IsShield)//检查该煮面篮是否被屏蔽 //{ var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == mORKS.RBTakeNoodleTask.ElementAt(0).SuborderId); if (res != null) { if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo)) { //写入煮面时间 //List values = new List(); //values.Add(Json.Data.parSets.ElementAt(loc).Minute); //values.Add(Json.Data.parSets.ElementAt(loc).Second); //WriteData($"VW{324 + (loc * 4)}", values.ToArray()); if (mORKS.CurrentFeedbackLoc >= 1 && mORKS.CurrentFeedbackLoc <= 5) { //var x = Json.Data.DishLibraryParSets.FirstOrDefault(p => p.TextBlockContext == mORKS.CurrentFeedbackLoc.ToString()); //if (x != null) //{ List values = new List(); if (Json.Data.localOrder.ContainsKey(res.OrderPush.GoodsName)) { values.Add((ushort)Json.Data.localOrder[res.OrderPush.GoodsName].FryTimeMin); values.Add((ushort)Json.Data.localOrder[res.OrderPush.GoodsName].FryTimeS); } else { values.Add(2); values.Add(0); } /* values.Add(re); values.Add(x.Second);*/ WriteData($"VW{324 + (loc * 4)}", values.ToArray()); //DeviceProcessLogShow($"转盘位置[{mORKS.CurrentFeedbackLoc}]:写入煮面时间{x.Minute}分{x.Second}秒。"); //} } mORKS.CurrentLoc = 0; mORKS.CookNodelId[loc] = orderLocInfo.SuborderId; mORKS.NoodleCookerStatus[loc] = true; SetFallNoodleLoc((ushort)(loc + 1)); //机器人开始取面 OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); if (res != null) res.OrderStatus = ORDER_STATUS.COOKING; else DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】异常"); DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏"); mORKS.TakeNoodleInterlock = true; } } } } } } /// 出餐控制 private void OutNoodleTask() { if (mORKS.AllowInvertedFace && mORKS.RobotTaskInterlock && !mORKS.RobotOutDinnigLock && !mORKS.TakeNoodleInterlock && mORKS.RobotStatus) { #region 修改之前的代码 //int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0); //if (loc >= 0 && loc <= 5) //{ // if (mORKS.CookNoodleCom[loc]) // { // SetTakeNoodleLoc((ushort)(loc + 1)); // mORKS.NoodleCookerStatus[loc] = false; // WriteData($"VW260", (ushort)0);//设置出汤时间 // OrderChange(mORKS.IngredientsCompleteId, ORDER_STATUS.COMPLETED_COOK); // DeviceProcessLogShow($"订单【{mORKS.IngredientsCompleteId}】制作完成"); // mORKS.CookCompleteFlatBit = true; // mORKS.OutMealId = mORKS.IngredientsCompleteId; // mORKS.OutMealName = mORKS.IngredientsCompleteName; // mORKS.OutMealSortNum = mORKS.IngredientsCompleteSortNum; // mORKS.IngredientsCompleteId = string.Empty; // mORKS.CookNodelId[loc] = string.Empty; // DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}"); // mORKS.CookNoodleCom[loc] = false; // } //} #region 出餐新 if (FoodMenuViewModel.orderStatusLists.Count>0) { int loc = mORKS.CookNodelId.ToList().FindIndex(o => o == FoodMenuViewModel.orderStatusLists.Last().OrderPush.SuborderId); if (loc>=0&&mORKS.CookNoodleCom[loc] && !mORKS.RobotOutDinnigLock) { var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == mORKS.CookNodelId[loc]); if (res != null) { SetTakeNoodleLoc((ushort)(loc + 1)); mORKS.NoodleCookerStatus[loc] = false; WriteData($"VW260", (ushort)0);//设置出汤时间 OrderChange(mORKS.CookNodelId[loc], ORDER_STATUS.COMPLETED_COOK); NoodOrderCtrl.GetInstance.statusList(res); DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】制作完成"); mORKS.CookCompleteFlatBit = true; mORKS.OutMealId = mORKS.CookNodelId[loc]; mORKS.OutMealName = mORKS.IngredientsCompleteName; mORKS.OutMealSortNum = mORKS.IngredientsCompleteSortNum; mORKS.IngredientsCompleteId = string.Empty; mORKS.CookNodelId[loc] = string.Empty; DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}"); mORKS.CookNoodleCom[loc] = false; mORKS.RobotOutDinnigLock = true; } else DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】异常"); } } #endregion #endregion 修改之前的代码 //int loc = mORKS.CookNodelId.ToList().FindIndex(o => o == FoodMenuViewModel.orderStatusLists.First().OrderPush.SuborderId); //for (int loc = 0; loc < mORKS.CookNodelId.Length; loc++) //{ // if (mORKS.CookNoodleCom[loc] && !mORKS.RobotOutDinnigLock) // { // var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == mORKS.CookNodelId[loc]); // if (res != null) // { // SetTakeNoodleLoc((ushort)(loc + 1)); // mORKS.NoodleCookerStatus[loc] = false; // WriteData($"VW260", (ushort)0);//设置出汤时间 // OrderChange(mORKS.CookNodelId[loc], ORDER_STATUS.COMPLETED_COOK); // NoodOrderCtrl.GetInstance.statusList(res); // DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】制作完成"); // mORKS.CookCompleteFlatBit = true; // mORKS.OutMealId = mORKS.CookNodelId[loc]; // mORKS.OutMealName = mORKS.IngredientsCompleteName; // mORKS.OutMealSortNum = mORKS.IngredientsCompleteSortNum; // mORKS.IngredientsCompleteId = string.Empty; // mORKS.CookNodelId[loc] = string.Empty; // DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}"); // mORKS.CookNoodleCom[loc] = false; // mORKS.RobotOutDinnigLock = true; // } // else // DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】异常"); // } //} } } /// 信号检测 private void SingleDetect() { //允许倒面信号检测 if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowInvertedFace)) { //mORKS.IngredientsCompleteId = mORKS.TakeBowlId; mORKS.IngredientsCompleteName = mORKS.TakeBowName; mORKS.IngredientsCompleteSortNum = mORKS.TakeBowSortNum; mORKS.TakeBowSortNum = 0; mORKS.TakeBowlId = string.Empty; mORKS.TakeBowName = string.Empty; //DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}"); DeviceProcessLogShow($"碗到位,允许倒面。"); mORKS.TakeBowlInterlock = false; mORKS.RobotOutDinnigLock = false; } //取餐完成逻辑处理 if (RTrig.GetInstance("CompleteChange1").Start(mORKS.DiningComplete) && mORKS.CookCompleteFlatBit == true) { OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); var res = FoodMenuViewModel.WaitTakeMeal.FirstOrDefault(o => o.OrderPush.SuborderId == mORKS.OutMealId); if (res != null) { res.OrderStatus = ORDER_STATUS.COMPLETED_TAKE; res.CompleteDate = DateTime.Now.ToString("HH:mm:ss"); //NoodOrderCtrl.GetInstance.FinishOrder(res); } else DeviceProcessLogShow($"订单【{mORKS.OutMealId}】异常"); DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成"); WriteData("M10.1", false); var orderEvent = mORKS.doOrderEvents.FirstOrDefault(order => order.MorkOrder.SuborderId == mORKS.OutMealId); mORKS.OutMealSortNum = orderEvent?.MorkOrder.SortNum ?? 0; DeviceProcessLogShow($"出餐订单序号【{mORKS.OutMealSortNum}】"); VoiceAPI.Speak(mORKS.OutMealSortNum.ToString()); //DeviceProcessLogShow($"叫号系统通知主题【MORKS/VoiceCall/{DeviceId}】"); //Plugin.GetInstance().GetPlugin().Publish($"MORKS/VoiceCall/{DeviceId}", mORKS.OutMealSortNum.ToString()); mORKS.CookCompleteFlatBit = false; mORKS.OutMealId = string.Empty; mORKS.OutMealName = string.Empty; mORKS.OutMealSortNum = 0; } //机器人取面完成信号检测 if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RobotTakeNoodleCom)) { mORKS.TakeNoodleInterlock = false; mORKS.AllowTakeNoodle = false; mORKS.TurntableInterlock = false; DeviceProcessLogShow("检测到机器人取面完成信号"); } int OutMealRequstCount = mORKS.CookNoodleCom.Where(p => p == true).ToList().Count; //int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count - Json.Data.parSets.Where(x => x.IsShield == true).ToList().Count; int mlCount = mORKS.nsm.Where(p => p.NoodleCookerStatus == true && p.IsShield == false).ToList().Count; int index = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId); bool isok = index >= 0 && index < mORKS.CookNoodleCom.Length && mORKS.CookNoodleCom[index]; mORKS.PriorityJudgment = Delay.GetInstance("取餐优先级判断").Start(mORKS.TurntableLocLists.Count > 0 && !mORKS.TurntableLowPosition, 4); //mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowInvertedFace && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment); //mORKS.RobotTaskInterlock = isok && mORKS.AllowInvertedFace && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment); //2023-8-5注释修改,并联出餐请求,出餐优先。 //mORKS.RobotTaskInterlock = mORKS.AllowInvertedFace && (mlCount >= 6 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment); mORKS.RobotTaskInterlock = mORKS.AllowInvertedFace && (OutMealRequstCount >= 1 /*|| mlCount >= 6*/ || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment); } /// 语音提醒取餐 /// private void WaitMeaLSpeak(string meal) { //VoiceAPI.m_SystemPlayWav(@"Vioce\电子提示音.wav"); //Thread.Sleep(1000); //if (meal != null) mORKS.speech.Speak(meal); //VoiceAPI.m_SystemPlayWav(@"Vioce\取餐通知.wav"); } #region PLC 控制函数 private void WriteData(string address, object value) { EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value }); } /// 设备初始化 public async void DeviceInit() { WriteData("M0.0", true); await Task.Delay(1000); WriteData("M0.0", false); } /// 取碗控制 /// private void TakeBowlControl(ushort loc) { if (loc == 10)//小碗 { WriteData("M9.1", true); } else if (loc == 11)//大碗 { WriteData("M9.0", true); } } /// 启动转台 /// private void TurntableStart(ushort loc) { if (loc >= 1 && loc <= 5 ) { mORKS.CurrentLoc = loc; mORKS.TurntableInterlock = true; if (!mORKS.TurntableLocLists.Contains(loc)) { mORKS.TurntableLocLists.Add(loc); } //mORKS.TurntableLocLists.Add(loc); WriteData($"M13.{loc - 1}", true); } } /// 设置倒面位置 /// private void SetFallNoodleLoc(ushort loc) { if (loc >= 1 && loc <= 6) WriteData($"M14.{loc - 1}", true); } /// 设置出餐位置 /// private void SetTakeNoodleLoc(ushort loc) { if (loc >= 1 && loc <= 6) WriteData($"M15.{loc - 1}", true); } public override void SimOrder() { EventBus.GetInstance().Subscribe(0, delegate (IEvent @event, EventCallBackHandle callBackHandle) { if (@event != null && @event is MorksSimorderModel msm) { string guid = Guid.NewGuid().ToString(); if (msm.NoodleLoc >= 1 && msm.NoodleLoc <= 5) { mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.NoodleLoc, SuborderId = guid }); MessageLog.GetInstance.Show($"添加订单:面条位置【{(ushort)msm.NoodleLoc}】"); } if (msm.Bowloc >= 10 && msm.Bowloc <= 11) { mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid }); MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】"); } } }); } #endregion PLC 控制函数 } }