From 06a4efb0d9e867bd2b6058d64869be547c0792da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Fri, 11 Nov 2022 11:09:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A5=BF=E9=97=A8=E5=AD=90=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.MorkS/Control_Morks.cs | 13 +++++++------ BPASmartClient.MorkS/DataServer.cs | 8 ++++++-- BPASmartClient.S7Net/EntityClassResolution.cs | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/BPASmartClient.MorkS/Control_Morks.cs b/BPASmartClient.MorkS/Control_Morks.cs index e7bd1ec2..80cf1f37 100644 --- a/BPASmartClient.MorkS/Control_Morks.cs +++ b/BPASmartClient.MorkS/Control_Morks.cs @@ -34,13 +34,11 @@ namespace BPASmartClient.MorkS public override void DoMain() { - - 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) { @@ -273,8 +271,11 @@ namespace BPASmartClient.MorkS if (order.MorkOrder.GoodBatchings == null) return; if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return; OrderCount++; - Json.Data.StatisticsTime=DateTime.Now; + 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); @@ -600,7 +601,7 @@ namespace BPASmartClient.MorkS } //取餐完成逻辑处理 - if (Delay.GetInstance("CompleteChange1").Start( !mORKS.TakeMealDetect, 1)&&mORKS.CookCompleteFlatBit == true) + if (Delay.GetInstance("CompleteChange1").Start(!mORKS.TakeMealDetect, 1) && mORKS.CookCompleteFlatBit == true) { OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成"); @@ -814,7 +815,7 @@ namespace BPASmartClient.MorkS mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid }); MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】"); } - + } }); } diff --git a/BPASmartClient.MorkS/DataServer.cs b/BPASmartClient.MorkS/DataServer.cs index 8d6019e3..ff948122 100644 --- a/BPASmartClient.MorkS/DataServer.cs +++ b/BPASmartClient.MorkS/DataServer.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using BPA.Helper; using BPASmartClient.MQTT; using BPA.Message; +using BPASmartClient.Model; namespace BPASmartClient.MorkS { @@ -17,15 +18,18 @@ namespace BPASmartClient.MorkS public static DataServer GetInstance => _Instance ?? (_Instance = new DataServer()); private DataServer() { } + public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS(); + public void Init() { MQTTProxy mQTTProxy = new MQTTProxy(); mQTTProxy.Connected = new Action(() => { - mQTTProxy.Subscrib(""); + mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); ThreadManage.GetInstance().StartLong(new Action(() => { - mQTTProxy.Publish("", ""); + morkS.MorkS_OrderCount = Json.Data.Count; + mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机), morkS.ToJSON()); Thread.Sleep(100); }), "海科食堂大屏监听"); }); diff --git a/BPASmartClient.S7Net/EntityClassResolution.cs b/BPASmartClient.S7Net/EntityClassResolution.cs index 75dcc8cd..81b10374 100644 --- a/BPASmartClient.S7Net/EntityClassResolution.cs +++ b/BPASmartClient.S7Net/EntityClassResolution.cs @@ -57,6 +57,7 @@ namespace BPASmartClient.S7Net default: numBytes = GetClassSize(Activator.CreateInstance(type), numBytes, isInnerProperty: true); if (type.IsClass) IncrementToEven(ref numBytes); + else if (!type.IsPrimitive && !type.IsEnum && type.IsValueType) IncrementToEven(ref numBytes); break; }