This commit is contained in:
gongxh
2022-05-09 08:59:35 +08:00
parent 64238fee13
commit b39357f27e
7 changed files with 370 additions and 264 deletions

View File

@@ -222,14 +222,14 @@ namespace CleanMachineHMI
isPlcConnStatus = true;
Global.SysThIsRunFlag = true;
PlcOperationHelper.Instance.StartRead();
// PlcOperationHelper.Instance.StartRead();
//Thread th = new Thread(RefreshPlcItem)
//{
// IsBackground = true
//};
//th.Start();
Thread th = new Thread(RefreshPlcItem)
{
IsBackground = true
};
th.Start();
//Thread th = new Thread(RefreshPlcItem_M)
@@ -597,49 +597,49 @@ namespace CleanMachineHMI
}
else if (sysRuningTimeLen >= maintainAlarmTime && sysRuningTimeLen < maintainQuitTime)
{
BeginInvoke(new Action(() =>
{
pictureBox1.Visible = true;
if (!sysAlarmFrmShowFlag)
{
sysAlarmFrmShowFlag = true;
frmSysExitAlarm frm = new frmSysExitAlarm();
//frm.showMsg = "机器即将于" + (maintainQuitTime - sysRuningTimeLen) + "分钟后退出。";
frm.showMsg = $"The machine will exit in {(maintainQuitTime - sysRuningTimeLen)} minutes.";
frm.TopLevel = true;
frm.ShowDialog();
}
}));
//BeginInvoke(new Action(() =>
//{
// pictureBox1.Visible = true;
// if (!sysAlarmFrmShowFlag)
// {
// sysAlarmFrmShowFlag = true;
// frmSysExitAlarm frm = new frmSysExitAlarm();
// //frm.showMsg = "机器即将于" + (maintainQuitTime - sysRuningTimeLen) + "分钟后退出。";
// frm.showMsg = $"The machine will exit in {(maintainQuitTime - sysRuningTimeLen)} minutes.";
// frm.TopLevel = true;
// frm.ShowDialog();
// }
//}));
}
else if (sysRuningTimeLen >= maintainQuitTime)
{
BeginInvoke(new Action(() =>
{
pictureBox1.Visible = true;
string sql = "SELECT 1 FROM CM_WORKING_PALLET WHERE WORKING_STATUS = 0";
DataTable dt = LeadDbHelperSQLite.Query(sql).Tables[0];
if (dt != null && dt.Rows.Count > 0)
{
if (!sysAlarmFrmShowFlag)
{
sysAlarmFrmShowFlag = true;
frmSysExitAlarm frm = new frmSysExitAlarm();
frm.showMsg = $"The machine maintenance time has exceeded: [{(maintainQuitTime - sysRuningTimeLen)}] minutes, please complete the current operation tray as soon as possible, and carry out equipment maintenance !!!!!!";
frm.TopLevel = true;
frm.ShowDialog();
}
}
else
{
string sqlUpdateParam = $@"update SYS_PARAMETER set PARAMETER_VALUE = '1' WHERE PARAMETER_CODE = 'MaintainFlag'";
LeadDbHelperSQLite.ExecuteSql(sqlUpdateParam);
PlcOperationHelper.Instance.WritePlcItem("StopSys", "True", PlcItemTypeDesc.M);
PlcOperationHelper.Instance.WritePlcItem("StopSys", "False", PlcItemTypeDesc.M);
PlcOperationHelper.Instance.WritePlcItem("ResetSys", "True", PlcItemTypeDesc.M);
PlcOperationHelper.Instance.WritePlcItem("ResetSys", "False", PlcItemTypeDesc.M);
Environment.Exit(0);
}
}));
//BeginInvoke(new Action(() =>
//{
// pictureBox1.Visible = true;
// string sql = "SELECT 1 FROM CM_WORKING_PALLET WHERE WORKING_STATUS = 0";
// DataTable dt = LeadDbHelperSQLite.Query(sql).Tables[0];
// if (dt != null && dt.Rows.Count > 0)
// {
// if (!sysAlarmFrmShowFlag)
// {
// sysAlarmFrmShowFlag = true;
// frmSysExitAlarm frm = new frmSysExitAlarm();
// frm.showMsg = $"The machine maintenance time has exceeded: [{(maintainQuitTime - sysRuningTimeLen)}] minutes, please complete the current operation tray as soon as possible, and carry out equipment maintenance !!!!!!";
// frm.TopLevel = true;
// frm.ShowDialog();
// }
// }
// else
// {
// string sqlUpdateParam = $@"update SYS_PARAMETER set PARAMETER_VALUE = '1' WHERE PARAMETER_CODE = 'MaintainFlag'";
// LeadDbHelperSQLite.ExecuteSql(sqlUpdateParam);
// PlcOperationHelper.Instance.WritePlcItem("StopSys", "True", PlcItemTypeDesc.M);
// PlcOperationHelper.Instance.WritePlcItem("StopSys", "False", PlcItemTypeDesc.M);
// PlcOperationHelper.Instance.WritePlcItem("ResetSys", "True", PlcItemTypeDesc.M);
// PlcOperationHelper.Instance.WritePlcItem("ResetSys", "False", PlcItemTypeDesc.M);
// Environment.Exit(0);
// }
//}));
}
string sqlUpdateRunTimeLen = $@"UPDATE SYS_PARAMETER set PARAMETER_VALUE = '{sysRuningTimeLen}' WHERE PARAMETER_CODE = 'SysRuningTimeLen'";
LeadDbHelperSQLite.ExecuteSql(sqlUpdateRunTimeLen);