Browse Source

临时提交

谢翼翔 1 year ago
parent
commit
de0ddc773a
13 changed files with 594 additions and 706 deletions
  1. 6 6
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Machines/SampleMachine.cs
  2. 109 0
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Models/OEEData/TimeUtilizationRate.cs
  3. 63 388
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Service/CustomerService.cs
  4. 35 0
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmBendDeviceOeeInformation.xaml
  5. 165 0
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmBendDeviceOeeInformation.xaml.cs
  6. 0 9
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmDeviceOeeInformation.xaml
  7. 17 29
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmDeviceOeeInformation.xaml.cs
  8. 1 1
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmDeviceOeeQuery.xaml.cs
  9. 117 166
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmKanbanForPressBrakeEquipment.xaml.cs
  10. 1 0
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Views/Dashboard/LaserAndDigitalPunchingEquipmentWidget.xaml.cs
  11. 72 105
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Views/Dashboard/YaweiPressBrakeOneWidget.xaml.cs
  12. 2 2
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Env.cs
  13. 6 0
      skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/SCADA_DAQ.csproj.user

+ 6 - 6
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Machines/SampleMachine.cs

@@ -213,12 +213,12 @@ namespace SCADA_DAQ.Customer.Machines
                 BendOn = false;
                 if (!string.IsNullOrEmpty(OrgID))
                 {
-                    Env.SqlDAL.App_Vertiv_ScheduleStop.Update(
-                        $"{T_Col_Name.App_Vertiv_ScheduleStop.StateId_Str} = '{OrgID}'",
-                        new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.EndTime_Dt, DateTime.Now),
-                        new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.Duration_Dt, DateTime.Now - StartTime)
-                        );
-                    OrgID = null;
+                    //    Env.SqlDAL.App_Vertiv_ScheduleStop.Update(
+                    //        $"{T_Col_Name.App_Vertiv_ScheduleStop.StateId_Str} = '{OrgID}'",
+                    //        new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.EndTime_Dt, DateTime.Now),
+                    //        new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.Duration_Dt, DateTime.Now - StartTime)
+                    //        );
+                    //    OrgID = null;
                 }
 
             }

+ 109 - 0
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Models/OEEData/TimeUtilizationRate.cs

@@ -0,0 +1,109 @@
+using LiveCharts;
+using SCADA.CommonLib.Helper;
+using SCADA.CommonLib;
+using SCADA;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SCADA_DAQ.Customer.Models.OEEData
+{
+    public class TimeUtilizationRate:ObservableObject
+    {
+        public OeeProperty DeviceOeePercenValue = new OeeProperty();
+        public void TenOeeChart()
+        {
+           
+        }
+
+        public void OeeChart(string deviceName, IList<string> DeviceAisxX, IChartValues DeviceAxisY)
+        {
+
+            var listdouble = OeePercent(deviceName);
+            for (int i = 0; i < listdouble.Count; i++)
+            {
+                DeviceAxisY.Add(listdouble[i]);
+                DeviceAisxX.Add(((i + 1).ToString() + "日"));
+
+            }
+            DeviceOeePercenValue.ChartOeeAxisYList = new ChartValues<double>();
+            DeviceOeePercenValue.ChartOeeAxisXList = new List<string>();
+
+
+        }
+
+        public void OeeAVGChart(string deviceName, IChartValues DeviceAxisY)
+        {
+            var deviceAVG = OeePercentAVG(deviceName);
+            for (int i = 0; i < deviceAVG.Count(); i++)
+            {
+                DeviceAxisY.Add(deviceAVG[i]);
+            }
+            DeviceOeePercenValue.ChartOeeAVGAxisYList = new ChartValues<double>();
+        }
+
+        public IEnumerable<OEEDataModel> OeeData { get; set; }
+
+        public List<TimeSection> Days { get; set; }
+        public void GetOeeData()
+        {
+            Days = DateTimeHelper.GetDays(DateTimeHelper.ToMonthStart(DateTime.Now), DateTimeHelper.ToMonthEnd(DateTime.Now));
+            var first = DateTime.Parse(Days.First().StartTime.ToString());
+            var last = DateTime.Parse(Days.Last().EndTime.ToString());
+            OeeData = Env.SqlDAL.App_Vertiv_MachineInfoOeeData.GetData<OEEDataModel>().Where(t => t.CreateTime >= first & t.CreateTime <= last);
+
+
+        }
+        public List<double> OeePercent(string deviceName)
+        {
+            var allOeePercentage = new List<double>();
+            var runTime = new List<double>();
+            double dayRunTime = 0;
+            for (int i = 0; i < Days.Count; i++)
+            {
+                //var hourStartResult = Days[i].StartTime.Format();
+                //var hourEndResult = Days[i].EndTime.Format();
+                var hourStartResult = Days[i].StartTime.Format();
+                var hourEndResult = Days[i].EndTime.Format();
+                var OeePercentSting = OeeData.ToLookup(t => t.DeviceName)[deviceName]
+                 .Where(t => t.CreateTime >= DateTime.Parse(hourStartResult) & t.CreateTime < DateTime.Parse(hourEndResult));
+                foreach (var item in OeePercentSting)
+                {
+                    if (OeePercentSting.Count() == 0)
+                    {
+                        dayRunTime = 0;
+
+                    }
+                    else
+                    {
+                        dayRunTime = double.Parse(OeePercentSting.First().OeePercentage.ToString());
+                    }
+                }
+                allOeePercentage.Add(dayRunTime * 100);
+                dayRunTime = 0;
+            }
+            return allOeePercentage;
+        }
+        public List<double> OeePercentAVG(string deviceName)
+        {
+            var hourStartResult = DateTime.Parse(Days.First().StartTime.ToString());
+            var hourEndResult = DateTime.Parse(DateTime.Now.ToString("00:00:00"));
+            var OeePercentStingAVG = OeeData.ToLookup(t => t.DeviceName)[deviceName]
+           .Where(t => t.CreateTime >= DateTime.Parse(hourStartResult.Format()) & t.CreateTime < DateTime.Parse(hourEndResult.Format()));
+            double aVGValue = 0;
+            var aVGOeePercentage = new List<double>();
+            foreach (var item in OeePercentStingAVG)
+            {
+                aVGValue = double.Parse(item.OeePercentage) + aVGValue;
+            }
+            var allAVGValue = aVGValue / OeePercentStingAVG.Count();
+            for (int i = 0; i < Days.Count; i++)
+            {
+                aVGOeePercentage.Add(allAVGValue * 100);
+            }
+            return aVGOeePercentage;
+        }
+    }
+}

+ 63 - 388
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Service/CustomerService.cs

@@ -89,86 +89,26 @@ namespace SCADA_DAQ.Customer.Service
         {
             // RpcService.GetInstance().Regiseter(this);   //将服务中方法注册到RPC服务器,可以给WebApi调用
             Timer.Start();
-            Timer.Elapsed += Timer_Elapsed;
+            //Timer.Elapsed += Timer_Elapsed;
             Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
             GetOeeData();
-            var str = $"{T_Col_Name.App_Vertiv_MachineInfo.Device_Str} = '亚威PBC折弯机' ";
-            var lastTime = Env.SqlDAL.App_Vertiv_MachineInfo.GetTopOne(str, "StartTime_Dt", " ID Desc ");
-            LastRecordTime = Convert.ToDateTime(lastTime);
+            //var str = $"{T_Col_Name.App_Vertiv_MachineInfo.Device_Str} = '亚威PBC折弯机' ";
+            //var lastTime = Env.SqlDAL.App_Vertiv_MachineInfo.GetTopOne(str, "StartTime_Dt", " ID Desc ");
+            //LastRecordTime = Convert.ToDateTime(lastTime);
             return base.Start();
-
-
-
         }
 
         private void Schedual_DateTimeChanged(object sender, DateTimeChangedArgs e)
         {
-            if (e.ChangeType == DateTimeChangeType.MinuteChanged)
-            {
-                TimeToUpdate();
-            }
-
+       
             if (e.ChangeType == DateTimeChangeType.DayChanged)
             {
-                TimeToUpdate();
-                yaweiMac.Power.OnOrgID_Str = Guid.NewGuid().ToString();
-                yaweiMac.Power.StateOnTime_Dt = DateTime.Now;
-                Env.SqlDAL.App_Vertiv_WorkTime.Insert(
-                    new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DeviceName_Str, "亚威PBC折弯机"),
-                    new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.OrgID_Str, yaweiMac.Power.OnOrgID_Str));
-
-                simensModel.OnOrgID_Str = Guid.NewGuid().ToString();
-                simensModel.StateOnTime_Dt = DateTime.Now;
-                Env.SqlDAL.App_Vertiv_WorkTime.Insert(
-                    new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DeviceName_Str, "西门子840D数冲"),
-                    new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.OrgID_Str, simensModel.OnOrgID_Str));
+              
                 OeePercent();
 
             }
 
