生产提报加锁
This commit is contained in:
@@ -76,6 +76,7 @@ namespace Tnb.ProductionMgr
|
|||||||
private readonly IWmsCarryService _wmsCarryService;
|
private readonly IWmsCarryService _wmsCarryService;
|
||||||
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||||
private readonly RedisData _redisData;
|
private readonly RedisData _redisData;
|
||||||
|
private static SemaphoreSlim prdreportSemaphore = new(1);
|
||||||
|
|
||||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
public PrdMoTaskService(
|
public PrdMoTaskService(
|
||||||
@@ -1608,6 +1609,9 @@ namespace Tnb.ProductionMgr
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<dynamic> PrdReport(PrdReportCrInput input)
|
public async Task<dynamic> PrdReport(PrdReportCrInput input)
|
||||||
|
{
|
||||||
|
await prdreportSemaphore.WaitAsync();
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Log.Information($"生产提报参数:{JsonConvert.SerializeObject(input)}");
|
Log.Information($"生产提报参数:{JsonConvert.SerializeObject(input)}");
|
||||||
ISqlSugarClient db = _repository.AsSugarClient();
|
ISqlSugarClient db = _repository.AsSugarClient();
|
||||||
@@ -1633,8 +1637,7 @@ namespace Tnb.ProductionMgr
|
|||||||
};
|
};
|
||||||
string materialBoxCode = input.material_box_code;
|
string materialBoxCode = input.material_box_code;
|
||||||
BasLocation location = null;
|
BasLocation location = null;
|
||||||
try
|
|
||||||
{
|
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
int row = -1;
|
int row = -1;
|
||||||
PrdMo prdMo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
PrdMo prdMo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
||||||
@@ -2181,6 +2184,9 @@ namespace Tnb.ProductionMgr
|
|||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
throw Oops.Bah("提报失败:"+ex.Message);
|
throw Oops.Bah("提报失败:"+ex.Message);
|
||||||
}
|
}
|
||||||
|
finally{
|
||||||
|
prdreportSemaphore.Release();
|
||||||
|
}
|
||||||
|
|
||||||
// DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
// DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||||
// {
|
// {
|
||||||
|
|||||||
Reference in New Issue
Block a user