diff --git a/CleanMachine.BLL/CM/DayWorkTimeBLL.cs b/CleanMachine.BLL/CM/DayWorkTimeBLL.cs index 3a48c53..f920570 100644 --- a/CleanMachine.BLL/CM/DayWorkTimeBLL.cs +++ b/CleanMachine.BLL/CM/DayWorkTimeBLL.cs @@ -15,22 +15,22 @@ namespace CleanMachine.BLL.CM /// /// 存在 /// - 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(); - 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 { - 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 }); } } diff --git a/CleanMachine.DAL/CM/DayWorkTimeDAL.cs b/CleanMachine.DAL/CM/DayWorkTimeDAL.cs index 93a817f..c5d5cf0 100644 --- a/CleanMachine.DAL/CM/DayWorkTimeDAL.cs +++ b/CleanMachine.DAL/CM/DayWorkTimeDAL.cs @@ -16,10 +16,10 @@ namespace CleanMachine.DAL.CM /// /// 存在 /// - public bool Exists(DateTime Date) + public bool Exists(DateTime Date,string UserName) { - string strSql = @"SELECT count(1) from CM_DayWorkTime WHERE Date=@Date "; - return LeadDbHelperSQLite.ExecuteScalar(strSql, new { Date }) > 0; + string strSql = @"SELECT count(1) from CM_DayWorkTime WHERE Date=@Date and UserName=@UserName "; + return LeadDbHelperSQLite.ExecuteScalar(strSql, new { Date, UserName }) > 0; } /// @@ -28,9 +28,9 @@ namespace CleanMachine.DAL.CM public bool Add(CleanMachine.Model.CM.DayWorkTime model) { string strSql = $@"INSERT INTO CM_DayWorkTime - (Date,StartValue,EndValue,StartTime) + (Date,StartValue,EndValue,StartTime,UserName) values - (@Date,@StartValue,@EndValue,@StartTime) "; + (@Date,@StartValue,@EndValue,@StartTime,@UserName) "; return LeadDbHelperSQLite.Execute(strSql, model) > 0; } @@ -41,7 +41,7 @@ namespace CleanMachine.DAL.CM { string strSql = $@"UPDATE CM_DayWorkTime SET StartValue=@StartValue,EndValue=@EndValue - WHERE Date=@Date "; + WHERE Date=@Date and UserName=@UserName "; return LeadDbHelperSQLite.Execute(strSql, model) > 0; } diff --git a/CleanMachine.Model/CM/DayWorkTime.cs b/CleanMachine.Model/CM/DayWorkTime.cs index 2fbea12..4f4e0cf 100644 --- a/CleanMachine.Model/CM/DayWorkTime.cs +++ b/CleanMachine.Model/CM/DayWorkTime.cs @@ -14,6 +14,7 @@ namespace CleanMachine.Model.CM private DateTime _startTime; private DateTime _endTime; + private string _userName; /// /// @@ -44,5 +45,6 @@ namespace CleanMachine.Model.CM public DateTime StartTime { get => _startTime; set => _startTime = value; } public DateTime EndTime { get => _endTime; set => _endTime = value; } + public string UserName { get => _userName; set => _userName = value; } } } diff --git a/CleanMachineHMI/CleanMachineHMI.csproj b/CleanMachineHMI/CleanMachineHMI.csproj index 97e2399..f2191da 100644 --- a/CleanMachineHMI/CleanMachineHMI.csproj +++ b/CleanMachineHMI/CleanMachineHMI.csproj @@ -36,12 +36,6 @@ - - ..\public\ComponentFactory.Krypton.Navigator.dll - - - ..\public\ComponentFactory.Krypton.Toolkit.dll - ..\public\FastReport.dll diff --git a/CleanMachineHMI/DataBase/clearMac.db b/CleanMachineHMI/DataBase/clearMac.db index a780288..84d20a6 100644 Binary files a/CleanMachineHMI/DataBase/clearMac.db and b/CleanMachineHMI/DataBase/clearMac.db differ diff --git a/CleanMachineHMI/FrmUserControl/frmMainDetail.cs b/CleanMachineHMI/FrmUserControl/frmMainDetail.cs index 3e89bde..4395082 100644 --- a/CleanMachineHMI/FrmUserControl/frmMainDetail.cs +++ b/CleanMachineHMI/FrmUserControl/frmMainDetail.cs @@ -2629,7 +2629,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -2672,7 +2672,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -2763,7 +2763,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -2902,7 +2902,7 @@ namespace CleanMachineHMI.FrmUserControl swtbtn_brush1.L_IsOpen = false; return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_brush1.L_IsOpen = false; @@ -2942,7 +2942,7 @@ namespace CleanMachineHMI.FrmUserControl swtbtn_brush2.L_IsOpen = false; return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_brush2.L_IsOpen = false; @@ -2987,7 +2987,7 @@ namespace CleanMachineHMI.FrmUserControl swtbtn_nozzle1.L_IsOpen = false; return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_nozzle1.L_IsOpen = false; @@ -3027,7 +3027,7 @@ namespace CleanMachineHMI.FrmUserControl swtbtn_brush3.L_IsOpen = false; return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); 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."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -3145,7 +3145,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -3184,7 +3184,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -3287,7 +3287,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -3335,7 +3335,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -3411,7 +3411,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -3444,7 +3444,7 @@ namespace CleanMachineHMI.FrmUserControl swtbtn_staticBar.L_IsOpen = false; return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_staticBar.L_IsOpen = false; @@ -3675,7 +3675,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -3713,7 +3713,7 @@ namespace CleanMachineHMI.FrmUserControl return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -3980,7 +3980,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; diff --git a/CleanMachineHMI/FrmUserControl/frmMainDetailNew.cs b/CleanMachineHMI/FrmUserControl/frmMainDetailNew.cs index 0d00e0d..1f71c0f 100644 --- a/CleanMachineHMI/FrmUserControl/frmMainDetailNew.cs +++ b/CleanMachineHMI/FrmUserControl/frmMainDetailNew.cs @@ -89,6 +89,7 @@ namespace CleanMachineHMI.FrmUserControl { LogHelper.WriteLog($"用户:【{Global.UserInfo.UserName}】注销登录!", LogTypeEum.Run); Global.LoginForm.Show(); + Global.UserInfo = null; //GlobalHelper.MainForm.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."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1487,7 +1488,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1578,7 +1579,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1721,7 +1722,7 @@ namespace CleanMachineHMI.FrmUserControl swtbtn_brush1.L_IsOpen = false; return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_brush1.L_IsOpen = false; @@ -1761,7 +1762,7 @@ namespace CleanMachineHMI.FrmUserControl swtbtn_brush2.L_IsOpen = false; return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_brush2.L_IsOpen = false; @@ -1806,7 +1807,7 @@ namespace CleanMachineHMI.FrmUserControl swtbtn_nozzle1.L_IsOpen = false; return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_nozzle1.L_IsOpen = false; @@ -1846,7 +1847,7 @@ namespace CleanMachineHMI.FrmUserControl swtbtn_brush3.L_IsOpen = false; return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); 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."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1964,7 +1965,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -2003,7 +2004,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -2106,7 +2107,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -2154,7 +2155,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -2230,7 +2231,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -2263,7 +2264,7 @@ namespace CleanMachineHMI.FrmUserControl swtbtn_staticBar.L_IsOpen = false; return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_staticBar.L_IsOpen = false; @@ -2495,7 +2496,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -2533,7 +2534,7 @@ namespace CleanMachineHMI.FrmUserControl return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -2775,7 +2776,7 @@ namespace CleanMachineHMI.FrmUserControl KryptonMessageBox.Show("The manual operation interface has been opened and is currently in manual mode."); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; diff --git a/CleanMachineHMI/FrmUserControl/frmManual.cs b/CleanMachineHMI/FrmUserControl/frmManual.cs index a527cf2..67a2a25 100644 --- a/CleanMachineHMI/FrmUserControl/frmManual.cs +++ b/CleanMachineHMI/FrmUserControl/frmManual.cs @@ -435,7 +435,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -464,7 +464,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -494,7 +494,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -524,7 +524,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -553,7 +553,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -582,7 +582,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -611,7 +611,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -641,7 +641,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -707,7 +707,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -736,7 +736,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -765,7 +765,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -795,7 +795,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -828,7 +828,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -877,7 +877,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -919,7 +919,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -957,7 +957,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -992,7 +992,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1027,7 +1027,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1062,7 +1062,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1097,7 +1097,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1132,7 +1132,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1167,7 +1167,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1202,7 +1202,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1237,7 +1237,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1272,7 +1272,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1307,7 +1307,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1342,7 +1342,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1377,7 +1377,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1412,7 +1412,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1447,7 +1447,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1482,7 +1482,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1517,7 +1517,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1549,7 +1549,7 @@ namespace CleanMachineHMI.FrmUserControl 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."); return; @@ -1633,7 +1633,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1674,7 +1674,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; @@ -1711,7 +1711,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; diff --git a/CleanMachineHMI/FrmUserControl/frmMechineCheck.cs b/CleanMachineHMI/FrmUserControl/frmMechineCheck.cs index f048d9e..395c31b 100644 --- a/CleanMachineHMI/FrmUserControl/frmMechineCheck.cs +++ b/CleanMachineHMI/FrmUserControl/frmMechineCheck.cs @@ -34,7 +34,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_brush1.L_IsOpen = false; @@ -60,7 +60,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_brush2.L_IsOpen = false; @@ -281,7 +281,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); swtbtn_brush3.L_IsOpen = false; diff --git a/CleanMachineHMI/FrmUserControl/frmPlcAlarmLog.cs b/CleanMachineHMI/FrmUserControl/frmPlcAlarmLog.cs index f9deade..fdda4f7 100644 --- a/CleanMachineHMI/FrmUserControl/frmPlcAlarmLog.cs +++ b/CleanMachineHMI/FrmUserControl/frmPlcAlarmLog.cs @@ -238,7 +238,7 @@ namespace CleanMachineHMI.FrmUserControl { try { - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; diff --git a/CleanMachineHMI/Utils/GlobalHelper.cs b/CleanMachineHMI/Utils/GlobalHelper.cs index 238db16..2cc8907 100644 --- a/CleanMachineHMI/Utils/GlobalHelper.cs +++ b/CleanMachineHMI/Utils/GlobalHelper.cs @@ -57,7 +57,7 @@ namespace CleanMachineHMI /// /// 用户信息 /// - public static UserInfo UserInfo { get; set; } + public static UserInfo UserInfo { get; set; }=null; /// /// 参数列表 diff --git a/CleanMachineHMI/Utils/PlcOperationHelper.cs b/CleanMachineHMI/Utils/PlcOperationHelper.cs index 11160ad..bb68d48 100644 --- a/CleanMachineHMI/Utils/PlcOperationHelper.cs +++ b/CleanMachineHMI/Utils/PlcOperationHelper.cs @@ -117,7 +117,7 @@ namespace CleanMachineHMI private bool _isConn = false; - public bool isConn + public bool IsConn { get { @@ -264,7 +264,7 @@ namespace CleanMachineHMI catch (Exception ex) { LogHelper.WriteLog($"初始化PLC连接时发生异常:【{ex.Message}】", LogTypeEum.Err); - isConn = false; + IsConn = false; return false; } } @@ -318,7 +318,7 @@ namespace CleanMachineHMI { port.Close(); master = null; - isConn = false; + IsConn = false; } } public void RefreshPlcItem_M(ref bool haschange) @@ -1191,7 +1191,7 @@ namespace CleanMachineHMI } if (WritePlcItem("PlcHeartbeatWriteData", wcsToPlcHeartData.ToString(), PlcItemTypeDesc.D)) { - isConn = true; + IsConn = true; HeartbeatTime = DateTime.Now; wcsToPlcHeartDataNew = wcsToPlcHeartData; frmMainNew.Show_Plc_Alarm("Serial port open success, PLC connect success!"); @@ -1212,7 +1212,7 @@ namespace CleanMachineHMI } if (WritePlcItem("PlcHeartbeatWriteData", wcsToPlcHeartData.ToString(), PlcItemTypeDesc.D)) { - isConn = true; + IsConn = true; HeartbeatTime = DateTime.Now; wcsToPlcHeartDataNew = wcsToPlcHeartData; frmMainNew.Show_Plc_Alarm("Serial port open success, PLC connect success!"); diff --git a/CleanMachineHMI/frmChild/frmSwitchRunDirection.cs b/CleanMachineHMI/frmChild/frmSwitchRunDirection.cs index 6e71a97..38725f3 100644 --- a/CleanMachineHMI/frmChild/frmSwitchRunDirection.cs +++ b/CleanMachineHMI/frmChild/frmSwitchRunDirection.cs @@ -82,7 +82,7 @@ namespace CleanMachineHMI.frmChild KryptonMessageBox.Show(this.T("请选择切换方向!", "SelectSwitchDirectionInfo")); return; } - if (!PlcOperationHelper.Instance.isConn) + if (!PlcOperationHelper.Instance.IsConn) { KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment."); return; diff --git a/CleanMachineHMI/frmMainNew.cs b/CleanMachineHMI/frmMainNew.cs index 06aca31..7355fc4 100644 --- a/CleanMachineHMI/frmMainNew.cs +++ b/CleanMachineHMI/frmMainNew.cs @@ -28,6 +28,13 @@ namespace CleanMachineHMI public frmMainNew() { 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 全局变量 @@ -241,6 +248,7 @@ namespace CleanMachineHMI isPlcConnStatus = true; Global.SysThIsRunFlag = true; + PlcOperationHelper.Instance.StartRead(); @@ -592,21 +600,27 @@ namespace CleanMachineHMI } } - - int SysRunTime = (int)PlcOperationHelper.Instance.ReadPlcItem("SysRuningTime", PlcItemTypeDesc.D); - - new CleanMachine.BLL.CM.DayWorkTimeBLL().UpdateTime(DateTime.Today, SysRunTime); - - - int Minutes = (SysRunTime - CleanMachineHMI.Global.MaintainTime) / 60; - BeginInvoke(new Action(() => + if (Global.UserInfo != null) { - kryptonLabel1.Text = Minutes + " Minutes"; - pictureBox1.Visible = Minutes >= Global.MaintainAlarmTime; + int SysRunTime = (int)PlcOperationHelper.Instance.ReadPlcItem("SysRuningTime", PlcItemTypeDesc.D); + + if (SysRunTime != 0) + { + new CleanMachine.BLL.CM.DayWorkTimeBLL().UpdateTime(DateTime.Today, SysRunTime, Global.UserInfo.UserName); - })); + int Minutes = (SysRunTime - CleanMachineHMI.Global.MaintainTime) / 60; + BeginInvoke(new Action(() => + { + + kryptonLabel1.Text = Minutes + " Minutes"; + pictureBox1.Visible = Minutes >= Global.MaintainAlarmTime; + + + })); + } + } //string sqlParam = $@"SELECT * FROM SYS_PARAMETER"; @@ -719,10 +733,10 @@ namespace CleanMachineHMI #region 定期清理历史业务数据 -- 数据保存2个月 - 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); + //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); #endregion // PlcOperationHelper.Instance.HeartbeatDetection();