This commit is contained in:
gongxh
2022-05-17 09:25:44 +08:00
parent 4fe118f2e5
commit d14b2ac45f
14 changed files with 125 additions and 114 deletions

View File

@@ -15,22 +15,22 @@ namespace CleanMachine.BLL.CM
/// <summary> /// <summary>
/// 存在 /// 存在
/// </summary> /// </summary>
public bool Exists(DateTime Date) public bool Exists(DateTime Date,string UserName)
{ {
return new DayWorkTimeDAL().Exists(Date); return new DayWorkTimeDAL().Exists(Date, UserName);
} }
public bool UpdateTime(DateTime date, int value) public bool UpdateTime(DateTime date, int value,string UserName)
{ {
var _dal = new DayWorkTimeDAL(); var _dal = new DayWorkTimeDAL();
if (!_dal.Exists(date)) if (!_dal.Exists(date,UserName))
{ {
return _dal.Add(new Model.CM.DayWorkTime() { Date = date, StartValue = value, StartTime = DateTime.Now, EndValue = 0 }); return _dal.Add(new Model.CM.DayWorkTime() {UserName=UserName ,Date = date, StartValue = value, StartTime = DateTime.Now, EndValue = 0 });
} }
else else
{ {
return _dal.UpdateEndValue(new Model.CM.DayWorkTime() { Date = date, StartValue = 0, EndValue = value, EndTime = DateTime.Now }); return _dal.UpdateEndValue(new Model.CM.DayWorkTime() {UserName=UserName ,Date = date, StartValue = 0, EndValue = value, EndTime = DateTime.Now });
} }
} }

View File

@@ -16,10 +16,10 @@ namespace CleanMachine.DAL.CM
/// <summary> /// <summary>
/// 存在 /// 存在
/// </summary> /// </summary>
public bool Exists(DateTime Date) public bool Exists(DateTime Date,string UserName)
{ {
string strSql = @"SELECT count(1) from CM_DayWorkTime WHERE Date=@Date "; string strSql = @"SELECT count(1) from CM_DayWorkTime WHERE Date=@Date and UserName=@UserName ";
return LeadDbHelperSQLite.ExecuteScalar<int>(strSql, new { Date }) > 0; return LeadDbHelperSQLite.ExecuteScalar<int>(strSql, new { Date, UserName }) > 0;
} }
/// <summary> /// <summary>
@@ -28,9 +28,9 @@ namespace CleanMachine.DAL.CM
public bool Add(CleanMachine.Model.CM.DayWorkTime model) public bool Add(CleanMachine.Model.CM.DayWorkTime model)
{ {
string strSql = $@"INSERT INTO CM_DayWorkTime string strSql = $@"INSERT INTO CM_DayWorkTime
(Date,StartValue,EndValue,StartTime) (Date,StartValue,EndValue,StartTime,UserName)
values values
(@Date,@StartValue,@EndValue,@StartTime) "; (@Date,@StartValue,@EndValue,@StartTime,@UserName) ";
return LeadDbHelperSQLite.Execute(strSql, model) > 0; return LeadDbHelperSQLite.Execute(strSql, model) > 0;
} }
@@ -41,7 +41,7 @@ namespace CleanMachine.DAL.CM
{ {
string strSql = $@"UPDATE CM_DayWorkTime SET string strSql = $@"UPDATE CM_DayWorkTime SET
StartValue=@StartValue,EndValue=@EndValue StartValue=@StartValue,EndValue=@EndValue
WHERE Date=@Date "; WHERE Date=@Date and UserName=@UserName ";
return LeadDbHelperSQLite.Execute(strSql, model) > 0; return LeadDbHelperSQLite.Execute(strSql, model) > 0;
} }

View File

@@ -14,6 +14,7 @@ namespace CleanMachine.Model.CM
private DateTime _startTime; private DateTime _startTime;
private DateTime _endTime; private DateTime _endTime;
private string _userName;
/// <summary> /// <summary>
/// ///
@@ -44,5 +45,6 @@ namespace CleanMachine.Model.CM
public DateTime StartTime { get => _startTime; set => _startTime = value; } public DateTime StartTime { get => _startTime; set => _startTime = value; }
public DateTime EndTime { get => _endTime; set => _endTime = value; } public DateTime EndTime { get => _endTime; set => _endTime = value; }
public string UserName { get => _userName; set => _userName = value; }
} }
} }

View File

