From d20ce230b49932d39ee4ce25e39fd78368c3b28a Mon Sep 17 00:00:00 2001
From: kazelee <1847801760@qq.com>
Date: 星期五, 27 六月 2025 17:26:04 +0800
Subject: [PATCH] 优化配置文件和部分日志打印信息

---
 Program.cs |   57 +++++++++++++++++++++++++--------------------------------
 1 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/Program.cs b/Program.cs
index 5f198b3..8bb92d5 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,17 +1,16 @@
 锘縰sing System;
 using System.Collections.Generic;
 using System.Threading;
-
-using HH.WCS.Mobox3.DSZSH.AppStart;
 using HH.WCS.Mobox3.DSZSH.device;
-using HH.WCS.Mobox3.DSZSH.Helpers;
-using HH.WCS.Mobox3.DSZSH.ServiceCore;
+using HH.WCS.Mobox3.DSZSH.core;
 
 using Microsoft.Owin.Hosting;
 
 using Topshelf;
 
 using Task = System.Threading.Tasks.Task;
+using Monitor = HH.WCS.Mobox3.DSZSH.core.Monitor;
+using System.Net.Sockets;
 
 namespace HH.WCS.Mobox3.DSZSH {
     internal class Program
@@ -22,11 +21,15 @@
             // 1.0 寮�惎api
             Startup();
             // 2.0 寮�惎tcp
-            StartTcp();
+            //StartTcp();
             // 3.0 寮�惎S7
-            StartS7();
+            //StartS7();
             // 4.0 寮�惎Modbus
             //StartModbus();
+
+            // TCP娴嬭瘯
+            //TcpClientHelper.Link("127.0.0.1", 8550);
+            Task.Run(() => { WCSCore.StartServer(); });
 
             // 5.0 寮�惎绾跨▼
             var rc = HostFactory.Run(x => {
@@ -54,7 +57,7 @@
             Console.WriteLine("Startup ApiController");
             Task.Run(() =>
             {
-                var url = AppStart.Settings.Config.WebApiUrl; // 杩愯鏃朵慨鏀�config.json 鏃犳晥
+                var url = Settings.WebApiUrl;
                 Console.WriteLine(url);
                 using (WebApp.Start<Startup>(url))
                 {
@@ -69,10 +72,12 @@
         /// </summary>
         private static void StartTcp()
         {
-            var tcpServerIP = AppStart.Settings.Config.TcpServerIp; // 杩愯鏃朵慨鏀�config.json 鏃犳晥
-            var tcpServerPort = AppStart.Settings.Config.TcpServerPort; // 杩愯鏃朵慨鏀�config.json 鏃犳晥
+            var tcpServerIP = Settings.TcpServerIp;
+            var tcpServerPort = Settings.TcpServerPort;
             new TcpServer(tcpServerIP, tcpServerPort);
-
+            //var res = TcpClientHelper.Init(tcpServerIP, tcpServerPort);
+            //var res = TcpClientHelper.Init(tcpServerIP, 8550);
+            //LogHelper.Info($"TcpClient杩炴帴" + (res ? "鎴愬姛" : "澶辫触"));
         }
 
         /// <summary>
@@ -91,18 +96,6 @@
             //        Console.WriteLine("S7ProductionLineHelper," + item.ProductionLine_IP);
             //    }
             //}
-
-            ////绉伴噸鐨凷7璁惧
-            //var weightPLCDevice = Settings.WeightDevices;
-
-            //if (weightPLCDevice.Count > 0)
-            //{
-            //    foreach (var item in weightPLCDevice)
-            //    {
-            //        new S7Helper(item.WeightDevice_IP, (short)item.WeightDevice_Rack, (short)item.WeightDevice_Slot);
-            //        Console.WriteLine("S7WeightDeviceHelper," + item.WeightDevice_Name);
-            //    }
-            //}
         }
 
         /// <summary>
@@ -111,7 +104,7 @@
         private static void StartModbus()
         {
             // 鎵�湁鐨凪odbus璁惧
-            var allPLCDevice = AppStart.Settings.Config.ProductionLines; // 杩愯鏃朵慨鏀�config.json 鏃犳晥
+            var allPLCDevice = Settings.ProductionLines;
             
             if (allPLCDevice.Count > 0) {
                 foreach (var item in allPLCDevice) {
@@ -127,19 +120,19 @@
             {
                 List<Task> tasks = new List<Task>();
 
-                //tasks.Add(GetTask(CheckCore.CheckOrderState));
+                tasks.Add(GetTask(WCSCore.Dispatch));
 
-                //tasks.Add(GetTask(OutboundCore.CheckOrderState));
+                // 娴嬭瘯锛氭墭鐩樹笅绾�+                //tasks.Add(GetTask(Monitor.CheckInbound));
 
+                // 杞锛氬嚭搴撳崟鐘舵�
+                tasks.Add(GetTask(Monitor.CheckOutboundOrder));
 
-                // 娣诲姞浠诲姟鎺ㄩ�绾跨▼
-                //tasks.Add(GetTask(WCSCore.Dispatch));
+                // 杞锛氭娊妫�崟鐘舵�
+                tasks.Add(GetTask(Monitor.CheckCheckOrder));
 
-                // 娣诲姞鑷畾涔夌嚎绋�-                //tasks.Add(GetTask(Monitor.CheckEmptyCnt));//妫�祴绌烘墭鐩�-
-                // 鏍规嵁S7/Modbus鍗忚鍒ゆ柇杈撻�绾跨殑淇″彿  鍘熸潗鏂欎骇绾垮簱鍖�>婊℃墭缂撳瓨搴撳尯锛岀┖鎵樼紦瀛樺簱鍖�>鍘熸潗鏂欎骇绾垮簱鍖�-                //tasks.Add(GetTask(Monitor.CheckS7Devices));
+                // 杞锛氱Щ搴撳崟鐘舵�
+                tasks.Add(GetTask(Monitor.CheckShiftOrder));
 
                 Task.WaitAll(tasks.ToArray());
             }

--
Gitblit v1.9.1