From dce72c48995b27aec441f45d227601dd247a69ef Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Wed, 26 Jun 2024 14:00:36 +0800 Subject: [PATCH] BUG --- .../PrdMaterialReceiptService.cs | 17 ++++++++++------- .../Tnb.ProductionMgr/TimeWorkService.cs | 12 ++++++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs index 16986d1c..83f0adf6 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs @@ -1,5 +1,6 @@ using JNPF; using JNPF.Common.Core.Manager; +using JNPF.Common.Enums; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.Extras.CollectiveOAuth.Models; @@ -457,15 +458,17 @@ namespace Tnb.ProductionMgr } } + + if (insertHList.Count <= 0 || insertDList.Count <= 0) + { + throw Oops.Bah(ErrorCode.COM1000); + } - DbResult result = await db.Ado.UseTranAsync(async () => + int row1 = await db.Insertable(insertHList).ExecuteCommandAsync(); + int row2 = await db.Insertable(insertDList).ExecuteCommandAsync(); + if (row1 <= 0 || row2 <= 0) { - await db.Insertable(insertHList).ExecuteCommandAsync(); - await db.Insertable(insertDList).ExecuteCommandAsync(); - }); - if (!result.IsSuccess) - { - throw Oops.Bah(result.ErrorMessage); + throw Oops.Bah(ErrorCode.COM1000); } } } diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs index 16898a23..bfda06a3 100644 --- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs @@ -237,7 +237,11 @@ namespace Tnb.ProductionMgr public async Task FixedPointDelivery() { string state = await _redisData.TryGetValueByKeyField("YTCS", "State"); - if ("OK" != state) return "YTCS没开机"; + if ("OK" != state) + { + Log.Error($"TCS没开机"); + return "YTCS没开机"; + } string stateHxja = await _redisData.TryGetValueByKeyField("hxjA", "State"); string stateHxjc = await _redisData.TryGetValueByKeyField("hxjC", "State"); List hxjList = new List(); @@ -250,7 +254,11 @@ namespace Tnb.ProductionMgr hxjList.Add("hxjC"); } - if (hxjList.IsEmpty()) return "hxjA,hxjC不正常"; + if (hxjList.IsEmpty()) + { + Log.Error($"hxjA,hxjC不正常"); + return "hxjA,hxjC不正常"; + } string msg = ""; List equipments = await _db.Queryable() .InnerJoin((x, y) => x.id == y.equip_type_id)