空载具出库新增事务操作

This commit is contained in:
alex
2023-06-20 14:49:06 +08:00
parent 7aec24710d
commit 8f4f65f67b

View File

@@ -186,6 +186,10 @@ namespace Tnb.WarehouseMgr
public async override Task ModifyAsync(WareHouseUpInput input) public async override Task ModifyAsync(WareHouseUpInput input)
{ {
if (input == null) throw new ArgumentNullException(nameof(input)); if (input == null) throw new ArgumentNullException(nameof(input));
try
{
await _db.Ado.BeginTranAsync();
//根据载具更新明细表状态 //根据载具更新明细表状态
var isOk = await _db.Updateable<WmsEmptyOutstockD>().SetColumns(it => new WmsEmptyOutstockD { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.bill_id == input.requireId && input.carryIds.Contains(it.carry_id)).ExecuteCommandHasChangeAsync(); var isOk = await _db.Updateable<WmsEmptyOutstockD>().SetColumns(it => new WmsEmptyOutstockD { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.bill_id == input.requireId && input.carryIds.Contains(it.carry_id)).ExecuteCommandHasChangeAsync();
@@ -193,9 +197,17 @@ namespace Tnb.WarehouseMgr
// 判断所有明细是否都完成 // 判断所有明细是否都完成
if (emptyCarrys?.Count > 0 && emptyCarrys.All(x => x.status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) if (emptyCarrys?.Count > 0 && emptyCarrys.All(x => x.status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
{ {
await _db.Updateable<WmsEmptyOutstockH>().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); isOk = await _db.Updateable<WmsEmptyOutstockH>().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
} }
if (!isOk) throw Oops.Oh(ErrorCode.COM1001); if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
await _db.Ado.CommitTranAsync();
}
catch (Exception)
{
await _db.Ado.RollbackTranAsync();
throw;
}
} }
} }
} }