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