-            if (e.ChangeType == SCADA.CommonLib.DateTimeChangeType.MinuteChanged ||
-                    e.ChangeType == SCADA.CommonLib.DateTimeChangeType.HourChanged)
-            {
-                if (yaweiMac.Power.StateOn_Bool && yaweiMac.Power.OnOrgID_Str != "")
-                {
-
-                    for (int i = 0; i < 10; i++)
-
-                    {
-                        if (CustomerEnv.schedualList[i].IsEnable)
-                        {
-                            if (CustomerEnv.schedualList[i].MaintainHour == DateTime.Now.Hour &&
-                                 CustomerEnv.schedualList[i].StartMin == DateTime.Now.Minute)
-                            {
-                                var name = "亚威PBC折弯机";
-                                StartTime = DateTime.Now;
-                                OrgID = Guid.NewGuid().ToString();
-                                Env.SqlDAL.App_Vertiv_ScheduleStop.Insert(
-                                new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.StateId_Str, OrgID),
-                                new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.StartTime_Dt, StartTime),
-                                new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.TableName_Str, name));
-
-                            }
-                        }
-                        if (CustomerEnv.schedualList[i].MaintainsStopInHour == DateTime.Now.Hour &&
-                          CustomerEnv.schedualList[i].StopMinute == DateTime.Now.Minute)
-                        {
-
-                            var stopTimeValue = DateTime.Now;
-                            var lastTime = stopTimeValue - StartTime;
-                            Env.SqlDAL.App_Vertiv_ScheduleStop.Update
-                                   (
-                               $"{T_Col_Name.App_Vertiv_ScheduleStop.StateId_Str} = '{OrgID}'",
-                               new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.EndTime_Dt, stopTimeValue),
-                               new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.Duration_Dt, lastTime)
-                                   );
-                            OrgID = null;
-                        }
-                    }
-                }
-            }
-
-
+       
             if (e.ChangeType == SCADA.CommonLib.DateTimeChangeType.SecondChanged & e.TimeFlag.Second % 10 == 0 )
             {
                 GetOeeData();
@@ -176,270 +116,7 @@ namespace SCADA_DAQ.Customer.Service
             }
         }
 
