物料签收erp接口调用失败不回滚

This commit is contained in:
2024-09-26 10:49:45 +08:00
parent e9c8b52354
commit c11c677cb0

View File

@@ -81,8 +81,9 @@ namespace Tnb.WarehouseMgr
/// <exception cref="ArgumentNullException"></exception> /// <exception cref="ArgumentNullException"></exception>
/// <exception cref="AppFriendlyException"></exception> /// <exception cref="AppFriendlyException"></exception>
[HttpPost] [HttpPost]
public async Task MaterialSign(MaterialSignInput input) public async Task<dynamic> MaterialSign(MaterialSignInput input)
{ {
string msg = "成功";
try try
{ {
if (input == null) if (input == null)
@@ -452,7 +453,8 @@ namespace Tnb.WarehouseMgr
BasFactoryConfig callErp = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.CALLERP); BasFactoryConfig callErp = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.CALLERP);
if(callErp.value=="1"){ if(callErp.value=="1"){
await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord }, "自动", _db); ThirdResult thirdResult = await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord }, "自动", _db);
msg = thirdResult.msgResult;
} }
break; break;
@@ -564,10 +566,11 @@ namespace Tnb.WarehouseMgr
if(callErp2.value=="1"){ if(callErp2.value=="1"){
ThirdResult thirdResult = await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord }, "自动", _db); ThirdResult thirdResult = await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord }, "自动", _db);
Logger.LogInformation($"【WmsMaterialSignHService ModifyAsync】thirdResult {JsonConvert.SerializeObject(thirdResult)}"); Logger.LogInformation($"【WmsMaterialSignHService ModifyAsync】thirdResult {JsonConvert.SerializeObject(thirdResult)}");
if (thirdResult.Code!=200) // if (thirdResult.Code!=200)
{ // {
throw Oops.Bah(thirdResult.msgResult ?? "erp接口调用失败"); // throw Oops.Bah(thirdResult.msgResult ?? "erp接口调用失败");
} // }
msg = thirdResult.msgResult;
} }
if (wmsMaterialTransfer.type == WmsWareHouseConst.MATERIALTRANSFER_JZGLRK_CODE if (wmsMaterialTransfer.type == WmsWareHouseConst.MATERIALTRANSFER_JZGLRK_CODE
@@ -644,10 +647,12 @@ namespace Tnb.WarehouseMgr
if(callErp2.value=="1"){ if(callErp2.value=="1"){
ThirdResult thirdResult = await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord2 }, "自动", _db); ThirdResult thirdResult = await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord2 }, "自动", _db);
if (thirdResult.Code!=200) // if (thirdResult.Code!=200)
{ // {
throw Oops.Bah(thirdResult.msgResult); // throw Oops.Bah(thirdResult.msgResult);
} // }
msg = thirdResult.msgResult;
} }
} }
break; break;
@@ -665,6 +670,8 @@ namespace Tnb.WarehouseMgr
await _db.Ado.RollbackTranAsync(); await _db.Ado.RollbackTranAsync();
throw new AppFriendlyException($"【MaterialSign】物料签收失败 {ex.Message}", 500); throw new AppFriendlyException($"【MaterialSign】物料签收失败 {ex.Message}", 500);
} }
return msg;
} }
} }