谢翼翔 1 rok temu
rodzic
commit
c2784ff103

+ 44 - 49
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Machines/CP1HMachine.cs

@@ -54,7 +54,7 @@ namespace SCADA_DAQ.Customer.Machines
             {
                 if (IsOpenTime == true)
                 {
-                    if (WaitTime.OnOrgID_Str != null)
+                    if (WaitTime.OnOrgID_Str != "")
                     {
                         Env.SqlDAL.App_Vertiv_MachineInfo.Update(
                          $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
@@ -63,7 +63,7 @@ namespace SCADA_DAQ.Customer.Machines
                         WaitTime.OnOrgID_Str = "";
                         WaitNameStateCode = "";
                     }
-                    if (ChangeModel.OnOrgID_Str != null)
+                    if (ChangeModel.OnOrgID_Str != "")
                     {
                         Env.SqlDAL.App_Vertiv_MachineInfo.Update(
                              $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
@@ -72,7 +72,7 @@ namespace SCADA_DAQ.Customer.Machines
                         ChangeModel.OnOrgID_Str = "";
                     }
 
-                    if (ProgramStart.OnOrgID_Str != null)
+                    if (ProgramStart.OnOrgID_Str != "")
                     {
                         Env.SqlDAL.App_Vertiv_MachineInfo.Update(
                         $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
@@ -81,7 +81,7 @@ namespace SCADA_DAQ.Customer.Machines
                         ProgramStart.OnOrgID_Str = "";
                     }
 
-                    if (RepairTime.OnOrgID_Str != null)
+                    if (RepairTime.OnOrgID_Str != "")
                     {
                         Env.SqlDAL.App_Vertiv_MachineInfo.Update(
                        $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{RepairTime.OnOrgID_Str}'",
@@ -441,71 +441,66 @@ namespace SCADA_DAQ.Customer.Machines
 
             if (e.ChangeType == DateTimeChangeType.MinuteChanged)
             {
-                if (!IsOpenTime)
+                if (ConnectState != SCADA.Comm.ConnectStates.Connected)
                 {
-                    Env.SqlDAL.App_Vertiv_MachineInfo.Update(
-                    $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
-                    new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
-                    new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ChangeModel.StateOnTime_Dt).TotalSeconds));
+                    if (WaitTime.OnOrgID_Str != null)
+                    {
+                        Env.SqlDAL.App_Vertiv_MachineInfo.Update(
+                       $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
+                       new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
+                       new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
+                    }
                 }
 
-
-                if (ProgramStart.OnOrgID_Str != null)
+                if (WaitTime.OnOrgID_Str != "")
                 {
                     Env.SqlDAL.App_Vertiv_MachineInfo.Update(
-                      $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
-                      new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
-                      new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ProgramStart.StateOnTime_Dt).TotalSeconds));
+                     $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
+                     new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
+                   new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
                 }
-
-
-
-                if (RepairTime.OnOrgID_Str != null)
+                if (ChangeModel.OnOrgID_Str != "")
                 {
                     Env.SqlDAL.App_Vertiv_MachineInfo.Update(
-                    $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{RepairTime.OnOrgID_Str}'",
-                      new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
-                    new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - RepairTime.StateOnTime_Dt)),
-                     new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - RepairTime.StateOnTime_Dt).TotalSeconds));
-                }
-
-
-
-                Env.SqlDAL.App_Vertiv_MachineInfo.Update(
-                $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
-                new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
-                new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
+                         $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
+                         new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
+                         new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ChangeModel.StateOnTime_Dt).TotalSeconds));
 
+                }
 
+                if (ProgramStart.OnOrgID_Str != "")
+                {
+                    Env.SqlDAL.App_Vertiv_MachineInfo.Update(
+                    $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
+                    new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
+                    new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ProgramStart.StateOnTime_Dt).TotalSeconds));
 
+                }
 
-                if (ConnectState != SCADA.Comm.ConnectStates.Connected)
+                if (RepairTime.OnOrgID_Str != "")
                 {
-                    if (WaitTime.OnOrgID_Str != null)
-                    {
-                        Env.SqlDAL.App_Vertiv_MachineInfo.Update(
-                       $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
-                       new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
-                       new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
-                    }
-                }
-            
+                    Env.SqlDAL.App_Vertiv_MachineInfo.Update(
+                   $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{RepairTime.OnOrgID_Str}'",
+                   new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
+                   new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - RepairTime.StateOnTime_Dt)),
+                   new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - RepairTime.StateOnTime_Dt).TotalSeconds));
 
