From f365035a89a60ab4756ae6c3969ef948ddd91a80 Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Fri, 18 Oct 2024 14:42:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E8=B4=A7=E6=8E=A7=E5=88=B6=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=A9=BA=E6=89=98=E7=9B=98=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/RedisBackGround.cs | 19 ++++++++++++++++++- .../Tnb.WarehouseMgr/WmsOutsourceDService.cs | 5 ++++- .../Tnb.WarehouseMgr/WmsPurchaseDService.cs | 3 ++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 32f0d48d..880acc55 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -579,6 +579,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA } // 未锁定且已占用且库位中没有记录托盘 此时认为是叠盘机送过来的 + // 20241018 业务变更 后续删除 var wmsLoc = db_BGWCarrySupplementtimer.Queryable() .LeftJoin((a, b) => a.id == b.location_id) .Where((a, b) => a.is_lock == 0 && a.is_use == "1" @@ -606,7 +607,23 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA return false; else return true; - }).Select(r => r.Key); + }).Select(r => r.Key).ToList(); + wmsLoc.Clear(); + if (wmsLoc.Count() == 0) + { + OutStockStrategyQuery OutStockStrategyInput = new() + { + carrystd_id = WmsWareHouseConst.CARRY_TP_ID, + warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID, + Size = 1 + }; + + List? carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput, db_BGWCarrySupplementtimer); + if (carrys.Count > 0) + { + wmsLoc = await db_BGWCarrySupplementtimer.Queryable().Where(r => r.id == carrys[0].location_id).ToListAsync(); + } + } if (wmsLoc.Count() == 0) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutsourceDService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutsourceDService.cs index 3a30528a..938831d1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutsourceDService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutsourceDService.cs @@ -121,7 +121,10 @@ namespace Tnb.WarehouseMgr // 托盘对应入库单 List instock_mains = await _db.Queryable().Where(x => x.source_id == wmsOutsourceD.fk_wms_outsource_order_id).ToListAsync(); - + if (instock_mains.Count == 0) + { + throw Oops.Bah($"委外收货单{wmsOutsourceH.bill_code}不存在此明细的入库记录!可能是入库任务还未执行完成或者物料是由人工入库"); + } List allInstockDetails = await _db.Queryable().Where(it => instock_mains.Select(r => r.id).Contains(it.bill_id) && it.material_code == wmsOutsourceD.matcode && it.code_batch == wmsOutsourceD.code_batch).OrderBy(x=>x.id).ToListAsync(); List> requestData = new List>(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs index 60e05ada..d2ff9b4a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs @@ -135,8 +135,9 @@ namespace Tnb.WarehouseMgr List instock_mains = await _db.Queryable().Where(x => x.source_id == wmsPurchaseD.bill_id).ToListAsync(); if (instock_mains.Count == 0) { - throw Oops.Bah("不存在此明细的入库记录!可能是入库任务还未执行完成或者物料是由人工入库"); + throw Oops.Bah($"采购收货单{wmsPurchaseH.bill_code}不存在此明细的入库记录!可能是入库任务还未执行完成或者物料是由人工入库"); } + List allInstockDetails = await _db.Queryable().Where(it => instock_mains.Select(r => r.id).Contains(it.bill_id) && it.material_id == wmsPurchaseD.material_id && it.code_batch == wmsPurchaseD.code_batch).OrderBy(x=>x.id).ToListAsync();