@@ -36,12 +36,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ComponentFactory.Krypton.Navigator">
<HintPath>..\public\ComponentFactory.Krypton.Navigator.dll</HintPath>
</Reference>
<Reference Include="ComponentFactory.Krypton.Toolkit">
<HintPath>..\public\ComponentFactory.Krypton.Toolkit.dll</HintPath>
</Reference>
<Reference Include="FastReport"> <Reference Include="FastReport">
<HintPath>..\public\FastReport.dll</HintPath> <HintPath>..\public\FastReport.dll</HintPath>
</Reference> </Reference>

Binary file not shown.

View File

@@ -2629,7 +2629,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -2672,7 +2672,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -2763,7 +2763,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -2902,7 +2902,7 @@ namespace CleanMachineHMI.FrmUserControl
swtbtn_brush1.L_IsOpen = false; swtbtn_brush1.L_IsOpen = false;
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_brush1.L_IsOpen = false; swtbtn_brush1.L_IsOpen = false;
@@ -2942,7 +2942,7 @@ namespace CleanMachineHMI.FrmUserControl
swtbtn_brush2.L_IsOpen = false; swtbtn_brush2.L_IsOpen = false;
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_brush2.L_IsOpen = false; swtbtn_brush2.L_IsOpen = false;
@@ -2987,7 +2987,7 @@ namespace CleanMachineHMI.FrmUserControl
swtbtn_nozzle1.L_IsOpen = false; swtbtn_nozzle1.L_IsOpen = false;
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_nozzle1.L_IsOpen = false; swtbtn_nozzle1.L_IsOpen = false;
@@ -3027,7 +3027,7 @@ namespace CleanMachineHMI.FrmUserControl
swtbtn_brush3.L_IsOpen = false; swtbtn_brush3.L_IsOpen = false;
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_brush3.L_IsOpen = false; swtbtn_brush3.L_IsOpen = false;
@@ -3069,7 +3069,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -3145,7 +3145,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -3184,7 +3184,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -3287,7 +3287,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -3335,7 +3335,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -3411,7 +3411,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -3444,7 +3444,7 @@ namespace CleanMachineHMI.FrmUserControl
swtbtn_staticBar.L_IsOpen = false; swtbtn_staticBar.L_IsOpen = false;
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_staticBar.L_IsOpen = false; swtbtn_staticBar.L_IsOpen = false;
@@ -3675,7 +3675,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -3713,7 +3713,7 @@ namespace CleanMachineHMI.FrmUserControl
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -3980,7 +3980,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;

View File

@@ -89,6 +89,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
LogHelper.WriteLog($"用户:【{Global.UserInfo.UserName}】注销登录!", LogTypeEum.Run); LogHelper.WriteLog($"用户:【{Global.UserInfo.UserName}】注销登录!", LogTypeEum.Run);
Global.LoginForm.Show(); Global.LoginForm.Show();
Global.UserInfo = null;
//GlobalHelper.MainForm.Hide(); //GlobalHelper.MainForm.Hide();
Global.MainFormNew.Hide(); Global.MainFormNew.Hide();
@@ -1444,7 +1445,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1487,7 +1488,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1578,7 +1579,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1721,7 +1722,7 @@ namespace CleanMachineHMI.FrmUserControl
swtbtn_brush1.L_IsOpen = false; swtbtn_brush1.L_IsOpen = false;
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_brush1.L_IsOpen = false; swtbtn_brush1.L_IsOpen = false;
@@ -1761,7 +1762,7 @@ namespace CleanMachineHMI.FrmUserControl
swtbtn_brush2.L_IsOpen = false; swtbtn_brush2.L_IsOpen = false;
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_brush2.L_IsOpen = false; swtbtn_brush2.L_IsOpen = false;
@@ -1806,7 +1807,7 @@ namespace CleanMachineHMI.FrmUserControl
swtbtn_nozzle1.L_IsOpen = false; swtbtn_nozzle1.L_IsOpen = false;
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_nozzle1.L_IsOpen = false; swtbtn_nozzle1.L_IsOpen = false;
@@ -1846,7 +1847,7 @@ namespace CleanMachineHMI.FrmUserControl
swtbtn_brush3.L_IsOpen = false; swtbtn_brush3.L_IsOpen = false;
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_brush3.L_IsOpen = false; swtbtn_brush3.L_IsOpen = false;
@@ -1888,7 +1889,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1964,7 +1965,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -2003,7 +2004,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -2106,7 +2107,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -2154,7 +2155,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -2230,7 +2231,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -2263,7 +2264,7 @@ namespace CleanMachineHMI.FrmUserControl
swtbtn_staticBar.L_IsOpen = false; swtbtn_staticBar.L_IsOpen = false;
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_staticBar.L_IsOpen = false; swtbtn_staticBar.L_IsOpen = false;
@@ -2495,7 +2496,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -2533,7 +2534,7 @@ namespace CleanMachineHMI.FrmUserControl
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -2775,7 +2776,7 @@ namespace CleanMachineHMI.FrmUserControl
KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode.");
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;

