fix:联调出入库问题处理
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package org.nl.wms.decision_manage.handler.chainer.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.Data;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.SpringContextHolder;
|
||||
import org.nl.wms.decision_manage.handler.chainer.DecisionerChain;
|
||||
import org.nl.wms.md_manage.vehicleMater.service.IMdPbVehicleMaterService;
|
||||
@@ -54,17 +56,26 @@ public class EndDecisionChainer extends DecisionerChain<List> {
|
||||
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
|
||||
.set("vehicle_code", startParam.getString("vehicle_code"))
|
||||
.set("lock_type", StatusEnum.LOCK.code("入库锁"))
|
||||
.set("update_time", DateUtil.now())
|
||||
.set("update_name", SecurityUtils.getCurrentNickName())
|
||||
.eq("struct_code", structattr.getStruct_code()));
|
||||
System.out.println("货位绑定成功"+structattr.getStruct_code()+"_"+startParam.getString("vehicle_code"));
|
||||
structs.add(structattr.getStruct_code());
|
||||
}else {
|
||||
for (StructattrVechielDto vechielDto : ((List<StructattrVechielDto>) transfers)) {
|
||||
List<StructattrVechielDto> vechielDtos = transfers;
|
||||
for (StructattrVechielDto vechielDto : vechielDtos) {
|
||||
iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
|
||||
.set("frozen_qty",vechielDto.getFrozen_qty())
|
||||
.eq("id",vechielDto.getVm_id()));
|
||||
}
|
||||
List<String> collect = ((List<StructattrVechielDto>) transfers).stream().map(StructattrVechielDto::getVehicle_code).collect(Collectors.toList());
|
||||
System.out.println("载具绑定成功"+collect.toString());
|
||||
List<String> structCodes = vechielDtos.stream().map(StructattrVechielDto::getStruct_code).collect(Collectors.toList());
|
||||
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
|
||||
.set("lock_type", StatusEnum.LOCK.code("出库锁"))
|
||||
.set("update_time", DateUtil.now())
|
||||
.set("update_name", SecurityUtils.getCurrentNickName())
|
||||
.in("struct_code", structCodes));
|
||||
List<String> collect = vechielDtos.stream().map(StructattrVechielDto::getVehicle_code).collect(Collectors.toList());
|
||||
System.out.println("载具绑定成功"+collect);
|
||||
structs = collect;
|
||||
}
|
||||
return structs;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class StartDecisionChainer extends DecisionerChain<List> {
|
||||
list = iStIvtStructattrService.list(query);
|
||||
}else {
|
||||
//出库流程由于有货货位较多:会生成多个对象容易内存益出,在fifo中直接通过materilal过滤目标
|
||||
list = iStIvtStructattrService.structVehicle(MapOf.of("stor_code",startParam.getString("stor_code")));
|
||||
// list = iStIvtStructattrService.structVehicle(MapOf.of("stor_code",startParam.getString("stor_code")));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@ public abstract class Decisioner<T,P> implements InitializingBean {
|
||||
public StStrategyConfig strategyConfig;
|
||||
@Autowired
|
||||
private IStStrategyConfigService iStStrategyConfigService;
|
||||
@Autowired
|
||||
private SpringContextHolder springContextHolder;
|
||||
|
||||
public abstract List<T> handler(List<T> list, P param);
|
||||
|
||||
|
||||
@@ -1,34 +1,35 @@
|
||||
package org.nl.wms.decision_manage.handler.decisioner.impl.base;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.utils.ListOf;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.wms.stor_manage.io.service.iostor_dtl.IStIvtIostorinvdtlService;
|
||||
import org.nl.wms.stor_manage.struct.service.IStIvtStructattrService;
|
||||
import org.nl.wms.stor_manage.struct.service.dao.StIvtStructattr;
|
||||
import org.nl.wms.stor_manage.struct.service.dao.StIvtStructattr2;
|
||||
import org.nl.wms.stor_manage.struct.service.dto.StructattrQuery;
|
||||
import org.nl.wms.decision_manage.handler.decisioner.Decisioner;
|
||||
import org.nl.wms.pm_manage.form_data.service.dao.PmFormData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2024/4/6 16:18
|
||||
* 巷道均衡策略
|
||||
* 巷道均衡策略:XYZ:排列层
|
||||
*/
|
||||
@Service("alleyAve")
|
||||
public class AlleyAveRuleHandler extends Decisioner<StIvtStructattr, PmFormData> {
|
||||
@Slf4j
|
||||
public class AlleyAveRuleHandler extends Decisioner<StIvtStructattr, JSONObject> {
|
||||
|
||||
/**
|
||||
* 出入库明细服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtIostorinvdtlService iStIvtIostorinvdtlService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructattrService iStIvtStructattrService;
|
||||
@@ -45,32 +46,74 @@ public class AlleyAveRuleHandler extends Decisioner<StIvtStructattr, PmFormData>
|
||||
* @return List<StIvtStructattr> :仓位集合
|
||||
*/
|
||||
@Override
|
||||
public List<StIvtStructattr> handler(List<StIvtStructattr> list, PmFormData param) {
|
||||
public List<StIvtStructattr> handler(List<StIvtStructattr> list, JSONObject param) {
|
||||
// 判断仓位是否为空
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return list;
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
throw new BadRequestException("当前分配策略alleyAve无可用货位");
|
||||
}
|
||||
|
||||
List<StIvtStructattr> resultList = new ArrayList<>();
|
||||
|
||||
switch (strategyConfig.getStrategy_type()) {
|
||||
case "1":
|
||||
// 入库策略
|
||||
resultList = inHandler(list,param);
|
||||
break;
|
||||
case "2":
|
||||
// 出库策略
|
||||
// resultList = outHandler(list,jsonParam);
|
||||
break;
|
||||
case "3":
|
||||
// 通用策略
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("策略类型错误!");
|
||||
}
|
||||
return resultList;
|
||||
/**
|
||||
* 根据XYZ进行均衡排序:排层列
|
||||
*/
|
||||
String configParam = this.strategyConfig.getParam();
|
||||
List<String> configList = JSONObject.parseArray(configParam, String.class);
|
||||
list.sort((o1, o2) -> {
|
||||
Integer rowNum1 = o1.getRow_num();
|
||||
Integer colNum1 = o1.getCol_num();
|
||||
Integer layerNum1 = o1.getLayer_num();
|
||||
Integer rowNum2 = o2.getRow_num();
|
||||
Integer colNum2 = o2.getCol_num();
|
||||
Integer layerNum2 = o2.getLayer_num();
|
||||
HashMap<String,Integer> of1 = MapOf.of("x", rowNum1, "y", colNum1, "z", layerNum1);
|
||||
HashMap<String,Integer> of2 = MapOf.of("x", rowNum2, "y", colNum2, "z", layerNum2);
|
||||
for (String sort : configList) {
|
||||
if (of1.get(sort)>of2.get(sort)){
|
||||
return 1;
|
||||
}
|
||||
if (of1.get(sort)<of2.get(sort)){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
List<StIvtStructattr> subList = list.subList(0, list.size()>10?10:list.size());
|
||||
log.info("均衡策略结果"+subList.stream().map(StIvtStructattr::getStruct_code).collect(Collectors.toList()));
|
||||
return subList;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<StIvtStructattr2> list = new ArrayList<>();
|
||||
for (int i =0;i<10;i++){
|
||||
StIvtStructattr2 structattr = new StIvtStructattr2();
|
||||
structattr.setRow_num(new Random().nextInt(2)+1);
|
||||
structattr.setCol_num(new Random().nextInt(10)+1);
|
||||
structattr.setLayer_num(new Random().nextInt(2)+1);
|
||||
list.add(structattr);
|
||||
}
|
||||
System.out.println(list);
|
||||
ArrayList<String> of = ListOf.of("x", "z","y");
|
||||
list.sort((o1, o2) -> {
|
||||
Integer rowNum1 = o1.getRow_num();
|
||||
Integer colNum1 = o1.getCol_num();
|
||||
Integer layerNum1 = o1.getLayer_num();
|
||||
Integer rowNum2 = o2.getRow_num();
|
||||
Integer colNum2 = o2.getCol_num();
|
||||
Integer layerNum2 = o2.getLayer_num();
|
||||
HashMap<String,Integer> of1 = MapOf.of("x", rowNum1, "y", colNum1, "z", layerNum1);
|
||||
HashMap<String,Integer> of2 = MapOf.of("x", rowNum2, "y", colNum2, "z", layerNum2);
|
||||
for (String sort : of) {
|
||||
Integer in1 = of1.get(sort);
|
||||
Integer in2 = of2.get(sort);
|
||||
if (in1 > in2){
|
||||
return 1;
|
||||
}
|
||||
if (in1 < in2){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
System.out.println(list.toString());
|
||||
}
|
||||
/**
|
||||
* 入库策略
|
||||
* @param attrList :仓位集合
|
||||
@@ -88,7 +131,6 @@ public class AlleyAveRuleHandler extends Decisioner<StIvtStructattr, PmFormData>
|
||||
List<StIvtStructattr> blockAttrList = null;
|
||||
iStIvtStructattrService.getByQuery(new StructattrQuery());
|
||||
|
||||
|
||||
// 如果为空说明这些巷道都没有相同物料的巷道,则返回所有仓位
|
||||
if (ObjectUtil.isEmpty(blockAttrList)) {
|
||||
return attrList;
|
||||
@@ -120,77 +162,6 @@ public class AlleyAveRuleHandler extends Decisioner<StIvtStructattr, PmFormData>
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库策略
|
||||
* @param attrList :仓位物料信息
|
||||
* @param jsonParam:iostorinvdtlId : 出入库明细标识(此方法只根据明细物料匹配)
|
||||
* @return List<StIvtStructattr> :需出库仓位集合
|
||||
*/
|
||||
// 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) {
|
||||
// // 找出物料最多的巷道
|
||||
// int blockNum = getMaxMaterial(attrList);
|
||||
//
|
||||
// // 匹配此巷道对应的仓位物料
|
||||
// StIvtStructattr attrDao = attrList.stream()
|
||||
// .filter(row -> row.getBlock_num().intValue() == blockNum)
|
||||
// .findFirst().orElse(null);
|
||||
//
|
||||
// if (ObjectUtil.isEmpty(attrDao)) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// // 添加需返回的仓位物料
|
||||
// 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;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 出库策略 - 查询物料最多的巷道
|
||||
* @param attrList: 仓位物料
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.decision_manage.handler.decisioner.impl.base;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.utils.MapOf;
|
||||
|
||||
@@ -23,6 +24,7 @@ import java.util.stream.Collectors;
|
||||
* 先进先出策略
|
||||
*/
|
||||
@Service("fifo")
|
||||
@Slf4j
|
||||
public class FIFORuleHandler extends Decisioner<StructattrVechielDto, JSONObject> {
|
||||
|
||||
/**
|
||||
@@ -53,6 +55,7 @@ public class FIFORuleHandler extends Decisioner<StructattrVechielDto, JSONObject
|
||||
//分配数量
|
||||
int plan_qty = param.getInteger("qty");
|
||||
//当前条件只有id,批次
|
||||
log.info("---------执行fifo出库分配规则---------");
|
||||
List<StructattrVechielDto> vechielDtos = iStIvtStructattrService.collectVechicle(MapOf.of("material_id", param.getString("material_id")
|
||||
, "pcsn", param.getString("pcsn")
|
||||
, "stor_code", param.getString("stor_code")
|
||||
@@ -62,8 +65,6 @@ public class FIFORuleHandler extends Decisioner<StructattrVechielDto, JSONObject
|
||||
);
|
||||
int finalPlan_qty = 0;
|
||||
// vechielDtos.sort(Comparator.comparingInt(o -> (o.getQty().intValue() - finalPlan_qty)));
|
||||
|
||||
|
||||
List<StructattrVechielDto> disList = new ArrayList<>();
|
||||
for (StructattrVechielDto structattr : vechielDtos) {
|
||||
// if (need.contains(structattr.getVehicle_code()) && structattr.getFrozen_qty().intValue()==0){
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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 org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.constant.DictConstantPool;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
@@ -101,6 +102,13 @@ public class ConveyorOutStorageTask extends AbstractTask {
|
||||
@Override
|
||||
public void finish(JSONObject data) {
|
||||
data.put("status", StatusEnum.FORM_STATUS.code("完成"));
|
||||
String vehicle_code = data.getString("vehicle_code");
|
||||
iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
|
||||
.set("frozen_qty",0)
|
||||
.set("proc_inst_id",null)
|
||||
.set("update_time",DateUtil.now())
|
||||
.eq("vehicle_code",vehicle_code)
|
||||
.eq("is_delete",false));
|
||||
this.updateTask(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ public class OutStorageTask extends AbstractTask {
|
||||
AtomicReference<String> moveStruct = new AtomicReference<>();
|
||||
RedissonUtils.lock(() -> {
|
||||
System.out.println("---3--" + Thread.currentThread().getName());
|
||||
Map process = SpringContextHolder.getBean(DecisionHandler.class).dispenseTransa(ListOf.of("nearby","depthPriority"), new JSONObject(MapOf.of("stor_code", block.getStor_code())));
|
||||
Map process = SpringContextHolder.getBean(DecisionHandler.class).dispenseTransa(ListOf.of("depthPriority","nearby"), new JSONObject(MapOf.of("stor_code", block.getStor_code())));
|
||||
moveStruct.set(((Map<String, String>) process.get("form_data")).get("end_struct_code"));
|
||||
}, "1" + block.getStor_code(), 5);
|
||||
Map moveForm = MapOf.of("task_type", StatusEnum.IOBILL_TYPE_MOVE.code("移库")
|
||||
|
||||
@@ -94,6 +94,7 @@ public class ToPickPlatformTask extends AbstractTask {
|
||||
task.setPoint_code2(target_point);
|
||||
iSchBaseTaskService.save(task);
|
||||
Lask_Point = target_point;
|
||||
log.info("当前拣选平台分配位置:{},{}",Lask_Point,target_point);
|
||||
iMdPbVehicleMaterService.update(new LambdaUpdateWrapper<MdPbVehicleMater>()
|
||||
.set(MdPbVehicleMater::getTask_code,task.getTask_code())
|
||||
.eq(MdPbVehicleMater::getVehicle_code,task.getVehicle_code())
|
||||
|
||||
@@ -6,15 +6,12 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.entity.PageQuery;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
@@ -119,7 +116,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
String now = DateUtil.now();
|
||||
Assert.notNull(entity.getStatus(), "任务状态不能为空!");
|
||||
|
||||
entity.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setId(IdUtil.getStringId());
|
||||
entity.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
@@ -204,18 +201,20 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
MdPbVehicleMater vehicleCode = iMdPbVehicleMaterService.getOne(new QueryWrapper<MdPbVehicleMater>()
|
||||
.eq("vehicle_code", task.getVehicle_code())
|
||||
.eq("is_delete",false));
|
||||
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
|
||||
.set("status", StatusEnum.FLOW_STATUS.code("异常完成"))
|
||||
.set("remark", task.getVehicle_code() + "载具空出:货位" + struct_code)
|
||||
.eq("proc_inst_id", vehicleCode.getProc_inst_id()));
|
||||
if (vehicleCode!=null){
|
||||
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
|
||||
.set("status", StatusEnum.FLOW_STATUS.code("异常完成"))
|
||||
.set("remark", task.getVehicle_code() + "载具空出:货位" + struct_code)
|
||||
.eq("proc_inst_id", vehicleCode.getProc_inst_id()));
|
||||
}
|
||||
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
|
||||
.set("update_time", DateUtil.now())
|
||||
.set("vehicle_code", null)
|
||||
.set("remark", struct_code + "出库异常")
|
||||
.set("remark", struct_code + "空出异常")
|
||||
.eq("struct_code", struct_code));
|
||||
this.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("status", StatusEnum.FORM_STATUS.code("取消"))
|
||||
.set("remark", struct_code + "出库异常")
|
||||
.set("remark", struct_code + "空出异常")
|
||||
.set("update_time", DateUtil.now())
|
||||
.eq("task_code", task_code));
|
||||
break;
|
||||
@@ -259,30 +258,35 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
.getOne(new QueryWrapper<MdPbVehicleMater>()
|
||||
.eq("vehicle_code", task.getVehicle_code())
|
||||
.eq("is_delete",false));
|
||||
//查询分配规则
|
||||
Map map = SpringContextHolder.getBean(DecisionHandler.class)
|
||||
.dispenseTransa(ListOf.of("nearby"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code())));
|
||||
String new_struct_code = ((Map<String, String>) map.get("form_data")).get("end_struct_code");
|
||||
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
|
||||
.set("remark", stIvtStructattr.getStruct_code() + "入满异常重新分配货位" + new_struct_code)
|
||||
.eq("proc_inst_id", vehicleCode.getProc_inst_id()));
|
||||
this.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("point_code2", new_struct_code)
|
||||
.set("remark", stIvtStructattr.getStor_code() + "入满异常重新分配货位" + new_struct_code)
|
||||
.eq("task_code", task_code));
|
||||
//阻挡位锁定
|
||||
if (StringUtils.isEmpty(stIvtStructattr.getVehicle_code())){
|
||||
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
|
||||
.eq("struct_code", stIvtStructattr.getStruct_code())
|
||||
.set("lock_type", StatusEnum.LOCK.code("异常锁定"))
|
||||
.set("update_time", DateUtil.now())
|
||||
.set("remark", "入满异常:" + task_code)
|
||||
.set("vehicle_code", "YCZD" + task_code));
|
||||
.set("vehicle_code", task_code+"_ZD_"+ org.nl.common.utils.IdUtil.getStringId()));
|
||||
}
|
||||
//深货位锁定防止二次分配到
|
||||
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
|
||||
.set("update_time", DateUtil.now())
|
||||
.set("vehicle_code", null)
|
||||
.set("lock_type", StatusEnum.LOCK.code("无锁"))
|
||||
.set("remark", stIvtStructattr.getStruct_code() + "入满异常重新分配货位")
|
||||
.set("lock_type", StatusEnum.LOCK.code("异常锁定"))
|
||||
.eq("struct_code", task.getPoint_code2()));
|
||||
//查询分配规则
|
||||
Map map = SpringContextHolder.getBean(DecisionHandler.class)
|
||||
.dispenseTransa(ListOf.of("depthPriority","passRCL","nearby"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code())));
|
||||
String new_struct_code = ((Map<String, String>) map.get("form_data")).get("end_struct_code");
|
||||
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
|
||||
.set("remark", stIvtStructattr.getStruct_code() + "入满异常重新分配货位" + new_struct_code)
|
||||
.eq("proc_inst_id", vehicleCode.getProc_inst_id()));
|
||||
this.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("point_code2", new_struct_code)
|
||||
.set("remark", stIvtStructattr.getStruct_code() + "入满异常重新分配货位" + new_struct_code)
|
||||
.eq("task_code", task_code));
|
||||
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("point_code2", new_struct_code);
|
||||
return result;
|
||||
@@ -295,21 +299,24 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
.eq("is_delete",false));
|
||||
//查询分配规则
|
||||
Map map = SpringContextHolder.getBean(DecisionHandler.class)
|
||||
.dispenseTransa(ListOf.of("nearby"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code())));
|
||||
.dispenseTransa(ListOf.of("depthPriority","passRCL","nearby"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code())));
|
||||
String new_struct_code = ((Map<String, String>) map.get("form_data")).get("end_struct_code");
|
||||
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
|
||||
.set("remark", stIvtStructattr.getStruct_code() + "入满异常重新分配货位" + new_struct_code)
|
||||
.eq("proc_inst_id", vehicleCode.getProc_inst_id()));
|
||||
if (vehicleCode!=null){
|
||||
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
|
||||
.set("remark", stIvtStructattr.getStruct_code() + "入满异常重新分配货位" + new_struct_code)
|
||||
.eq("proc_inst_id", vehicleCode.getProc_inst_id()));
|
||||
}
|
||||
|
||||
this.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("point_code2", new_struct_code)
|
||||
.set("remark", stIvtStructattr.getStor_code() + "入满异常重新分配货位" + new_struct_code)
|
||||
.set("remark", stIvtStructattr.getStruct_code() + "入满异常重新分配货位" + new_struct_code)
|
||||
.eq("task_code", task_code));
|
||||
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
|
||||
.eq("struct_code", stIvtStructattr.getStruct_code())
|
||||
.set("lock_type", StatusEnum.LOCK.code("异常锁定"))
|
||||
.set("update_time", DateUtil.now())
|
||||
.set("remark", "入满异常:" + task_code)
|
||||
.set("vehicle_code", "YCZD" + task_code));
|
||||
.set("vehicle_code", task_code+"_ZD_"+org.nl.common.utils.IdUtil.getStringId()));
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("point_code2", new_struct_code);
|
||||
return result;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class DecisionHandler extends TypeHandler<JSONObject,ExecutionEntity<JSON
|
||||
System.out.println("---3--"+Thread.currentThread().getName());
|
||||
Map<String, String> process = SpringContextHolder.getBean(DecisionHandler.class).dispenseTransa(params, iostorinvdtl);
|
||||
atomicResult.set(process);
|
||||
},decisioner.strategyConfig.getStrategy_type()+iostorinvdtl.getString("stor_code"),5);
|
||||
},decisioner.strategyConfig.getStrategy_type()+iostorinvdtl.getString("stor_code"),8);
|
||||
return atomicResult.get();
|
||||
}
|
||||
@Transactional(propagation= Propagation.REQUIRES_NEW)
|
||||
|
||||
@@ -45,6 +45,8 @@ public class DeviceManageController {
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
@Autowired
|
||||
private IBmVehicleInfoService iBmVehicleInfoService;
|
||||
@Autowired
|
||||
private IMdPbVehicleMaterService iMdPbVehicleMaterService;
|
||||
|
||||
/**
|
||||
* 切换出入库模式
|
||||
@@ -88,9 +90,17 @@ public class DeviceManageController {
|
||||
if (code!=null && !code.getIs_used()){
|
||||
throw new BadRequestException(String.format("输送线%s模式不正确不允许下发运动",device_code));
|
||||
}
|
||||
BmVehicleInfo vehicleInfo = iBmVehicleInfoService.getOne(new QueryWrapper<BmVehicleInfo>().eq("vehicle_code", vehicleCode));
|
||||
BmVehicleInfo vehicleInfo = iBmVehicleInfoService.getOne(new QueryWrapper<BmVehicleInfo>()
|
||||
.eq("vehicle_code", vehicleCode));
|
||||
if (vehicleInfo == null ){
|
||||
throw new BadRequestException(String.format("载具信息不存在"));
|
||||
throw new BadRequestException(String.format(vehicleCode+"载具信息不存在"));
|
||||
}
|
||||
MdPbVehicleMater vehicleMater = iMdPbVehicleMaterService.getOne(new QueryWrapper<MdPbVehicleMater>()
|
||||
.eq("vehicle_code", vehicleCode)
|
||||
.isNull("proc_inst_id")
|
||||
.eq("is_delete", false));
|
||||
if (vehicleMater == null){
|
||||
throw new BadRequestException(String.format(vehicleCode+"载具组盘信息不存在"));
|
||||
}
|
||||
wmsToAcsService.toCommand(device_code,form.getMode(),vehicleInfo.getH());
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.pda_manage.iostorage;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -10,6 +11,7 @@ import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.flow_manage.flow.service.execution.IActRuExecutionService;
|
||||
import org.nl.wms.flow_manage.flow.service.execution.dao.ActRuExecution;
|
||||
import org.nl.wms.md_manage.vehicleMater.service.IMdPbVehicleMaterService;
|
||||
@@ -62,6 +64,9 @@ public class IOStorageController {
|
||||
}
|
||||
iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
|
||||
.set("is_delete",true)
|
||||
.set("proc_inst_id",null)
|
||||
.set("update_time", DateUtil.now())
|
||||
.set("update_name", SecurityUtils.getCurrentNickName())
|
||||
.eq("id",one.getId()));
|
||||
}
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.entity.PageQuery;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
|
||||
import org.nl.wms.pm_manage.form_data.service.dao.PmFormData;
|
||||
import org.nl.wms.pm_manage.form_data.service.dto.FormDataQuery;
|
||||
@@ -67,7 +68,9 @@ public class PickingController {
|
||||
@PostMapping("/savePickTask")
|
||||
@Log("拣选作业")
|
||||
public ResponseEntity<Object> savePickTask(@RequestBody JSONArray params) {
|
||||
pickingService.savePickTask(params);
|
||||
RedissonUtils.lock( ()->
|
||||
pickingService.savePickTask(params)
|
||||
,"拣选作业"+params.getJSONObject(0).getString("parent_id"),null);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -84,7 +87,9 @@ public class PickingController {
|
||||
@PostMapping("/taskOpen")
|
||||
@Log("拣选作业下发")
|
||||
public ResponseEntity<Object> taskOpen(@RequestBody JSONObject param) {
|
||||
pickingService.taskOpen(param);
|
||||
RedissonUtils.lock(()->{
|
||||
pickingService.taskOpen(param);
|
||||
},"拣选作业"+param.getString("param"),null);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class PickingService {
|
||||
int mCode = iMdPbVehicleMaterService.count(new QueryWrapper<MdPbVehicleMater>()
|
||||
.in("vehicle_code", vehicleCodes).eq("is_delete",false));
|
||||
if (mCode > 0) {
|
||||
throw new BadRequestException("当前载具" + vehicleCodes.toString() + "以存在载具物料信息");
|
||||
throw new BadRequestException("当前载具" + vehicleCodes + "以存在载具物料信息");
|
||||
}
|
||||
String now = DateUtil.now();
|
||||
String user = SecurityUtils.getCurrentNickName();
|
||||
@@ -111,6 +111,10 @@ public class PickingService {
|
||||
if (StringUtils.isEmpty(task_type)) {
|
||||
throw new BadRequestException("创建失败:未配置任务类型");
|
||||
}
|
||||
String outbound = data.getForm_data().getString("outbound");
|
||||
if (task_type.equals("23") && StringUtils.isEmpty(outbound)){
|
||||
throw new BadRequestException("创建失败:拣选出库未选择出库口");
|
||||
}
|
||||
data.setCreate_time(now);
|
||||
data.setCreate_name(user);
|
||||
data.setId(IdUtil.getStringId());
|
||||
@@ -160,7 +164,7 @@ public class PickingService {
|
||||
for (ExecutionDto executionDto : dto.getItem()) {
|
||||
for (ExecutionDto executionDto1 : executionDto.getItem()) {
|
||||
JSONObject dis = executionDto1.getT();
|
||||
if (!"false".equals(dis.getJSONObject("form_data").getString("s_move"))) {
|
||||
if (!"false".equals(dis.getJSONObject("form_data").getString("is_move"))) {
|
||||
String vehicle_code = dis.getString("vehicle_code");
|
||||
BmVehicleInfo vehicleInfo = iBmVehicleInfoService.getOne(new QueryWrapper<BmVehicleInfo>().eq("vehicle_code", vehicle_code));
|
||||
if (vehicleInfo==null || vehicleInfo.getH()==null ||vehicleInfo.getH().intValue()<1){
|
||||
@@ -174,6 +178,7 @@ public class PickingService {
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("拣选平台输送线分配信息"+converys);
|
||||
for (Map<String,Object> convery : converys) {
|
||||
wmsToAcsService.toCommand((String)convery.get("c"), "1",(Integer) convery.get("v"));
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
</if>
|
||||
<if test="is_lock != null and is_lock != ''">
|
||||
and md_pb_vehicleMater.is_lock = false
|
||||
and st_ivt_structattr.lock_type = '00'
|
||||
and md_pb_vehicleMater.frozen_qty = 0
|
||||
</if>
|
||||
<if test="order_by != null and order_by != ''">
|
||||
@@ -96,8 +97,8 @@
|
||||
st_ivt_structattr.*
|
||||
FROM st_ivt_structattr
|
||||
LEFT JOIN md_pb_vehicleMater ON st_ivt_structattr.vehicle_code = md_pb_vehicleMater.vehicle_code
|
||||
WHERE st_ivt_structattr.vehicle_code is not null
|
||||
and IF(ISNULL(md_pb_vehicleMater.is_lock),true,md_pb_vehicleMater.is_lock = false)
|
||||
WHERE st_ivt_structattr.vehicle_code is not null and md_pb_vehicleMater.frozen_qty = 0
|
||||
and md_pb_vehicleMater.is_lock = false
|
||||
<if test="stor_code != null and stor_code != ''">
|
||||
and st_ivt_structattr.stor_code = #{stor_code}
|
||||
</if>
|
||||
|
||||
@@ -75,7 +75,9 @@ public class StIvtStructattrServiceImpl extends ServiceImpl<StIvtStructattrMappe
|
||||
if (!growth && change_qty==null){
|
||||
wrapper.set("vehicle_code",null);
|
||||
}
|
||||
List<MdPbVehicleMater> vehicleMaters = vehicleMaterService.list(new QueryWrapper<MdPbVehicleMater>().eq("vehicle_code", vehicle_code));
|
||||
List<MdPbVehicleMater> vehicleMaters = vehicleMaterService.list(new QueryWrapper<MdPbVehicleMater>()
|
||||
.eq("vehicle_code", vehicle_code)
|
||||
.eq("is_delete",false));
|
||||
if (growth && CollectionUtils.isEmpty(vehicleMaters)){
|
||||
wrapper.set("lock_type",StatusEnum.LOCK.code("异常锁定"))
|
||||
.set("remark","异常入库");
|
||||
@@ -83,7 +85,13 @@ public class StIvtStructattrServiceImpl extends ServiceImpl<StIvtStructattrMappe
|
||||
this.update(wrapper);
|
||||
List<StIvtStructivtflow> records = new ArrayList<>();
|
||||
StIvtStructattr attr = this.getOne(new QueryWrapper<StIvtStructattr>().eq("struct_code", struct_code).select("stor_code"));
|
||||
//更新冻结数量
|
||||
for (MdPbVehicleMater vehicleMater : vehicleMaters) {
|
||||
vehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
|
||||
.set("frozen_qty",0)
|
||||
.set("proc_inst_id",null)
|
||||
.set("update_time",DateUtil.now())
|
||||
.eq("id",vehicleMater.getId()));
|
||||
StIvtStructivtflow record = new StIvtStructivtflow();
|
||||
record.setId(IdUtil.getStringId());
|
||||
record.setUpdate_time(DateUtil.now());
|
||||
@@ -102,6 +110,7 @@ public class StIvtStructattrServiceImpl extends ServiceImpl<StIvtStructattrMappe
|
||||
record.setVehicle_form_data(vehicleMater.getForm_data());
|
||||
record.setGrowth(growth);
|
||||
records.add(record);
|
||||
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(records)){
|
||||
structivtflowService.saveBatch(records);
|
||||
|
||||
@@ -83,10 +83,13 @@ public class TaskScheduleService {
|
||||
if (!CollectionUtils.isEmpty(taskCodes)){
|
||||
iSchBaseTaskService.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("status",StatusEnum.FORM_STATUS.code("下发"))
|
||||
.in("task_code",taskCodes));
|
||||
.in("task_codse",taskCodes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception ex){
|
||||
log.error("定时任务执行异常:"+ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
}finally {
|
||||
if (lock.isLocked() && lock.isHeldByCurrentThread()){
|
||||
lock.unlock();
|
||||
|
||||
@@ -357,13 +357,13 @@ function CRUD(options) {
|
||||
crud.status.edit = CRUD.STATUS.PROCESSING
|
||||
crud.crudMethod.edit(crud.form).then(() => {
|
||||
crud.status.edit = CRUD.STATUS.NORMAL
|
||||
crud.getDataStatus(crud.getDataId(crud.form)).edit = CRUD.STATUS.NORMAL
|
||||
// crud.getDataStatus(crud.getDataId(crud.form)).edit = CRUD.STATUS.NORMAL
|
||||
crud.editSuccessNotify()
|
||||
crud.resetForm()
|
||||
callVmHook(crud, CRUD.HOOK.afterSubmit)
|
||||
crud.refresh()
|
||||
}).catch(() => {
|
||||
crud.status.edit = CRUD.STATUS.PREPARED
|
||||
}).catch(err => {
|
||||
crud.status.edit = CRUD.STATUS.NORMAL
|
||||
callVmHook(crud, CRUD.HOOK.afterEditError)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="is_used">
|
||||
<el-switch v-model="form.is_used" active-value="1" inactive-value="0" />
|
||||
<el-switch v-model="form.is_used" :active-value=true :inactive-value=false />
|
||||
</el-form-item>
|
||||
<el-form-item v-show="pointTypesDialogList.length > 0" label="点位类型" prop="device_point_type">
|
||||
<el-select
|
||||
@@ -269,7 +269,7 @@ export default {
|
||||
return CRUD({
|
||||
title: '点位',
|
||||
url: 'api/point',
|
||||
idField: 'point_id',
|
||||
idField: 'id',
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: true,
|
||||
|
||||
@@ -139,6 +139,11 @@
|
||||
{{ statusEnum.label.TASK_TYPE[scope.row.task_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="vehicle_code" show-overflow-tooltip show-tooltip-when-overflow label="载具编码">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.vehicle_code ? scope.row.vehicle_code : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="acs_type" show-overflow-tooltip show-tooltip-when-overflow width="130" label="ACS任务类型"/>
|
||||
<el-table-column prop="status" show-overflow-tooltip show-tooltip-when-overflow label="任务状态">
|
||||
<template slot-scope="scope">
|
||||
@@ -151,11 +156,7 @@
|
||||
<el-table-column prop="point_code2" show-overflow-tooltip show-tooltip-when-overflow width="130" label="终点1"/>
|
||||
<el-table-column prop="point_code3" show-overflow-tooltip show-tooltip-when-overflow width="130" label="起点2"/>
|
||||
<el-table-column prop="point_code4" show-overflow-tooltip show-tooltip-when-overflow width="130" label="终点2"/>
|
||||
<el-table-column prop="vehicle_code" show-overflow-tooltip show-tooltip-when-overflow label="载具编码">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.vehicle_code ? scope.row.vehicle_code : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="priority" show-overflow-tooltip show-tooltip-when-overflow label="优先级"/>
|
||||
<el-table-column prop="handle_class" show-overflow-tooltip show-tooltip-when-overflow width="150" label="处理类"/>
|
||||
<el-table-column prop="is_send" show-overflow-tooltip show-tooltip-when-overflow label="立即下发"/>
|
||||
|
||||
@@ -379,6 +379,9 @@ export default {
|
||||
})
|
||||
this.tabledis[index].qty = this.currentDtl.qty-dis_assign_qty
|
||||
}
|
||||
if (taskType == "23"){
|
||||
this.tabledis[index].qty = this.currentDtl.assign_qty
|
||||
}
|
||||
},
|
||||
savePickTask() {
|
||||
pick.savePickTask(this.tabledis).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user