|
@@ -9,6 +9,7 @@ using SCADA.SECS;
|
|
|
using SCADA_DAQ.Customer.Models;
|
|
|
using SCADA_DAQ.Customer.Models.AlarmTime;
|
|
|
using SCADA_DAQ.Customer.Models.DeviceInfoTime;
|
|
|
+using SCADA_DAQ.Customer.Models.DistinctTimePiece;
|
|
|
using SCADA_DAQ.Customer.Models.ScheduleStop;
|
|
|
using SqlSchema.DBNames;
|
|
|
using System;
|
|
@@ -50,9 +51,7 @@ namespace SCADA_DAQ.Customer
|
|
|
GetRepairTime();
|
|
|
GetScheduleStopTime();
|
|
|
GetDeviceAlarmTime();
|
|
|
- GetHighDeviceWaitTime();
|
|
|
- GetDeviceScheduleStopBetweenTime();
|
|
|
- GetDeviceAlarmScheduleStopBetweenTime();
|
|
|
+ GetDeviceStopTime();
|
|
|
Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
|
|
|
ToolBar.Visibility = Visibility.Collapsed;
|
|
|
Image_Title.Source = SCADA.CommonCtrl.WpfHelper.VisualHelper.ImageToImageSource(@"Icon\VertivBck.png");
|
|
@@ -103,12 +102,11 @@ namespace SCADA_DAQ.Customer
|
|
|
//var highmachineStopTime = totalTimeOfDay - highmachineRunTime - highmachineMoldTime - DevicScheduleStop("高机母线冲剪机") - highmachineArlamDouble
|
|
|
// + DeviceScheduleStopBetweenTime("高机母线冲剪机") + DeviceAlarmScheduleStopBetweenTime("高机母线冲剪机");//高机母线冲剪机等待时间
|
|
|
//var highmachineStopTimeSpan = TimeSpan.FromSeconds(Math.Round(highmachineStopTime)).ToString();
|
|
|
-
|
|
|
-
|
|
|
- var kimFangyuanStopTime = DeviceTimeValue("金方圆数控母线冲孔机", "停止标志位");//金方圆数控母线冲孔机等待时间
|
|
|
+ var kimFangyuanStopTime = DeviceTimeValue("金方圆数控母线冲孔机", "停止标志位") - DevicMainTableTime("金方圆铜排冲剪机").TotalSeconds;//金方圆数控母线冲孔机等待时间
|
|
|
var kimFangyuanStopTimeSpan = TimeSpan.FromSeconds(Math.Round(kimFangyuanStopTime)).ToString();
|
|
|
|
|
|
- var highmachineStopTime = DeviceTimeValue("高机母线冲剪机", "停止标志位");//高机母线冲剪机等待时间
|
|
|
+
|
|
|
+ var highmachineStopTime = DeviceTimeValue("高机母线冲剪机", "停止标志位") - DevicMainTableTime("高机铜排冲剪机").TotalSeconds;//高机母线冲剪机等待时间
|
|
|
var highmachineStopTimeSpan = TimeSpan.FromSeconds(Math.Round(highmachineStopTime)).ToString();
|
|
|
|
|
|
var kimFangyuanTimeValue = new double[] { kimFangyuanRunTime, kimFangyuanStopTime, kimFangyuanArlamDouble, kimFangyuanMoldTime };
|
|
@@ -150,7 +148,7 @@ namespace SCADA_DAQ.Customer
|
|
|
//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"));
|
|
|
//获取当天所有设备信息
|
|
@@ -237,114 +235,87 @@ namespace SCADA_DAQ.Customer
|
|
|
}
|
|
|
|
|
|
|
|
|
- public List<DeviceAlarmInformationModel> deviceAlarmTime { get; set; }
|
|
|
+ public List<AlarmColumModel> deviceAlarmTime { get; set; }
|
|
|
+
|
|
|
+ public List<AlarmColumModel> DistinctDeviceAlarmTime { get; set; }
|
|
|
public void GetDeviceAlarmTime()//获取设备一天报警信息
|
|
|
{
|
|
|
var classesStartTime = Convert.ToDateTime(DateTime.Now.ToString("00:00:00"));
|
|
|
var classesEndTime = Convert.ToDateTime(DateTime.Now.ToString("23:59:59"));
|
|
|
- deviceAlarmTime = DAL.Base_AlarmLog.GetData<DeviceAlarmInformationModel>()?.Where(t => t.CreateTime >= classesStartTime & t.CreateTime <= classesEndTime).ToList();
|
|
|
- }
|
|
|
+ deviceAlarmTime = DAL.Base_AlarmLog.GetData<AlarmColumModel>()?.Where(t => t.CreateTime >= classesStartTime & t.CreateTime <= classesEndTime).ToList();
|
|
|
|
|
|
- public double DeviceAlarmTime(string deviceName)
|
|
|
- {
|
|
|
- var deviceAlarm = deviceAlarmTime.ToLookup(t => t.Device)[deviceName].Sum(t => t.Duration);//获取设备报警时间
|
|
|
- return Convert.ToDouble(deviceAlarm);
|
|
|
+ var classesYesterdayStartTime = Convert.ToDateTime(DateTime.Now.AddDays(-1).Date);
|
|
|
+ var classesDayEndTime = Convert.ToDateTime(DateTime.Now);
|
|
|
+ DistinctDeviceAlarmTime = DAL.Base_AlarmLog.GetData<AlarmColumModel>()?.Where(t => t.StartTime >= classesYesterdayStartTime & t.EndTime <= classesDayEndTime).ToList();
|
|
|
|
|
|
}
|
|
|
+ public List<DeviceScheduleStopModel> deviceStopTime { get; set; }
|
|
|
|
|
|
- public List<DeviceWorkTimeModel> highDeviceWaitTime { get; set; }//高机设备一天通电时间的信息
|
|
|
- public void GetHighDeviceWaitTime()
|
|
|
+ public void GetDeviceStopTime()//获取计划停止时间
|
|
|
{
|
|
|
- var classesStartTime = Convert.ToDateTime(DateTime.Now.ToString("00:00:00"));
|
|
|
- var classesEndTime = Convert.ToDateTime(DateTime.Now.ToString("23:59:59"));
|
|
|
- highDeviceWaitTime = DAL.App_Vertiv_WorkTime.GetData<DeviceWorkTimeModel>()?.Where(t => t.TurnOnTime >= classesStartTime & t.TurnOnTime <= classesEndTime).ToList();
|
|
|
+ deviceStopTime = DAL.App_Vertiv_DeviceScheduleStop.GetData<DeviceScheduleStopModel>();
|
|
|
}
|
|
|
|
|
|
- public double HighDeviceWaitTime(string deviceName)//高机一天通电的时长
|
|
|
- {
|
|
|
-
|
|
|
- var highDeviceWait = highDeviceWaitTime.ToLookup(t => t.DeviceName)[deviceName].Sum(t => t.DurationSec);//获取高机设备等待时间
|
|
|
- return highDeviceWait;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public List<MachineInfoModel> DeviceMachineInformation { get; set; }
|
|
|
-
|
|
|
- public List<DeviceScheduleStopModel> DeviceScheduleStopInformation { get; set; }
|
|
|
-
|
|
|
- public int DeviceScheduleStopBetWeenTime { get; set; }
|
|
|
-
|
|
|
- public List<int> DeviceScheduleStopBetweenTimeList { get; set; }
|
|
|
-
|
|
|
- public int IntValue { get; set; }
|
|
|
- public void GetDeviceScheduleStopBetweenTime()
|
|
|
- {
|
|
|
- DeviceScheduleStopInformation = Env.SqlDAL.App_Vertiv_DeviceScheduleStop.GetData<DeviceScheduleStopModel>();
|
|
|
- DeviceMachineInformation = Env.SqlDAL.App_Vertiv_MachineInfo.GetData<MachineInfoModel>();
|
|
|
- }
|
|
|
- public double DeviceScheduleStopBetweenTime(string deviceName)
|
|
|
+ public double DeviceAlarmTime(string deviceName)
|
|
|
{
|
|
|
- IntValue = 0;
|
|
|
- List<int> DeviceValue = new List<int>();
|
|
|
- var deviceScheduleStop = DeviceScheduleStopInformation.ToLookup(t => t.Device)[deviceName];
|
|
|
- foreach (var item in deviceScheduleStop)
|
|
|
+ var timeStopTime = deviceStopTime.ToLookup(t => t.Device)[deviceName];
|
|
|
+ var timeStopPieces = new List<TimePiece>();
|
|
|
+ if (timeStopTime.Count() != 0)
|
|
|
{
|
|
|
-
|
|
|
- var classesStartTime = Convert.ToDateTime(DateTime.Now.ToString(item.StartTime.ToString()));
|
|
|
- var classesEndTime = Convert.ToDateTime(DateTime.Now.ToString(item.EndTime.ToString()));
|
|
|
- var deviceBetweenTime = DeviceMachineInformation.ToLookup(t => t.Device)[deviceName]?.Where(t => t.CreateTime >= classesStartTime & t.CreateTime <= classesEndTime);
|
|
|
- DeviceScheduleStopBetWeenTime = deviceBetweenTime.Sum(t => t.DurationSec);
|
|
|
- DeviceValue.Add(DeviceScheduleStopBetWeenTime);
|
|
|
+ foreach (var item in timeStopTime)
|
|
|
+ {
|
|
|
+ timeStopPieces.Add(new TimePiece
|
|
|
+ {
|
|
|
+ StartTime = Convert.ToDateTime(item.StartTime.ToString()).TimeOfDay,
|
|
|
+ EndTime = Convert.ToDateTime(item.EndTime.ToString()).TimeOfDay
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ var informationValue = deviceAlarmTime?.ToLookup(t => t.Device_Str)[deviceName];
|
|
|
+ var deviceValueInformation = DistinctDeviceAlarmTime.ToLookup(t => t.Device_Str)[deviceName];
|
|
|
|
|
|
- DeviceScheduleStopBetweenTimeList = DeviceValue;
|
|
|
- for (int i = 0; i < DeviceScheduleStopBetweenTimeList.Count; i++)
|
|
|
+ var timePieces = new List<TimePiece>();
|
|
|
+ if (deviceValueInformation.Count() != 0)
|
|
|
{
|
|
|
- IntValue = DeviceScheduleStopBetweenTimeList[i] + IntValue;
|
|
|
- }
|
|
|
- return IntValue;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public List<AlarmColumModel> DeviceAlarmMachineInformation { get; set; }
|
|
|
-
|
|
|
- public List<DeviceScheduleStopModel> DeviceAlarmScheduleStopInformation { get; set; }
|
|
|
- public int DeviceAlarmInt { get; set; }
|
|
|
-
|
|
|
+ foreach (var item in deviceValueInformation)
|
|
|
+ {
|
|
|
+ timePieces.Add(new TimePiece
|
|
|
+ {
|
|
|
+ StartTime = Convert.ToDateTime(DateTime.Now.ToString("00:00:00")).TimeOfDay,
|
|
|
+ EndTime = item.EndTime.TimeOfDay
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- public int DeviceAlarmIntValue { get; set; }
|
|
|
+ }
|
|
|
+ if (informationValue.Count() != 0)
|
|
|
+ {
|
|
|
+ foreach (var item in informationValue)
|
|
|
+ {
|
|
|
+ timePieces.Add(new TimePiece
|
|
|
+ {
|
|
|
+ StartTime = item.StartTime.TimeOfDay,
|
|
|
+ EndTime = item.EndTime.TimeOfDay
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ timePieces = new List<TimePiece>() {
|
|
|
|
|
|
+ new TimePiece{StartTime =TimeSpan.FromSeconds(DateTime.Now.ToOADate()) ,
|
|
|
+ EndTime = TimeSpan.FromSeconds(DateTime.Now.ToOADate())},
|
|
|
+ };
|
|
|
+ }
|
|
|
|
|
|
- public List<int> DeviceAlarmIntList { get; set; }
|
|
|
- public void GetDeviceAlarmScheduleStopBetweenTime()
|
|
|
- {
|
|
|
- DeviceAlarmScheduleStopInformation = Env.SqlDAL.App_Vertiv_DeviceScheduleStop.GetData<DeviceScheduleStopModel>();
|
|
|
+ var total = TimeTotalHelper.DistinctPlanStopTime(TimeTotalHelper.DistinctTime(timePieces), timeStopPieces);
|
|
|
+ var doubletotal = total.TotalSeconds;
|
|
|
+ return doubletotal;
|
|
|
|
|
|
- DeviceAlarmMachineInformation = Env.SqlDAL.Base_AlarmLog.GetData<AlarmColumModel>();
|
|
|
}
|
|
|
|
|
|
|
|
|
- public double DeviceAlarmScheduleStopBetweenTime(string deviceName)
|
|
|
- {
|
|
|
- DeviceAlarmIntValue = 0;
|
|
|
- List<int> DeviceValue = new List<int>();
|
|
|
- var deviceScheduleStop = DeviceAlarmScheduleStopInformation.ToLookup(t => t.Device)[deviceName];
|
|
|
- foreach (var item in deviceScheduleStop)
|
|
|
- {
|
|
|
- var classesStartTime = Convert.ToDateTime(DateTime.Now.ToString(item.StartTime.ToString()));
|
|
|
- var classesEndTime = Convert.ToDateTime(DateTime.Now.ToString(item.EndTime.ToString()));
|
|
|
- var deviceBetweenTime = DeviceAlarmMachineInformation.ToLookup(t => t.Device_Str)[deviceName]?.Where(t => t.CreateTime >= classesStartTime & t.CreateTime <= classesEndTime);
|
|
|
- DeviceAlarmInt = deviceBetweenTime.Sum(t => t.DurationSec);
|
|
|
- DeviceValue.Add(DeviceAlarmInt);
|
|
|
- }
|
|
|
-
|
|
|
- DeviceAlarmIntList = DeviceValue;
|
|
|
- for (int i = 0; i < DeviceAlarmIntList.Count; i++)
|
|
|
- {
|
|
|
- DeviceAlarmIntValue = DeviceAlarmIntList[i] + DeviceAlarmIntValue;
|
|
|
- }
|
|
|
- return DeviceAlarmIntValue;
|
|
|
- }
|
|
|
+
|
|
|
private void Schedual_DateTimeChanged(object sender, SCADA.CommonLib.DateTimeChangedArgs e)
|
|
|
{
|
|
|
|
|
@@ -358,10 +329,8 @@ namespace SCADA_DAQ.Customer
|
|
|
GetRepairTime();
|
|
|
GetScheduleStopTime();
|
|
|
GetDeviceAlarmTime();
|
|
|
- GetHighDeviceWaitTime();
|
|
|
- GetDeviceScheduleStopBetweenTime();
|
|
|
- GetDeviceAlarmScheduleStopBetweenTime();
|
|
|
- var kimFangyuanRepairTime = "倒计时" + DeviceRepairTime("金方圆铜排冲剪机").ToString() + "天";//金方圆铜排冲剪机设备保养信息
|
|
|
+ GetDeviceStopTime();
|
|
|
+ var kimFangyuanRepairTime = "倒计时" + DeviceRepairTime("金方圆铜排冲剪机").ToString() + "天";//金方圆铜排冲剪机设备保养信息
|
|
|
var highmachineRepairTime = "倒计时" + DeviceRepairTime("高机铜排冲剪机").ToString() + "天";//高机铜排冲剪机设备保养信息
|
|
|
var kimFangyuanArlamTimeSpanString = Convert.ToString(DevicMainTableTime("金方圆铜排冲剪机")
|
|
|
+ TimeSpan.FromSeconds(DeviceTimeValue("金方圆数控母线冲孔机", "维修时间")) + TimeSpan.FromSeconds(DeviceAlarmTime("金方圆数控母线冲孔机")));//获取金方圆铜排冲剪机设备维修时间
|
|
@@ -388,19 +357,21 @@ namespace SCADA_DAQ.Customer
|
|
|
|
|
|
|
|
|
double totalTimeOfDay = TimeSpan.Parse(DateTime.Now.ToString("HH:mm:ss")).TotalSeconds;
|
|
|
-
|
|
|
- var kimFangyuanStopTime = DeviceTimeValue("金方圆数控母线冲孔机", "停止标志位");//金方圆数控母线冲孔机等待时间
|
|
|
+
|
|
|
+ var kimFangyuanStopTime = DeviceTimeValue("金方圆数控母线冲孔机", "停止标志位")- DevicMainTableTime("金方圆铜排冲剪机").TotalSeconds;//金方圆数控母线冲孔机等待时间
|
|
|
var kimFangyuanStopTimeSpan = TimeSpan.FromSeconds(Math.Round(kimFangyuanStopTime)).ToString();
|
|
|
|
|
|
|
|
|
- //var highmachineStopTime = totalTimeOfDay - highmachineRunTime - highmachineMoldTime - DeviceTimeValue("高机母线冲剪机", "计划停止时间") - highmachineArlamDouble
|
|
|
- //+ DeviceScheduleStopBetweenTime("高机母线冲剪机") + DeviceAlarmScheduleStopBetweenTime("高机母线冲剪机");//高机母线冲剪机等待时间
|
|
|
- //var highmachineStopTimeSpan = TimeSpan.FromSeconds(Math.Round(highmachineStopTime)).ToString();
|
|
|
- var highmachineStopTime = DeviceTimeValue("高机母线冲剪机", "停止标志位");//高机母线冲剪机等待时间
|
|
|
+ var highmachineStopTime = DeviceTimeValue("高机母线冲剪机", "停止标志位")- DevicMainTableTime("高机铜排冲剪机").TotalSeconds;//高机母线冲剪机等待时间
|
|
|
var highmachineStopTimeSpan = TimeSpan.FromSeconds(Math.Round(highmachineStopTime)).ToString();
|
|
|
|
|
|
var kimFangyuanTimeValue = new double[] { kimFangyuanRunTime, kimFangyuanStopTime, kimFangyuanArlamDouble, kimFangyuanMoldTime };
|
|
|
var highmachineTimeValue = new double[] { highmachineRunTime, highmachineStopTime, highmachineArlamDouble, highmachineMoldTime };
|
|
|
+
|
|
|
+ //var highmachineStopTime = totalTimeOfDay - highmachineRunTime - highmachineMoldTime - DeviceTimeValue("高机母线冲剪机", "计划停止时间") - highmachineArlamDouble
|
|
|
+ //+ DeviceScheduleStopBetweenTime("高机母线冲剪机") + DeviceAlarmScheduleStopBetweenTime("高机母线冲剪机");//高机母线冲剪机等待时间
|
|
|
+ //var highmachineStopTimeSpan = TimeSpan.FromSeconds(Math.Round(highmachineStopTime)).ToString();
|
|
|
+
|
|
|
//TimeResult[0] = $"{timespanOne.Hours.ToString("00")}时 {timespanOne.Minutes.ToString("00")}分 {timespanOne.Seconds.ToString("00")}秒";
|
|
|
//countdown[0] = "倒计时" + $"{timefinalResult}" + "天";
|
|
|
//var waitTime = $"{waitTimeResult.Hours.ToString("00")}时 {waitTimeResult.Minutes.ToString("00")}分 {Convert.ToInt32(waitTimeResult.Seconds).ToString("00")}秒";
|