View File

@@ -435,7 +435,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -464,7 +464,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -494,7 +494,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -524,7 +524,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -553,7 +553,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -582,7 +582,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -611,7 +611,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -641,7 +641,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -707,7 +707,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -736,7 +736,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -765,7 +765,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -795,7 +795,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -828,7 +828,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -877,7 +877,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -919,7 +919,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -957,7 +957,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -992,7 +992,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1027,7 +1027,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1062,7 +1062,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1097,7 +1097,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1132,7 +1132,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1167,7 +1167,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1202,7 +1202,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1237,7 +1237,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1272,7 +1272,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1307,7 +1307,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1342,7 +1342,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1377,7 +1377,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1412,7 +1412,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1447,7 +1447,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1482,7 +1482,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1517,7 +1517,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1549,7 +1549,7 @@ namespace CleanMachineHMI.FrmUserControl
private void kryptonButton13_Click(object sender, EventArgs e) private void kryptonButton13_Click(object sender, EventArgs e)
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1633,7 +1633,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1674,7 +1674,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;
@@ -1711,7 +1711,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;

View File

@@ -34,7 +34,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_brush1.L_IsOpen = false; swtbtn_brush1.L_IsOpen = false;
@@ -60,7 +60,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_brush2.L_IsOpen = false; swtbtn_brush2.L_IsOpen = false;
@@ -281,7 +281,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
swtbtn_brush3.L_IsOpen = false; swtbtn_brush3.L_IsOpen = false;

View File

