From 9fe67118a220448d5d9647733d6c8308f069e4da Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期日, 13 十月 2024 16:05:23 +0800
Subject: [PATCH] 增加工艺路线必须要有结束节点,及其流程相应优化 增加工单批次自动关单 增加判断条码是未投入生产还是已经完工产出

---
 Tiger.Api/ApiWebHostService.cs |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/Tiger.Api/ApiWebHostService.cs b/Tiger.Api/ApiWebHostService.cs
index 3bead49..be53ff7 100644
--- a/Tiger.Api/ApiWebHostService.cs
+++ b/Tiger.Api/ApiWebHostService.cs
@@ -6,9 +6,26 @@
 using System.Threading.Tasks;
 using Rhea.Common;
 using Tiger.IBusiness;
+using System.ServiceProcess;
 
 namespace Tiger.Api
 {
+    public static class WebHostServiceExtensions
+    {
+        public static void RunAsApiService(this IWebHost host)
+        {
+            try
+            {
+                var webHostService = new ApiWebHostService(host);
+                ServiceBase.Run(webHostService);
+            }
+            catch (System.Exception ex)
+            {
+                Logger.Console.Fatal(ex, "Windows Services Exception");
+            }
+        }
+    }
+
     internal class ApiWebHostService : WebHostService
     {
         public ApiWebHostService(IWebHost host) : base(host)
@@ -39,7 +56,7 @@
                 DI.Resolve<IServicesBus>().StopServices();
                 //鍏抽棴DB缂撳瓨鑷姩鏇存柊
                 DI.Resolve<IDbCacheBus>().StopAutoUpdate();
-                MQTTHelper.MQTTConn?.Close();
+                //MQTTHelper.MQTTConn?.Close();
 	            base.OnStopping();
             }
             catch (System.Exception ex)

--
Gitblit v1.9.3