From 39ee9078d88fd4787437360e7f69ed999aaf0b7b Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 28 十二月 2024 09:14:41 +0800
Subject: [PATCH] 更新代码

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 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 447eda6..607c8f4 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"
@@ -25,6 +25,7 @@
 using WIDESEA_Common.OrderEnum;
 using WIDESEA_Common.StockEnum;
 using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
@@ -36,6 +37,7 @@
 using WIDESEA_External.ERPService;
 using WIDESEA_IBasicRepository;
 using WIDESEA_IBasicService;
+using WIDESEA_IInboundRepository;
 using WIDESEA_IInboundService;
 using WIDESEA_IOutboundRepository;
 using WIDESEA_IOutboundService;
@@ -61,6 +63,7 @@
         private readonly IBasicRepository _basicRepository;
         private readonly IApiInfoRepository _apiInfoRepository;
         private readonly IInvokeERPService _invokeERPService;
+        private readonly IInboundRepository _inboundRepository;
 
         public ITaskRepository Repository => BaseDal;
 
@@ -74,7 +77,7 @@
 
         public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
 
-        public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService) : base(BaseDal)
+        public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService, IInboundRepository inboundRepository) : base(BaseDal)
         {
             _mapper = mapper;
             _unitOfWorkManage = unitOfWorkManage;
@@ -86,6 +89,7 @@
             _basicRepository = basicRepository;
             _apiInfoRepository = apiInfoRepository;
             _invokeERPService = invokeERPService;
+            _inboundRepository = inboundRepository;
         }
 
         /// <summary>
@@ -131,7 +135,7 @@
                     return WebResponseContent.Instance.Error($"浠诲姟绫诲瀷閿欒");
                 }
 
-                Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.Details).First();
+                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($"鏈壘鍒版墭鐩樺搴旂殑缁勭洏淇℃伅");
@@ -142,7 +146,7 @@
                     return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅");
                 }
 
-                if (stockInfo.Details == null || stockInfo.Details.Count == 0)
+                if (stockInfo.Details.Count == 0)
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒拌鎵樼洏搴撳瓨鏄庣粏淇℃伅");
                 }
@@ -160,27 +164,32 @@
 
                 LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus;
                 locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
-
+                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseId== task.WarehouseId);
                 //娴嬭瘯鏋跺叆搴撳簱瀛樼姸鎬�
-                if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
+                if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() && warehouse.WarehouseCode==WarehouseEnum.HA64.ToString())
                 {
                     stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚鏈缓鍑哄簱鍗�.ObjToInt();
-                    stockInfo.Details.ForEach(x =>
-                    {
-                        x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
-                    });
                 }
                 else
                 {
                     stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                    
                 }
+                stockInfo.Details.ForEach(x =>
+                {
+                    x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                });
                 stockInfo.LocationCode = locationInfo.LocationCode;
+                //鎺ㄩ�佸叆搴撳畬鎴愮粰Erp
+                //鑾峰彇鍏ュ簱鍗曟洿鏂板叆搴撳崟
+                //Dt_InboundOrder inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x=>x.InboundOrderNo);
+                if (true)
+                {
 
+                }
                 _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);

--
Gitblit v1.9.3