This commit is contained in:
gongxh
2021-12-27 14:36:49 +08:00
parent c6260156f8
commit 59eec06d5e
3 changed files with 53 additions and 21 deletions

View File

@@ -157,6 +157,7 @@ namespace CleanMachineHMI.FrmUserControl
string sqlQuerySheetType = $@"SELECT SHEET_TYPE_CODE,SHEET_TYPE_NAME FROM BAS_SHEET_TYPE WHERE USED_FLAG = 1 and DEL_FLAG = 0 ORDER BY SHEET_TYPE_ID"; string sqlQuerySheetType = $@"SELECT SHEET_TYPE_CODE,SHEET_TYPE_NAME FROM BAS_SHEET_TYPE WHERE USED_FLAG = 1 and DEL_FLAG = 0 ORDER BY SHEET_TYPE_ID";
DataTable dtQuerySheetType = LeadDbHelperSQLite.Query(sqlQuerySheetType).Tables[0]; DataTable dtQuerySheetType = LeadDbHelperSQLite.Query(sqlQuerySheetType).Tables[0];
kcmb_SheetType.DisplayMember = "Text";
if (dtQuerySheetType != null && dtQuerySheetType.Rows.Count > 0) if (dtQuerySheetType != null && dtQuerySheetType.Rows.Count > 0)
{ {
kcmb_SheetType.Items.Clear(); kcmb_SheetType.Items.Clear();
@@ -3131,7 +3132,8 @@ namespace CleanMachineHMI.FrmUserControl
{ {
if (isManualStatus()) if (isManualStatus())
{ {
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;
} }

View File

@@ -87,7 +87,7 @@
this.label2.ForeColor = System.Drawing.Color.Red; this.label2.ForeColor = System.Drawing.Color.Red;
this.label2.Location = new System.Drawing.Point(268, 51); this.label2.Location = new System.Drawing.Point(268, 51);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(255, 16); this.label2.Size = new System.Drawing.Size(254, 16);
this.label2.TabIndex = 15; this.label2.TabIndex = 15;
this.label2.Text = "托盘即将满料,剩余数量为6!!"; this.label2.Text = "托盘即将满料,剩余数量为6!!";
this.label2.Visible = false; this.label2.Visible = false;
@@ -261,7 +261,6 @@
this.ClientSize = new System.Drawing.Size(1008, 729); this.ClientSize = new System.Drawing.Size(1008, 729);
this.Controls.Add(this.kryptonNavigator1); this.Controls.Add(this.kryptonNavigator1);
this.Controls.Add(this.kryptonGroupBox1); this.Controls.Add(this.kryptonGroupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "frmMainNew"; this.Name = "frmMainNew";

View File

@@ -194,30 +194,36 @@ namespace CleanMachineHMI
isPlcConnStatus = true; isPlcConnStatus = true;
GlobalHelper.SysThIsRunFlag = true; GlobalHelper.SysThIsRunFlag = true;
Thread th = new Thread(RefreshPlcItem)
Thread th = new Thread(RefreshPlcItem_M)
{ {
IsBackground = true IsBackground = true
}; };
th.Start(); th.Start();
Thread th1 = new Thread(RefreshPlcItem_D)
{
IsBackground = true
};
th1.Start();
Thread th2 = new Thread(RefreshPlcItem_X) //Thread th = new Thread(RefreshPlcItem_M)
{ //{
IsBackground = true // IsBackground = true
}; //};
th2.Start(); //th.Start();
Thread th3 = new Thread(RefreshPlcItem_Y) //Thread th1 = new Thread(RefreshPlcItem_D)
{ //{
IsBackground = true // IsBackground = true
}; //};
th3.Start(); //th1.Start();
//Thread th2 = new Thread(RefreshPlcItem_X)
//{
// IsBackground = true
//};
//th2.Start();
//Thread th3 = new Thread(RefreshPlcItem_Y)
//{
// IsBackground = true
//};
//th3.Start();
Thread th4 = new Thread(MainThRunFunc) Thread th4 = new Thread(MainThRunFunc)
{ {
@@ -425,6 +431,22 @@ namespace CleanMachineHMI
} }
} }
private void RefreshPlcItem()
{
while (GlobalHelper.SysThIsRunFlag)
{
PlcOperationHelper.Instance.RefreshPlcItem_M();
PlcOperationHelper.Instance.RefreshPlcItem_D();
PlcOperationHelper.Instance.RefreshPlcItem_X();
PlcOperationHelper.Instance.RefreshPlcItem_Y();
ShowWarningMsg();
Thread.Sleep(100);
}
}
#region 线程执行函数 #region 线程执行函数
private void RefreshPlcItem_M() private void RefreshPlcItem_M()
{ {
@@ -461,6 +483,9 @@ namespace CleanMachineHMI
} }
private void MainThRunFunc() private void MainThRunFunc()
{ {
long lastTick = DateTime.Now.Ticks;
while (GlobalHelper.SysThIsRunFlag) while (GlobalHelper.SysThIsRunFlag)
{ {
try try
@@ -517,8 +542,10 @@ namespace CleanMachineHMI
if (maintainFlag == 0) if (maintainFlag == 0)
{ {
bool isRun = (bool)PlcOperationHelper.Instance.ReadPlcItem("CleanMacRunStatusNew", PlcItemTypeDesc.M); bool isRun = (bool)PlcOperationHelper.Instance.ReadPlcItem("CleanMacRunStatusNew", PlcItemTypeDesc.M);
if (isRun) if (isRun)
{ {
if (timerRunNUm == 60) if (timerRunNUm == 60)
{ {
sysRuningTimeLen++; sysRuningTimeLen++;
@@ -595,6 +622,10 @@ namespace CleanMachineHMI
})); }));
} }
} }
} }
else else
{ {
@@ -620,7 +651,7 @@ namespace CleanMachineHMI
{ {
LogHelper.WriteLog($"定时器运行函数发生异常:【{ex.Message}】", LogTypeEum.Err); LogHelper.WriteLog($"定时器运行函数发生异常:【{ex.Message}】", LogTypeEum.Err);
} }
Thread.Sleep(100); Thread.Sleep(1000);
} }
} }
#endregion #endregion