From 033ec9867162a653b171b99d2f2227044bfc3d67 Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Sat, 31 Aug 2024 10:49:47 +0800 Subject: [PATCH] 1 --- .../Consts/WmsWareHouseConst.cs | 20 +++++++++++++ .../Tnb.WarehouseMgr/WmsPrdInstockHService.cs | 30 +++++++------------ 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index 6040a9a4..d64cc9ad 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -676,5 +676,25 @@ /// public const string EQUIPMANAGERORG_ID = "26586914497557"; + /// + /// 注塑提报 + /// + public const string bipwarehouseid_zs = "1001A1100000001SO7YO"; + /// + /// 挤出提报 + /// + public const string bipwarehouseid_jc = "1001A1100000001SO4AM"; + /// + /// 包装提报 + /// + public const string bipwarehouseid_bz = "1001A1100000001KZIU5"; + /// + /// 灭菌提报 + /// + public const string bipwarehouseid_mj = "1001A1100000001MA8KP"; + /// + /// 成品提报 + /// + public const string bipwarehouseid_cp = "1001A1100000001MA8ME"; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs index 857b9153..7a6c67e1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs @@ -30,6 +30,7 @@ using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Entity; using Tnb.WarehouseMgr.Interfaces; using Tnb.ProductionMgr.Entities.Entity; +using System.Threading; namespace Tnb.WarehouseMgr { @@ -67,6 +68,7 @@ namespace Tnb.WarehouseMgr db = dbConn; string type = ""; + SemaphoreSlim semaphoreSlim = null; try { await db.Ado.BeginTranAsync(); @@ -118,19 +120,19 @@ namespace Tnb.WarehouseMgr string scwarehouse_id = ""; if (type == DictConst.PrdMoTypeZS) { - scwarehouse_id = "0201010402"; + scwarehouse_id = WmsWareHouseConst.bipwarehouseid_zs; } else if (type == DictConst.PrdMoTypeJC) { - scwarehouse_id = "0202010202"; + scwarehouse_id = WmsWareHouseConst.bipwarehouseid_jc; } else if (type == DictConst.PrdMoTypeZZ) { - scwarehouse_id = "0204010402"; + scwarehouse_id = WmsWareHouseConst.bipwarehouseid_bz; } else if (type == DictConst.PrdMoTypeBZ) { - scwarehouse_id = "0204010402"; + scwarehouse_id = WmsWareHouseConst.bipwarehouseid_bz; } #endregion foreach (WmsPrdInstockDInput prdInstockDInput in input.prdInstockDs) @@ -171,16 +173,17 @@ namespace Tnb.WarehouseMgr if (type == DictConst.PrdMoTypeZS) { - await _s_taskExecuteSemaphore_F1ZCCInstock.WaitAsync(); + semaphoreSlim = _wareHouseService.GetSemaphore("instock", WmsWareHouseConst.WAREHOUSE_ZC_ID); } else if (type == DictConst.PrdMoTypeJC) { - await _s_taskExecuteSemaphore_F2HCCInstock.WaitAsync(); + semaphoreSlim = _wareHouseService.GetSemaphore("instock", WmsWareHouseConst.WAREHOUSE_HCC_ID); } else if (type == DictConst.PrdMoTypeBZ) { - + semaphoreSlim = _wareHouseService.GetSemaphore("instock", WmsWareHouseConst.WAREHOUSE_DMJC_ID); } + await semaphoreSlim.WaitAsync(); foreach (WmsPrdInstockD wmsPrdInstockD in WmsPrdInstockDs) { @@ -315,18 +318,7 @@ namespace Tnb.WarehouseMgr } finally { - if (type == DictConst.PrdMoTypeZS) - { - _s_taskExecuteSemaphore_F1ZCCInstock.Release(); - } - else if (type == DictConst.PrdMoTypeJC) - { - _s_taskExecuteSemaphore_F2HCCInstock.Release(); - } - else if (type == DictConst.PrdMoTypeBZ) - { - - } + semaphoreSlim.Release(); _wareHouseService.GenTaskExecute(); }