From e47120b1aec14296f84fd246af76675f4c2765a0 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 29 一月 2026 09:40:20 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/RuiShengZhiNeng/GaoPuLiTiKu

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |  144 ++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 134 insertions(+), 10 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 1a48cda..1179514 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"
@@ -18,12 +18,16 @@
 using AutoMapper;
 using SqlSugar;
 using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
+using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseRepository;
 using WIDESEAWCS_Core.BaseServices;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_DTO.TaskInfo;
+using WIDESEAWCS_DTO.WMS;
+using WIDESEAWCS_IBasicInfoService;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob.Models;
@@ -35,6 +39,9 @@
     {
         private readonly IRouterService _routerService;
         private readonly ITaskExecuteDetailService _taskExecuteDetailService;
+        private readonly IHKLocationInfoService _hKLocationInfoService;
+        private readonly IKLSLocationInfoService _kLSLocationInfoService;
+        private readonly IRGVLocationInfoService _rGVLocationInfoService;
         private readonly IRepository<Dt_TaskExecuteDetail> _taskExecuteDetailRepository;
         private readonly IMapper _mapper;
 
@@ -55,12 +62,15 @@
         /// </summary>
         public IRepository<Dt_Task> Repository => BaseDal;
 
-        public TaskService(IRepository<Dt_Task> BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_TaskExecuteDetail> taskExecuteDetailRepository, IMapper mapper) : base(BaseDal)
+        public TaskService(IRepository<Dt_Task> BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_TaskExecuteDetail> taskExecuteDetailRepository, IMapper mapper, IKLSLocationInfoService kLSLocationInfoService, IRGVLocationInfoService rGVLocationInfoService, IHKLocationInfoService hKLocationInfoService) : base(BaseDal)
         {
             _routerService = routerService;
             _taskExecuteDetailService = taskExecuteDetailService;
             _taskExecuteDetailRepository = taskExecuteDetailRepository;
             _mapper = mapper;
+            _kLSLocationInfoService = kLSLocationInfoService;
+            _rGVLocationInfoService = rGVLocationInfoService;
+            _hKLocationInfoService = hKLocationInfoService;
         }
         public WebResponseContent ReceiveWMSTask([NotNull] List<WMSTasksDTO> taskDTOs)
         {
@@ -69,17 +79,36 @@
             {
                 foreach (var item in taskDTOs)
                 {
-                    if (item.taskType == TaskTypeEnum.MLInbound.ObjToInt())
+                    foreach (var task in item.tasks)
                     {
-                        foreach (var task in item.tasks)
+                        content = TaskHelpMethods.isOkTaskInfo(task, true, true);
+                        if (!content.Status) throw new Exception(content.Message);
+                        if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode || x.PalletCode == task.containerCode) != null)
                         {
-                            content = TaskHelpMethods.isOkTaskInfo(task, true, true);
-                            if (!content.Status) throw new Exception(content.Message);
-                            if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode || x.PalletCode == task.containerCode) != null)
-                            {
-                                continue;
-                            }
-                            CreateNewInTask(task);
+                            continue;
+                        }
+                        switch (item.taskType)
+                        {
+                            case (int)TaskTypeEnum.MLInbound:
+                                CreateKLSNewInTask(task, item.taskType);
+                                break;
+                            case (int)TaskTypeEnum.MLOutbound:
+                                CreateKLSNewOutTask(task, item.taskType);
+                                break;
+                            case (int)TaskTypeEnum.CPInbound:
+                                CreateRGVNewInTask(task, item.taskType);
+                                break;
+                            case (int)TaskTypeEnum.CPOutbound:
+                                CreateRGVNewOutTask(task, item.taskType);
+                                break;
+                            case (int)TaskTypeEnum.CJInbound:
+                                CreateHKNewInTask(task, item.taskType);
+                                break;
+                            case (int)TaskTypeEnum.CJOutbound:
+                                CreateHKNewOutTask(task, item.taskType);
+                                break;
+                            default:
+                                break;
                         }
                     }
                 }
@@ -90,6 +119,92 @@
             }
             return content;
         }
+
+        /// <summary>
+        /// 鍙栨秷浠诲姟
+        /// </summary>
+        /// <param name="taskCode">浠诲姟鍙�</param>
+        /// <param name="containerCode">鏂欑鏉$爜</param>
+        /// <returns></returns>
+        public WebResponseContent CancelWMSTask(WMSCancelTask wMSCancelTask)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                Dt_Task dt_Task = BaseDal.QueryFirst(x => x.WMSTaskNum == wMSCancelTask.TaskCode);
+                if (dt_Task == null) throw new Exception("鏈煡璇㈠埌浠诲姟鍙风浉鍏充换鍔�");
+                if (dt_Task.TaskType == TaskTypeEnum.MLInbound.ObjToInt() || dt_Task.TaskType == TaskTypeEnum.CPInbound.ObjToInt() || dt_Task.TaskType == TaskTypeEnum.CJInbound.ObjToInt())
+                    dt_Task.TaskType = TaskInStatusEnum.InCancel.ObjToInt();
+                else if (dt_Task.TaskType == TaskTypeEnum.MLOutbound.ObjToInt() || dt_Task.TaskType == TaskTypeEnum.CPOutbound.ObjToInt() || dt_Task.TaskType == TaskTypeEnum.CJOutbound.ObjToInt())
+                    dt_Task.TaskType = TaskOutStatusEnum.OutCancel.ObjToInt();
+                BaseDal.UpdateData(dt_Task);
+                content.OK();
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+
+
+        /// <summary>
+        /// 淇敼浠诲姟浼樺厛绾�
+        /// </summary>
+        /// <param name="updateTaskPriority"></param>
+        /// <returns></returns>
+        public WebResponseContent UpdateWMSTaskPriority(WMSUpdateTaskPriority updateTaskPriority)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                Dt_Task dt_Task = BaseDal.QueryFirst(x => x.WMSTaskNum == updateTaskPriority.taskCode);
+                if (dt_Task == null) throw new Exception("鏈煡璇㈠埌浠诲姟鍙风浉鍏充换鍔�");
+                dt_Task.Grade = updateTaskPriority.taskPriority;
+                BaseDal.UpdateData(dt_Task);
+                content.OK();
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+
+        /// <summary>
+        /// 淇敼搴撲綅鍒嗗尯
+        /// </summary>
+        /// <returns></returns>
+        public WebResponseContent ModifyWMSLayoutZone(WMSUpdateLocationArea wMSUpdateLocationArea)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                if(wMSUpdateLocationArea.WarehouseId == 1)
+                {
+                    foreach (var LocationCode in wMSUpdateLocationArea.LocationCodes)
+                    {
+                        Dt_RGVLocationInfo dt_RGVLocationInfo = _rGVLocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
+                        UpdateLocationCode(dt_RGVLocationInfo,wMSUpdateLocationArea.UpdateAreaCode);
+
+                    }
+                }
+                
+                content.OK();
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+
+        private void UpdateLocationCode(object LocationInfo, string updateAreaCode)
+        {
+           
+        }
+
+
         /// <summary>
         /// 鎺ユ敹WMS浠诲姟淇℃伅
         /// </summary>
@@ -618,5 +733,14 @@
             }
             return content;
         }
+
+        static object lock_taskNum = new object();
+        public int GetTaskNum(string sequenceName)
+        {
+            lock (lock_taskNum)
+            {
+                return Db.Ado.GetScalar($"SELECT NEXT VALUE FOR {sequenceName}").ObjToInt();
+            }
+        }
     }
 }

--
Gitblit v1.9.3