From 3a3f17f0890d721d97b139f88dde7df5c13ba688 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 06 一月 2025 18:51:21 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   41 ++++++++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 17 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 056a1bc..3dedb60 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"
@@ -32,6 +32,7 @@
 using WIDESEA_Core.Enums;
 using WIDESEA_Core.Helper;
 using WIDESEA_DTO.Inbound;
+using WIDESEA_DTO.MES;
 using WIDESEA_DTO.Stock;
 using WIDESEA_DTO.Task;
 using WIDESEA_External.ERPService;
@@ -108,7 +109,7 @@
                 {
                     x.AGVArea = agvDescription;
                 });
-                string response = HttpHelper.Post("http://127.0.0.1:9291/api/Task/ReceiveTask", taskDTOs.Serialize());
+                string response = HttpHelper.Post("http://127.0.0.1:9281/api/Task/ReceiveTask", taskDTOs.Serialize());
 
                 return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒");
             }
@@ -218,6 +219,15 @@
                         return WebResponseContent.Instance.Error($"鍏ュ簱鍚屾Erp澶辫触");
                     }
                 }
+
+                if ((stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt() || stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt()) && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())
+                {
+                    foreach (var model in stockInfo.Details)
+                    {
+                        TestSynStock(new TestToolSynInfo() { ToolCode = model.BatchNo, Life = int.TryParse(model.Remark, out int val) ? val : 1000 });
+                    }
+                }
+
                 //娴嬭瘯鏋跺叆搴撳簱瀛樼姸鎬�
                 if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt())
                 {
@@ -232,12 +242,14 @@
                 {
                     x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
                 });
+                //鏇存柊浠诲姟鐘舵��
+                task.TaskStatus = (int)TaskStatusEnum.Finish;
                 _unitOfWorkManage.BeginTran();
                 BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚);
                 _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId);
                 _stockRepository.StockInfoRepository.UpdateData(stockInfo);
                 _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details);
-                _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundCompleted);
+                _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted);
                 _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum);
                 if (inboundOrder != null)
                 {
@@ -290,13 +302,13 @@
                 }
                 else
                 {
-                    for (int i = 0; i < outStockLockInfos.Count; i++)
+                    foreach (var item in outStockLockInfos)
                     {
-                        Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == outStockLockInfos[i].OrderDetailId);
+                        Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == item.OrderDetailId);
                         if (outboundOrderDetail != null)
                         {
-                            outboundOrderDetail.OverOutQuantity = outboundOrderDetail.LockQuantity;
-                            if (outboundOrderDetail.LockQuantity == outboundOrderDetail.OrderQuantity)
+                            outboundOrderDetail.OverOutQuantity = item.AssignQuantity;
+                            if (outboundOrderDetail.OverOutQuantity == outboundOrderDetail.OrderQuantity)
                             {
                                 outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
                             }
@@ -305,15 +317,7 @@
                     }
                 }
 
-                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)
                 {
@@ -327,10 +331,13 @@
                 _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId);
                 BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
 
-                _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationChangeType.OutboundCompleted, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
+                _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationStatusEnum.Free, 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