二楼下升降机机械手边调度逻辑

This commit is contained in:
2024-05-06 10:49:25 +08:00
parent 18ff3b29ed
commit 87d8da928a
7 changed files with 693 additions and 155 deletions

View File

@@ -128,7 +128,7 @@ namespace Tnb.WarehouseMgr
}
await _db.Ado.CommitTranAsync();
}
catch (Exception)
catch (Exception ex)
{
await _db.Ado.RollbackTranAsync();
throw;
@@ -170,8 +170,104 @@ namespace Tnb.WarehouseMgr
}
}
/// <summary>
/// 二楼机械手
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="AppFriendlyException"></exception>
[NonAction]
public async Task<dynamic> CarryBindFloor2UpDownMachine(CarryBindFloor2UpDownMachineInput input)
{
bool isOk = false;
try
{
if (input == null)
{
throw new ArgumentNullException(nameof(input));
}
WmsCarryH? carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
WmsCarryH? subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.membercarry_id);
if (carry != null && subCarry != null)
{
WmsCarrybindH wmsCarrybindH = new()
{
carry_id = input.carry_id,
carry_code = input.carry_code,
membercarry_id = input.membercarry_id,
membercarry_code = input.membercarry_code,
loc = 1,
type = 0,
create_time = DateTime.Now
};
int row = await _db.Insertable(wmsCarrybindH).ExecuteCommandAsync();
isOk = row > 0;
if (!isOk)
{
throw Oops.Oh(ErrorCode.COM1001);
}
}
else
{
if (carry == null || subCarry == null)
{
throw new AppFriendlyException("没有可用的主载具", 500);
}
}
}
catch (Exception ex)
{
}
return Task.FromResult(true);
}
/// <summary>
/// 二楼机械手解绑定
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="AppFriendlyException"></exception>
[NonAction]
public async Task<dynamic> CarryUnbindFloor2UpDownMachine(CarryBindFloor2UpDownMachineInput input)
{
bool isOk = false;
try
{
if (input == null)
{
throw new ArgumentNullException(nameof(input));
}
WmsCarryH? carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
WmsCarryH? subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.membercarry_id);
if (carry != null && subCarry != null)
{
int row = await _db.Deleteable<WmsCarrybindH>().Where(r => r.carry_id == input.carry_id && r.membercarry_id == input.membercarry_id).ExecuteCommandAsync();
isOk = row > 0;
if (!isOk)
{
throw Oops.Oh(ErrorCode.COM1001);
}
}
else
{
if (carry == null || subCarry == null)
{
throw new AppFriendlyException("没有可用的主载具", 500);
}
}
}
catch (Exception ex)
{
}
return Task.FromResult(true);
}
/* public override async Task ModifyAsync(WareHouseUpInput input)
{
if (input == null) throw new ArgumentNullException(nameof(input));