From a8627a98b82d2364cbe849ca746e72fbab9916e5 Mon Sep 17 00:00:00 2001
From: kazelee <1847801760@qq.com>
Date: 星期三, 21 五月 2025 17:31:14 +0800
Subject: [PATCH] 重构代码修复事务问题,测试完善后台盘点功能

---
 Program.cs |   37 ++++++++++++++-----------------------
 1 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/Program.cs b/Program.cs
index 40608f4..577f06e 100644
--- a/Program.cs
+++ b/Program.cs
@@ -3,8 +3,7 @@
 using System.Threading;
 using System.Threading.Tasks;
 
-using HH.WCS.Mobox3.AnGang.AppStart;
-using HH.WCS.Mobox3.AnGang.Devices;
+using HH.WCS.Mobox3.AnGang.device;
 
 using Microsoft.Owin.Hosting;
 
@@ -13,6 +12,7 @@
 namespace HH.WCS.Mobox3.AnGang {
     internal class Program
     {
+        [STAThread]
         static void Main(string[] args)
         {
             //鍩虹璁剧疆淇℃伅鍒濆鍖�@@ -22,9 +22,12 @@
             //2.0 寮�惎tcp
             StartTcp();
             //3.0 寮�惎S7
-            StartS7();
+            //StartS7();
             //4.0 寮�惎Modbus
-            StartModbus();
+            //StartModbus();
+
+            //寮�惎鐩告満
+            StartSnap();
 
             //5.0 寮�惎绾跨▼
             var rc = HostFactory.Run(x =>
@@ -55,7 +58,7 @@
             Console.WriteLine("Startup ApiController");
             Task.Run(() =>
             {
-                var url = Settings.Config.WebApiUrl;
+                var url = Settings.WebApiUrl;
                 Console.WriteLine(url);
                 using (WebApp.Start<Startup>(url))
                 {
@@ -70,8 +73,8 @@
         /// </summary>
         private static void StartTcp()
         {
-            var tcpServerIP = Settings.Config.TCPServerIP;
-            var tcpServerPort = Settings.Config.TCPServerPort;
+            var tcpServerIP = Settings.TCPServerIP;
+            var tcpServerPort = Settings.TCPServerPort;
             new TcpServer(tcpServerIP, tcpServerPort);
 
         }
@@ -92,18 +95,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>
@@ -122,6 +113,10 @@
             //}
         }
 
+        private static void StartSnap() {
+            new SnapManager(Settings.Snaps[0]);
+        }
+
         public class WorkThread
         {
             public void Start()
@@ -130,11 +125,7 @@
                 // 娣诲姞浠诲姟鎺ㄩ�绾跨▼
                 //tasks.Add(GetTask(WCSCore.Dispatch));
 
-                ////娣诲姞鑷畾涔夌嚎绋�-                //tasks.Add(GetTask(Monitor.CheckEmptyCnt));//妫�祴绌烘墭鐩� 
-                ////鏍规嵁S7/Modbus鍗忚鍒ゆ柇杈撻�绾跨殑淇″彿  鍘熸潗鏂欎骇绾垮簱鍖�>婊℃墭缂撳瓨搴撳尯锛岀┖鎵樼紦瀛樺簱鍖�>鍘熸潗鏂欎骇绾垮簱鍖�-                //tasks.Add(GetTask(Monitor.CheckS7Devices));
 
                 Task.WaitAll(tasks.ToArray());
             }

--
Gitblit v1.9.1