From 90a0c4e0ab42a3574cfb6f9fd3b031dac9e7fb0d Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 13 三月 2025 18:04:58 +0800
Subject: [PATCH] 空托出入库

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   53 +++++++++++++++++++++++++++++++++++------------------
 1 files changed, 35 insertions(+), 18 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index bcf6a63..369e09c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -262,7 +262,7 @@
             {
                 Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == WMStask.TaskNum && x.TaskType == WMStask.TaskType);
                 if (task == null) return WebResponseContent.Instance.Error("鏈壘鍒颁换鍔′俊鎭�");
-                if (task.TaskType == (int)TaskTypeEnum.Inbound)
+                if (TaskEnumHelper.GetTaskTypeGroup(task.TaskType) == TaskTypeGroup.InboundGroup)
                 {
                     int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
                     if (WMStask.TaskState != nextStatus) return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佹湁璇�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
@@ -283,7 +283,7 @@
                             break;
                         //case (int)TaskOutStatusEnum.Line_OutFinish:
 
-                            //break;
+                        //break;
                         case (int)TaskOutStatusEnum.OutFinish:
                             UpdateTaskStatusOutFinish(task);
                             break;
@@ -327,7 +327,7 @@
                 }
                 if (Sourcelocation != null)
                 {
-                    Sourcelocation.CurrentQty--;
+                    if (task.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt()) Sourcelocation.CurrentQty--;
                     if (Sourcelocation.CurrentQty == 0)
                     {
                         Sourcelocation.LocationStatus = LocationStatusEnum.Free.ObjToInt();
@@ -336,8 +336,9 @@
                     if (Sourcelocation.Row == 1 && Sourcelocation.LocationStatus == LocationStatusEnum.Free.ObjToInt())
                     {
                         Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.Row == 2 && x.Column == Sourcelocation.Column && x.Layer == Sourcelocation.Layer);
-                        if (locationInfo.CurrentQty == 0 && locationInfo.LocationStatus == LocationStatusEnum.Free.ObjToInt())
+                        if (locationInfo.CurrentQty == 0 /*&& locationInfo.LocationStatus == LocationStatusEnum.Free.ObjToInt()*/)
                         {
+                            locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
                             locationInfo.EnableStatus = EnableStatusEnum.Normal.ObjToInt();
                             _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
                         }
@@ -368,11 +369,11 @@
         {
             try
             {
-                Dt_OutStockLockInfo outStockLockInfo = _outboundService.OutboundStockLockInfoService.Repository.QueryFirst(x => x.TaskNum == task.TaskNum);
+                Dt_OutStockLockInfo? outStockLockInfo = _outboundService.OutboundStockLockInfoService.Repository.QueryFirst(x => x.TaskNum == task.TaskNum);
+                Dt_OutboundOrder? outboundOrder = null;
+                int overCount = 0;
                 if (outStockLockInfo != null)
                 {
-                    Dt_OutboundOrder outboundOrder = null;
-                    int overCount = 0;
                     Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == outStockLockInfo.OrderDetailId);
                     if (outboundOrderDetail != null)
                     {
@@ -387,17 +388,17 @@
                         }
                     }
                     outStockLockInfo.Status = OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
-                    Db.Ado.BeginTran();
-                    if (outboundOrder != null && outboundOrder.Details.Count == overCount)
-                    {
-                        outboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
-                        _outboundService.OutboundOrderService.Repository.DeleteAndMoveIntoHty(outboundOrder, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
-                        _outboundService.OutboundOrderDetailService.Repository.DeleteAndMoveIntoHty(outboundOrder.Details, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
-                    }
-                    BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
-                    _outboundService.OutboundStockLockInfoService.Repository.UpdateData(outStockLockInfo);
-                    Db.Ado.CommitTran();
                 }
+                Db.Ado.BeginTran();
+                if (outboundOrder != null && outboundOrder.Details.Count == overCount)
+                {
+                    outboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+                    _outboundService.OutboundOrderService.Repository.DeleteAndMoveIntoHty(outboundOrder, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+                    _outboundService.OutboundOrderDetailService.Repository.DeleteAndMoveIntoHty(outboundOrder.Details, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+                }
+                BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+                _outboundService.OutboundStockLockInfoService.Repository.UpdateData(outStockLockInfo);
+                Db.Ado.CommitTran();
                 return WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
@@ -467,7 +468,23 @@
 
                 if (stockInfo.StockStatus != StockStatusEmun.鍏ュ簱涓�.ObjToInt()) throw new Exception($"鎵樼洏[{task.PalletCode}],璇ョ粍鐩樼姸鎬佷笉鍙叆搴�");
                 Dt_StockInfoDetail stockInfoDetail = stockInfo.Details.FirstOrDefault(x => x.StockId == stockInfo.Id);
-
+                if (task.TaskType == TaskTypeEnum.PalletInbound.ObjToInt())
+                {
+                    stockInfo.SerialNumber = locationInfo.CurrentQty;
+                    stockInfo.InDate = DateTime.Now;
+                    stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt();
+                    stockInfoDetail.Status = StockStatusEmun.宸插叆搴�.ObjToInt();
+                    locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt();
+                    task.CurrentAddress = task.NextAddress;
+                    task.NextAddress = string.Empty;
+                    Db.Ado.BeginTran();
+                    BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+                    _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
+                    _stockService.StockInfoService.Repository.UpdateData(stockInfo);
+                    _stockService.StockInfoDetailService.Repository.UpdateData(stockInfoDetail);
+                    Db.Ado.CommitTran();
+                    return content;
+                }
                 #region 鍏ュ簱鍗�
                 Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(stockInfoDetail.OrderNo);
                 if (inboundOrder == null || inboundOrder.Details == null) throw new Exception($"鏈壘鍒版墭鐩榌{task.PalletCode}]鐨勫叆搴撳崟鏄庣粏淇℃伅");

--
Gitblit v1.9.3