|
@@ -30,186 +30,339 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
public YaweiStateInfoModel RepairTime = new YaweiStateInfoModel();
|
|
|
|
|
|
public string WaitNameStateCode { get; set; }
|
|
|
+
|
|
|
+ public string OrgID { get; set; }
|
|
|
private int _MyProperty;
|
|
|
|
|
|
public CP1HMachine(string machieID) : base(machieID)
|
|
|
{
|
|
|
Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
|
|
|
+ PropertyChanged += CP1HMachine_PropertyChanged;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public bool RepairValueRegFalse { get; set; }
|
|
|
|
|
|
public bool RepairValueRegTrue { get; set; }
|
|
|
|
|
|
public int Flag { get; set; }
|
|
|
|
|
|
- protected override void RegReadValueChanged(object sender, RegReadValueChangedEventArgs e)
|
|
|
+ private void CP1HMachine_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
- if (IsOpenTime == true)
|
|
|
+ if (e.PropertyName == nameof(IsOpenTime))
|
|
|
{
|
|
|
- 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 (IsOpenTime == true)
|
|
|
+ {
|
|
|
+ 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));
|
|
|
+ WaitTime.OnOrgID_Str = "";
|
|
|
+ WaitNameStateCode = "";
|
|
|
+ }
|
|
|
+ if (ChangeModel.OnOrgID_Str != null)
|
|
|
+ {
|
|
|
+ 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 = "";
|
|
|
+ }
|
|
|
|
|
|
- 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 != null)
|
|
|
+ {
|
|
|
+ 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 = "";
|
|
|
+ }
|
|
|
|
|
|
- Env.SqlDAL.App_Vertiv_MachineInfo.Update(
|
|
|
- $"{T_Col_Name.App_Vertiv_MachineInfo.StateId_Str} = '{ProgramStart.OnOrgID_Str}'",
|
|
|
+ if (RepairTime.OnOrgID_Str != null)
|
|
|
+ {
|
|
|
+ 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.DurationSec_Int, (DateTime.Now - ProgramStart.StateOnTime_Dt).TotalSeconds));
|
|
|
- ProgramStart.OnOrgID_Str = "";
|
|
|
+ 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 = "";
|
|
|
+ }
|
|
|
|
|
|
- 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 = "";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (!IsOpenTime)
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- if (ConnectState == SCADA.Comm.ConnectStates.Connected)
|
|
|
+ if (!IsOpenTime)
|
|
|
{
|
|
|
- base.RegReadValueChanged(sender, e);
|
|
|
- var reg = (RegInfo)sender;
|
|
|
-
|
|
|
- int RepairValueRegFlag = 0;
|
|
|
- if (reg.Comment.Variable == "维修时间")
|
|
|
+ if (ConnectState == SCADA.Comm.ConnectStates.Connected)
|
|
|
{
|
|
|
-
|
|
|
- RepairValueRegFlag = (int)reg.Value;
|
|
|
- if (reg.Value == 1)
|
|
|
+ var reg = (RegInfo)sender;
|
|
|
+ int RepairValueRegFlag = 0;
|
|
|
+ if (reg.Comment.Variable == "维修时间")
|
|
|
{
|
|
|
- RepairValueRegTrue = reg.Value == 1;
|
|
|
- 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, "维修时间"));
|
|
|
+
|
|
|
+ RepairValueRegFlag = (int)reg.Value;
|
|
|
+ if (reg.Value == 1)
|
|
|
+ {
|
|
|
+ RepairValueRegTrue = reg.Value == 1;
|
|
|
+ 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 (reg.Value == 0)
|
|
|
+ {
|
|
|
+ RepairValueRegFalse = reg.Value == 0;
|
|
|
+ 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 = "";
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
- else if (reg.Value == 0)
|
|
|
+
|
|
|
+
|
|
|
+ if (reg.Comment.Variable == "运行标志位" && RepairValueRegFalse)
|
|
|
{
|
|
|
- RepairValueRegFalse = reg.Value == 0;
|
|
|
- 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 = "";
|
|
|
|
|
|
+ if (reg.Value == 1)
|
|
|
+ {
|
|
|
+ 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 (reg.Value == 0)
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ 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 (reg.Comment.Variable == "运行标志位" && RepairValueRegFalse)
|
|
|
- {
|
|
|
+ }
|
|
|
|
|
|
- if (reg.Value == 1)
|
|
|
+ if (reg.Comment.Variable == "换模标志位" && RepairValueRegFalse)
|
|
|
{
|
|
|
- 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, "运行标志位"));
|
|
|
+ if (reg.Value == 0)
|
|
|
+ {
|
|
|
+ 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
|
|
|
+ {
|
|
|
+ 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 = "";
|
|
|
+ }
|
|
|
}
|
|
|
- else if (reg.Value == 0)
|
|
|
+ var runFlag = this.GetListenReg("运行标志位");
|
|
|
+ var toolChangeFlag = this.GetListenReg("换模标志位");
|
|
|
+ var repairFlag = this.GetListenReg("维修时间");
|
|
|
+ reg = runFlag.Value == 1 ? runFlag : toolChangeFlag.Value == 0 ? toolChangeFlag : repairFlag.Value == 1 ? repairFlag : null;
|
|
|
+ if (reg == null)
|
|
|
{
|
|
|
+ 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
|
|
|
+ {
|
|
|
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 = "";
|
|
|
+ $"{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 = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ 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 = "停止标志位";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ protected override void RegReadValueChanged(object sender, RegReadValueChangedEventArgs e)
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ if (!IsOpenTime)
|
|
|
+ {
|
|
|
+ if (ConnectState == SCADA.Comm.ConnectStates.Connected)
|
|
|
+ {
|
|
|
+ base.RegReadValueChanged(sender, e);
|
|
|
+ var reg = (RegInfo)sender;
|
|
|
+ int RepairValueRegFlag = 0;
|
|
|
+ if (reg.Comment.Variable == "维修时间")
|
|
|
+ {
|
|
|
+
|
|
|
+ RepairValueRegFlag = (int)reg.Value;
|
|
|
+ if (reg.Value == 1)
|
|
|
+ {
|
|
|
+ RepairValueRegTrue = reg.Value == 1;
|
|
|
+ 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 (reg.Value == 0)
|
|
|
+ {
|
|
|
+ RepairValueRegFalse = reg.Value == 0;
|
|
|
+ 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 = "";
|
|
|
+
|
|
|
|
|
|
- if (reg.Comment.Variable == "换模标志位" && RepairValueRegFalse)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (reg.Comment.Variable == "运行标志位" && RepairValueRegFalse)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (reg.Value == 1)
|
|
|
{
|
|
|
- if (reg.Value == 0)
|
|
|
- {
|
|
|
- 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
|
|
|
- {
|
|
|
- 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 = "";
|
|
|
- }
|
|
|
+ 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, "运行标志位"));
|
|
|
}
|
|
|
- var runFlag = this.GetListenReg("运行标志位");
|
|
|
- var toolChangeFlag = this.GetListenReg("换模标志位");
|
|
|
- var repairFlag = this.GetListenReg("维修时间");
|
|
|
- reg = runFlag.Value == 1 ? runFlag : toolChangeFlag.Value == 0 ? toolChangeFlag : repairFlag.Value == 1 ? repairFlag : null;
|
|
|
- if (reg == null)
|
|
|
+ else if (reg.Value == 0)
|
|
|
{
|
|
|
- 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 = "停止标志位";
|
|
|
- }
|
|
|
+
|
|
|
+ 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 (reg.Comment.Variable == "换模标志位" && RepairValueRegFalse)
|
|
|
+ {
|
|
|
+ if (reg.Value == 0)
|
|
|
+ {
|
|
|
+ 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
|
|
|
{
|
|
|
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 = "";
|
|
|
+ $"{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("维修时间");
|
|
|
+ reg = runFlag.Value == 1 ? runFlag : toolChangeFlag.Value == 0 ? toolChangeFlag : repairFlag.Value == 1 ? repairFlag : null;
|
|
|
+ if (reg == null)
|
|
|
+ {
|
|
|
+ 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, "停止标志位"),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.TagName_Str, "停止标志位"));
|
|
|
+ WaitNameStateCode = "停止标志位";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
- 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 = "停止标志位";
|
|
|
+ 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 = "";
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ 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 = "停止标志位";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -218,21 +371,26 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
base.ConnectStateChanged(sender, e);
|
|
|
if (!IsOpenTime)
|
|
|
{
|
|
|
- if (ConnectState == SCADA.Comm.ConnectStates.Connected)
|
|
|
+ if (ConnectState != SCADA.Comm.ConnectStates.Connected)
|
|
|
{
|
|
|
+ DeviceUpdate();
|
|
|
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));
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_WorkTime.DeviceName_Str, BaseDevice.DeviceID)
|
|
|
+ );
|
|
|
PowerOn.StateOnTime_Dt = DateTime.Now;
|
|
|
|
|
|
- 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 = "";
|
|
|
+ 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, "停止标志位"),
|
|
|
+ new UpdateItem(T_Col_Name.App_Vertiv_MachineInfo.TagName_Str, "停止标志位"));
|
|
|
+ WaitNameStateCode = "停止标志位";
|
|
|
+ OrgID = WaitTime.OnOrgID_Str;
|
|
|
}
|
|
|
else if (ConnectState == SCADA.Comm.ConnectStates.Connected)
|
|
|
{
|
|
@@ -245,16 +403,9 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
PowerOn.OnOrgID_Str = "";
|
|
|
}
|
|
|
|
|
|
- DeviceUpdate();
|
|
|
|
|
|
- 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 = "停止标志位";
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -292,88 +443,69 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
{
|
|
|
if (!IsOpenTime)
|
|
|
{
|
|
|
- DeviceUpdate();
|
|
|
+ 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 (ProgramStart.OnOrgID_Str != null)
|
|
|
+ {
|
|
|
+ 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));
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- public void DeviceUpdate()
|
|
|
- {
|
|
|
- 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} = '{ChangeModel.OnOrgID_Str}'",
|
|
|
+ if (RepairTime.OnOrgID_Str != null)
|
|
|
+ {
|
|
|
+ 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.DurationSec_Int, (DateTime.Now - ChangeModel.StateOnTime_Dt).TotalSeconds));
|
|
|
+ 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} = '{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));
|
|
|
|
|
|
+ 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 DeviceInsert()
|
|
|
- {
|
|
|
- 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, "维修时间"));
|
|
|
-
|
|
|
- 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, "运行标志位"));
|
|
|
-
|
|
|
- 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, "换模标志位"));
|
|
|
-
|
|
|
- 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)
|
|
|
- {
|
|
|
- if (WaitNameStateCode != "停止标志位")
|
|
|
+
|
|
|
+
|
|
|
+ if (ConnectState != SCADA.Comm.ConnectStates.Connected)
|
|
|
{
|
|
|
- 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 = "停止标志位";
|
|
|
+ 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));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
- public override void Dispose()
|
|
|
- {
|
|
|
- Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;
|
|
|
- base.Dispose();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public void DeviceUpdate()
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public override void Dispose()
|
|
|
+ {
|
|
|
+ Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;
|
|
|
+ base.Dispose();
|
|
|
+ }
|
|
|
+}
|
|
|
}
|