From c4738d5ecf7abd1800bb2fcc3d583ad079109332 Mon Sep 17 00:00:00 2001 From: fyf <11621@LAPTOP-04QQU0AO> Date: Wed, 20 Apr 2022 09:52:56 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=B0=83=E6=95=B4=E5=91=BD=E4=BB=A4=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E6=9E=9A=E4=B8=BE=E5=88=B0Model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.DRCoffee/CoffeeMachine.cs | 5 +++-- BPASmartClient.DRCoffee/Protocal/DrCoffeePackage.cs | 3 ++- BPASmartClient.GSIceCream/IceCreamMachine.cs | 5 +++-- BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_DW.cs | 3 ++- BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs | 3 ++- BPASmartClient.GSIceCream/Protocal/ICMSG_MODE_DW.cs | 3 ++- BPASmartClient.GSIceCream/Protocal/ICMSG_MODE_UP.cs | 3 ++- BPASmartClient.Model/BPASmartClient.Model.csproj | 2 +- .../冰淇淋/Enum}/MORKI_MODE.cs | 2 +- BPASmartClient.Model/冰淇淋/GSIceCreamEvent.cs | 5 +++-- .../单片机/Enum}/IC_CUP.cs | 2 +- .../单片机/Enum}/IC_SE.cs | 2 +- BPASmartClient.Model/单片机/SCChipEvent.cs | 9 +++++---- BPASmartClient.Model/咖啡机/DRCoffeeEvent.cs | 7 ++++--- .../咖啡机/Enum}/DrCoffeeCommCmd.cs | 4 ++-- .../咖啡机/Enum}/DrCoffeeDrinksCode.cs | 4 ++-- BPASmartClient.SCChip/ICChipMachine.cs | 5 +++-- BPASmartClient/MainWindow.xaml.cs | 6 ++++-- 18 files changed, 43 insertions(+), 30 deletions(-) rename {BPASmartClient.GSIceCream/Protocal => BPASmartClient.Model/冰淇淋/Enum}/MORKI_MODE.cs (95%) rename {BPASmartClient.SCChip/Protocal => BPASmartClient.Model/单片机/Enum}/IC_CUP.cs (89%) rename {BPASmartClient.SCChip/Protocal => BPASmartClient.Model/单片机/Enum}/IC_SE.cs (91%) rename {BPASmartClient.DRCoffee/Protocal => BPASmartClient.Model/咖啡机/Enum}/DrCoffeeCommCmd.cs (93%) rename {BPASmartClient.DRCoffee/Protocal => BPASmartClient.Model/咖啡机/Enum}/DrCoffeeDrinksCode.cs (91%) diff --git a/BPASmartClient.DRCoffee/CoffeeMachine.cs b/BPASmartClient.DRCoffee/CoffeeMachine.cs index 9d07749d..db8e06cc 100644 --- a/BPASmartClient.DRCoffee/CoffeeMachine.cs +++ b/BPASmartClient.DRCoffee/CoffeeMachine.cs @@ -3,6 +3,7 @@ using BPASmartClient.EventBus; using BPASmartClient.Helper; using BPASmartClient.Message; using BPASmartClient.Model; +using BPASmartClient.Model.咖啡机.Enum; using BPASmartClient.Peripheral; using BPASmartClient.SerialPort; using System; @@ -180,7 +181,7 @@ namespace BPASmartClient.DRCoffee free = true; Thread.Sleep(200); drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令; - drinksOrder.DrinksCode = (DrCoffeeDrinksCode)((DRCoffee_MakeCoffeeEvent)@event).DrinkCode; + drinksOrder.DrinksCode = ((DRCoffee_MakeCoffeeEvent)@event).DrinkCode; commProxy.SendData(DrCoffee.Packe(drinksOrder)); Thread.Sleep(200); free = false; @@ -217,7 +218,7 @@ namespace BPASmartClient.DRCoffee { free = true; Thread.Sleep(200); - drinksOrder.CommCmd = (DrCoffeeCommCmd)((DRCoffee_CoffeeCommCmdEvent)@event).CommCmd; + drinksOrder.CommCmd = ((DRCoffee_CoffeeCommCmdEvent)@event).CommCmd; commProxy.SendData(DrCoffee.Packe(drinksOrder)); Thread.Sleep(200); free = false; diff --git a/BPASmartClient.DRCoffee/Protocal/DrCoffeePackage.cs b/BPASmartClient.DRCoffee/Protocal/DrCoffeePackage.cs index f1aafa02..563affe6 100644 --- a/BPASmartClient.DRCoffee/Protocal/DrCoffeePackage.cs +++ b/BPASmartClient.DRCoffee/Protocal/DrCoffeePackage.cs @@ -1,4 +1,5 @@ -using System; +using BPASmartClient.Model.咖啡机.Enum; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; diff --git a/BPASmartClient.GSIceCream/IceCreamMachine.cs b/BPASmartClient.GSIceCream/IceCreamMachine.cs index 85e80e0a..79a66028 100644 --- a/BPASmartClient.GSIceCream/IceCreamMachine.cs +++ b/BPASmartClient.GSIceCream/IceCreamMachine.cs @@ -2,6 +2,7 @@ using BPASmartClient.Helper; using BPASmartClient.Message; using BPASmartClient.Model; +using BPASmartClient.Model.冰淇淋.Enum; using BPASmartClient.Peripheral; using BPASmartClient.SerialPort; using System; @@ -252,11 +253,11 @@ namespace BPASmartClient.GSIceCream { free = true; Thread.Sleep(200); - var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build((MORKI_MODE)((GSIceCream_ModeSetEvent)@event).Mode)); + var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build(((GSIceCream_ModeSetEvent)@event).Mode)); commProxy.SendData(data); Thread.Sleep(200); free = false; - MessageLog.GetInstance.Show(string.Format("设置模式[{0}]",Enum.GetName(typeof(MORKI_MODE),(MORKI_MODE)((GSIceCream_ModeSetEvent)@event).Mode))); + MessageLog.GetInstance.Show(string.Format("设置模式[{0}]",Enum.GetName(typeof(MORKI_MODE),((GSIceCream_ModeSetEvent)@event).Mode))); } catch (Exception ex) { diff --git a/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_DW.cs b/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_DW.cs index e3bb0f30..a7973bb6 100644 --- a/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_DW.cs +++ b/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_DW.cs @@ -1,4 +1,5 @@ -using System; +using BPASmartClient.Model.冰淇淋.Enum; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; diff --git a/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs b/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs index 90a127fb..a2daf77e 100644 --- a/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs +++ b/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs @@ -1,4 +1,5 @@ -using System; +using BPASmartClient.Model.冰淇淋.Enum; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; diff --git a/BPASmartClient.GSIceCream/Protocal/ICMSG_MODE_DW.cs b/BPASmartClient.GSIceCream/Protocal/ICMSG_MODE_DW.cs index eb0fb4a4..fd34abfb 100644 --- a/BPASmartClient.GSIceCream/Protocal/ICMSG_MODE_DW.cs +++ b/BPASmartClient.GSIceCream/Protocal/ICMSG_MODE_DW.cs @@ -1,4 +1,5 @@ -using System; +using BPASmartClient.Model.冰淇淋.Enum; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; diff --git a/BPASmartClient.GSIceCream/Protocal/ICMSG_MODE_UP.cs b/BPASmartClient.GSIceCream/Protocal/ICMSG_MODE_UP.cs index 3f16a278..2a19b575 100644 --- a/BPASmartClient.GSIceCream/Protocal/ICMSG_MODE_UP.cs +++ b/BPASmartClient.GSIceCream/Protocal/ICMSG_MODE_UP.cs @@ -1,4 +1,5 @@ -using System.Runtime.InteropServices; +using BPASmartClient.Model.冰淇淋.Enum; +using System.Runtime.InteropServices; using static BPASmartClient.GSIceCream.MessageDefine; namespace BPASmartClient.GSIceCream diff --git a/BPASmartClient.Model/BPASmartClient.Model.csproj b/BPASmartClient.Model/BPASmartClient.Model.csproj index 4de56856..df1a01f9 100644 --- a/BPASmartClient.Model/BPASmartClient.Model.csproj +++ b/BPASmartClient.Model/BPASmartClient.Model.csproj @@ -11,7 +11,7 @@ - + diff --git a/BPASmartClient.GSIceCream/Protocal/MORKI_MODE.cs b/BPASmartClient.Model/冰淇淋/Enum/MORKI_MODE.cs similarity index 95% rename from BPASmartClient.GSIceCream/Protocal/MORKI_MODE.cs rename to BPASmartClient.Model/冰淇淋/Enum/MORKI_MODE.cs index 85e40580..772556d8 100644 --- a/BPASmartClient.GSIceCream/Protocal/MORKI_MODE.cs +++ b/BPASmartClient.Model/冰淇淋/Enum/MORKI_MODE.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPASmartClient.GSIceCream +namespace BPASmartClient.Model.冰淇淋.Enum { /* * 模式 参数 diff --git a/BPASmartClient.Model/冰淇淋/GSIceCreamEvent.cs b/BPASmartClient.Model/冰淇淋/GSIceCreamEvent.cs index a4b413e9..ea9d0468 100644 --- a/BPASmartClient.Model/冰淇淋/GSIceCreamEvent.cs +++ b/BPASmartClient.Model/冰淇淋/GSIceCreamEvent.cs @@ -1,4 +1,5 @@ -using System; +using BPASmartClient.Model.冰淇淋.Enum; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -17,7 +18,7 @@ namespace BPASmartClient.Model /// public class GSIceCream_ModeSetEvent :BaseEvent { - public byte Mode { get; set; } + public MORKI_MODE Mode { get; set; } } /// diff --git a/BPASmartClient.SCChip/Protocal/IC_CUP.cs b/BPASmartClient.Model/单片机/Enum/IC_CUP.cs similarity index 89% rename from BPASmartClient.SCChip/Protocal/IC_CUP.cs rename to BPASmartClient.Model/单片机/Enum/IC_CUP.cs index a85f0e58..695bb5e2 100644 --- a/BPASmartClient.SCChip/Protocal/IC_CUP.cs +++ b/BPASmartClient.Model/单片机/Enum/IC_CUP.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPASmartClient.SCChip +namespace BPASmartClient.Model.单片机.Enum { /// /// 杯子 diff --git a/BPASmartClient.SCChip/Protocal/IC_SE.cs b/BPASmartClient.Model/单片机/Enum/IC_SE.cs similarity index 91% rename from BPASmartClient.SCChip/Protocal/IC_SE.cs rename to BPASmartClient.Model/单片机/Enum/IC_SE.cs index 5d3e073a..a22bcb59 100644 --- a/BPASmartClient.SCChip/Protocal/IC_SE.cs +++ b/BPASmartClient.Model/单片机/Enum/IC_SE.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPASmartClient.SCChip +namespace BPASmartClient.Model.单片机.Enum { /// /// 冰淇淋舵机 diff --git a/BPASmartClient.Model/单片机/SCChipEvent.cs b/BPASmartClient.Model/单片机/SCChipEvent.cs index 44c618e5..a7e6f201 100644 --- a/BPASmartClient.Model/单片机/SCChipEvent.cs +++ b/BPASmartClient.Model/单片机/SCChipEvent.cs @@ -1,4 +1,5 @@ -using System; +using BPASmartClient.Model.单片机.Enum; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -20,7 +21,7 @@ namespace BPASmartClient.Model.单片机 /// /// 杯 /// - public byte Cup { get; set; } + public IC_CUP Cup { get; set; } } /// @@ -28,7 +29,7 @@ namespace BPASmartClient.Model.单片机 /// public class SCChip_MakeIceCreamEvent :BaseEvent { - public byte SteeringEngine { get; set; } + public IC_SE SteeringEngine { get; set; } } /// @@ -36,7 +37,7 @@ namespace BPASmartClient.Model.单片机 /// public class SCChip_SESwitchCreamEvent :BaseEvent { - public byte SteeringEngine { get; set; } + public IC_SE SteeringEngine { get; set; } public bool IsOpen { get; set; } } diff --git a/BPASmartClient.Model/咖啡机/DRCoffeeEvent.cs b/BPASmartClient.Model/咖啡机/DRCoffeeEvent.cs index d0ddac8d..3df8ead2 100644 --- a/BPASmartClient.Model/咖啡机/DRCoffeeEvent.cs +++ b/BPASmartClient.Model/咖啡机/DRCoffeeEvent.cs @@ -1,4 +1,5 @@ -using System; +using BPASmartClient.Model.咖啡机.Enum; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -17,7 +18,7 @@ namespace BPASmartClient.Model /// public class DRCoffee_MakeCoffeeEvent :BaseEvent { - public byte DrinkCode { get; set; } + public DrCoffeeDrinksCode DrinkCode { get; set; } } /// @@ -33,7 +34,7 @@ namespace BPASmartClient.Model /// public class DRCoffee_CoffeeCommCmdEvent :BaseEvent { - public byte CommCmd { get; set; } + public DrCoffeeCommCmd CommCmd { get; set; } } /// diff --git a/BPASmartClient.DRCoffee/Protocal/DrCoffeeCommCmd.cs b/BPASmartClient.Model/咖啡机/Enum/DrCoffeeCommCmd.cs similarity index 93% rename from BPASmartClient.DRCoffee/Protocal/DrCoffeeCommCmd.cs rename to BPASmartClient.Model/咖啡机/Enum/DrCoffeeCommCmd.cs index d58adee2..bed221c0 100644 --- a/BPASmartClient.DRCoffee/Protocal/DrCoffeeCommCmd.cs +++ b/BPASmartClient.Model/咖啡机/Enum/DrCoffeeCommCmd.cs @@ -4,12 +4,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPASmartClient.DRCoffee +namespace BPASmartClient.Model.咖啡机.Enum { /// /// 通信指令 /// - public enum DrCoffeeCommCmd : byte + public enum DrCoffeeCommCmd :byte { 无指令 = 0x00, 饮品制作指令 = 0x01, diff --git a/BPASmartClient.DRCoffee/Protocal/DrCoffeeDrinksCode.cs b/BPASmartClient.Model/咖啡机/Enum/DrCoffeeDrinksCode.cs similarity index 91% rename from BPASmartClient.DRCoffee/Protocal/DrCoffeeDrinksCode.cs rename to BPASmartClient.Model/咖啡机/Enum/DrCoffeeDrinksCode.cs index fb7d67e7..a86926bc 100644 --- a/BPASmartClient.DRCoffee/Protocal/DrCoffeeDrinksCode.cs +++ b/BPASmartClient.Model/咖啡机/Enum/DrCoffeeDrinksCode.cs @@ -4,12 +4,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPASmartClient.DRCoffee +namespace BPASmartClient.Model.咖啡机.Enum { /// /// 饮品编号 /// - public enum DrCoffeeDrinksCode : byte + public enum DrCoffeeDrinksCode :byte { 意式浓缩 = 1, 美式咖啡 = 2, diff --git a/BPASmartClient.SCChip/ICChipMachine.cs b/BPASmartClient.SCChip/ICChipMachine.cs index 130436df..4ef0958e 100644 --- a/BPASmartClient.SCChip/ICChipMachine.cs +++ b/BPASmartClient.SCChip/ICChipMachine.cs @@ -3,6 +3,7 @@ using BPASmartClient.Helper; using BPASmartClient.Message; using BPASmartClient.Model; using BPASmartClient.Model.单片机; +using BPASmartClient.Model.单片机.Enum; using BPASmartClient.Peripheral; using BPASmartClient.SerialPort; using System; @@ -231,7 +232,7 @@ namespace BPASmartClient.SCChip { try { - switch ((IC_CUP)(@event as SCChip_TakeCupEvent).Cup) + switch ((@event as SCChip_TakeCupEvent).Cup) { case IC_CUP.CUP_ICECREAM: status["CompletedTake_CPU_CUP_ICECREAM"] = false; @@ -251,7 +252,7 @@ namespace BPASmartClient.SCChip wait = DateTime.Now < waitTimeout; if (wait) { - switch ((IC_CUP)(@event as SCChip_TakeCupEvent).Cup) + switch ((@event as SCChip_TakeCupEvent).Cup) { case IC_CUP.CUP_ICECREAM: wait = !(bool)status["CompletedTake_CPU_CUP_ICECREAM"]; diff --git a/BPASmartClient/MainWindow.xaml.cs b/BPASmartClient/MainWindow.xaml.cs index 39082190..e518fb42 100644 --- a/BPASmartClient/MainWindow.xaml.cs +++ b/BPASmartClient/MainWindow.xaml.cs @@ -1,6 +1,8 @@ using BPASmartClient.Business; using BPASmartClient.EventBus; using BPASmartClient.Model; +using BPASmartClient.Model.冰淇淋.Enum; +using BPASmartClient.Model.咖啡机.Enum; using System; using System.Collections.Generic; using System.Linq; @@ -32,8 +34,8 @@ namespace BPASmartClient private void Button_Click(object sender, RoutedEventArgs e) { new Demo_MakeCoffeeEvent() { Id = "1" }.Publish(); - new DRCoffee_MakeCoffeeEvent() { Id = "1", DrinkCode=120 }.Publish(); - new DRCoffee_CoffeeCommCmdEvent() { Id = "1",CommCmd = 0x01 }.Publish(); + new DRCoffee_MakeCoffeeEvent() { Id = "1", DrinkCode= DrCoffeeDrinksCode.两杯意式浓缩 }.Publish(); + new DRCoffee_CoffeeCommCmdEvent() { Id = "1",CommCmd = DrCoffeeCommCmd.冲煮系统快速冲洗指令}.Publish(); } }