From 74956ce551e67036ae1f80c72a8e57878d471aeb Mon Sep 17 00:00:00 2001 From: fyf Date: Wed, 11 May 2022 17:29:15 +0800 Subject: [PATCH 1/2] 44 --- BPASmartClient.DRCoffee/CoffeeMachine.cs | 12 ++++++------ BPASmartClient.Device/DeviceStatus.cs | 13 +++++++++---- BPASmartClient.KLMCoffee/CoffeeMachine.cs | 16 ++++++++-------- .../Protocal/FaultMessage.cs | 13 +++++++++++++ .../Protocal/UpkeepMessage.cs | 13 +++++++++++++ 5 files changed, 49 insertions(+), 18 deletions(-) diff --git a/BPASmartClient.DRCoffee/CoffeeMachine.cs b/BPASmartClient.DRCoffee/CoffeeMachine.cs index 0b5161d0..ea60763b 100644 --- a/BPASmartClient.DRCoffee/CoffeeMachine.cs +++ b/BPASmartClient.DRCoffee/CoffeeMachine.cs @@ -137,19 +137,19 @@ namespace BPASmartClient.DRCoffee /// public void ProcessPackage(DrCoffeePackage package) { - if (((DrCoffeeStatus)status["CoffeeStatus"]) == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running) + if (((DrCoffeeStatus)status["Status"]) == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running) { - status["CoffeeStatus"] = package.Status; + status["Status"] = package.Status; lastRefreshTime = DateTime.Now; new DRCoffee_CoffeEndCookEvent() { Id = DeviceId }.Publish(); } - else status["CoffeeStatus"] = package.Status; + else status["Status"] = package.Status; status["AppStatus"] = package.ApplicationStatus; status["Warning"] = package.Warning; status["Fault"] = package.Fault; - if ((DrCoffeeStatus)status["CoffeeStatus"] == DrCoffeeStatus.Warning - || (DrCoffeeStatus)status["CoffeeStatus"] == DrCoffeeStatus.Fault + if ((DrCoffeeStatus)status["Status"] == DrCoffeeStatus.Warning + || (DrCoffeeStatus)status["Status"] == DrCoffeeStatus.Fault || (DrCoffeeWarning)status["Warning"] != DrCoffeeWarning.无警告 || (DrCoffeeFault)status["Fault"] != DrCoffeeFault.无故障 ) @@ -162,7 +162,7 @@ namespace BPASmartClient.DRCoffee protected override void InitStatus() { - status["CoffeeStatus"] = DrCoffeeStatus.Wait; + status["Status"] = DrCoffeeStatus.Wait; status["AppStatus"] = DrCoffeeAppStatus.应用无状态; status["Warning"] = DrCoffeeWarning.无警告; status["Fault"] = DrCoffeeFault.无故障; diff --git a/BPASmartClient.Device/DeviceStatus.cs b/BPASmartClient.Device/DeviceStatus.cs index 252319e5..d7743dff 100644 --- a/BPASmartClient.Device/DeviceStatus.cs +++ b/BPASmartClient.Device/DeviceStatus.cs @@ -31,10 +31,15 @@ namespace BPASmartClient.Device {"False","异常" }, {"True","正常" }, - {"CoffeeStatus","咖啡机状态" }, - {"AppStatus","咖啡机应用状态" }, - {"Warning","咖啡机告警" }, - {"Fault","咖啡机故障" } + {"Status","状态" }, + {"AppStatus","应用状态" }, + {"Warning","告警" }, + {"Fault","故障" }, + {"drinkType","饮品类型" }, + {"taskIndex","任务序号" }, + {"Keep","维修保护" }, + {"progress","工作进度" } + }; diff --git a/BPASmartClient.KLMCoffee/CoffeeMachine.cs b/BPASmartClient.KLMCoffee/CoffeeMachine.cs index f0b10073..0b803647 100644 --- a/BPASmartClient.KLMCoffee/CoffeeMachine.cs +++ b/BPASmartClient.KLMCoffee/CoffeeMachine.cs @@ -139,12 +139,12 @@ namespace BPASmartClient.KLMCoffee SystemStatusModel systemStatus = new K95Command().StateResolution(data); if (systemStatus != null) { - status["temStatus"] = systemStatus.temStatus; + status["Status"] = systemStatus.temStatus; status["drinkType"] = systemStatus.drinkType; - status["taskIndex"] = systemStatus.taskIndex; + status["AppStatus"] = systemStatus.taskIndex; status["progress"] = systemStatus.progress; - status["faultMessage"] = systemStatus.faultMessage; - status["upkeepMessage"] = systemStatus.upkeepMessage; + status["Warning"] = systemStatus.faultMessage.dataFault(); + status["Keep"] = systemStatus.upkeepMessage; if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep()) IsWork=false; else @@ -160,12 +160,12 @@ namespace BPASmartClient.KLMCoffee protected override void InitStatus() { - status["temStatus"] = K95SysTemStatus.空闲状态; + status["Status"] = K95SysTemStatus.空闲状态; status["drinkType"] = DrinkType.意式; - status["taskIndex"] = TaskIndex.无任务; + status["AppStatus"] = TaskIndex.无任务; status["progress"] = 0; - status["faultMessage"] = new FaultMessage(0x00,0x00); - status["upkeepMessage"] = new UpkeepMessage(0x00); + status["Warning"] = new FaultMessage(0x00,0x00).dataFault(); + status["Keep"] = new UpkeepMessage(0x00).dataFault(); } diff --git a/BPASmartClient.KLMCoffee/Protocal/FaultMessage.cs b/BPASmartClient.KLMCoffee/Protocal/FaultMessage.cs index 8f4152b9..27899c60 100644 --- a/BPASmartClient.KLMCoffee/Protocal/FaultMessage.cs +++ b/BPASmartClient.KLMCoffee/Protocal/FaultMessage.cs @@ -104,5 +104,18 @@ namespace BPASmartClient.KLMCoffee.Protocal } return false; } + + public string dataFault() + { + string message = string.Empty; + foreach (System.Reflection.PropertyInfo info in this.GetType().GetProperties()) + { + if ((bool)info.GetValue(this) == true) + { + message= message +" "+ info.Name; + } + } + return string.IsNullOrEmpty(message)?"无": message; + } } } diff --git a/BPASmartClient.KLMCoffee/Protocal/UpkeepMessage.cs b/BPASmartClient.KLMCoffee/Protocal/UpkeepMessage.cs index db20ef79..6982f575 100644 --- a/BPASmartClient.KLMCoffee/Protocal/UpkeepMessage.cs +++ b/BPASmartClient.KLMCoffee/Protocal/UpkeepMessage.cs @@ -44,5 +44,18 @@ namespace BPASmartClient.KLMCoffee.Protocal } return false; } + + public string dataFault() + { + string message = string.Empty; + foreach (System.Reflection.PropertyInfo info in this.GetType().GetProperties()) + { + if ((bool)info.GetValue(this) == true) + { + message = message + " " + info.Name; + } + } + return string.IsNullOrEmpty(message) ? "无" : message; + } } } From 89c56507f06886f332daf1dc497e82077225f006 Mon Sep 17 00:00:00 2001 From: fyf Date: Wed, 11 May 2022 18:04:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0dll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.Device/BaseDevice.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BPASmartClient.Device/BaseDevice.cs b/BPASmartClient.Device/BaseDevice.cs index 1889ddfc..0ee7eea2 100644 --- a/BPASmartClient.Device/BaseDevice.cs +++ b/BPASmartClient.Device/BaseDevice.cs @@ -144,7 +144,8 @@ namespace BPASmartClient.Device foreach (var key in peripheral.GetAllStatus().Keys) { peripheralStatus[key] = peripheral.GetAllStatus()[key]; - Status.Update($"{TypeName}.{key}", peripheral.GetAllStatus()[key]); + if(TypeName!= "PLC.MorksMachine") + Status.Update($"{TypeName}.{key}", peripheral.GetAllStatus()[key]); } } Thread.Sleep(100);