From c61cd04ae70a096b4414c66a3a018e02fa5f19eb Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Fri, 26 Jul 2024 17:54:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/RedisBackGround.cs | 13 ++++++------- .../Consts/WmsWareHouseConst.cs | 4 ++-- .../Entity/WmsElevatorH.cs | 5 ++++- .../Tnb.WarehouseMgr/WmsPurchaseService.cs | 15 ++++++++++++++- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index f8875a3f..98242b94 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -2255,19 +2255,18 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 开始执行四楼灭菌仓到成品库"); LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 开始执行四楼灭菌仓到成品库"); - WmsFloor4stewingConfig wmsFloor4StewingConfig = await db_Floor4DMC2CPK.Queryable() - .Where(r => r.name == "静置时间(小时)").FirstAsync(); - - if (wmsFloor4StewingConfig == null) + var time = db_Floor4DMC2CPK.Queryable().Where(p => p.key == "mjcstewingtime").FirstAsync().Result.value; + + if (time == null) { LoggerFloor4DMC2CPK.LogWarning($"【四楼灭菌仓到成品库】 未在静置仓配置中配置 静置时间(小时)"); return; } int hours = 168; - if (!int.TryParse(wmsFloor4StewingConfig.value, out hours)) + if (!int.TryParse(time, out hours)) { - LoggerFloor4DMC2CPK.LogWarning($"【四楼灭菌仓到成品库】 静置时间(小时) 配置有误,错误值为 {wmsFloor4StewingConfig.value}"); + LoggerFloor4DMC2CPK.LogWarning($"【四楼灭菌仓到成品库】 静置时间(小时) 配置有误,错误值为 {time}"); return; } @@ -2529,7 +2528,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA Floor4DMC2CPKtimer = new Timer(Floor4DMC2CPK, null, TimeSpan.Zero, TimeSpan.FromSeconds(30)); F2KTPsupplementtimer = new Timer(F2KTPsupplement, null, TimeSpan.Zero, TimeSpan.FromSeconds(30)); - //YCLInternalTransfertimer = new Timer(YCLInternalTransfer, null, TimeSpan.Zero, TimeSpan.FromSeconds(180)); + YCLInternalTransfertimer = new Timer(YCLInternalTransfer, null, TimeSpan.Zero, TimeSpan.FromSeconds(180)); return Task.CompletedTask; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index 2c36b037..e99c5955 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -541,11 +541,11 @@ /// /// 原材料仓内转移策略 /// - public const string POLICY_YCLINSTOCK = "WISP202407250001"; + public const string POLICY_YCLINSTOCK = "WISP202407260001"; /// /// 原材料仓先进先出 /// - public const string POLICY_YCLOUTSTOCK = "WOSP202407250001"; + public const string POLICY_YCLOUTSTOCK = "WOSP202407260001"; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.cs index 7887ec70..ec8eff6e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.cs @@ -96,5 +96,8 @@ public partial class WmsElevatorH : BaseEntity /// 电梯占用状态 /// public int is_use { get; set; } - + /// + /// 占用任务 + /// + public int use_tasks { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs index 5b0c8c47..4073681f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs @@ -33,6 +33,7 @@ using Tnb.WarehouseMgr.Interfaces; using Tnb.BasicData; using Tnb.ProductionMgr.Entities.Entity; using Tnb.WarehouseMgr.Entities.Entity; +using Microsoft.Extensions.Logging; namespace Tnb.WarehouseMgr { @@ -280,8 +281,18 @@ namespace Tnb.WarehouseMgr throw new AppFriendlyException("条码已生成", 500); }; WmsPurchaseD WmsPurchaseD = await _db.Queryable().Where(it => input.BillId == it.id).FirstAsync(); + + if (WmsPurchaseD.purchase_arriveqty == 0) + { + throw new AppFriendlyException("到货数量为0,没有物料可以打印", 500); + }; + List wmsTempCodes = new(); decimal? minPacking = (await _db.Queryable().FirstAsync(it => it.id == WmsPurchaseD.material_id))?.minpacking; + if (!minPacking.HasValue || minPacking.Value <= 0) + { + throw new AppFriendlyException($"物料{WmsPurchaseD.material_code} {WmsPurchaseD.material_id} 包装数量为空或者等于0,无法打印!", 500); + }; int codeNum = 0; if (minPacking.HasValue && minPacking.Value > 0) @@ -330,8 +341,10 @@ namespace Tnb.WarehouseMgr } - catch (Exception) + catch (Exception ex) { + Logger.LogError($"【BarCodePrint】" + ex.Message); + Logger.LogError($"【BarCodePrint】" + ex.StackTrace); await _db.Ado.RollbackTranAsync(); throw; }