收货控制 自动空托盘出库调整

This commit is contained in:
2024-10-18 14:42:23 +08:00
parent 013c706b42
commit f365035a89
3 changed files with 24 additions and 3 deletions

View File

@@ -579,6 +579,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
} }
// 未锁定且已占用且库位中没有记录托盘 此时认为是叠盘机送过来的 // 未锁定且已占用且库位中没有记录托盘 此时认为是叠盘机送过来的
// 20241018 业务变更 后续删除
var wmsLoc = db_BGWCarrySupplementtimer.Queryable<BasLocation>() var wmsLoc = db_BGWCarrySupplementtimer.Queryable<BasLocation>()
.LeftJoin<WmsCarryH>((a, b) => a.id == b.location_id) .LeftJoin<WmsCarryH>((a, b) => a.id == b.location_id)
.Where((a, b) => a.is_lock == 0 && a.is_use == "1" .Where((a, b) => a.is_lock == 0 && a.is_use == "1"
@@ -606,7 +607,23 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
return false; return false;
else else
return true; return true;
}).Select(r => r.Key); }).Select(r => r.Key).ToList();
wmsLoc.Clear();
if (wmsLoc.Count() == 0)
{
OutStockStrategyQuery OutStockStrategyInput = new()
{
carrystd_id = WmsWareHouseConst.CARRY_TP_ID,
warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID,
Size = 1
};
List<WmsCarryH>? carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput, db_BGWCarrySupplementtimer);
if (carrys.Count > 0)
{
wmsLoc = await db_BGWCarrySupplementtimer.Queryable<BasLocation>().Where(r => r.id == carrys[0].location_id).ToListAsync();
}
}
if (wmsLoc.Count() == 0) if (wmsLoc.Count() == 0)

View File

@@ -121,7 +121,10 @@ namespace Tnb.WarehouseMgr
// 托盘对应入库单 // 托盘对应入库单
List<WmsInstockH> instock_mains = await _db.Queryable<WmsInstockH>().Where(x => x.source_id == wmsOutsourceD.fk_wms_outsource_order_id).ToListAsync(); List<WmsInstockH> instock_mains = await _db.Queryable<WmsInstockH>().Where(x => x.source_id == wmsOutsourceD.fk_wms_outsource_order_id).ToListAsync();
if (instock_mains.Count == 0)
{
throw Oops.Bah($"委外收货单{wmsOutsourceH.bill_code}不存在此明细的入库记录!可能是入库任务还未执行完成或者物料是由人工入库");
}
List<WmsInstockD> allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => instock_mains.Select(r => r.id).Contains(it.bill_id) && it.material_code == wmsOutsourceD.matcode && it.code_batch == wmsOutsourceD.code_batch).OrderBy(x=>x.id).ToListAsync(); List<WmsInstockD> allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => instock_mains.Select(r => r.id).Contains(it.bill_id) && it.material_code == wmsOutsourceD.matcode && it.code_batch == wmsOutsourceD.code_batch).OrderBy(x=>x.id).ToListAsync();
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>(); List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();

View File

@@ -135,8 +135,9 @@ namespace Tnb.WarehouseMgr
List<WmsInstockH> instock_mains = await _db.Queryable<WmsInstockH>().Where(x => x.source_id == wmsPurchaseD.bill_id).ToListAsync(); List<WmsInstockH> instock_mains = await _db.Queryable<WmsInstockH>().Where(x => x.source_id == wmsPurchaseD.bill_id).ToListAsync();
if (instock_mains.Count == 0) if (instock_mains.Count == 0)
{ {
throw Oops.Bah("不存在此明细的入库记录!可能是入库任务还未执行完成或者物料是由人工入库"); throw Oops.Bah($"采购收货单{wmsPurchaseH.bill_code}不存在此明细的入库记录!可能是入库任务还未执行完成或者物料是由人工入库");
} }
List<WmsInstockD> allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => instock_mains.Select(r => r.id).Contains(it.bill_id) && it.material_id == wmsPurchaseD.material_id && it.code_batch == wmsPurchaseD.code_batch).OrderBy(x=>x.id).ToListAsync(); List<WmsInstockD> allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => instock_mains.Select(r => r.id).Contains(it.bill_id) && it.material_id == wmsPurchaseD.material_id && it.code_batch == wmsPurchaseD.code_batch).OrderBy(x=>x.id).ToListAsync();