-        private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
-        {
-            try
-            {
-                Ping ping = new Ping();
-                PingReply pingReply = ping.Send(((CustomerServiceConfig)ServiceConfig).ip);
-                if (pingReply.Status == IPStatus.Success)
-                {
-                    if (yaweiMac.Power.StateOn_Bool == false)
-                    {
-                        yaweiMac.Power.OnOrgID_Str = Guid.NewGuid().ToString();
-                        yaweiMac.Power.StateOnTime_Dt = DateTime.Now;
-                        Env.SqlDAL.App_Vertiv_WorkTime.Insert(
-                            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DeviceName_Str, "亚威PBC折弯机"),
-                            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.OrgID_Str, yaweiMac.Power.OnOrgID_Str));
-                        yaweiMac.Power.StateOn_Bool = true;
-                    }
-                    string path = @"\\192.168.1.107\Logs\TEST\12345.txt";
-                    //string path = @"C:\Users\ShiMing\Desktop\12345.txt";
-                    bool result = File.Exists(path);
-
-                    if (result == true)
-                    {
-                        FileInfo fi = new FileInfo(path);
-                        if (fi.Length > 0)
-                        {
-                            Log.Debug("亚威PCB文件记录存在");
-                            var lineList = new List<string>();
-                            string line;
-                            System.IO.StreamReader file =
-                                                   new System.IO.StreamReader(path);
-                            var recordModelList = new List<YaweiEventModel>();
-                            while ((line = file.ReadLine()) != null)
-                            {
-                                var a = line.Replace("<log ", "{\"")
-                                    .Replace(@"/>", "}")
-                                    .Replace(@"=", "\":")
-                                    .Replace(" ", ",\"")
-                                    .Replace("\\", "\\\\");
-                                var recordModel = JsonDeserialize<YaweiEventModel>(a);
-                                recordModelList.Add(recordModel);
-                            }
-                            var startList = recordModelList.Where(t => t.@event == "start" || t.@event == "stop").Where(t => t.StrTimeFormat(t.time) > LastRecordTime).ToList();
-                            if (startList != null)
-                            {
-                                if (startList.Count > 0)
-                                {
-                                    foreach (var item in startList)
-                                    {
-                                        if (item.@event == "start")
-                                        {
-                                            Env.SqlDAL.App_Vertiv_ProductionLog.Insert(
-                                                new UpdateItem(T_Col_Name.App_Vertiv_ProductionLog.DeviceName_Str, "亚威PBC折弯机"));
-                                            InsertStateCode(ref yaweiMac.Work.OnOrgID_Str,
-                                                "运行标志位",
-                                                ref yaweiMac.Work.StateOn_Bool,
-                                                item.StrTimeFormat(item.time),
-                                                ref yaweiMac.Work.StateOnTime_Dt);
-
-                                        }
-                                        else if (item.@event == "stop")
-                                        {
-                                            UpdateStateCode(ref yaweiMac.Work.OnOrgID_Str,
-                                                   ref yaweiMac.Work.StateOn_Bool,
-                                                   item.StrTimeFormat(item.time),
-                                                   yaweiMac.Work.StateOnTime_Dt,
-                                                   ref yaweiMac.Work.StateOnDuration_Double);
-                                        }
-                                    }
-                                }
-                            }
-
-                            var modeChange = recordModelList.Where(t => t.@event == "mode" && t.StrTimeFormat(t.time) > LastRecordTime).ToList();
-                            if (modeChange != null)
-                            {
-                                if (modeChange.Count > 0)
-                                {
-                                    foreach (var item in modeChange)
-                                    {
-                                        if (item.mode != "3" && yaweiMac.Program.OnOrgID_Str == "")
-                                        {
-                                            InsertStateCode(ref yaweiMac.Program.OnOrgID_Str, "换模标志位", ref yaweiMac.Program.StateOn_Bool, item.StrTimeFormat(item.time), ref yaweiMac.Program.StateOnTime_Dt);
-                                        }
-                                        if (item.mode == "3" && yaweiMac.Program.OnOrgID_Str != "")
-                                        {
-                                            UpdateStateCode(ref yaweiMac.Program.OnOrgID_Str,
-                                                ref yaweiMac.Program.StateOn_Bool,
-                                                item.StrTimeFormat(item.time),
-                                                yaweiMac.Program.StateOnTime_Dt,
-                                                ref yaweiMac.Program.StateOnDuration_Double);
-                                        }
-                                    }
-
-                                }
-                            }
-
-                            var stepList = recordModelList.Where(t => t.@event == "step" && t.StrTimeFormat(t.time) > LastRecordTime).ToList();
-                            if (stepList != null)
-                            {
-                                if (stepList.Count > 0)
-                                {
-                                    foreach (var item in stepList)
-                                    {
-                                        Env.SqlDAL.App_Vertiv_BendCounter.Insert(
-                                            new UpdateItem(T_Col_Name.App_Vertiv_BendCounter.DeviceName_Str, "亚威PBC折弯机"));
-                                    }
-                                }
-                            }
-                            //if (recordModelList[i].StrTimeFormat(recordModelList[i].time) > LastRecordTime)
-                            //    {
-                            //        //程序启动
-                            //        if (recordModelList[i].@event == "start")
-                            //        {
-                            //            Env.SqlDAL.App_Vertiv_ProductionLog.Insert(
-                            //                new UpdateItem(T_Col_Name.App_Vertiv_ProductionLog.DeviceName_Str, "亚威PBC折弯机"));
-                            //            InsertStateCode(ref yaweiMac.Work.OnOrgID_Str,
-                            //                "运行标志位",
-                            //                ref yaweiMac.Work.StateOn_Bool,
-                            //                recordModelList[i].StrTimeFormat(recordModelList[i].time),
-                            //                ref yaweiMac.Work.StateOnTime_Dt);
-
-                            //        }
-                            //        else if (recordModelList[i].@event == "mode")
-                            //        {
-                            //            if (recordModelList[i].mode != "3" && yaweiMac.Program.OnOrgID_Str == "")
-                            //            {
-                            //                InsertStateCode(ref yaweiMac.Program.OnOrgID_Str, "换模标志位", ref yaweiMac.Program.StateOn_Bool, recordModelList[i].StrTimeFormat(recordModelList[i].time), ref yaweiMac.Program.StateOnTime_Dt);
-                            //            }
-                            //            if (recordModelList[i].mode == "3" && yaweiMac.Program.OnOrgID_Str != "")
-                            //            {
-                            //                UpdateStateCode(ref yaweiMac.Program.OnOrgID_Str,
-                            //                    ref yaweiMac.Program.StateOn_Bool,
-                            //                    recordModelList[i].StrTimeFormat(recordModelList[i].time),
-                            //                    yaweiMac.Program.StateOnTime_Dt,
-                            //                    ref yaweiMac.Program.StateOnDuration_Double);
-                            //            }
-                            //        }
-
-                            //        else if (recordModelList[i].@event == "error")
-                            //        {
-                            //            if (recordModelList[i].error.First() == 'P')
-                            //            {
-
-                            //            }
-                            //        }
-                            //        else if (recordModelList[i].@event == "step")
-                            //        {
-                            //            Env.SqlDAL.App_Vertiv_BendCounter.Insert(
-                            //                new UpdateItem(T_Col_Name.App_Vertiv_BendCounter.DeviceName_Str, "亚威PBC折弯机"));
-                            //        }
-                            //    }
-                            //    Thread.Sleep(50);
-
-
-
-                            LastRecordTime = recordModelList.Last().StrTimeFormat(recordModelList.Last().time);
-                            file.Close();
-
-
-
-                            try
-                            {
-                                Thread.Sleep(200);
-                                File.WriteAllText(path, string.Empty);
-                                Log.Debug("亚威PCB文件记录清除");
-                            }
-                            catch (Exception ex)
-                            {
-
-                            }
-
-
-                        }
-                    }
-
-                    else
-                    {
-                        Log.Debug("折弯机未生成事件记录");
-                    }
-                }
-                else
-                {
-                    if (yaweiMac.Power.StateOn_Bool == true)
-                    {
-                        yaweiMac.Power.StateOnDuration_Double =
-                            (DateTime.Now - yaweiMac.Power.StateOnTime_Dt).TotalSeconds;
-                        Env.SqlDAL.App_Vertiv_WorkTime.Update(
-                            $"{T_Col_Name.App_Vertiv_WorkTime.OrgID_Str} = '{yaweiMac.Power.OnOrgID_Str}'",
-                            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DurationSec_Dec, yaweiMac.Power.StateOnDuration_Double),
-                            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.TurnOffTime_Dt, DateTime.Now.Format()));
-                        yaweiMac.Power.StateOn_Bool = false;
-                    }
-                }
-            }
-            catch (Exception)
-            {
-                if (yaweiMac.Power.StateOn_Bool == true)
-                {
-                    yaweiMac.Power.StateOnDuration_Double =
-                        (DateTime.Now - yaweiMac.Power.StateOnTime_Dt).TotalSeconds;
-                    Env.SqlDAL.App_Vertiv_WorkTime.Update(
-                        $"{T_Col_Name.App_Vertiv_WorkTime.OrgID_Str} = '{yaweiMac.Power.OnOrgID_Str}'",
-                        new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DurationSec_Dec, yaweiMac.Power.StateOnDuration_Double),
-                        new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.TurnOffTime_Dt, DateTime.Now.Format()));
-                    yaweiMac.Power.StateOn_Bool = false;
-
-                }
-                if (!string.IsNullOrEmpty(OrgID))
-                {
-                    Env.SqlDAL.App_Vertiv_ScheduleStop.Update(
-                        $"{T_Col_Name.App_Vertiv_ScheduleStop.StateId_Str} = '{OrgID}'",
-                        new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.EndTime_Dt, DateTime.Now),
-                        new UpdateItem(T_Col_Name.App_Vertiv_ScheduleStop.Duration_Dt, DateTime.Now - StartTime)
-                        );
-                    OrgID = null;
-                }
-            }
-
-            //西门子数冲
-            try
-            {
-                Ping ping = new Ping();
-                PingReply pingReply = ping.Send("192.168.1.102");
-                if (pingReply.Status == IPStatus.Success)
-                {
-                    if (simensModel.StateOn_Bool == false)
-                    {
-                        simensModel.OnOrgID_Str = Guid.NewGuid().ToString();
-                        simensModel.StateOnTime_Dt = DateTime.Now;
-                        Env.SqlDAL.App_Vertiv_WorkTime.Insert(
-                            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DeviceName_Str, "西门子840D数冲"),
-                            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.OrgID_Str, simensModel.OnOrgID_Str));
-                        simensModel.StateOn_Bool = true;
-                    }
-                }
-                else
-                {
-                    if (simensModel.StateOn_Bool == true)
-                    {
-                        simensModel.StateOnDuration_Double =
-                            (DateTime.Now - simensModel.StateOnTime_Dt).TotalSeconds;
-                        Env.SqlDAL.App_Vertiv_WorkTime.Update(
-                            $"{T_Col_Name.App_Vertiv_WorkTime.OrgID_Str} = '{simensModel.OnOrgID_Str}'",
-                            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DurationSec_Dec, simensModel.StateOnDuration_Double),
-                            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.TurnOffTime_Dt, DateTime.Now.Format()));
-                        simensModel.StateOn_Bool = false;
-                    }
-                }
-            }
-            catch (Exception)
-            {
-                if (simensModel.StateOn_Bool == true)
-                {
-                    simensModel.StateOnDuration_Double =
-                        (DateTime.Now - simensModel.StateOnTime_Dt).TotalSeconds;
-                    Env.SqlDAL.App_Vertiv_WorkTime.Update(
-                        $"{T_Col_Name.App_Vertiv_WorkTime.OrgID_Str} = '{simensModel.OnOrgID_Str}'",
-                        new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DurationSec_Dec, simensModel.StateOnDuration_Double),
-                        new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.TurnOffTime_Dt, DateTime.Now.Format()));
-                    simensModel.StateOn_Bool = false;
-                }
-            }
 
-        }
 
         public static T JsonDeserialize<T>(string jsonString)
         {
@@ -469,61 +146,61 @@ namespace SCADA_DAQ.Customer.Service
             return base.Stop();
         }
 
