From 96a77e69b0577c50adfaacd5fd8b89009242d3bd Mon Sep 17 00:00:00 2001
From: Admin <Admin@ADMIN>
Date: 星期日, 07 十二月 2025 18:25:00 +0800
Subject: [PATCH] 更新

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   71 +++++++++++------------------------
 1 files changed, 23 insertions(+), 48 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 6a7a5e1..aa44c09 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -171,12 +171,10 @@
                         task.TaskState = (int)TaskInStatusEnum.Line_InFinish;
                         task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02";
                         BaseDal.AddData(task);
-                        return content;
+                        return content.OK("鎴愬姛鍏ュ簱鐢宠wms");
                     }
                 }
-
-                
-                return content = WebResponseContent.Instance.Error();
+                return content;
             }
             catch (Exception ex)
             {
@@ -244,11 +242,11 @@
                         WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"绌烘墭鍑哄簱澶辫触锛岃鎯咃細{content.Message}", "闇�瑕佺┖鎵�");
                     }
                 }
-                return content = WebResponseContent.Instance.Error();
+                return content;
             }
             catch (Exception ex)
             {
-                return content = WebResponseContent.Instance.Error(ex.Message);
+                return content.Error(ex.Message);
             }
         }
 
@@ -598,19 +596,6 @@
             {
                 Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                 if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
-
-                if(task.TaskType == (int)TaskRelocationTypeEnum.Relocation)
-                {
-                    if (task.TaskState != (int)TaskOutStatusEnum.ResRestNet)
-                    {
-                        return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
-                    }
-                    task.TaskState = (int)TaskOutStatusEnum.ResRest;    //涓嬪彂绉诲簱浠诲姟
-                    task.ModifyDate = DateTime.Now;
-                    task.Modifier = "System";
-                    BaseDal.UpdateData(task);
-                }
-
                 return UpdateTaskStatusToNext(task);
             }
             catch (Exception ex)
@@ -638,13 +623,10 @@
                         return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
                     }
 
-                    int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
+                    //int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
 
-                    task.TaskState = nextStatus;
-                    if (task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting)
-                    {
-                        task.Dispatchertime = DateTime.Now;
-                    }
+                    task.TaskState = (int)TaskOutStatusEnum.SC_OutExecuting;
+                    task.Dispatchertime = DateTime.Now;
                 }
                 else if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
                 {
@@ -653,34 +635,17 @@
                         return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
                     }
 
-                    int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
-                    task.TaskState = nextStatus;
-                    if (task.TaskState == (int)TaskInStatusEnum.SC_InExecuting)
-                    {
-                        task.Dispatchertime = DateTime.Now;
-                    }
-                    if (task.TaskState == (int)TaskRelocationTypeEnum.Relocation)
-                    {
-                        Random random = new Random();
-                        task.CurrentAddress = task.NextAddress;
-                        task.NextAddress = $"{random.Next(1, 100).ToString().PadLeft(3, '0')}-{random.Next(1, 100).ToString().PadLeft(3, '0')}-{random.Next(1, 100).ToString().PadLeft(3, '0')}";
-                        task.TargetAddress = task.NextAddress;
-                    }
+                    //int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
+                    task.TaskState = (int)TaskInStatusEnum.SC_InExecuting;
+                    task.Dispatchertime = DateTime.Now;
                 }
-                else if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
+                else if (task.TaskType == (int)TaskRelocationTypeEnum.Relocation)
                 {
-                    if (task.TaskState <= (int)TaskRelocationStatusEnum.SC_RelocationFinish)
+                    if (task.TaskState != (int)TaskOutStatusEnum.ResRestNet)
                     {
-                        
                         return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
                     }
-
-                    int nextStatus = (int)TaskRelocationStatusEnum.SC_RelocationExecuting;
-                    task.TaskState = nextStatus;
-                    if (task.TaskState == (int)TaskRelocationStatusEnum.SC_RelocationExecuting)
-                    {
-                        task.Dispatchertime = DateTime.Now;
-                    }
+                    task.TaskState = (int)TaskOutStatusEnum.ResRest;    //涓嬪彂绉诲簱浠诲姟
                 }
                 else
                 {
@@ -986,6 +951,16 @@
             }
         }
 
+        public bool ObtainOutTaskInfo()
+        {
+            Dt_Task task = BaseDal.QueryData(x => x.Roadway == "SC01" && x.TargetAddress == "R01-002-044-001-01").FirstOrDefault();
+            if (task != null)
+            {
+                return true;
+            }
+            return false;
+        }
+
         public WebResponseContent ReceiveWCSTask(int tasknum)
         {
             Dt_Task tasks = BaseDal.QueryFirst(x => x.TaskNum == tasknum);

--
Gitblit v1.9.3