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 1/2] =?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(); From 7865fd5c2d07a0750876b0ab1e61d3d0adf3ade0 Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Fri, 18 Oct 2024 17:09:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E8=B0=83=E6=95=B4=20?= =?UTF-8?q?=E7=81=AD=E8=8F=8C=E8=BD=AC=E5=BA=93=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 | 2 +- .../Entity/WmsPurchaseQcrecord.cs | 2 +- .../WmsMaterialTransferService.cs | 28 +++++++++---------- .../Tnb.WarehouseMgr/WmsOutsourceService.cs | 2 +- .../WmsPDAScanInStockService.cs | 2 +- .../WmsPurchaseQcrecordService.cs | 7 +++-- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 880acc55..91d43652 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -608,7 +608,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA else return true; }).Select(r => r.Key).ToList(); - wmsLoc.Clear(); + if (wmsLoc.Count() == 0) { OutStockStrategyQuery OutStockStrategyInput = new() diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseQcrecord.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseQcrecord.cs index 30c519b4..e0dbe939 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseQcrecord.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseQcrecord.cs @@ -107,7 +107,7 @@ public partial class WmsPurchaseQcrecord : BaseEntity /// /// [SugarColumn(IsIgnore = true)] - public string? material_specification { get; set; } + public string? container_no { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs index c8128e88..8cdd5cb6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs @@ -550,16 +550,16 @@ namespace Tnb.WarehouseMgr BasLocation startLocation = item.Item4; - WmsSterilizationInstockH wmsSterilizationInstockH = await _db.Queryable().Where(r => r.carry_id == wmsCarryH.id - && r.status == WmsWareHouseConst.BILLSTATUS_ADD_ID && r.origin == "外协调拨入库").FirstAsync(); - if (wmsSterilizationInstockH == null) - { - throw new Exception($"【四楼静置仓到成品库】载具{wmsCarryH.carry_code}没有找到新增状态且来源是外协调拨入库的灭菌入库记录!"); - } - if (wmsCarryH.location_id != wmsSterilizationInstockH.location_id) - { - throw new Exception($"【四楼静置仓到成品库】载具{wmsCarryH.carry_code}实际位置与灭菌入库记录位置不一致"); - } + //WmsSterilizationInstockH wmsSterilizationInstockH = await _db.Queryable().Where(r => r.carry_id == wmsCarryH.id + //&& r.status == WmsWareHouseConst.BILLSTATUS_ADD_ID && r.origin == "外协调拨入库").FirstAsync(); + //if (wmsSterilizationInstockH == null) + //{ + // throw new Exception($"【四楼静置仓到成品库】载具{wmsCarryH.carry_code}没有找到新增状态且来源是外协调拨入库的灭菌入库记录!"); + //} + //if (wmsCarryH.location_id != wmsSterilizationInstockH.location_id) + //{ + // throw new Exception($"【四楼静置仓到成品库】载具{wmsCarryH.carry_code}实际位置与灭菌入库记录位置不一致"); + //} BasLocation startlocation = await _db.Queryable().Where(r => r.id == wmsCarryH.location_id).FirstAsync(); @@ -568,11 +568,11 @@ namespace Tnb.WarehouseMgr throw new Exception($"【四楼静置仓到成品库】 起点库位{startlocation.location_code}已锁定"); } - wmsSterilizationInstockH.status = WmsWareHouseConst.BILLSTATUS_ON_ID; - wmsSterilizationInstockH.cp_location_id = endLocations[instockLocIndex].id; - wmsSterilizationInstockH.cp_location_code = endLocations[instockLocIndex].location_code; + //wmsSterilizationInstockH.status = WmsWareHouseConst.BILLSTATUS_ON_ID; + //wmsSterilizationInstockH.cp_location_id = endLocations[instockLocIndex].id; + //wmsSterilizationInstockH.cp_location_code = endLocations[instockLocIndex].location_code; - await _db.Updateable(wmsSterilizationInstockH).UpdateColumns(r => new { r.status, r.cp_location_id, r.cp_location_code }).ExecuteCommandAsync(); + //await _db.Updateable(wmsSterilizationInstockH).UpdateColumns(r => new { r.status, r.cp_location_id, r.cp_location_code }).ExecuteCommandAsync(); // 转库单载具子表 WmsMaterialTransferCarry wmsMaterialTransferCarry = new WmsMaterialTransferCarry(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutsourceService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutsourceService.cs index c570d842..a3b6f300 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutsourceService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutsourceService.cs @@ -204,7 +204,7 @@ namespace Tnb.WarehouseMgr is_lock = 0, is_end = 0, require_id = WmsOutsourceD.id, - require_code = WmsOutsourceH.outsource_order, + require_code = WmsOutsourceH.bill_code, create_id = _userManager.UserId, create_time = DateTime.Now, required_type = WmsWareHouseConst.BILLTYPE_OUTSOURCE_ID, diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs index 04db7178..aaff4c2c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs @@ -430,7 +430,7 @@ namespace Tnb.WarehouseMgr case WmsWareHouseConst.BILLTYPE_OUTSOURCE_ID: { bill_type = WmsWareHouseConst.BILLTYPE_OUTSOURCEINSTOCK_ID; - source_main_id = (await _dbScanInStockByRedis.Queryable().FirstAsync(it => it.id == source_id)).erp_outsource_order_d_pk; + source_main_id = (await _dbScanInStockByRedis.Queryable().FirstAsync(it => it.id == source_id)).fk_wms_outsource_order_id; break; } case WmsWareHouseConst.BILLTYPE_RAWMATTRANSFERINSTOCK_ID: diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseQcrecordService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseQcrecordService.cs index 368fb7c3..ca411ba8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseQcrecordService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseQcrecordService.cs @@ -91,9 +91,9 @@ namespace Tnb.WarehouseMgr var _start_time = time.Count > 0 ? (long)time[0] : 0; var _end_time = time.Count > 1 ? (long)time[1] : 0; - DateTimeOffset _start_timeofs = DateTimeOffset.FromUnixTimeSeconds((long)_start_time); + DateTimeOffset _start_timeofs = DateTimeOffset.FromUnixTimeMilliseconds((long)_start_time); DateTime start_time = _start_timeofs.DateTime; - DateTimeOffset _end_timeofs = DateTimeOffset.FromUnixTimeSeconds((long)_end_time); + DateTimeOffset _end_timeofs = DateTimeOffset.FromUnixTimeMilliseconds((long)_end_time); DateTime end_time = _end_timeofs.DateTime; var data = await _db.Queryable() @@ -112,7 +112,8 @@ namespace Tnb.WarehouseMgr material_id = a.material_id, material_code = a.material_code, material_name = a.material_name, - material_specification = b.material_specification, + container_no = b.material_standard, + material_spec = b.material_specification, unit_id = c.FullName, purchase_qty = a.purchase_qty, purchase_prqty = a.purchase_prqty,