-        public void InsertStateCode(ref string guidStr,
-                                    string stateCode,
-                                    ref bool stateOn,
-                                    DateTime createTime,
-                                    ref DateTime onTime)
-        {
-            guidStr = Guid.NewGuid().ToString();
-            onTime = createTime;
-            Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
-                new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, "亚威PBC折弯机"),
-                new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, guidStr),
-                new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, stateCode),
-                new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, createTime));
-            stateOn = true;
-        }
-
-        public void UpdateStateCode(ref string guidStr,
-                                    ref bool stateOn,
-                                    DateTime endTime,
-                                    DateTime startTime,
-                                    ref double durationTime)
-        {
-            if (stateOn == true)
-            {
-                durationTime = (endTime - startTime).TotalSeconds;
-                Env.SqlDAL.App_Vertiv_MachineInfo.Update(
-                    $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{guidStr}'",
-                    new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, endTime),
-                    new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, durationTime));
-                stateOn = false;
-                guidStr = "";
-            }
-        }
-
-        private void TimeToUpdate()
-        {
-            if (yaweiMac.Power.StateOn_Bool && yaweiMac.Power.OnOrgID_Str != "")
-            {
-                yaweiMac.Power.StateOnDuration_Double =
-                    (DateTime.Now - yaweiMac.Power.StateOnTime_Dt).TotalSeconds;
-                Env.SqlDAL.App_Vertiv_WorkTime.Update(
-                    $"{T_Col_Name.App_Vertiv_WorkTime.OrgID_Str} = '{yaweiMac.Power.OnOrgID_Str}'",
-                    new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DurationSec_Dec, yaweiMac.Power.StateOnDuration_Double),
-                    new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.TurnOffTime_Dt, DateTime.Now.Format()));
-            }
-            if (simensModel.StateOn_Bool && simensModel.OnOrgID_Str != "")
-            {
-                simensModel.StateOnDuration_Double =
-                    (DateTime.Now - simensModel.StateOnTime_Dt).TotalSeconds;
-                Env.SqlDAL.App_Vertiv_WorkTime.Update(
-                    $"{T_Col_Name.App_Vertiv_WorkTime.OrgID_Str} = '{simensModel.OnOrgID_Str}'",
-                    new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DurationSec_Dec, simensModel.StateOnDuration_Double),
-                    new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.TurnOffTime_Dt, DateTime.Now.Format()));
-            }
-        }
+        //public void InsertStateCode(ref string guidStr,
+        //                            string stateCode,
+        //                            ref bool stateOn,
+        //                            DateTime createTime,
+        //                            ref DateTime onTime)
+        //{
+        //    guidStr = Guid.NewGuid().ToString();
+        //    onTime = createTime;
+        //    Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
+        //        new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, "亚威PBC折弯机"),
+        //        new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, guidStr),
+        //        new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, stateCode),
+        //        new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, createTime));
+        //    stateOn = true;
+        //}
+
+        //public void UpdateStateCode(ref string guidStr,
+        //                            ref bool stateOn,
+        //                            DateTime endTime,
+        //                            DateTime startTime,
+        //                            ref double durationTime)
+        //{
+        //    if (stateOn == true)
+        //    {
+        //        durationTime = (endTime - startTime).TotalSeconds;
+        //        Env.SqlDAL.App_Vertiv_MachineInfo.Update(
+        //            $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{guidStr}'",
+        //            new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, endTime),
+        //            new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, durationTime));
+        //        stateOn = false;
+        //        guidStr = "";
+        //    }
+        //}
+
+        //private void TimeToUpdate()
+        //{
+        //    if (yaweiMac.Power.StateOn_Bool && yaweiMac.Power.OnOrgID_Str != "")
+        //    {
+        //        yaweiMac.Power.StateOnDuration_Double =
+        //            (DateTime.Now - yaweiMac.Power.StateOnTime_Dt).TotalSeconds;
+        //        Env.SqlDAL.App_Vertiv_WorkTime.Update(
+        //            $"{T_Col_Name.App_Vertiv_WorkTime.OrgID_Str} = '{yaweiMac.Power.OnOrgID_Str}'",
+        //            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DurationSec_Dec, yaweiMac.Power.StateOnDuration_Double),
+        //            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.TurnOffTime_Dt, DateTime.Now.Format()));
+        //    }
+        //    if (simensModel.StateOn_Bool && simensModel.OnOrgID_Str != "")
+        //    {
+        //        simensModel.StateOnDuration_Double =
+        //            (DateTime.Now - simensModel.StateOnTime_Dt).TotalSeconds;
+        //        Env.SqlDAL.App_Vertiv_WorkTime.Update(
+        //            $"{T_Col_Name.App_Vertiv_WorkTime.OrgID_Str} = '{simensModel.OnOrgID_Str}'",
+        //            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DurationSec_Dec, simensModel.StateOnDuration_Double),
+        //            new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.TurnOffTime_Dt, DateTime.Now.Format()));
+        //    }
+        //}
 
 
         public IEnumerable<MachineInfoModel> OeeData { get; set; }
@@ -541,9 +218,7 @@ namespace SCADA_DAQ.Customer.Service
         }
 
         public string OeeValue { get; set; }
