3 Revize 994488dc89 ... a11e5c5918

Autor SHA1 Zpráva Datum
  mengshunguo a11e5c5918 MES接口异常处理,定时删除设备状态表 před 2 týdny
  mengshunguo d08a1b1b3b 临时提交 před 2 týdny
  mengshunguo aaf3c51261 临时提交 před 2 týdny

+ 1 - 1
SCADA_DAQ/Customer/CustomerEnv_MES.cs

@@ -59,7 +59,7 @@ namespace SCADA_DAQ.Customer
                 stepResult = result,
                 errCode = errCode,
                 Args = new List<ProductProcessData> { new ProductProcessData {
-                    Comment = "功率",
+                    Comment = "老化峰值功率",
                     Result = result,
                     Value = Math.Round(value,2),
                     UOM = "W"

+ 28 - 12
SCADA_DAQ/Customer/Machines/RFIDBindingMachine.cs

@@ -112,6 +112,13 @@ namespace SCADA_DAQ.Customer.Machines
 
         private async void Schedual_DateTimeChanged(object sender, SCADA.CommonLib.DateTimeChangedArgs e)
         {
+            #region 定时删除设备状态表
+            if (e.ChangeType == DateTimeChangeType.HourChanged && e.TimeFlag.Hour % 2 == 0)
+            {
+                Env.DAL.Base_DeviceStateResume.DeleteOldData(DateTime.Now);
+            }
+            #endregion
+
             #region 90s后读回绑定队列产品数据
             if (e.ChangeType == DateTimeChangeType.SecondChanged && e.TimeFlag.Second % 5 == 0)
             {
@@ -645,10 +652,29 @@ namespace SCADA_DAQ.Customer.Machines
                             RunTimeStr = $"{points.Count} S",
                         };
 
-                        if (rfidInfo.Barcode != null && rfidInfo.Barcode != "" && product.ProcessDatas.Count > 0 &&
+                        Env.DAL.Insert(product);
+                        foreach (var item in points)
+                        {
+                            item.ReportId = product.ID;
+                        }
+                        Env.DAL.Insert(points);
+
+                        Log.Info($"RFID{uid},产品条码{rfidInfo.Barcode},收到{product?.ProcessDatas?.Count}");
+                        TestFinish?.Invoke(this, new TestFinishEventArgs() { Product = product });
+
+                        if (rfidInfo.Barcode != null && rfidInfo.Barcode != "" && product.ProcessDatas.Count > 0 && CustomerEnv.MESAPITokenExpired > DateTime.Now &&
                             CustomerEnv.MESServerConnectStatus && CustomerEnv.MESAPIToken != null && CustomerEnv.CustomerConfig.SetPower.MESUpload)
                         {
-                            var result = CustomerEnv.MESUploadProductData(product);
+                            MESResultMsg result;
+                            try
+                            {
+                                result = CustomerEnv.MESUploadProductData(product);
+                            }
+                            catch (Exception)
+                            {
+
+                                throw;
+                            }
                             if (result.IsError)
                             {
                                 Log.Info($"产品{product.Barcode}过程数据上传MES失败,报错信息:{result.Message}");
@@ -659,16 +685,6 @@ namespace SCADA_DAQ.Customer.Machines
                                 Log.Info($"产品{product.Barcode}过程数据上传成功");
                             }
                         }
-
-                        Env.DAL.Insert(product);
-                        foreach (var item in points)
-                        {
-                            item.ReportId = product.ID;
-                        }
-                        Env.DAL.Insert(points);
-
-                        Log.Info($"RFID{uid},产品条码{rfidInfo.Barcode},收到{product?.ProcessDatas?.Count}");
-                        TestFinish?.Invoke(this, new TestFinishEventArgs() { Product = product });
                     }
                 }
                 else

+ 4 - 0
SCADA_DAQ/Customer/Models/ProcessData.cs

@@ -120,6 +120,7 @@ namespace SCADA_DAQ.Customer.Models
                     model.Power = 1150.564m;
                     model.Voltage = 225.12m;
                     model.Amps = 5.11m;
+                    points.Add(model);
                 }
                 else if (i >= 10 && i <= 19)
                 {
@@ -127,6 +128,7 @@ namespace SCADA_DAQ.Customer.Models
                     model.Power = 0;
                     model.Voltage = 0;
                     model.Amps = 0;
+                    points.Add(model);
                 }
                 else if (i >= 20 && i <= 110)
                 {
@@ -134,6 +136,7 @@ namespace SCADA_DAQ.Customer.Models
                     model.Power = 1155.854m;
                     model.Voltage = 223.191m;
                     model.Amps = 5.30m;
+                    points.Add(model);
                 }
                 else if (i >= 111)
                 {
@@ -141,6 +144,7 @@ namespace SCADA_DAQ.Customer.Models
                     model.Power = 0;
                     model.Voltage = 0;
                     model.Amps = 0;
+                    points.Add(model);
                 }
             }
             return points;