@@ -238,7 +238,7 @@ namespace CleanMachineHMI.FrmUserControl
{ {
try try
{ {
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;

View File

@@ -57,7 +57,7 @@ namespace CleanMachineHMI
/// <summary> /// <summary>
/// 用户信息 /// 用户信息
/// </summary> /// </summary>
public static UserInfo UserInfo { get; set; } public static UserInfo UserInfo { get; set; }=null;
/// <summary> /// <summary>
/// 参数列表 /// 参数列表

View File

@@ -117,7 +117,7 @@ namespace CleanMachineHMI
private bool _isConn = false; private bool _isConn = false;
public bool isConn public bool IsConn
{ {
get get
{ {
@@ -264,7 +264,7 @@ namespace CleanMachineHMI
catch (Exception ex) catch (Exception ex)
{ {
LogHelper.WriteLog($"初始化PLC连接时发生异常:【{ex.Message}】", LogTypeEum.Err); LogHelper.WriteLog($"初始化PLC连接时发生异常:【{ex.Message}】", LogTypeEum.Err);
isConn = false; IsConn = false;
return false; return false;
} }
} }
@@ -318,7 +318,7 @@ namespace CleanMachineHMI
{ {
port.Close(); port.Close();
master = null; master = null;
isConn = false; IsConn = false;
} }
} }
public void RefreshPlcItem_M(ref bool haschange) public void RefreshPlcItem_M(ref bool haschange)
@@ -1191,7 +1191,7 @@ namespace CleanMachineHMI
} }
if (WritePlcItem("PlcHeartbeatWriteData", wcsToPlcHeartData.ToString(), PlcItemTypeDesc.D)) if (WritePlcItem("PlcHeartbeatWriteData", wcsToPlcHeartData.ToString(), PlcItemTypeDesc.D))
{ {
isConn = true; IsConn = true;
HeartbeatTime = DateTime.Now; HeartbeatTime = DateTime.Now;
wcsToPlcHeartDataNew = wcsToPlcHeartData; wcsToPlcHeartDataNew = wcsToPlcHeartData;
frmMainNew.Show_Plc_Alarm("Serial port open success, PLC connect success!"); frmMainNew.Show_Plc_Alarm("Serial port open success, PLC connect success!");
@@ -1212,7 +1212,7 @@ namespace CleanMachineHMI
} }
if (WritePlcItem("PlcHeartbeatWriteData", wcsToPlcHeartData.ToString(), PlcItemTypeDesc.D)) if (WritePlcItem("PlcHeartbeatWriteData", wcsToPlcHeartData.ToString(), PlcItemTypeDesc.D))
{ {
isConn = true; IsConn = true;
HeartbeatTime = DateTime.Now; HeartbeatTime = DateTime.Now;
wcsToPlcHeartDataNew = wcsToPlcHeartData; wcsToPlcHeartDataNew = wcsToPlcHeartData;
frmMainNew.Show_Plc_Alarm("Serial port open success, PLC connect success!"); frmMainNew.Show_Plc_Alarm("Serial port open success, PLC connect success!");

View File

@@ -82,7 +82,7 @@ namespace CleanMachineHMI.frmChild
KryptonMessageBox.Show(this.T("请选择切换方向!", "SelectSwitchDirectionInfo")); KryptonMessageBox.Show(this.T("请选择切换方向!", "SelectSwitchDirectionInfo"));
return; return;
} }
if (!PlcOperationHelper.Instance.isConn) if (!PlcOperationHelper.Instance.IsConn)
{ {
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
return; return;

View File

@@ -28,6 +28,13 @@ namespace CleanMachineHMI
public frmMainNew() public frmMainNew()
{ {
InitializeComponent(); InitializeComponent();
//清理过期任务
string sqlZbkWorkingPallet = $@"DELETE FROM ZBK_WORKING_PALLET WHERE julianday('now') - julianday(UPDATE_TIME) > 30";
string sqlZbkWorkingPalletDtl = $@"DELETE FROM ZBK_WORKING_PALLET_DTL WHERE julianday('now') - julianday(UPDATE_TIME) > 30";
LeadDbHelperSQLite.Execute(sqlZbkWorkingPallet);
LeadDbHelperSQLite.Execute(sqlZbkWorkingPalletDtl);
} }
#region 全局变量 #region 全局变量
@@ -241,6 +248,7 @@ namespace CleanMachineHMI
isPlcConnStatus = true; isPlcConnStatus = true;
Global.SysThIsRunFlag = true; Global.SysThIsRunFlag = true;
PlcOperationHelper.Instance.StartRead(); PlcOperationHelper.Instance.StartRead();
@@ -592,10 +600,14 @@ namespace CleanMachineHMI
} }
} }
if (Global.UserInfo != null)
{
int SysRunTime = (int)PlcOperationHelper.Instance.ReadPlcItem("SysRuningTime", PlcItemTypeDesc.D); int SysRunTime = (int)PlcOperationHelper.Instance.ReadPlcItem("SysRuningTime", PlcItemTypeDesc.D);
new CleanMachine.BLL.CM.DayWorkTimeBLL().UpdateTime(DateTime.Today, SysRunTime); if (SysRunTime != 0)
{
new CleanMachine.BLL.CM.DayWorkTimeBLL().UpdateTime(DateTime.Today, SysRunTime, Global.UserInfo.UserName);
int Minutes = (SysRunTime - CleanMachineHMI.Global.MaintainTime) / 60; int Minutes = (SysRunTime - CleanMachineHMI.Global.MaintainTime) / 60;
@@ -607,6 +619,8 @@ namespace CleanMachineHMI
})); }));
}
}
//string sqlParam = $@"SELECT * FROM SYS_PARAMETER"; //string sqlParam = $@"SELECT * FROM SYS_PARAMETER";
@@ -719,10 +733,10 @@ namespace CleanMachineHMI
#region 定期清理历史业务数据 -- 数据保存2个月 #region 定期清理历史业务数据 -- 数据保存2个月
string sqlZbkWorkingPallet = $@"DELETE FROM ZBK_WORKING_PALLET WHERE julianday('now') - julianday(UPDATE_TIME) > 30"; //string sqlZbkWorkingPallet = $@"DELETE FROM ZBK_WORKING_PALLET WHERE julianday('now') - julianday(UPDATE_TIME) > 30";
string sqlZbkWorkingPalletDtl = $@"DELETE FROM ZBK_WORKING_PALLET_DTL WHERE julianday('now') - julianday(UPDATE_TIME) > 30"; //string sqlZbkWorkingPalletDtl = $@"DELETE FROM ZBK_WORKING_PALLET_DTL WHERE julianday('now') - julianday(UPDATE_TIME) > 30";
LeadDbHelperSQLite.Execute(sqlZbkWorkingPallet); //LeadDbHelperSQLite.Execute(sqlZbkWorkingPallet);
LeadDbHelperSQLite.Execute(sqlZbkWorkingPalletDtl); //LeadDbHelperSQLite.Execute(sqlZbkWorkingPalletDtl);
#endregion #endregion
// PlcOperationHelper.Instance.HeartbeatDetection(); // PlcOperationHelper.Instance.HeartbeatDetection();