生产提报日志优化

This commit is contained in:
2024-06-27 17:11:06 +08:00
parent 398f8f3696
commit 22b1b80b1e
2 changed files with 13 additions and 6 deletions

View File

@@ -1076,8 +1076,9 @@ namespace Tnb.ProductionMgr
throw new ArgumentException($"{nameof(input.Behavior)} not be null or empty");
}
ISqlSugarClient db = _repository.AsSugarClient();
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
try
{
await db.Ado.BeginTranAsync();
List<PrdMoTask> prdTaskList = new List<PrdMoTask>();
//var taskList = await _db.Queryable<PrdMoTask>().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 "保存成功";
}
/// <summary>