增加存储库位判断,限制条件

This commit is contained in:
FanLian
2023-07-17 17:06:57 +08:00
parent 0a1d4db247
commit 2509eb739d
4 changed files with 13 additions and 7 deletions

View File

@@ -171,7 +171,7 @@ namespace Tnb.WarehouseMgr
it => new BasLocation { is_lock = 1 });
}
}
else
else
{
throw new AppFriendlyException("无可出库的空载具或目标库位不存在或者目标库位被锁", 500);
}
@@ -226,7 +226,7 @@ namespace Tnb.WarehouseMgr
if (input.IsNull()) throw new ArgumentNullException("input");
try
{
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code);
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code && it.is_type != EnumLocationType..ToString());
var dic = new Dictionary<string, object>();
dic[nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId();
dic[nameof(WmsEmptyOutstockH.org_id)] = input.org_id;

View File

@@ -270,7 +270,7 @@ namespace Tnb.WarehouseMgr
//入库申请条码明细表
List<WmsInstockCode> instockcodes = input.instockcodes.Adapt<List<WmsInstockCode>>();
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.instock.location_code);
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.instock.location_code && it.is_type != EnumLocationType..ToString());
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.instock.carry_code);
//如果数据不全,
if (carry.IsNull() || loc.IsNull() || instockds?.Count < 1 || instockcodes?.Count < 1)

View File

@@ -316,7 +316,7 @@ namespace Tnb.WarehouseMgr
//出库申请明细表
List<WmsOutstockD> outstockDs = input.outstockDs.Adapt<List<WmsOutstockD>>();
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.outstock.location_code);
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.outstock.location_code && it.is_type != EnumLocationType..ToString());
//如果数据不全,
if (location.IsNull() || outstockDs?.Count < 1)
{

View File

@@ -13,6 +13,7 @@ using JNPF.Common.Enums;
using JNPF.Common.Extension;
using JNPF.Common.Security;
using JNPF.FriendlyException;
using JNPF.LinqBuilder;
using JNPF.Logging;
using JNPF.Systems.Interfaces.System;
using Mapster;
@@ -70,20 +71,25 @@ namespace Tnb.WarehouseMgr
// var set = true ; 如果有 把set修改为false
var items = await _db.Queryable<WmsKittingoutH>().Where(it => it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID).ToListAsync();
var isCalled = items?.Count > 0;
if (kittingOuts?.Count > 0)
{
foreach (var ko in kittingOuts)
{
//a.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID
Expression<Func<WmsCarryH, bool>> whereExp = (ko.carry_id != null) ? a=>a.id == ko.carry_id : a => a.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID;
var carrys = await _db.Queryable<WmsCarryH>()
.InnerJoin<WmsCollocationSchemeH>((a, b) => a.collocation_scheme_id == b.id)
.Where(a => a.collocation_scheme_id == ko.collocation_scheme_id && a.is_lock == 0)
.Where(whereExp.And(a => a.collocation_scheme_id == ko.collocation_scheme_id && a.is_lock == 0))
.OrderBy((a, b) => b.seq)
.ToListAsync();
if (carrys?.Count > 0)
{
var firstCarry = carrys.FirstOrDefault();
GenPreTaskUpInput genPreTaskInput = new() { CarryId = firstCarry?.id };
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1 }, null!);
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1 , out_status = EnumOutStatus..ToString()}, null!);
ko.status = WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID;
ko.carry_id = firstCarry?.id;
ko.carry_code = firstCarry?.carry_code;
@@ -185,7 +191,7 @@ namespace Tnb.WarehouseMgr
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
preTask.biz_type = ko.biz_type;
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
preTask.carry_id = ko!.carry_id!;
preTask.carry_code = ko!.carry_code!;
preTask.area_id = sPoint?.area_id!;