diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 0772557a..bae05527 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1076,8 +1076,9 @@ namespace Tnb.ProductionMgr throw new ArgumentException($"{nameof(input.Behavior)} not be null or empty"); } ISqlSugarClient db = _repository.AsSugarClient(); - DbResult result = await db.Ado.UseTranAsync(async () => + try { + await db.Ado.BeginTranAsync(); List prdTaskList = new List(); //var taskList = await _db.Queryable().Where(it => input.TaskIds.Contains(it.id) && it.mo_task_status == DictConst.ToBeScheduledEncode).ToListAsync(); //if (taskList?.Count > 0) @@ -1477,11 +1478,17 @@ namespace Tnb.ProductionMgr } } } - }); - if (!result.IsSuccess) - throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess ? "保存成功" : result.ErrorMessage; + await db.Ado.CommitTranAsync(); + } + catch (Exception e) + { + Log.Error(e.Message,e); + await db.Ado.RollbackTranAsync(); + throw Oops.Bah(e.Message); + } + + return "保存成功"; } /// diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs index fb14e393..6e94a14b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs @@ -295,7 +295,7 @@ namespace Tnb.ProductionMgr ) )) { - Log.Error($"{equipment.name}存在待下发的任务"); + Log.Error($"{equipment.name}存在未完成的任务"); continue; } bool? value = await _redisData.TryGetValueByKeyField(eqpDaq.equip_code, eqpDaq.label_name);