From 6fff0e3d3b6c9afc29b54d591012cb90475be149 Mon Sep 17 00:00:00 2001
From: czw <selecti@yeah.net>
Date: 星期一, 14 七月 2025 10:42:21 +0800
Subject: [PATCH] 1

---
 2025年6月12日/AuxAllWCS/Build/Project/代码/ViewModel.cs |  888 ++++++++++++++++++++++------------------------------------
 1 files changed, 335 insertions(+), 553 deletions(-)

diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/ViewModel.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/ViewModel.cs"
index 74fea72..92da2fb 100644
--- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/ViewModel.cs"
+++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/ViewModel.cs"
@@ -30,27 +30,27 @@
 using GZ.DB.Entity.OIDATABASE;
 namespace GZ.Projects.AuxAllWCS
 {
-	public partial class ViewModel : System.ComponentModel.INotifyPropertyChanged
-	{
-		#region 绉佹湁鍙橀噺
-		//闆嗘垚浜掕仈
-		private Conn Conn = new Conn();
-		//璁惧閫氫俊
-		private Device Device = new Device();
-		//鍙橀噺鏁版嵁搴�-		private Tag tag = new Tag();
-		public Tag Tag
-		{
-			get { return tag; }
-			set { tag = value; RaisePropertyChanged(nameof(Tag)); }
-		}
-		//绠�寲PLC
-		public EasyPLC EasyPLC = new EasyPLC();
-		#endregion
-		
-		#region 鏋勯�鍑芥暟
-		private static ViewModel _ViewModel = null;
-		private static List<object> _Windows = new List<object>();
+    public partial class ViewModel : System.ComponentModel.INotifyPropertyChanged
+    {
+        #region 绉佹湁鍙橀噺
+        //闆嗘垚浜掕仈
+        private Conn Conn = new Conn();
+        //璁惧閫氫俊
+        private Device Device = new Device();
+        //鍙橀噺鏁版嵁搴�+        private Tag tag = new Tag();
+        public Tag Tag
+        {
+            get { return tag; }
+            set { tag = value; RaisePropertyChanged(nameof(Tag)); }
+        }
+        //绠�寲PLC
+        public EasyPLC EasyPLC = new EasyPLC();
+        #endregion
+
+        #region 鏋勯�鍑芥暟
+        private static ViewModel _ViewModel = null;
+        private static List<object> _Windows = new List<object>();
         public static ViewModel CreateInstance(object obj, Type type)
         {
             if (_ViewModel == null)
@@ -59,47 +59,49 @@
             }
             if (!_Windows.Contains(obj))
             {
-				_Windows.Add(obj);
+                _Windows.Add(obj);
             }
             return _ViewModel;
         }
-		public ViewModel()
-		{
-			
-		}
-		#endregion
-		
-		#region 鑷畾涔夋寚浠�-public void Method1(System.Int32 param1)
-{
-		#region    [鑷畾涔夋寚浠[20250323111354905][Method1]
-
-		#endregion [鑷畾涔夋寚浠[20250323111354905][Method1]
-}
-public void SettingInit()
-{
-		#region    [鑷畾涔夋寚浠[20250323144605974][SettingInit]
-try
-{
-    var jsonFile = System.AppDomain.CurrentDomain.BaseDirectory + "/Static/config.json";
-    using (System.IO.StreamReader file = System.IO.File.OpenText(jsonFile))
-    {
-        using (JsonTextReader reader = new JsonTextReader(file))
+        public ViewModel()
         {
-            JObject o = (JObject)JToken.ReadFrom(reader);
-            foreach (Newtonsoft.Json.Linq.JProperty keyValue in o.Properties())
+
+        }
+        #endregion
+
+        #region 鑷畾涔夋寚浠�+        public void Method1(System.Int32 param1)
+        {
+            #region    [鑷畾涔夋寚浠[20250323111354905][Method1]
+
+            #endregion [鑷畾涔夋寚浠[20250323111354905][Method1]
+        }
+        public void SettingInit()
+        {
+            #region    [鑷畾涔夋寚浠[20250323144605974][SettingInit]
+            try
             {
-                Console.WriteLine(keyValue.Name);
-                if (keyValue.Name == "HostToAgvServerUrl")
+                var jsonFile = System.AppDomain.CurrentDomain.BaseDirectory + "/Static/config.json";
+                using (System.IO.StreamReader file = System.IO.File.OpenText(jsonFile))
                 {
-                    Settings.HostToAgvServerUrl = keyValue.Value.ToString();
-                }
-                if (keyValue.Name == "deviceInfo") {
-                      Settings.deviceInfos = JsonConvert.DeserializeObject<List<deviceInfo>>(keyValue.Value.ToString());
-                }
-                if (keyValue.Name == "HKbaseUrl") {
-                      Settings.HKbaseUrl = keyValue.Value.ToString();
-                }
+                    using (JsonTextReader reader = new JsonTextReader(file))
+                    {
+                        JObject o = (JObject)JToken.ReadFrom(reader);
+                        foreach (Newtonsoft.Json.Linq.JProperty keyValue in o.Properties())
+                        {
+                            Console.WriteLine(keyValue.Name);
+                            if (keyValue.Name == "HostToAgvServerUrl")
+                            {
+                                Settings.HostToAgvServerUrl = keyValue.Value.ToString();
+                            }
+                            if (keyValue.Name == "deviceInfo")
+                            {
+                                Settings.deviceInfos = JsonConvert.DeserializeObject<List<deviceInfo>>(keyValue.Value.ToString());
+                            }
+                            if (keyValue.Name == "HKbaseUrl")
+                            {
+                                Settings.HKbaseUrl = keyValue.Value.ToString();
+                            }
                             if (keyValue.Name == "MESbaseUrl")
                             {
                                 Settings.MESbaseUrl = keyValue.Value.ToString();
@@ -108,345 +110,117 @@
                             {
                                 Settings.WMSbaseUrl = keyValue.Value.ToString();
                             }
+                        }
+                    }
+                }
+                //if(!Settings.FirstG)
+                //LogHelper.Info("鍔犺浇閰嶇疆鏂囦欢淇℃伅 瀹屾垚");
             }
+            catch (Exception ex)
+            {
+                LogHelper.Error("鍔犺浇閰嶇疆鏂囦欢澶辫触锛� + ex.Message, ex);
+            }
+            #endregion [鑷畾涔夋寚浠[20250323144605974][SettingInit]
         }
-    }
-    //if(!Settings.FirstG)
-    	//LogHelper.Info("鍔犺浇閰嶇疆鏂囦欢淇℃伅 瀹屾垚");
-}
-catch (Exception ex)
-{
-    LogHelper.Error("鍔犺浇閰嶇疆鏂囦欢澶辫触锛� + ex.Message, ex);
-}
-		#endregion [鑷畾涔夋寚浠[20250323144605974][SettingInit]
-}
-public void OperateHKTaskStatus(System.Object param1)
-{
-		#region    [鑷畾涔夋寚浠[20250324165239206][OperateHKTaskStatus]
-HaiKangOrderInfo model = (HaiKangOrderInfo)param1;
+        public void OperateHKTaskStatus(System.Object param1)
+        {
+            #region    [鑷畾涔夋寚浠[20250324165239206][OperateHKTaskStatus]
+            HaiKangOrderInfo model = (HaiKangOrderInfo)param1;
             if (string.IsNullOrEmpty(model.taskCode))
                 return;
-            // 鏌ヨ浠诲姟锛氭牴鎹换鍔″彿
-            //var wcsTask = WCSHelper.GetTask(model.taskCode);
-            ITaskRepository MainMissionService = new TaskRepository();
-            var wcsTask = MainMissionService.FindEntity(x => model.taskCode == x.S_TASK_NO);
-            if (wcsTask != null)
+            var hkr = AutoThread.InvokeMethod(AutoThread.Instance, "OperateHKTaskStatus", new object[] { model });
+            //return JsonConvert.SerializeObject(hkr);
+            #endregion [鑷畾涔夋寚浠[20250324165239206][OperateHKTaskStatus]
+        }
+        public GZ.DB.Entity.OIDATABASE.TaskEntity Begin(GZ.DB.Entity.OIDATABASE.TaskEntity task)
+        {
+            #region    [鑷畾涔夋寚浠[20250324170811305][Begin]
+            if (task.S_B_STATE.Trim() == "宸叉帹閫�)
             {
-                if (!string.IsNullOrWhiteSpace(model.method))
+                task.S_B_STATE = "鎵ц涓�;
+                task.T_START_TIME = DateTime.Now;
+            }
+            return task;
+            #endregion [鑷畾涔夋寚浠[20250324170811305][Begin]
+        }
+        public GZ.DB.Entity.OIDATABASE.TaskEntity End(GZ.DB.Entity.OIDATABASE.TaskEntity task)
+        {
+            #region    [鑷畾涔夋寚浠[20250324170922920][End]
+            if (task != null)
+            {
+                task.S_B_STATE = "瀹屾垚";
+                task.T_END_TIME = DateTime.Now;
+            }
+            return task;
+            #endregion [鑷畾涔夋寚浠[20250324170922920][End]
+        }
+        public GZ.DB.Entity.OIDATABASE.TaskEntity UpdateStatus(GZ.DB.Entity.OIDATABASE.TaskEntity task, System.String status)
+        {
+            #region    [鑷畾涔夋寚浠[20250324171118766][UpdateStatus]
+            task.S_B_STATE = status;
+            return task;
+            #endregion [鑷畾涔夋寚浠[20250324171118766][UpdateStatus]
+        }
+        public void RunafterMac(System.Object dev, System.Boolean blen)
+        {
+            #region    [鑷畾涔夋寚浠[20250325085905222][RunafterMac]
+            var device = (deviceInfo)dev;
+            if (device.areaPriy.Any() && device.deviceNo.Any())
+            {
+                LocRepository locRepository = new LocRepository();
+                LocContainerRepository locContainerRepository = new LocContainerRepository();
+                ContainerRepository containerRepository = new ContainerRepository();
+                LocEntity startLoc = null;
+                string Sign = device.deviceType == 1 ? "F" : "E";
+                foreach (var sloc in device.deviceNo)
                 {
-                    ILocRepository locrep = new LocRepository();
-                    var startloc = locrep.FindEntity(x => x.S_LOC_CODE == wcsTask.S_START_LOC);
-                    var endLoc = locrep.FindEntity(x => x.S_LOC_CODE == wcsTask.S_END_LOC);
-
-                    List<string> cntrs = wcsTask.S_CNTRS.Split(',').ToList();
-                    bool bobe = false;
-                    switch (model.method)
+                    ContainerEntity c = null;
+                    var Startloc = locRepository.FindEntity(x => x.S_LOC_CODE == sloc);
+                    if (Startloc != null && Startloc.N_CURRENT_NUM == 1 && Startloc.S_LOCK_STATE == "鏃�)
                     {
-                        case "start":
-                            LogHelper.Info($"娴峰悍杞︿换鍔$姸鎬佸彉鏇翠负鎵ц锛屼换鍔″彿涓猴細{model.taskCode}", "agv鏉弶浜や簰鏃ュ織");
-                            if (wcsTask.S_B_STATE.Trim() == "宸叉帹閫�)
-                            {
-                                wcsTask.S_B_STATE = "鎵ц涓�;
-                                wcsTask.T_START_TIME = DateTime.Now;
-                                MainMissionService.Update(wcsTask);
-                                bobe = true;
-                            }
-                            break;
-                        case "outbin":
-                            LogHelper.Info($"娴峰悍杞︿换鍔$姸鎬佸彉鏇翠负鍙栬揣瀹屾垚锛屼换鍔″彿涓猴細{model.taskCode}", "agv鏉弶浜や簰鏃ュ織");
-                            wcsTask.S_B_STATE = "鍙栬揣瀹屾垚";
-
-                            startloc.N_CURRENT_NUM = 0;
-                            startloc.S_LOCK_STATE = "鏃�;
-                            startloc.T_MODIFY = DateTime.Now;
-                            //ILocContainerRepository locContainerRepository = new LocContainerRepository();
-                            ////var cnr = locContainerRepository.FindList(x => cntrs.Contains(x.S_CNTR_CODE.Trim()) && x.S_LOC_CODE == wcsTask.S_START_LOC);
-                            //locContainerRepository.Delete(x => cntrs.Contains(x.S_CNTR_CODE.Trim()) && x.S_LOC_CODE == wcsTask.S_START_LOC);
-                            MainMissionService.Update(wcsTask);
-                            locrep.Update(startloc);
-
-                            bobe = true;
-                            var device = Settings.deviceInfos.Find(x => x.location.Contains(wcsTask.S_START_LOC));
-                            if (device != null)
-                            {
-                                if (device.deviceType == 1)
-                                {
-                                    if (device.deviceName.Contains("缁村笇灏旀姄鑷�))
-                                    {  //鍗歌揣杩涜娓呯┖锛岃Е鍙戞壂鐮�-                                       var inde = device.location.ToList().FindIndex(x => x == wcsTask.S_START_LOC) == 0;
-                                       string V = inde ? "R05" : "R06";
-                                       Conn.榛樿Redis.SetValue(device.deviceName + "." + V, "true", device.deviceName + "Queue");
-                                       TcpServer.TrayIps.Remove(device.deviceNo[inde ? 0 : 1]);
-                                    }
-                                }
-                                else if(device.deviceType == 2){
-									var inde = device.location.ToList().FindIndex(x => x == wcsTask.S_START_LOC) == 0;
-									 string V = inde? "D1224" : "D1225";
-									 Conn.榛樿Redis.SetValue(device.deviceName + "." + V, "0", device.deviceName + "Queue");
-                                }
-                            }
-                            //LocationHelper.UnLockLoc(wcsTask.S_START_LOC);
-                            break;
-                        case "end":
-                            LogHelper.Info($"娴峰悍杞︿换鍔$姸鎬佸彉鏇翠负瀹屾垚锛屼换鍔″彿涓猴細{model.taskCode}", "agv鏉弶浜や簰鏃ュ織");
-                            wcsTask.S_B_STATE = "瀹屾垚";
-                            wcsTask.T_END_TIME = DateTime.Now;
-
-                            bobe = true;
-                            //ILocContainerRepository locContainerRepository2 = new LocContainerRepository();
-                            //List<LocContainerEntity> llls = new List<LocContainerEntity>();
-                            //foreach (var c in cntrs)
-                            //{
-                            //    var action = new LocContainerEntity()
-                            //    {
-                            //        S_ID = Guid.NewGuid().ToString(),
-                            //        S_STATE = "缂栬緫",
-                            //        T_CREATE = DateTime.Now,
-                            //        T_MODIFY = DateTime.Now,
-
-                            //        S_LOC_CODE = endLoc.S_LOC_CODE,
-                            //        S_CNTR_CODE = c,
-                            //        S_TYPE = "",
-                            //    };
-                            //    llls.Add(action);
-                            //}
-
-                            endLoc.S_LOCK_STATE = "鏃�;
-                            endLoc.N_CURRENT_NUM = 1;
-                            endLoc.T_MODIFY = DateTime.Now;
-                            MainMissionService.Update(wcsTask);
-                            if(Settings.deviceInfos.Find(x=>x.deviceType==2 && (/*x.location.Contains(wcsTask.S_END_LOC)||*/x.deviceNo.Contains(wcsTask.S_END_LOC)))!=null)
-                                locrep.Update(endLoc);
-                            //locContainerRepository2.Insert(llls);
-
-                            var device2 = Settings.deviceInfos.Find(x => x.location.Contains(wcsTask.S_END_LOC));
-                            if (device2 != null)
-                            {
-                                if (device2.deviceType == 1)
-                                {
-                                    if (device2.deviceName.Contains("缁村笇灏旀姄鑷�))
-                                    {
-                                        //string V = device2.location.ToList().FindIndex(x => x == wcsTask.S_START_LOC) == 0 ? "R10" : "R11";
-                                        //Conn.榛樿Redis.SetValue(device2.deviceName + "." + V, "true", device2.deviceName + "Queue");
-                                        //鍗歌揣鍐嶅啓鎵樼洏鍙栬蛋銆�鐒跺悗瑙﹀彂鎵爜杩涜鏍¢獙銆�
-                                        var inde = device2.location.ToList().FindIndex(x => x == wcsTask.S_END_LOC) == 0;
-                                        //string V = inde ? "R05" : "R06";
-                                        //Conn.榛樿Redis.SetValue(device2.deviceName + "." + V, "true", device2.deviceName + "Queue");
-                                        string V2 = inde ? "R10_LAST" : "R11_LAST";
-                                        Conn.榛樿Redis.SetValue(device2.deviceName + "." + V2, "true", device2.deviceName + "Queue");
-                                        TcpServer.TrayIps.Remove(device2.deviceNo[inde ? 0 : 1]);
-                                    }
-                                }
-                                else if (device2.deviceType == 2)
-                                    if (device2.deviceName.Contains("Js鎹烽『"))
-                                    {
-                                        var inde = device2.location.ToList().FindIndex(x => x == wcsTask.S_END_LOC) == 0;
-                                        string V = inde? "D1224" : "D1225";
-                                        Conn.榛樿Redis.SetValue(device2.deviceName + "." + V, "1", device2.deviceName + "Queue");
-
-                                        var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
-                                        {
-                                            sceneType = 3,
-                                            cntrCode = cntrs.FirstOrDefault()
-                                        }));
-                                        //if (device2.deviceName.Contains("1"))
-                                        //{
-                                        //    if (inde) tag.Js1.D1224 = 1;
-                                        //    else tag.Js1.D1225 = 1;
-                                        //}else
-                                        //{
-                                        //    if (inde) tag.Js2.D1224 = 1;
-                                        //    else tag.Js2.D1225 = 1;
-                                        //}
-                                    }
-                            }
-
-                            //LocationMethod.JudgeLocation(wcsTask);
-                            break;
-                        case "cancel":
-                            LogHelper.Info($"娴峰悍杞︿换鍔$姸鎬佸彉鏇翠负鍙栨秷锛屼换鍔″彿涓猴細{model.taskCode}", "agv鏉弶浜や簰鏃ュ織");
-                            wcsTask.S_B_STATE = "鍙栨秷";
-                            //startloc.S_LOCK_STATE = "鏃�;
-                            //endLoc.S_LOCK_STATE = "鏃�;
-                            MainMissionService.Update(wcsTask);
-                            TaskActRepository taskActRepository = new TaskActRepository();
-                            var tare = taskActRepository.FindList(x => x.S_TASK_NO == wcsTask.S_TASK_NO);
-                            if (tare.Any())
-                            {
-                                if(tare.Find(x=>x.S_ACTION_CODE=="outbin")==null)
-                                {
-                                    startloc.S_LOCK_STATE = "鏃�;
-                                    endLoc.S_LOCK_STATE = "鏃�;
-                                    locrep.Update(startloc);
-                                    locrep.Update(endLoc);
-                                }else if (tare.Find(x => x.S_ACTION_CODE == "end") == null)
-                                {
-                                    endLoc.S_LOCK_STATE = "鏃�;
-                                    locrep.Update(endLoc);
-                                }
-                            }
-
-                            //locrep.Update(startloc);
-                            //locrep.Update(endLoc);
-                            //TaskProcess.OperateStatus(wcsTask, 7);
-                            //WCSHelper.Fail(wcsTask);
-                            break;
-                        case "apply":
-                            // 鍒ゆ柇璇ヤ换鍔$殑鎺ラ┏浣嶆槸鍚︽湁鍏朵粬鍏ュ簱鎴栧嚭搴撲换鍔★紝濡傛灉鏈夛紝鍒欏湪绛変綅绛夊緟锛屽鏋滄病鏈夛紝鍒欏叆
-                            TaskisOk(wcsTask);
-                            break;
-                    }
-
-                    if (!string.IsNullOrEmpty(wcsTask.S_SRC_NO))
-                    {
-                        var mestask = MainMissionService.FindEntity(x => x.S_TASK_NO == wcsTask.S_SRC_NO);
-                        if (mestask!=null&&bobe)
+                        var cntr = locContainerRepository.FindEntity(x => x.S_LOC_CODE == sloc);
+                        if (cntr != null)
                         {
-                            if ( model.method != "end")
+                            c = containerRepository.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);
+                            if (c != null && c.S_TYPE == Sign)
                             {
-                            	if (mestask.S_START_LOC == wcsTask.S_START_LOC&&mestask.S_B_STATE == "MES")
-	                                Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/201", JsonConvert.SerializeObject(new
-	                                {
-	                                    reqCode = wcsTask.S_SRC_NO,
-	                                    model.method
-	                                }));
+                                startLoc = Startloc;
                             }
-                            else
-                            {
-                                if (mestask.S_END_LOC != wcsTask.S_END_LOC)
-                                {
-                                    LogHelper.Info($"{wcsTask.S_SRC_NO}-{wcsTask.S_TASK_NO} 涓�樁娈靛畬鎴愶紝閲嶇疆杩涜浜岄樁娈点�");
-                                    mestask.N_PRIORITY = -88;
-                                    MainMissionService.Update(mestask);
-                                }
-                                else if(mestask.S_B_STATE == "MES")
-                                {
-                                    var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/201", JsonConvert.SerializeObject(new
-                                    {
-                                        reqCode = wcsTask.S_SRC_NO,
-                                        model.method
-                                    }));
-                                }
-                            }
-
-                        }else if(mestask!=null && model.method== "cancel")
-                        {
-                        	 if(mestask.S_B_STATE == "MES")
-	                           Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/201", JsonConvert.SerializeObject(new
-	                            {
-	                                reqCode = wcsTask.S_SRC_NO,
-	                                model.method
-	                            })); 
-                            LogHelper.Info($"{wcsTask.S_SRC_NO}-{wcsTask.S_TASK_NO} 涓�樁娈靛彇娑堬紝閲嶇疆鐐癸紝绾跨▼澶勭悊銆�);
-                            mestask.N_PRIORITY = -1;
-                            mestask.S_B_STATE = "MES_鍙栨秷";
-                            MainMissionService.Update(mestask);
                         }
                     }
-                    TaskProcess.AddActionRecord(model.taskCode, model.method, model.eqpCode, model.data,wcsTask.S_START_LOC,wcsTask.S_END_LOC);
-                    //璋冪敤绗笁鏂规帴鍙o紙濡傛灉鏈夛級TaskProcess.ReportStatus
-                }
-                else
-                {
-                    // 鏆傛椂璁惧畾涓�
-                    wcsTask.S_B_STATE = "涓婃姤鐘舵�绌�;
-                    //瀹夊叏璇锋眰绛�-                    //TaskProcess.OperateReq(model.taskCode, wcsTask.N_B_STATE, model.eqpCode, model.data);
-                }
-            }
-            else
-            {
-                LogHelper.Info($"褰撳墠浠诲姟鍙蜂换鍔′笉瀛樺湪{model.taskCode}", "agv鏉弶浜や簰鏃ュ織");
-            }
-		#endregion [鑷畾涔夋寚浠[20250324165239206][OperateHKTaskStatus]
-}
-public GZ.DB.Entity.OIDATABASE.TaskEntity Begin(GZ.DB.Entity.OIDATABASE.TaskEntity task)
-{
-		#region    [鑷畾涔夋寚浠[20250324170811305][Begin]
- if (task.S_B_STATE.Trim() == "宸叉帹閫�) {
-     task.S_B_STATE = "鎵ц涓�;
-     task.T_START_TIME = DateTime.Now;
- }
- return task;
-		#endregion [鑷畾涔夋寚浠[20250324170811305][Begin]
-}
-public GZ.DB.Entity.OIDATABASE.TaskEntity End(GZ.DB.Entity.OIDATABASE.TaskEntity task)
-{
-		#region    [鑷畾涔夋寚浠[20250324170922920][End]
- if (task != null) {
-     task.S_B_STATE = "瀹屾垚";
-     task.T_END_TIME = DateTime.Now;
- }
- return task;
-		#endregion [鑷畾涔夋寚浠[20250324170922920][End]
-}
-public GZ.DB.Entity.OIDATABASE.TaskEntity UpdateStatus(GZ.DB.Entity.OIDATABASE.TaskEntity task, System.String status)
-{
-		#region    [鑷畾涔夋寚浠[20250324171118766][UpdateStatus]
-task.S_B_STATE = status;
-return task;
-		#endregion [鑷畾涔夋寚浠[20250324171118766][UpdateStatus]
-}
-public void RunafterMac(System.Object dev, System.Boolean blen)
-{
-		#region    [鑷畾涔夋寚浠[20250325085905222][RunafterMac]
-var device = (deviceInfo)dev;
-if (device.areaPriy.Any() && device.deviceNo.Any())
-{
-    LocRepository locRepository = new LocRepository();
-    LocContainerRepository locContainerRepository = new LocContainerRepository();
-    ContainerRepository containerRepository = new ContainerRepository();
-    LocEntity startLoc = null;
-    string Sign = device.deviceType == 1 ? "F" : "E";
-    foreach (var sloc in device.deviceNo)
-    {
-        ContainerEntity c = null;
-        var Startloc = locRepository.FindEntity(x => x.S_LOC_CODE == sloc);
-        if (Startloc != null && Startloc.N_CURRENT_NUM == 1 && Startloc.S_LOCK_STATE == "鏃�)
-        {
-            var cntr = locContainerRepository.FindEntity(x => x.S_LOC_CODE == sloc);
-            if (cntr != null)
-            {
-                c = containerRepository.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);
-                if (c != null && c.S_TYPE == Sign)
-                {
-                    startLoc = Startloc;
-                }
-            }
-        }
 
-        if (startLoc != null)
-        {
-            foreach (var dn in device.areaPriy)
-            {
-                LocEntity endLoc = null;
-                var di = Settings.deviceInfos.Find(x => x.deviceName == dn);
-                if (di != null)
-                {
-                    foreach (var ssloc in di.deviceNo)
+                    if (startLoc != null)
                     {
-                        var endloc = locRepository.FindEntity(x => x.S_LOC_CODE == ssloc);
-                        if (endloc != null && endloc.N_CURRENT_NUM == 0 && endloc.S_LOCK_STATE == "鏃�)
+                        foreach (var dn in device.areaPriy)
                         {
-                            endLoc = endloc;
-                            break;
+                            LocEntity endLoc = null;
+                            var di = Settings.deviceInfos.Find(x => x.deviceName == dn);
+                            if (di != null)
+                            {
+                                foreach (var ssloc in di.deviceNo)
+                                {
+                                    var endloc = locRepository.FindEntity(x => x.S_LOC_CODE == ssloc);
+                                    if (endloc != null && endloc.N_CURRENT_NUM == 0 && endloc.S_LOCK_STATE == "鏃�)
+                                    {
+                                        endLoc = endloc;
+                                        break;
+                                    }
+                                }
+                                if (endLoc != null)
+                                {
+                                    TaskProcess.CreateTask("", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, $"鎵樼洏娴佽浆-{Sign}", 5, new List<string> { c.S_CODE });
+                                    break;
+                                }
+                            }
                         }
                     }
-                    if (endLoc != null)
-                    {
-                        TaskProcess.CreateTask("", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, $"鎵樼洏娴佽浆-{Sign}", 5, new List<string> { c.S_CODE });
-                        break;
-                    }
                 }
             }
+            #endregion [鑷畾涔夋寚浠[20250325085905222][RunafterMac]
         }
-    }
-}
-		#endregion [鑷畾涔夋寚浠[20250325085905222][RunafterMac]
-}
-public System.Boolean RunTask(GZ.DB.Entity.OIDATABASE.TaskEntity task)
-{
-		#region    [鑷畾涔夋寚浠[20250325092323531][RunTask]
+        public System.Boolean RunTask(GZ.DB.Entity.OIDATABASE.TaskEntity task)
+        {
+            #region    [鑷畾涔夋寚浠[20250325092323531][RunTask]
 
             ILocRepository locrep = new LocRepository();
             var startloc = locrep.FindEntity(x => x.S_LOC_CODE == task.S_START_LOC);
@@ -476,8 +250,8 @@
             //璋冪涓夋柟鎺ュ彛
             var model = new HaiKangOrderInfo
             {
-                reqCode=task.S_TASK_NO.Trim(),
-                reqTime=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                reqCode = task.S_TASK_NO.Trim(),
+                reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                 taskCode = task.S_TASK_NO.Trim(),
                 ctnrCode = task.S_CNTRS,
                 taskTyp = task.S_INDEX,
@@ -485,199 +259,207 @@
             };
 
             return CreateOrder(model);
-		#endregion [鑷畾涔夋寚浠[20250325092323531][RunTask]
-}
-public System.Boolean CreateOrder(System.Object m)
-{
-		#region    [鑷畾涔夋寚浠[20250325095053549][CreateOrder]
-var model = (HaiKangOrderInfo)m;
+            #endregion [鑷畾涔夋寚浠[20250325092323531][RunTask]
+        }
+        public System.Boolean CreateOrder(System.Object m)
+        {
+            #region    [鑷畾涔夋寚浠[20250325095053549][CreateOrder]
+            var model = (HaiKangOrderInfo)m;
             var msg = "";
             var result = false;
             var request = JsonConvert.SerializeObject(model);
             var response = Settings.apiHelper.Post(Settings.HKbaseUrl + "rcms/services/rest/hikRpcService/genAgvSchedulingTask", request);
             msg = $"[haikang-CreateOrder] request={request} response={response}";
-            
+
             LogHelper.Info(msg);
-            if (response != "") {
-                try {
+            if (response != "")
+            {
+                try
+                {
                     var dataResult = JsonConvert.DeserializeObject<HKResult>(response);
-                    if (dataResult.code == "0") {
+                    if (dataResult.code == "0")
+                    {
                         result = true;
                     }
                 }
-                catch (Exception ex) {
+                catch (Exception ex)
+                {
                     Console.WriteLine(ex.Message);
-                    LogHelper.Info(msg,"娴峰悍");
+                    LogHelper.Info(msg, "娴峰悍");
                 }
             }
-            else {
+            else
+            {
                 msg = "[haikang-CreateOrder]鍒涘缓璁㈠崟澶辫触";
                 Console.WriteLine(msg);
             }
 
-            LogHelper.Info(msg,"娴峰悍");
+            LogHelper.Info(msg, "娴峰悍");
             return result;
-		#endregion [鑷畾涔夋寚浠[20250325095053549][CreateOrder]
-}
-public void TaskisOk(GZ.DB.Entity.OIDATABASE.TaskEntity task)
-{
-		#region    [鑷畾涔夋寚浠[20250325100336909][TaskisOk]
-// 杞﹁締鍙栨斁鐢宠銆�- if ("鍙栬揣鐢宠" != "")
- {
-     var device1 = Settings.deviceInfos.Find(x => x.location.Contains(task.S_START_LOC));
-     if (device1 != null)
-     {
-         var left = device1.location.ToList().FindIndex(x => x == task.S_START_LOC) == 0;
-         if (device1.deviceType == 1)
-         {
-             if (device1.deviceName.Contains("缁村笇灏旀姄鑷�))
-             {
-                 if ("IN_BEFORE" == "IN_BEFORE"|| "out_BEFORE" == "out_BEFORE")
-                 {
-                     string V = left ? "R01" : "R03";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-                 if ("IN_after" == "IN_after"|| "out_after" == "out_after")
-                 {
-                     string V = left ? "R02" : "R04";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-             }
-             else if(device1.deviceName.Contains("Js鎹烽『"))
-             {
-                 if ("IN_BEFORE" == "IN_BEFORE")
-                 {
-                     string V = left ? "M0" : "M1";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-                 if ("out_BEFORE" == "out_BEFORE")
-                 {
-                     //string V = left ? "R01" : "R03";
-                     //Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-                 if ("IN_after" == "IN_after")
-                 {
-                     string V = left ? "M2" : "M3";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-                 if ("out_after" == "out_after")
-                 {
-                     string V = left ? "M6" : "M7";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-             }
-         }
-     }
- }
- if ("鏀捐揣鐢宠" != "")
- {
-     var device1 = Settings.deviceInfos.Find(x => x.location.Contains(task.S_END_LOC));
-     if (device1 != null)
-     {
-         var left = device1.location.ToList().FindIndex(x => x == task.S_END_LOC) == 0;
-         if (device1.deviceType == 1)
-         {
-             if (device1.deviceName.Contains("缁村笇灏旀姄鑷�))
-             {
-                 if ("IN_BEFORE" == "IN_BEFORE" || "out_BEFORE" == "out_BEFORE")
-                 {
-                     string V = left ? "R01" : "R03";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-                 if ("IN_after" == "IN_after" || "out_after" == "out_after")
-                 {
-                     string V = left ? "R02" : "R04";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-             }
-             else if (device1.deviceName.Contains("Js鎹烽『"))
-             {
-                 if ("IN_BEFORE" == "IN_BEFORE")
-                 {
-                     string V = left ? "M0" : "M1";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-                 if ("out_BEFORE" == "out_BEFORE")
-                 {
-                     string V = left ? "M4" : "M5";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-                 if ("IN_after" == "IN_after")
-                 {
-                     string V = left ? "M2" : "M3";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-                 if ("out_after" == "out_after")
-                 {
-                     string V = left ? "M6" : "M7";
-                     Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
-                 }
-             }
-         }
-     }
- }
-		#endregion [鑷畾涔夋寚浠[20250325100336909][TaskisOk]
-}
-public System.Boolean continueTask(System.Object m)
-{
-		#region    [鑷畾涔夋寚浠[20250325100607380][continueTask]
-var model = (HaiKangOrderInfo)m;
-bool result = false;
-string msg = "";
-var request = JsonConvert.SerializeObject(model);
-var response = Settings.apiHelper.Post(Settings.HKbaseUrl + "rcms/services/rest/hikRpcService/continueTask", request);
-msg = $"[haikang-CancelOrder] request={request};response={response}";
-Console.WriteLine(msg);
-if (response != "")
-{
-    var dataResult = JsonConvert.DeserializeObject<HKResult>(response);
-    if (dataResult.code == "0")
-    {
-        result = true;
+            #endregion [鑷畾涔夋寚浠[20250325095053549][CreateOrder]
+        }
+        public void TaskisOk(GZ.DB.Entity.OIDATABASE.TaskEntity task)
+        {
+            #region    [鑷畾涔夋寚浠[20250325100336909][TaskisOk]
+            // 杞﹁締鍙栨斁鐢宠銆�+            if ("鍙栬揣鐢宠" != "")
+            {
+                var device1 = Settings.deviceInfos.Find(x => x.location.Contains(task.S_START_LOC));
+                if (device1 != null)
+                {
+                    var left = device1.location.ToList().FindIndex(x => x == task.S_START_LOC) == 0;
+                    if (device1.deviceType == 1)
+                    {
+                        if (device1.deviceName.Contains("缁村笇灏旀姄鑷�))
+                        {
+                            if ("IN_BEFORE" == "IN_BEFORE" || "out_BEFORE" == "out_BEFORE")
+                            {
+                                string V = left ? "R01" : "R03";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                            if ("IN_after" == "IN_after" || "out_after" == "out_after")
+                            {
+                                string V = left ? "R02" : "R04";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                        }
+                        else if (device1.deviceName.Contains("Js鎹烽『"))
+                        {
+                            if ("IN_BEFORE" == "IN_BEFORE")
+                            {
+                                string V = left ? "M0" : "M1";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                            if ("out_BEFORE" == "out_BEFORE")
+                            {
+                                //string V = left ? "R01" : "R03";
+                                //Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                            if ("IN_after" == "IN_after")
+                            {
+                                string V = left ? "M2" : "M3";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                            if ("out_after" == "out_after")
+                            {
+                                string V = left ? "M6" : "M7";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                        }
+                    }
+                }
+            }
+            if ("鏀捐揣鐢宠" != "")
+            {
+                var device1 = Settings.deviceInfos.Find(x => x.location.Contains(task.S_END_LOC));
+                if (device1 != null)
+                {
+                    var left = device1.location.ToList().FindIndex(x => x == task.S_END_LOC) == 0;
+                    if (device1.deviceType == 1)
+                    {
+                        if (device1.deviceName.Contains("缁村笇灏旀姄鑷�))
+                        {
+                            if ("IN_BEFORE" == "IN_BEFORE" || "out_BEFORE" == "out_BEFORE")
+                            {
+                                string V = left ? "R01" : "R03";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                            if ("IN_after" == "IN_after" || "out_after" == "out_after")
+                            {
+                                string V = left ? "R02" : "R04";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                        }
+                        else if (device1.deviceName.Contains("Js鎹烽『"))
+                        {
+                            if ("IN_BEFORE" == "IN_BEFORE")
+                            {
+                                string V = left ? "M0" : "M1";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                            if ("out_BEFORE" == "out_BEFORE")
+                            {
+                                string V = left ? "M4" : "M5";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                            if ("IN_after" == "IN_after")
+                            {
+                                string V = left ? "M2" : "M3";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                            if ("out_after" == "out_after")
+                            {
+                                string V = left ? "M6" : "M7";
+                                Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue");
+                            }
+                        }
+                    }
+                }
+            }
+            #endregion [鑷畾涔夋寚浠[20250325100336909][TaskisOk]
+        }
+        public System.Boolean continueTask(System.Object m)
+        {
+            #region    [鑷畾涔夋寚浠[20250325100607380][continueTask]
+            var model = (HaiKangOrderInfo)m;
+            bool result = false;
+            string msg = "";
+            var request = JsonConvert.SerializeObject(model);
+            var response = Settings.apiHelper.Post(Settings.HKbaseUrl + "rcms/services/rest/hikRpcService/continueTask", request);
+            msg = $"[haikang-CancelOrder] request={request};response={response}";
+            Console.WriteLine(msg);
+            if (response != "")
+            {
+                var dataResult = JsonConvert.DeserializeObject<HKResult>(response);
+                if (dataResult.code == "0")
+                {
+                    result = true;
+                }
+            }
+            else
+            {
+                msg = "[haikang-CancelOrder]鑾峰彇浠诲姟鐘舵�澶辫触";
+                Console.WriteLine(msg);
+            }
+            LogHelper.Info(msg, "娴峰悍");
+            return result;
+            #endregion [鑷畾涔夋寚浠[20250325100607380][continueTask]
+        }
+        public System.Boolean CancelOrder(System.Object m)
+        {
+            #region    [鑷畾涔夋寚浠[20250325100705351][CancelOrder]
+            var model = (HaiKangOrderInfo)m;
+            bool result = false;
+            string msg = "";
+            var request = JsonConvert.SerializeObject(model);
+            var response = Settings.apiHelper.Post(Settings.HKbaseUrl + "rcms/services/rest/hikRpcService/continueTask", request);
+            msg = $"[haikang-CancelOrder] request={request};response={response}";
+            Console.WriteLine(msg);
+            if (response != "")
+            {
+                var dataResult = JsonConvert.DeserializeObject<HKResult>(response);
+                if (dataResult.code == "0")
+                {
+                    result = true;
+                }
+            }
+            else
+            {
+                msg = "[haikang-CancelOrder]鍙栨秷璁㈠崟澶辫触";
+                Console.WriteLine(msg);
+            }
+            LogHelper.Info(msg, "娴峰悍");
+            return result;
+            #endregion [鑷畾涔夋寚浠[20250325100705351][CancelOrder]
+        }
+        public System.String GetSerialNumber(System.String snType, System.String prefix)
+        {
+            #region    [鑷畾涔夋寚浠[20250325131530407][GetSerialNumber]
+            int result = 0;
+            return "";
+            #endregion [鑷畾涔夋寚浠[20250325131530407][GetSerialNumber]
+        }
+        #endregion
     }
 }
-else
-{
-    msg = "[haikang-CancelOrder]鑾峰彇浠诲姟鐘舵�澶辫触";
-    Console.WriteLine(msg);
-}
-LogHelper.Info(msg, "娴峰悍");
-return result;
-		#endregion [鑷畾涔夋寚浠[20250325100607380][continueTask]
-}
-public System.Boolean CancelOrder(System.Object m)
-{
-		#region    [鑷畾涔夋寚浠[20250325100705351][CancelOrder]
-var model = (HaiKangOrderInfo)m;
-bool result = false;
-string msg = "";
-var request = JsonConvert.SerializeObject(model);
-var response = Settings.apiHelper.Post(Settings.HKbaseUrl + "rcms/services/rest/hikRpcService/continueTask", request);
-msg = $"[haikang-CancelOrder] request={request};response={response}";
-Console.WriteLine(msg);
-if (response != "") {
-    var dataResult = JsonConvert.DeserializeObject<HKResult>(response);
-    if (dataResult.code == "0") {
-        result = true;
-    }
-}
-else {
-    msg = "[haikang-CancelOrder]鍙栨秷璁㈠崟澶辫触";
-    Console.WriteLine(msg);
-}
-LogHelper.Info(msg, "娴峰悍");
-return result;
-		#endregion [鑷畾涔夋寚浠[20250325100705351][CancelOrder]
-}
-public System.String GetSerialNumber(System.String snType, System.String prefix)
-{
-		#region    [鑷畾涔夋寚浠[20250325131530407][GetSerialNumber]
-int result = 0;
-return "";
-		#endregion [鑷畾涔夋寚浠[20250325131530407][GetSerialNumber]
-}
-		#endregion
-	}
-}
-    
+

--
Gitblit v1.9.1