From 18d2f40bbf40469b033de6f07ca8a8e3bc191132 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期六, 26 四月 2025 19:21:40 +0800 Subject: [PATCH] 优化代码 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" index 369e09c..5bab84e 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" @@ -265,12 +265,12 @@ if (TaskEnumHelper.GetTaskTypeGroup(task.TaskType) == TaskTypeGroup.InboundGroup) { int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>(); - if (WMStask.TaskState != nextStatus) return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佹湁璇�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�"); + //if (WMStask.TaskState != nextStatus) return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佹湁璇�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�"); //task.TaskState = nextStatus; task.TaskState = TaskInStatusEnum.InFinish.ObjToInt(); content = UpdateTaskStatusInFinish(task); } - else if (task.TaskType == (int)TaskTypeEnum.Outbound) + else if (TaskEnumHelper.GetTaskTypeGroup(task.TaskType) == TaskTypeGroup.OutbondGroup) { //int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>(); //if (WMStask.TaskState != nextStatus) return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佹湁璇�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�"); @@ -281,9 +281,14 @@ case (int)TaskOutStatusEnum.SC_OutFinish://鏇存柊璐т綅搴撳瓨淇℃伅 UpdateTaskStatusSC_OutFinish(task); break; - //case (int)TaskOutStatusEnum.Line_OutFinish: - - //break; + case (int)TaskOutStatusEnum.AGV_OutFinish: + { + task.CurrentAddress = WMStask.CurrentAddress; + task.TargetAddress = WMStask.TargetAddress; + task.NextAddress = string.Empty; + UpdateData(task); + } + break; case (int)TaskOutStatusEnum.OutFinish: UpdateTaskStatusOutFinish(task); break; @@ -327,9 +332,11 @@ } if (Sourcelocation != null) { - if (task.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt()) Sourcelocation.CurrentQty--; - if (Sourcelocation.CurrentQty == 0) + /*if (task.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt())*/ + Sourcelocation.CurrentQty--; + if (Sourcelocation.CurrentQty <= 0 && Sourcelocation.Row != 2) { + Sourcelocation.CurrentQty = 0; Sourcelocation.LocationStatus = LocationStatusEnum.Free.ObjToInt(); Sourcelocation.EnableStatus = EnableStatusEnum.Normal.ObjToInt(); } @@ -397,7 +404,7 @@ _outboundService.OutboundOrderDetailService.Repository.DeleteAndMoveIntoHty(outboundOrder.Details, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚); } BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚); - _outboundService.OutboundStockLockInfoService.Repository.UpdateData(outStockLockInfo); + if (outStockLockInfo != null) _outboundService.OutboundStockLockInfoService.Repository.UpdateData(outStockLockInfo); Db.Ado.CommitTran(); return WebResponseContent.Instance.OK(); } @@ -468,9 +475,11 @@ if (stockInfo.StockStatus != StockStatusEmun.鍏ュ簱涓�.ObjToInt()) throw new Exception($"鎵樼洏[{task.PalletCode}],璇ョ粍鐩樼姸鎬佷笉鍙叆搴�"); Dt_StockInfoDetail stockInfoDetail = stockInfo.Details.FirstOrDefault(x => x.StockId == stockInfo.Id); + + List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.Repository.LocationCodesGetStockInfos(new List<string> { stockInfo.LocationCode }).Where(x => x.StockStatus == StockStatusEmun.宸插叆搴�.ObjToInt()).ToList(); if (task.TaskType == TaskTypeEnum.PalletInbound.ObjToInt()) { - stockInfo.SerialNumber = locationInfo.CurrentQty; + stockInfo.SerialNumber = stockInfos.Count + 1; stockInfo.InDate = DateTime.Now; stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt(); stockInfoDetail.Status = StockStatusEmun.宸插叆搴�.ObjToInt(); @@ -487,9 +496,9 @@ } #region 鍏ュ簱鍗� Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(stockInfoDetail.OrderNo); - if (inboundOrder == null || inboundOrder.Details == null) throw new Exception($"鏈壘鍒版墭鐩榌{task.PalletCode}]鐨勫叆搴撳崟鏄庣粏淇℃伅"); + if (inboundOrder == null || inboundOrder.Details.Count < 1) throw new Exception($"鏈壘鍒版墭鐩榌{task.PalletCode}]鐨勫叆搴撳崟鏄庣粏淇℃伅"); Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfoDetail.BatchNo && x.MaterielCode == stockInfoDetail.MaterielCode); - inboundOrderDetail.OverInQuantity++; + //inboundOrderDetail.OverInQuantity++; inboundOrderDetail.OrderDetailStatus = inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity ? OrderDetailStatusEnum.Over.ObjToInt() : OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); if (inboundOrder.Details.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) == null) @@ -501,8 +510,6 @@ inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱涓�.ObjToInt(); } #endregion - - List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.Repository.LocationCodesGetStockInfos(new List<string> { stockInfo.LocationCode }).Where(x => x.StockStatus == StockStatusEmun.宸插叆搴�.ObjToInt()).ToList(); stockInfo.SerialNumber = stockInfos.Count + 1; stockInfo.InDate = DateTime.Now; stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt(); @@ -521,8 +528,10 @@ } else { + List<Dt_InboundOrderDetail> orderDetails = inboundOrder.Details; + inboundOrder.Details = null; _inboundService.InbounOrderService.Repository.DeleteAndMoveIntoHty(inboundOrder, OperateType.鑷姩瀹屾垚); - _inboundService.InboundOrderDetailService.Repository.DeleteAndMoveIntoHty(inboundOrder.Details, OperateType.鑷姩瀹屾垚); + _inboundService.InboundOrderDetailService.Repository.DeleteAndMoveIntoHty(orderDetails, OperateType.鑷姩瀹屾垚); } #endregion _basicService.LocationInfoService.Repository.UpdateData(locationInfo); -- Gitblit v1.9.3