+                }
+            }
         }
-    }
 
-    public void DeviceUpdate()
-    {
+        public void DeviceUpdate()
+        {
 
 
 
-    }
+        }
 
 
-    public override void Dispose()
-    {
-        Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;
-        base.Dispose();
+        public override void Dispose()
+        {
+            Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;
+            base.Dispose();
+        }
     }
 }
-}

+ 6 - 4
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmPunchingMachineEquipmentKanban.xaml.cs

@@ -108,8 +108,7 @@ namespace SCADA_DAQ.Customer
             var kimFangyuanStopTime = DeviceTimeValue("金方圆数控母线冲孔机", "停止标志位");//金方圆数控母线冲孔机等待时间
             var kimFangyuanStopTimeSpan = TimeSpan.FromSeconds(Math.Round(kimFangyuanStopTime)).ToString();
 
-           var highmachineStopTime = totalTimeOfDay - highmachineRunTime - highmachineMoldTime - DeviceTimeValue("高机母线冲剪机","计划停止时间")- highmachineArlamDouble
-               + DeviceScheduleStopBetweenTime("高机母线冲剪机") + DeviceAlarmScheduleStopBetweenTime("高机母线冲剪机");//高机母线冲剪机等待时间
+            var highmachineStopTime = DeviceTimeValue("高机母线冲剪机", "停止标志位");//高机母线冲剪机等待时间
             var highmachineStopTimeSpan = TimeSpan.FromSeconds(Math.Round(highmachineStopTime)).ToString();
 
             var kimFangyuanTimeValue = new double[] { kimFangyuanRunTime, kimFangyuanStopTime, kimFangyuanArlamDouble, kimFangyuanMoldTime };
@@ -393,8 +392,11 @@ namespace SCADA_DAQ.Customer
                     var kimFangyuanStopTime = DeviceTimeValue("金方圆数控母线冲孔机", "停止标志位");//金方圆数控母线冲孔机等待时间
                     var kimFangyuanStopTimeSpan = TimeSpan.FromSeconds(Math.Round(kimFangyuanStopTime)).ToString();
 
-                    var highmachineStopTime = totalTimeOfDay - highmachineRunTime - highmachineMoldTime - DeviceTimeValue("高机母线冲剪机", "计划停止时间") - highmachineArlamDouble
-                        + DeviceScheduleStopBetweenTime("高机母线冲剪机") + DeviceAlarmScheduleStopBetweenTime("高机母线冲剪机");//高机母线冲剪机等待时间
+
+                    //var highmachineStopTime = totalTimeOfDay - highmachineRunTime - highmachineMoldTime - DeviceTimeValue("高机母线冲剪机", "计划停止时间") - highmachineArlamDouble
+                    //+ DeviceScheduleStopBetweenTime("高机母线冲剪机") + DeviceAlarmScheduleStopBetweenTime("高机母线冲剪机");//高机母线冲剪机等待时间
+                    //var highmachineStopTimeSpan = TimeSpan.FromSeconds(Math.Round(highmachineStopTime)).ToString();
+                    var highmachineStopTime = DeviceTimeValue("高机母线冲剪机", "停止标志位");//高机母线冲剪机等待时间
                     var highmachineStopTimeSpan = TimeSpan.FromSeconds(Math.Round(highmachineStopTime)).ToString();
 
                     var kimFangyuanTimeValue = new double[] { kimFangyuanRunTime, kimFangyuanStopTime, kimFangyuanArlamDouble, kimFangyuanMoldTime };

+ 1 - 1
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Env.cs

@@ -31,7 +31,7 @@ namespace SCADA_DAQ
         //public static SqlSchema.DIL.DILDB SqlDAL = new SqlSchema.DIL.DILDB("10.163.96.79", "Vertiv", "sa", "1qaz2wsx");
 
         public static SqlSchema.DIL.DILDB SqlDAL = new SqlSchema.DIL.DILDB("127.0.0.1", "Vertiv", "sa", "M+123456");
-        //public static SqlSchema.DIL.DILDB SqlDAL = new SqlSchema.DIL.DILDB("10.163.96.79", "Vertiv", "sa", "1qaz2wsx");
+       //public static SqlSchema.DIL.DILDB SqlDAL = new SqlSchema.DIL.DILDB("10.163.96.79", "Vertiv", "sa", "1qaz2wsx");
 
         //public static SqlSchema.DIL.DILDB SqlDAL;