|
|
@ -273,7 +273,7 @@ namespace SlnMesnac.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (plc != null && plc.IsConnected)
|
|
|
|
if (plc != null && plc.IsConnected)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
plc.writeInt16ByAddress("M100", 8);
|
|
|
|
plc.writeInt32ByAddress("DB22.DBW2", 8);
|
|
|
|
Task.Run(() =>
|
|
|
|
Task.Run(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 设置计时器
|
|
|
|
// 设置计时器
|
|
|
@ -281,7 +281,7 @@ namespace SlnMesnac.Business
|
|
|
|
stopwatch.Start();
|
|
|
|
stopwatch.Start();
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (plc.readInt16ByAddress("M100") == 0)
|
|
|
|
if (plc.readInt32ByAddress("DB22.DBW2") == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.LogInformation("PLC复位成功,启动线体");
|
|
|
|
logger.LogInformation("PLC复位成功,启动线体");
|
|
|
|
RefreshMessageEvent?.Invoke("PLC复位成功,启动线体", true);
|
|
|
|
RefreshMessageEvent?.Invoke("PLC复位成功,启动线体", true);
|
|
|
@ -291,6 +291,7 @@ namespace SlnMesnac.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.LogError("PLC复位超时");
|
|
|
|
logger.LogError("PLC复位超时");
|
|
|
|
RefreshMessageEvent?.Invoke("PLC复位超时", true);
|
|
|
|
RefreshMessageEvent?.Invoke("PLC复位超时", true);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Thread.Sleep(100);
|
|
|
|
Thread.Sleep(100);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -318,7 +319,7 @@ namespace SlnMesnac.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (plc != null && plc.IsConnected)
|
|
|
|
if (plc != null && plc.IsConnected)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
plc.writeInt16ByAddress("M100", 9);
|
|
|
|
plc.writeInt32ByAddress("DB22.DBW2", 9);
|
|
|
|
Task.Run(() =>
|
|
|
|
Task.Run(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 设置计时器
|
|
|
|
// 设置计时器
|
|
|
@ -326,7 +327,7 @@ namespace SlnMesnac.Business
|
|
|
|
stopwatch.Start();
|
|
|
|
stopwatch.Start();
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (plc.readInt16ByAddress("M100") == 1)
|
|
|
|
if (plc.readInt32ByAddress("DB22.DBW2") == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.LogInformation("PLC复位成功,启动线体");
|
|
|
|
logger.LogInformation("PLC复位成功,启动线体");
|
|
|
|
RefreshMessageEvent?.Invoke("PLC复位成功,启动线体", true);
|
|
|
|
RefreshMessageEvent?.Invoke("PLC复位成功,启动线体", true);
|
|
|
@ -336,6 +337,7 @@ namespace SlnMesnac.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.LogError("PLC复位超时");
|
|
|
|
logger.LogError("PLC复位超时");
|
|
|
|
RefreshMessageEvent?.Invoke("PLC复位超时", true);
|
|
|
|
RefreshMessageEvent?.Invoke("PLC复位超时", true);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Thread.Sleep(100);
|
|
|
|
Thread.Sleep(100);
|
|
|
|
}
|
|
|
|
}
|
|
|
|