From 6b9801e47304eac1640cf737ef6bc039ff104dd1 Mon Sep 17 00:00:00 2001
From: kazelee <1847801760@qq.com>
Date: 星期一, 23 六月 2025 17:17:39 +0800
Subject: [PATCH] 删除冗余的注释和功能,优化部分代码

---
 Program.cs |   53 ++++++++++++++++++++++-------------------------------
 1 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/Program.cs b/Program.cs
index e77e060..0601b18 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,17 +1,15 @@
 锘縰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;
 
 namespace HH.WCS.Mobox3.DSZSH {
     internal class Program
@@ -24,9 +22,12 @@
             // 2.0 寮�惎tcp
             StartTcp();
             // 3.0 寮�惎S7
-            StartS7();
+            //StartS7();
             // 4.0 寮�惎Modbus
             //StartModbus();
+
+            // TCP娴嬭瘯
+            //TcpClientHelper.Link("127.0.0.1", 8550);
 
             // 5.0 寮�惎绾跨▼
             var rc = HostFactory.Run(x => {
@@ -54,7 +55,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 +70,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 +94,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 +102,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 +118,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