From 694412e9650ef6abdd1de89f2c18e45180ad41af Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Wed, 3 Jul 2024 17:51:58 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index c7408f87..2b0c1b11 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -466,9 +466,13 @@ namespace Tnb.ProductionMgr if (detail.feeding_num + num < detail.num) { + if (wmsCarryCode.codeqty < num) + { + throw new Exception("条码数量小于签收数量"); + } await db.Updateable() .SetColumns(x => x.codeqty == x.codeqty - num) - .Where(x => x.carry_id == detail.member_carry_id) + .Where(x => x.carry_id == carry.id) .ExecuteCommandAsync(); } else From 785f0f287ad6e163604b9a5b8adc87ff9af945af Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Wed, 3 Jul 2024 17:52:37 +0800 Subject: [PATCH 2/4] 1 --- ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 2b0c1b11..a1a29ebe 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -468,7 +468,7 @@ namespace Tnb.ProductionMgr { if (wmsCarryCode.codeqty < num) { - throw new Exception("条码数量小于签收数量"); + throw new Exception("条码数量小于投料数量"); } await db.Updateable() .SetColumns(x => x.codeqty == x.codeqty - num) From fa4fdb9d0c81ca24d6dd22c0e41c436fed359bfa Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Thu, 4 Jul 2024 09:22:17 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E6=8F=90=E6=8A=A5?= =?UTF-8?q?=E5=8A=A0=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/PrdMoTaskService.cs | 54 ++++++++++--------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 7e42c0cc..dcf69b08 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -76,6 +76,7 @@ namespace Tnb.ProductionMgr private readonly IWmsCarryService _wmsCarryService; private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build(); private readonly RedisData _redisData; + private static SemaphoreSlim prdreportSemaphore = new(1); public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); public PrdMoTaskService( @@ -1609,32 +1610,34 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task PrdReport(PrdReportCrInput input) { - Log.Information($"生产提报参数:{JsonConvert.SerializeObject(input)}"); - ISqlSugarClient db = _repository.AsSugarClient(); - PrdMoTask? prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); - EqpEquipment equip = await db.Queryable().SingleAsync(x => x.id == prdMoTask.eqp_id); - BasMaterial basMaterial = await db.Queryable().SingleAsync(x => x.id == prdMoTask.material_id); - PrdReport report = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); - - if (basMaterial == null) - { - throw Oops.Bah($"未找到物料{prdMoTask.material_id}"); - } - - Dictionary dic = new Dictionary() - { - ["30019971917589"] = "外包装箱码垛线" - }; - - Dictionary dic2 = new Dictionary() - { - [WmsWareHouseConst.XUELUGUAN1XIAN] = "WBZX_x1_Enquantity", - [WmsWareHouseConst.XUELUGUAN2XIAN] = "WBZX_x2_Enquantity" - }; - string materialBoxCode = input.material_box_code; - BasLocation location = null; + await prdreportSemaphore.WaitAsync(); try { + Log.Information($"生产提报参数:{JsonConvert.SerializeObject(input)}"); + ISqlSugarClient db = _repository.AsSugarClient(); + PrdMoTask? prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); + EqpEquipment equip = await db.Queryable().SingleAsync(x => x.id == prdMoTask.eqp_id); + BasMaterial basMaterial = await db.Queryable().SingleAsync(x => x.id == prdMoTask.material_id); + PrdReport report = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); + + if (basMaterial == null) + { + throw Oops.Bah($"未找到物料{prdMoTask.material_id}"); + } + + Dictionary dic = new Dictionary() + { + ["30019971917589"] = "外包装箱码垛线" + }; + + Dictionary dic2 = new Dictionary() + { + [WmsWareHouseConst.XUELUGUAN1XIAN] = "WBZX_x1_Enquantity", + [WmsWareHouseConst.XUELUGUAN2XIAN] = "WBZX_x2_Enquantity" + }; + string materialBoxCode = input.material_box_code; + BasLocation location = null; + await _db.Ado.BeginTranAsync(); int row = -1; PrdMo prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); @@ -2181,6 +2184,9 @@ namespace Tnb.ProductionMgr await _db.Ado.RollbackTranAsync(); throw Oops.Bah("提报失败:"+ex.Message); } + finally{ + prdreportSemaphore.Release(); + } // DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => // { From 397c2b2eaef7f8d9297fe5079ec0fb319fdd95b3 Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Thu, 4 Jul 2024 09:40:55 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs index 8fe5a3ed..742f8f72 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs @@ -3,6 +3,7 @@ using JNPF.Common.Extension; using JNPF.FriendlyException; using Mapster; using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; using Senparc.Weixin.MP.AdvancedAPIs.Semantic; using SqlSugar; using Tnb.BasicData.Entities; @@ -102,7 +103,7 @@ namespace Tnb.WarehouseMgr { throw new AppFriendlyException("载具条码数据异常,有料箱为空", 500); } - + int i = 0; foreach ((string mCarryId, object v) in mCarryIdDic) { @@ -121,6 +122,7 @@ namespace Tnb.WarehouseMgr { if (carryCodeQueryOutput.member_carrycode == null) { + Logger.Information($"WmsCarryD数据:{JsonConvert.SerializeObject(mCarryIdDic)}||||||carryCodes数据:{JsonConvert.SerializeObject(carryCodes)}"); throw new AppFriendlyException("载具与条码数量可能不匹配", 500); } carryCodeQueryOutput.member_carryid = mCarryIdDic2.GetOrDefault(carryCodeQueryOutput.member_carrycode).ToString();