From df5b2944a6cb34b658a4e62096b45f10f679023e Mon Sep 17 00:00:00 2001
From: cjs <2216046164@qq.com>
Date: 星期四, 26 六月 2025 17:17:11 +0800
Subject: [PATCH] 11

---
 ams/Hanhe.iWCS.JingmenGEMTwoProtocol/ProcessHelper.cs |  148 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 104 insertions(+), 44 deletions(-)

diff --git a/ams/Hanhe.iWCS.JingmenGEMTwoProtocol/ProcessHelper.cs b/ams/Hanhe.iWCS.JingmenGEMTwoProtocol/ProcessHelper.cs
index 89db716..2128a19 100644
--- a/ams/Hanhe.iWCS.JingmenGEMTwoProtocol/ProcessHelper.cs
+++ b/ams/Hanhe.iWCS.JingmenGEMTwoProtocol/ProcessHelper.cs
@@ -9,6 +9,7 @@
 using MongoDB.Driver.Builders;
 using MySql.Data.MySqlClient;
 using Newtonsoft.Json;
+using SqlSugar;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -698,50 +699,50 @@
                 {
                     #region 鍒ゆ柇杈撻�绾挎ā寮�鍙樻洿娉ㄩ噴
 
-                    foreach(var a in plc)
-                    {
-                        bool action = false;
-                        var modeResult = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel
-                        {
-                            dataNum = 1,
-                            addr = a.readAddr + 3,
-                            host = a.ip,
-                            port = a.port
-                        });
-                        if (modeResult != null && modeResult.errCode == 0)
-                        {
-                            CMMLog.Debug($"OutWareTask锛氳鍙栨粴绛掓満{a.ip}閫氶亾鍙蜂负锛歿a.readAddr + 3}鐨勫�涓猴細{modeResult.result[0]}");
-                            if (modeResult.result[0] == 2)
-                            {
-                                CMMLog.Debug($"OutWareTask:杈撻�绾夸负 鍏ュ簱妯″紡锛岃緭閫佺嚎鐐逛綅锛歿a.location}");
-                                break;
-                            }
-                            else
-                            {
-                                //璇诲彇涓棿琛ㄦā寮�-                                var modelInfo = MongoDBSingleton.Instance.FindOne<ModeList>("ModeList");
-                                if (modelInfo != null)
-                                {
-                                    if (modelInfo.Mode == "鍏ュ簱妯″紡")
-                                    {
-                                        CMMLog.Debug($"OutWareTask:涓棿琛�ModeList涓�鍏ュ簱妯″紡");
-                                    }
-                                    else
-                                    {
-                                        action = true;
-                                    }
-                                }
-                                else
-                                {
-                                    CMMLog.Debug("OutWareTask:涓棿琛�ModeList 涓虹┖");
-                                }
-                            }
-                        }
-                        if (!action)
-                        {
-                            return false;
-                        }
-                    };
+                    //foreach(var a in plc)
+                    //{
+                    //    bool action = false;
+                    //    var modeResult = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel
+                    //    {
+                    //        dataNum = 1,
+                    //        addr = a.readAddr + 3,
+                    //        host = a.ip,
+                    //        port = a.port
+                    //    });
+                    //    if (modeResult != null && modeResult.errCode == 0)
+                    //    {
+                    //        CMMLog.Debug($"OutWareTask锛氳鍙栨粴绛掓満{a.ip}閫氶亾鍙蜂负锛歿a.readAddr + 3}鐨勫�涓猴細{modeResult.result[0]}");
+                    //        if (modeResult.result[0] == 2)
+                    //        {
+                    //            CMMLog.Debug($"OutWareTask:杈撻�绾夸负 鍏ュ簱妯″紡锛岃緭閫佺嚎鐐逛綅锛歿a.location}");
+                    //            break;
+                    //        }
+                    //        else
+                    //        {
+                    //            //璇诲彇涓棿琛ㄦā寮�+                    //            var modelInfo = MongoDBSingleton.Instance.FindOne<ModeList>("ModeList");
+                    //            if (modelInfo != null)
+                    //            {
+                    //                if (modelInfo.Mode == "鍏ュ簱妯″紡")
+                    //                {
+                    //                    CMMLog.Debug($"OutWareTask:涓棿琛�ModeList涓�鍏ュ簱妯″紡");
+                    //                }
+                    //                else
+                    //                {
+                    //                    action = true;
+                    //                }
+                    //            }
+                    //            else
+                    //            {
+                    //                CMMLog.Debug("OutWareTask:涓棿琛�ModeList 涓虹┖");
+                    //            }
+                    //        }
+                    //    }
+                    //    if (!action)
+                    //    {
+                    //        return false;
+                    //    }
+                    //};
 
                     #endregion
 
