齐套出库,寄存出库,业务回更新增清空载具

This commit is contained in:
alex
2023-06-28 16:29:05 +08:00
parent e4c0f1ab18
commit 40da9b1afe
2 changed files with 47 additions and 6 deletions

View File

@@ -39,13 +39,15 @@ namespace Tnb.WarehouseMgr
private readonly IWareHouseService _wareHouseService;
private readonly IBillRullService _billRullService;
private readonly IUserManager _userManager;
private readonly IWmsCarryService _wmsCarryService;
public WmsOutBaleService(
ISqlSugarRepository<WmsCarryH> repository,
IRunService runService,
IVisualDevService visualDevService,
IWareHouseService wareHouseService,
IUserManager userManager,
IBillRullService billRullService)
IBillRullService billRullService,
IWmsCarryService wmsCarryService)
{
_db = repository.AsSugarClient();
_runService = runService;
@@ -53,6 +55,7 @@ namespace Tnb.WarehouseMgr
_wareHouseService = wareHouseService;
_userManager = userManager;
_billRullService = billRullService;
_wmsCarryService = wmsCarryService;
OverideFuncs.CreateAsync = CarryOutBale;
}
@@ -154,8 +157,25 @@ namespace Tnb.WarehouseMgr
public override async Task ModifyAsync(WareHouseUpInput input)
{
if (input == null) throw new ArgumentNullException(nameof(input));
var isOk = await _db.Updateable<WmsOutbale>().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
try
{
await _db.Ado.BeginTranAsync();
var isOk = await _db.Updateable<WmsOutbale>().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
var carryId = input.carryIds[^input.carryIds.Count];
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
var row = await _wmsCarryService.UpdateNullCarry(carry);
isOk = row > 0;
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
await _db.Ado.CommitTranAsync();
}
catch (Exception)
{
await _db.Ado.RollbackTranAsync();
throw;
}
}
}
}

View File

@@ -33,13 +33,15 @@ namespace Tnb.WarehouseMgr
private readonly IWareHouseService _warehouseService;
private readonly IUserManager _userManager;
private readonly IBillRullService _billRullService;
private readonly IWmsCarryService _carryService;
private const string BizTypeId = "26169472620837";
public WmskittingOutService(ISqlSugarRepository<WmsKittingoutH> repository, IWareHouseService warehouseService, IUserManager userManager, IBillRullService billRullService)
public WmskittingOutService(ISqlSugarRepository<WmsKittingoutH> repository, IWareHouseService warehouseService, IUserManager userManager, IBillRullService billRullService, IWmsCarryService carryService)
{
_db = repository.AsSugarClient();
_warehouseService = warehouseService;
_userManager = userManager;
_billRullService = billRullService;
_carryService = carryService;
}
/// <summary>
/// 齐套出库(新增状态)
@@ -193,8 +195,27 @@ namespace Tnb.WarehouseMgr
public override async Task ModifyAsync(WareHouseUpInput input)
{
if (input == null) throw new ArgumentNullException(nameof(input));
var isOk = await _db.Updateable<WmsKittingoutH>().SetColumns(it => new WmsKittingoutH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
try
{
await _db.Ado.BeginTranAsync();
var isOk = await _db.Updateable<WmsKittingoutH>().SetColumns(it => new WmsKittingoutH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
var carryId = input.carryIds[^input.carryIds.Count];
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
if (carry != null)
{
var row = await _carryService.UpdateNullCarry(carry);
isOk = row > 0;
}
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
await _db.Ado.CommitTranAsync();
}
catch (Exception)
{
await _db.Ado.RollbackTranAsync();
throw;
}
}
}