3 Commits b5b0aca8ec ... 994488dc89

Author SHA1 Message Date
  mengshunguo 994488dc89 提交 2 weeks ago
  mengshunguo c97a8d3724 提交 2 weeks ago
  mengshunguo 334a06bebb 提交 2 weeks ago

+ 6 - 7
SCADA_DAQ/Customer/Machines/RFIDBindingMachine.cs

@@ -142,11 +142,11 @@ namespace SCADA_DAQ.Customer.Machines
             }
             #endregion
 
-            #region //定时上传未上传的产品数据
-            if (e.ChangeType == DateTimeChangeType.MinuteChanged && e.TimeFlag.Minute % 30 == 0 &&
+            #region 定时上传未上传的产品数据
+            if (e.ChangeType == DateTimeChangeType.MinuteChanged && e.TimeFlag.Minute % 10 == 0 &&
                 CustomerEnv.MESServerConnectStatus && CustomerEnv.MESAPIToken != null && CustomerEnv.CustomerConfig.SetPower.MESUpload)
             {
-                var notSyncedList = Env.DAL.App_Microwave_TestResult.GetData<ProductModel>(t => t.IsSynced == false && t.Barcode != null && t.Barcode != "");
+                var notSyncedList = Env.DAL.App_Microwave_TestResult.GetData<ProductModel>(t => t.IsSynced == false && t.Barcode != null && t.Barcode != "" && t.RunTime > 0);
                 var synecdList = new List<ProductModel>();
                 string str = "";
                 for (int i = 0; i < notSyncedList?.Count; i++)
@@ -224,15 +224,14 @@ namespace SCADA_DAQ.Customer.Machines
 
         private void Sr_BarCodeReceived(object sender, BarcodeReceivedEventArgs e)
         {
+            PLCMachine = MachineServer.GetInstance().GetMachine<SampleMachine>("Device3");
             if (e.Barcode.Length < 22)
             {
-                PLCMachine = MachineServer.GetInstance().GetMachine<SampleMachine>("Device3");
                 Barcode = e.Barcode; //NoRead,未拍到条码
                 PLCMachine?.GetListenReg("RedLight").WriteReg(1);
             }
             else
             {
-                PLCMachine = MachineServer.GetInstance().GetMachine<SampleMachine>("Device3");
                 Barcode = e.Barcode.Substring(e.Barcode.Length - 22, 22);
                 PLCMachine?.GetListenReg("YellowLight").WriteReg(1);
             }
@@ -570,7 +569,7 @@ namespace SCADA_DAQ.Customer.Machines
                     {
                         int secondFFIndex = 0;
                         List<byte> dataByteList = null;
-                        try
+                        try //有出现两段重复报文数据,提取第一段报文数据
                         {
                             for (int i = 0; i < data.Count; i++)
                             {
@@ -614,7 +613,7 @@ namespace SCADA_DAQ.Customer.Machines
                             model.DataDecode(data.ToArray(), i);
                             points.Add(model);
                         }
-                        if (points.Count <= 90 && CustomerEnv.CustomerConfig.SetPower.IsSimulationDta)
+                        if (points.Count <= 90 && CustomerEnv.CustomerConfig.SetPower.IsSimulationDta) //当时长不够时进行模拟数据赋值
                         {
                             points = ProcessData.SimulationData();
                         }

+ 1 - 1
SCADA_DAQ/Customer/Machines/RFIDMachine.cs

@@ -200,7 +200,7 @@ namespace SCADA_DAQ.Customer.Machines
                     {
                         int secondFFIndex = 0;
                         List<byte> dataByteList = null;
-                        try
+                        try    //有出现两段重复报文数据,提取第一段报文数据
                         {
                             for (int i = 0; i < data.Count; i++)
                             {

+ 2 - 2
SCADA_DAQ/Customer/Models/ProcessData.cs

@@ -105,8 +105,8 @@ namespace SCADA_DAQ.Customer.Models
         {
             Voltage = ((data[startIndex] << 8) + data[startIndex + 1]) / 100.0m;
             Amps = ((data[startIndex + 2] << 8) + data[startIndex + 3]) / 1000.0m;
-            //Power = ((data[startIndex + 4] << 8) + data[startIndex + 5]) / 10.0m;
-            Power = Voltage * Amps;
+            Power = ((data[startIndex + 4] << 8) + data[startIndex + 5]) / 10.0m <= 1 ?
+                Voltage * Amps : ((data[startIndex + 4] << 8) + data[startIndex + 5]) / 10.0m;
         }
 
         public static List<ProcessData> SimulationData()