@@ -1322,5 +1323,64 @@
             return WeekNumInMonth;
         }
 
+        internal static bool UpdateTaskState(string taskNo, int state)
+        {
+            var result = false;
+            try
+            {
+                string taskState = state == 3 ? "寮�鍙栬揣" : state == 4 ? "鍙栬揣瀹屾垚" : state == 5 ? "寮�鍗歌揣" : state == 6 ? "鍗歌揣瀹屾垚" : state == 2 ? "瀹屾垚" : "";
+                CMMLog.Info($"SQLServer 鏇存柊浠诲姟鐘舵�锛氫换鍔″彿锛歿taskNo},鏇存敼鐘舵�锛歿taskState}");
+                if (!string.IsNullOrEmpty(taskState)) result = new SqlHelper<SQL_TN_I_TASK_MST>().ExecuteSql($"update dbo.tn_am_task_mst set CN_S_STATUS='{taskState}' where CN_S_TASK_NO='{taskNo}'");
+            }
+            catch (Exception ex)
+            {
+                CMMLog.Error($"SQLServer 鏇存柊浠诲姟鐘舵�寮傚父锛歿ex.Message}");
+            }
+
+            return result;
+        }
+
+        /// <summary>
+        /// SQL-AMS浠诲姟涓昏〃
+        /// </summary>
+        [SugarTable("dbo.tn_am_task_mst")]
+        public class SQL_TN_I_TASK_MST
+        {
+            public string CN_S_BATCH_NO { get; set; }
+            public int CN_S_ORDER_NO { get; set; }
+            public string CN_S_TASK_NO { get; set; }
+            public string CN_S_SOURCE_SYS { get; set; }
+            public string CN_S_SOURCE_NO { get; set; }
+            public string CN_S_PROCESS_CODE { get; set; }
+            public string CN_S_TASK_TYPE { get; set; }
+            public string CN_S_START_AREA { get; set; }
+            public string CN_S_START_AREA_NAME { get; set; }
+            public string CN_S_START_BIT { get; set; }
+            public int CN_N_START_AGVBIT { get; set; }
+            public string CN_S_END_AREA { get; set; }
+            public string CN_S_END_AREA_NAME { get; set; }
+            public string CN_S_END_BIT { get; set; }
+            public int CN_N_END_AGVBIT { get; set; }
+            public string CN_S_STATUS { get; set; }
+            public string CN_S_BEF_STATUS { get; set; }
+            public string CN_S_BEFORE_NO { get; set; }
+            public string CN_S_AFTER_NO { get; set; }
+            public string CN_T_START_WORKING { get; set; }
+            public string CN_T_END_WORKING { get; set; }
+            public int CN_N_PRIORITY { get; set; }
+            public int CN_N_CUR_STEP { get; set; }
+            public string CN_S_CREATOR { get; set; }
+            public string CN_S_CREATOR_NAME { get; set; }
+            public string CN_T_CREATE { get; set; }
+            public string CN_S_MENDER { get; set; }
+            public string CN_S_MODIFY_NAME { get; set; }
+            public string CN_T_MODIFY { get; set; }
+            public string CN_S_TASK_MODEL { get; set; }
+            public string CN_S_EXT1 { get; set; }
+            public string CN_S_EXT2 { get; set; }
+            public string CN_S_EXT3 { get; set; }
+            public string CN_N_AGV_NO { get; set; }
+            public string CN_S_TRANSPORT_INFO { get; set; }
+        }
     }
 }

--
Gitblit v1.9.1