齐套分拣的org_id 的user可能为空,空载具出库出库策略更改
This commit is contained in:
@@ -77,13 +77,16 @@ namespace Tnb.WarehouseMgr
|
||||
//判断目标库位是否自动签收
|
||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
//出库取起点,获取所有符合输入的载具规格的载具
|
||||
var OutStockStrategyInput = new OutStockStrategyQuery { carry_id = input.data[nameof(OutStockStrategyQuery.carry_id)].ToString() };
|
||||
var outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||
|
||||
//var OutStockStrategyInput = new OutStockStrategyQuery { carry_id = input.data[nameof(OutStockStrategyQuery.carry_id)].ToString() };
|
||||
//var carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||
var carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((a, b) => a.location_id == b.id)
|
||||
.Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString()
|
||||
&& a.carry_status == ((int)EnumCarryStatus.空闲).ToString() && a.is_lock == 0 && b.is_lock == 0 && b.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.ToListAsync();
|
||||
// 判断最终目标库位是否可以放置当前载具
|
||||
if (outStkCarrys?.Count > 0)
|
||||
if (carrys?.Count > 0)
|
||||
{
|
||||
var curCarry = outStkCarrys[^outStkCarrys.Count];
|
||||
var curCarry = carrys[^carrys.Count];
|
||||
var isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, loc);
|
||||
if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500);
|
||||
}
|
||||
@@ -99,12 +102,12 @@ namespace Tnb.WarehouseMgr
|
||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString() && it.is_lock == 0);
|
||||
}
|
||||
//根据每个载具的起始库位做路径运算
|
||||
if (outStkCarrys?.Count > 0)
|
||||
if (carrys?.Count > 0)
|
||||
{
|
||||
int min = (outStkCarrys.Count > setQty.qty) ? setQty.qty : outStkCarrys.Count;
|
||||
int min = (carrys.Count > setQty.qty) ? setQty.qty : carrys.Count;
|
||||
for (int i = 0; i < min; i++)
|
||||
{
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == outStkCarrys[i].location_id);
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carrys[i].location_id);
|
||||
|
||||
var isOk = false;
|
||||
if (sPoint != null && ePoint != null)
|
||||
@@ -136,8 +139,8 @@ namespace Tnb.WarehouseMgr
|
||||
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
||||
biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID,
|
||||
task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID,
|
||||
carry_id = outStkCarrys![i].id,
|
||||
carry_code = outStkCarrys![i].carry_code,
|
||||
carry_id = carrys![i].id,
|
||||
carry_code = carrys![i].carry_code,
|
||||
area_id = sPoint?.area_id!,
|
||||
area_code = it.Key,
|
||||
require_id = input.data["ReturnIdentity"].ToString(),
|
||||
@@ -161,7 +164,7 @@ namespace Tnb.WarehouseMgr
|
||||
GenPreTaskUpInput preTaskUpInput = new()
|
||||
{
|
||||
RquireId = input.data["ReturnIdentity"].ToString()!,
|
||||
CarryId = outStkCarrys![i].id,
|
||||
CarryId = carrys![i].id,
|
||||
CarryStartLocationId = points!.FirstOrDefault()!.location_id!,
|
||||
CarryStartLocationCode = points!.FirstOrDefault()!.location_code!,
|
||||
LocationIds = points!.Select(x => x.location_id).ToList()!
|
||||
@@ -175,8 +178,8 @@ namespace Tnb.WarehouseMgr
|
||||
biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID,
|
||||
location_id = ePoint.location_id!,
|
||||
status = WmsWareHouseConst.BILLSTATUS_ON_ID,
|
||||
carry_id = outStkCarrys[i].id,
|
||||
carry_code = outStkCarrys[i].carry_code,
|
||||
carry_id = carrys[i].id,
|
||||
carry_code = carrys[i].carry_code,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now
|
||||
};
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace Tnb.WarehouseMgr
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.bill_id = input.requireId;
|
||||
x.bill_d_id = billDId!;
|
||||
x.org_id = _userManager.User.OrganizeId;
|
||||
x.org_id = ssds?.Select(xx=>xx.org_id).FirstOrDefault() ?? string.Empty;
|
||||
x.create_id = _userManager.UserId;
|
||||
x.create_time = DateTime.Now;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user