包材入库 包材出库 PDA空载具出库bug、其它bug处理
This commit is contained in:
@@ -61,10 +61,9 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
try
|
||||
{
|
||||
Logger.Information("开始PDA空载具出库");
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYOUTSTKPDA_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
|
||||
//判断目标库位是否自动签收
|
||||
BasLocation loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
@@ -85,8 +84,15 @@ namespace Tnb.WarehouseMgr
|
||||
int i = 0;
|
||||
bool isOk = false;
|
||||
|
||||
Logger.Information($"PDA空载具出库实际可出载具数量:{carrys.Count}");
|
||||
|
||||
if (int.Parse(input.data["qty"].ToString())> carrys.Count)
|
||||
{
|
||||
throw new AppFriendlyException($"实际可出空载具数量只有 {carrys.Count}", 500);
|
||||
}
|
||||
|
||||
//根据每个载具的起始库位做路径运算
|
||||
for (i = 0; i < setQty.qty; i++)
|
||||
for (i = 0; i < int.Parse(input.data["qty"].ToString()); i++)
|
||||
{
|
||||
|
||||
if (carrys?.Count > 0)
|
||||
@@ -96,14 +102,26 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
List<WmsPointH>? points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
List<WmsPointH> points = new List<WmsPointH>();
|
||||
if (sPoint.area_code != ePoint.area_code)
|
||||
{
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points.Add(sPoint);
|
||||
points.Add(ePoint);
|
||||
}
|
||||
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYOUTSTKPDA_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
@@ -143,7 +161,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||
}
|
||||
isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||
isOk = await _wareHouseService.GenPreTask(preTasks, null!, _db);
|
||||
|
||||
}
|
||||
if (isOk)
|
||||
@@ -175,37 +193,39 @@ namespace Tnb.WarehouseMgr
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
//生成操作记录表
|
||||
WmsHandleH handleH = new()
|
||||
{
|
||||
org_id = _userManager.User.OrganizeId,
|
||||
startlocation_id = carrys?[i].location_id!,
|
||||
endlocation_id = ePoint!.location_id!,
|
||||
bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!,
|
||||
biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!,
|
||||
carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!,
|
||||
carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!,
|
||||
require_id = input.data["ReturnIdentity"].ToString(),
|
||||
require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now
|
||||
};
|
||||
preTaskUpInput.PreTaskRecord = handleH;
|
||||
//WmsHandleH handleH = new()
|
||||
//{
|
||||
// org_id = _userManager.User.OrganizeId,
|
||||
// startlocation_id = carrys?[i].location_id!,
|
||||
// endlocation_id = ePoint!.location_id!,
|
||||
// bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!,
|
||||
// biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!,
|
||||
// carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!,
|
||||
// carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!,
|
||||
// require_id = input.data["ReturnIdentity"].ToString(),
|
||||
// require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!,
|
||||
// create_id = _userManager.UserId,
|
||||
// create_time = DateTime.Now
|
||||
//};
|
||||
//preTaskUpInput.PreTaskRecord = handleH;
|
||||
//根据空载具出库Id,回更单据状态
|
||||
_ = await _db.Updateable<WmsEmptyOutstockH>().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
|
||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
it => new BasLocation { is_lock = 1 }, _db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("空载具出库错误", ex);
|
||||
Log.Error("PDA空载具出库错误", ex.Message);
|
||||
Log.Error("PDA空载具出库错误", ex.StackTrace);
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user