2 Commits 1643758ed0 ... be0bf5c11a

Author SHA1 Message Date
  谢翼翔 be0bf5c11a 临时提交 1 year ago
  谢翼翔 7e5f1f335a 临时提交 1 year ago

+ 63 - 56
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Machines/FXMachine.cs

@@ -23,6 +23,7 @@ namespace SCADA_DAQ.Customer.Machines
         private List<MachineStateModel> machineStateResumeModels = new List<MachineStateModel>();
 
         public string IsExitState { get; set; }
+        public bool IsReadyCode { get; set; }
 
         public FXMachine(string machieID) : base(machieID)
         {
@@ -73,7 +74,6 @@ namespace SCADA_DAQ.Customer.Machines
                         else
                        {
                           
-
                             MachineStateModel machineStateResumeModel = new MachineStateModel();
                             machineStateResumeModel.StateCode = "停止标志位";
                             machineStateResumeModel.StartTime = DateTime.Parse(DateTime.Now.Format());
@@ -101,42 +101,42 @@ namespace SCADA_DAQ.Customer.Machines
         {
             if (!IsOpenTime)
             {
-                //if (e.ChangeType == DateTimeChangeType.DayChanged)
-                //{
-                //    if (BaseDevice.ConnectState == SCADA.Comm.ConnectStates.Connected)
-                //    {
-                //        var runFlag = this.GetListenReg("运行标志位");
-                //        var stopFlag = this.GetListenReg("停止标志位");
-                //        var toolChangeFlag = this.GetListenReg("换模标志位");
-                //        var repairFlag = this.GetListenReg("维修时间");
-                //        if (runFlag != null && stopFlag != null && toolChangeFlag != null && repairFlag != null)
-                //        {
-                //            RegInfo reg = runFlag.Value == 1 ? runFlag : stopFlag.Value == 1 ? stopFlag : toolChangeFlag.Value == 1 ? toolChangeFlag : repairFlag.Value == 1 ? repairFlag : null;
-
-                //            if (reg != null)
-                //            {
-                //                if (machineStateResumeModels.Count > 0)
-                //                {
-                //                    if (machineStateResumeModels[0].TagName == reg.Comment.Variable)
-                //                    {
-                //                        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.Clear();
-                //                }
-                //                InsertStateRecord(reg);
-                //            }
-
-                //        }
-                //    }
-
-                //}
+                if (e.ChangeType == DateTimeChangeType.DayChanged)
+                {
+                    if (BaseDevice.ConnectState == SCADA.Comm.ConnectStates.Connected)
+                    {
+                        var runFlag = this.GetListenReg("运行标志位");
+                        var stopFlag = this.GetListenReg("停止标志位");
+                        var toolChangeFlag = this.GetListenReg("换模标志位");
+                        var repairFlag = this.GetListenReg("维修时间");
+                        if (runFlag != null && stopFlag != null && toolChangeFlag != null && repairFlag != null)
+                        {
+                            RegInfo reg = runFlag.Value == 1 ? runFlag : stopFlag.Value == 1 ? stopFlag : toolChangeFlag.Value == 1 ? toolChangeFlag : repairFlag.Value == 1 ? repairFlag : null;
+
+                            if (reg != null)
+                            {
+                                if (machineStateResumeModels.Count > 0)
+                                {
+                                    if (machineStateResumeModels[0].TagName == reg.Comment.Variable)
+                                    {
+                                        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.Clear();
+                                }
+                                InsertStateRecord(reg);
+                            }
+
+                        }
+                    }
+
+                }
                 if (e.ChangeType == DateTimeChangeType.SecondChanged & e.TimeFlag.Second % 15 == 0)
                 {
                     if (machineStateResumeModels.Count > 0)
@@ -157,30 +157,37 @@ namespace SCADA_DAQ.Customer.Machines
 
         protected override void RegReadValueChanged(object sender, RegReadValueChangedEventArgs e)
         {
+         
             base.RegReadValueChanged(sender, e);
+             var reg= (RegInfo)sender;
             if (!IsOpenTime)
             {
                 if (ConnectState == SCADA.Comm.ConnectStates.Connected)
                 {
-                     var runFlag = this.GetListenReg("运行标志位");
-                    var stopFlag = this.GetListenReg("停止标志位");
-                    var toolChangeFlag = this.GetListenReg("换模标志位");
-                    var repairFlag = this.GetListenReg("维修时间");
-                    RegInfo reg = runFlag.Value == 1 ? runFlag : stopFlag.Value == 1 ? stopFlag : toolChangeFlag.Value == 1 ? toolChangeFlag : repairFlag.Value == 1 ? repairFlag : null;
-                    if (reg != null)
-                    {
-                        InsertStateRecord(reg);
-                    }
-                  
+                    InsertStateRecord(reg);
+                                  
+
                 }                    
          
             }
 
+          
         }
 
         private void InsertStateRecord(RegInfo reg)
         {
+            var runFlag = this.GetListenReg("运行标志位");
+            var stopFlag = this.GetListenReg("停止标志位");
+            var toolChangeFlag = this.GetListenReg("换模标志位");
+            var repairFlag = this.GetListenReg("维修时间");
+            if (runFlag.Value == 0 && stopFlag.Value == 0 && toolChangeFlag.Value == 0 && repairFlag.Value == 0)
+            {
+                if (ConnectState == SCADA.Comm.ConnectStates.Connected)
+                {
+                    Log.Info($"设备名{BaseDevice.DeviceID},插入状态{0}");
+                }
 
+            }
             if (reg.Comment.Variable == "运行标志位" ||
                  reg.Comment.Variable == "停止标志位" ||
                   reg.Comment.Variable == "换模标志位" ||
@@ -284,15 +291,15 @@ namespace SCADA_DAQ.Customer.Machines
                         Log.Info($"设备名{BaseDevice.DeviceID},重连更新停止状态,记录列表有{machineStateResumeModels.Count}条数据");
                     }
 
-                    //var runFlag = this.GetListenReg("运行标志位");
-                    //var stopFlag = this.GetListenReg("停止标志位");
-                    //var toolChangeFlag = this.GetListenReg("换模标志位");
-                    //var repairFlag = this.GetListenReg("维修时间");
-                    //RegInfo reg = runFlag.Value == 1 ? runFlag : stopFlag.Value == 1 ? stopFlag : toolChangeFlag.Value == 1 ? toolChangeFlag : repairFlag.Value == 1 ? repairFlag : null;
-                    //if (reg != null)
-                    //{
-                    //    InsertStateRecord(reg);
-                    //}
+                    var runFlag = this.GetListenReg("运行标志位");
+                    var stopFlag = this.GetListenReg("停止标志位");
+                    var toolChangeFlag = this.GetListenReg("换模标志位");
+                    var repairFlag = this.GetListenReg("维修时间");
+                    RegInfo reg = runFlag.Value == 1 ? runFlag : stopFlag.Value == 1 ? stopFlag : toolChangeFlag.Value == 1 ? toolChangeFlag : repairFlag.Value == 1 ? repairFlag : null;
+                    if (reg != null)
+                    {
+                        InsertStateRecord(reg);
+                    }
 
                 }
 

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

@@ -78,7 +78,7 @@ namespace SCADA_DAQ.Customer
 
             var kimFangyuanArlamDouble = DeviceAlarmTime("金方圆数控母线冲孔机")
                 + DeviceTimeValue("金方圆数控母线冲孔机", "维修时间") + DevicMainTableTime("金方圆铜排冲剪机").TotalSeconds;
-            var highmachineArlamDouble = DeviceAlarmTime("高机母线冲剪机")
+            var highmachineArlamDouble = DeviceTimeValue("高机母线冲剪机","故障标志位")
                 + DeviceTimeValue("高机母线冲剪机", "维修时间") + DevicMainTableTime("高机铜排冲剪机").TotalSeconds;
             var kimFangyuanArlamTimeSpanString = TimeSpan.FromSeconds(Math.Round(kimFangyuanArlamDouble)).ToString();//获取金方圆铜排冲剪机设备维修时间
 
@@ -305,7 +305,7 @@ namespace SCADA_DAQ.Customer
                     });
                 }
             }
-            else
+            if(timePieces.Count() == 0)
             {
                 timePieces = new List<TimePiece>() {
 
@@ -347,7 +347,7 @@ namespace SCADA_DAQ.Customer
 
                     var kimFangyuanArlamDouble = DeviceAlarmTime("金方圆数控母线冲孔机")
                         + DeviceTimeValue("金方圆数控母线冲孔机", "维修时间") + DevicMainTableTime("金方圆铜排冲剪机").TotalSeconds;
-                    var highmachineArlamDouble = DeviceAlarmTime("高机母线冲剪机")
+                    var highmachineArlamDouble = DeviceTimeValue("高机母线冲剪机", "故障标志位")
                         + DeviceTimeValue("高机母线冲剪机", "维修时间") + DevicMainTableTime("高机铜排冲剪机").TotalSeconds;
 
                     var kimFangyuanArlamTimeSpanString = TimeSpan.FromSeconds(Math.Round(kimFangyuanArlamDouble)).ToString();//获取金方圆铜排冲剪机设备维修时间

+ 62 - 62
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmRunHistory.xaml.cs

@@ -1,5 +1,6 @@
 using DBModel;
 using DBNames;
+using Mysqlx.Crud;
 using NPOI.SS.Formula.Eval;
 using NPOI.SS.Formula.Functions;
 using SCADA.CommonCtrl.WpfControl;
@@ -46,68 +47,67 @@ namespace SCADA_DAQ.Customer
         {
             InitializeComponent();
 
-            var timeListAdd = new List<List<TimePiece>>();
-            var timeStopTime = DAL.App_Vertiv_DeviceScheduleStop.GetData<DeviceScheduleStopModel>().ToLookup(t => t.Device)["高机母线冲剪机"];
-            var timeStopPieces = new List<TimePiece>();
-            if (timeStopTime.Count() != 0)
-            {
-                foreach (var item in timeStopTime)
-                {
-                    timeStopPieces.Add(new TimePiece
-                    {
-                        StartTime = Convert.ToDateTime(item.StartTime.ToString()).TimeOfDay,
-                        EndTime = Convert.ToDateTime(item.EndTime.ToString()).TimeOfDay
-                    });
-                }
-            }
-
-            var classesStartTime = Convert.ToDateTime(DateTime.Now.ToString("00:00:00"));
-            var classesEndTime = Convert.ToDateTime(DateTime.Now.ToString("23:59:59"));
-            var informationValue = Env.SqlDAL.Base_AlarmLog.GetData<AlarmColumModel>()?.Where(t => t.CreateTime >= classesStartTime & t.CreateTime <= classesEndTime).ToLookup(t => t.Device_Str)["高机母线冲剪机"];
-
-            var classesYesterdayStartTime = Convert.ToDateTime(DateTime.Now.AddDays(-1).Date);
-            var classesDayEndTime = Convert.ToDateTime(DateTime.Now.ToString("23:59:59"));
-            var deviceValueInformation = Env.SqlDAL.Base_AlarmLog.GetData<AlarmColumModel>()?.Where(t => t.CreateTime >= classesYesterdayStartTime & t.CreateTime <= classesDayEndTime).ToLookup(t => t.Device_Str)["高机母线冲剪机"];
-
-            var timePieces = new List<TimePiece>();
-            if (deviceValueInformation.Count() != 0)
-            {
-                foreach (var item in deviceValueInformation)
-                {
-                    if (item.StartTime < Convert.ToDateTime(DateTime.Now.ToString("00:00:00")) & item.EndTime > Convert.ToDateTime(DateTime.Now.ToString("00:00:00")))
-                    {
-                        timePieces.Add(new TimePiece
-                        {
-                            StartTime = Convert.ToDateTime(DateTime.Now.ToString("00:00:00")).TimeOfDay,
-                            EndTime = item.EndTime.TimeOfDay
-                        });
-                    }
-
-                }
-
-            }
-            if (informationValue.Count() != 0)
-            {
-                foreach (var item in informationValue)
-                {
-                    timePieces.Add(new TimePiece
-                    {
-                        StartTime = item.StartTime.TimeOfDay,
-                        EndTime = item.EndTime.TimeOfDay
-                    });
-                }
-            }
-            else
-            {
-                timePieces = new List<TimePiece>() {
-
-                      new TimePiece{StartTime =TimeSpan.FromSeconds(DateTime.Now.ToOADate()) ,
-                          EndTime = TimeSpan.FromSeconds(DateTime.Now.ToOADate())},
-                     };
-            }
-
-
-            var total = TimeTotalHelper.DistinctPlanStopTime(TimeTotalHelper.DistinctTime(timePieces), timeStopPieces);
+            //    var timeListAdd = new List<List<TimePiece>>();
+            //    var timeStopTime = DAL.App_Vertiv_DeviceScheduleStop.GetData<DeviceScheduleStopModel>().ToLookup(t => t.Device)["激光机"];
+            //    var timeStopPieces = new List<TimePiece>();
+            //    if (timeStopTime.Count() != 0)
+            //    {
+            //        foreach (var item in timeStopTime)
+            //        {
+            //            timeStopPieces.Add(new TimePiece
+            //            {
+            //                StartTime = Convert.ToDateTime(item.StartTime.ToString()).TimeOfDay,
+            //                EndTime = Convert.ToDateTime(item.EndTime.ToString()).TimeOfDay
+            //            });
+            //        }
+            //    }
+
+            //    var classesStartTime = Convert.ToDateTime(DateTime.Now.ToString("00:00:00"));
+            //    var classesEndTime = Convert.ToDateTime(DateTime.Now.ToString("23:59:59"));
+            //    var informationValue = Env.SqlDAL.Base_AlarmLog.GetData<AlarmColumModel>()?.Where(t => t.CreateTime >= classesStartTime & t.CreateTime <= classesEndTime).ToLookup(t => t.Device_Str)["激光机"];
+
+            //    var classesYesterdayStartTime = Convert.ToDateTime(DateTime.Now.AddDays(-1).Date);
+            //    var classesDayEndTime = Convert.ToDateTime(DateTime.Now.ToString("23:59:59"));
+            //    var deviceValueInformation = Env.SqlDAL.Base_AlarmLog.GetData<AlarmColumModel>()?.Where(t => t.CreateTime >= classesYesterdayStartTime & t.CreateTime <= classesDayEndTime).ToLookup(t => t.Device_Str)["激光机"];
+
+            //    var timePieces = new List<TimePiece>();
+            //    if (deviceValueInformation.Count() != 0)
+            //    {
+            //        foreach (var item in deviceValueInformation)
+            //        {
+            //            if (item.StartTime < Convert.ToDateTime(DateTime.Now.ToString("00:00:00")) & item.EndTime > Convert.ToDateTime(DateTime.Now.ToString("00:00:00")))
+            //            {
+            //                timePieces.Add(new TimePiece
+            //                {
+            //                    StartTime = Convert.ToDateTime(DateTime.Now.ToString("00:00:00")).TimeOfDay,
+            //                    EndTime = item.EndTime.TimeOfDay
+            //                });
+            //            }
+
+            //        }
+
+            //    }
+            //    if (informationValue.Count() != 0)
+            //    {
+            //        foreach (var item in informationValue)
+            //        {
+            //            timePieces.Add(new TimePiece
+            //            {
+            //                StartTime = item.StartTime.TimeOfDay,
+            //                EndTime = item.EndTime.TimeOfDay
+            //            });
+            //        }
+            //    }
+
+            //   if(timePieces.Count() == 0 )
+            //    {
+            //        timePieces = new List<TimePiece>() {
+
+            //              new TimePiece{StartTime =TimeSpan.FromSeconds(DateTime.Now.ToOADate()) ,
+            //                  EndTime = TimeSpan.FromSeconds(DateTime.Now.ToOADate())},
+            //             };
+            //    }
+            //    var total = TimeTotalHelper.DistinctPlanStopTime(TimeTotalHelper.DistinctTime(timePieces), timeStopPieces);
 
 
         }

+ 2 - 1
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Views/Dashboard/LaserAndDigitalPunchingEquipmentWidget.xaml.cs

@@ -346,7 +346,8 @@ namespace SCADA_DAQ.Customer.Views.Dashboard
                     });
                 }
             }
-            else
+
+            if (timePieces.Count() == 0)
             {
                 timePieces = new List<TimePiece>() {
 

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

@@ -29,8 +29,8 @@ 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("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;