From 92338ab006f0e23f286a0914e4456c4f3a1c1b7b Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期五, 06 九月 2024 10:48:50 +0800
Subject: [PATCH] 日志
---
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
index 69e9e93..a7eff8f 100644
--- a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -19,6 +19,7 @@
private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId);
private static readonly SysCacheService sysCacheService = App.GetRequiredService<SysCacheService>();
private static readonly IHubContext<PlcHub, IPlcHub> _plcHubContext = App.GetService<IHubContext<PlcHub, IPlcHub>>();
+ private static readonly SysConfigService _sysConfigService = App.GetService<SysConfigService>();
private static List<WcsPlc> listPlc = new List<WcsPlc>();
private static List<WcsDevice> listPlcDevice = new List<WcsDevice>();
@@ -37,6 +38,9 @@
{
//璁㈤槄浜嬩欢
DeviceValueChangeEvent += PLCService.OnChangeEvent;
+ boRunningState = _sysConfigService.GetConfigValue<bool>("sys_RunningState").Result;
+ boOffline = _sysConfigService.GetConfigValue<bool>("sys_Offline").Result;
+ boRefresh = _sysConfigService.GetConfigValue<bool>("sys_Refresh").Result;
}
/// <summary>
/// 鍒濆鍖朠LC杩炴帴
@@ -60,18 +64,20 @@
var plc = new PLCUtil(modPlc);
listPlcUtil.Add(plc);
}
- cts = new CancellationTokenSource();
- boRunningState = true;
_plcHubContext.Clients.All.UpdateService(new PLCServiceModel()
{
BoRunningState = boRunningState,
BoOffline = boOffline,
BoRefresh = boRefresh
});
- StartRead();
- ConnectionStatus();
- StartWatchAlarm();
- StartWatchPosition();
+ if (boRunningState)
+ {
+ cts = new CancellationTokenSource();
+ StartRead();
+ ConnectionStatus();
+ StartWatchAlarm();
+ StartWatchPosition();
+ }
}
/// <summary>
/// 寮�鍚鍙杙lc绾跨▼
--
Gitblit v1.8.0