From 18d1f45193e34e00fc1b6f65b8596ddb29c5267d Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期二, 24 十二月 2024 15:32:43 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 36 ++++++++++++++++++++++++------------ 1 files changed, 24 insertions(+), 12 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 6a05e7a..bc617ce 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; @@ -57,6 +58,9 @@ private readonly IRecordService _recordService; private readonly IOutboundService _outboundService; private readonly IStockService _stockService; + private readonly IBasicRepository _basicRepository; + private readonly IApiInfoRepository _apiInfoRepository; + private readonly IInvokeERPService _invokeERPService; public ITaskRepository Repository => BaseDal; @@ -66,11 +70,11 @@ {nameof(Dt_Task.CreateDate),OrderByType.Asc}, }; - public List<int> TaskInboundTypes => typeof(TaskInboundTypeEnum).GetEnumIndexList(); + public List<int> TaskTypes => typeof(TaskTypeEnum).GetEnumIndexList(); - public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList(); + 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) : 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; @@ -79,20 +83,24 @@ _recordService = recordService; _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 => (TaskInboundTypes.Contains(x.TaskType) && x.TaskStatus == (int)TaskInStatusEnum.InNew || TaskOutboundTypes.Contains(x.TaskType) && x.TaskStatus == (int)TaskOutStatusEnum.OutNew)); - 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("杩斿洖閿欒"); @@ -118,7 +126,7 @@ return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅"); } - if (task.TaskType != TaskInboundTypeEnum.Inbound.ObjToInt()) + if (task.TaskType != TaskTypeEnum.Inbound.ObjToInt()) { return WebResponseContent.Instance.Error($"浠诲姟绫诲瀷閿欒"); } @@ -154,9 +162,13 @@ locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); //娴嬭瘯鏋跺叆搴撳簱瀛樼姸鎬� - if (task.TaskType == TaskInboundTypeEnum.TestInbound.ObjToInt()) + if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) { stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚鏈缓鍑哄簱鍗�.ObjToInt(); + stockInfo.Details.ForEach(x => + { + x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(); + }); } else { @@ -167,10 +179,10 @@ _unitOfWorkManage.BeginTran(); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚); - _basicService.LocationInfoService.Repository.UpdateData(locationInfo); + _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.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum); _unitOfWorkManage.CommitTran(); @@ -240,7 +252,7 @@ int beforeStatus = locationInfo.LocationStatus; locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); - _basicService.LocationInfoService.Repository.UpdateData(locationInfo); + _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); -- Gitblit v1.9.3