|
@@ -2,6 +2,7 @@
|
|
|
using SCADA;
|
|
|
using SCADA.CommonLib;
|
|
|
using SCADA.CommonLib.Data.DIL;
|
|
|
+using SCADA.CommonLib.Helper;
|
|
|
using SCADA.Drive;
|
|
|
using SCADA_DAQ.Customer.Models;
|
|
|
using SCADA_DAQ.Plugin.Machine;
|
|
@@ -14,6 +15,7 @@ using System.Configuration;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using static log4net.Appender.RollingFileAppender;
|
|
|
using static NPOI.HSSF.Util.HSSFColor;
|
|
|
|
|
|
namespace SCADA_DAQ.Customer.Machines
|
|
@@ -68,8 +70,8 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
WaitTime.OnOrgID_Str = "";
|
|
|
WaitNameStateCode = "";
|
|
|
}
|
|
@@ -77,8 +79,8 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
ChangeModel.OnOrgID_Str = "";
|
|
|
}
|
|
|
|
|
@@ -86,8 +88,8 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
ProgramStart.OnOrgID_Str = "";
|
|
|
}
|
|
|
|
|
@@ -95,9 +97,9 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{RepairTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - RepairTime.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - RepairTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Parse(DateTime.Now.Format()) - RepairTime.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - RepairTime.StateOnTime_Dt).TotalSeconds));
|
|
|
RepairTime.OnOrgID_Str = "";
|
|
|
}
|
|
|
|
|
@@ -105,9 +107,9 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{AlarmTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - AlarmTime.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - AlarmTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Parse(DateTime.Now.Format()) - AlarmTime.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - AlarmTime.StateOnTime_Dt).TotalSeconds));
|
|
|
AlarmTime.OnOrgID_Str = "";
|
|
|
}
|
|
|
|
|
@@ -119,194 +121,22 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
if (ConnectState == SCADA.Comm.ConnectStates.Connected)
|
|
|
{
|
|
|
- var repairTime = this.GetListenReg("维修时间");
|
|
|
- if (repairTime.Value == 1)
|
|
|
- {
|
|
|
- RepairValueRegTrue = true;
|
|
|
- RepairTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- RepairTime.StateOnTime_Dt = DateTime.Now;
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, RepairTime.OnOrgID_Str),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "维修时间"));
|
|
|
-
|
|
|
- }
|
|
|
- else if (repairTime.Value == 0)
|
|
|
- {
|
|
|
- if (RepairTime.OnOrgID_Str != "")
|
|
|
- {
|
|
|
- RepairValueRegTrue = false;
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
- $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{RepairTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - RepairTime.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - RepairTime.StateOnTime_Dt).TotalSeconds));
|
|
|
- RepairTime.OnOrgID_Str = "";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- var runTIme = this.GetListenReg("运行标志位");
|
|
|
- if (runTIme.Value == 1 && RepairValueRegTrue != true && AlarmCode != true)
|
|
|
- {
|
|
|
- ProgramStart.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- ProgramStart.StateOnTime_Dt = DateTime.Now;
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, ProgramStart.OnOrgID_Str),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "运行标志位"));
|
|
|
- }
|
|
|
- else if (runTIme.Value == 0)
|
|
|
- {
|
|
|
- if (ProgramStart.OnOrgID_Str != "")
|
|
|
- {
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
- $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
- ProgramStart.OnOrgID_Str = "";
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- var changeMoldTime = this.GetListenReg("换模标志位");
|
|
|
- if (changeMoldTime.Value == 0 && RepairValueRegTrue != true && AlarmCode != true)
|
|
|
- {
|
|
|
- ChangeModel.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- ChangeModel.StateOnTime_Dt = DateTime.Now;
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, ChangeModel.OnOrgID_Str),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "换模标志位"));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (ChangeModel.OnOrgID_Str != "")
|
|
|
- {
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
- $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- //new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - ProgramStart.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
- ChangeModel.OnOrgID_Str = "";
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- var runFlag = this.GetListenReg("运行标志位");
|
|
|
- var toolChangeFlag = this.GetListenReg("换模标志位");
|
|
|
- var repairFlag = this.GetListenReg("维修时间");
|
|
|
- RegInfo reg = runFlag.Value == 1 ? runFlag : toolChangeFlag.Value == 0 ? toolChangeFlag : repairFlag.Value == 1 ? repairFlag : null;
|
|
|
- if (reg == null && AlarmCode != true)
|
|
|
- {
|
|
|
- if (WaitNameStateCode != "停止标志位")
|
|
|
- {
|
|
|
- WaitTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- WaitTime.StateOnTime_Dt = DateTime.Now;
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, WaitTime.OnOrgID_Str),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "停止标志位"));
|
|
|
- WaitNameStateCode = "停止标志位";
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (WaitTime.OnOrgID_Str != "")
|
|
|
- {
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
- $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- //new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - ProgramStart.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
- WaitTime.OnOrgID_Str = "";
|
|
|
- WaitNameStateCode = "";
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (AlarmCode == true && RepairValueRegTrue != true)
|
|
|
- {
|
|
|
- if (WaitTime.OnOrgID_Str != "")
|
|
|
- {
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
- $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
- WaitTime.OnOrgID_Str = "";
|
|
|
- WaitNameStateCode = "";
|
|
|
- }
|
|
|
- if (ChangeModel.OnOrgID_Str != "")
|
|
|
- {
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
- $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
- ChangeModel.OnOrgID_Str = "";
|
|
|
- }
|
|
|
- if (ProgramStart.OnOrgID_Str != "")
|
|
|
- {
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
- $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
- ProgramStart.OnOrgID_Str = "";
|
|
|
- }
|
|
|
- if (AlarmTime.OnOrgID_Str == "")
|
|
|
- {
|
|
|
- AlarmTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- AlarmTime.StateOnTime_Dt = DateTime.Now;
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, AlarmTime.OnOrgID_Str),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "故障标志位"));
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (AlarmTime.OnOrgID_Str != "")
|
|
|
- {
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
- $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{AlarmTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - AlarmTime.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - AlarmTime.StateOnTime_Dt).TotalSeconds));
|
|
|
- AlarmTime.OnOrgID_Str = "";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ DeviceInsert();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (WaitNameStateCode != "停止标志位")
|
|
|
{
|
|
|
WaitTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- WaitTime.StateOnTime_Dt = DateTime.Now;
|
|
|
+ WaitTime.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, WaitTime.OnOrgID_Str),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "停止标志位"));
|
|
|
WaitNameStateCode = "停止标志位";
|
|
|
}
|
|
|
- //WaitTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- //WaitTime.StateOnTime_Dt = DateTime.Now;
|
|
|
- //Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
- // new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, WaitTime.OnOrgID_Str),
|
|
|
- // new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- // new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
- // new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "停止标志位"));
|
|
|
- //WaitNameStateCode = "停止标志位";
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -334,11 +164,11 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
RepairValueRegTrue = true;
|
|
|
RepairTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- RepairTime.StateOnTime_Dt = DateTime.Now;
|
|
|
+ RepairTime.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, RepairTime.OnOrgID_Str),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "维修时间"));
|
|
|
|
|
|
}
|
|
@@ -349,9 +179,9 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{RepairTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - RepairTime.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - RepairTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, DateTime.Parse(DateTime.Now.Format()) - RepairTime.StateOnTime_Dt),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - RepairTime.StateOnTime_Dt).TotalSeconds));
|
|
|
RepairTime.OnOrgID_Str = "";
|
|
|
}
|
|
|
|
|
@@ -366,11 +196,11 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
if (reg.Value == 1)
|
|
|
{
|
|
|
ProgramStart.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- ProgramStart.StateOnTime_Dt = DateTime.Now;
|
|
|
+ ProgramStart.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, ProgramStart.OnOrgID_Str),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "运行标志位"));
|
|
|
}
|
|
|
else if (reg.Value == 0)
|
|
@@ -379,8 +209,8 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
ProgramStart.OnOrgID_Str = "";
|
|
|
}
|
|
|
|
|
@@ -393,11 +223,11 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
if (reg.Value == 0)
|
|
|
{
|
|
|
ChangeModel.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- ChangeModel.StateOnTime_Dt = DateTime.Now;
|
|
|
+ ChangeModel.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, ChangeModel.OnOrgID_Str),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "换模标志位"));
|
|
|
}
|
|
|
else
|
|
@@ -406,9 +236,9 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
//new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - ProgramStart.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
ChangeModel.OnOrgID_Str = "";
|
|
|
}
|
|
|
|
|
@@ -423,11 +253,11 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
if (WaitTime.OnOrgID_Str == "" & WaitNameStateCode != "停止标志位")
|
|
|
{
|
|
|
WaitTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- WaitTime.StateOnTime_Dt = DateTime.Now;
|
|
|
+ WaitTime.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, WaitTime.OnOrgID_Str),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "停止标志位"));
|
|
|
WaitNameStateCode = "停止标志位";
|
|
|
}
|
|
@@ -439,9 +269,9 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
//new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - ProgramStart.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
WaitTime.OnOrgID_Str = "";
|
|
|
WaitNameStateCode = "";
|
|
|
}
|
|
@@ -455,8 +285,8 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
WaitTime.OnOrgID_Str = "";
|
|
|
WaitNameStateCode = "";
|
|
|
}
|
|
@@ -464,26 +294,26 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
ChangeModel.OnOrgID_Str = "";
|
|
|
}
|
|
|
if (ProgramStart.OnOrgID_Str != "")
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
ProgramStart.OnOrgID_Str = "";
|
|
|
}
|
|
|
if (AlarmTime.OnOrgID_Str == "")
|
|
|
{
|
|
|
AlarmTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- AlarmTime.StateOnTime_Dt = DateTime.Now;
|
|
|
+ AlarmTime.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, AlarmTime.OnOrgID_Str),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "故障标志位"));
|
|
|
}
|
|
|
|
|
@@ -496,30 +326,17 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{AlarmTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - AlarmTime.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - AlarmTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Parse(DateTime.Now.Format()) - AlarmTime.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - AlarmTime.StateOnTime_Dt).TotalSeconds));
|
|
|
AlarmTime.OnOrgID_Str = "";
|
|
|
+
|
|
|
+ DeviceInsert();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- if (WaitNameStateCode != "停止标志位")
|
|
|
- {
|
|
|
- WaitTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- WaitTime.StateOnTime_Dt = DateTime.Now;
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, WaitTime.OnOrgID_Str),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "停止标志位"));
|
|
|
- WaitNameStateCode = "停止标志位";
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -535,22 +352,23 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
|
|
|
if (ConnectState != SCADA.Comm.ConnectStates.Connected)
|
|
|
{
|
|
|
+
|
|
|
PowerOn.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
Env.SqlDAL.App_Vertiv_WorkTime.Insert(
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.OrgID_Str, PowerOn.OnOrgID_Str),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DeviceName_Str, BaseDevice.DeviceID)
|
|
|
);
|
|
|
PowerOn.StateOnTime_Dt = DateTime.Now;
|
|
|
-
|
|
|
+ DeviceUpdate();
|
|
|
|
|
|
if (WaitNameStateCode != "停止标志位")
|
|
|
{
|
|
|
WaitTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
- WaitTime.StateOnTime_Dt = DateTime.Now;
|
|
|
+ WaitTime.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, WaitTime.OnOrgID_Str),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Now),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "停止标志位"),
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.TagName_Str, "停止标志位"));
|
|
|
WaitNameStateCode = "停止标志位";
|
|
@@ -572,11 +390,10 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ DeviceInsert();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -606,7 +423,13 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DeviceName_Str, BaseDevice.DeviceID));
|
|
|
PowerOn.StateOnTime_Dt = DateTime.Now;
|
|
|
}
|
|
|
+ if (!IsOpenTime)
|
|
|
+ {
|
|
|
+ DeviceUpdate();
|
|
|
|
|
|
+ DeviceInsert();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -620,8 +443,8 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -629,15 +452,15 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
}
|
|
|
if (ChangeModel.OnOrgID_Str != "")
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
|
|
|
}
|
|
|
|
|
@@ -645,8 +468,8 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
|
|
|
}
|
|
|
|
|
@@ -654,9 +477,9 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{RepairTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - RepairTime.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - RepairTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Parse(DateTime.Now.Format()) - RepairTime.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - RepairTime.StateOnTime_Dt).TotalSeconds));
|
|
|
|
|
|
}
|
|
|
|
|
@@ -664,9 +487,9 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{AlarmTime.OnOrgID_Str}'",
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Now),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - AlarmTime.StateOnTime_Dt)),
|
|
|
- new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Now - AlarmTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Parse(DateTime.Now.Format()) - AlarmTime.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format())- AlarmTime.StateOnTime_Dt).TotalSeconds));
|
|
|
|
|
|
}
|
|
|
|
|
@@ -674,6 +497,226 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public void DeviceUpdate()
|
|
|
+ {
|
|
|
+ if (WaitTime.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ WaitTime.OnOrgID_Str = "";
|
|
|
+ WaitNameStateCode = "";
|
|
|
+ }
|
|
|
+ if (ChangeModel.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
+ ChangeModel.OnOrgID_Str = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ProgramStart.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
+ ProgramStart.OnOrgID_Str = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (RepairTime.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{RepairTime.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Parse(DateTime.Now.Format()) - RepairTime.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - RepairTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ RepairTime.OnOrgID_Str = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (AlarmTime.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{AlarmTime.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Parse(DateTime.Now.Format()) - AlarmTime.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - AlarmTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ AlarmTime.OnOrgID_Str = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ public void DeviceInsert()
|
|
|
+ {
|
|
|
+ var repairTime = this.GetListenReg("维修时间");
|
|
|
+ if (repairTime.Value == 1)
|
|
|
+ {
|
|
|
+ RepairValueRegTrue = true;
|
|
|
+ RepairTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
+ RepairTime.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, RepairTime.OnOrgID_Str),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "维修时间"));
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (repairTime.Value == 0)
|
|
|
+ {
|
|
|
+ if (RepairTime.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ RepairValueRegTrue = false;
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{RepairTime.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Parse(DateTime.Now.Format()) - RepairTime.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - RepairTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ RepairTime.OnOrgID_Str = "";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var runTIme = this.GetListenReg("运行标志位");
|
|
|
+ if (runTIme.Value == 1 && RepairValueRegTrue != true && AlarmCode != true)
|
|
|
+ {
|
|
|
+ ProgramStart.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
+ ProgramStart.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, ProgramStart.OnOrgID_Str),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "运行标志位"));
|
|
|
+ }
|
|
|
+ else if (runTIme.Value == 0)
|
|
|
+ {
|
|
|
+ if (ProgramStart.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
+ ProgramStart.OnOrgID_Str = "";
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var changeMoldTime = this.GetListenReg("换模标志位");
|
|
|
+ if (changeMoldTime.Value == 0 && RepairValueRegTrue != true && AlarmCode != true)
|
|
|
+ {
|
|
|
+ ChangeModel.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
+ ChangeModel.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, ChangeModel.OnOrgID_Str),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "换模标志位"));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (ChangeModel.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ //new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - ProgramStart.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
+ ChangeModel.OnOrgID_Str = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var runFlag = this.GetListenReg("运行标志位");
|
|
|
+ var toolChangeFlag = this.GetListenReg("换模标志位");
|
|
|
+ var repairFlag = this.GetListenReg("维修时间");
|
|
|
+ RegInfo reg = runFlag.Value == 1 ? runFlag : toolChangeFlag.Value == 0 ? toolChangeFlag : repairFlag.Value == 1 ? repairFlag : null;
|
|
|
+ if (reg == null && AlarmCode != true)
|
|
|
+ {
|
|
|
+ if (WaitNameStateCode != "停止标志位")
|
|
|
+ {
|
|
|
+ WaitTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
+ WaitTime.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, WaitTime.OnOrgID_Str),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "停止标志位"));
|
|
|
+ WaitNameStateCode = "停止标志位";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (WaitTime.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ //new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Now - ProgramStart.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ WaitTime.OnOrgID_Str = "";
|
|
|
+ WaitNameStateCode = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (AlarmCode == true && RepairValueRegTrue != true)
|
|
|
+ {
|
|
|
+ if (WaitTime.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - WaitTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ WaitTime.OnOrgID_Str = "";
|
|
|
+ WaitNameStateCode = "";
|
|
|
+ }
|
|
|
+ if (ChangeModel.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
+ ChangeModel.OnOrgID_Str = "";
|
|
|
+ }
|
|
|
+ if (ProgramStart.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
+ ProgramStart.OnOrgID_Str = "";
|
|
|
+ }
|
|
|
+ if (AlarmTime.OnOrgID_Str == "")
|
|
|
+ {
|
|
|
+ AlarmTime.OnOrgID_Str = Guid.NewGuid().ToString();
|
|
|
+ AlarmTime.StateOnTime_Dt = DateTime.Parse(DateTime.Now.Format());
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Insert(
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateId_Str, AlarmTime.OnOrgID_Str),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Device_Str, BaseDevice.DeviceID),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StartTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.StateCode_Str, "故障标志位"));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (AlarmTime.OnOrgID_Str != "")
|
|
|
+ {
|
|
|
+ Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
+ $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{AlarmTime.OnOrgID_Str}'",
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.EndTime_Dt, DateTime.Parse(DateTime.Now.Format())),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.Duration_Dt, (DateTime.Parse(DateTime.Now.Format()) - AlarmTime.StateOnTime_Dt)),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.DurationSec_Int, (DateTime.Parse(DateTime.Now.Format()) - AlarmTime.StateOnTime_Dt).TotalSeconds));
|
|
|
+ AlarmTime.OnOrgID_Str = "";
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;
|