-
-        public string HoldID { get; set; }
-        public void OeePercent()
+         public void OeePercent()
         {
             var deviceName = new List<string>{"高机母线冲剪机", "2号YaWei折弯机", "3号YaWei折弯机", "激光机", "1号YaWei折弯机", "百超折弯机",
             "倍福数冲机", "金方圆数控母线冲孔机", "西门子840D数冲", "亚威PBC折弯机"};

+ 35 - 0
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmBendDeviceOeeInformation.xaml

@@ -0,0 +1,35 @@
+<wpfcontrol:BaseUctFrm  xmlns:wpfcontrol="clr-namespace:SCADA.CommonCtrl.WpfControl;assembly=SCADA.CommonCtrl" x:Class="SCADA_DAQ.Customer.UctFrmBendDeviceOeeInformation"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:SCADA_DAQ.Customer" xmlns:uct="clr-namespace:SCADA_DAQ.Customer.Views.Uct"
+                        mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="UctFrmBendDeviceOeeInformation">
+    <Grid>
+        <Grid>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="Auto"/>
+                <RowDefinition/>
+            </Grid.RowDefinitions>
+            <Image x:Name="Image_Title" Grid.RowSpan="3" Stretch="Fill"/>
+            <TextBlock x:Name="LocalTime" Foreground="White" FontSize="30" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,10,10,0" FontWeight="Bold"/>
+            <TextBlock Text="时间稼动率月看板" FontSize="28" HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="White" FontWeight="Bold" />
+            <Grid Grid.Row="1">
+                <Grid.RowDefinitions>
+                    <RowDefinition/>
+                    <RowDefinition/>
+                    <RowDefinition/>
+                    <RowDefinition/>
+                    <RowDefinition/>
+                </Grid.RowDefinitions>
+                <uct:UctDeviceChart x:Name = "OneBendingDevice" />
+                <uct:UctDeviceChart Grid.Row = "1" x:Name= "TwoBendingDevice" />
+                <uct:UctDeviceChart Grid.Row = "2" x:Name = "ThreeBendingDevice" />
+                <uct:UctDeviceChart Grid.Row = "3" x:Name = "YaWeiPBCDevice" />
+                <uct:UctDeviceChart Grid.Row = "4" x:Name = "BaiChaoDevice" />
+            </Grid>
+        </Grid>
+    </Grid>
+</wpfcontrol:BaseUctFrm>

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

@@ -0,0 +1,165 @@
+using LiveCharts;
+using SCADA;
+using SCADA.CommonCtrl.WpfControl;
+using SCADA.CommonLib.Helper;
+using SCADA.CommonLib;
+using SCADA_DAQ.Customer.Models.OEEData;
+using SCADA_DAQ.Customer.Views.Uct;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace SCADA_DAQ.Customer
+{
+    /// <summary>
+    /// UctFrmBendDeviceOeeInformation.xaml 的交互逻辑
+    /// </summary>
+    [UctMenu("折弯设备时间稼动率界面", Icon = "看板")]
+    public partial class UctFrmBendDeviceOeeInformation : BaseUctFrm
+    {
+        public OeeProperty DeviceOeePercenValue = new OeeProperty();
+        public UctFrmBendDeviceOeeInformation()
+        {
+            InitializeComponent();
+            ToolBar.Visibility = Visibility.Collapsed;
+            GetOeeData();
+            TenOeeChart();
+            Image_Title.Source = SCADA.CommonCtrl.WpfHelper.VisualHelper.ImageToImageSource(@"Icon\VertivBck.png");
+            LocalTime.Text = DateTime.Now.ToString("dddd yyyy年MM月dd日 HH:mm");
+            OneBendingDevice.Title = new string[] { "单位:%", "1号YaWei折弯机" };
+            TwoBendingDevice.Title = new string[] { "单位:%", "2号YaWei折弯机" };
+            ThreeBendingDevice.Title = new string[] { "单位:%", "3号YaWei折弯机" };
+            YaWeiPBCDevice.Title = new string[] { "单位:%", "亚威PBC折弯机" };
+            BaiChaoDevice.Title = new string[] { "单位:%", "百超折弯机" };
+            Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
+        }
+
+        private void Schedual_DateTimeChanged(object sender, DateTimeChangedArgs e)
+        {
+            if (e.ChangeType == DateTimeChangeType.SecondChanged && e.TimeFlag.Second % 10 == 0)
+            {
+                Dispatcher.Invoke(new Action(() =>
+                {
+                    GetOeeData();
+                    TenOeeChart();
+
+                }));
+
+            }
+        }
+        public void TenOeeChart()
+        {
+
+            OeeChart("1号YaWei折弯机", OneBendingDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, OneBendingDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
+            OeeChart("2号YaWei折弯机", TwoBendingDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, TwoBendingDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
+            OeeChart("3号YaWei折弯机", ThreeBendingDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, ThreeBendingDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList); ;
+            OeeChart("亚威PBC折弯机", YaWeiPBCDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, YaWeiPBCDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
+            OeeChart("百超折弯机", BaiChaoDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, BaiChaoDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
+
+            OeeAVGChart("1号YaWei折弯机", OneBendingDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
+            OeeAVGChart("2号YaWei折弯机", TwoBendingDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
+            OeeAVGChart("3号YaWei折弯机", ThreeBendingDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
+            OeeAVGChart("亚威PBC折弯机", YaWeiPBCDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
+            OeeAVGChart("百超折弯机", BaiChaoDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
+        }
+
+        public void OeeChart(string deviceName, IList<string> DeviceAisxX, IChartValues DeviceAxisY)
+        {
+
+            var listdouble = OeePercent(deviceName);
+            for (int i = 0; i < listdouble.Count; i++)
+            {
+                DeviceAxisY.Add(listdouble[i]);
+                DeviceAisxX.Add(((i + 1).ToString() + "日"));
+
+            }
+            DeviceOeePercenValue.ChartOeeAxisYList = new ChartValues<double>();
+            DeviceOeePercenValue.ChartOeeAxisXList = new List<string>();
+
+
+        }
+
+        public void OeeAVGChart(string deviceName, IChartValues DeviceAxisY)
+        {
+            var deviceAVG = OeePercentAVG(deviceName);
+            for (int i = 0; i < deviceAVG.Count(); i++)
+            {
+                DeviceAxisY.Add(deviceAVG[i]);
+            }
+            DeviceOeePercenValue.ChartOeeAVGAxisYList = new ChartValues<double>();
+        }
+
+        public IEnumerable<OEEDataModel> OeeData { get; set; }
+
+        public List<TimeSection> Days { get; set; }
+        public void GetOeeData()
+        {
+            Days = DateTimeHelper.GetDays(DateTimeHelper.ToMonthStart(DateTime.Now), DateTimeHelper.ToMonthEnd(DateTime.Now));
+            var first = DateTime.Parse(Days.First().StartTime.ToString());
+            var last = DateTime.Parse(Days.Last().EndTime.ToString());
+            OeeData = Env.SqlDAL.App_Vertiv_MachineInfoOeeData.GetData<OEEDataModel>().Where(t => t.CreateTime >= first & t.CreateTime <= last);
+
+
+        }
+        public List<double> OeePercent(string deviceName)
+        {
+            var allOeePercentage = new List<double>();
+            var runTime = new List<double>();
+            double dayRunTime = 0;
+            for (int i = 0; i < Days.Count; i++)
+            {
+                //var hourStartResult = Days[i].StartTime.Format();
+                //var hourEndResult = Days[i].EndTime.Format();
+                var hourStartResult = Days[i].StartTime.Format();
+                var hourEndResult = Days[i].EndTime.Format();
+                var OeePercentSting = OeeData.ToLookup(t => t.DeviceName)[deviceName]
+                 .Where(t => t.CreateTime >= DateTime.Parse(hourStartResult) & t.CreateTime < DateTime.Parse(hourEndResult));
+                foreach (var item in OeePercentSting)
+                {
+                    if (OeePercentSting.Count() == 0)
+                    {
+                        dayRunTime = 0;
+
+                    }
+                    else
+                    {
+                        dayRunTime = double.Parse(OeePercentSting.First().OeePercentage.ToString());
+                    }
+                }
+                allOeePercentage.Add(dayRunTime * 100);
+                dayRunTime = 0;
+            }
+            return allOeePercentage;
+        }
+        public List<double> OeePercentAVG(string deviceName)
+        {
+            var hourStartResult = DateTime.Parse(Days.First().StartTime.ToString());
+            var hourEndResult = DateTime.Parse(DateTime.Now.ToString("00:00:00"));
+            var OeePercentStingAVG = OeeData.ToLookup(t => t.DeviceName)[deviceName]
+           .Where(t => t.CreateTime >= DateTime.Parse(hourStartResult.Format()) & t.CreateTime < DateTime.Parse(hourEndResult.Format()));
+            double aVGValue = 0;
+            var aVGOeePercentage = new List<double>();
+            foreach (var item in OeePercentStingAVG)
+            {
+                aVGValue = double.Parse(item.OeePercentage) + aVGValue;
+            }
+            var allAVGValue = aVGValue / OeePercentStingAVG.Count();
+            for (int i = 0; i < Days.Count; i++)
+            {
+                aVGOeePercentage.Add(allAVGValue * 100);
+            }
+            return aVGOeePercentage;
+        }
+    }
+}

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

@@ -23,20 +23,11 @@
                 <RowDefinition/>
                 <RowDefinition/>
             </Grid.RowDefinitions>
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition/>
-                <ColumnDefinition/>
-            </Grid.ColumnDefinitions>
             <uct:UctDeviceChart  x:Name="LaserDevice" Grid.Column="1"/>
             <uct:UctDeviceChart Grid.Row="1" x:Name="simenDevice" Grid.Column="1"/>
             <uct:UctDeviceChart Grid.Row="2" x:Name="BeiFuDevice" Grid.Column="1"/>
             <uct:UctDeviceChart Grid.Row="3" x:Name="KimFangyuanDevice" Grid.Column="1"/>
             <uct:UctDeviceChart Grid.Row="4" x:Name="HighDevice" Grid.Column="1"/>
-            <uct:UctDeviceChart  x:Name="OneBendingDevice" />
-            <uct:UctDeviceChart Grid.Row="1" x:Name="TwoBendingDevice" />
-            <uct:UctDeviceChart Grid.Row="2" x:Name="ThreeBendingDevice" />
-            <uct:UctDeviceChart Grid.Row="3" x:Name="YaWeiPBCDevice" />
-            <uct:UctDeviceChart Grid.Row="4" x:Name="BaiChaoDevice"/>
         </Grid>
     </Grid>
 </wpfcontrol:BaseUctFrm>

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

@@ -28,7 +28,7 @@ namespace SCADA_DAQ.Customer
     /// <summary>
     /// UctFrmDeviceOeeInformation.xaml 的交互逻辑
     /// </summary>
-    [UctMenu("时间稼动率界面", Icon = "看板")]
+    [UctMenu("激光数冲时间稼动率界面", Icon = "看板")]
     public partial class UctFrmDeviceOeeInformation : BaseUctFrm
     {
         public OeeProperty DeviceOeePercenValue = new OeeProperty();
@@ -44,17 +44,13 @@ namespace SCADA_DAQ.Customer
             GetOeeData();
             TenOeeChart();
             Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
-            LaserDevice.Title = new string[] { "单位:%", "激光机"};
+            LaserDevice.Title = new string[] { "单位:%", "激光机" };
             simenDevice.Title = new string[] { "单位:%", "西门子数冲机" };
             BeiFuDevice.Title = new string[] { "单位:%", "倍福数冲机" };
             KimFangyuanDevice.Title = new string[] { "单位:%", "金方圆数控母线冲孔机" };
             HighDevice.Title = new string[] { "单位:%", "高机母线冲剪机" };
-            OneBendingDevice.Title = new string[] { "单位:%", "1号YaWei折弯机" };
-            TwoBendingDevice.Title = new string[] { "单位:%", "2号YaWei折弯机" };
-            ThreeBendingDevice.Title = new string[] { "单位:%", "3号YaWei折弯机" };
-            YaWeiPBCDevice.Title = new string[] { "单位:%", "亚威PBC折弯机" };
-            BaiChaoDevice.Title = new string[] { "单位:%", "百超折弯机" };
-    
+         
+
 
         }
 
@@ -77,7 +73,7 @@ namespace SCADA_DAQ.Customer
                     //YaWeiPBCDevice.OeeValueUpdate.Update();
                     //BaiChaoDevice.OeeValueUpdate.Update();
                 }));
-            
+
             }
         }
 
@@ -88,33 +84,25 @@ namespace SCADA_DAQ.Customer
             OeeChart("倍福数冲机", BeiFuDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, BeiFuDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
             OeeChart("金方圆数控母线冲孔机", KimFangyuanDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, KimFangyuanDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
             OeeChart("高机母线冲剪机", HighDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, HighDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
-            OeeChart("1号YaWei折弯机", OneBendingDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, OneBendingDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
-            OeeChart("2号YaWei折弯机", TwoBendingDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, TwoBendingDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
-            OeeChart("3号YaWei折弯机", ThreeBendingDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, ThreeBendingDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList); ;
-            OeeChart("亚威PBC折弯机", YaWeiPBCDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, YaWeiPBCDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
-            OeeChart("百超折弯机", BaiChaoDevice.Axisx.Labels = DeviceOeePercenValue.ChartOeeAxisXList, BaiChaoDevice.OeeValue.Values = DeviceOeePercenValue.ChartOeeAxisYList);
+      
 
-            OeeAVGChart("激光机", LaserDevice.OeeValueAGV.Values= DeviceOeePercenValue.ChartOeeAVGAxisYList);
+            OeeAVGChart("激光机", LaserDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
             OeeAVGChart("西门子840D数冲", simenDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
             OeeAVGChart("倍福数冲机", BeiFuDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
             OeeAVGChart("金方圆数控母线冲孔机", KimFangyuanDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
             OeeAVGChart("高机母线冲剪机", HighDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
-            OeeAVGChart("1号YaWei折弯机", OneBendingDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
-            OeeAVGChart("2号YaWei折弯机", TwoBendingDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
-            OeeAVGChart("3号YaWei折弯机", ThreeBendingDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
-            OeeAVGChart("亚威PBC折弯机", YaWeiPBCDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
-            OeeAVGChart("百超折弯机", BaiChaoDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
+
         }
-     
+
         public void OeeChart(string deviceName, IList<string> DeviceAisxX, IChartValues DeviceAxisY)
         {
-         
+
             var listdouble = OeePercent(deviceName);
             for (int i = 0; i < listdouble.Count; i++)
             {
                 DeviceAxisY.Add(listdouble[i]);
                 DeviceAisxX.Add(((i + 1).ToString() + "日"));
-               
+
             }
             DeviceOeePercenValue.ChartOeeAxisYList = new ChartValues<double>();
             DeviceOeePercenValue.ChartOeeAxisXList = new List<string>();
@@ -122,7 +110,7 @@ namespace SCADA_DAQ.Customer
 
         }
 
-        public void OeeAVGChart(string deviceName , IChartValues DeviceAxisY)
+        public void OeeAVGChart(string deviceName, IChartValues DeviceAxisY)
         {
             var deviceAVG = OeePercentAVG(deviceName);
             for (int i = 0; i < deviceAVG.Count(); i++)
@@ -131,7 +119,7 @@ namespace SCADA_DAQ.Customer
             }
             DeviceOeePercenValue.ChartOeeAVGAxisYList = new ChartValues<double>();
         }
-      
+
         public IEnumerable<OEEDataModel> OeeData { get; set; }
 
         public List<TimeSection> Days { get; set; }
@@ -161,7 +149,7 @@ namespace SCADA_DAQ.Customer
                 {
                     if (OeePercentSting.Count() == 0)
                     {
-                        dayRunTime = 0;
+                        dayRunTime = null;
 
                     }
                     else
@@ -169,7 +157,7 @@ namespace SCADA_DAQ.Customer
                         dayRunTime = double.Parse(OeePercentSting.First().OeePercentage.ToString());
                     }
                 }
-                allOeePercentage.Add(dayRunTime*100);
+                allOeePercentage.Add(dayRunTime * 100);
                 dayRunTime = 0;
             }
             return allOeePercentage;
@@ -182,14 +170,14 @@ namespace SCADA_DAQ.Customer
            .Where(t => t.CreateTime >= DateTime.Parse(hourStartResult.Format()) & t.CreateTime < DateTime.Parse(hourEndResult.Format()));
             double aVGValue = 0;
             var aVGOeePercentage = new List<double>();
-           foreach (var item in OeePercentStingAVG)
+            foreach (var item in OeePercentStingAVG)
             {
                 aVGValue = double.Parse(item.OeePercentage) + aVGValue;
             }
             var allAVGValue = aVGValue / OeePercentStingAVG.Count();
             for (int i = 0; i < Days.Count; i++)
             {
-                aVGOeePercentage.Add(allAVGValue*100);
+                aVGOeePercentage.Add(allAVGValue * 100);
             }
             return aVGOeePercentage;
         }

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

@@ -21,7 +21,7 @@ namespace SCADA_DAQ.Customer
     /// <summary>
     /// UctFrmDeviceOeeQuery.xaml 的交互逻辑
     /// </summary>
-    [UctMenu("设备Oee数据查询")]
+    [UctMenu("设备时间稼动率数据查询",Icon ="查询")]
     public partial class UctFrmDeviceOeeQuery : BaseUctFrm<QueryOeeModel>
     {
         public UctFrmDeviceOeeQuery()

+ 117 - 166
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmKanbanForPressBrakeEquipment.xaml.cs

@@ -89,21 +89,6 @@ 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折弯机换模时间
 
@@ -126,28 +111,6 @@ 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折弯机", "维修时间");
@@ -213,13 +176,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;
         }
@@ -227,10 +190,7 @@ 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"));
             //获取当天所有设备信息
@@ -240,9 +200,7 @@ 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);
         }
@@ -250,10 +208,7 @@ 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"));
 
@@ -389,126 +344,122 @@ namespace SCADA_DAQ.Customer
         private void Schedual_DateTimeChanged(object sender, SCADA.CommonLib.DateTimeChangedArgs e)
         {
 
-            try
+
+            if (e.ChangeType == SCADA.CommonLib.DateTimeChangeType.SecondChanged &&
+                        e.TimeFlag.Second % 16 == 0)
             {
-                if (e.ChangeType == SCADA.CommonLib.DateTimeChangeType.SecondChanged &&
-                            e.TimeFlag.Second % 16 == 0)
+                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(() =>
                 {
-                    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;
-                    }));
-                }
+                    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(() =>

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

@@ -474,6 +474,7 @@ namespace SCADA_DAQ.Customer.Views.Dashboard
                             e.TimeFlag.Second % 16 == 0)
 
                 {
+                    System.GC.Collect(2);
                     GetDBData();
                     GetTableTime();
                     GetScheduleStopTime();

+ 72 - 105
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Views/Dashboard/YaweiPressBrakeOneWidget.xaml.cs

@@ -49,20 +49,7 @@ namespace SCADA_DAQ.Customer.Views.Dashboard
             GetTableTime();
             GetDeviceScheduleStopBetweenTime();
             string[] deviceStatus = { "运行", "等待", "报警/维修", "换模" };
-            //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折弯机换模时间
 
@@ -84,23 +71,11 @@ namespace SCADA_DAQ.Customer.Views.Dashboard
             var pbcYaWweiStopTime = DeviceTimeValue("亚威PBC折弯机", "停止标志位") - DevicMainTableTime("亚威PBC折弯机").TotalSeconds;//亚威PBC折弯机等待时间
             var baiChaoStopTime = DeviceTimeValue("百超折弯机", "停止标志位") - DevicMainTableTime("百超折弯机").TotalSeconds;//百超折弯机折弯机等待时间
 
-            //double totalTimeOfDay = TimeSpan.Parse(DateTime.Now.ToString("HH:mm:ss")).TotalSeconds;
-            //var firstYaWeiStopTime = totalTimeOfDay - firstYaWeiRunTime - firstYaWeiMoldTime - DevicScheduleStop("1号YaWei折弯机")
-            //     - DevicMainTableTime("亚威一号折弯机").TotalSeconds - DeviceTimeValue("1号YaWei折弯机", "维修时间") + DeviceScheduleStopBetweenTime("1号YaWei折弯机");//1号YaWei折弯机等待时间
-            //var sencondYaWeiStopTime = totalTimeOfDay - sencondYaWeiRunTime - sencondYaWeiMoldTime - DevicScheduleStop("2号YaWei折弯机")
-            //    - DevicMainTableTime("亚威二号折弯机").TotalSeconds - DeviceTimeValue("2号YaWei折弯机", "维修时间") + DeviceScheduleStopBetweenTime("2号YaWei折弯机");//2号YaWei折弯机等待时间
-            //var thirdYaWweiStopTime = totalTimeOfDay - thirdYaWweiRunTime - thirdYaWweiMoldTime - DevicScheduleStop("3号YaWei折弯机")
-            //    - DevicMainTableTime("亚威三号折弯机").TotalSeconds - DeviceTimeValue("3号YaWei折弯机", "维修时间") + DeviceScheduleStopBetweenTime("3号YaWei折弯机");//3号YaWei折弯机等待时间
-            //var pbcYaWweiStopTime = totalTimeOfDay - pbcYaWweiRunTime - pbcYaWweiMoldTime - DevicScheduleStop("亚威PBC折弯机")
-            //    - DevicMainTableTime("亚威PBC折弯机").TotalSeconds - DeviceTimeValue("亚威PBC折弯机", "维修时间") + DeviceScheduleStopBetweenTime("亚威PBC折弯机");//亚威PBC折弯机等待时间
-            //var baiChaoStopTime = totalTimeOfDay - baiChaoRunTime - baiChaoMoldTime - DevicScheduleStop("百超折弯机")
-            //    - DevicMainTableTime("百超折弯机").TotalSeconds - DeviceTimeValue("百超折弯机", "维修时间") + DeviceScheduleStopBetweenTime("百超折弯机");//百超折弯机折弯机等待时间
-
-            var firstYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威一号折弯机").TotalSeconds + DeviceTimeValue("1号YaWei折弯机", "维修时间") ;
-            var secondYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威二号折弯机").TotalSeconds + DeviceTimeValue("2号YaWei折弯机", "维修时间") ;
-            var thirdYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威三号折弯机").TotalSeconds + DeviceTimeValue("3号YaWei折弯机", "维修时间") ;
-            var pbcYaWweiTimeMaintenanceTable = DevicMainTableTime("亚威PBC折弯机").TotalSeconds + DeviceTimeValue("亚威PBC折弯机", "维修时间") ;
-            var baiChaoTimeMaintenanceTable = DevicMainTableTime("百超折弯机").TotalSeconds + DeviceTimeValue("百超折弯机", "维修时间") ;
+            var firstYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威一号折弯机").TotalSeconds + DeviceTimeValue("1号YaWei折弯机", "维修时间");
+            var secondYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威二号折弯机").TotalSeconds + DeviceTimeValue("2号YaWei折弯机", "维修时间");
+            var thirdYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威三号折弯机").TotalSeconds + DeviceTimeValue("3号YaWei折弯机", "维修时间");
+            var pbcYaWweiTimeMaintenanceTable = DevicMainTableTime("亚威PBC折弯机").TotalSeconds + DeviceTimeValue("亚威PBC折弯机", "维修时间");
+            var baiChaoTimeMaintenanceTable = DevicMainTableTime("百超折弯机").TotalSeconds + DeviceTimeValue("百超折弯机", "维修时间");
 
             var firstYaWeiValueTime = new double[] { firstYaWeiRunTime, firstYaWeiStopTime, firstYaWeiTimeMaintenanceTable, firstYaWeiMoldTime };
             var sencondYaWeiValueTime = new double[] { sencondYaWeiRunTime, sencondYaWeiStopTime, secondYaWeiTimeMaintenanceTable, sencondYaWeiMoldTime };
@@ -147,10 +122,6 @@ namespace SCADA_DAQ.Customer.Views.Dashboard
         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"));
 
@@ -162,8 +133,7 @@ namespace SCADA_DAQ.Customer.Views.Dashboard
         }
         public double DeviceTimeValue(string deviceName, string StateCode)
         {
-            ////获取当天所有设备信息
-            //var deviceInformation = DAL.App_Vertiv_MachineInfo.GetData<MachineInfoModel>()?.Where(t => t.CreateTime.Date == DateTime.Now.Date);
+
             var keepTime = deviceInformation.ToLookup(t => t.Device)[deviceName].ToLookup(t => t.StateCode)[StateCode].Sum(t => t.DurationSec);
             return Convert.ToDouble(keepTime);
         }
@@ -288,99 +258,96 @@ namespace SCADA_DAQ.Customer.Views.Dashboard
 
         private void Schedual_DateTimeChanged(object sender, SCADA.CommonLib.DateTimeChangedArgs e)
         {
-            try
+
+            if (e.ChangeType == SCADA.CommonLib.DateTimeChangeType.SecondChanged &&
+                        e.TimeFlag.Second % 16 == 0)
             {
-                if (e.ChangeType == SCADA.CommonLib.DateTimeChangeType.SecondChanged  &&
-                            e.TimeFlag.Second % 16 == 0)
-                {
-                    GetDBData();
-                    GetScheduleStopTime();
-                    GetTableTime();
-                    GetDeviceScheduleStopBetweenTime();
-                    string[] deviceStatus = { "运行", "等待", "报警/维修", "换模" };
-                    var firstYaWeiRunTime = DeviceTimeValue("1号YaWei折弯机", "运行标志位");//1号YaWei折弯机运行时间
-                    var firstYaWeiMoldTime = DeviceTimeValue("1号YaWei折弯机", "换模标志位");//1号YaWei折弯机换模时间
+                System.GC.Collect(2);
+                GetDBData();
+                GetScheduleStopTime();
+                GetTableTime();
+                GetDeviceScheduleStopBetweenTime();
+                string[] deviceStatus = { "运行", "等待", "报警/维修", "换模" };
+                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 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 thirdYaWweiRunTime = DeviceTimeValue("3号YaWei折弯机", "运行标志位");//3号YaWei折弯机运行时间
+                var thirdYaWweiMoldTime = DeviceTimeValue("3号YaWei折弯机", "换模标志位");//3号YaWei折弯机换模时间
 
-                    var pbcYaWweiRunTime = DeviceTimeValue("亚威PBC折弯机", "运行标志位");//亚威PBC折弯机运行时间
-                    var pbcYaWweiMoldTime = DeviceTimeValue("亚威PBC折弯机", "换模标志位");//亚威PBC折弯机换模时间
+                var pbcYaWweiRunTime = DeviceTimeValue("亚威PBC折弯机", "运行标志位");//亚威PBC折弯机运行时间
+                var pbcYaWweiMoldTime = DeviceTimeValue("亚威PBC折弯机", "换模标志位");//亚威PBC折弯机换模时间
 
-                    var baiChaoRunTime = DeviceTimeValue("百超折弯机", "运行标志位");//百超折弯机运行时间
-                    var baiChaoMoldTime = DeviceTimeValue("百超折弯机", "换模标志位");//百超折弯机换模时间
+                var baiChaoRunTime = DeviceTimeValue("百超折弯机", "运行标志位");//百超折弯机运行时间
+                var baiChaoMoldTime = DeviceTimeValue("百超折弯机", "换模标志位");//百超折弯机换模时间
 
-                    var firstYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威一号折弯机").TotalSeconds + DeviceTimeValue("1号YaWei折弯机", "维修时间");
-                    var secondYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威二号折弯机").TotalSeconds + DeviceTimeValue("2号YaWei折弯机", "维修时间");
-                    var thirdYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威三号折弯机").TotalSeconds + DeviceTimeValue("3号YaWei折弯机", "维修时间");
-                    var pbcYaWweiTimeMaintenanceTable = DevicMainTableTime("亚威PBC折弯机").TotalSeconds + DeviceTimeValue("亚威PBC折弯机", "维修时间");
-                    var baiChaoTimeMaintenanceTable = DevicMainTableTime("百超折弯机").TotalSeconds + DeviceTimeValue("百超折弯机", "维修时间");
+                var firstYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威一号折弯机").TotalSeconds + DeviceTimeValue("1号YaWei折弯机", "维修时间");
+                var secondYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威二号折弯机").TotalSeconds + DeviceTimeValue("2号YaWei折弯机", "维修时间");
+                var thirdYaWeiTimeMaintenanceTable = DevicMainTableTime("亚威三号折弯机").TotalSeconds + DeviceTimeValue("3号YaWei折弯机", "维修时间");
+                var pbcYaWweiTimeMaintenanceTable = DevicMainTableTime("亚威PBC折弯机").TotalSeconds + DeviceTimeValue("亚威PBC折弯机", "维修时间");
+                var baiChaoTimeMaintenanceTable = DevicMainTableTime("百超折弯机").TotalSeconds + DeviceTimeValue("百超折弯机", "维修时间");
 
-                    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 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 firstYaWeiValueTime = new double[] { firstYaWeiRunTime, firstYaWeiStopTime, firstYaWeiTimeMaintenanceTable, firstYaWeiMoldTime };
-                    var sencondYaWeiValueTime = new double[] { sencondYaWeiRunTime, sencondYaWeiStopTime, secondYaWeiTimeMaintenanceTable, sencondYaWeiMoldTime };
-                    var thirdYaWeiValueTime = new double[] { thirdYaWweiRunTime, thirdYaWweiStopTime, thirdYaWeiTimeMaintenanceTable, thirdYaWweiMoldTime };
-                    var pbcYaWeiValueTime = new double[] { pbcYaWweiRunTime, pbcYaWweiStopTime, pbcYaWweiTimeMaintenanceTable, pbcYaWweiMoldTime };
-                    var baiChaoValueTime = new double[] { baiChaoRunTime, baiChaoStopTime, baiChaoTimeMaintenanceTable, baiChaoMoldTime };
+                var firstYaWeiValueTime = new double[] { firstYaWeiRunTime, firstYaWeiStopTime, firstYaWeiTimeMaintenanceTable, firstYaWeiMoldTime };
+                var sencondYaWeiValueTime = new double[] { sencondYaWeiRunTime, sencondYaWeiStopTime, secondYaWeiTimeMaintenanceTable, sencondYaWeiMoldTime };
+                var thirdYaWeiValueTime = new double[] { thirdYaWweiRunTime, thirdYaWweiStopTime, thirdYaWeiTimeMaintenanceTable, thirdYaWweiMoldTime };
+                var pbcYaWeiValueTime = new double[] { pbcYaWweiRunTime, pbcYaWweiStopTime, pbcYaWweiTimeMaintenanceTable, pbcYaWweiMoldTime };
+                var baiChaoValueTime = new double[] { baiChaoRunTime, baiChaoStopTime, baiChaoTimeMaintenanceTable, baiChaoMoldTime };
 
 
 
-                    for (int k = 0; k < deviceStatus.Length; k++)
-                    {
-                        pressBrakeOneValue[k].Value = firstYaWeiValueTime[k];
+                for (int k = 0; k < deviceStatus.Length; k++)
+                {
+                    pressBrakeOneValue[k].Value = firstYaWeiValueTime[k];
 
-                    }
+                }
 
-                    for (int k = 0; k < deviceStatus.Length; k++)
-                    {
-                        pressBrakeTwoValue[k].Value = sencondYaWeiValueTime[k];
-                    }
+                for (int k = 0; k < deviceStatus.Length; k++)
+                {
+                    pressBrakeTwoValue[k].Value = sencondYaWeiValueTime[k];
+                }
 
 
 
-                    for (int k = 0; k < deviceStatus.Length; k++)
-                    {
-                        pressBrakeThreeValue[k].Value = thirdYaWeiValueTime[k];
-                    }
+                for (int k = 0; k < deviceStatus.Length; k++)
+                {
+                    pressBrakeThreeValue[k].Value = thirdYaWeiValueTime[k];
+                }
 
-                    for (int k = 0; k < deviceStatus.Length; k++)
-                    {
-                        pressBrakeFourValue[k].Value = pbcYaWeiValueTime[k];
-                    }
+                for (int k = 0; k < deviceStatus.Length; k++)
+                {
+                    pressBrakeFourValue[k].Value = pbcYaWeiValueTime[k];
+                }
 
 
-                    for (int k = 0; k < deviceStatus.Length; k++)
-                    {
-                        pressBrakeFiveValue[k].Value = baiChaoValueTime[k];
-                    }
+                for (int k = 0; k < deviceStatus.Length; k++)
+                {
+                    pressBrakeFiveValue[k].Value = baiChaoValueTime[k];
+                }
 
 
-                    // 委托
-                    Dispatcher.Invoke(new Action(() =>
-                    {
-                        YaweiPressBrakeOne.Update();
-                        YaweiPressBrakeTwo.Update();
-                        YaweiPressBrakeThree.Update();
-                        YaweiPressBrakeFour.Update();
-                        YaweiPressBrakeFive.Update();
-                    }));
-                }
+                // 委托
+                Dispatcher.Invoke(new Action(() =>
+                {
+                    YaweiPressBrakeOne.Update();
+                    YaweiPressBrakeTwo.Update();
+                    YaweiPressBrakeThree.Update();
+                    YaweiPressBrakeFour.Update();
+                    YaweiPressBrakeFive.Update();
+                }));
             }
+        }
+
+
 
-            catch (Exception ex)
-            {
-                //Log.Warn(ex.ToString());
-            }
 
-        }
     }
 }
 

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

@@ -30,8 +30,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;
 

+ 6 - 0
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/SCADA_DAQ.csproj.user

@@ -5,6 +5,9 @@
     <Compile Update="Customer\UctFrmAlarmQuery.xaml.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Update="Customer\UctFrmBendDeviceOeeInformation.xaml.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Update="Customer\UctFrmDeviceOeeInformation.xaml.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -141,6 +144,9 @@
     <Page Update="Customer\UctFrmAlarmQuery.xaml">
       <SubType>Designer</SubType>
     </Page>
+    <Page Update="Customer\UctFrmBendDeviceOeeInformation.xaml">
+      <SubType>Designer</SubType>
+    </Page>
     <Page Update="Customer\UctFrmDeviceOeeInformation.xaml">
       <SubType>Designer</SubType>
     </Page>