From 4db56b86d54f4f8d5a01ecb7365a30673f5d8fd4 Mon Sep 17 00:00:00 2001
From: chengsc <Demo@DESKTOP-CPA90BF>
Date: 星期四, 12 九月 2024 14:00:39 +0800
Subject: [PATCH] Merge branch 'master' into csc

---
 Admin.NET/WCS.Application/Hub/PlcHub.cs |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/Admin.NET/WCS.Application/Hub/PlcHub.cs b/Admin.NET/WCS.Application/Hub/PlcHub.cs
index de41681..ecf48ab 100644
--- a/Admin.NET/WCS.Application/Hub/PlcHub.cs
+++ b/Admin.NET/WCS.Application/Hub/PlcHub.cs
@@ -10,10 +10,11 @@
 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杩炴帴鐘舵��
@@ -48,14 +49,27 @@
                 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 _plcHubContext.Clients.All.UpdateService(new PLCServiceModel() { BoRunningState = PLCTaskAction.boRunningState, BoRefresh = PLCTaskAction.boRefresh, BoOffline = PLCTaskAction.boOffline });
+            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
@@ -67,4 +81,6 @@
 
 
     public bool? BoRefresh { get; set; }
+
+    public bool? BoDemo { get; set; }
 }
\ No newline at end of file

--
Gitblit v1.8.0