From ae9517420d848e215a9eb807270d5ef6fbe92ae9 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 09 二月 2026 09:43:44 +0800
Subject: [PATCH] 添加 CreateTaskDto 和任务创建存根

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index 408a9cb..48ec9bb 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -20,6 +20,7 @@
 using WIDESEA_Common.TaskEnum;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
+using WIDESEA_DTO.Task;
 using WIDESEA_IBasicService;
 using WIDESEA_IInboundService;
 using WIDESEA_IOutboundService;
@@ -53,5 +54,48 @@
             _unitOfWorkManage = unitOfWorkManage;
         }
 
+        /// <summary>
+        /// 鍒涘缓浠诲姟锛堢粍鐩樺叆搴撲换鍔°�佺┖鎵樼洏鍥炲簱浠诲姟锛�
+        /// </summary>
+        /// <param name="palletCode">鎵樼洏鍙�</param>
+        /// <param name="sourceAddress">璧峰鍦板潃</param>
+        /// <param name="targetAddress">鐩爣鍦板潃</param>
+        /// <param name="roadway">宸烽亾鍙�</param>
+        /// <param name="warehouseId">浠撳簱涓婚敭</param>
+        /// <param name="palletType">鎵樼洏绫诲瀷</param>
+        /// <param name="taskType">浠诲姟绫诲瀷</param>
+        /// <returns>鏄惁鎴愬姛</returns>
+        public async Task<Dt_Task?> CreateTaskInboundAsync(CreateTaskDto taskDto)
+        {
+            if (string.IsNullOrWhiteSpace(taskDto.PalletCode) || string.IsNullOrWhiteSpace(taskDto.SourceAddress) || string.IsNullOrWhiteSpace(taskDto.TargetAddress) || string.IsNullOrWhiteSpace(taskDto.Roadway))
+            {
+                return null;
+            }
+
+            if (taskDto.TaskType != TaskTypeEnum.Inbound || taskDto.TaskType != TaskTypeEnum.InEmpty)
+            {
+                return null;
+            }
+
+            var task = new Dt_Task
+            {
+                TaskNum = 0,
+                PalletCode = taskDto.PalletCode,
+                PalletType = taskDto.PalletType,
+                Roadway = taskDto.Roadway,
+                TaskType = taskDto.TaskType.GetHashCode(),
+                TaskStatus = TaskStatusEnum.New.GetHashCode(),
+                SourceAddress = taskDto.SourceAddress,
+                TargetAddress = taskDto.TargetAddress,
+                CurrentAddress = taskDto.SourceAddress,
+                NextAddress = taskDto.TargetAddress,
+                WarehouseId = taskDto.WarehouseId,
+                Grade = 1,
+                Creater = "system"
+            };
+
+            return await Repository.AddDataAsync(task) > 0 ? task : null;
+        }
+
     }
 }

--
Gitblit v1.9.3