Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -77,16 +77,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
//判断目标库位是否自动签收
|
//判断目标库位是否自动签收
|
||||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
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 carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((a, b) => a.location_id == b.id)
|
var outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||||
.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 (carrys?.Count > 0)
|
if (outStkCarrys?.Count > 0)
|
||||||
{
|
{
|
||||||
var curCarry = carrys[^carrys.Count];
|
var curCarry = outStkCarrys[^outStkCarrys.Count];
|
||||||
var isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, loc);
|
var isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, loc);
|
||||||
if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500);
|
if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500);
|
||||||
}
|
}
|
||||||
@@ -102,12 +99,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);
|
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString() && it.is_lock == 0);
|
||||||
}
|
}
|
||||||
//根据每个载具的起始库位做路径运算
|
//根据每个载具的起始库位做路径运算
|
||||||
if (carrys?.Count > 0)
|
if (outStkCarrys?.Count > 0)
|
||||||
{
|
{
|
||||||
int min = (carrys.Count > setQty.qty) ? setQty.qty : carrys.Count;
|
int min = (outStkCarrys.Count > setQty.qty) ? setQty.qty : outStkCarrys.Count;
|
||||||
for (int i = 0; i < min; i++)
|
for (int i = 0; i < min; i++)
|
||||||
{
|
{
|
||||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carrys[i].location_id);
|
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == outStkCarrys[i].location_id);
|
||||||
|
|
||||||
var isOk = false;
|
var isOk = false;
|
||||||
if (sPoint != null && ePoint != null)
|
if (sPoint != null && ePoint != null)
|
||||||
@@ -135,8 +132,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
||||||
biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID,
|
biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID,
|
||||||
task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID,
|
task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID,
|
||||||
carry_id = carrys![i].id,
|
carry_id = outStkCarrys![i].id,
|
||||||
carry_code = carrys![i].carry_code,
|
carry_code = outStkCarrys![i].carry_code,
|
||||||
area_id = sPoint?.area_id!,
|
area_id = sPoint?.area_id!,
|
||||||
area_code = it.Key,
|
area_code = it.Key,
|
||||||
require_id = input.data["ReturnIdentity"].ToString(),
|
require_id = input.data["ReturnIdentity"].ToString(),
|
||||||
@@ -160,7 +157,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
GenPreTaskUpInput preTaskUpInput = new()
|
GenPreTaskUpInput preTaskUpInput = new()
|
||||||
{
|
{
|
||||||
RquireId = input.data["ReturnIdentity"].ToString()!,
|
RquireId = input.data["ReturnIdentity"].ToString()!,
|
||||||
CarryId = carrys![i].id,
|
CarryId = outStkCarrys![i].id,
|
||||||
CarryStartLocationId = points!.FirstOrDefault()!.location_id!,
|
CarryStartLocationId = points!.FirstOrDefault()!.location_id!,
|
||||||
CarryStartLocationCode = points!.FirstOrDefault()!.location_code!,
|
CarryStartLocationCode = points!.FirstOrDefault()!.location_code!,
|
||||||
LocationIds = points!.Select(x => x.location_id).ToList()!
|
LocationIds = points!.Select(x => x.location_id).ToList()!
|
||||||
@@ -174,8 +171,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID,
|
biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID,
|
||||||
location_id = ePoint.location_id!,
|
location_id = ePoint.location_id!,
|
||||||
status = WmsWareHouseConst.BILLSTATUS_ON_ID,
|
status = WmsWareHouseConst.BILLSTATUS_ON_ID,
|
||||||
carry_id = carrys[i].id,
|
carry_id = outStkCarrys[i].id,
|
||||||
carry_code = carrys[i].carry_code,
|
carry_code = outStkCarrys[i].carry_code,
|
||||||
create_id = _userManager.UserId,
|
create_id = _userManager.UserId,
|
||||||
create_time = DateTime.Now
|
create_time = DateTime.Now
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -92,16 +92,19 @@ namespace Tnb.WarehouseMgr
|
|||||||
List<WmsCarryCode> carryCodes = new();
|
List<WmsCarryCode> carryCodes = new();
|
||||||
foreach (var os in outStockDList)
|
foreach (var os in outStockDList)
|
||||||
{
|
{
|
||||||
var OutStockStrategyInput = new OutStockStrategyQuery { carry_id = input.data[nameof(OutStockStrategyQuery.carry_id)].ToString(), Size = 1 };
|
var OutStockStrategyInput = new OutStockStrategyQuery {
|
||||||
|
carry_id = input.data[nameof(OutStockStrategyQuery.carry_id)].ToString(),
|
||||||
|
warehouse_id = input.data[nameof(WmsOutstockH.warehouse_id)].ToString(),
|
||||||
|
material_id = os.material_id,
|
||||||
|
code_batch = os.code_batch,
|
||||||
|
};
|
||||||
var outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
var outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||||
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||||
.Where((a,b) => b.carry_id == outStkCarrys[0].id)
|
.Where((a,b) => outStkCarrys.Select(x=>x.id).Contains(b.carry_id))
|
||||||
.Select<WmsCarryCode>()
|
.Select<WmsCarryCode>()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (carryCodesPart?.Count > 0)
|
if (carryCodesPart?.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var codeQty = carryCodesPart.Sum(x => x.codeqty);
|
var codeQty = carryCodesPart.Sum(x => x.codeqty);
|
||||||
if (codeQty < os.pr_qty)
|
if (codeQty < os.pr_qty)
|
||||||
{
|
{
|
||||||
@@ -356,8 +359,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
List<WmsCarryMat> carryMats = new();
|
List<WmsCarryMat> carryMats = new();
|
||||||
List<WmsCarryCode> carryCodes = new();
|
List<WmsCarryCode> carryCodes = new();
|
||||||
|
|
||||||
|
|
||||||
foreach (var os in outStockDList)
|
foreach (var os in outStockDList)
|
||||||
{
|
{
|
||||||
var whereExp = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
var whereExp = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
||||||
|
|||||||
@@ -77,22 +77,23 @@ namespace Tnb.WarehouseMgr
|
|||||||
List<WmsCarryCode> carryCodes = new();
|
List<WmsCarryCode> carryCodes = new();
|
||||||
List<string> carryIds = new();
|
List<string> carryIds = new();
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
foreach (var os in setSortingDList)
|
foreach (var os in setSortingDList)
|
||||||
{
|
{
|
||||||
var whereExpr = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
var OutStockStrategyInput = new OutStockStrategyQuery {
|
||||||
.And((a, b, c) => a.is_lock == 0)
|
carry_id = carryMat.carry_id,
|
||||||
.And((a, b, c) => !string.IsNullOrEmpty(a.location_id))
|
material_id = os.material_id,
|
||||||
.And((a, b, c) => a.status == (int)EnumCarryStatus.占用)
|
warehouse_id = os.warehouse_id,
|
||||||
.And((a, b, c) => b.material_id == os.material_id)
|
code_batch = os.code_batch,
|
||||||
.And((a, b, c) => c.wh_id == os.warehouse_id)
|
};
|
||||||
.AndIF(!string.IsNullOrEmpty(os.code_batch), (a, b, c) => b.code_batch == os.code_batch)
|
var outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||||
.ToExpression();
|
|
||||||
;
|
|
||||||
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||||
.Where(whereExpr)
|
.Where((a, b) => outStkCarrys.Select(x=>x.id).Contains(b.carry_id))
|
||||||
.Select<WmsCarryCode>()
|
.Select<WmsCarryCode>()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
if (carryCodesPart?.Count > 0)
|
if (carryCodesPart?.Count > 0)
|
||||||
{
|
{
|
||||||
carryCodes.AddRange(carryCodesPart);
|
carryCodes.AddRange(carryCodesPart);
|
||||||
|
|||||||
Reference in New Issue
Block a user