挤出批号修改 erp接口另起线程调用

This commit is contained in:
2024-09-29 16:03:05 +08:00
parent e6a0066616
commit a04831bbae
8 changed files with 76 additions and 28 deletions

View File

@@ -44,7 +44,7 @@ namespace Tnb.BasicData
public async Task<string> Send(string id)
{
ThirdWebapiRecord record = await _repository.GetSingleAsync(x=>x.id==id);
ThirdResult thirdResult = await Send(Arrays.AsList(record), "手动");
ThirdResult thirdResult = await Send(Arrays.AsList(record), "手动",null,false);
return thirdResult.msgResult;
}
@@ -89,7 +89,25 @@ namespace Tnb.BasicData
return "失败";
}
public async Task<ThirdResult> Send(List<ThirdWebapiRecord> records, string send_type,ISqlSugarClient db=null)
public async Task<ThirdResult> Send(List<ThirdWebapiRecord> records, string send_type,ISqlSugarClient db=null,bool threadFlag=true)
{
ThirdResult thirdResult = new ThirdResult();
if (threadFlag)
{
Task.Run(() =>
{
Send(records, send_type, db);
});
}
else
{
thirdResult = await Send(records, send_type, db);
}
return thirdResult;
}
private async Task<ThirdResult> Send(List<ThirdWebapiRecord> records, string send_type, ISqlSugarClient db = null)
{
ThirdResult thirdResult = null;
bool tranFlag = true;
@@ -273,8 +291,6 @@ namespace Tnb.BasicData
Log.Error(e.Message,e);
if(tranFlag) await db.Ado.RollbackTranAsync();
}
return thirdResult;
}
}