质量bug

This commit is contained in:
2024-08-28 10:05:02 +08:00
parent be5bdc46e3
commit 687ea79f41
3 changed files with 44 additions and 6 deletions

View File

@@ -1110,7 +1110,7 @@ namespace Tnb.ProductionMgr
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="NotImplementedException"></exception>
[HttpPost]
public async Task<dynamic> PrdTaskRelease(PrdTaskReleaseUpInput input)
public async Task<dynamic> PrdTaskRelease(PrdTaskReleaseUpInput input,ISqlSugarClient db = null)
{
int row = -1;
if (input is null)
@@ -1126,10 +1126,17 @@ namespace Tnb.ProductionMgr
{
throw new ArgumentException($"{nameof(input.Behavior)} not be null or empty");
}
ISqlSugarClient db = _repository.AsSugarClient();
bool tranFlag = true;
if (db==null)
{
tranFlag = false;
db = _repository.AsSugarClient();
}
try
{
await db.Ado.BeginTranAsync();
if(tranFlag) 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)
@@ -1606,12 +1613,12 @@ namespace Tnb.ProductionMgr
}
await db.Ado.CommitTranAsync();
if(tranFlag) await db.Ado.CommitTranAsync();
}
catch (Exception e)
{
Log.Error(e.Message,e);
await db.Ado.RollbackTranAsync();
if(tranFlag) await db.Ado.RollbackTranAsync();
throw Oops.Bah(e.Message);
}