diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs index 63f2391c..336f4758 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs @@ -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().SingleAsync(it => it.location_code == input.location_code); + var location = await _db.Queryable().SingleAsync(it => it.location_code == input.location_code && it.is_type != EnumLocationType.存储库位.ToString()); var dic = new Dictionary(); dic[nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId(); dic[nameof(WmsEmptyOutstockH.org_id)] = input.org_id; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index 9a5da81b..f1c685d6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -270,7 +270,7 @@ namespace Tnb.WarehouseMgr //入库申请条码明细表 List instockcodes = input.instockcodes.Adapt>(); - var loc = await _db.Queryable().SingleAsync(it => it.location_code == input.instock.location_code); + var loc = await _db.Queryable().SingleAsync(it => it.location_code == input.instock.location_code && it.is_type != EnumLocationType.存储库位.ToString()); var carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.instock.carry_code); //如果数据不全, if (carry.IsNull() || loc.IsNull() || instockds?.Count < 1 || instockcodes?.Count < 1) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index 357de608..b2f552c0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -316,7 +316,7 @@ namespace Tnb.WarehouseMgr //出库申请明细表 List outstockDs = input.outstockDs.Adapt>(); - var location = await _db.Queryable().SingleAsync(it => it.location_code == input.outstock.location_code); + var location = await _db.Queryable().SingleAsync(it => it.location_code == input.outstock.location_code && it.is_type != EnumLocationType.存储库位.ToString()); //如果数据不全, if (location.IsNull() || outstockDs?.Count < 1) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 79fff1cd..71fb5512 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -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().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> whereExp = (ko.carry_id != null) ? a=>a.id == ko.carry_id : a => a.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID; + var carrys = await _db.Queryable() .InnerJoin((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!;