add:增加二楼特殊托盘入库逻辑;

opt:优化搜索相关
This commit is contained in:
2026-04-03 15:50:05 +08:00
parent b4d595c5d0
commit 6c03f3a96b
5 changed files with 57 additions and 29 deletions

View File

@@ -93,7 +93,10 @@
(attr.struct_code LIKE #{param.struct_code} or
attr.struct_name LIKE #{param.struct_code} )
</if>
<if test="param.storagevehicle_code != null and param.storagevehicle_code != ''">
AND
attr.storagevehicle_code LIKE #{param.storagevehicle_code}
</if>
<if test="param.material_code != null and param.material_code != ''">
AND
(mater.material_code LIKE #{param.material_code} or

View File

@@ -348,57 +348,82 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
@Override
public List<Structattr> inBoundSectDiv(StrategyStructParam param) {
//批号,单据暂时不校验,具体业务具体校验
Assert.noNullElements(new Object[]{param.getStrategyMaters(),param.getStor_code(),param.getSect_code()},"请求参数不能为空");
Assert.noNullElements(new Object[]{param.getStrategyMaters(), param.getStor_code(), param.getSect_code()}, "请求参数不能为空");
StSectStrategy one = iStSectStrategyService.getOne(new LambdaQueryWrapper<StSectStrategy>()
.eq(StSectStrategy::getSect_code, param.getSect_code())
.eq(StSectStrategy::getStrategy_type, StatusEnum.STRATEGY_TYPE.code("入库")));
if (one==null){
throw new BadRequestException("当前库区"+param.getSect_code()+"未配置入库规则");
if (one == null) {
throw new BadRequestException("当前库区" + param.getSect_code() + "未配置入库规则");
}
//最高层数
Integer maxLayerNum = structattrMapper.selectList(
new QueryWrapper<Structattr>()
.select("MAX(layer_num) as layer_num")
.eq("sect_code", param.getSect_code())
).stream().findFirst().map(Structattr::getLayer_num).orElse(null);
if (maxLayerNum == null) {
maxLayerNum = 0;
}
List<String> strategy = one.getStrategy();
Map<String, Decisioner> decisionerMap = SpringContextHolder.getBeansOfType(Decisioner.class);
QueryWrapper<Structattr> query = new QueryWrapper<Structattr>();
if ("3".equals(param.getSuitable_car())) {
query.eq("is_used", true)
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("sect_code", param.getSect_code())
.isNull("width")
.isNull("stor_type")
if ("2FCP3C".equals(param.getStoragevehicle_type())) {
query.eq("is_used", true)
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("sect_code", param.getSect_code())
.eq("layer_num", maxLayerNum)
.and(wrapper -> wrapper.isNull("storagevehicle_code")
.or()
.eq("storagevehicle_code", " "));
} else if("2".equals(param.getSuitable_car())){
} else if ("3".equals(param.getSuitable_car())) {
query.eq("is_used", true)
.eq("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("sect_code", param.getSect_code())
.eq("width",1)
.ne("layer_num",4)
.isNull("width")
.isNull("stor_type")
.and(wrapper -> wrapper.isNull("storagevehicle_code")
.or()
.eq("storagevehicle_code", " "));
} else if ("1".equals(param.getSuitable_car())){
} else if ("2".equals(param.getSuitable_car())) {
query.eq("is_used", true)
.eq("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("sect_code", param.getSect_code())
.eq("layer_num",4)
.eq("width", 1)
.ne("layer_num", maxLayerNum)
.isNull("stor_type")
.and(wrapper -> wrapper.isNull("storagevehicle_code")
.or()
.eq("storagevehicle_code", " "));
} else if ("1".equals(param.getSuitable_car())) {
query.eq("is_used", true)
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("sect_code", param.getSect_code())
.eq("layer_num", maxLayerNum)
.isNull("stor_type")
.and(wrapper -> wrapper.isNull("storagevehicle_code")
.or()
.eq("storagevehicle_code", " "));
}
List<Structattr> list = this.list(query);
if("BCPCTZB".equals(param.getStoragevehicle_type())){
list=structattrMapper.getctnextcode();
if ("BCPCTZB".equals(param.getStoragevehicle_type())) {
list = structattrMapper.getctnextcode();
}
if ("2FCP3C".equals(param.getStoragevehicle_type()) && ObjectUtil.isEmpty(list)) {
query.eq("is_used", true)
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("sect_code", param.getSect_code())
.and(wrapper -> wrapper.isNull("storagevehicle_code")
.or()
.eq("storagevehicle_code", " "));
list = this.list(query);
}
for (String decisionerType : strategy) {
Decisioner decisioner = decisionerMap.get(decisionerType);
log.info("执行入库规格:"+decisioner.strategyConfig.getStrategy_name());
log.info("执行入库规格:" + decisioner.strategyConfig.getStrategy_name());
JSONObject params = (JSONObject) JSON.toJSON(param);
list = decisioner.handler(list, params);
if (CollectionUtils.isEmpty(list)){
throw new BadRequestException("当前策略"+decisioner.strategyConfig.getStrategy_name()+"无可用货位,分配前数量:"+list.size());
if (CollectionUtils.isEmpty(list)) {
throw new BadRequestException("当前策略" + decisioner.strategyConfig.getStrategy_name() + ",当前仓库:" + param.getStor_code() + ",当前库区:" + param.getSect_code() + "无可用货位,分配前数量:" + list.size());
}
}
return list;

View File

@@ -46,9 +46,8 @@ public class NearbyRuleHandler extends Decisioner<Structattr, JSONObject> {
*/
@Override
public List<Structattr> handler(List<Structattr> list, JSONObject param) {
if (CollectionUtils.isEmpty(list)) {
throw new BadRequestException("当前分配策略无可用货位");
throw new BadRequestException("当前策略:就近放置策略"+",当前仓库:"+param.getString("stor_code")+",当前库区:"+param.getString("sect_code")+",当前载具:"+param.getString("storagevehicle_code")+",当前载具类型:"+param.getString("storagevehicle_type")+",系统暂无空余库位,分配前数量:"+list.size());
}
List<Structattr> before = list.subList(0, list.size() > 10 ? 10 : list.size());
log.info("就近分配前:" + before.stream().map(Structattr::getStruct_code).collect(Collectors.joining(",")));

View File

@@ -638,6 +638,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
.storagevehicle_type(param.getString("storagevehicle_type"))
.suitable_car(suitable_car)
.strategyMaters(maters)
.storagevehicle_type(storagevehicle_stype)
.build());
Structattr struct = structattrs.get(0);
sect_id = struct.getSect_id();

View File

@@ -182,7 +182,7 @@ public class WmsToIWmsServiceImpl implements WmsToIWmsService {
}
String car_type=null;
String car_width="685";
if(parm.getString("task_type").equals("1")){
if("1".equals(parm.getString("task_type"))){
List<Structattr> regionCode = structattrMapper.selectList(new LambdaQueryWrapper<Structattr>()
.eq(Structattr::getSect_code, "1BCDJQ")
.eq(Structattr::getIs_used,true)
@@ -192,7 +192,7 @@ public class WmsToIWmsServiceImpl implements WmsToIWmsService {
if(StringUtils.isBlank(pointCode)){
throw new BadRequestException("待检区域无库存");
}
if(parm.getString("storagevehicle_type").equals("BCPHDL")){
if("BCPHDL".equals(parm.getString("storagevehicle_type"))||"2FCP3C".equals(parm.getString("storagevehicle_type"))){
car_type="1";
}else{
car_type="2";
@@ -208,8 +208,8 @@ public class WmsToIWmsServiceImpl implements WmsToIWmsService {
task_form.put("car_width",car_width);
CheckInTask checkInTask = SpringContextHolder.getBean("CheckInTask");
String task_id = checkInTask.create(task_form);
} else if(parm.getString("task_type").equals("2")){
if(parm.getString("storagevehicle_type").equals("BCPHDL")){
} else if("2".equals(parm.getString("task_type"))){
if("BCPHDL".equals(parm.getString("storagevehicle_type"))||"2FCP3C".equals(parm.getString("storagevehicle_type"))){
car_type="1";
}else{
car_type="2";