完善日志 bug处理
This commit is contained in:
@@ -272,7 +272,28 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($@"当前实际托盘数量为{input.palletCount} 实际库存数量为{qty},与前台数据不一致,请重新获取库存", HttpStatusCode.InternalServerError);
|
||||
}
|
||||
|
||||
foreach(var wmsCarryH in items)
|
||||
List<BasLocation> endLocations = new List<BasLocation>();
|
||||
// 集中供料区三工位
|
||||
if (wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_JZGL_ID)
|
||||
{
|
||||
// 根据三工位任务数平均分配任务 暂定
|
||||
endLocations = _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1GLSGWOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0")
|
||||
.OrderBy("is_lock, task_nums, location_code").ToList();
|
||||
}
|
||||
// 中储仓三工位
|
||||
else if (wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
// 根据三工位任务数平均分配任务 暂定
|
||||
endLocations = _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1WXSGWOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0")
|
||||
.OrderBy("is_lock, task_nums, location_code").ToList();
|
||||
}
|
||||
|
||||
if (endLocations.Count() < input.palletCount)
|
||||
{
|
||||
throw new AppFriendlyException($@"可用的终点库位数量为{endLocations.Count()}个 下发数量为{input.palletCount}个 请检查终点库位的锁定和占用状态", 500);
|
||||
}
|
||||
|
||||
foreach (var wmsCarryH in items)
|
||||
{
|
||||
WmsCarryCode wmsCarryCode = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).FirstAsync();
|
||||
BasLocation startLocation = await _db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.location_code).FirstAsync();
|
||||
@@ -282,13 +303,18 @@ namespace Tnb.WarehouseMgr
|
||||
if (wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_JZGL_ID)
|
||||
{
|
||||
// 根据三工位任务数平均分配任务 暂定
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1GLSGWOutstockLocation().Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1GLSGWOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
}
|
||||
// 中储仓三工位
|
||||
else if(wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
// 根据三工位任务数平均分配任务 暂定
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1WXSGWOutstockLocation().Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1WXSGWOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
}
|
||||
|
||||
if (endLocation == null)
|
||||
{
|
||||
throw new AppFriendlyException($@"没有可用的终点库位!请检查终点库位的锁定和占用状态", 500);
|
||||
}
|
||||
|
||||
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
||||
@@ -299,6 +325,7 @@ namespace Tnb.WarehouseMgr
|
||||
commonCreatePretaskInput.require_id = input.source_id;
|
||||
commonCreatePretaskInput.carry_id = wmsCarryH.id;
|
||||
commonCreatePretaskInput.carry_code = wmsCarryH.carry_code;
|
||||
commonCreatePretaskInput.isExcuteMission = false;
|
||||
|
||||
Entities.Dto.Outputs.Result res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput);
|
||||
|
||||
@@ -317,6 +344,8 @@ namespace Tnb.WarehouseMgr
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
Logger.LogError("【Distribute】" + ex.Message);
|
||||
Logger.LogError("【Distribute】" + ex.StackTrace);
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
finally
|
||||
@@ -334,14 +363,14 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
WmsCarryCode wmsCarryCode = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == input.carryIds[0]).SingleAsync();
|
||||
if (wmsCarryCode == null)
|
||||
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == input.carryIds[0]).ToListAsync();
|
||||
if (wmsCarryCodes.Count == 0)
|
||||
{
|
||||
Logger.LogWarning($"【ModifyAsync】载具{input.carryIds[0]}没有绑定物料条码");
|
||||
return;
|
||||
}
|
||||
// 更新已转数量
|
||||
bool isOk = await _db.Updateable<WmsMaterialTransferD>().SetColumns(it => new WmsMaterialTransferD { yzqty = it.yzqty + wmsCarryCode.codeqty })
|
||||
bool isOk = await _db.Updateable<WmsMaterialTransferD>().SetColumns(it => new WmsMaterialTransferD { yzqty = it.yzqty + wmsCarryCodes.Sum(r => r.codeqty)})
|
||||
.Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
|
||||
// 如果所有明细已完成 更新主表状态为完成
|
||||
@@ -401,7 +430,7 @@ namespace Tnb.WarehouseMgr
|
||||
material_id = wmsMaterialTransferD.material_id,
|
||||
code_batch = wmsMaterialTransferD.code_batch
|
||||
};
|
||||
List<WmsCarryH>? carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||
List<WmsCarryH>? carrys = await _wareHouseService.OutStockStrategyZCC2Floor2(OutStockStrategyInput);
|
||||
|
||||
// 需要转库数量
|
||||
decimal? needOut = wmsMaterialTransferD.qty;
|
||||
@@ -412,8 +441,16 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
break;
|
||||
}
|
||||
WmsCarryCode wmsCarryCode = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).First();
|
||||
needOut -= wmsCarryCode.codeqty;
|
||||
|
||||
List<WmsCarryCode> wmsCarryCodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).ToList();
|
||||
|
||||
WmsCarryCode wmsCarryCode = wmsCarryCodes.First();
|
||||
|
||||
// 目前只支持一个料箱只有一个物料
|
||||
foreach (WmsCarryCode _wmsCarryCode in wmsCarryCodes)
|
||||
{
|
||||
needOut -= wmsCarryCode.codeqty;
|
||||
}
|
||||
|
||||
BasLocation endlocation_ssx = await _db.Queryable<BasLocation>().Where(r => new string[2] { "32609229889045", "32609238573589" }.Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
await _db.Updateable<BasLocation>().SetColumns(it => it.task_nums == it.task_nums + 1).Where(it => endlocation_ssx.id == it.id).ExecuteCommandAsync();
|
||||
|
||||
Reference in New Issue
Block a user