diff --git a/BPASmartClient.KLMCoffee/CoffeeMachine.cs b/BPASmartClient.KLMCoffee/CoffeeMachine.cs index e2a20f59..b459392b 100644 --- a/BPASmartClient.KLMCoffee/CoffeeMachine.cs +++ b/BPASmartClient.KLMCoffee/CoffeeMachine.cs @@ -61,6 +61,8 @@ namespace BPASmartClient.KLMCoffee { MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); } + + } /// @@ -102,6 +104,8 @@ namespace BPASmartClient.KLMCoffee private void ResolveMsg() { + status["CoffeeIsConnected"] = OnLine; + IsConnected = OnLine; List temp = new List(); //一系列解包 while (dataStorage.GetSize() > 0) @@ -170,12 +174,11 @@ namespace BPASmartClient.KLMCoffee protected override void InitStatus() { status["CoffeeStatus"] = K95SysTemStatus.空闲状态; - status["CoffeedrinkType"] = DrinkType.意式; + status["CoffeedrinkType"] = DrinkType.意式咖啡; status["CoffeeAppStatus"] = TaskIndex.无任务; status["Coffeeprogress"] = 0; status["CoffeeWarning"] = new FaultMessage(0x00, 0x00).dataFault(); status["CoffeeKeep"] = new UpkeepMessage(0x00).dataFault(); - } public override void Init() @@ -189,9 +192,12 @@ namespace BPASmartClient.KLMCoffee try { free = true; - Thread.Sleep(200); - byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode)); + Thread.Sleep(300); + K95deFaultCoffeeEnum K95Code = (K95deFaultCoffeeEnum)((KLMCoffee_MakeCoffeeEvent)@event).KLMDrinkFaultCode; + //byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode)); + byte[] data = command.ReturnsCommandData(K95CommandEnum.咖啡制作.GetString(), K95Code.GetString()); commProxy.SendData(data); + MessageLog.GetInstance.Show($"制作{K95Code}数据发送完成"); Thread.Sleep(200); free = false; } diff --git a/BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs b/BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs index ddca4769..90ad6882 100644 --- a/BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs +++ b/BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs @@ -89,12 +89,12 @@ namespace BPASmartClient.KLMCoffee.Protocal { switch (me) { - case DrinkType.意式: return "01"; - case DrinkType.美式: return "02"; + case DrinkType.意式咖啡: return "01"; + case DrinkType.美式咖啡: return "02"; case DrinkType.热水: return "03"; - case DrinkType.卡布: return "04"; - case DrinkType.玛奇朵: return "05"; - case DrinkType.拿铁: return "06"; + case DrinkType.卡布奇诺: return "04"; + case DrinkType.玛琪雅朵: return "05"; + case DrinkType.拿铁咖啡: return "06"; case DrinkType.热牛奶: return "07"; case DrinkType.热奶沫: return "08"; default: return "01"; diff --git a/BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs b/BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs index da2fd40d..1a870f78 100644 --- a/BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs +++ b/BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs @@ -11,34 +11,34 @@ namespace BPASmartClient.KLMCoffee.Protocal /// public enum K95deFaultCoffeeEnum { - 意式咖啡, - 美式咖啡, - 咖啡意式咖啡, - 卡布奇诺, - 玛琪雅朵, - 拿铁, - 白咖啡, - 芮斯崔朵, - 意式玛奇朵, - 奶油咖啡, - 双杯意式咖啡, - 双杯卡布奇诺, - 双杯拿铁, - 双杯玛琪雅朵, - 双杯白咖啡, - 双杯咖啡, - 双杯芮斯崔朵, - 双杯意式玛奇朵, - 双杯奶油咖啡, - 热水, - 牛奶, - 奶沫, - 大壶咖啡, - 取消制作, - 放杯确认, - 清洗冲泡器, - 清洗奶沫器, - 清洗奶沫器确认, - 状态查询 + 意式咖啡 = 1, + 美式咖啡 = 2, + 咖啡意式咖啡 = 9, + 卡布奇诺 = 4, + 玛琪雅朵 = 5, + 拿铁 = 6, + 白咖啡 = 14, + 芮斯崔朵 = 10, + 意式玛奇朵 = 13, + 奶油咖啡 = 12, + 双杯意式咖啡 = 51, + 双杯卡布奇诺 = 55, + 双杯拿铁 = 57, + 双杯玛琪雅朵 = 56, + 双杯白咖啡 = 59, + 双杯咖啡 = 52, + 双杯芮斯崔朵 = 53, + 双杯意式玛奇朵 = 58, + 双杯奶油咖啡 = 54, + 热水 = 3, + 牛奶 = 7, + 奶沫 = 8, + 大壶咖啡 = 11, + 取消制作 = 200, + 放杯确认 = 201, + 清洗冲泡器 = 202, + 清洗奶沫器 = 203, + 清洗奶沫器确认 = 204, + 状态查询 = 205 } } diff --git a/BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs b/BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs index 5665fd69..35677fb7 100644 --- a/BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs +++ b/BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs @@ -63,7 +63,7 @@ namespace BPASmartClient.KLMCoffee.Protocal public RecipeModel() { - 饮品类型 = DrinkType.意式; + 饮品类型 = DrinkType.意式咖啡; 咖啡量 = 0; 咖啡温度 = TempEnum.低; 咖啡浓度 = CoffeeConcentration.清淡; @@ -125,22 +125,22 @@ namespace BPASmartClient.KLMCoffee.Protocal { switch (drink) { - case DrinkType.意式: + case DrinkType.意式咖啡: return GetItalian(60); break; - case DrinkType.美式: + case DrinkType.美式咖啡: return GetAmerican(60,450); break; case DrinkType.热水: return GetHotWater(194); break; - case DrinkType.卡布: + case DrinkType.卡布奇诺: return GetCabo(60,17); break; - case DrinkType.玛奇朵: + case DrinkType.玛琪雅朵: return GetMacChiato(60,8,17); break; - case DrinkType.拿铁: + case DrinkType.拿铁咖啡: return GetLatte(60,8,17); break; case DrinkType.热牛奶: @@ -166,7 +166,7 @@ namespace BPASmartClient.KLMCoffee.Protocal /// 15-240 public string GetItalian(int _咖啡量) { - 饮品类型 = DrinkType.意式; + 饮品类型 = DrinkType.意式咖啡; 咖啡量 = _咖啡量; 咖啡温度 = TempEnum.中; 咖啡浓度 = CoffeeConcentration.适中; @@ -187,7 +187,7 @@ namespace BPASmartClient.KLMCoffee.Protocal /// 25-450 public string GetAmerican(int _咖啡量,int _热水量) { - 饮品类型 = DrinkType.美式; + 饮品类型 = DrinkType.美式咖啡; 咖啡量 = _咖啡量; 咖啡温度 = TempEnum.中; 咖啡浓度 = CoffeeConcentration.适中; @@ -228,7 +228,7 @@ namespace BPASmartClient.KLMCoffee.Protocal /// 5-120 public string GetCabo(int _咖啡量,int _奶沫时间) { - 饮品类型 = DrinkType.卡布; + 饮品类型 = DrinkType.卡布奇诺; 咖啡量 = _咖啡量; 咖啡温度 = TempEnum.中; 咖啡浓度 = CoffeeConcentration.适中; @@ -250,7 +250,7 @@ namespace BPASmartClient.KLMCoffee.Protocal /// 5-120 public string GetMacChiato(int _咖啡量,int _牛奶时间,int _奶沫时间) { - 饮品类型 = DrinkType.玛奇朵; + 饮品类型 = DrinkType.玛琪雅朵; 咖啡量 = _咖啡量; 咖啡温度 = TempEnum.中; 咖啡浓度 = CoffeeConcentration.适中; @@ -272,7 +272,7 @@ namespace BPASmartClient.KLMCoffee.Protocal /// 5-120 public string GetLatte(int _咖啡量,int _牛奶时间,int _奶沫时间) { - 饮品类型 = DrinkType.拿铁; + 饮品类型 = DrinkType.拿铁咖啡; 咖啡量 = _咖啡量; 咖啡温度 = TempEnum.中; 咖啡浓度 = CoffeeConcentration.适中; diff --git a/BPASmartClient.Model/咖啡机/Enum/DrinkType.cs b/BPASmartClient.Model/咖啡机/Enum/DrinkType.cs index b8c5ce24..e65a0f30 100644 --- a/BPASmartClient.Model/咖啡机/Enum/DrinkType.cs +++ b/BPASmartClient.Model/咖啡机/Enum/DrinkType.cs @@ -11,13 +11,13 @@ namespace BPASmartClient.Model.咖啡机.Enum /// public enum DrinkType { - 意式, - 美式, - 热水, - 卡布, - 玛奇朵, - 拿铁, - 热牛奶, - 热奶沫 + 意式咖啡=0, + 美式咖啡=1, + 热水=2, + 卡布奇诺=3, + 玛琪雅朵=4, + 拿铁咖啡=5, + 热牛奶=6, + 热奶沫=7, } } diff --git a/BPASmartClient.Model/咖啡机/Enum/KLMDrinkFaultType.cs b/BPASmartClient.Model/咖啡机/Enum/KLMDrinkFaultType.cs new file mode 100644 index 00000000..ed8f4a6c --- /dev/null +++ b/BPASmartClient.Model/咖啡机/Enum/KLMDrinkFaultType.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.Model.咖啡机.Enum +{ + public enum KLMDrinkFaultType + { + 意式咖啡 = 1, + 美式咖啡 = 2, + 咖啡意式咖啡 = 9, + 卡布奇诺 = 4, + 玛琪雅朵 = 5, + 拿铁 = 6, + 白咖啡 = 14, + 芮斯崔朵 = 10, + 意式玛奇朵 = 13, + 奶油咖啡 = 12, + 双杯意式咖啡 = 51, + 双杯卡布奇诺 = 55, + 双杯拿铁 = 57, + 双杯玛琪雅朵 = 56, + 双杯白咖啡 = 59, + 双杯咖啡 = 52, + 双杯芮斯崔朵 = 53, + 双杯意式玛奇朵 = 58, + 双杯奶油咖啡 = 54, + 热水 = 3, + 牛奶 = 7, + 奶沫 = 8, + 大壶咖啡 = 11 + } + /*意式咖啡 = 1, + 美式咖啡 = 2, + 咖啡意式咖啡 = 9, + 卡布奇诺 = 4, + 玛琪雅朵 = 5, + 拿铁 = 6, + 白咖啡 = 14, + 芮斯崔朵 = 10, + 意式玛奇朵 = 13, + 奶油咖啡 = 12, + 双杯意式咖啡 = 51, + 双杯卡布奇诺 = 55, + 双杯拿铁 = 57, + 双杯玛琪雅朵 = 56, + 双杯白咖啡 = 59, + 双杯咖啡 = 52, + 双杯芮斯崔朵 = 53, + 双杯意式玛奇朵 = 58, + 双杯奶油咖啡 = 54, + 热水 = 3, + 牛奶 = 100, + 奶沫 = 101, + 大壶咖啡 = 11*/ +} diff --git a/BPASmartClient.Model/咖啡机/KLMCoffeeEvent.cs b/BPASmartClient.Model/咖啡机/KLMCoffeeEvent.cs index b2b05948..0998e752 100644 --- a/BPASmartClient.Model/咖啡机/KLMCoffeeEvent.cs +++ b/BPASmartClient.Model/咖啡机/KLMCoffeeEvent.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; - namespace BPASmartClient.Model { /// @@ -22,6 +21,7 @@ namespace BPASmartClient.Model /// 饮品类型 /// public DrinkType DrinkCode { get; set; } + public KLMDrinkFaultType KLMDrinkFaultCode { get; set; } } /// diff --git a/BPASmartClient.Model/订单/MorkTSimOrder.cs b/BPASmartClient.Model/订单/MorkTSimOrder.cs index f104dfd1..972f3d9b 100644 --- a/BPASmartClient.Model/订单/MorkTSimOrder.cs +++ b/BPASmartClient.Model/订单/MorkTSimOrder.cs @@ -11,6 +11,7 @@ namespace BPASmartClient.Model { public int OrderNum { get; set; } public DrCoffeeDrinksCode DrinkCode { get; set; } + public KLMDrinkFaultType KLMDrinkFaultCode { get; set; } public int JuiceList { get; set; } public string JuiceMakeID{ get; set; } } diff --git a/BPASmartClient.MorkF/Control_MorkF.cs b/BPASmartClient.MorkF/Control_MorkF.cs index 7f0aa20e..269d342c 100644 --- a/BPASmartClient.MorkF/Control_MorkF.cs +++ b/BPASmartClient.MorkF/Control_MorkF.cs @@ -845,7 +845,7 @@ namespace BPASmartClient.MorkF /// private void SingleProcess() { - + //主流程出餐完成,相应变量复位 if (morkF.MainOutMealComplete) @@ -1950,7 +1950,6 @@ namespace BPASmartClient.MorkF Task.Delay(5).Wait(); } } - } if (morkF.MinorProessStatus) { diff --git a/BPASmartClient.MorkS/Control_Morks.cs b/BPASmartClient.MorkS/Control_Morks.cs index 0a20b717..00c62d80 100644 --- a/BPASmartClient.MorkS/Control_Morks.cs +++ b/BPASmartClient.MorkS/Control_Morks.cs @@ -88,7 +88,6 @@ namespace BPASmartClient.MorkS if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value); }), "WriteBools"); ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice"); - } public override void ResetProgram() diff --git a/BPASmartClient.MorkTJuicer/BPASmartClient.MorkTJuicer.csproj b/BPASmartClient.MorkTJuicer/BPASmartClient.MorkTJuicer.csproj deleted file mode 100644 index 5ca62444..00000000 --- a/BPASmartClient.MorkTJuicer/BPASmartClient.MorkTJuicer.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - diff --git a/BPASmartClient.MorkTJuicer/Control_MORKJC.cs b/BPASmartClient.MorkTJuicer/Control_MORKJC.cs deleted file mode 100644 index e672cab0..00000000 --- a/BPASmartClient.MorkTJuicer/Control_MORKJC.cs +++ /dev/null @@ -1,317 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Linq; -using System.Threading; -using System.Collections.Concurrent; -using System.Diagnostics; -using System.Threading.Tasks; -using BPASmartClient.Device; -using BPA.Message.Enum; -using BPA.Message; -using BPASmartClient.Helper; -using BPASmartClient.Model.咖啡机.Enum; -using BPASmartClient.Model; -using BPASmartClient.EventBus; -using static BPASmartClient.EventBus.EventBus; -using BPASmartClient.Model.PLC; -using BPASmartClient.Model.单片机; - -namespace BPASmartClient.MorkTJuicer -{ - /* - * 冰淇淋咖啡机组合套装 - * 物料位置: - * 1:冰淇料 - * 2:冰淇淋杯 - * 5:咖啡 - * 6:咖啡杯 - * 9: 茶 - * 10: 茶杯 - */ - public class Control_MORKJC : BaseDevice - { - GVL_MORKJC mORKD = new GVL_MORKJC(); - //物料存放位置 - private Dictionary batchings = new Dictionary(); - //容器位置 - private string holderLoc; - //主料位置 - private string mainMaterialLoc; - //子订单ID - private string subOrderId; - - private bool enableFunny = false; - private DateTime lastRecvdOrder = DateTime.Now; - private bool working = false; - /// - /// 果汁机做法,true:热饮,false:冷饮 - /// - private bool GuMake = false; - - private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) - { - EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); - } - - //private SerialPortClient commProxy; - public void ConnectOk() - { - - } - ConcurrentQueue morkOrderPushes = new ConcurrentQueue(); - public void Init() - { - //构建所有商品物料信息 - batchings = PolymerBatching.BuildAll(); - Main(); - ReadData(); - ThreadManage.GetInstance().StartLong(new Action(() => - { - while (morkOrderPushes.Count > 0) - { - while (enableFunny) { Thread.Sleep(10); } - DeviceProcessLogShow("当前非自嗨模式,允许开工"); - working = true; - if (morkOrderPushes.TryDequeue(out MorkOrderPush order)) - { - DeviceProcessLogShow($"开始制作订单[{order.SortNum}]"); - //商品类型 - GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; - //子订单ID - subOrderId = order.SuborderId; - //遍历物料 - foreach (var item in order.GoodBatchings) - { - var res = Json.Data.orderMaterialDelivery.BatchingInfo.FirstOrDefault(p => p.BatchingId == item.BatchingId); - if (res != null) - { - //获取主料和容器位置 - switch (batchings[res.BatchingLoc].BatchingClass) - { - case BATCHING_CLASS.HOLDER: - holderLoc = res.BatchingLoc; - break; - case BATCHING_CLASS.MAIN_MATERIAL: - // mainMaterialLoc ="1"; - mainMaterialLoc = res.BatchingLoc; - //验证商品是咖啡还是冰淇淋 - if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER) - { - //获取当前物料所属商品类型 - currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); - } - break; - } - } - } - //根据商品类型执行具体制作流程 - switch (currentGoodsType) - { - case GOODS_TYPE.JUICE: - GuMake = order.MakeID == "2"; - DoJuicer(); - break; - case GOODS_TYPE.NEITHER: - DeviceProcessLogShow("未知的商品类型"); - break; - } - } - working = false; - lastRecvdOrder = DateTime.Now; - } - Thread.Sleep(1000); - }), "订单制作"); - } - - public void Main() - { - //开始心跳刷新,根据咖啡机及冰淇淋机来判断 - //ThreadManage.GetInstance().StartLong(new Action(() => - //{ - // Thread.Sleep(100); - //}), "MORK-IC心跳刷新"); - } - - public void DataParse(T order) - { - if (order is MorkOrderPush morkOrderPush) - { - morkOrderPushes.Enqueue(morkOrderPush); - } - } - - /// - /// - /// - /// 物料位置 - private GOODS_TYPE ValidateGoodsByBatching(string batchingLoc) - { - if (batchings.ContainsKey(batchingLoc)) - return batchings[batchingLoc].GoodsType; - return GOODS_TYPE.NEITHER; - } - - private AutoResetEvent are = new AutoResetEvent(false); - - private T GetStatus(string key) - { - if (peripheralStatus.ContainsKey(key)) - { - if (peripheralStatus[key] != null) - { - return (T)(peripheralStatus[key]); - } - } - return default; - } - - private void Wait(int value) - { - while (!((GetStatus("Get_RobotAO1") == value) && GetStatus("GetProgramStatus") == 0))//判断文件是否已经执行结束 且 文件末端变量值==文件名 - { - Thread.Sleep(5); - } - } - int[] devStatusBy = new int[2] { 0, 0 }; - /// - /// 果汁机控制信号 - /// - private byte JuicerNum; - /// - /// 做果汁 - /// - private void DoJuicer() - { - #region 接果汁流程 - OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); - try - { - int JuicerNum1 = int.Parse(mainMaterialLoc); - switch (JuicerNum1) - { - case 52: - if (GuMake) - { - JuicerNum = 0x00; - } - else - { - JuicerNum = 0x01; - } - break; - case 53: - if (GuMake) - { - JuicerNum = 0x02; - } - else - { - JuicerNum = 0x03; - } - break; - case 54: - if (GuMake) - { - JuicerNum = 0x04; - } - else - { - JuicerNum = 0x05; - } - break; - case 55: - if (GuMake) - { - JuicerNum = 0x06; - } - else - { - JuicerNum = 0x07; - } - break; - default: - JuicerNum = 0x00; - break; - } - var devStatus = GetStatus("GetDeviceStatus"); - var devStatus1 = Convert.ToString(devStatus[0], 2); - var devStatus2 = devStatus[1]; - - if (devStatus1.IndexOf("0") == 1 && devStatus2 == 0) - { - new WriteJuicer() { Value = JuicerNum }.Publish(); - - Thread.Sleep(100); - devStatusBy = GetStatus("GetDeviceStatus"); - while (!(devStatusBy[1] == 0)) - { - Thread.Sleep(100); - devStatusBy = GetStatus("GetDeviceStatus"); - while (devStatusBy.Length != 2) - { - Thread.Sleep(100); - devStatusBy = GetStatus("GetDeviceStatus"); - } - } - devStatusBy = GetStatus("GetDeviceStatus"); - Thread.Sleep(5000); - OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); - } - } - catch (Exception ex) - { - DeviceProcessLogShow("获取果汁机状态失败"); - } - #endregion - } - - public override DeviceClientType DeviceType => throw new NotImplementedException(); - - - private T McuRead(string tagName, object par) - { - new ReadMcu() { DeviceId = DeviceId, TagName = tagName, ReadPar = par }; - if (peripheralStatus.ContainsKey(tagName)) - { - if (peripheralStatus[tagName] != null) - { - return (T)peripheralStatus[tagName]; - } - } - return default; - } - - public void SimOrder(T simOrder) - { - - } - public override void DoMain() - { - - } - - public override void Stop() - { - - } - - public override void ReadData() - { - - } - - public override void MainTask() - { - - } - - public override void ResetProgram() - { - - } - public override void SimOrder() - { - } - } -} diff --git a/BPASmartClient.MorkTJuicer/GVL_MORKJC.cs b/BPASmartClient.MorkTJuicer/GVL_MORKJC.cs deleted file mode 100644 index 34ab7669..00000000 --- a/BPASmartClient.MorkTJuicer/GVL_MORKJC.cs +++ /dev/null @@ -1,8 +0,0 @@ -using BPASmartClient.Device; - -namespace BPASmartClient.MorkTJuicer -{ - public class GVL_MORKJC : IStatus - { - } -} diff --git a/BPASmartClient.MorkTM/Alarm.cs b/BPASmartClient.MorkTM/Alarm.cs deleted file mode 100644 index 6fc83b1c..00000000 --- a/BPASmartClient.MorkTM/Alarm.cs +++ /dev/null @@ -1,15 +0,0 @@ -using BPASmartClient.Device; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MorkTM -{ - public class Alarm: IAlarm - { - [Alarm("报警")] - public string Name { get; set; } - } -} diff --git a/BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj b/BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj deleted file mode 100644 index 0115625e..00000000 --- a/BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj +++ /dev/null @@ -1,48 +0,0 @@ - - - - net6.0-windows - enable - enable - true - Library - False - - - - - - - - - - True - True - Resources.resx - - - True - True - Settings.settings - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - diff --git a/BPASmartClient.MorkTM/Control_MorkTM.cs b/BPASmartClient.MorkTM/Control_MorkTM.cs deleted file mode 100644 index 30dfb988..00000000 --- a/BPASmartClient.MorkTM/Control_MorkTM.cs +++ /dev/null @@ -1,169 +0,0 @@ -using BPA.Message; -using BPA.Message.Enum; -using BPASmartClient.Device; -using BPASmartClient.EventBus; -using BPASmartClient.Helper; -using BPASmartClient.Message; -using BPASmartClient.Model; -using BPASmartClient.Model.PLC; -using BPASmartClient.MorkTM.Model; -using System.Collections.Concurrent; -using static BPASmartClient.EventBus.EventBus; - -namespace BPASmartClient.MorkTM -{ - public class Control_MorkTM : BaseDevice - { - public override DeviceClientType DeviceType => throw new NotImplementedException(); - - GVL_MorkTM morkTM = new GVL_MorkTM(); - public override void DoMain() - { - ServerInit(); - DataParse(); - - 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"); - - DeviceProcessLogShow("设备初始化完成"); - - } - private void ServerInit() - { - //物料信息 - EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) - { - if (@event == null) return; - if (@event is MaterialDeliveryEvent material) - { - orderMaterialDelivery = material.orderMaterialDelivery; - } - }); - - //配方数据信息 - EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) - { - if (@event == null) return; - if (@event is RecipeBomEvent recipe) - { - recipeBoms = recipe.recipeBoms; - } - }); - } - private void DataParse() - { - EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) - { - if(@event == null) return; - if(@event is DoOrderEvent order) - { - if (order.MorkOrder.GoodBatchings == null) return; - OrderCount++; - OrderChange(order.MorkOrder, ORDER_STATUS.WAIT); - DeviceProcessLogShow($"接收到{OrderCount}次订单"); - Dictionary OrderPushes = new Dictionary(); - foreach (var item in order.MorkOrder.GoodBatchings) - { - var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); - if (res != null) - { - OrderPushes.TryAdd(res.BatchingLoc, item.BatchingCount); - } - } - - morkTM.morkOrderPushesTeaWithMilk.Enqueue(new OrderLocInfo() - { - GoodName = order.MorkOrder.GoodsName, - SuborderId = order.MorkOrder.SuborderId, - GoodPushes = OrderPushes - }); - } - }); - } - private void OrderChange(MorkOrderPush orderPush, ORDER_STATUS oRDER_STATUS) - { - EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() - { - SortNum = orderPush.SortNum.ToString(), - GoodName = orderPush.GoodsName, - Status = oRDER_STATUS, - SubOrderId = orderPush.SuborderId, - deviceClientType = DeviceType - }); - } - - - public override void MainTask() - { - IsHealth = true; - MakeTeaWithMilkProcess(); - } - - private void MakeTeaWithMilkProcess() - { - if(morkTM.morkOrderPushesTeaWithMilk.Count > 0) - { - if(morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc)) - { - morkTM.RecipesPushes.Clear(); - morkTM.RecipesPushes = orderLoc.GoodPushes; - foreach(var item in morkTM.RecipesPushes) - { - WriteData(item.Key,item.Value); - while (!RTrig.GetInstance("OutMaterialComplete").Start(morkTM.OutMaterialComplete)) - { - Thread.Sleep(100); - } - DeviceProcessLogShow($"奶茶{orderLoc.GoodName}:配料{item.Key}:添加量{item.Value}"); - } - } - } - } - - - - public override void ReadData() - { - throw new NotImplementedException(); - } - - public override void ResetProgram() - { - morkTM = null; - morkTM = new GVL_MorkTM(); - } - - private void WriteData(string address, object value) - { - EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value }); - } - - private void GetStatus(string key, Action action) - { - if (peripheralStatus.ContainsKey(key)) - { - if (peripheralStatus[key] != null) - { - action?.Invoke(peripheralStatus[key]); - } - } - } - - public override void SimOrder() - { - throw new NotImplementedException(); - } - - public override void Stop() - { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/BPASmartClient.MorkTM/GVL_MorkTM.cs b/BPASmartClient.MorkTM/GVL_MorkTM.cs deleted file mode 100644 index 77df5d56..00000000 --- a/BPASmartClient.MorkTM/GVL_MorkTM.cs +++ /dev/null @@ -1,33 +0,0 @@ -using BPA.Models; -using BPASmartClient.Device; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MorkTM -{ - public class GVL_MorkTM: IStatus - { - /// - /// 奶茶订单队列 - /// - public ConcurrentQueue morkOrderPushesTeaWithMilk = new ConcurrentQueue(); - /// - /// 当前正在制作的奶茶订单 - /// - public OrderLocInfo CurrentOrderLoc = new OrderLocInfo(); - /// - /// 奶茶配料的队列 - /// - public Dictionary RecipesPushes = new Dictionary(); - /// - /// - /// - [VariableMonitor("出料完成", "", "")] - public bool OutMaterialComplete { get; set; } - - } -} diff --git a/BPASmartClient.MorkTM/Model/Alarms.cs b/BPASmartClient.MorkTM/Model/Alarms.cs deleted file mode 100644 index 9456f648..00000000 --- a/BPASmartClient.MorkTM/Model/Alarms.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.Toolkit.Mvvm.ComponentModel; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MorkTM.Model -{ - public class Alarms : ObservableObject - { - private string _id; - public string ID { get { return _id; } set { _id = value; OnPropertyChanged(); } } - - private string _varName; - public string VarName { get { return _varName; } set { _varName = value; OnPropertyChanged(); } } - - private string _plcAddress; - public string PLCAddress { get { return _plcAddress; } set { _plcAddress = value; OnPropertyChanged(); } } - - private string _modbusTCP; - public string ModbusTCP { get { return _modbusTCP; } set { _modbusTCP = value; OnPropertyChanged(); } } - - private string _value; - public string Value { get { return _value; } set { _value = value; OnPropertyChanged(); } } - - private string _notes; - public string Notes { get { return _notes; } set { _notes = value; OnPropertyChanged(); } } - } -} diff --git a/BPASmartClient.MorkTM/Model/WritePar.cs b/BPASmartClient.MorkTM/Model/WritePar.cs deleted file mode 100644 index c05e762c..00000000 --- a/BPASmartClient.MorkTM/Model/WritePar.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MorkTM.Model -{ - public class WritePar - { - public string Address { get; set; } - public object Value { get; set; } - } -} diff --git a/BPASmartClient.MorkTM/PolymerBatching.cs b/BPASmartClient.MorkTM/PolymerBatching.cs deleted file mode 100644 index cf6d36f6..00000000 --- a/BPASmartClient.MorkTM/PolymerBatching.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MorkTM -{ - public enum Material - { - Material_Top_1, Material_Top_2, Material_Top_3, Material_Top_4, Material_Top_5, Material_Top_6, - Material_Mid_1, Material_Mid_2, Material_Mid_3, Material_Mid_4, Material_Mid_5, Material_Mid_6, Material_Mid_7, Material_Mid_8, Material_Mid_9, Material_Mid_10, - Marerial_Bottom_1, Marerial_Bottom_2, Marerial_Bottom_3, Marerial_Top_4,Marerial_Bottom_5, Marerial_Bottom_6 - } - public enum TeaStorageBox - { - TeaStorageBox_1, TeaStorageBox_2, TeaStorageBox_3, TeaStorageBox_4, TeaStorageBox_5, TeaStorageBox_6 - } - - public class PolymerBatching - { - - } -} diff --git a/BPASmartClient.MorkTM/Properties/AssemblyInfo.cs b/BPASmartClient.MorkTM/Properties/AssemblyInfo.cs deleted file mode 100644 index e59a713c..00000000 --- a/BPASmartClient.MorkTM/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Runtime.InteropServices; - -[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] - -// 在此类的 SDK 样式项目中,现在,在此文件中早前定义的几个程序集属性将在生成期间自动添加,并使用在项目属性中定义的值进行填充。有关包含的属性以及如何定制此过程的详细信息,请参阅 -// https://aka.ms/assembly-info-properties - - -// 将 ComVisible 设置为 false 会使此程序集中的类型对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,请将该类型的 ComVisible -// 属性设置为 true。 - -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID。 - -[assembly: Guid("a100db3c-23af-4bd5-991e-224a062d4f2d")] diff --git a/BPASmartClient.MorkTM/Properties/Resources.Designer.cs b/BPASmartClient.MorkTM/Properties/Resources.Designer.cs deleted file mode 100644 index 1631f5d2..00000000 --- a/BPASmartClient.MorkTM/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -namespace BPASmartClient.MorkTM.Properties { - using System; - - - /// - /// 一个强类型的资源类,用于查找本地化的字符串等。 - /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// 返回此类使用的缓存的 ResourceManager 实例。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BPASmartClient.MorkTM.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// 重写当前线程的 CurrentUICulture 属性,对 - /// 使用此强类型资源类的所有资源查找执行重写。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/BPASmartClient.MorkTM/Properties/Resources.resx b/BPASmartClient.MorkTM/Properties/Resources.resx deleted file mode 100644 index 4fdb1b6a..00000000 --- a/BPASmartClient.MorkTM/Properties/Resources.resx +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/BPASmartClient.MorkTM/Properties/Settings.Designer.cs b/BPASmartClient.MorkTM/Properties/Settings.Designer.cs deleted file mode 100644 index 0275f2c3..00000000 --- a/BPASmartClient.MorkTM/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -namespace BPASmartClient.MorkTM.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/BPASmartClient.MorkTM/Properties/Settings.settings b/BPASmartClient.MorkTM/Properties/Settings.settings deleted file mode 100644 index 049245f4..00000000 --- a/BPASmartClient.MorkTM/Properties/Settings.settings +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/BPASmartClient.MorkTM/View/Debug.xaml b/BPASmartClient.MorkTM/View/Debug.xaml deleted file mode 100644 index 2427db65..00000000 --- a/BPASmartClient.MorkTM/View/Debug.xaml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -