From c05003c73bbe527478bccc55efe25c19068b6f50 Mon Sep 17 00:00:00 2001 From: Huangxiaoqiang-03 <1247017146@qq.com> Date: 星期三, 23 十月 2024 17:30:42 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 44 insertions(+), 4 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 e0ba81d..d4104dd 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" @@ -60,10 +60,12 @@ private readonly IInboundService _inboundService; private readonly IRecordService _recordService; private readonly IStockService _stockService; + private readonly ITask_HtyService _taskHtyService; + private readonly ILocationInfoService _locationInfoService; public ITaskRepository Repository => BaseDal; - public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IBasicService basicService, IOutboundService outboundService, IInboundService inboundService, IRecordService recordService, IStockService stockService) : base(BaseDal) + public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IBasicService basicService, IOutboundService outboundService, IInboundService inboundService, IRecordService recordService, IStockService stockService, ITask_HtyService taskHtyService, ILocationInfoService locationInfoService) : base(BaseDal) { _mapper = mapper; _unitOfWorkManage = unitOfWorkManage; @@ -72,6 +74,8 @@ _inboundService = inboundService; _recordService = recordService; _stockService = stockService; + _taskHtyService = taskHtyService; + _locationInfoService = locationInfoService; } /// <summary> @@ -108,6 +112,8 @@ public WebResponseContent InboundTaskCompleted(Dt_Task task) { + decimal beforeQuantity = 0; + Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); @@ -117,14 +123,18 @@ stockInfo.LocationCode = locationInfo.LocationCode; stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt(); _stockService.StockInfoService.Repository.UpdateData(stockInfo); + beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity); int beforeStatus = locationInfo.LocationStatus; locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); + _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum); _basicService.LocationInfoService.Repository.UpdateData(locationInfo); + task.TaskStatus = InTaskStatusEnum.InFinish.ObjToInt(); - BaseDal.DeleteData(task); + BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚); _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); + _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, StockChangeType.Inbound); return WebResponseContent.Instance.OK(); } @@ -150,10 +160,11 @@ int beforeStatus = locationInfo.LocationStatus; locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt(); + _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum); _basicService.LocationInfoService.Repository.UpdateData(locationInfo); - - BaseDal.DeleteData(task); + task.TaskStatus = InTaskStatusEnum.InFinish.ObjToInt(); + BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚); _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum); @@ -200,8 +211,10 @@ int beforeStatus = locationInfo.LocationStatus; locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); + _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum); _basicService.LocationInfoService.Repository.UpdateData(locationInfo); + task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt(); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚); _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); @@ -221,13 +234,40 @@ int beforeStatus = locationInfo.LocationStatus; locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); + _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum); _basicService.LocationInfoService.Repository.UpdateData(locationInfo); + task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt(); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚); _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); return WebResponseContent.Instance.OK(); } + + public WebResponseContent RelocationTaskCompleted(Dt_Task task) + { + Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); + + Dt_LocationInfo locationStart = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); + Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); + + CheckCompleted(stockInfo, locationStart); + + stockInfo.LocationCode = locationEnd.LocationCode; + stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt(); + _stockService.StockInfoService.Repository.UpdateData(stockInfo); + + + //locationStart.LocationStatus = LocationStatusEnum.Free.ObjToInt(); + _basicService.LocationInfoService.RelocationFree(locationStart, locationEnd, task.TaskNum); + //_basicService.LocationInfoService.Repository.UpdateData(locationStart); + + task.TaskStatus = InTaskStatusEnum.RelocationFinish.ObjToInt(); + BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚); + + + return WebResponseContent.Instance.OK(); + } } } -- Gitblit v1.9.3