fix: 修复原框架问题

This commit is contained in:
2025-07-21 08:50:28 +08:00
parent 1c910ca154
commit bdd0fe292c
7 changed files with 3073 additions and 58 deletions

View File

@@ -6,8 +6,8 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -93,16 +93,16 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
String is_used = (String) whereJson.get("is_used");
String is_have = (String) whereJson.get("is_have");
return structattrMapper.selectPage(new Page<>(page.getPage() + 1 ,page.getSize()), new LambdaQueryWrapper<Structattr>()
.like(StrUtil.isNotEmpty(search),Structattr::getStruct_code, search)
.like(StrUtil.isNotEmpty(search),Structattr::getStruct_name, search)
.eq(StrUtil.isNotEmpty(stor_id),Structattr::getStor_id, stor_id)
.eq(StrUtil.isNotEmpty(sect_id),Structattr::getSect_id, sect_id)
.eq(StrUtil.isNotEmpty(lock_type),Structattr::getLock_type, lock_type)
.eq(StrUtil.isNotEmpty(layer_num),Structattr::getLayer_num, layer_num)
.eq(StrUtil.isNotEmpty(is_used),Structattr::getIs_used, is_used)
.isNull("1".equals(is_have),Structattr::getStoragevehicle_code)
.isNotNull("2".equals(is_have),Structattr::getStoragevehicle_code)
return structattrMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), new LambdaQueryWrapper<Structattr>()
.like(StrUtil.isNotEmpty(search), Structattr::getStruct_code, search)
.like(StrUtil.isNotEmpty(search), Structattr::getStruct_name, search)
.eq(StrUtil.isNotEmpty(stor_id), Structattr::getStor_id, stor_id)
.eq(StrUtil.isNotEmpty(sect_id), Structattr::getSect_id, sect_id)
.eq(StrUtil.isNotEmpty(lock_type), Structattr::getLock_type, lock_type)
.eq(StrUtil.isNotEmpty(layer_num), Structattr::getLayer_num, layer_num)
.eq(StrUtil.isNotEmpty(is_used), Structattr::getIs_used, is_used)
.isNull("1".equals(is_have), Structattr::getStoragevehicle_code)
.isNotNull("2".equals(is_have), Structattr::getStoragevehicle_code)
.orderByAsc(Structattr::getStruct_code)
);
@@ -123,7 +123,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
@Override
public List<Structattr> findBySectId(String id) {
return structattrMapper.selectList(new LambdaQueryWrapper<>(Structattr.class)
.eq(Structattr::getSect_id,id));
.eq(Structattr::getSect_id, id));
}
@Override
@@ -131,7 +131,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
public void create(Structattr dto) {
String struct_code = dto.getStruct_code();
Structattr structattr = this.findByCode(struct_code);
if (structattr != null ) {
if (structattr != null) {
throw new BadRequestException("存在相同的库区编号");
}
String currentUserId = SecurityUtils.getCurrentUserId();
@@ -208,8 +208,8 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
public void changeActive(JSONObject json) {
String sect_id = json.getString("sect_id");
Sectattr sectattr = iSectattrService.getOne(new LambdaQueryWrapper<>(Sectattr.class)
.eq(Sectattr::getSect_id,sect_id)
.eq(Sectattr::getIs_used,BaseDataEnum.IS_YES_NOT.code(""))
.eq(Sectattr::getSect_id, sect_id)
.eq(Sectattr::getIs_used, BaseDataEnum.IS_YES_NOT.code(""))
);
if (ObjectUtil.isEmpty(sectattr)) {
throw new BadRequestException("该仓位所属的库区已禁用,请先启用该库区!");
@@ -240,37 +240,37 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
@Override
public void updateStatusByCode(String operate, JSONObject jsonObject) {
//operate:0生成、1单据确认、2取消分配
switch (operate){
switch (operate) {
case "0":
//锁定仓位
this.update(new LambdaUpdateWrapper<>(Structattr.class)
.set(Structattr::getInv_id,jsonObject.getString("inv_id"))
.set(Structattr::getInv_code,jsonObject.getString("inv_code"))
.set(Structattr::getInv_type,jsonObject.getString("inv_type"))
.set(Structattr::getInv_id, jsonObject.getString("inv_id"))
.set(Structattr::getInv_code, jsonObject.getString("inv_code"))
.set(Structattr::getInv_type, jsonObject.getString("inv_type"))
.set(Structattr::getLock_type, jsonObject.getString("lock_type"))
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
.eq(Structattr::getStruct_code, jsonObject.getString("struct_code"))
);
break;
case "1":
//完成任务,解锁仓位绑定载具号
this.update(new LambdaUpdateWrapper<>(Structattr.class)
.set(Structattr::getInv_id,jsonObject.getString("inv_id"))
.set(Structattr::getInv_code,jsonObject.getString("inv_code"))
.set(Structattr::getInv_type,jsonObject.getString("inv_type"))
.set(Structattr::getStoragevehicle_code,jsonObject.getString("storagevehicle_code"))
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
.set(Structattr::getInv_id, jsonObject.getString("inv_id"))
.set(Structattr::getInv_code, jsonObject.getString("inv_code"))
.set(Structattr::getInv_type, jsonObject.getString("inv_type"))
.set(Structattr::getStoragevehicle_code, jsonObject.getString("storagevehicle_code"))
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
.eq(Structattr::getStruct_code, jsonObject.getString("struct_code"))
);
break;
case "2":
//解锁仓位
this.update(new LambdaUpdateWrapper<>(Structattr.class)
.set(Structattr::getInv_id,jsonObject.getString("inv_id"))
.set(Structattr::getInv_code,jsonObject.getString("inv_code"))
.set(Structattr::getInv_type,jsonObject.getString("inv_type"))
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
.set(Structattr::getInv_id, jsonObject.getString("inv_id"))
.set(Structattr::getInv_code, jsonObject.getString("inv_code"))
.set(Structattr::getInv_type, jsonObject.getString("inv_type"))
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
.eq(Structattr::getStruct_code, jsonObject.getString("struct_code"))
);
break;
}
@@ -302,7 +302,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
.eq(Structattr::getStruct_code, struct_code)
);
if (ObjectUtil.isEmpty(one)) {
throw new BadRequestException("此仓位编码不存在【"+struct_code+"");
throw new BadRequestException("此仓位编码不存在【" + struct_code + "");
}
return one;
}
@@ -319,6 +319,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
/**
* 出库分配
*
* @param param根据库区需要物料及数量,单据,批次分配具体货位
* @return 返回结果为仓位--对应--货物组盘物料信息及出库冻结数量
* 当前分配不会自动锁定货位及冻结出库数量,分配完成后需要手动锁定货位并冻结出库数量
@@ -326,22 +327,22 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
@Override
public List<StrategyStructMaterialVO> outBoundSectDiv(StrategyStructParam param) {
//只校验仓库,库区
Assert.noNullElements(new Object[]{param.getStor_code(),param.getSect_code()},"请求参数不能为空");
Assert.noNullElements(new Object[]{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() + "未配置入出库规则");
}
List<String> strategy = one.getStrategy();
Map<String, Decisioner> decisionerMap = SpringContextHolder.getBeansOfType(Decisioner.class);
List list = null;
for (String decisionerType : strategy) {
Decisioner decisioner = decisionerMap.get(decisionerType);
log.info("执行出入库规格:"+decisioner.strategyConfig.getStrategy_name());
log.info("执行出入库规格:" + decisioner.strategyConfig.getStrategy_name());
list = decisioner.handler(list, param);
if (CollectionUtils.isEmpty(list)){
throw new BadRequestException("当前策略"+decisioner.strategyConfig.getStrategy_name()+"无可用货位,分配前数量:"+list.size());
if (CollectionUtils.isEmpty(list)) {
throw new BadRequestException("当前策略" + decisioner.strategyConfig.getStrategy_name() + "无可用货位,分配前数量:" + list.size());
}
}
return list;
@@ -349,6 +350,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
/**
* 入库分配
*
* @param param根据库区需要物料及数量,单据,批次分配具体货位;按托进行分配:默认一托一个货位
* @return 返回结果为分配的具体仓位
* 当前分配不会自动锁定货位,分配完成后需要手动锁定货位
@@ -356,28 +358,28 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
@Override
public List<Structattr> inBoundSectDiv(StrategyStructParam param) {
//批号,单据暂时不校验,具体业务具体校验
Assert.noNullElements(new Object[]{param.getQty(),param.getMaterial_code(),param.getSect_code()},"请求参数不能为空");
Assert.noNullElements(new Object[]{param.getQty(), param.getMaterial_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() + "未配置入库规则");
}
List<String> strategy = one.getStrategy();
Map<String, Decisioner> decisionerMap = SpringContextHolder.getBeansOfType(Decisioner.class);
QueryWrapper<Structattr> query = new QueryWrapper<Structattr>()
.eq("is_used", true)
.eq("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("sect_code", param.getSect_code())
.isNull("storagevehicle_code");
List<Structattr> 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() + "无可用货位,分配前数量:" + list.size());
}
}
return list;
@@ -407,7 +409,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
BigDecimal subtract = vehicleMater.getQty().subtract(vehicleMater.getFrozen_qty());
//100-出50 = 50
//如果出库是手持库出确认则不在这边变动组盘信息
if (!changeDto.getInBound()){
if (!changeDto.getInBound()) {
UpdateWrapper<GroupPlate> update = new UpdateWrapper<GroupPlate>()
.set("frozen_qty", 0)
.set("qty", subtract)
@@ -434,7 +436,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
record.setGrowth(changeDto.getInBound());
records.add(record);
}
if (!CollectionUtils.isEmpty(records)){
if (!CollectionUtils.isEmpty(records)) {
stIvtStructivtflowService.saveBatch(records);
}
}

View File

@@ -9,13 +9,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ResolvableType;
import java.util.List;
/*
/**
* @author ZZQ
* @Date 2024/4/6 16:13
*/
public abstract class Decisioner<T,P> implements InitializingBean {
//每个策略的配置信息
/**
* 每个策略的配置信息
*/
public StStrategyConfig strategyConfig;
@Autowired
private IStStrategyConfigService iStStrategyConfigService;

View File

@@ -1,6 +1,5 @@
package org.nl.wms.decision_manage.service.strategyConfig.decisioner.impl.base;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.nl.common.exception.BadRequestException;
@@ -15,10 +14,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.List;
/*
/**
* @author ZZQ
* @Date 2024/4/6 16:18
* 先进先出策略

View File

@@ -12,7 +12,7 @@ import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/*
/**
* @author GBX
* @Date 2025/2/1 16:18
* 相同巷道,自下而上分配,左右相邻

View File

@@ -379,9 +379,9 @@ public class PdaIosInServiceImpl implements PdaIosInService {
sendTask(whereJson);
//更新组盘表状态
mdPbGroupplateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<GroupPlate>()
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘")));
} else {
//空载具入库
whereJson.put("qty", 1);

View File

@@ -40,7 +40,7 @@ import java.util.Map;
*/
@Slf4j
@RestController
@RequestMapping("/api/bigScreenScreen")
@RequestMapping("/mobile/auth")
public class MobileAuthorizationController {
@Autowired
private ISysUserService userService;
@@ -51,7 +51,7 @@ public class MobileAuthorizationController {
@SaIgnore
//("手持登陆验证")
public ResponseEntity<Object> handLogin(@RequestBody Map<String, String> whereJson) {
SysUser userInfo = userService.getOne(new QueryWrapper<SysUser>().eq("username", whereJson.get("user")));
SysUser userInfo = userService.getOne(new QueryWrapper<SysUser>().eq("username", whereJson.get("username")));
if (userInfo == null || !userInfo.getPassword().equals(SaSecureUtil.md5BySalt(RsaUtils.decryptByPrivateKey(RsaUtils.KEY, whereJson.get("password")), "salt"))) { // 这里需要密码加密
throw new BadRequestException("账号或密码错误");
}

File diff suppressed because one or more lines are too long