diff --git a/BPASmartClient.Device/VariableMonitor.cs b/BPASmartClient.Device/VariableMonitor.cs index 5e8373f9..63e7139e 100644 --- a/BPASmartClient.Device/VariableMonitor.cs +++ b/BPASmartClient.Device/VariableMonitor.cs @@ -48,7 +48,16 @@ namespace BPASmartClient.Device } } private string _mCurrentValue; - + public bool SwitchValue + { + get { return _sWitchValue; } + set + { + _sWitchValue = value; + OnPropertyChanged(); + } + } + private bool _sWitchValue; public object StatusColor { get; set; } } } diff --git a/BPASmartClient.IceMaker/IceMakerMachine.cs b/BPASmartClient.IceMaker/IceMakerMachine.cs index aade2e3d..c71a614e 100644 --- a/BPASmartClient.IceMaker/IceMakerMachine.cs +++ b/BPASmartClient.IceMaker/IceMakerMachine.cs @@ -23,7 +23,8 @@ namespace BPASmartClient.Icemoker IsWork = true; if (status != null) { - SetStatus("GetDeviceStatus", iceMakerHelper.GetDeviceStatus()); + SetStatus("MakeIceDeviceStatus", iceMakerHelper.GetDeviceStatus()); + SetStatus("MakeIceConnected", IsConnected); } Thread.Sleep(500); } @@ -40,6 +41,21 @@ namespace BPASmartClient.Icemoker if (@event == null) return; iceMakerHelper.EndCook(); }); + EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) + { + if (@event == null) return; + iceMakerHelper.pump(); + }); + EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) + { + if (@event == null) return; + iceMakerHelper.Standby(); + }); + EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) + { + if (@event == null) return; + iceMakerHelper.PowerOn(); + }); EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) { if (@event == null) return; diff --git a/BPASmartClient.IceMaker/IceMakerStatus.cs b/BPASmartClient.IceMaker/IceMakerStatus.cs new file mode 100644 index 00000000..83fb3404 --- /dev/null +++ b/BPASmartClient.IceMaker/IceMakerStatus.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.IceMaker +{ + public enum IceMakerStatus + { + 关机状态=0x01, + 制冰状态=0x02, + 电机故障=0x04, + 缺水=0x08, + 冰满=0x16 + } +} diff --git a/BPASmartClient.Juicer/JuicerMachine.cs b/BPASmartClient.Juicer/JuicerMachine.cs index 047e3770..f1963006 100644 --- a/BPASmartClient.Juicer/JuicerMachine.cs +++ b/BPASmartClient.Juicer/JuicerMachine.cs @@ -23,7 +23,8 @@ namespace BPASmartClient.Juicer IsWork = true; if (status != null) { - SetStatus("GetDeviceStatus", juicerHelper.GetDeviceStatus()); + SetStatus("GetJuicerDeviceStatus", juicerHelper.GetDeviceStatus()); + SetStatus("GetJuicerConnected", IsConnected); } Thread.Sleep(500); } diff --git a/BPASmartClient.Lebai/LebaiRobot.cs b/BPASmartClient.Lebai/LebaiRobot.cs index 8d7d9a46..3dcb4969 100644 --- a/BPASmartClient.Lebai/LebaiRobot.cs +++ b/BPASmartClient.Lebai/LebaiRobot.cs @@ -50,9 +50,11 @@ namespace BPASmartClient.Lebai status["RobotValue"] = LebaiHelper.GetInstance().GetValueAsync().Value; if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] =(ELebaiRModel)LebaiHelper.GetInstance().robotData.RobotMode.Mode; status["RobotValue1"] = LebaiHelper.GetInstance().GetValueAsync(1).Value; - status["GetInput"] = LebaiHelper.GetInstance().GetInput(); - status["GetInput2"] = LebaiHelper.GetInstance().GetInput(2); - + status["LeibaiGetTcpInput"] = LebaiHelper.GetInstance().GetTcpInput(); + status["LeibaiGetInput1"] = LebaiHelper.GetInstance().GetInput(1); + status["LeibaiGetInput2"] = LebaiHelper.GetInstance().GetInput(2); + status["LeibaiGetInput3"] = LebaiHelper.GetInstance().GetInput(3); + status["LeibaiGetInput4"] = LebaiHelper.GetInstance().GetInput(4); if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] = LebaiHelper.GetInstance().robotData.RobotMode.Mode; LebaiHelper.GetInstance().GetRobotModeStatus(); Thread.Sleep(10); @@ -105,7 +107,7 @@ namespace BPASmartClient.Lebai { switch (lebaiControlEvent.LebaiControl) { - case "机器人启动": + case "启动": LebaiHelper.GetInstance().StartRobot(); break; case "启动示教": @@ -114,7 +116,7 @@ namespace BPASmartClient.Lebai case "停止示教": LebaiHelper.GetInstance().EndtTeachMode(); break; - case "机器人急停": + case "急停": LebaiHelper.GetInstance().EStopRobot(); break; case "暂停": diff --git a/BPASmartClient.Model/果汁机/IceMaker.cs b/BPASmartClient.Model/果汁机/IceMaker.cs index 78534e74..bafff610 100644 --- a/BPASmartClient.Model/果汁机/IceMaker.cs +++ b/BPASmartClient.Model/果汁机/IceMaker.cs @@ -18,9 +18,25 @@ namespace BPASmartClient.Model public class StopMakeIce : BaseEvent { + } + public class PumpMakeIce : BaseEvent + { + + } + public class PowerOnMakeIce : BaseEvent + { + + } + public class StandbyMakeIce : BaseEvent + { + } public class SetIceNumber : WriteModel { + } + public class IceMakerState : ReadModel + { + } } diff --git a/BPASmartClient.Model/订单/MorkTSimOrder.cs b/BPASmartClient.Model/订单/MorkTSimOrder.cs new file mode 100644 index 00000000..f104dfd1 --- /dev/null +++ b/BPASmartClient.Model/订单/MorkTSimOrder.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using BPASmartClient.Model.咖啡机.Enum; +namespace BPASmartClient.Model +{ + public class MorkTSimOrder : BaseEvent + { + public int OrderNum { get; set; } + public DrCoffeeDrinksCode DrinkCode { get; set; } + public int JuiceList { get; set; } + public string JuiceMakeID{ get; set; } + } +} diff --git a/BPASmartClient.MorkT/ViewModel/DebugViewModel.cs b/BPASmartClient.MorkT/ViewModel/DebugViewModel.cs index 34a070f2..f1a92f85 100644 --- a/BPASmartClient.MorkT/ViewModel/DebugViewModel.cs +++ b/BPASmartClient.MorkT/ViewModel/DebugViewModel.cs @@ -317,7 +317,6 @@ namespace BPASmartClient.MorkT.ViewModel CXB = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器成型比").CurrentValue; DLCompleted = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器打料完成")?.CurrentValue == "True" ? "打料完成" : "打料中"; } - Thread.Sleep(500); }), "MorkT-状态刷新"); } diff --git a/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj b/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj index c9f3d027..621da4cb 100644 --- a/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj +++ b/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj @@ -1,9 +1,9 @@ - + - net6.0 - enable - enable + net6.0-windows + enable + true @@ -17,4 +17,10 @@ + + + $(DefaultXamlRuntime) + + + diff --git a/BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs b/BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs index 27ed9659..70cf8a2f 100644 --- a/BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs +++ b/BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs @@ -18,6 +18,8 @@ using BPASmartClient.Message; using BPASmartClient.Model.乐白机器人; using BPASmartClient.Model.单片机; using BPASmartClient.Model.PLC; +using BPASmartClient.DRCoffee; +using BPASmartClient.LebaiRobot; namespace BPASmartClient.MorkT_BarCounter { @@ -40,7 +42,7 @@ namespace BPASmartClient.MorkT_BarCounter private string mainMaterialLoc; public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } } - GVL_MorkT morkTJaka =new GVL_MorkT(); + GVL_MorkT morkTLebaiJC =new GVL_MorkT(); /// /// 果汁机做法,true:热饮,false:冷饮 /// @@ -59,7 +61,6 @@ namespace BPASmartClient.MorkT_BarCounter serverInit(); DataParse(); ActionManage.GetInstance.Register(new Action((o) => { SimOrder(o); }), "SimOrder");//模拟订单委托注册 - } private void serverInit() @@ -85,10 +86,8 @@ namespace BPASmartClient.MorkT_BarCounter OrderCount++; DeviceProcessLogShow($"接收到{OrderCount}次订单"); batchings = PolymerBatching.BuildAll(); - //商品类型 GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; - foreach (var item in order.MorkOrder.GoodBatchings) { var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); @@ -100,7 +99,6 @@ namespace BPASmartClient.MorkT_BarCounter //获取当前物料所属商品类型 currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); } - // switch (batchings[res.BatchingLoc].BatchingClass) { case BATCHING_CLASS.HOLDER: @@ -114,10 +112,10 @@ namespace BPASmartClient.MorkT_BarCounter switch (currentGoodsType) { case GOODS_TYPE.COFFEE: - IsAddIce = order.MorkOrder.MakeID == "3";//判断是否加冰 - if (morkTJaka.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) + + if (morkTLebaiJC.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) { - morkTJaka.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() + morkTLebaiJC.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId, @@ -127,22 +125,23 @@ namespace BPASmartClient.MorkT_BarCounter } break; case GOODS_TYPE.JUICE: - if (morkTJaka.morkOrderPushesJuicer.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) + + if (morkTLebaiJC.morkOrderPushesJuicer.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) { - morkTJaka.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() + morkTLebaiJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId, Loc = ushort.Parse(mainMaterialLoc), GoodName = order.MorkOrder.GoodsName, - MakeID = ushort.Parse(order.MorkOrder.MakeID), + makeID = order.MorkOrder.MakeID, }); } break; case GOODS_TYPE.TEA: - if (morkTJaka.morkOrderPushesTea.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) + if (morkTLebaiJC.morkOrderPushesTea.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) { - morkTJaka.morkOrderPushesTea.Enqueue(new OrderLocInfo() + morkTLebaiJC.morkOrderPushesTea.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId, @@ -152,9 +151,9 @@ namespace BPASmartClient.MorkT_BarCounter } break; case GOODS_TYPE.WATER: - if (morkTJaka.morkOrderPushesWater.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) + if (morkTLebaiJC.morkOrderPushesWater.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) { - morkTJaka.morkOrderPushesWater.Enqueue(new OrderLocInfo() + morkTLebaiJC.morkOrderPushesWater.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId, @@ -188,25 +187,26 @@ namespace BPASmartClient.MorkT_BarCounter { EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) { - if (morkTJaka.IsHaveCoffeeCup) - morkTJaka.MakeCoffeeEnd = true; + if (morkTLebaiJC.IsHaveCoffeeCup && morkTLebaiJC.MakeCoffeeEnd != true) + morkTLebaiJC.MakeCoffeeEnd = true; }); - if (pickUpCoffeeHaveCup) + if (morkTLebaiJC.IsHaveCoffeeCup && morkTLebaiJC.MakeCoffeeEnd != true) { if (!bFirstTrig_Coffee) { bFirstTrig_Coffee = true; delayTimeOut_Coffee = DateTime.Now; } - else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 && bFirstTrig_Coffee == true) + else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 18 && bFirstTrig_Coffee == true) { + DeviceProcessLogShow("接咖啡超时,接咖啡结束,等待取咖啡"); bFirstTrig_Coffee = false; - if (morkTJaka.IsHaveCoffeeCup) - morkTJaka.MakeCoffeeEnd = true; + if (morkTLebaiJC.IsHaveCoffeeCup) + morkTLebaiJC.MakeCoffeeEnd = true; } } - if (morkTJaka.IsHaveJuiceCup) + if (morkTLebaiJC.IsHaveJuiceCup && morkTLebaiJC.MakeJuiceEnd != true) { var Juicestate = GetStatus("GetDeviceStatus"); if (Juicestate != null) @@ -217,33 +217,39 @@ namespace BPASmartClient.MorkT_BarCounter var Juicestate2 = Juicestate[1]; if (Juicestate1.IndexOf("0") == 1 && Juicestate2 == 0) { - morkTJaka.MakeJuiceEnd = true; + morkTLebaiJC.MakeJuiceEnd = true; + bFirstTrig_Juice = false; } } } - //若无状态返回 则加延迟 - if (!bFirstTrig_Juice) - { - bFirstTrig_Juice = true; - delayTimeOut_Juice = DateTime.Now; - } - else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 30 && bFirstTrig_Juice==true) + if (!morkTLebaiJC.MakeJuiceEnd) { - bFirstTrig_Juice = false; - morkTJaka.MakeJuiceEnd = true; + //若无状态返回 则加延迟 + if (!bFirstTrig_Juice) + { + bFirstTrig_Juice = true; + delayTimeOut_Juice = DateTime.Now; + } + else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 3 && bFirstTrig_Juice == true) + { + DeviceProcessLogShow("接果汁超时,接果汁结束,等待取果汁"); + bFirstTrig_Juice = false; + morkTLebaiJC.MakeJuiceEnd = true; + } } } - if (morkTJaka.IsHaveTeaWaterCup) + if (morkTLebaiJC.IsHaveTeaWaterCup && morkTLebaiJC.MakeTeaEnd != true) { if (!bFirstTrig_TeaWater) { bFirstTrig_TeaWater = true; delayTimeOut_Water = DateTime.Now;//开启接水信号后,记录当前时间 } - else if (DateTime.Now.Subtract(delayTimeOut_Water).TotalSeconds >= 50 && bFirstTrig_TeaWater == true)//接水超过50s后,启动接水完成标志,开启接水程序 + else if (DateTime.Now.Subtract(delayTimeOut_Water).TotalSeconds >= 5 && bFirstTrig_TeaWater == true)//接水超过50s后,启动接水完成标志,开启接水程序 { + DeviceProcessLogShow("接茶或水延迟时间结束"); bFirstTrig_TeaWater = false; - morkTJaka.MakeTeaEnd = true; + morkTLebaiJC.MakeTeaEnd = true; } } DoCoffee(); @@ -300,7 +306,6 @@ namespace BPASmartClient.MorkT_BarCounter { new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Pin = pin,Value=value }.Publish(); } - private T GetStatus(string key) { if (peripheralStatus.ContainsKey(key)) @@ -315,41 +320,44 @@ namespace BPASmartClient.MorkT_BarCounter int[] devStatusBy = new int[2] { 0, 0 }; bool outCupCheck = false;//放纸杯位置有无判断 /// - /// 判断接咖啡的位置是否有杯子 - /// - bool pickUpCoffeeHaveCup = false; - /// - /// 判断接果汁的位置是否有杯子 - /// - bool pickUpJuiceHaveCup = false; - /// - /// 判断接开水的位置是否有杯子 - /// - bool pickUpHotWaterHaveCup = false; - /// /// 传感器的输入信号 0:无意义 1:有信号 2:无信号 3:信号不正确 /// int bSensorInput; - + /// + /// 判断是否有咖啡订单 + /// + /// private bool IsMakeCoffee() { - bool bMake = (IsHealth && morkTJaka.morkOrderPushesCoffee.Count > 0 && !morkTJaka.IsHaveCoffeeCup) ? true : false; + bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesCoffee.Count > 0 && !morkTLebaiJC.IsHaveCoffeeCup) ? true : false; return bMake; } + /// + /// 判断是否有果汁订单 + /// + /// private bool IsMakeJuice() { - bool bMake = (IsHealth && morkTJaka.morkOrderPushesJuicer.Count > 0 && !morkTJaka.IsHaveJuiceCup) ? true : false; + bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesJuicer.Count > 0 && !morkTLebaiJC.IsHaveJuiceCup) ? true : false; return bMake; } + /// + /// 判断是否有茶订单 + /// + /// private bool IsMakeTeaWater() { - bool bMake = (IsHealth && morkTJaka.morkOrderPushesTea.Count > 0 && !morkTJaka.IsHaveTeaWaterCup) ? true : false; + bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesTea.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false; return bMake; } + /// + /// 判断是否有开水订单 + /// + /// private bool IsMakeWater() { - bool bMake = (IsHealth && morkTJaka.morkOrderPushesWater.Count > 0 && !morkTJaka.IsHaveTeaWaterCup) ? true : false; + bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesWater.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false; return bMake; } /// @@ -359,88 +367,113 @@ namespace BPASmartClient.MorkT_BarCounter { if (IsMakeCoffee()) { - if (morkTJaka.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc)) - { - PickUpCoffee();//接咖啡 - morkTJaka.IsHaveCoffeeCup = true; - } + PickUpCoffee();//接咖啡 + morkTLebaiJC.IsHaveCoffeeCup = true; } - else if(morkTJaka.MakeCoffeeEnd) + else if(morkTLebaiJC.MakeCoffeeEnd) { - PutCoffeeCup(); - pickUpCoffeeHaveCup = false; - morkTJaka.IsHaveCoffeeCup = false; + try + { + PutCoffeeCup(); + morkTLebaiJC.MakeCoffeeEnd = false; + morkTLebaiJC.IsHaveCoffeeCup = false; + morkTLebaiJC.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc); + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx(ex.ToString()); + } } } private void DoJuice() { if (IsMakeJuice()) { - if (morkTJaka.morkOrderPushesJuicer.TryDequeue(out OrderLocInfo orderLoc)) + switch (morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).makeID) { - switch (morkTJaka.morkOrderPushesJuicer.ElementAt(0).Loc) - { - case 1: - GuMake = true; - IsAddIce = false; - break; - case 2: - GuMake = false; - IsAddIce = false; - break; - case 3: - GuMake = false; - IsAddIce = true; - break; - default: - break; - } - PickUpJuicer(); - morkTJaka.IsHaveJuiceCup = true; + case "1": + GuMake = true; + IsAddIce = false; + break; + case "2": + GuMake = false; + IsAddIce = false; + break; + case "3": + GuMake = false; + IsAddIce = true; + break; + default: + break; } + PickUpJuicer(); + morkTLebaiJC.IsHaveJuiceCup = true; } - else if (morkTJaka.MakeJuiceEnd) + else if (morkTLebaiJC.MakeJuiceEnd) { - Thread.Sleep(5000);//延迟五秒,防止接饮料口滴饮料 - putJuice(); - pickUpJuiceHaveCup = false; - morkTJaka.IsHaveJuiceCup = false; - morkTJaka.MakeJuiceEnd = false; + try + { + Thread.Sleep(5000);//延迟五秒,防止饮料口滴饮料 + putJuice(); + morkTLebaiJC.IsHaveJuiceCup = false; + morkTLebaiJC.MakeJuiceEnd = false; + morkTLebaiJC.morkOrderPushesJuicer.TryDequeue(out OrderLocInfo orderLoc); + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx(ex.ToString()); + } } } + public bool DoTeaOrWater; private void DoBoiledTea() { if (IsMakeTeaWater()) { - if (morkTJaka.morkOrderPushesTea.TryDequeue(out OrderLocInfo orderLoc)) - { - PickUpTea(); - morkTJaka.IsHaveTeaWaterCup = true; - } + PickUpTea(); + morkTLebaiJC.IsHaveTeaWaterCup = true; + DoTeaOrWater = true; } - else if(morkTJaka.MakeTeaEnd) + else if (morkTLebaiJC.MakeTeaEnd && morkTLebaiJC.morkOrderPushesTea.Count > 0 && DoTeaOrWater) { - PutWaterCup(); - pickUpHotWaterHaveCup = false; - morkTJaka.IsHaveTeaWaterCup = false ; - morkTJaka.MakeTeaEnd = false; + try + { + PutWaterCup(); + OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); + DeviceProcessLogShow("-------------茶 制作完成------------"); + morkTLebaiJC.IsHaveTeaWaterCup = false; + morkTLebaiJC.MakeTeaEnd = false; + morkTLebaiJC.morkOrderPushesTea.TryDequeue(out OrderLocInfo orderLoc); + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx(ex.ToString()); + } } } private void DoBoiledWater() { if (IsMakeWater()) { - if (morkTJaka.morkOrderPushesWater.TryDequeue(out OrderLocInfo orderLoc)) - { - PickUpWater(); - } + PickUpWater(); + morkTLebaiJC.IsHaveTeaWaterCup = true; + DoTeaOrWater = false; } - else if (morkTJaka.MakeTeaEnd) + else if (morkTLebaiJC.MakeTeaEnd && morkTLebaiJC.morkOrderPushesWater.Count > 0 && DoTeaOrWater == false) { - PutWaterCup(); - pickUpHotWaterHaveCup = false; - morkTJaka.IsHaveTeaWaterCup = false; - morkTJaka.MakeTeaEnd = false; + try + { + PutWaterCup(); + OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); + DeviceProcessLogShow("-------------开水 制作完成------------"); + morkTLebaiJC.IsHaveTeaWaterCup = false; + morkTLebaiJC.MakeTeaEnd = false; + morkTLebaiJC.morkOrderPushesWater.TryDequeue(out OrderLocInfo orderLoc); + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx(ex.ToString()); + } } } @@ -451,30 +484,32 @@ namespace BPASmartClient.MorkT_BarCounter /// private void PickUpCoffee() { - if (!pickUpCoffeeHaveCup) + if (!morkTLebaiJC.IsHaveCoffeeCup) { outCupCheck = false; - OrderChange(morkTJaka.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); + OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); int resultTakeCup = takeCup(); if (resultTakeCup == 1) { new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.机器人安全位); - Wait(); + //Wait(); WritePLCData("",2);//将轴移动到接咖啡的位置 + DeviceProcessLogShow("伺服电机移动到接咖啡的位置"); DeviceProcessLogShow("咖啡杯取杯完成"); new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接咖啡); - Wait(); - pickUpCoffeeHaveCup = true; - new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)(morkTJaka.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 + //Wait(); + new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).Loc)}.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 } else { - DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!"); + /*DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!"); + new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.机器人初始位); + //Wait();*/ } } } @@ -492,14 +527,14 @@ namespace BPASmartClient.MorkT_BarCounter outCupCheck = false; new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.机器人安全位); - Wait(); + //Wait(); WritePLCData("", 2);//将轴移动到接咖啡的位置 new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.放咖啡杯); - Wait(); - OrderChange(morkTJaka.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); - DeviceProcessLogShow("咖啡制作完成"); + //Wait(); + OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); + DeviceProcessLogShow($"-------------{morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).GoodName}制作完成------------"); } #endregion #region 做开水流程 @@ -509,15 +544,15 @@ namespace BPASmartClient.MorkT_BarCounter private void PickUpWater() { #region 接水流程 - if (!pickUpHotWaterHaveCup) + if (!morkTLebaiJC.IsHaveTeaWaterCup) { - OrderChange(morkTJaka.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); + OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); int resultTakeCup = takeCup(); if (resultTakeCup == 1) { new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接开水); - Wait(); + //Wait(); Output(false, 1); Output(false, 0); Thread.Sleep(100); @@ -547,16 +582,16 @@ namespace BPASmartClient.MorkT_BarCounter private void PickUpTea() { #region 接茶流程 - if (!pickUpHotWaterHaveCup) + if (!morkTLebaiJC.IsHaveTeaWaterCup) { - OrderChange(morkTJaka.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); + OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); int resultTakeCup = takeCup(); if (resultTakeCup == 1) { DeviceProcessLogShow("取茶杯完成"); new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接茶叶); - Wait(); + //Wait(); new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish(); Thread.Sleep(1000); @@ -567,7 +602,7 @@ namespace BPASmartClient.MorkT_BarCounter Thread.Sleep(3000); new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接茶水); - Wait(); + //Wait(); Output(false, 1); Output(false, 0); Thread.Sleep(100); @@ -581,7 +616,7 @@ namespace BPASmartClient.MorkT_BarCounter Output(true, 1); Thread.Sleep(500); Output(false, 1); - pickUpHotWaterHaveCup = true; + morkTLebaiJC.IsHaveTeaWaterCup = true; } else { @@ -604,9 +639,6 @@ namespace BPASmartClient.MorkT_BarCounter outCupCheck = false; new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.放水杯); - Wait(); - OrderChange(morkTJaka.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); - DeviceProcessLogShow("茶水制作完成"); } #endregion @@ -623,18 +655,20 @@ namespace BPASmartClient.MorkT_BarCounter { new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.取杯位_机器人安全位); - Wait(); + //Wait(); WritePLCData("",3);//将模组移动到接冰的位置 new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接冰块); - Wait(); - new StartMakeIce() { }.Publish(); - + //Wait(); + if (Math.Pow(1, GetStatus("GetMakeIceDeviceStatus")) == 0)//制冰机在待机状态才可以制作冰 + { + new StartMakeIce() { }.Publish(); + } new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接冰_机器人安全位); - Wait(); + //Wait(); } } /// @@ -648,21 +682,21 @@ namespace BPASmartClient.MorkT_BarCounter private void PickUpJuicer() { #region 接果汁流程 - if (!pickUpJuiceHaveCup) + if (!morkTLebaiJC.IsHaveJuiceCup) { - OrderChange(morkTJaka.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); - int resultTakeCup = takeCup(); - JuiceCH = morkTJaka.morkOrderPushesJuicer.ElementAt(0).Loc; + OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); + int resultTakeCup = takeCup(); + JuiceCH = morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).Loc; if (resultTakeCup == 1) { getIce(); new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.机器人安全位); - Wait(); + //Wait(); WritePLCData("", 3);//将模组移动到接冰的位置 new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接果汁过渡位); - Wait(); + //Wait(); switch (JuiceCH) { case 52: @@ -672,7 +706,7 @@ namespace BPASmartClient.MorkT_BarCounter JuicerNum = 0x01; new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接果汁1); - Wait(); + //Wait(); break; case 53: if (GuMake) @@ -681,7 +715,7 @@ namespace BPASmartClient.MorkT_BarCounter JuicerNum = 0x03; new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接果汁2); - Wait(); + //Wait(); break; case 54: if (GuMake) @@ -690,7 +724,7 @@ namespace BPASmartClient.MorkT_BarCounter JuicerNum = 0x05; new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接果汁3); - Wait(); + //Wait(); break; case 55: if (GuMake) @@ -699,17 +733,17 @@ namespace BPASmartClient.MorkT_BarCounter JuicerNum = 0x07; new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接果汁4); - Wait(); + //Wait(); break; default: JuicerNum = 0x00; new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.接果汁1); - Wait(); + //Wait(); break; } new WriteJuicer() { Value = JuicerNum }.Publish(); - pickUpJuiceHaveCup = true; + morkTLebaiJC.IsHaveJuiceCup = true; } else { @@ -735,31 +769,31 @@ namespace BPASmartClient.MorkT_BarCounter case 52: new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.放果汁杯1); - Wait(); + //Wait(); break; case 53: new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.放果汁杯2); - Wait(); + //Wait(); break; case 54: new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.放果汁杯3); - Wait(); + //Wait(); break; case 55: new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.放果汁杯4); - Wait(); + //Wait(); break; default: new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.放果汁杯1); - Wait(); + //Wait(); break; } - OrderChange(morkTJaka.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); - DeviceProcessLogShow("果汁制作完成"); + OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); + DeviceProcessLogShow($"-------------{morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).GoodName}果汁 制作完成------------"); } #endregion @@ -778,25 +812,21 @@ namespace BPASmartClient.MorkT_BarCounter nCnt = 0; new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.机器人初始位); - Wait(); + //Wait(); new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.机器人安全位); - Wait(); + //Wait(); - WritePLCData("", SendToPlc.取杯); - if (!morkTJaka.sensorGetCup) - { - WritePLCData("", 2); - } + WritePLCData("", 1); new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.取纸杯); - Wait(); + //Wait(); new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.取纸杯检测); - Wait(); + //Wait(); nCnt++; Thread.Sleep(2000); while (!GetStatus("GetInput")) //读取传感器的值 @@ -807,10 +837,10 @@ namespace BPASmartClient.MorkT_BarCounter DeviceProcessLogShow("三次取杯失败,回原点"); new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.机器人安全位); - Wait(); + //Wait(); new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.机器人初始位); - Wait(); + //Wait(); return 2; } else @@ -818,17 +848,16 @@ namespace BPASmartClient.MorkT_BarCounter nCnt++; new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.二次取杯); - Wait(); + //Wait(); new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.取纸杯检测); - Wait(); - + //Wait(); } Thread.Sleep(1000); } new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); Sence(GVL_MorkT.取杯位_机器人安全位); - Wait(); + //Wait(); return 1; } catch (Exception ex) @@ -847,10 +876,10 @@ namespace BPASmartClient.MorkT_BarCounter { if (GetStatus("GetInput2")) return 2; Sence(GVL_MorkT.JUICE_放杯); - Wait(); + //Wait(); new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); Sence(GVL_MorkT.JUICE_放杯检测); - Wait(); + //Wait(); new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); if (GetStatus("GetInput2")) { @@ -890,13 +919,204 @@ namespace BPASmartClient.MorkT_BarCounter public override void ReadData() { - GetStatus("", new Action((obj) => + #region 乐白机器人状态 + GetStatus("RobotIsConnected", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.RobotIsConnected = b; + } + })); + GetStatus("RobotMode", new Action((o) => + { + if (o is ELebaiRModel eLebaiRModel) + { + morkTLebaiJC.RobotMode = eLebaiRModel; + } + })); + GetStatus("LeibaiGetTcpInput", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.RobotGetTcpInput = b; + } + })); + GetStatus("LeibaiGetInput1", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.RobotGetInput0 = b; + } + })); + GetStatus("LeibaiGetInput2", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.RobotGetInput1 = b; + } + })); + GetStatus("LeibaiGetInput3", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.RobotGetInput2 = b; + } + })); + GetStatus("LeibaiGetInput4", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.RobotGetInput3 = b; + } + })); + + #endregion + #region 制冰机状态 + GetStatus("MakeIceConnected", new Action((o) => { - if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 24) + if (o is bool bt) { - + morkTLebaiJC.IceMakerConnect = bt; } })); + GetStatus("MakeIceDeviceStatus", new Action((o) => + { + if (o is byte bt) + { + morkTLebaiJC.IceMakerState = bt; + } + })); + #endregion + #region 咖啡机状态 + GetStatus("CoffeeIsConnected", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.CoffeeIsConnected = b; + } + })); + + GetStatus("CoffeeStatus", new Action((o) => + { + if (o is DrCoffeeStatus coffeeStatus) + { + morkTLebaiJC.DrCoffeeStatus = coffeeStatus; + } + })); + + GetStatus("CoffeeAppStatus", new Action((o) => + { + if (o is DrCoffeeAppStatus appStatus) + { + morkTLebaiJC.CoffeeAppStatus = appStatus; + } + })); + + GetStatus("CoffeeWarning", new Action((o) => + { + if (o is DrCoffeeWarning coffeeWarning) + { + morkTLebaiJC.CoffeeWarning = coffeeWarning; + } + })); + GetStatus("CoffeeFault", new Action((o) => + { + if (o is DrCoffeeFault coffeeFault) + { + morkTLebaiJC.CaffeeFault = coffeeFault; + } + })); + #endregion + #region 单片机状态 + EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput0" }); + EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput1" }); + EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput2" }); + EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput3" }); + EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput4" }); + EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput5" }); + EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput6" }); + EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput7" }); + GetStatus("SCChipIsConnect", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.SCChipIsConnect = b; + } + })); + GetStatus("SCChipGetInput0", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.SCChipInput0 = b; + } + })); + GetStatus("SCChipGetInput1", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.SCChipInput1 = b; + } + })); + GetStatus("SCChipGetInput2", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.SCChipInput2 = b; + } + })); + GetStatus("SCChipGetInput3", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.SCChipInput3 = b; + } + })); + GetStatus("SCChipGetInput4", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.SCChipInput4 = b; + } + })); + GetStatus("SCChipGetInput5", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.SCChipInput5 = b; + } + })); + GetStatus("SCChipGetInput6", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.SCChipInput6 = b; + } + })); + GetStatus("SCChipGetInput7", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.SCChipInput7 = b; + } + })); + + #endregion + #region 果汁机 + GetStatus("GetJuicerConnected", new Action((o) => + { + if (o is bool b) + { + morkTLebaiJC.JuicerConnected = b; + } + })); + GetStatus("GetJuicerDeviceStatus", new Action((o) => + { + if (o is int[] b) + { + morkTLebaiJC.JuicerState = b; + } + })); + #endregion } #endregion public override void Stop() @@ -911,7 +1131,30 @@ namespace BPASmartClient.MorkT_BarCounter public override void SimOrder() { - + EventBus.EventBus.GetInstance().Subscribe(0, delegate (IEvent @event, EventCallBackHandle callBackHandle) + { + string guid = Guid.NewGuid().ToString(); + if (@event != null && @event is MorkTSimOrder msm) + { + DeviceProcessLogShow("----开始模拟订单----"); + if (msm.OrderNum == 1) + { + morkTLebaiJC.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() { Loc =(ushort)msm.DrinkCode, SuborderId = guid, GoodName="模拟咖啡订单" }); + } + else if (msm.OrderNum == 2) + { + morkTLebaiJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() { Loc = (ushort) (msm.JuiceList + 51), makeID = msm.JuiceMakeID, SuborderId = guid, GoodName = "模拟果汁订单" }); + } + else if (msm.OrderNum == 3) + { + morkTLebaiJC.morkOrderPushesTea.Enqueue(new OrderLocInfo() { SuborderId = guid, GoodName = "模拟茶水订单" }); + } + else if (msm.OrderNum == 4) + { + morkTLebaiJC.morkOrderPushesWater.Enqueue(new OrderLocInfo() { SuborderId = guid, GoodName = "模拟开水订单" }); + } + } + }); } } } diff --git a/BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs b/BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs index eff6d4b8..85f1241f 100644 --- a/BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs +++ b/BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs @@ -5,6 +5,9 @@ using System.Text; using System.Threading.Tasks; using BPASmartClient.Device; using System.Collections.Concurrent; +using BPASmartClient.LebaiRobot; +using BPASmartClient.DRCoffee; +using BPASmartClient.IceMaker; namespace BPASmartClient.MorkT_BarCounter { @@ -79,9 +82,8 @@ namespace BPASmartClient.MorkT_BarCounter /// 是否有咖啡杯 /// public bool IsHaveCoffeeCup = false; - /// - /// 咖啡是否制作完成 + /// 出咖啡完成,是否取咖啡杯 /// public bool MakeCoffeeEnd = false; @@ -90,11 +92,11 @@ namespace BPASmartClient.MorkT_BarCounter /// public ConcurrentQueue morkOrderPushesJuicer = new ConcurrentQueue(); /// - /// 果汁是否在制作中 + /// 是否有果汁杯 /// public bool IsHaveJuiceCup = false; /// - /// 咖啡是否制作完成 + /// 出果汁完成,是否去取果汁 /// public bool MakeJuiceEnd = false; @@ -103,11 +105,11 @@ namespace BPASmartClient.MorkT_BarCounter /// public ConcurrentQueue morkOrderPushesTea = new ConcurrentQueue(); /// - /// 茶或水是否在制作中 + /// 接水口是否有茶水杯 /// public bool IsHaveTeaWaterCup = false; /// - /// 咖啡是否制作完成 + /// 水已经接完,是否去取水杯 /// public bool MakeTeaEnd = false; @@ -131,15 +133,79 @@ namespace BPASmartClient.MorkT_BarCounter /// public string SuborderId = null; - #region PLC的变量交互 - /// - /// - /// - public bool sensorGetCup { get; set; } - public bool sensorPutCup { get; set; } + #region + + [VariableMonitor("机器人连接状态")] + public bool RobotIsConnected { get; set; } + [VariableMonitor("机器人状态")] + public ELebaiRModel RobotMode { get; set; } + [VariableMonitor("机器人TCP输入状态")] + public bool RobotGetTcpInput { get; set; } + [VariableMonitor("机器人输入0状态")] + public bool RobotGetInput0{ get; set; } + [VariableMonitor("机器人输入1状态")] + public bool RobotGetInput1 { get; set; } + [VariableMonitor("机器人输入2状态")] + public bool RobotGetInput2 { get; set; } + [VariableMonitor("机器人输入3状态")] + public bool RobotGetInput3 { get; set; } + + + [VariableMonitor("咖啡机连接状态")] + public bool CoffeeIsConnected { get; set; } + [VariableMonitor("咖啡机状态")] + public DrCoffeeStatus DrCoffeeStatus { get; set; } + [VariableMonitor("咖啡机应用状态")] + public DrCoffeeAppStatus CoffeeAppStatus { get; set; } + [VariableMonitor("咖啡机告警")] + public DrCoffeeWarning CoffeeWarning { get; set; } + [VariableMonitor("咖啡机故障")] + public DrCoffeeFault CaffeeFault { get; set; } + + [VariableMonitor("单片机连接状态")] + public bool SCChipIsConnect { get; set; } + [VariableMonitor("单片机输入0状态")] + public bool SCChipInput0 { get; set; } + [VariableMonitor("单片机输入1状态")] + public bool SCChipInput1 { get; set; } + [VariableMonitor("单片机输入2状态")] + public bool SCChipInput2 { get; set; } + [VariableMonitor("单片机输入3状态")] + public bool SCChipInput3 { get; set; } + [VariableMonitor("单片机输入4状态")] + public bool SCChipInput4 { get; set; } + [VariableMonitor("单片机输入5状态")] + public bool SCChipInput5 { get; set; } + [VariableMonitor("单片机输入6状态")] + public bool SCChipInput6 { get; set; } + [VariableMonitor("单片机输入7状态")] + public bool SCChipInput7 { get; set; } + + + + [VariableMonitor("制冰机连接状态")] + public bool IceMakerConnect { get; set; } + [VariableMonitor("制冰机设备状态")] + public byte IceMakerState { get; set; } + + + [VariableMonitor("果汁机连接状态")] + public bool JuicerConnected { get; set; } + + public int[] JuicerState{ get; set; } + + [VariableMonitor("果汁机制热")] + public bool JuiceState_Heating { get; set; } + [VariableMonitor("果汁机制冷")] + public bool JuiceState_Cooling { get; set; } + [VariableMonitor("果汁机缺水")] + public bool JuiceState_LackOfWater { get; set; } + [VariableMonitor("果汁机童锁")] + public bool JuiceState_ChildLocks { get; set; } + [VariableMonitor("果汁机使用")] + public bool JuiceState_Using { get; set; } #endregion - } - + } diff --git a/BPASmartClient.MorkT_BarCounter/OrderLocInfo.cs b/BPASmartClient.MorkT_BarCounter/OrderLocInfo.cs index f9cfa8de..4addc342 100644 --- a/BPASmartClient.MorkT_BarCounter/OrderLocInfo.cs +++ b/BPASmartClient.MorkT_BarCounter/OrderLocInfo.cs @@ -13,6 +13,6 @@ namespace BPASmartClient.MorkT_BarCounter public ushort RecipeNumber { get; set; } public int BatchingId { get; set; } public string GoodName { get; set; } - public int MakeID { get; set; } + public string makeID { get; set; } } } diff --git a/BPASmartClient.MorkT_BarCounter/SendToPlc.cs b/BPASmartClient.MorkT_BarCounter/SendToPlc.cs deleted file mode 100644 index 09679a07..00000000 --- a/BPASmartClient.MorkT_BarCounter/SendToPlc.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MorkT_BarCounter -{ - public enum SendToPlc - { - 取杯, - 咖啡, - 果汁, - 开水, - 落茶, - 制冰, - } -} diff --git a/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml b/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml new file mode 100644 index 00000000..5d8a62a2 --- /dev/null +++ b/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 舵机控制 + + 舵机1 + 舵机2 + 舵机3 + 舵机4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 果汁: + + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + + + + + + 果汁: + + 饮品1 + 饮品2 + 饮品3 + 饮品4 + + + 热饮 + 常温 + 冷饮 + + + + + + + 开水: + + + + + + 茶水: + + + + + + + + + + + + + + + + + + + 连接状态: + + + + + + + + + + + + + 设备状态: + + + + + + + + + + 控制: + + + + + + + 出冰时间: + + s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 咖啡机状态 + + 应用状态 + + 告警信息 + + 故障信息 + + + + + 饮品 + +