Browse Source

合并后提交

谢翼翔 1 year ago
parent
commit
0c5ebeec97

+ 184 - 121
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmKanbanForPressBrakeEquipment.xaml.cs

@@ -46,6 +46,8 @@ namespace SCADA_DAQ.Customer
     public partial class UctFrmKanbanForPressBrakeEquipment : BaseUctFrm
     {
         private static SqlSchema.DIL.DILDB DAL = Env.SqlDAL;
+
+        public int Index { get; set; }
         //private static DIL.DILDB sqliteDAL = Env.DAL;
         public UctFrmKanbanForPressBrakeEquipment()
         {
@@ -53,10 +55,22 @@ namespace SCADA_DAQ.Customer
             {
                 while (true)
                 {
-                    //点击频率  单位秒
-                    System.Threading.Thread.Sleep(10 * 60000);
-                    //方法第一个参数鼠标x的坐标,第二个参数是鼠标y的坐标
-                    MouseFlag.MouseLeftClickEvent(1401, 1061, 0);
+                    //点击频率  单位豪秒
+                    System.Threading.Thread.Sleep(30 * 1000);
+                    
+                    if (Index == 0)
+                    {
+                        //方法第一个参数鼠标x的坐标,第二个参数是鼠标y的坐标
+                        MouseFlag.MouseLeftClickEvent(500, 500, 0);
+                        Index++;
+                    }
+                    else
+                    {
+                        MouseFlag.MouseLeftClickEvent(800, 500, 0);
+                        Index = 0;  
+                    }
+                    
+                    
 
                 }
             });
@@ -100,6 +114,21 @@ namespace SCADA_DAQ.Customer
                 "维保时间:"};
 
 
+            //var firstYaWeiRunTime = DeviceTimeValue("1号YaWei折弯机", "运行标志位") - DeviceStateCodeStopBetweenTime("1号YaWei折弯机", "运行标志位");//1号YaWei折弯机运行时间
+            //var firstYaWeiMoldTime = DeviceTimeValue("1号YaWei折弯机", "换模标志位") - DeviceStateCodeStopBetweenTime("1号YaWei折弯机", "换模标志位");//1号YaWei折弯机换模时间
+
+            //var sencondYaWeiRunTime = DeviceTimeValue("2号YaWei折弯机", "运行标志位") - DeviceStateCodeStopBetweenTime("2号YaWei折弯机", "运行标志位");//2号YaWei折弯机运行时间
+            //var sencondYaWeiMoldTime = DeviceTimeValue("2号YaWei折弯机", "换模标志位") - DeviceStateCodeStopBetweenTime("2号YaWei折弯机", "换模标志位");//2号YaWei折弯机换模时间
+
+            //var thirdYaWweiRunTime = DeviceTimeValue("3号YaWei折弯机", "运行标志位") - DeviceStateCodeStopBetweenTime("3号YaWei折弯机", "运行标志位"); ;//3号YaWei折弯机运行时间
+            //var thirdYaWweiMoldTime = DeviceTimeValue("3号YaWei折弯机", "换模标志位") - DeviceStateCodeStopBetweenTime("3号YaWei折弯机", "换模标志位");//3号YaWei折弯机换模时间
+
+            //var pbcYaWweiRunTime = DeviceTimeValue("亚威PBC折弯机", "运行标志位") - DeviceStateCodeStopBetweenTime("亚威PBC折弯机", "运行标志位"); ;//亚威PBC折弯机运行时间
+            //var pbcYaWweiMoldTime = DeviceTimeValue("亚威PBC折弯机", "换模标志位") - DeviceStateCodeStopBetweenTime("亚威PBC折弯机", "换模标志位");//亚威PBC折弯机换模时间
+
+            //var baiChaoRunTime = DeviceTimeValue("百超折弯机", "运行标志位") - DeviceStateCodeStopBetweenTime("百超折弯机", "运行标志位"); ;//百超折弯机运行时间
+            //var baiChaoMoldTime = DeviceTimeValue("百超折弯机", "换模标志位") - DeviceStateCodeStopBetweenTime("百超折弯机", "换模标志位");//百超折弯机换模时间
+
             var firstYaWeiRunTime = DeviceTimeValue("1号YaWei折弯机", "运行标志位");//1号YaWei折弯机运行时间
             var firstYaWeiMoldTime = DeviceTimeValue("1号YaWei折弯机", "换模标志位");//1号YaWei折弯机换模时间
 
@@ -122,6 +151,28 @@ namespace SCADA_DAQ.Customer
             var pbcYaWweiRepairTime = "倒计时" + DeviceRepairTime("亚威PBC折弯机").ToString() + "天";//亚威PBC折弯机设备保养信息
             var baiChaoRepairTime = "倒计时" + DeviceRepairTime("百超折弯机").ToString() + "天";//百超折弯机设备保养信息
 
