Browse Source

Merge branch '45维谛技术数采一期' of http://www.imaodou.com.cn:30030/c_jack/Aliyun_EICP3.0 into 45维谛技术数采一期

谢翼翔 1 year ago
parent
commit
a34c79d1f8

+ 13 - 13
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Doc/DeviceCfg.json

@@ -26,7 +26,7 @@
         "CanShare": true
       },
       "CommWay": "SCADA.Comm.TcpComm",
-      "PollRate": 500,
+      "PollRate": 1000,
       "AnnotationGroup": 6,
       "GroupName": "默认组"
     },
@@ -86,7 +86,7 @@
         "CanShare": true
       },
       "CommWay": "SCADA.Comm.TcpComm",
-      "PollRate": 500,
+      "PollRate": 1000,
       "AnnotationGroup": 6,
       "GroupName": "默认组"
     },
@@ -116,7 +116,7 @@
         "CanShare": true
       },
       "CommWay": "SCADA.Comm.TcpComm",
-      "PollRate": 500,
+      "PollRate": 1000,
       "AnnotationGroup": 8,
       "GroupName": "默认组"
     },
@@ -134,7 +134,7 @@
       "Desc": "",
       "IsEnable": true,
       "Simulated": false,
-      "LastEditTime": "2023-10-26T15:14:34.6271304+08:00",
+      "LastEditTime": "2023-11-08T12:45:31.1118633+08:00",
       "ComInfo": {
         "IPAddress": "10.169.216.16",
         "Port": 10067,
@@ -146,7 +146,7 @@
         "CanShare": true
       },
       "CommWay": "SCADA.Comm.TcpComm",
-      "PollRate": 500,
+      "PollRate": 1000,
       "AnnotationGroup": 8,
       "GroupName": "默认组"
     },
@@ -164,7 +164,7 @@
       "Desc": "",
       "IsEnable": true,
       "Simulated": false,
-      "LastEditTime": "2023-10-26T15:14:36.6993176+08:00",
+      "LastEditTime": "2023-11-08T12:45:29.147502+08:00",
       "ComInfo": {
         "IPAddress": "10.169.216.18",
         "Port": 10067,
@@ -176,7 +176,7 @@
         "CanShare": true
       },
       "CommWay": "SCADA.Comm.TcpComm",
-      "PollRate": 500,
+      "PollRate": 1000,
       "AnnotationGroup": 8,
       "GroupName": "默认组"
     },
@@ -206,7 +206,7 @@
         "CanShare": true
       },
       "CommWay": "SCADA.Comm.TcpComm",
-      "PollRate": 500,
+      "PollRate": 1000,
       "AnnotationGroup": 5,
       "GroupName": "默认组"
     },
@@ -236,7 +236,7 @@
         "CanShare": true
       },
       "CommWay": "SCADA.Comm.TcpComm",
-      "PollRate": 500,
+      "PollRate": 1000,
       "AnnotationGroup": 8,
       "GroupName": "默认组"
     },
@@ -266,7 +266,7 @@
         "CanShare": true
       },
       "CommWay": "SCADA.Comm.TcpComm",
-      "PollRate": 500,
+      "PollRate": 1000,
       "AnnotationGroup": 7,
       "GroupName": "默认组"
     },
@@ -296,7 +296,7 @@
         "CanShare": true
       },
       "CommWay": "SCADA.Comm.TcpComm",
-      "PollRate": 500,
+      "PollRate": 1000,
       "AnnotationGroup": 3,
       "GroupName": "默认组"
     }
@@ -6175,8 +6175,8 @@
   "DatabseSyncTasks": [],
   "ProjectInfo": {
     "ProjectName": null,
-    "LastEditTime": "2023-10-26T15:15:16.1275273+08:00",
-    "ModifyBy": "维谛应用虚拟机",
+    "LastEditTime": "2023-11-08T12:46:10.1250633+08:00",
+    "ModifyBy": "陈子杰",
     "CreateTime": "0001-01-01T00:00:00",
     "CreateBy": null,
     "Remark": null

+ 42 - 10
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Machines/FXMachine.cs

@@ -183,7 +183,7 @@ namespace SCADA_DAQ.Customer.Machines
                         machineStateResumeModel.StateCode = reg.Comment.Annotation;
                         machineStateResumeModels.Add(machineStateResumeModel);
                         machineStateResumeModel.StartTime = DateTime.Parse(DateTime.Now.Format());
-                        machineStateResumeModel.TagName = reg.Comment.Variable;
+                        machineStateResumeModel.TagName = reg.Comment.RegName;
                         Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
                             new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, machineStateResumeModel.StateId),
                             new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, reg.Comment.Annotation),
