From dc06f58d8ed537555fd529551180f43a0586ec3f Mon Sep 17 00:00:00 2001 From: helongyang <647556386@qq.com> Date: 星期日, 22 六月 2025 11:44:43 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 146 ++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 122 insertions(+), 24 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" index a4d38c2..ae8089e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" @@ -16,6 +16,7 @@ using WIDESEA_Common.TaskEnum; using WIDESEA_Common.WareHouseEnum; using WIDESEA_Core; +using WIDESEA_Core.Enums; using WIDESEA_Core.Helper; using WIDESEA_DTO; using WIDESEA_DTO.MES; @@ -60,7 +61,7 @@ { return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); } - if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt()) + if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫佹瀹屾垚.ObjToInt()) { return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱"); } @@ -76,6 +77,10 @@ { Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouseId); if (locationInfo == null) return WebResponseContent.Instance.Error($"鏈壘鍒板綋鍓嶅簱鍖鸿揣浣嶄俊鎭�"); + if (stationCode!= "8005") + { + return WebResponseContent.Instance.Error($"璧风偣閿欒锛歿stationCode}"); + } return DeviceRequestInboundTask(stationCode, locationInfo.RoadwayNo, palletCode); } else @@ -93,8 +98,8 @@ TaskStatus = TaskStatusEnum.New.ObjToInt(), WarehouseId = stockInfo.WarehouseId, PalletType = stockInfo.PalletType, - MaterielCode = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode, - Quantity = (float)stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.StockQuantity, + MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode, + Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity), }; //鑾峰彇鏄惁瀛樺湪鍏ュ簱鍗� Dt_InboundOrder? inboundOrder = null; @@ -130,6 +135,11 @@ stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); newTask.TaskType = TaskTypeEnum.InPick.ObjToInt(); } + else if (stockInfo.StockStatus == StockStatusEmun.閫佹瀹屾垚.ObjToInt()) + { + stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); + newTask.TaskType = TaskTypeEnum.InQuality.ObjToInt(); + } else { stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); @@ -158,7 +168,52 @@ return WebResponseContent.Instance.Error(ex.Message); } } - + /// <summary> + /// 鏌ヨ璐ㄦ鏁伴噺 + /// </summary> + /// <param name="palletCode">鎵樼洏鍙�</param> + /// <returns></returns> + public WebResponseContent InQualityConfirm(string palletCode) + { + WebResponseContent content = new WebResponseContent(); + try + { + Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(palletCode); + if (stockInfo == null) + { + return content.Error($"鏈壘鍒拌鎵樼洏搴撳瓨淇℃伅"); + } + if (stockInfo.Details.Count<=0) + { + return content.Error($"璇ユ墭鐩樺簱瀛樻槑缁嗕负绌�"); + } + if (stockInfo.StockStatus != StockStatusEmun.閫佹瀹屾垚.ObjToInt()) + { + return content.Error($"璇ユ墭鐩樿繕鏈�佹鍑哄簱瀹屾垚"); + } + Dt_OutStockLockInfo? outStockLockInfo = _outboundRepository.OutboundStockLockInfoRepository.QueryData(x => x.PalletCode == palletCode && x.Status == OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt() && x.OrderType== OutOrderTypeEnum.Quality.ObjToInt()).OrderByDescending(x=>x.Id).FirstOrDefault(); + if (outStockLockInfo != null) + { + //鑾峰彇瀵瑰簲妫�楠屽崟 + Dt_CheckOrder checkOrder = _checkOrderRepository.QueryFirst(x=>x.ReceiveDetailRowNo== outStockLockInfo.Id && x.CheckOrderStatus==CheckOrderStatusEnum.Checked.ObjToInt()); + if (checkOrder == null) + { + return content.Error($"璇ユ墭鐩橀�佹淇℃伅鏈"); + } + content.OK("鎴愬姛", data:new { stockInfo.Details.FirstOrDefault()?.MaterielCode,checkOrder.ReceivedQuantity,checkOrder.ScrappedQuantity,checkOrder.DefectedQuantity,checkOrder.QualifiedQuantity,stockQuantity= stockInfo.Details.Sum(x=>x.StockQuantity) }) ; + } + else + { + content.Error("璇ユ墭鐩橀�佹鍑哄簱璇︽儏涓嶅瓨鍦�"); + } + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + content.Error(ex.Message); + } + return content; + } /// <summary> /// 鍏ョ┖绠� /// </summary> @@ -330,8 +385,16 @@ TaskStatus = TaskStatusEnum.New.ObjToInt(), WarehouseId = stockInfoPPorGM.WarehouseId, PalletType = stockInfoPPorGM.PalletType, - TaskLength= stockInfoPPorGM.StockLength + TaskLength= stockInfoPPorGM.StockLength, + }; + string MaterielCodeGMPP = stockInfoPPorGM.Details?.Where(x => x.StockId == stockInfoPPorGM.Id).FirstOrDefault()?.MaterielCode; + float QuantityGMPP = (float)stockInfoPPorGM.Details?.Where(x => x.StockId == stockInfoPPorGM.Id).Sum(x => x.StockQuantity); + if (MaterielCodeGMPP != null && QuantityGMPP != null) + { + newTaskPPorGM.MaterielCode = MaterielCodeGMPP; + newTaskPPorGM.Quantity = QuantityGMPP; + } //鑾峰彇鏄惁瀛樺湪鍏ュ簱鍗� Dt_InboundOrder? inboundOrderPPorGM = null; @@ -370,7 +433,7 @@ { return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); } - if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES閫�搴�.ObjToInt()) + if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫佹瀹屾垚.ObjToInt()) { return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱"); } @@ -399,6 +462,13 @@ WarehouseId = stockInfo.WarehouseId, PalletType = stockInfo.PalletType, }; + string MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode; + float Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity); + if (MaterielCode != null && Quantity != null) + { + newTask.MaterielCode = MaterielCode; + newTask.Quantity = Quantity; + } //鑾峰彇鏄惁瀛樺湪鍏ュ簱鍗� Dt_InboundOrder? inboundOrder = null; @@ -429,7 +499,13 @@ } else if (stockInfo.StockStatus == StockStatusEmun.鎷i�夊畬鎴�.ObjToInt()) { + stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); newTask.TaskType = TaskTypeEnum.InPick.ObjToInt(); + } + else if (stockInfo.StockStatus == StockStatusEmun.閫佹瀹屾垚.ObjToInt()) + { + stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); + newTask.TaskType = TaskTypeEnum.InQuality.ObjToInt(); } else { @@ -478,8 +554,7 @@ { return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�"); } - - Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); + Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); if (stockInfo == null) { return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); @@ -507,7 +582,13 @@ WarehouseId = stockInfo.WarehouseId, PalletType = stockInfo.PalletType, }; - + string MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode; + float Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity); + if (MaterielCode != null && Quantity != null) + { + newTask.MaterielCode = MaterielCode; + newTask.Quantity = (float)Quantity; + } if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) { @@ -519,8 +600,9 @@ } else if (stockInfo.StockStatus == StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt()) { + Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x=>x.WarehouseId==stockInfo.WarehouseId && x.PalletType==stockInfo.PalletType); //todo 灏忔墭鐩樻殏鏃舵湭鍚敤 - if (stockInfo.PalletType == PalletTypeEnum.MediumPallet.ObjToInt()) + if (palletTypeInfo.LocaitonCount==2) { newTask.TaskType = TaskTypeEnum.MesPalletLargeReturn.ObjToInt(); } @@ -578,7 +660,7 @@ string roadwayNo = AssignRoadwayNo(staions, palletCode, heightType); - Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); + Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); if (stockInfo == null) { return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); @@ -606,7 +688,13 @@ WarehouseId = stockInfo.WarehouseId, PalletType = stockInfo.PalletType, }; - + string MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode; + float Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity); + if (MaterielCode != null && Quantity != null) + { + newTask.MaterielCode = MaterielCode; + newTask.Quantity = Quantity; + } if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) { stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); @@ -765,22 +853,30 @@ { return content.Error($"鎵樼洏绫诲瀷淇℃伅涓嶅瓨鍦�"); } - //鑾峰彇闃荤剨鎵规 - WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); - if (!requestLotInfo.Status) + ////鑾峰彇闃荤剨鎵规 + //WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); + //if (!requestLotInfo.Status) + //{ + // return content.Error($"璇锋眰闃荤剨鎵规淇℃伅澶辫触,{requestLotInfo.Message}"); + //} + //MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); + MesLotInfoModel mesLotInfo = new MesLotInfoModel() { - return content.Error($"璇锋眰闃荤剨鎵规淇℃伅澶辫触,{requestLotInfo.Message}"); - } - MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); + Product="FH001", + ProductVersion="A1", + Qty=20, + LotNo= materialLot, + IsFullNumber=true + }; Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() { MaterielSpec = mesLotInfo.ProductVersion, BatchNo = materialLot, - EffectiveDate = mesLotInfo.DateCode ?? "", + EffectiveDate = mesLotInfo.DateCode ?? " ", MaterielCode = mesLotInfo.Product, InboundOrderRowNo = 0, MaterielName = mesLotInfo.Product, - ProductionDate = mesLotInfo.DateCode ?? "", + ProductionDate = mesLotInfo.DateCode ?? " ", OrderNo = "", OutboundQuantity = 0, SerialNumber = materialLot, @@ -812,7 +908,9 @@ TaskType = palletTypeInfo.LocaitonCount==2? (int)TaskTypeEnum.InZHProductLarge : (int)TaskTypeEnum.InZHProductSmall, TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), PalletType = palletTypeInfo.PalletType, - WarehouseId = warehouse.WarehouseId + WarehouseId = warehouse.WarehouseId, + MaterielCode = mesLotInfo.Product, + Quantity = (float)mesLotInfo.Qty, }; _unitOfWorkManage.BeginTran(); Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); @@ -820,7 +918,7 @@ //BaseDal.AddData(task); _unitOfWorkManage.CommitTran(); //灏嗕换鍔℃帹閫佸埌WCS - PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH"); ; + PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH", agvTaskCode); content.OK(data: taskIn); } catch (Exception ex) @@ -924,8 +1022,8 @@ TaskStatus = TaskStatusEnum.New.ObjToInt(), WarehouseId = warePoint.WarehouseId, PalletType = proStockInfo.PalletType, - MaterielCode = proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).FirstOrDefault()?.ProductCode, - Quantity = (float)proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).Sum(x => x.StockPcsQty) + MaterielCode = proStockInfo.proStockInfoDetails?.Where(x => x.ProStockId == proStockInfo.Id).FirstOrDefault()?.ProductCode, + Quantity = (float)proStockInfo.proStockInfoDetails?.Where(x => x.ProStockId == proStockInfo.Id).Sum(x => x.StockPcsQty) }; _unitOfWorkManage.BeginTran(); int taskId = BaseDal.AddData(newTask); -- Gitblit v1.9.3