From 810fe2bcf1888eacd926f3caa604f033483d20c9 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期三, 30 十月 2024 14:57:33 +0800 Subject: [PATCH] 优化WMS基础管理模块、任务管理添加任务历史信息 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs | 104 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 98 insertions(+), 6 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs" index 51ee5d1..26748a6 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs" @@ -8,6 +8,8 @@ using WIDESEA_Core; using WIDESEA_Model.Models; using WIDESEA_Core.Helper; +using WIDESEAWCS_DTO.WCSInfo; +using System.Transactions; namespace WIDESEA_TaskInfoService { @@ -148,6 +150,96 @@ } /// <summary> + /// 鍫嗗灈鏈虹敵璇峰叆搴擄紒锛侊紒锛侊紒锛侊紒鍏ュ簱鍒嗛厤閫昏緫寰呭畾 + /// </summary> + /// <param name="task"></param> + /// <returns></returns> + public WebResponseContent StackerCraneRequestInbound(ConveyorLineDTO lineDTO) + { + WebResponseContent content = new WebResponseContent().OK(); + try + { + var task = BaseDal.QueryFirst(x => x.PalletCode == lineDTO.Barcode); + if (task == null) throw new Exception($"鏈壘鍒版墭鐩樺彿[{lineDTO.Barcode}]鐨勫叆搴撲换鍔�"); + if (task.TaskStatus != (int)InTaskStatusEnum.Line_InFinish) throw new Exception($"鎵樼洏鍙穂{lineDTO.Barcode}]鐨勫叆搴撲换鍔$姸鎬佷笉鍖归厤"); + + Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(lineDTO.Barcode); + if (stockInfo == null) throw new Exception($"鏈壘鍒版墭鐩榌{lineDTO.Barcode}]鐨勭粍鐩樹俊鎭�"); + if (stockInfo.StockStatus != StockStatusEmun.鍏ュ簱纭.ObjToInt()) throw new Exception($"鎵樼洏[{lineDTO.Barcode}],璇ョ粍鐩樼姸鎬佷笉鍙叆搴�"); + Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(lineDTO.stationCode, TaskTypeEnum.Inbound.ObjToInt()); + if (locationInfo == null) throw new Exception($"鏃犲彲鍏ヨ揣浣�"); + locationInfo.LocationStatus = LocationStatusEnum.Inbounding.ObjToInt(); + stockInfo.StockStatus = StockStatusEmun.鍏ュ簱涓�.ObjToInt(); + using (TransactionScope scope = new TransactionScope()) + { + _basicService.LocationInfoService.Repository.UpdateData(locationInfo); + _stockService.StockInfoService.Repository.UpdateData(stockInfo); + scope.Complete(); + } + content.Data = new ReceiveWMSInfo() + { + TargetAddress = locationInfo.LocationCode, + IsPickPlace = locationInfo.MaxQty - locationInfo.CurrentQty == 1, + }; + } + catch (Exception ex) + { + content.Error(ex.Message); + } + return content; + } + /// <summary> + /// 杈撻�佺嚎鐢宠鍏ュ簱 + /// </summary> + /// <param name="lineDTO"></param> + /// <returns></returns> + public WebResponseContent ConveyorLineRequestInbound(ConveyorLineDTO lineDTO) + { + WebResponseContent content = new WebResponseContent().OK(); + try + { + var task = BaseDal.QueryFirst(x => x.PalletCode == lineDTO.Barcode); + if (task == null) throw new Exception($"鏈壘鍒版墭鐩樺彿[{lineDTO.Barcode}]鐨勫叆搴撲换鍔�"); + if (task.TaskStatus != (int)InTaskStatusEnum.AGV_InFinish) throw new Exception($"鎵樼洏鍙穂{lineDTO.Barcode}]鐨勫叆搴撲换鍔$姸鎬佷笉鍖归厤"); + + Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(lineDTO.Barcode); + (bool, string) result = CheckRequestInbound(lineDTO.stationCode, lineDTO.Barcode, true, stockInfo); + if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); + + if (lineDTO.Spec != 1 || lineDTO.Weight != 500)//鏉′欢闇�鏇存敼锛侊紒锛侊紒锛侊紒锛侊紒锛侊紒 + { + task.NextAddress = "101"; + task.TaskStatus = (int)InTaskStatusEnum.InException; + task.Remark = $"鎵樼洏[{lineDTO.Barcode}]淇℃伅涓嶅悎鏍�"; + stockInfo.StockStatus = StockStatusEmun.鍏ュ簱鎾ら攢.ObjToInt(); + } + else + { + task.NextAddress = "104"; + task.CurrentAddress = lineDTO.stationCode; + task.TaskStatus = (int)InTaskStatusEnum.Line_InExecuting; + stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); + } + + #region 浜嬪姟 + using (TransactionScope scope = new TransactionScope()) + { + BaseDal.UpdateData(task); + Db.Updateable(stockInfo); + scope.Complete(); + } + #endregion + + if (!string.IsNullOrEmpty(task.Remark)) throw new Exception(task.Remark); + } + catch (Exception ex) + { + content.Code = 404; + content.Error(ex.Message); + } + return content; + } + /// <summary> /// 楠岃瘉鏁版嵁 /// </summary> /// <param name="stationCode">璧峰鍦板潃</param> @@ -157,13 +249,13 @@ /// <returns>杩斿洖澶勭悊缁撴灉</returns> private (bool, string) CheckRequestInbound(string stationCode, string palletCode, bool isCheckStock = true, Dt_StockInfo? stockInfo = null) { - if (BaseDal.QueryFirst(x => x.PalletCode == palletCode) != null) + //if (BaseDal.QueryFirst(x => x.PalletCode == palletCode) != null) + //{ + // return (false, "璇ユ墭鐩樺彿宸叉湁浠诲姟"); + //} + if (BaseDal.QueryFirst(x => (x.SourceAddress == stationCode || x.CurrentAddress == stationCode) && x.TaskStatus == InTaskStatusEnum.AGV_InFinish.ObjToInt()) != null) { - return (false, "璇ユ墭鐩樺彿宸叉湁浠诲姟"); - } - if (BaseDal.QueryFirst(x => (x.SourceAddress == stationCode || x.CurrentAddress == stationCode) && x.TaskStatus == InTaskStatusEnum.InNew.ObjToInt()) != null) - { - return (false, "褰撳墠鍏ュ簱绔欏彴宸叉湁涓�鏉℃柊寤轰换鍔�"); + return (false, "褰撳墠鍏ュ簱绔欏彴宸叉湁涓�鏉′换鍔�"); } if (isCheckStock) { -- Gitblit v1.9.3