From 636a0e56fb705177dbd043a90e47c4b8be20f8fc Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 24 十二月 2024 10:01:30 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 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 284909e..008afe2 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"
@@ -33,6 +33,7 @@
 using WIDESEA_DTO.Inbound;
 using WIDESEA_DTO.Stock;
 using WIDESEA_DTO.Task;
+using WIDESEA_External.ERPService;
 using WIDESEA_IBasicRepository;
 using WIDESEA_IBasicService;
 using WIDESEA_IInboundService;
@@ -58,6 +59,8 @@
         private readonly IOutboundService _outboundService;
         private readonly IStockService _stockService;
         private readonly IBasicRepository _basicRepository;
+        private readonly IApiInfoRepository _apiInfoRepository;
+        private readonly IInvokeERPService _invokeERPService;
 
         public ITaskRepository Repository => BaseDal;
 
@@ -71,7 +74,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) : 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) : base(BaseDal)
         {
             _mapper = mapper;
             _unitOfWorkManage = unitOfWorkManage;
@@ -81,19 +84,23 @@
             _outboundService = outboundService;
             _stockService = stockService;
             _basicRepository = basicRepository;
+            _apiInfoRepository = apiInfoRepository;
+            _invokeERPService = invokeERPService;
         }
 
         /// <summary>
         /// 浠诲姟淇℃伅鎺ㄩ�佽嚦WCS
         /// </summary>
         /// <returns></returns>
-        public WebResponseContent PushTasksToWCS()
+        public WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription="")
         {
             try
             {
-                List<Dt_Task> tasks = BaseDal.QueryData(x => (TaskTypes.Contains(x.TaskType) && x.TaskStatus == (int)TaskStatusEnum.New));
                 List<WMSTaskDTO> taskDTOs = _mapper.Map<List<WMSTaskDTO>>(tasks);
-
+                taskDTOs.ForEach(x =>
+                {
+                    x.AGVArea = agvDescription;
+                });
                 string response = HttpHelper.Post("http://127.0.0.1:9291/api/Task/ReceiveTask", taskDTOs.Serialize());
 
                 return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒");
@@ -155,9 +162,13 @@
                 locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
 
                 //娴嬭瘯鏋跺叆搴撳簱瀛樼姸鎬�
-                if (task.TaskType == TaskTypeEnum.TestInbound.ObjToInt())
+                if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                 {
                     stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚鏈缓鍑哄簱鍗�.ObjToInt();
+                    stockInfo.Details.ForEach(x =>
+                    {
+                        x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                    });
                 }
                 else
                 {
@@ -171,7 +182,7 @@
                 _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
 
                 _stockRepository.StockInfoRepository.UpdateData(stockInfo);
-
+                _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);
                 _unitOfWorkManage.CommitTran();

--
Gitblit v1.9.3