|
@@ -54,7 +54,7 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
if (IsOpenTime == true)
|
|
|
{
|
|
|
- if (WaitTime.OnOrgID_Str != null)
|
|
|
+ if (WaitTime.OnOrgID_Str != "")
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{WaitTime.OnOrgID_Str}'",
|
|
@@ -63,7 +63,7 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
WaitTime.OnOrgID_Str = "";
|
|
|
WaitNameStateCode = "";
|
|
|
}
|
|
|
- if (ChangeModel.OnOrgID_Str != null)
|
|
|
+ if (ChangeModel.OnOrgID_Str != "")
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ChangeModel.OnOrgID_Str}'",
|
|
@@ -72,7 +72,7 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
ChangeModel.OnOrgID_Str = "";
|
|
|
}
|
|
|
|
|
|
- if (ProgramStart.OnOrgID_Str != null)
|
|
|
+ if (ProgramStart.OnOrgID_Str != "")
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
@@ -81,7 +81,7 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
ProgramStart.OnOrgID_Str = "";
|
|
|
}
|
|
|
|
|
|
- if (RepairTime.OnOrgID_Str != null)
|
|
|
+ if (RepairTime.OnOrgID_Str != "")
|
|
|
{
|
|
|
Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
$"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{RepairTime.OnOrgID_Str}'",
|
|
@@ -441,71 +441,66 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
|
|
|
if (e.ChangeType == DateTimeChangeType.MinuteChanged)
|
|
|
{
|
|
|
- if (!IsOpenTime)
|
|
|
+ if (ConnectState != SCADA.Comm.ConnectStates.Connected)
|
|
|
{
|
|
|
- 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));
|
|
|
+ if (WaitTime.OnOrgID_Str != null)
|
|
|
+ {
|
|
|
+ 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));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if (ProgramStart.OnOrgID_Str != null)
|
|
|
+ if (WaitTime.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));
|
|
|
+ $"{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));
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if (RepairTime.OnOrgID_Str != null)
|
|
|
+ if (ChangeModel.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.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));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- 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));
|
|
|
+ $"{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));
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ 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));
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if (ConnectState != SCADA.Comm.ConnectStates.Connected)
|
|
|
+ if (RepairTime.OnOrgID_Str != "")
|
|
|
{
|
|
|
- if (WaitTime.OnOrgID_Str != null)
|
|
|
- {
|
|
|
- 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));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ 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));
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- public void DeviceUpdate()
|
|
|
- {
|
|
|
+ public void DeviceUpdate()
|
|
|
+ {
|
|
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- public override void Dispose()
|
|
|
- {
|
|
|
- Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;
|
|
|
- base.Dispose();
|
|
|
+ public override void Dispose()
|
|
|
+ {
|
|
|
+ Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;
|
|
|
+ base.Dispose();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-}
|