rev:分配逻辑;todo:分配完更新单据还是载具?
This commit is contained in:
@@ -16,6 +16,11 @@ public class CodeUtil {
|
||||
ISysCodeRuleService service = SpringContextHolder.getBean(ISysCodeRuleService.class);
|
||||
RedissonUtils.lock(() -> code[0] = service.codeDemo("1",ruleCode), ruleCode, 1);
|
||||
return code[0];
|
||||
|
||||
}
|
||||
public static String codeView(String ruleCode) {
|
||||
final String[] code = {""};
|
||||
ISysCodeRuleService service = SpringContextHolder.getBean(ISysCodeRuleService.class);
|
||||
RedissonUtils.lock(() -> code[0] = service.codeDemo("0",ruleCode), ruleCode, 1);
|
||||
return code[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,27 +49,27 @@ public class StIvtStructattr implements Serializable {
|
||||
/**
|
||||
* 容量
|
||||
*/
|
||||
private BigDecimal capacity;
|
||||
private Integer capacity;
|
||||
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
private BigDecimal width;
|
||||
private Integer w;
|
||||
|
||||
/**
|
||||
* 高度
|
||||
*/
|
||||
private BigDecimal height;
|
||||
private Integer h;
|
||||
|
||||
/**
|
||||
* 深度
|
||||
* 深度(长度)
|
||||
*/
|
||||
private BigDecimal zdepth;
|
||||
private Integer l;
|
||||
|
||||
/**
|
||||
* 承受重量
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
private Integer weight;
|
||||
|
||||
/**
|
||||
* 起始X坐标
|
||||
@@ -106,21 +106,6 @@ public class StIvtStructattr implements Serializable {
|
||||
*/
|
||||
private Integer block_num;
|
||||
|
||||
/**
|
||||
* 入库顺序
|
||||
*/
|
||||
private Integer in_order_seq;
|
||||
|
||||
/**
|
||||
* 出库库顺序
|
||||
*/
|
||||
private Integer out_order_seq;
|
||||
|
||||
/**
|
||||
* 放置类型
|
||||
*/
|
||||
private String placement_type;
|
||||
|
||||
/**
|
||||
* 超限货位关联的货位编号
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface IBmVehicleInfoService extends IService<BmVehicleInfo> {
|
||||
* @param vehile_code
|
||||
* @return
|
||||
*/
|
||||
Map vehileInfo(String vehile_code);
|
||||
BmVehicleInfo vehileInfo(String vehile_code);
|
||||
|
||||
void updateVehicleMaterial(JSONObject vorm);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.base_manage.vehicle.service.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
@@ -26,21 +27,20 @@ public class BmVehicleInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 载具标识
|
||||
*/
|
||||
@TableId
|
||||
private String storagevehicle_id;
|
||||
|
||||
/**
|
||||
* 载具编码
|
||||
*/
|
||||
private String storagevehicle_code;
|
||||
@TableId
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 载具名称
|
||||
*/
|
||||
private String storagevehicle_name;
|
||||
private String vehicle_name;
|
||||
/**
|
||||
* 载具名称
|
||||
*/
|
||||
private String vehicle_type;
|
||||
|
||||
/**
|
||||
* 一维码
|
||||
@@ -57,26 +57,6 @@ public class BmVehicleInfo implements Serializable {
|
||||
*/
|
||||
private String rfid_code;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_id;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
@@ -93,32 +73,28 @@ public class BmVehicleInfo implements Serializable {
|
||||
*/
|
||||
private Boolean is_used;
|
||||
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
private String storagevehicle_type;
|
||||
|
||||
/**
|
||||
* 载具宽度
|
||||
*/
|
||||
private BigDecimal vehicle_width;
|
||||
|
||||
|
||||
/**
|
||||
* 载具重量(kg)
|
||||
*/
|
||||
private BigDecimal vehicle_weight;
|
||||
private Integer w;
|
||||
|
||||
|
||||
/**
|
||||
* 载具长度
|
||||
*/
|
||||
private BigDecimal vehicle_long;
|
||||
private Integer l;
|
||||
|
||||
/**
|
||||
* 载具高度
|
||||
*/
|
||||
private BigDecimal vehicle_height;
|
||||
private Integer h;
|
||||
|
||||
/**
|
||||
* 载具重量(kg)
|
||||
*/
|
||||
private Integer weight;
|
||||
|
||||
|
||||
/**
|
||||
* 载具是否超仓位
|
||||
@@ -133,7 +109,12 @@ public class BmVehicleInfo implements Serializable {
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
private JSONObject ext_json;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@ import java.util.Map;
|
||||
*/
|
||||
public interface BmVehicleInfoMapper extends BaseMapper<BmVehicleInfo> {
|
||||
|
||||
Map vehileInfo(String vehicle_code);
|
||||
BmVehicleInfo vehileInfo(String vehicle_code);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.base_manage.vehicle.service.dao.mapper.BmVehicleInfoMapper">
|
||||
|
||||
<select id="vehileInfo" resultType="java.util.Map">
|
||||
<select id="vehileInfo" resultType="org.nl.wms.base_manage.vehicle.service.dao.BmVehicleInfo">
|
||||
select *
|
||||
from md_pb_storagevehicleinfo
|
||||
left join md_pb_storagevehicleext
|
||||
on md_pb_storagevehicleinfo.storagevehicle_code = md_pb_storagevehicleext.storagevehicle_code
|
||||
where md_pb_storagevehicleinfo.storagevehicle_code = #{vehicle_code}
|
||||
and md_pb_storagevehicleinfo.is_delete = false
|
||||
</select>
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.entity.PageQuery;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.base_manage.vehicle.service.IBmVehicleInfoService;
|
||||
@@ -36,28 +37,21 @@ import java.util.Map;
|
||||
@Service
|
||||
public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, BmVehicleInfo> implements IBmVehicleInfoService {
|
||||
|
||||
/* @Autowired
|
||||
private MdPbStoragevehicleextServiceImpl storagevehicleextService;
|
||||
|
||||
@Autowired
|
||||
protected IMdMeMaterialbaseService iMdMeMaterialbaseService;*/
|
||||
|
||||
@Override
|
||||
public Map vehileInfo(String vehicle_code) {
|
||||
if(StringUtils.isEmpty(vehicle_code)){
|
||||
return new HashMap();
|
||||
}
|
||||
return this.baseMapper.vehileInfo(vehicle_code);
|
||||
public BmVehicleInfo vehileInfo(String vehicle_code) {
|
||||
return this.getOne(new QueryWrapper<BmVehicleInfo>().eq("vehicle_code",vehicle_code));
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray create(JSONObject map) {
|
||||
BmVehicleInfo one = this.getOne(new QueryWrapper<BmVehicleInfo>().eq("storagevehicle_code", map.getString("storagevehicle_code")));
|
||||
BmVehicleInfo one = this.getOne(new QueryWrapper<BmVehicleInfo>()
|
||||
.eq("vehicle_code", map.getString("vehicle_code")));
|
||||
if (!ObjectUtil.isEmpty(one)) {
|
||||
throw new BadRequestException("此载具已存在");
|
||||
}
|
||||
String code = "";
|
||||
switch (map.getString("storagevehicle_type")) {
|
||||
switch (map.getString("vehicle_type")) {
|
||||
case "00":
|
||||
code = "VEHICCLE_CODE_XMTPT";
|
||||
break;
|
||||
@@ -81,16 +75,14 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
||||
int num = MapUtil.getInt(map, "num");
|
||||
for (int i = 0; i < num; i++) {
|
||||
BmVehicleInfo entity = new BmVehicleInfo();
|
||||
entity.setStoragevehicle_id(IdUtil.getStringId());
|
||||
/*entity.setStoragevehicle_code(CodeUtil.getNewCode(code));*/
|
||||
entity.setStoragevehicle_name(entity.getStoragevehicle_code());
|
||||
entity.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
entity.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setCreate_time(DateUtil.now());
|
||||
entity.setVehicle_code(CodeUtil.getNewCode(code));
|
||||
entity.setVehicle_name(entity.getVehicle_name());
|
||||
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setUpdate_name(DateUtil.now());
|
||||
entity.setIs_used(map.getString("is_used").equals("1"));
|
||||
entity.setStoragevehicle_type(map.getString("storagevehicle_type"));
|
||||
entity.setVehicle_type(map.getString("vehicle_type"));
|
||||
this.save(entity);
|
||||
resultCodeArr.add(entity.getStoragevehicle_code());
|
||||
resultCodeArr.add(entity.getVehicle_code());
|
||||
}
|
||||
return resultCodeArr;
|
||||
}
|
||||
@@ -168,7 +160,6 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
||||
public void changeActive(JSONObject json) {
|
||||
|
||||
BmVehicleInfo entity = json.toJavaObject(BmVehicleInfo.class);
|
||||
entity.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
entity.setUpdate_time(DateUtil.now());
|
||||
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
this.updateById(entity);
|
||||
@@ -198,14 +189,8 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
||||
break;
|
||||
}
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("code", term);
|
||||
map.put("flag", "0");
|
||||
// GenCodeServiceImpl genCodeService = new GenCodeServiceImpl();
|
||||
// String value = genCodeService.codeDemo(map);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
// json.put("value", value);
|
||||
json.put("value", CodeUtil.codeView(term));
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nl.common.domain.entity.BaseQuery;
|
||||
import org.nl.common.domain.entity.QParam;
|
||||
import org.nl.common.enums.QueryTEnum;
|
||||
import org.nl.wms.config_manage.form_struc.service.dao.BmFormStruc;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -24,4 +26,12 @@ public class FormStrucQuery extends BaseQuery<BmFormStruc> {
|
||||
|
||||
private String form_type;
|
||||
|
||||
private String search;
|
||||
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
this.doP.put("search", QParam.builder().k(new String[]{"form_name"}).type(QueryTEnum.LK).build());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,15 @@ package org.nl.wms.decision_manage.handler.impl.base;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.utils.ListOf;
|
||||
import org.nl.common.utils.SpringContextHolder;
|
||||
import org.nl.wms.base_manage.struct.service.dao.StIvtStructattr;
|
||||
import org.nl.wms.base_manage.vehicle.service.IBmVehicleInfoService;
|
||||
import org.nl.wms.base_manage.vehicle.service.dao.BmVehicleInfo;
|
||||
import org.nl.wms.base_manage.vehicleext.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.base_manage.vehicleext.service.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.decision_manage.handler.Decisioner;
|
||||
@@ -20,17 +24,17 @@ import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2024/4/6 16:18
|
||||
* 货位限位策略:限高,限宽,双货位
|
||||
* 货位限位策略:限高,限宽,限长,限重
|
||||
*/
|
||||
@Service("limitStorage")
|
||||
public class LimitStorageRuleHandler extends Decisioner<StIvtStructattr,String> {
|
||||
//每个策略的配置信息
|
||||
private static StStrategyConfig Strategy_Config;
|
||||
public class LimitStorageRuleHandler extends Decisioner<StIvtStructattr,StIvtIostorinvdtlIn> {
|
||||
|
||||
/**
|
||||
* 出入库明细服务
|
||||
*/
|
||||
@@ -41,7 +45,7 @@ public class LimitStorageRuleHandler extends Decisioner<StIvtStructattr,String>
|
||||
* 载具扩展属性服务服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService;
|
||||
private IBmVehicleInfoService bmVehicleInfoService;
|
||||
|
||||
/**
|
||||
* 货位限位策略:根据货位的长宽高
|
||||
@@ -54,32 +58,30 @@ public class LimitStorageRuleHandler extends Decisioner<StIvtStructattr,String>
|
||||
* @return List<StIvtStructattr> :仓位集合
|
||||
*/
|
||||
@Override
|
||||
public List<StIvtStructattr> handler(List<StIvtStructattr> list, String param) {
|
||||
public List<StIvtStructattr> handler(List<StIvtStructattr> list, StIvtIostorinvdtlIn param) {
|
||||
// 判断仓位是否为空
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
throw new BadRequestException("仓位集合为空!");
|
||||
}
|
||||
|
||||
// 判断策略类型
|
||||
JSONObject jsonParam = JSONObject.parseObject(param, JSONObject.class);
|
||||
|
||||
List<StIvtStructattr> resultList = new ArrayList<>();
|
||||
|
||||
switch (Strategy_Config.getStrategy_type()) {
|
||||
case "1":
|
||||
// 入库策略
|
||||
resultList = inHandler(list,jsonParam);
|
||||
break;
|
||||
case "2":
|
||||
// 出库策略
|
||||
resultList = outHandler(list,jsonParam);
|
||||
break;
|
||||
case "3":
|
||||
// 通用策略
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("策略类型错误!");
|
||||
String vehicleCode = param.getVehicle_code();
|
||||
BmVehicleInfo vehileInfo = bmVehicleInfoService.vehileInfo(vehicleCode);
|
||||
if (vehileInfo==null){
|
||||
throw new BadRequestException("当前载具信息不存在:"+vehicleCode+"!");
|
||||
}
|
||||
List<StIvtStructattr> resultList = inHandler(list,vehileInfo);
|
||||
|
||||
|
||||
// switch (Strategy_Config.getStrategy_type()) {
|
||||
// case "1":
|
||||
// // 入库策略
|
||||
// break;
|
||||
// case "2":
|
||||
// // 出库策略
|
||||
// resultList = outHandler(list,jsonParam);
|
||||
// break;
|
||||
// case "3":
|
||||
// // 通用策略
|
||||
// break;
|
||||
// default:
|
||||
// throw new BadRequestException("策略类型错误!");
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -89,15 +91,30 @@ public class LimitStorageRuleHandler extends Decisioner<StIvtStructattr,String>
|
||||
* @param jsonParam:materialId :物料标识、width: 宽度、 height:高度、zdepth:深度
|
||||
* @return List<StIvtStructattr> :仓位集合
|
||||
*/
|
||||
private List<StIvtStructattr> inHandler(List<StIvtStructattr> attrList, JSONObject jsonParam) {
|
||||
|
||||
private List<StIvtStructattr> inHandler(List<StIvtStructattr> attrList, BmVehicleInfo vehicle) {
|
||||
//限制条件:限制哪些
|
||||
List<String> limits = JSONArray.parseArray(strategyConfig.getParam(), String.class);
|
||||
Predicate<StIvtStructattr> predicate = stIvtStructattr -> {
|
||||
Boolean result = Boolean.TRUE;
|
||||
if (limits.contains("h")){
|
||||
result = result && stIvtStructattr.getH()>=vehicle.getH();
|
||||
}
|
||||
if (limits.contains("w")){
|
||||
result = result && stIvtStructattr.getW()>=vehicle.getW();
|
||||
}
|
||||
if (limits.contains("l")){
|
||||
result = result && stIvtStructattr.getL()>=vehicle.getL();
|
||||
}
|
||||
if (limits.contains("weight")){
|
||||
result = result && stIvtStructattr.getWeight()>=vehicle.getWeight();
|
||||
}
|
||||
return result;
|
||||
};
|
||||
// 判断长宽高是否符合要求
|
||||
return attrList.stream()
|
||||
.filter(row -> row.getWidth().doubleValue() <= jsonParam.getDoubleValue("width") &&
|
||||
row.getHeight().doubleValue() <= jsonParam.getDoubleValue("height") &&
|
||||
row.getZdepth().doubleValue() <= jsonParam.getDoubleValue("zdepth")
|
||||
)
|
||||
List<StIvtStructattr> collect = attrList.stream()
|
||||
.filter(predicate)
|
||||
.collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,59 +123,60 @@ public class LimitStorageRuleHandler extends Decisioner<StIvtStructattr,String>
|
||||
* @param jsonParam:iostorinvdtlId : 出入库明细标识(此方法只根据时间匹配)
|
||||
* @return List<StIvtStructattr> :需出库仓位集合
|
||||
*/
|
||||
private List<StIvtStructattr> outHandler(List<StIvtStructattr> attrList, JSONObject jsonParam) {
|
||||
// private List<StIvtStructattr> outHandler(List<StIvtStructattr> attrList, JSONObject jsonParam) {
|
||||
//
|
||||
// // 查询对应的出入库明细
|
||||
// StIvtIostorinvdtlIn dtlDao = iStIvtIostorinvdtlService.getById(jsonParam.getString("iostorinvdtlId"));
|
||||
//
|
||||
// // 查询传入仓位物料中的数量是否满足明细中的数量
|
||||
// List<String> vehicleCodeIn = attrList.stream()
|
||||
// .map(StIvtStructattr::getVehicle_code)
|
||||
// .distinct()
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// // 查询对应的载具物料
|
||||
// List<MdPbStoragevehicleext> extList = iMdPbStoragevehicleextService.list(
|
||||
// new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
// .in(MdPbStoragevehicleext::getStoragevehicle_code, vehicleCodeIn)
|
||||
// );
|
||||
//
|
||||
// double attrQty = extList.stream()
|
||||
// .map(MdPbStoragevehicleext::getQty)
|
||||
// .reduce(BigDecimal.ZERO, BigDecimal::add)
|
||||
// .doubleValue();
|
||||
//
|
||||
// if (dtlDao.getUnassign_qty().doubleValue() > attrQty) {
|
||||
// // 说明不满足所需重量则全部返回
|
||||
// return attrList;
|
||||
// }
|
||||
//
|
||||
// // 需返回仓位物料集合
|
||||
// List<StIvtStructattr> resultList = new ArrayList<>();
|
||||
// // 满足所需数量: 根据巷道进行平均分配
|
||||
// double unAssingQty = dtlDao.getUnassign_qty().doubleValue();
|
||||
//
|
||||
// while (unAssingQty > 0) {
|
||||
//
|
||||
// // 添加需返回的仓位物料
|
||||
// StIvtStructattr attrDao = attrList.get(0);
|
||||
// resultList.add(attrDao);
|
||||
//
|
||||
// // 减去未分配重量
|
||||
// MdPbStoragevehicleext extDao = extList.stream()
|
||||
// .filter(row -> row.getStoragevehicle_code().equals(attrDao.getVehicle_code()))
|
||||
// .findFirst().orElse(null);
|
||||
//
|
||||
// if (ObjectUtil.isEmpty(extDao)) {
|
||||
// throw new BadRequestException("未查询到载具对应的物料【"+attrDao.getVehicle_code()+"】");
|
||||
// }
|
||||
//
|
||||
// unAssingQty = NumberUtil.sub(unAssingQty,extDao.getQty().doubleValue());
|
||||
//
|
||||
// // 移出此仓位物料,方便下一轮进行匹配
|
||||
// attrList.remove(attrDao);
|
||||
// }
|
||||
//
|
||||
// return resultList;
|
||||
// }
|
||||
|
||||
// 查询对应的出入库明细
|
||||
StIvtIostorinvdtlIn dtlDao = iStIvtIostorinvdtlService.getById(jsonParam.getString("iostorinvdtlId"));
|
||||
|
||||
// 查询传入仓位物料中的数量是否满足明细中的数量
|
||||
List<String> vehicleCodeIn = attrList.stream()
|
||||
.map(StIvtStructattr::getVehicle_code)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 查询对应的载具物料
|
||||
List<MdPbStoragevehicleext> extList = iMdPbStoragevehicleextService.list(
|
||||
new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
.in(MdPbStoragevehicleext::getStoragevehicle_code, vehicleCodeIn)
|
||||
);
|
||||
|
||||
double attrQty = extList.stream()
|
||||
.map(MdPbStoragevehicleext::getQty)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
||||
.doubleValue();
|
||||
|
||||
if (dtlDao.getUnassign_qty().doubleValue() > attrQty) {
|
||||
// 说明不满足所需重量则全部返回
|
||||
return attrList;
|
||||
}
|
||||
|
||||
// 需返回仓位物料集合
|
||||
List<StIvtStructattr> resultList = new ArrayList<>();
|
||||
// 满足所需数量: 根据巷道进行平均分配
|
||||
double unAssingQty = dtlDao.getUnassign_qty().doubleValue();
|
||||
|
||||
while (unAssingQty > 0) {
|
||||
|
||||
// 添加需返回的仓位物料
|
||||
StIvtStructattr attrDao = attrList.get(0);
|
||||
resultList.add(attrDao);
|
||||
|
||||
// 减去未分配重量
|
||||
MdPbStoragevehicleext extDao = extList.stream()
|
||||
.filter(row -> row.getStoragevehicle_code().equals(attrDao.getVehicle_code()))
|
||||
.findFirst().orElse(null);
|
||||
|
||||
if (ObjectUtil.isEmpty(extDao)) {
|
||||
throw new BadRequestException("未查询到载具对应的物料【"+attrDao.getVehicle_code()+"】");
|
||||
}
|
||||
|
||||
unAssingQty = NumberUtil.sub(unAssingQty,extDao.getQty().doubleValue());
|
||||
|
||||
// 移出此仓位物料,方便下一轮进行匹配
|
||||
attrList.remove(attrDao);
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.function.ToIntFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/*
|
||||
@@ -29,7 +30,7 @@ import java.util.stream.Collectors;
|
||||
* 就近放置策略:根据物料ABC类区分
|
||||
*/
|
||||
@Service("nearby")
|
||||
public class NearbyRuleHandler extends Decisioner<StIvtStructattr,String> {
|
||||
public class NearbyRuleHandler extends Decisioner<StIvtStructattr,StIvtIostorinvdtlIn> {
|
||||
//每个策略的配置信息
|
||||
private static StStrategyConfig stStrategyConfig;
|
||||
/**
|
||||
@@ -55,33 +56,14 @@ public class NearbyRuleHandler extends Decisioner<StIvtStructattr,String> {
|
||||
* @return List<StIvtStructattr> :仓位集合
|
||||
*/
|
||||
@Override
|
||||
public List<StIvtStructattr> handler(List<StIvtStructattr> list, String param) {
|
||||
public List<StIvtStructattr> handler(List<StIvtStructattr> list, StIvtIostorinvdtlIn param) {
|
||||
// 判断仓位是否为空
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
throw new BadRequestException("仓位集合为空!");
|
||||
}
|
||||
|
||||
// 判断策略类型
|
||||
JSONObject jsonParam = JSONObject.parseObject(param, JSONObject.class);
|
||||
|
||||
List<StIvtStructattr> resultList = new ArrayList<>();
|
||||
|
||||
switch (jsonParam.getString("ioType")) {
|
||||
case "1":
|
||||
// 入库策略
|
||||
resultList = inHandler(list,jsonParam);
|
||||
break;
|
||||
case "2":
|
||||
// 出库策略
|
||||
resultList = outHandler(list,jsonParam);
|
||||
break;
|
||||
case "3":
|
||||
// 通用策略
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("策略类型错误!");
|
||||
}
|
||||
return resultList;
|
||||
list.sort(Comparator.comparingInt(i -> i.getRow_num()+i.getCol_num()+i.getLayer_num()+i.getBlock_num()));
|
||||
//就近分配区分出库还是入库策略
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,9 +74,7 @@ public class NearbyRuleHandler extends Decisioner<StIvtStructattr,String> {
|
||||
*/
|
||||
private List<StIvtStructattr> inHandler(List<StIvtStructattr> attrList, JSONObject jsonParam) {
|
||||
|
||||
return attrList.stream()
|
||||
.sorted(Comparator.comparing(StIvtStructattr::getIn_order_seq))
|
||||
.collect(Collectors.toList());
|
||||
return attrList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,9 +86,6 @@ public class NearbyRuleHandler extends Decisioner<StIvtStructattr,String> {
|
||||
private List<StIvtStructattr> outHandler(List<StIvtStructattr> attrList, JSONObject jsonParam) {
|
||||
|
||||
// 先进行顺序排序
|
||||
attrList = attrList.stream()
|
||||
.sorted(Comparator.comparing(StIvtStructattr::getIn_order_seq))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 查询对应的出入库明细
|
||||
StIvtIostorinvdtlIn dtlDao = iStIvtIostorinvdtlService.getById(jsonParam.getString("iostorinvdtlId"));
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BpmnJSONConverter {
|
||||
List<JSONObject> list = nodes.toJavaList(JSONObject.class);
|
||||
Iterator<JSONObject> iterator = list.iterator();
|
||||
while(iterator.hasNext()){
|
||||
JSONObject node = (JSONObject)iterator.next();
|
||||
JSONObject node = iterator.next();
|
||||
iterator.remove();
|
||||
Node_Converter.get(node.getString("type")).convertToBpmnModel(iterator, node,bpmnModel);
|
||||
|
||||
@@ -57,168 +57,5 @@ public class BpmnJSONConverter {
|
||||
Node_Converter.get("sequenceFlow").convertToBpmnModel(iterator, edge,bpmnModel);
|
||||
}
|
||||
return bpmnModel;
|
||||
//流程线
|
||||
// JSONArray edges = model_json.getJSONArray("edges");
|
||||
// model.setStartEventFormTypes(startEventFormTypes);
|
||||
// model.setUserTaskFormTypes(userTaskFormTypes);
|
||||
// try {
|
||||
// Process activeProcess = new Process();
|
||||
// List<SubProcess> activeSubProcessList = new ArrayList<>();
|
||||
// while (xtr.hasNext()) {
|
||||
// try {
|
||||
// xtr.next();
|
||||
// } catch (Exception e) {
|
||||
// LOGGER.debug("Error reading XML document", e);
|
||||
// throw new XMLException("Error reading XML", e);
|
||||
// }
|
||||
//
|
||||
// if (xtr.isEndElement() && (ELEMENT_SUBPROCESS.equals(xtr.getLocalName()) ||
|
||||
// ELEMENT_TRANSACTION.equals(xtr.getLocalName()) ||
|
||||
// ELEMENT_ADHOC_SUBPROCESS.equals(xtr.getLocalName()))) {
|
||||
//
|
||||
// activeSubProcessList.remove(activeSubProcessList.size() - 1);
|
||||
// }
|
||||
//
|
||||
// if (!xtr.isStartElement()) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (ELEMENT_DEFINITIONS.equals(xtr.getLocalName())) {
|
||||
// definitionsParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_RESOURCE.equals(xtr.getLocalName())) {
|
||||
// resourceParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_SIGNAL.equals(xtr.getLocalName())) {
|
||||
// signalParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_MESSAGE.equals(xtr.getLocalName())) {
|
||||
// messageParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_ERROR.equals(xtr.getLocalName())) {
|
||||
//
|
||||
// if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_ID))) {
|
||||
// model.addError(xtr.getAttributeValue(null, ATTRIBUTE_ID), xtr.getAttributeValue(null, ATTRIBUTE_ERROR_CODE));
|
||||
// }
|
||||
//
|
||||
// } else if (ELEMENT_ESCALATION.equals(xtr.getLocalName())) {
|
||||
//
|
||||
// if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_ID))) {
|
||||
// model.addEscalation(xtr.getAttributeValue(null, ATTRIBUTE_ID), xtr.getAttributeValue(null, ATTRIBUTE_ESCALATION_CODE),
|
||||
// xtr.getAttributeValue(null, ATTRIBUTE_NAME));
|
||||
// }
|
||||
//
|
||||
// } else if (ELEMENT_IMPORT.equals(xtr.getLocalName())) {
|
||||
// importParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_ITEM_DEFINITION.equals(xtr.getLocalName())) {
|
||||
// itemDefinitionParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_DATA_STORE.equals(xtr.getLocalName())) {
|
||||
// dataStoreParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_INTERFACE.equals(xtr.getLocalName())) {
|
||||
// interfaceParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_IOSPECIFICATION.equals(xtr.getLocalName())) {
|
||||
// ioSpecificationParser.parseChildElement(xtr, activeProcess, model);
|
||||
//
|
||||
// } else if (ELEMENT_PARTICIPANT.equals(xtr.getLocalName())) {
|
||||
// participantParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_MESSAGE_FLOW.equals(xtr.getLocalName())) {
|
||||
// messageFlowParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_PROCESS.equals(xtr.getLocalName())) {
|
||||
//
|
||||
// Process process = processParser.parse(xtr, model);
|
||||
// if (process != null) {
|
||||
// activeProcess = process;
|
||||
// // copy over anything already parsed
|
||||
// process.setAttributes(activeProcess.getAttributes());
|
||||
// process.setDocumentation(activeProcess.getDocumentation());
|
||||
// process.setExtensionElements(activeProcess.getExtensionElements());
|
||||
// }
|
||||
//
|
||||
// } else if (ELEMENT_POTENTIAL_STARTER.equals(xtr.getLocalName())) {
|
||||
// potentialStarterParser.parse(xtr, activeProcess);
|
||||
//
|
||||
// } else if (ELEMENT_LANE.equals(xtr.getLocalName())) {
|
||||
// laneParser.parse(xtr, activeProcess, model);
|
||||
//
|
||||
// } else if (ELEMENT_DOCUMENTATION.equals(xtr.getLocalName())) {
|
||||
//
|
||||
// BaseElement parentElement = null;
|
||||
// if (!activeSubProcessList.isEmpty()) {
|
||||
// parentElement = activeSubProcessList.get(activeSubProcessList.size() - 1);
|
||||
// } else if (activeProcess != null) {
|
||||
// parentElement = activeProcess;
|
||||
// }
|
||||
// documentationParser.parseChildElement(xtr, parentElement, model);
|
||||
//
|
||||
// } else if (activeProcess == null && ELEMENT_TEXT_ANNOTATION.equals(xtr.getLocalName())) {
|
||||
// String elementId = xtr.getAttributeValue(null, ATTRIBUTE_ID);
|
||||
// TextAnnotation textAnnotation = (TextAnnotation) new TextAnnotationXMLConverter().convertXMLToElement(xtr, model);
|
||||
// textAnnotation.setId(elementId);
|
||||
// model.getGlobalArtifacts().add(textAnnotation);
|
||||
//
|
||||
// } else if (activeProcess == null && ELEMENT_ASSOCIATION.equals(xtr.getLocalName())) {
|
||||
// String elementId = xtr.getAttributeValue(null, ATTRIBUTE_ID);
|
||||
// Association association = (Association) new AssociationXMLConverter().convertXMLToElement(xtr, model);
|
||||
// association.setId(elementId);
|
||||
// model.getGlobalArtifacts().add(association);
|
||||
//
|
||||
// } else if (ELEMENT_EXTENSIONS.equals(xtr.getLocalName())) {
|
||||
// extensionElementsParser.parse(xtr, activeSubProcessList, activeProcess, model);
|
||||
//
|
||||
// } else if (ELEMENT_SUBPROCESS.equals(xtr.getLocalName()) || ELEMENT_TRANSACTION.equals(xtr.getLocalName()) || ELEMENT_ADHOC_SUBPROCESS.equals(xtr.getLocalName())) {
|
||||
// subProcessParser.parse(xtr, activeSubProcessList, activeProcess);
|
||||
//
|
||||
// } else if (ELEMENT_COMPLETION_CONDITION.equals(xtr.getLocalName())) {
|
||||
// if (!activeSubProcessList.isEmpty()) {
|
||||
// SubProcess subProcess = activeSubProcessList.get(activeSubProcessList.size() - 1);
|
||||
// if (subProcess instanceof AdhocSubProcess) {
|
||||
// AdhocSubProcess adhocSubProcess = (AdhocSubProcess) subProcess;
|
||||
// adhocSubProcess.setCompletionCondition(xtr.getElementText());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// } else if (ELEMENT_DI_SHAPE.equals(xtr.getLocalName())) {
|
||||
// bpmnShapeParser.parse(xtr, model);
|
||||
//
|
||||
// } else if (ELEMENT_DI_EDGE.equals(xtr.getLocalName())) {
|
||||
// bpmnEdgeParser.parse(xtr, model);
|
||||
//
|
||||
// } else {
|
||||
//
|
||||
// if (!activeSubProcessList.isEmpty() && ELEMENT_MULTIINSTANCE.equalsIgnoreCase(xtr.getLocalName())) {
|
||||
// multiInstanceParser.parseChildElement(xtr, activeSubProcessList.get(activeSubProcessList.size() - 1), model);
|
||||
//
|
||||
// } else if (convertersToBpmnMap.containsKey(xtr.getLocalName())) {
|
||||
// if (activeProcess != null) {
|
||||
// BaseBpmnXMLConverter converter = convertersToBpmnMap.get(xtr.getLocalName());
|
||||
// converter.convertToBpmnModel(xtr, model, activeProcess, activeSubProcessList);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (Process process : model.getProcesses()) {
|
||||
// for (Pool pool : model.getPools()) {
|
||||
// if (process.getId().equals(pool.getProcessRef())) {
|
||||
// pool.setExecutable(process.isExecutable());
|
||||
// }
|
||||
// }
|
||||
// processFlowElements(process.getFlowElements(), process);
|
||||
// }
|
||||
//
|
||||
// } catch (XMLException e) {
|
||||
// throw e;
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// LOGGER.error("Error processing BPMN document", e);
|
||||
// throw new XMLException("Error processing BPMN document", e);
|
||||
// }
|
||||
// return model;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class StartEventConverter extends BaseNodeConverter {
|
||||
start.setName(properties.getString("name"));
|
||||
start.setDocumentation(properties.getString("documentation"));
|
||||
//设置触发事件
|
||||
start.setPassNode(true);
|
||||
start.setPassNode(properties.getBoolean("passNode"));
|
||||
start.setExecutionListeners(null);
|
||||
start.setSkipExpression(properties.getString("skipExpression"));
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public abstract class FlowNodeActivityBehavior<T> {
|
||||
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
|
||||
.eq("proc_inst_id",entity.getProc_inst_id())
|
||||
.set("status", StatusEnum.FLOW_STATUS.code("暂停"))
|
||||
.set("remark","流程节点:"+entity.getActivityName()+"执行错误"+ex.getMessage()));
|
||||
.set("remark","节点:"+entity.getActivityName()+":异常:"+ex.getMessage()));
|
||||
}
|
||||
}
|
||||
private final void leaveActivity(ExecutionEntity<T> entity) {
|
||||
|
||||
@@ -72,8 +72,7 @@ public class SubProcessActivityBehavior extends FlowNodeActivityBehavior<JSONObj
|
||||
subEntity.setForm_type(entity.getForm_type());
|
||||
subEntity.setDeploymentId(entity.getDeploymentId());
|
||||
subEntity.setCurrentFlowElement(startEvent);
|
||||
new JSONObject(form);
|
||||
subEntity.setT(entity.getT());
|
||||
subEntity.setT(o);
|
||||
//在endEvent中有个所有子流程结束的判断:如果判断成功会触发父流程:startEvent暂时通过等待处理防止自动流程导致endEvent判断出错
|
||||
commandExecutor.execute(new StartInstanceCmd(), subEntity);
|
||||
}).exceptionally(throwable -> {
|
||||
|
||||
@@ -64,21 +64,17 @@ public class DecisionHandler extends TypeHandler<JSONObject,JSONObject> {
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
throw new BadRequestException("当前分配策略无可用货位");
|
||||
}
|
||||
//跟新货位载具
|
||||
String struct_code = list.get(0).getStruct_code();
|
||||
//更新仓位,更新数据
|
||||
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
|
||||
.set("vahicle_code",struct_code)
|
||||
.eq("struct_code",struct_code));
|
||||
// iPmFormDataService.updateById(iostorinvdtlIn);
|
||||
stIvtIostorinvdtlInService.updateById(iostorinvdtlIn);
|
||||
item_json.getJSONObject("form_data").put("point_code2", struct_code);
|
||||
}
|
||||
//跟新货位载具
|
||||
System.out.println(list);
|
||||
// JSONArray item = entity.getJSONArray("item");
|
||||
// for (int i = 0; i < item.size(); i++) {
|
||||
//
|
||||
// }
|
||||
String struct_code = list.get(0).getStruct_code();
|
||||
//更新仓位,更新数据
|
||||
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
|
||||
.set("vehicle_code",iostorinvdtlIn.getVehicle_code())
|
||||
.eq("struct_code",struct_code));
|
||||
stIvtIostorinvdtlInService.update(new UpdateWrapper<StIvtIostorinvdtlIn>()
|
||||
.set("vehicle_code",struct_code)
|
||||
.eq("id",iostorinvdtlIn.getId()));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ spring:
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:password}
|
||||
password: ${DB_PWD:123456}
|
||||
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
|
||||
Reference in New Issue
Block a user