+            //var firstYaWeiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威一号折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("1号YaWei折弯机", "维修时间"))
+            //    - TimeSpan.FromSeconds(DeviceStateCodeStopBetweenTime("1号YaWei折弯机", "维修时间")));
+            //var secondYaWeiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威二号折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("2号YaWei折弯机", "维修时间"))
+            //    - TimeSpan.FromSeconds(DeviceStateCodeStopBetweenTime("2号YaWei折弯机", "维修时间")));
+            //var thirdYaWeiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威三号折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("3号YaWei折弯机", "维修时间"))
+            //    - TimeSpan.FromSeconds(DeviceStateCodeStopBetweenTime("3号YaWei折弯机", "维修时间")));
+            //var pbcYaWweiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威PBC折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("亚威PBC折弯机", "维修时间"))
+            //    - TimeSpan.FromSeconds(DeviceStateCodeStopBetweenTime("亚威PBC折弯机", "维修时间")));
+            //var baiChaoTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("百超折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("百超折弯机", "维修时间"))
+            //    - TimeSpan.FromSeconds(DeviceStateCodeStopBetweenTime("百超折弯机", "维修时间")));
+
+            //double totalTimeOfDay = TimeSpan.Parse(DateTime.Now.ToString("HH:mm:ss")).TotalSeconds;
+            //var firstYaWeiStopTime = totalTimeOfDay - firstYaWeiRunTime - firstYaWeiMoldTime - DevicScheduleStop("1号YaWei折弯机")
+            //    - DevicMainTableTime("亚威一号折弯机").TotalSeconds - DeviceTimeValue("1号YaWei折弯机", "维修时间") + DeviceStateCodeStopBetweenTime("1号YaWei折弯机", "维修时间");//1号YaWei折弯机等待时间
+            //var sencondYaWeiStopTime = totalTimeOfDay - sencondYaWeiRunTime - sencondYaWeiMoldTime - DevicScheduleStop("2号YaWei折弯机")
+            //    - DevicMainTableTime("亚威二号折弯机").TotalSeconds - DeviceTimeValue("2号YaWei折弯机", "维修时间") + DeviceStateCodeStopBetweenTime("2号YaWei折弯机", "维修时间");//2号YaWei折弯机等待时间
+            //var thirdYaWweiStopTime = totalTimeOfDay - thirdYaWweiRunTime - thirdYaWweiMoldTime - DevicScheduleStop("3号YaWei折弯机")
+            //    - DevicMainTableTime("亚威三号折弯机").TotalSeconds - DeviceTimeValue("3号YaWei折弯机", "维修时间") + DeviceStateCodeStopBetweenTime("3号YaWei折弯机", "维修时间"); //3号YaWei折弯机等待时间
+            //var pbcYaWweiStopTime = totalTimeOfDay - pbcYaWweiRunTime - pbcYaWweiMoldTime - DevicScheduleStop("亚威PBC折弯机")
+            //    - DevicMainTableTime("亚威PBC折弯机").TotalSeconds - DeviceTimeValue("亚威PBC折弯机", "维修时间") + DeviceStateCodeStopBetweenTime("亚威PBC折弯机", "维修时间");//亚威PBC折弯机等待时间
+            //var baiChaoStopTime = totalTimeOfDay - baiChaoRunTime - baiChaoMoldTime - DevicScheduleStop("百超折弯机")
+            //    - DevicMainTableTime("百超折弯机").TotalSeconds - DeviceTimeValue("百超折弯机", "维修时间") + DeviceStateCodeStopBetweenTime("百超折弯机", "维修时间");//百超折弯机折弯机等待时间
 
             var firstYaWeiTimeMaintenanceTableDouble = DevicMainTableTime("亚威一号折弯机").TotalSeconds + DeviceTimeValue("1号YaWei折弯机", "维修时间");
             var secondYaWeiTimeMaintenanceTableDouble = DevicMainTableTime("亚威二号折弯机").TotalSeconds + DeviceTimeValue("2号YaWei折弯机", "维修时间");
@@ -187,13 +238,13 @@ namespace SCADA_DAQ.Customer
             KanbanForPressBrakeEquipmentFour.DeviceNameOne.Value = pbcYaWweiRunTimeSpan;
             KanbanForPressBrakeEquipmentFour.DeviceNameTwo.Value = pbcYaWweiStopTimeSpan;
             KanbanForPressBrakeEquipmentFour.DeviceNameThree.Value = pbcYaWweiTimeMaintenanceTable;