@@ -201,7 +201,7 @@ namespace SCADA_DAQ.Customer.Machines
                 {
                     if (machineStateResumeModels.Count > 0)
                     {
-                        if (machineStateResumeModels[0].TagName == reg.Comment.Variable)
+                        if (machineStateResumeModels[0].StateCode == reg.Comment.Variable)
                         {
                             machineStateResumeModels[0].EndTime = DateTime.Parse(DateTime.Now.Format());
                             Env.SqlDAL.App_Vertiv_MachineInfo.Update(
@@ -231,14 +231,45 @@ namespace SCADA_DAQ.Customer.Machines
                     //断线更新数据
                     if (machineStateResumeModels.Count > 0)
                     {
-                        machineStateResumeModels[0].EndTime = DateTime.Parse(DateTime.Now.Format());
-                        Env.SqlDAL.App_Vertiv_MachineInfo.Update(
-                            $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{machineStateResumeModels[0].StateId}'",
-                            new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now.Format()),
-                            new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, machineStateResumeModels[0].EndTime - machineStateResumeModels[0].StartTime),
-                            new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (machineStateResumeModels[0].EndTime - machineStateResumeModels[0].StartTime).TotalSeconds)
-                            );
-                        machineStateResumeModels.RemoveAt(0);
+                        if (machineStateResumeModels.Count == 1)
+                        {
+                            machineStateResumeModels[0].EndTime = DateTime.Parse(DateTime.Now.Format());
+                            Env.SqlDAL.App_Vertiv_MachineInfo.Update(
+                                $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{machineStateResumeModels[0].StateId}'",
+                                new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now.Format()),
+                                new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, machineStateResumeModels[0].EndTime - machineStateResumeModels[0].StartTime),
+                                new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (machineStateResumeModels[0].EndTime - machineStateResumeModels[0].StartTime).TotalSeconds)
+                                );
+                            machineStateResumeModels.RemoveAt(0);
+                        }
+                        else
+                        {
+                            var orderTime = machineStateResumeModels.OrderBy(t=>t.StartTime).ToList();
+                            for (int i = 0; i < orderTime.Count; i++)
+                            {
+                                if (i < orderTime.Count - 1)
+                                {
+                                    orderTime[i].EndTime = orderTime[i+1].StartTime;
+                                  
+                                }
+                                else if (i == orderTime.Count - 1)
+                                {
+                                    orderTime[i].EndTime = DateTime.Parse(DateTime.Now.Format());
+
+                                }
+                                Env.SqlDAL.App_Vertiv_MachineInfo.Update(
+                                      $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{orderTime[i].StateId}'",
+                                      new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, orderTime[i].EndTime),
+                                      new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, orderTime[i].EndTime - orderTime[i].StartTime),
+                                      new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (orderTime[i].EndTime - orderTime[i].StartTime).TotalSeconds)
+                                      );
+                                ListenReg[orderTime[i].TagName].Value = 0;
+                                //machineStateResumeModels.RemoveAt(0);
+                            }
+                        }
+                        machineStateResumeModels.Clear();
+                        
+
                         //不写Log
                         //Log.Info($"设备名{BaseDevice.DeviceID},断线更新状态{machineStateResumeModels[0].StateCode},记录列表有{machineStateResumeModels.Count}条数据");
                     }
@@ -293,6 +324,7 @@ namespace SCADA_DAQ.Customer.Machines
             {
                 InsertStateRecord(reg);
             }
+            
         }
 
         public override void Dispose()

+ 13 - 5
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Service/CustomerService.cs

@@ -109,7 +109,6 @@ namespace SCADA_DAQ.Customer.Service
             {
                 _instance = this;
             }
-            Log.Warn("折弯机服务实例");
         }
 
 
@@ -176,7 +175,10 @@ namespace SCADA_DAQ.Customer.Service
                     hourStatistics.Add(new StatisticsDBModel
                     {
                         Source = "Hour",
-                        Value = DateTime.Now.Hour
+                        Value = DateTime.Now.Hour,
+                        CreateTime = DateTime.Now
+
+
                     }) ;
                     addInfo.Add(hourStatistics.First());
                 }
@@ -185,7 +187,9 @@ namespace SCADA_DAQ.Customer.Service
                     dayStatistics.Add(new StatisticsDBModel
                     {
                         Source = "Day",
-                        Value = DateTime.Now.Day
+                        Value = DateTime.Now.Day,
+                        CreateTime = DateTime.Now
+
                     });
                     addInfo.Add(dayStatistics.First());
                 }
@@ -194,7 +198,9 @@ namespace SCADA_DAQ.Customer.Service
                     monthStatistics.Add(new StatisticsDBModel
                     {
                         Source = "Month",
-                        Value = DateTime.Now.Month
+                        Value = DateTime.Now.Month,
+                        CreateTime = DateTime.Now
+
                     });
                     addInfo.Add(monthStatistics.First());
 
@@ -204,7 +210,9 @@ namespace SCADA_DAQ.Customer.Service
                     yearStatistics.Add(new StatisticsDBModel
                     {
                         Source = "Year",
-                        Value = DateTime.Now.Year
+                        Value = DateTime.Now.Year,
+                        CreateTime = DateTime.Now
+
                     });
                     addInfo.Add(yearStatistics.First());
                 }

+ 9 - 1
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmBendDeviceOeeInformation.xaml.cs

@@ -53,10 +53,18 @@ namespace SCADA_DAQ.Customer
                 {
                     GetOeeData();
                     TenOeeChart();
-
+                   
                 }));
 
             }
+            if (e.ChangeType == DateTimeChangeType.DayChanged || e.ChangeType == DateTimeChangeType.MinuteChanged || e.ChangeType == DateTimeChangeType.HourChanged)
+            {
+                Dispatcher.Invoke(() =>
+                {
+                    LocalTime.Text = DateTime.Now.ToString("dddd yyyy年MM月dd日 HH:mm");
+
+                });
+            }
         }
         public void TenOeeChart()
         {

+ 8 - 0
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmDeviceOeeInformation.xaml.cs

@@ -75,6 +75,14 @@ namespace SCADA_DAQ.Customer
                 }));
 
             }
+            if (e.ChangeType == DateTimeChangeType.DayChanged || e.ChangeType == DateTimeChangeType.MinuteChanged || e.ChangeType == DateTimeChangeType.HourChanged)
+            {
+                Dispatcher.Invoke(() =>
+                {
+                    LocalTime.Text = DateTime.Now.ToString("dddd yyyy年MM月dd日 HH:mm");
+
+                });
+            }
         }
 
         public void TenOeeChart()