From d0f01f571918ae942349068776fa7fb70f3ab5cd Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期三, 28 八月 2024 16:20:18 +0800
Subject: [PATCH] 更新设备信息表从表导入问题

---
 WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   45 +++++++++++++++++++++------------------------
 1 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 8028059..a479655 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -21,6 +21,7 @@
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using System.Reflection;
 using System.Text;
@@ -69,7 +70,7 @@
         /// </summary>
         /// <param name="taskDTOs">WMS浠诲姟瀵硅薄闆嗗悎</param>
         /// <returns>杩斿洖澶勭悊缁撴灉</returns>
-        public WebResponseContent ReceiveWMSTask(List<WMSTaskDTO> taskDTOs)
+        public WebResponseContent ReceiveWMSTask([NotNull]List<WMSTaskDTO> taskDTOs)
         {
             WebResponseContent content = new WebResponseContent();
             try
@@ -92,7 +93,6 @@
                             task.TaskState = (int)TaskOutStatusEnum.OutNew;
                             task.CurrentAddress = item.SourceAddress;
                             task.NextAddress = routers.FirstOrDefault().ChildPosi;
-
                         }
                     }
                     else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
@@ -106,16 +106,7 @@
                             task.NextAddress = routers.FirstOrDefault().ChildPosi;
                         }
                     }
-                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
-                    {
-
-                    }
-                    else
-                    {
-                        throw new Exception($"鎺ユ敹WMS浠诲姟澶辫触,浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵item.TaskNum}銆�,浠诲姟绫诲瀷:銆恵item.TaskType}銆�");
-                    }
                     tasks.Add(task);
-
                 }
                 BaseDal.AddData(tasks);
 
@@ -159,7 +150,7 @@
 
         public Dt_Task QueryConveyorLineTask(string deviceNo, string currentAddress)
         {
-            return BaseDal.QueryFirst(x => (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew || TaskOutboundTypes.Contains( x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) && x.CurrentAddress == currentAddress, TaskOrderBy);
+            return BaseDal.QueryFirst(x => (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) && x.CurrentAddress == currentAddress, TaskOrderBy);
         }
 
         public Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress)
@@ -285,12 +276,26 @@
             {
                 Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                 if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
+                return UpdateTaskStatusToNext(task);
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            return content;
+        }
+
+        public WebResponseContent UpdateTaskStatusToNext([NotNull] Dt_Task task)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
                 int oldState = task.TaskState;
                 if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                 {
                     if (task.TaskState >= (int)TaskOutStatusEnum.OutFinish)
                     {
-                        return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
+                        return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
                     }
 
                     int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
@@ -301,7 +306,7 @@
                 {
                     if (task.TaskState >= (int)TaskInStatusEnum.InFinish)
                     {
-                        return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
+                        return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
                     }
 
                     int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
@@ -315,22 +320,14 @@
                         task.TargetAddress = task.NextAddress;
                     }
                 }
-                else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
-                {
-                    //todo 璋冪敤WMS绉诲簱瀹屾垚
-                }
-                else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OtherGroup)
-                {
-
-                }
                 else
                 {
-                    throw new Exception($"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�");
+                    throw new Exception($"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�");
                 }
 
                 if (task.TaskState <= 0)
                 {
-                    return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
+                    return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
                 }
 
                 task.ModifyDate = DateTime.Now;

--
Gitblit v1.9.3