-            KanbanForPressBrakeEquipmentFour.DeviceNameFour.Value = pbcYaWweiMoldTimeSpan;
+            KanbanForPressBrakeEquipmentFour.DeviceNameFour.Value =  pbcYaWweiMoldTimeSpan;
             KanbanForPressBrakeEquipmentFour.DeviceNameFive.Value = pbcYaWweiRepairTime;
 
             KanbanForPressBrakeEquipmentFive.DeviceNameOne.Value = baiChaoRunTimeSpan;
             KanbanForPressBrakeEquipmentFive.DeviceNameTwo.Value = baiChaoStopTimeSpan;
             KanbanForPressBrakeEquipmentFive.DeviceNameThree.Value = baiChaoTimeMaintenanceTable;
-            KanbanForPressBrakeEquipmentFive.DeviceNameFour.Value = baiChaoMoldTimeSpan;
+            KanbanForPressBrakeEquipmentFive.DeviceNameFour.Value =  baiChaoMoldTimeSpan;
             KanbanForPressBrakeEquipmentFive.DeviceNameFive.Value = baiChaoRepairTime;
             Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
         }
@@ -201,7 +252,10 @@ namespace SCADA_DAQ.Customer
         public List<MachineInfoModel> deviceInformation { get; set; }
         public void GetDBData()//设备运行状态时间
         {
-
+            //var classesStartTimeSpan = Env.Schedual.CurrentClasses.StartTime.ToString();
+            //var classesEndTimeSpan = Env.Schedual.CurrentClasses.EndTime.ToString();
+            //var classesStartTime = Convert.ToDateTime(classesStartTimeSpan);
+            //var classesEndTime = Convert.ToDateTime(classesEndTimeSpan);
             var classesStartTime = Convert.ToDateTime(DateTime.Now.ToString("00:00:00"));
             var classesEndTime = Convert.ToDateTime(DateTime.Now.ToString("23:59:59"));
             //获取当天所有设备信息
@@ -211,7 +265,9 @@ namespace SCADA_DAQ.Customer
         }
         public double DeviceTimeValue(string deviceName, string StateCode)//设备运行状态时间
         {
-
+            //获取当天所有设备信息
+            //var deviceInformation = DAL.App_Vertiv_MachineInfo.GetData<MachineInfoModel>()?.Where(t => t.CreateTime.Date == DateTime.Now.Date);
+            //var tt = deviceInformation.Where(m => m.CreateTime >= dateNightStratTime & m.CreateTime <= dateNightEndTime);
             var keepTime = deviceInformation.ToLookup(t => t.Device)[deviceName].ToLookup(t => t.StateCode)[StateCode].Sum(t => t.DurationSec);
             return Convert.ToDouble(keepTime);
         }
