erp转库单同步
This commit is contained in:
@@ -393,19 +393,34 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.BeginTranAsync();
|
||||
try
|
||||
{
|
||||
|
||||
WmsCarryH wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
|
||||
if (wmsCarryH == null)
|
||||
{
|
||||
Logger.Error($"【FinishproductOutstockSign】请扫描正确的载具条码");
|
||||
throw new AppFriendlyException($"请扫描正确的载具条码", 500);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(wmsCarryH.location_id))
|
||||
{
|
||||
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!");
|
||||
throw new AppFriendlyException("FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!", 500);
|
||||
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!可能是重复签收");
|
||||
throw new AppFriendlyException($"载具 {input.carry_code}没有当前库位 不能签收!可能是重复签收", 500);
|
||||
}
|
||||
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
||||
BasLocation location = _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).First();
|
||||
if (string.IsNullOrEmpty(location.location_code))
|
||||
{
|
||||
is_lock = 0,
|
||||
carry_status = "0"
|
||||
}).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
||||
Logger.Error($"【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!");
|
||||
throw new AppFriendlyException($"库位id {wmsCarryH.location_id}没有对应的库位基础资料!", 500);
|
||||
}
|
||||
|
||||
WmsDistaskH wmsDistaskH = _db.Queryable<WmsDistaskH>().Where(r => r.carry_code == input.carry_code && r.endlocation_id == location.id
|
||||
&& r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID).First();
|
||||
if (wmsDistaskH != null)
|
||||
{
|
||||
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code} 库位 {location.location_code}有正在执行的任务,不允许签收!");
|
||||
throw new AppFriendlyException($"载具 {input.carry_code} 库位 {location.location_code}有正在执行的任务,不允许签收!", 500);
|
||||
}
|
||||
|
||||
await _db.Updateable<BasLocation>().SetColumns(r => new BasLocation
|
||||
{
|
||||
@@ -413,12 +428,15 @@ namespace Tnb.WarehouseMgr
|
||||
is_use = "0"
|
||||
}).Where(r => r.id == wmsCarryH.location_id).ExecuteCommandAsync();
|
||||
|
||||
BasLocation location = _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).First();
|
||||
if (string.IsNullOrEmpty(location.location_code))
|
||||
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
||||
{
|
||||
Logger.Error($"【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!");
|
||||
throw new AppFriendlyException("【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!", 500);
|
||||
}
|
||||
location_id = "",
|
||||
location_code = "",
|
||||
is_lock = 0,
|
||||
carry_status = "0"
|
||||
}).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
||||
|
||||
await _db.Updateable<WmsPointH>().SetColumns(r => new WmsPointH
|
||||
{
|
||||
is_lock = 0
|
||||
@@ -430,9 +448,10 @@ namespace Tnb.WarehouseMgr
|
||||
if (result.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||
{
|
||||
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}解绑失败!");
|
||||
throw new AppFriendlyException("【FinishproductOutstockSign】载具 {input.carry_code}解绑失败!", 500);
|
||||
throw new AppFriendlyException($"载具 {input.carry_code}解绑失败!", 500);
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
Logger.LogInformation($"【FinishproductOutstockSign】载具签收成功 载具:{input.carry_code} 库位:{location.location_code}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user