mengshunguo 2 weeks ago
parent
commit
c97a8d3724

+ 4 - 5
SCADA_DAQ/Customer/Machines/RFIDBindingMachine.cs

@@ -142,7 +142,7 @@ namespace SCADA_DAQ.Customer.Machines
             }
             #endregion
 
-            #region //定时上传未上传的产品数据
+            #region 定时上传未上传的产品数据
             if (e.ChangeType == DateTimeChangeType.MinuteChanged && e.TimeFlag.Minute % 10 == 0 &&
                 CustomerEnv.MESServerConnectStatus && CustomerEnv.MESAPIToken != null && CustomerEnv.CustomerConfig.SetPower.MESUpload)
             {
@@ -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 < 0 ?
+                Voltage * Amps : ((data[startIndex + 4] << 8) + data[startIndex + 5]) / 10.0m;
         }
 
         public static List<ProcessData> SimulationData()