From 551cabeb6da6eac58b8ee280101f708e06b42316 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 02 一月 2025 09:43:16 +0800
Subject: [PATCH] PDA

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   51 ++++++++++++++++++++++++++-------------------------
 1 files changed, 26 insertions(+), 25 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 bdf4c84..8700f6f 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"
@@ -163,7 +163,7 @@
                 LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus;
                 locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
                 Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId);
-                
+
                 stockInfo.LocationCode = locationInfo.LocationCode;
                 Dt_InboundOrder? inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x => x.Details).First();
                 List<Dt_InboundOrderDetail> inboundOrderDetails = new List<Dt_InboundOrderDetail>();
@@ -176,7 +176,7 @@
                     }
 
                     List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>();
-                    
+
                     foreach (var item in stockInfo.Details)
                     {
                         Dt_InboundOrderDetail? inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.RowNo == item.InboundOrderRowNo);
@@ -213,13 +213,13 @@
                     {
                         inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
                     }
-                    if (!_inboundOrderService.FeedbackInboundOrder(stockInfo, inboundOrder, detailModels).Status)
+                    if (!_inboundOrderService.FeedbackInboundOrder(stockInfo, inboundOrder, detailModels).Status)//todo 淇敼澶勭悊
                     {
                         return WebResponseContent.Instance.Error($"鍏ュ簱鍚屾Erp澶辫触");
                     }
                 }
                 //娴嬭瘯鏋跺叆搴撳簱瀛樼姸鎬�
-                if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())
+                if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt())
                 {
                     stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚鏈缓鍑哄簱鍗�.ObjToInt();
                 }
@@ -239,8 +239,11 @@
                 _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details);
                 _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundCompleted);
                 _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum);
-                _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetails);
-                _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder);
+                if (inboundOrder != null)
+                {
+                    _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetails);
+                    _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder);
+                }
                 _unitOfWorkManage.CommitTran();
                 return WebResponseContent.Instance.OK();
             }
@@ -279,35 +282,30 @@
                 }
                 Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId);
                 List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.TaskNum == taskNum);
+                List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
 
                 if ((outStockLockInfos == null || outStockLockInfos.Count == 0) && warehouse.WarehouseCode != WarehouseEnum.HA64.ToString())
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撹鎯呬俊鎭�");
                 }
-
-                List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
-                for (int i = 0; i < outStockLockInfos.Count; i++)
+                else
                 {
-                    Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == outStockLockInfos[i].OrderDetailId);
-                    if (outboundOrderDetail != null)
+                    foreach (var item in outStockLockInfos)
                     {
-                        outboundOrderDetail.OverOutQuantity = outboundOrderDetail.LockQuantity;
-                        if (outboundOrderDetail.LockQuantity == outboundOrderDetail.OrderQuantity)
+                        Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == item.OrderDetailId);
+                        if (outboundOrderDetail != null)
                         {
-                            outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+                            outboundOrderDetail.OverOutQuantity = item.AssignQuantity;
+                            if (outboundOrderDetail.OverOutQuantity == outboundOrderDetail.OrderQuantity)
+                            {
+                                outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+                            }
+                            outboundOrderDetails.Add(outboundOrderDetail);
                         }
-                        outboundOrderDetails.Add(outboundOrderDetail);
                     }
                 }
-                if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString())
-                {
-                    //鎺ㄩ�佸嚭搴撳畬鎴�
-                    WebResponseContent webResponse = _outboundService.OutboundOrderService.TestOutUpload(outboundOrderDetails.FirstOrDefault().Id, stockInfo);
-                    if (!webResponse.Status)
-                    {
-                        return webResponse;
-                    }
-                }
+
+                
                 _unitOfWorkManage.BeginTran();
                 if (outboundOrderDetails.Count > 0)
                 {
@@ -324,7 +322,10 @@
                 _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationChangeType.OutboundCompleted, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
                 _unitOfWorkManage.CommitTran();
 
-
+                if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString())
+                {
+                    _outboundService.OutboundOrderService.TestOutUpload(outboundOrderDetails.FirstOrDefault().Id, outStockLockInfos);
+                }
                 return WebResponseContent.Instance.OK();
             }
             catch (Exception ex)

--
Gitblit v1.9.3