From cb25acc46bf41863e068b6f968f1592b7a14d1c9 Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期六, 13 九月 2025 08:12:14 +0800
Subject: [PATCH] 功能更新优化

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 7ba7bb8..c5fe062 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -1178,5 +1178,53 @@
             }
             return content;
         }
+
+        public WebResponseContent InboundTaskHandCancel(int taskNum, int warehouseId)
+        {
+            try
+            {
+                Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+                if (task == null)
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅");
+                }
+                Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).Includes(x => x.Details).First();
+                if (stockInfo == null)
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺搴旂殑缁勭洏淇℃伅");
+                }
+                if (stockInfo.Details.Count == 0 && stockInfo.PalletType != PalletTypeEnum.Empty.ObjToInt())
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒拌鎵樼洏搴撳瓨鏄庣粏淇℃伅");
+                }
+                if (task.TaskType == TaskTypeEnum.MesPalletLargeReturn.ObjToInt() || task.TaskType == TaskTypeEnum.MesPalletSmallReturn.ObjToInt())
+                {
+                    task.TaskStatus = TaskStatusEnum.Cancel.ObjToInt();
+                    _unitOfWorkManage.BeginTran();
+                    BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐鍒犻櫎 : OperateTypeEnum.鑷姩鍒犻櫎);
+                    _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.鑷姩鍒犻櫎 : OperateTypeEnum.浜哄伐鍒犻櫎);
+                    _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.鑷姩鍒犻櫎 : OperateTypeEnum.浜哄伐鍒犻櫎);
+                    _unitOfWorkManage.CommitTran();
+                    return WebResponseContent.Instance.OK();
+                }
+                Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
+                if (locationInfo != null)
+                {
+                    if (locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
+                    {
+                        return WebResponseContent.Instance.Error($"璐т綅鐘舵�佷笉姝g‘");
+                    }
+
+                    LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus;
+                    locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+                }
+                return WebResponseContent.Instance.OK();
+                
+            }
+            catch(Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
     }
 }

--
Gitblit v1.9.3