From d662639715b6f5e56734a3f36a5d43ba433b1cc4 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期日, 15 九月 2024 16:34:57 +0800
Subject: [PATCH] 任务管理任务日志操作列增加上传按钮
---
Admin.NET/WCS.Application/Hub/PlcHub.cs | 67 ++++++++++++++++++++++++++-------
1 files changed, 53 insertions(+), 14 deletions(-)
diff --git a/Admin.NET/WCS.Application/Hub/PlcHub.cs b/Admin.NET/WCS.Application/Hub/PlcHub.cs
index 31d652c..ecf48ab 100644
--- a/Admin.NET/WCS.Application/Hub/PlcHub.cs
+++ b/Admin.NET/WCS.Application/Hub/PlcHub.cs
@@ -4,26 +4,27 @@
namespace WCS.Application;
/// <summary>
-/// PLC闆嗙嚎鍣�
+/// 浠诲姟鏃ュ織闆嗙嚎鍣�
/// </summary>
[MapHub("/hubs/Plc")]
public class PlcHub : Hub<IPlcHub>
{
private readonly IHubContext<PlcHub, IPlcHub> _plcHubContext;
-
- public PlcHub(IHubContext<PlcHub, IPlcHub> plcHubContext)
+ private readonly SysConfigService _sysConfigService;
+ public PlcHub(IHubContext<PlcHub, IPlcHub> plcHubContext, SysConfigService sysConfigService)
{
_plcHubContext = plcHubContext;
+ _sysConfigService = sysConfigService;
}
/// <summary>
/// 涓嬪彂PLC杩炴帴鐘舵��
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
- //public async Task PublicPlcConn(WcsPlc context)
- //{
- // await _plcHubContext.Clients.All.PublicPlcConn(context);
- //}
+ public async Task PublicPlcConn(WcsPlc context)
+ {
+ await _plcHubContext.Clients.All.PublicPlcConn(context);
+ }
/// <summary>
/// 涓嬪彂宸ヤ綅鐘舵��
@@ -36,12 +37,50 @@
//}
/// <summary>
- /// 涓嬪彂鎶ヨ淇℃伅
+ /// 涓嬪彂鏈嶅姟鐘舵��
/// </summary>
- /// <param name="context"></param>
- /// <returns></returns>
- //public async Task PublicAlarm(WcsAlarmInfoOutput context)
- //{
- // await _plcHubContext.Clients.All.PublicAlarm(context);
- //}
+ public async Task UpdateService(PLCServiceModel context)
+ {
+ //杩愯鐘舵��
+ if (context.BoRunningState.HasValue)
+ {
+ PLCTaskAction.boRunningState = context.BoRunningState.Value;
+ if (context.BoRunningState.Value)
+ PLCTaskAction.Init();
+ else
+ PLCTaskAction.Stop();
+ await _sysConfigService.UpdateConfigValue("sys_RunningState", context.BoRunningState.Value);
+ }
+ //鑴辨満妯″紡
+ if (context.BoOffline.HasValue)
+ {
+ PLCTaskAction.boOffline = context.BoOffline.Value;
+ await _sysConfigService.UpdateConfigValue("sys_Offline", context.BoOffline.Value);
+ }
+ //鑷埛鏂�
+ if (context.BoRefresh.HasValue)
+ {
+ PLCTaskAction.boRefresh = context.BoRefresh.Value;
+ await _sysConfigService.UpdateConfigValue("sys_Refresh", context.BoRefresh.Value);
+ }
+ //婕旂ず妯″紡
+ if (context.BoDemo.HasValue)
+ {
+ PLCTaskAction.boDemo = context.BoDemo.Value;
+ await _sysConfigService.UpdateConfigValue("sys_demo", context.BoDemo.Value);
+ }
+ await _plcHubContext.Clients.All.UpdateService(new PLCServiceModel() { BoRunningState = PLCTaskAction.boRunningState, BoRefresh = PLCTaskAction.boRefresh, BoOffline = PLCTaskAction.boOffline, BoDemo = PLCTaskAction.boDemo});
+ }
}
+public class PLCServiceModel
+{
+ public bool? BoRunningState { get; set; }
+
+
+ public bool? BoOffline { get; set; }
+
+
+ public bool? BoRefresh { get; set; }
+
+ public bool? BoDemo { get; set; }
+}
\ No newline at end of file
--
Gitblit v1.8.0