From 1c696f3e12ddcb136e772f9d83eb906760766b96 Mon Sep 17 00:00:00 2001 From: huanghongfeng <huanghongfeng@hnkhzn.com> Date: 星期二, 03 十二月 2024 21:37:58 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs | 102 +++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 91 insertions(+), 11 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs" index 7a886a0..a41b3b6 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs" @@ -452,6 +452,7 @@ Creater = "WMS", CreateDate = DateTime.Now, TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), + MaterialType = dt_StockInfo.MaterialType }; _unitOfWorkManage.BeginTran(); if (locationInfos.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) @@ -510,10 +511,10 @@ { RoadwayNo = "2"; } - Dt_LocationInfo locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.RoadwayNo == RoadwayNo && x.Depth==1 && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt()); + Dt_LocationInfo locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.RoadwayNo == RoadwayNo && x.EnableStatus != (int)EnableStatusEnum.Disable && x.Depth==1 && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt()); if(locationInfos == null) { - locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.RoadwayNo == RoadwayNo && x.Depth == 2 && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt()); + locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.RoadwayNo == RoadwayNo && x.Depth == 2 && x.EnableStatus != (int)EnableStatusEnum.Disable && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt()); } if (locationInfos != null) @@ -543,6 +544,7 @@ Depth = locationInfos.Depth, CreateDate = DateTime.Now, PalletCodequantity = (int)dt_StockInfo.Materialweight, + MaterialType = dt_StockInfo.MaterialType }; _unitOfWorkManage.BeginTran(); @@ -623,6 +625,7 @@ CreateDate = DateTime.Now, PalletCodequantity = (int)dt_StockInfo[i].Materialweight, PLCTo = generate.TargetAddress == "R01-002-041-011-01" ? 1 : 2, + MaterialType = dt_StockInfo[i].MaterialType }; _unitOfWorkManage.BeginTran(); @@ -669,7 +672,7 @@ for (int i = 0; i < saveModel.DelKeys.Count; i++) { Dt_StockInfo stockt = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == saveModel.DelKeys[i].ToString()); - if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴�) + if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴� && (stockt.Wlstatus == (int)InventoryMaterialStatus.鍚堟牸 || stockt.Wlstatus == (int)InventoryMaterialStatus.杩斿伐)) { if(stockt.MaterialType != (int)InventoryMaterialType.鍘熸潗鏂�) { @@ -712,6 +715,7 @@ Creater = "WMS", Depth = locationinfo.Depth, CreateDate = DateTime.Now, + MaterialType= stockt.MaterialType }; dtstockt.Add(stockt); locations.Add(locationinfo); @@ -723,17 +727,17 @@ } else { - return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屽彧鍙嚭搴�1宸烽亾鐨勬墭鐩樺拰鎴愬搧"); + return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屽彧鍙嚭搴�1宸烽亾鐨勬墭鐩樺拰鎴愬搧锛屽嚭搴撴潯鐮侊細{saveModel.DelKeys[i].ToString()}"); } } else { - return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃涓嶈閫夋嫨鍘熸潗鏂欏嚭搴�"); + return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃涓嶈閫夋嫨鍘熸潗鏂欏嚭搴擄紝鍑哄簱鏉$爜锛歿saveModel.DelKeys[i].ToString()}"); } } else { - return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃閫夋嫨宸插叆搴撶殑搴撳瓨淇℃伅杩涜鍑哄簱"); + return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃閫夋嫨宸插叆搴撲笖鍚堟牸鐨勭墿鏂欏嚭搴擄紒锛侊紒锛屽嚭搴撴潯鐮侊細{saveModel.DelKeys[i].ToString()}"); } } @@ -783,7 +787,7 @@ Dt_StockInfo stockt = stocktData.FirstOrDefault(x => x.PalletCode == palletCode); if (stockt !=null) { - if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴�) + if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴� && (stockt.Wlstatus == (int)InventoryMaterialStatus.鍚堟牸 || stockt.Wlstatus == (int)InventoryMaterialStatus.閫�璐� || stockt.Wlstatus == (int)InventoryMaterialStatus.鐗归噰)) { Dt_StockInfoDetail stocktdetail = StockInfoDetailData.FirstOrDefault(x => x.StockId == stockt.Id); if(stocktdetail != null) @@ -796,6 +800,21 @@ { locationinfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); } + + string TargetAdd = ""; + if (saveModel.DelKeys[1].ToString()=="20") + { + TargetAdd = "R02-001-010-001-02"; + }else if(saveModel.DelKeys[1].ToString() == "30") + { + TargetAdd = "R02-001-011-001-02"; + } + else + { + TargetAdd = locationinfo.RoadwayNo == "2" ? "R02-002-027-011-01" : "R01-002-041-011-01"; + } + + Dt_Task dt_Task = new() { PalletCode = stockt.PalletCode, @@ -804,26 +823,43 @@ TaskType = TaskTypeEnum.Outbound.ObjToInt(), TaskStatus = InTaskStatusEnum.InNew.ObjToInt(), SourceAddress = locationinfo.LocationCode, - TargetAddress = locationinfo.RoadwayNo == "2" ? "R02-002-027-011-01" : "R01-002-041-011-01", + TargetAddress = TargetAdd, CurrentAddress = locationinfo.LocationCode, - NextAddress = locationinfo.RoadwayNo == "2" ? "R02-002-027-011-01" : "R01-002-041-011-01", + NextAddress = TargetAdd, Grade = 1, Creater = "WMS", Depth = locationinfo.Depth, CreateDate = DateTime.Now, PLCTo = int.Parse(saveModel.DelKeys[1].ToString()), - + MaterialType=stockt.MaterialType }; dtstockt.Add(stockt); locations.Add(locationinfo); taskdt.Add(dt_Task); dtstocktdetail.Add(stocktdetail); } + else + { + return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱浣嶄俊鎭紝璇锋牳瀵癸紒锛侊紒锛屽嚭搴撴潯鐮侊細{palletCode}"); + } + } + else + { + return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱瀛樿鎯呬俊鎭紝璇锋牳瀵癸紒锛侊紒锛屽嚭搴撴潯鐮侊細{palletCode}"); } } + else + { + return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃閫夋嫨宸插叆搴撲笖锛堝悎鏍硷紝鐗归噰锛岄��璐э級鐨勭墿鏂欏嚭搴擄紒锛侊紒锛屽嚭搴撴潯鐮侊細{palletCode}"); + } + } + else + { + return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾湭鎵惧埌瀵瑰簲鏉$爜鐨勫簱瀛樹俊鎭紝鍑哄簱鏉$爜锛歿palletCode}"); + } } - var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTask, taskdt, "涓嬪彂浠诲姟鍏ュ簱"); + //var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTask, taskdt, "涓嬪彂浠诲姟鍏ュ簱"); _unitOfWorkManage.BeginTran(); if(dtstockt.Count > 0) { @@ -844,6 +880,50 @@ } } + public WebResponseContent ManualOutbound3(SaveModel saveModel) + { + WebResponseContent content = new WebResponseContent(); + try + { + List<Dt_StockInfo> dtstockt = new List<Dt_StockInfo>(); + + + List<Dt_StockInfo> stocktData = _stockService.StockInfoService.Repository.QueryData(x => x.StockStatus == (int)StockStatusEmun.宸插叆搴�); + string json = saveModel.DelKeys[0].ToString(); + List<int> palletCodes = JsonConvert.DeserializeObject<List<int>>(json); + + foreach (int pallid in palletCodes) + { + Dt_StockInfo stockt = stocktData.FirstOrDefault(x => x.Id == pallid); + if (stockt != null) + { + + stockt.Wlstatus = int.Parse(saveModel.DelKeys[1].ToString()); + dtstockt.Add(stockt); + } + else + { + return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱瀛樹俊鎭紝搴撳瓨缂栧彿锛歿pallid}"); + + } + } + _unitOfWorkManage.BeginTran(); + if (dtstockt.Count > 0) + { + _stockService.StockInfoService.Repository.UpdateData(dtstockt); + } + _unitOfWorkManage.CommitTran(); + content = WebResponseContent.Instance.OK($"淇敼鎴愬姛"); + return content; + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾姤閿欎俊鎭細{ex.Message}"); + throw; + } + } + public class PalletCodeList { public string PalletCode { get; set; } -- Gitblit v1.9.3