@@ -219,7 +275,10 @@ namespace SCADA_DAQ.Customer
         public List<MaintenanceTableModel> deviceMaintenanceTable { get; set; }
         public void GetTableTime()
         {
-
+            //var classesStartTimeSpan = Env.Schedual.CurrentClasses.StartTime.ToString();
+            //var classesEndTimeSpan = Env.Schedual.CurrentClasses.EndTime.ToString();
+            //var classesStartTime = Convert.ToDateTime(classesStartTimeSpan);
+            //var classesEndTime = Convert.ToDateTime(classesEndTimeSpan);
             var classesStartTime = Convert.ToDateTime(DateTime.Now.ToString("00:00:00"));
             var classesEndTime = Convert.ToDateTime(DateTime.Now.ToString("23:59:59"));
 
@@ -355,122 +414,126 @@ namespace SCADA_DAQ.Customer
         private void Schedual_DateTimeChanged(object sender, SCADA.CommonLib.DateTimeChangedArgs e)
         {
 
-
-            if (e.ChangeType == SCADA.CommonLib.DateTimeChangeType.SecondChanged &&
-                        e.TimeFlag.Second % 16 == 0)
+            try
             {
-                System.GC.Collect(2);
-                GetDBData();
-                GetTableTime();
-                GetRepairTime();
-                GetScheduleStopTime();
-                GetDeviceScheduleStopBetweenTime();
-
-                var firstYaWeiRunTime = DeviceTimeValue("1号YaWei折弯机", "运行标志位");//1号YaWei折弯机运行时间
-                var firstYaWeiMoldTime = DeviceTimeValue("1号YaWei折弯机", "换模标志位");//1号YaWei折弯机换模时间
-
-                var sencondYaWeiRunTime = DeviceTimeValue("2号YaWei折弯机", "运行标志位");//2号YaWei折弯机运行时间
-                var sencondYaWeiMoldTime = DeviceTimeValue("2号YaWei折弯机", "换模标志位");//2号YaWei折弯机换模时间
-
-                var thirdYaWweiRunTime = DeviceTimeValue("3号YaWei折弯机", "运行标志位");//3号YaWei折弯机运行时间
-                var thirdYaWweiMoldTime = DeviceTimeValue("3号YaWei折弯机", "换模标志位");//3号YaWei折弯机换模时间
-
-                var pbcYaWweiRunTime = DeviceTimeValue("亚威PBC折弯机", "运行标志位");//亚威PBC折弯机运行时间
-                var pbcYaWweiMoldTime = DeviceTimeValue("亚威PBC折弯机", "换模标志位");//亚威PBC折弯机换模时间
-
-                var baiChaoRunTime = DeviceTimeValue("百超折弯机", "运行标志位");//百超折弯机运行时间
-                var baiChaoMoldTime = DeviceTimeValue("百超折弯机", "换模标志位");//百超折弯机换模时间
-
-
-                var firstYaWeiRepairTime = "倒计时" + DeviceRepairTime("亚威一号折弯机").ToString() + "天";//亚威一号折弯机设备保养信息
-                var secondYaWeiRepairTime = "倒计时" + DeviceRepairTime("亚威二号折弯机").ToString() + "天";//亚威二号折弯机设备保养信息
-                var thirdYaWeiRepairTime = "倒计时" + DeviceRepairTime("亚威三号折弯机").ToString() + "天";//亚威三号折弯机设备保养信息
-                var pbcYaWweiRepairTime = "倒计时" + DeviceRepairTime("亚威PBC折弯机").ToString() + "天";//亚威PBC折弯机设备保养信息
-                var baiChaoRepairTime = "倒计时" + DeviceRepairTime("百超折弯机").ToString() + "天";//百超折弯机设备保养信息
-
-                //var firstYaWeiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威一号折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("1号YaWei折弯机", "维修时间")));
-                //var secondYaWeiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威二号折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("2号YaWei折弯机", "维修时间")));
-                //var thirdYaWeiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威三号折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("3号YaWei折弯机", "维修时间")));
-                //var pbcYaWweiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威PBC折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("亚威PBC折弯机", "维修时间")));
-                //var baiChaoTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("百超折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("百超折弯机", "维修时间")));
-
-                var firstYaWeiTimeMaintenanceTableDouble = DevicMainTableTime("亚威一号折弯机").TotalSeconds + DeviceTimeValue("1号YaWei折弯机", "维修时间");
-                var secondYaWeiTimeMaintenanceTableDouble = DevicMainTableTime("亚威二号折弯机").TotalSeconds + DeviceTimeValue("2号YaWei折弯机", "维修时间");
-                var thirdYaWeiTimeMaintenanceTableDouble = DevicMainTableTime("亚威三号折弯机").TotalSeconds + DeviceTimeValue("3号YaWei折弯机", "维修时间");
-                var pbcYaWweiTimeMaintenanceTableDouble = DevicMainTableTime("亚威PBC折弯机").TotalSeconds + DeviceTimeValue("亚威PBC折弯机", "维修时间");
-                var baiChaoTimeMaintenanceTableDouble = DevicMainTableTime("百超折弯机").TotalSeconds + DeviceTimeValue("百超折弯机", "维修时间");
-
-                var firstYaWeiTimeMaintenanceTable = TimeSpan.FromSeconds(Math.Round(firstYaWeiTimeMaintenanceTableDouble)).ToString();
-                var secondYaWeiTimeMaintenanceTable = TimeSpan.FromSeconds(Math.Round(secondYaWeiTimeMaintenanceTableDouble)).ToString();
-                var thirdYaWeiTimeMaintenanceTable = TimeSpan.FromSeconds(Math.Round(thirdYaWeiTimeMaintenanceTableDouble)).ToString();
-                var pbcYaWweiTimeMaintenanceTable = TimeSpan.FromSeconds(Math.Round(pbcYaWweiTimeMaintenanceTableDouble)).ToString();
-                var baiChaoTimeMaintenanceTable = TimeSpan.FromSeconds(Math.Round(baiChaoTimeMaintenanceTableDouble)).ToString();
-
-                var firstYaWeiStopTime = DeviceTimeValue("1号YaWei折弯机", "停止标志位") - DevicMainTableTime("亚威一号折弯机").TotalSeconds;//1号YaWei折弯机等待时间
-                var sencondYaWeiStopTime = DeviceTimeValue("2号YaWei折弯机", "停止标志位") - DevicMainTableTime("亚威二号折弯机").TotalSeconds;//2号YaWei折弯机等待时间
-                var thirdYaWweiStopTime = DeviceTimeValue("3号YaWei折弯机", "停止标志位") - DevicMainTableTime("亚威三号折弯机").TotalSeconds; //3号YaWei折弯机等待时间
-                var pbcYaWweiStopTime = DeviceTimeValue("亚威PBC折弯机", "停止标志位") - DevicMainTableTime("亚威PBC折弯机").TotalSeconds;//亚威PBC折弯机等待时间
-                var baiChaoStopTime = DeviceTimeValue("百超折弯机", "停止标志位") - DevicMainTableTime("百超折弯机").TotalSeconds;//百超折弯机折弯机等待时间
-
-                var firstYaWeiRunTimeSpan = TimeSpan.FromSeconds(Math.Round(firstYaWeiRunTime)).ToString();
-                var firstYaWeiStopTimeSpan = TimeSpan.FromSeconds(Math.Round(firstYaWeiStopTime)).ToString();
-                var firstYaWeiMoldTimeSpan = TimeSpan.FromSeconds(Math.Round(firstYaWeiMoldTime)).ToString();
-
-                var sencondYaWeiRunTimeSpan = TimeSpan.FromSeconds(Math.Round(sencondYaWeiRunTime)).ToString();
-                var sencondYaWeiStopTimeSpan = TimeSpan.FromSeconds(Math.Round(sencondYaWeiStopTime)).ToString();
-                var sencondYaWeiMoldTimeSpan = TimeSpan.FromSeconds(Math.Round(sencondYaWeiMoldTime)).ToString();
-
-
-                var thirdYaWweiRunTimeSpan = TimeSpan.FromSeconds(Math.Round(thirdYaWweiRunTime)).ToString();
-                var thirdYaWweiStopTimeSpan = TimeSpan.FromSeconds(Math.Round(thirdYaWweiStopTime)).ToString();
-                var thirdYaWweiMoldTimeSpan = TimeSpan.FromSeconds(Math.Round(thirdYaWweiMoldTime)).ToString();
-
-
-                var pbcYaWweiRunTimeSpan = TimeSpan.FromSeconds(Math.Round(pbcYaWweiRunTime)).ToString();
-                var pbcYaWweiStopTimeSpan = TimeSpan.FromSeconds(Math.Round(pbcYaWweiStopTime)).ToString();
-                var pbcYaWweiMoldTimeSpan = TimeSpan.FromSeconds(Math.Round(pbcYaWweiMoldTime)).ToString();
-
-
-                var baiChaoRunTimeSpan = TimeSpan.FromSeconds(Math.Round(baiChaoRunTime)).ToString();
-                var baiChaoStopTimeSpan = TimeSpan.FromSeconds(Math.Round(baiChaoStopTime)).ToString();
-                var baiChaoMoldTimeSpan = TimeSpan.FromSeconds(Math.Round(baiChaoMoldTime)).ToString();
-
-                // 委托
-                Dispatcher.Invoke(new Action(() =>
+                if (e.ChangeType == SCADA.CommonLib.DateTimeChangeType.SecondChanged &&
+                            e.TimeFlag.Second % 16 == 0)
                 {
-                    KanbanForPressBrakeEquipmentOne.DeviceNameOne.Value = firstYaWeiRunTimeSpan;
-                    KanbanForPressBrakeEquipmentOne.DeviceNameTwo.Value = firstYaWeiStopTimeSpan;
-                    KanbanForPressBrakeEquipmentOne.DeviceNameThree.Value = firstYaWeiTimeMaintenanceTable;
-                    KanbanForPressBrakeEquipmentOne.DeviceNameFour.Value = firstYaWeiMoldTimeSpan;
-                    KanbanForPressBrakeEquipmentOne.DeviceNameFive.Value = firstYaWeiRepairTime;
-
-                    KanbanForPressBrakeEquipmentTwo.DeviceNameOne.Value = sencondYaWeiRunTimeSpan;
-                    KanbanForPressBrakeEquipmentTwo.DeviceNameTwo.Value = sencondYaWeiStopTimeSpan;
-                    KanbanForPressBrakeEquipmentTwo.DeviceNameThree.Value = secondYaWeiTimeMaintenanceTable;
-                    KanbanForPressBrakeEquipmentTwo.DeviceNameFour.Value = sencondYaWeiMoldTimeSpan;
-                    KanbanForPressBrakeEquipmentTwo.DeviceNameFive.Value = secondYaWeiRepairTime;
-
-                    KanbanForPressBrakeEquipmentThree.DeviceNameOne.Value = thirdYaWweiRunTimeSpan;
-                    KanbanForPressBrakeEquipmentThree.DeviceNameTwo.Value = thirdYaWweiStopTimeSpan;
-                    KanbanForPressBrakeEquipmentThree.DeviceNameThree.Value = thirdYaWeiTimeMaintenanceTable;
-                    KanbanForPressBrakeEquipmentThree.DeviceNameFour.Value = thirdYaWweiMoldTimeSpan;
-                    KanbanForPressBrakeEquipmentThree.DeviceNameFive.Value = thirdYaWeiRepairTime;
-
-                    KanbanForPressBrakeEquipmentFour.DeviceNameOne.Value = pbcYaWweiRunTimeSpan;
-                    KanbanForPressBrakeEquipmentFour.DeviceNameTwo.Value = pbcYaWweiStopTimeSpan;
-                    KanbanForPressBrakeEquipmentFour.DeviceNameThree.Value = pbcYaWweiTimeMaintenanceTable;
-                    KanbanForPressBrakeEquipmentFour.DeviceNameFour.Value = pbcYaWweiMoldTimeSpan;
-                    KanbanForPressBrakeEquipmentFour.DeviceNameFive.Value = pbcYaWweiRepairTime;
-
-                    KanbanForPressBrakeEquipmentFive.DeviceNameOne.Value = baiChaoRunTimeSpan;
-                    KanbanForPressBrakeEquipmentFive.DeviceNameTwo.Value = baiChaoStopTimeSpan;
-                    KanbanForPressBrakeEquipmentFive.DeviceNameThree.Value = baiChaoTimeMaintenanceTable;
-                    KanbanForPressBrakeEquipmentFive.DeviceNameFour.Value = baiChaoMoldTimeSpan;
-                    KanbanForPressBrakeEquipmentFive.DeviceNameFive.Value = baiChaoRepairTime;
-                }));
+                    GetDBData();
+                    GetTableTime();
+                    GetRepairTime();
+                    GetScheduleStopTime();
+                    GetDeviceScheduleStopBetweenTime();
+
+                    var firstYaWeiRunTime = DeviceTimeValue("1号YaWei折弯机", "运行标志位");//1号YaWei折弯机运行时间
+                    var firstYaWeiMoldTime = DeviceTimeValue("1号YaWei折弯机", "换模标志位");//1号YaWei折弯机换模时间
+
+                    var sencondYaWeiRunTime = DeviceTimeValue("2号YaWei折弯机", "运行标志位");//2号YaWei折弯机运行时间
+                    var sencondYaWeiMoldTime = DeviceTimeValue("2号YaWei折弯机", "换模标志位");//2号YaWei折弯机换模时间
+
+                    var thirdYaWweiRunTime = DeviceTimeValue("3号YaWei折弯机", "运行标志位");//3号YaWei折弯机运行时间
+                    var thirdYaWweiMoldTime = DeviceTimeValue("3号YaWei折弯机", "换模标志位");//3号YaWei折弯机换模时间
+
+                    var pbcYaWweiRunTime = DeviceTimeValue("亚威PBC折弯机", "运行标志位");//亚威PBC折弯机运行时间
+                    var pbcYaWweiMoldTime = DeviceTimeValue("亚威PBC折弯机", "换模标志位");//亚威PBC折弯机换模时间
+
+                    var baiChaoRunTime = DeviceTimeValue("百超折弯机", "运行标志位");//百超折弯机运行时间
+                    var baiChaoMoldTime = DeviceTimeValue("百超折弯机", "换模标志位");//百超折弯机换模时间
+
+
+                    var firstYaWeiRepairTime = "倒计时" + DeviceRepairTime("亚威一号折弯机").ToString() + "天";//亚威一号折弯机设备保养信息
+                    var secondYaWeiRepairTime = "倒计时" + DeviceRepairTime("亚威二号折弯机").ToString() + "天";//亚威二号折弯机设备保养信息
+                    var thirdYaWeiRepairTime = "倒计时" + DeviceRepairTime("亚威三号折弯机").ToString() + "天";//亚威三号折弯机设备保养信息
+                    var pbcYaWweiRepairTime = "倒计时" + DeviceRepairTime("亚威PBC折弯机").ToString() + "天";//亚威PBC折弯机设备保养信息
+                    var baiChaoRepairTime = "倒计时" + DeviceRepairTime("百超折弯机").ToString() + "天";//百超折弯机设备保养信息
+
+                    //var firstYaWeiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威一号折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("1号YaWei折弯机", "维修时间")));
+                    //var secondYaWeiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威二号折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("2号YaWei折弯机", "维修时间")));
+                    //var thirdYaWeiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威三号折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("3号YaWei折弯机", "维修时间")));
+                    //var pbcYaWweiTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("亚威PBC折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("亚威PBC折弯机", "维修时间")));
+                    //var baiChaoTimeMaintenanceTable = Convert.ToString(DevicMainTableTime("百超折弯机") + TimeSpan.FromSeconds(DeviceTimeValue("百超折弯机", "维修时间")));
+
+                    var firstYaWeiTimeMaintenanceTableDouble = DevicMainTableTime("亚威一号折弯机").TotalSeconds + DeviceTimeValue("1号YaWei折弯机", "维修时间");
+                    var secondYaWeiTimeMaintenanceTableDouble = DevicMainTableTime("亚威二号折弯机").TotalSeconds + DeviceTimeValue("2号YaWei折弯机", "维修时间");
+                    var thirdYaWeiTimeMaintenanceTableDouble = DevicMainTableTime("亚威三号折弯机").TotalSeconds + DeviceTimeValue("3号YaWei折弯机", "维修时间");
+                    var pbcYaWweiTimeMaintenanceTableDouble = DevicMainTableTime("亚威PBC折弯机").TotalSeconds + DeviceTimeValue("亚威PBC折弯机", "维修时间");
+                    var baiChaoTimeMaintenanceTableDouble = DevicMainTableTime("百超折弯机").TotalSeconds + DeviceTimeValue("百超折弯机", "维修时间");
+
+                    var firstYaWeiTimeMaintenanceTable = TimeSpan.FromSeconds(Math.Round(firstYaWeiTimeMaintenanceTableDouble)).ToString();
+                    var secondYaWeiTimeMaintenanceTable = TimeSpan.FromSeconds(Math.Round(secondYaWeiTimeMaintenanceTableDouble)).ToString();
+                    var thirdYaWeiTimeMaintenanceTable = TimeSpan.FromSeconds(Math.Round(thirdYaWeiTimeMaintenanceTableDouble)).ToString();
+                    var pbcYaWweiTimeMaintenanceTable = TimeSpan.FromSeconds(Math.Round(pbcYaWweiTimeMaintenanceTableDouble)).ToString();
+                    var baiChaoTimeMaintenanceTable = TimeSpan.FromSeconds(Math.Round(baiChaoTimeMaintenanceTableDouble)).ToString();
+
+                    var firstYaWeiStopTime = DeviceTimeValue("1号YaWei折弯机", "停止标志位") - DevicMainTableTime("亚威一号折弯机").TotalSeconds;//1号YaWei折弯机等待时间
+                    var sencondYaWeiStopTime = DeviceTimeValue("2号YaWei折弯机", "停止标志位") - DevicMainTableTime("亚威二号折弯机").TotalSeconds;//2号YaWei折弯机等待时间
+                    var thirdYaWweiStopTime = DeviceTimeValue("3号YaWei折弯机", "停止标志位") - DevicMainTableTime("亚威三号折弯机").TotalSeconds; //3号YaWei折弯机等待时间
+                    var pbcYaWweiStopTime = DeviceTimeValue("亚威PBC折弯机", "停止标志位") - DevicMainTableTime("亚威PBC折弯机").TotalSeconds;//亚威PBC折弯机等待时间
+                    var baiChaoStopTime = DeviceTimeValue("百超折弯机", "停止标志位") - DevicMainTableTime("百超折弯机").TotalSeconds;//百超折弯机折弯机等待时间
+
+                    var firstYaWeiRunTimeSpan = TimeSpan.FromSeconds(Math.Round(firstYaWeiRunTime)).ToString();
+                    var firstYaWeiStopTimeSpan = TimeSpan.FromSeconds(Math.Round(firstYaWeiStopTime)).ToString();
+                    var firstYaWeiMoldTimeSpan = TimeSpan.FromSeconds(Math.Round(firstYaWeiMoldTime)).ToString();
+
+                    var sencondYaWeiRunTimeSpan = TimeSpan.FromSeconds(Math.Round(sencondYaWeiRunTime)).ToString();
+                    var sencondYaWeiStopTimeSpan = TimeSpan.FromSeconds(Math.Round(sencondYaWeiStopTime)).ToString();
+                    var sencondYaWeiMoldTimeSpan = TimeSpan.FromSeconds(Math.Round(sencondYaWeiMoldTime)).ToString();
+
+
+                    var thirdYaWweiRunTimeSpan = TimeSpan.FromSeconds(Math.Round(thirdYaWweiRunTime)).ToString();
+                    var thirdYaWweiStopTimeSpan = TimeSpan.FromSeconds(Math.Round(thirdYaWweiStopTime)).ToString();
+                    var thirdYaWweiMoldTimeSpan = TimeSpan.FromSeconds(Math.Round(thirdYaWweiMoldTime)).ToString();
+
+
+                    var pbcYaWweiRunTimeSpan = TimeSpan.FromSeconds(Math.Round(pbcYaWweiRunTime)).ToString();
+                    var pbcYaWweiStopTimeSpan = TimeSpan.FromSeconds(Math.Round(pbcYaWweiStopTime)).ToString();
+                    var pbcYaWweiMoldTimeSpan = TimeSpan.FromSeconds(Math.Round(pbcYaWweiMoldTime)).ToString();
+
+
+                    var baiChaoRunTimeSpan = TimeSpan.FromSeconds(Math.Round(baiChaoRunTime)).ToString();
+                    var baiChaoStopTimeSpan = TimeSpan.FromSeconds(Math.Round(baiChaoStopTime)).ToString();
+                    var baiChaoMoldTimeSpan = TimeSpan.FromSeconds(Math.Round(baiChaoMoldTime)).ToString();
+
+                    // 委托
+                    Dispatcher.Invoke(new Action(() =>
+                    {
+                        KanbanForPressBrakeEquipmentOne.DeviceNameOne.Value = firstYaWeiRunTimeSpan;
+                        KanbanForPressBrakeEquipmentOne.DeviceNameTwo.Value = firstYaWeiStopTimeSpan;
+                        KanbanForPressBrakeEquipmentOne.DeviceNameThree.Value = firstYaWeiTimeMaintenanceTable;
+                        KanbanForPressBrakeEquipmentOne.DeviceNameFour.Value = firstYaWeiMoldTimeSpan;
+                        KanbanForPressBrakeEquipmentOne.DeviceNameFive.Value = firstYaWeiRepairTime;
+
+                        KanbanForPressBrakeEquipmentTwo.DeviceNameOne.Value = sencondYaWeiRunTimeSpan;
+                        KanbanForPressBrakeEquipmentTwo.DeviceNameTwo.Value = sencondYaWeiStopTimeSpan;
+                        KanbanForPressBrakeEquipmentTwo.DeviceNameThree.Value = secondYaWeiTimeMaintenanceTable;
+                        KanbanForPressBrakeEquipmentTwo.DeviceNameFour.Value = sencondYaWeiMoldTimeSpan;
+                        KanbanForPressBrakeEquipmentTwo.DeviceNameFive.Value = secondYaWeiRepairTime;
+
+                        KanbanForPressBrakeEquipmentThree.DeviceNameOne.Value = thirdYaWweiRunTimeSpan;
+                        KanbanForPressBrakeEquipmentThree.DeviceNameTwo.Value = thirdYaWweiStopTimeSpan;
+                        KanbanForPressBrakeEquipmentThree.DeviceNameThree.Value = thirdYaWeiTimeMaintenanceTable;
+                        KanbanForPressBrakeEquipmentThree.DeviceNameFour.Value = thirdYaWweiMoldTimeSpan;
+                        KanbanForPressBrakeEquipmentThree.DeviceNameFive.Value = thirdYaWeiRepairTime;
+
+                        KanbanForPressBrakeEquipmentFour.DeviceNameOne.Value = pbcYaWweiRunTimeSpan;
+                        KanbanForPressBrakeEquipmentFour.DeviceNameTwo.Value = pbcYaWweiStopTimeSpan;
+                        KanbanForPressBrakeEquipmentFour.DeviceNameThree.Value = pbcYaWweiTimeMaintenanceTable;
+                        KanbanForPressBrakeEquipmentFour.DeviceNameFour.Value = pbcYaWweiMoldTimeSpan;
+                        KanbanForPressBrakeEquipmentFour.DeviceNameFive.Value = pbcYaWweiRepairTime;
+
+                        KanbanForPressBrakeEquipmentFive.DeviceNameOne.Value = baiChaoRunTimeSpan;
+                        KanbanForPressBrakeEquipmentFive.DeviceNameTwo.Value = baiChaoStopTimeSpan;
+                        KanbanForPressBrakeEquipmentFive.DeviceNameThree.Value = baiChaoTimeMaintenanceTable;
+                        KanbanForPressBrakeEquipmentFive.DeviceNameFour.Value = baiChaoMoldTimeSpan;
+                        KanbanForPressBrakeEquipmentFive.DeviceNameFive.Value = baiChaoRepairTime;
+                    }));
+                }
             }
 
-
+            catch (Exception ex)
+            {
+                Log.Warn(ex.ToString());
+            }
             if (e.ChangeType.HasFlag(DateTimeChangeType.MinuteChanged))
             {
                 Dispatcher.BeginInvoke(new Action(() =>