'add:双工位堆垛机开发'
This commit is contained in:
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.domain.DeviceExtra;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
@@ -35,6 +36,7 @@ import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 双工位堆垛机驱动
|
||||
@@ -57,6 +59,9 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
@Autowired
|
||||
DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
|
||||
|
||||
public static final Integer MAX_Y = 6;
|
||||
public static final Integer MIN_Y = 1;
|
||||
|
||||
//心跳
|
||||
Integer heartbeat = 0;
|
||||
Integer last_heartbeat = 0;
|
||||
@@ -205,7 +210,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
}
|
||||
|
||||
|
||||
switch (command) {
|
||||
switch (front_command) {
|
||||
case 0:
|
||||
applyTask();
|
||||
requireSucess = true;
|
||||
@@ -215,7 +220,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
break;
|
||||
case 2:
|
||||
message = "取货完成";
|
||||
Instruction instruction = checkInst();
|
||||
Instruction instruction = null;
|
||||
String next_device_code = instruction.getNext_device_code();
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||
@@ -233,14 +238,14 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
}
|
||||
}
|
||||
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())) {
|
||||
map.put("to_y", inst.getFrom_z());
|
||||
if (inst.getFrom_x().length() > 1) {
|
||||
String substring = inst.getFrom_x().substring(1);
|
||||
map.put("to_y", instruction.getFrom_z());
|
||||
if (instruction.getFrom_x().length() > 1) {
|
||||
String substring = instruction.getFrom_x().substring(1);
|
||||
map.put("to_z", substring);
|
||||
} else {
|
||||
map.put("to_z", inst.getFrom_x());
|
||||
map.put("to_z", instruction.getFrom_x());
|
||||
}
|
||||
map.put("to_x", inst.getFrom_y());
|
||||
map.put("to_x", instruction.getFrom_y());
|
||||
}
|
||||
map.put("to_command", 2);
|
||||
requireSucess = true;
|
||||
@@ -250,7 +255,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
break;
|
||||
case 4:
|
||||
message = "请求卸货(申请卸货)";
|
||||
Instruction instruction1 = checkInst();
|
||||
Instruction instruction1 = null;
|
||||
String next_device_code1 = instruction1.getNext_device_code();
|
||||
Device nextDevice1 = deviceAppService.findDeviceByCode(next_device_code1);
|
||||
if (ObjectUtil.isNotNull(instruction1)) {
|
||||
@@ -260,7 +265,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice1.getDeviceDriver();
|
||||
if (siemensConveyorDeviceDriver.getMode() != 2 || siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
notCreateInstMessage = "未下发电气信号原因->输送线-货架对接位:" + siemensConveyorDeviceDriver.getDevice_code() +
|
||||
"有货或未联机,无法下发指令!指令号:" + inst.getInstruction_code();
|
||||
"有货或未联机,无法下发指令!指令号:" ;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -271,7 +276,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
case 5:
|
||||
message = "放货完成";
|
||||
map.put("to_command", 5);
|
||||
Instruction inst = checkInst();
|
||||
Instruction inst = null;
|
||||
try {
|
||||
finish_instruction(inst);
|
||||
} catch (Exception e) {
|
||||
@@ -398,92 +403,134 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
Instruction instruction1 = new Instruction();
|
||||
instruction1.setInstruction_status("0");
|
||||
List<Instruction> instructions = instructionService.findByDeviceCodes(instruction1, false);
|
||||
if (CollUtil.isEmpty(instructions) || instructions.size() < 1) {
|
||||
return false;
|
||||
}
|
||||
List<Instruction> instructionList = new ArrayList<>();
|
||||
for (Instruction instruction : instructions) {
|
||||
List<RouteLineDto> routeLineDtos = routeLineService.selectDeviceCodeList(instruction.getStart_device_code());
|
||||
if (CollUtil.isEmpty(routeLineDtos) || routeLineDtos.size() < 1) {
|
||||
message = "没有输送线到堆垛机的路由";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "没有" + instruction.getStart_device_code() + "->"
|
||||
+ this.device_code + "的路由");
|
||||
continue;
|
||||
}
|
||||
for (RouteLineDto routeLineDto : routeLineDtos) {
|
||||
if (this.getDeviceCode().equals(routeLineDto.getNext_device_code())) {
|
||||
List<RouteLineDto> routeLineDtoList = routeLineService.selectDeviceCodeList(this.getDeviceCode());
|
||||
if (CollUtil.isEmpty(routeLineDtos) || routeLineDtos.size() < 1) {
|
||||
message = "没有输送线到堆垛机的路由";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "没有" + instruction.getStart_device_code() + "->"
|
||||
+ this.device_code + "的路由");
|
||||
continue;
|
||||
}
|
||||
for (RouteLineDto routeLinedto : routeLineDtoList) {
|
||||
if (instruction.getNext_device_code().equals(routeLinedto.getNext_device_code())) {
|
||||
instructionList.add(instruction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//根据路由过滤指令
|
||||
if (checkRute(instructions, instructionList)) return false;
|
||||
if (CollUtil.isEmpty(instructionList) || instructionList.size() < 1) {
|
||||
return false;
|
||||
}
|
||||
instructionList = this.sortInst(instructionList);
|
||||
|
||||
//筛选符合条件的指令
|
||||
for (Instruction instruction : instructionList) {
|
||||
|
||||
|
||||
Instruction inst = instructionList.get(0);
|
||||
List<Instruction> instructionsAll = new ArrayList<>();
|
||||
instructions.add(inst);
|
||||
//找出有相邻的列的指令,如果没有按照单叉走,有按照双叉走
|
||||
if (findInstruction(instructionList, inst, instructionsAll)) return false;
|
||||
|
||||
if (instructionsAll.size()==0){
|
||||
//写信号
|
||||
if (wirteData(inst)) return false;
|
||||
}
|
||||
|
||||
inst = instructionList.get(0);
|
||||
//指令未执行
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||
String start_device_code = inst.getStart_device_code();
|
||||
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||
if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver();
|
||||
if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 0) {
|
||||
notCreateInstMessage = "未下发电气信号原因->输送线-货架对接位:" + beltConveyorDeviceDriver.getDevice_code() +
|
||||
"无货或未联机,无法下发指令!指令号:" + inst.getInstruction_code();
|
||||
return false;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean checkRute(List<Instruction> instructions, List<Instruction> instructionList) {
|
||||
if (CollUtil.isEmpty(instructions) || instructions.size() < 1) {
|
||||
return true;
|
||||
}
|
||||
for (Instruction instruction : instructions) {
|
||||
List<RouteLineDto> routeLineDtos = routeLineService.selectDeviceCodeList(instruction.getStart_device_code());
|
||||
if (CollUtil.isEmpty(routeLineDtos) || routeLineDtos.size() < 1) {
|
||||
message = "没有输送线到堆垛机的路由";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "没有" + instruction.getStart_device_code() + "->"
|
||||
+ this.device_code + "的路由");
|
||||
continue;
|
||||
}
|
||||
for (RouteLineDto routeLineDto : routeLineDtos) {
|
||||
if (this.getDeviceCode().equals(routeLineDto.getNext_device_code())) {
|
||||
List<RouteLineDto> routeLineDtoList = routeLineService.selectDeviceCodeList(this.getDeviceCode());
|
||||
if (CollUtil.isEmpty(routeLineDtos) || routeLineDtos.size() < 1) {
|
||||
message = "没有输送线到堆垛机的路由";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "没有" + instruction.getStart_device_code() + "->"
|
||||
+ this.device_code + "的路由");
|
||||
continue;
|
||||
}
|
||||
for (RouteLineDto routeLinedto : routeLineDtoList) {
|
||||
if (instruction.getNext_device_code().equals(routeLinedto.getNext_device_code())) {
|
||||
instructionList.add(instruction);
|
||||
}
|
||||
}
|
||||
}
|
||||
HashMap map = new HashMap();
|
||||
map.put("to_device_code", this.getDevice().getAddress());
|
||||
map.put("to_command", 1);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean wirteData(Instruction inst) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||
String start_device_code = inst.getStart_device_code();
|
||||
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||
if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver();
|
||||
if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 0) {
|
||||
notCreateInstMessage = "未下发电气信号原因->输送线-货架对接位:" + beltConveyorDeviceDriver.getDevice_code() +
|
||||
"无货或未联机,无法下发指令!指令号:" + inst.getInstruction_code();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
HashMap map = new HashMap();
|
||||
map.put("to_device_code", this.getDevice().getAddress());
|
||||
map.put("to_command", 1);
|
||||
// map.put("to_type", inst.getMaterial());
|
||||
map.put("to_task", inst.getInstruction_code());
|
||||
map.put("to_task", inst.getInstruction_code());
|
||||
|
||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||
List<DeviceExtra> list = deviceExtraService.list(Wrappers.lambdaQuery(DeviceExtra.class).eq(DeviceExtra::getDevice_code, start_device_code));
|
||||
for (DeviceExtra deviceExtra : list) {
|
||||
if ("x".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||
map.put("to_x", deviceExtra.getExtra_value());
|
||||
}
|
||||
if ("z".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||
map.put("to_z", deviceExtra.getExtra_value());
|
||||
}
|
||||
if ("y".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||
map.put("to_y", deviceExtra.getExtra_value());
|
||||
}
|
||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||
List<DeviceExtra> list = deviceExtraService.list(Wrappers.lambdaQuery(DeviceExtra.class).eq(DeviceExtra::getDevice_code, start_device_code));
|
||||
for (DeviceExtra deviceExtra : list) {
|
||||
if ("x".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||
map.put("to_x", deviceExtra.getExtra_value());
|
||||
}
|
||||
if ("z".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||
map.put("to_z", deviceExtra.getExtra_value());
|
||||
}
|
||||
if ("y".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||
map.put("to_y", deviceExtra.getExtra_value());
|
||||
}
|
||||
}
|
||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
|
||||
map.put("to_y", inst.getFrom_z());
|
||||
if (inst.getFrom_x().length() > 1) {
|
||||
String substring = inst.getFrom_x().substring(1);
|
||||
map.put("to_z", substring);
|
||||
} else {
|
||||
map.put("to_z", inst.getFrom_x());
|
||||
}
|
||||
map.put("to_x", inst.getFrom_y());
|
||||
}
|
||||
|
||||
this.writing(map);
|
||||
}
|
||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
|
||||
map.put("to_y", inst.getFrom_z());
|
||||
if (inst.getFrom_x().length() > 1) {
|
||||
String substring = inst.getFrom_x().substring(1);
|
||||
map.put("to_z", substring);
|
||||
} else {
|
||||
map.put("to_z", inst.getFrom_x());
|
||||
}
|
||||
map.put("to_x", inst.getFrom_y());
|
||||
}
|
||||
|
||||
this.writing(map);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean findInstruction(List<Instruction> instructionList, Instruction inst, List<Instruction> instructionsAll) {
|
||||
if (StringUtils.isEmpty(inst.getNext_point_code())&&!StringUtils.contains(inst.getNext_point_code(),"-")){
|
||||
return true;
|
||||
}else {
|
||||
String[] split = inst.getNext_point_code().split("-");
|
||||
if (Integer.valueOf(split[1]).equals(MIN_Y)){
|
||||
return true;
|
||||
}
|
||||
if (Integer.valueOf(split[1]).equals(MAX_Y)){
|
||||
String nextPointCodeDown = split[0] + "-" + (Integer.parseInt(split[1]) - 1) + "-" + split[2];
|
||||
List<Instruction> instructionNextPointList = instructionList.stream().filter(item -> item.getNext_point_code().equals(nextPointCodeDown)).collect(Collectors.toList());
|
||||
if (instructionNextPointList.size()>0){
|
||||
instructionsAll.add(instructionNextPointList.get(0));
|
||||
}
|
||||
}else {
|
||||
String nextPointCodeUp = split[0] + "-" + (Integer.parseInt(split[1]) - 1) + "-" + split[2];
|
||||
String nextPointCodeDown = split[0] + "-" + (Integer.parseInt(split[1]) - 1) + "-" + split[2];
|
||||
List<Instruction> instructionNextPointList = instructionList.stream().filter(item -> item.getNext_point_code().equals(nextPointCodeDown)||item.getNext_point_code().equals(nextPointCodeUp)).collect(Collectors.toList());
|
||||
if (instructionNextPointList.size()>0){
|
||||
instructionsAll.add(instructionNextPointList.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -508,77 +555,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
return instructions;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新指令状态
|
||||
*/
|
||||
public synchronized void update_instruction_status() throws Exception {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||
|
||||
} else {
|
||||
this.instruction_update_time = date;
|
||||
//更改指令状态
|
||||
if (task > 0) {
|
||||
//inst_message
|
||||
Instruction inst = checkInst();
|
||||
if (inst != null) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
HashMap map = new HashMap();
|
||||
//取货完成
|
||||
if (command == 2) {
|
||||
map.put("to_command", 2);
|
||||
}
|
||||
//请求卸货(申请卸货)
|
||||
if (command == 4) {
|
||||
Instruction instruction = checkInst();
|
||||
if (ObjectUtil.isNotNull(instruction)) {
|
||||
//指令为执行
|
||||
String next_device_code = instruction.getNext_device_code();
|
||||
Device startDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||
if (startDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startDevice.getDeviceDriver();
|
||||
if (siemensConveyorDeviceDriver.getMode() != 2 || siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
notCreateInstMessage = "未下发电气信号原因->输送线-货架对接位:" + siemensConveyorDeviceDriver.getDevice_code() +
|
||||
"有货或未联机,无法下发指令!指令号:" + inst.getInstruction_code();
|
||||
return;
|
||||
}
|
||||
}
|
||||
map.put("to_command", 3);
|
||||
}
|
||||
}
|
||||
//放货完成
|
||||
if (command == 5) {
|
||||
map.put("to_command", 5);
|
||||
try {
|
||||
finish_instruction(inst);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//取货准备(回库台位)
|
||||
if (command == 6) {
|
||||
map.put("to_command", 6);
|
||||
}
|
||||
//召回
|
||||
if (command == 7) {
|
||||
map.put("to_command", 7);
|
||||
}
|
||||
//急停
|
||||
if (command == 8) {
|
||||
map.put("to_command", 8);
|
||||
}
|
||||
this.writing(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -389,8 +389,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
|
||||
|
||||
if (mode != 3) {
|
||||
message = "未联机";
|
||||
if (mode != 3 || requireSucess) {
|
||||
message = "未联机或已修改";
|
||||
|
||||
} else if (error != 0) {
|
||||
message = "有报警";
|
||||
@@ -417,8 +417,10 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
HashMap map = new HashMap();
|
||||
switch (command) {
|
||||
case 0:
|
||||
applyTask();
|
||||
requireSucess = true;
|
||||
boolean b = applyTask();
|
||||
if (b) {
|
||||
requireSucess = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
message = "取货中";
|
||||
@@ -429,13 +431,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
String next_device_code = instruction.getNext_device_code();
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("z")) && "z".equals(nextDevice.getExtraValue().get("z"))) {
|
||||
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("z"))) {
|
||||
map.put("to_x", nextDevice.getExtraValue().get("z"));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("x")) && "x".equals(nextDevice.getExtraValue().get("x"))) {
|
||||
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("x"))) {
|
||||
map.put("to_z", nextDevice.getExtraValue().get("x"));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("y")) && "y".equals(nextDevice.getExtraValue().get("y"))) {
|
||||
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("y"))) {
|
||||
map.put("to_y", nextDevice.getExtraValue().get("y"));
|
||||
}
|
||||
}
|
||||
@@ -620,13 +622,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
map.put("to_task", inst.getInstruction_code());
|
||||
|
||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("x")) && "x".equals(startDevice.getExtraValue().get("x"))) {
|
||||
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("x"))) {
|
||||
map.put("to_x", startDevice.getExtraValue().get("x"));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z")) && "z".equals(startDevice.getExtraValue().get("z"))) {
|
||||
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z"))) {
|
||||
map.put("to_z", startDevice.getExtraValue().get("z"));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("y")) && "y".equals(startDevice.getExtraValue().get("y"))) {
|
||||
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("y"))) {
|
||||
map.put("to_y", startDevice.getExtraValue().get("y"));
|
||||
}
|
||||
}
|
||||
@@ -644,7 +646,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
this.writing(map);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -780,7 +780,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
throw new BadRequestException(LangProcess.msg("task_checkExist",device_code));
|
||||
}
|
||||
if (StrUtil.equals(material_type, "") || StrUtil.equals(quantity, "")) {
|
||||
throw new RuntimeException("请填写物料信息!");
|
||||
throw new RuntimeException(LangProcess.msg("material_information"));
|
||||
}
|
||||
dto.setStart_device_code(device_code);
|
||||
dto.setStart_point_code(device_code);
|
||||
@@ -805,7 +805,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
JSONArray array2 = json.getJSONArray("data2");
|
||||
JSONArray array3 = json.getJSONArray("data3");
|
||||
if (array.size() != 0 && array3.size() != 0) {
|
||||
throw new RuntimeException("只能选择一个终点");
|
||||
throw new RuntimeException(LangProcess.msg("an_endpoint"));
|
||||
}
|
||||
|
||||
for (int i = 0; i < array2.size(); i++) {
|
||||
@@ -1515,10 +1515,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
// 如果point_device为货架,则不包含列层信息,需要重新拼接
|
||||
if (StrUtil.equals("storage", start_device)) {
|
||||
if (StrUtil.isEmpty(task.getFrom_x())) {
|
||||
throw new BadRequestException("货位信息起点需要包含列信息");
|
||||
throw new BadRequestException(LangProcess.msg("start_point_column"));
|
||||
}
|
||||
if (StrUtil.isEmpty(task.getFrom_y())) {
|
||||
throw new BadRequestException("货位信息起点需要包含层信息");
|
||||
throw new BadRequestException(LangProcess.msg("start_point_layer"));
|
||||
}
|
||||
if (Integer.parseInt(task.getFrom_y()) < 10 && task.getFrom_y().length() == 1) {
|
||||
from_y = "0" + task.getFrom_y();
|
||||
@@ -1578,10 +1578,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
.name();
|
||||
if (StrUtil.equals("storage", next_device)) {
|
||||
if (StrUtil.isEmpty(task.getTo_x())) {
|
||||
throw new BadRequestException("货位信息终点需要包含列信息");
|
||||
throw new BadRequestException(LangProcess.msg("endpoint_column"));
|
||||
}
|
||||
if (StrUtil.isEmpty(task.getTo_y())) {
|
||||
throw new BadRequestException("货位信息终点需要包含层信息");
|
||||
throw new BadRequestException(LangProcess.msg("endpoint_layer"));
|
||||
}
|
||||
if (Integer.parseInt(task.getTo_y()) < 10 && task.getTo_y().length() == 1) {
|
||||
to_y = "0" + task.getTo_y();
|
||||
|
||||
@@ -73,7 +73,8 @@ public class CreateDDJInst {
|
||||
RouteLineDto routeLineDto = (RouteLineDto) list.get(0);
|
||||
String[] path = routeLineDto.getPath().split("->");
|
||||
List<String> pathlist = Arrays.asList(path);
|
||||
if (pathlist.size() < 3 || pathlist.get(1).equals(DeviceType.stacker.name())) {
|
||||
String deviceType = appService.findDeviceByCode(pathlist.get(1)).getDevice_type();
|
||||
if (pathlist.size() < 3 || (!deviceType.equals(DeviceType.stacker.name()))) {
|
||||
return;
|
||||
}
|
||||
Device deviceByCode = appService.findDeviceByCode(pathlist.get(1));
|
||||
@@ -128,6 +129,46 @@ public class CreateDDJInst {
|
||||
|
||||
String start_height = taskDto.getStart_height();
|
||||
String next_height = taskDto.getNext_height();
|
||||
/**
|
||||
* 开始平均分配
|
||||
*/
|
||||
String this_coevice_code = taskserver.queryAssignedByDevice(start_device_code, next_device_code);
|
||||
if (StrUtil.isEmpty(this_coevice_code)) {
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
RouteLineDto routeLineDto1 = shortPathsList.get(0);
|
||||
|
||||
String path1 = routeLineDto1.getPath();
|
||||
String type1 = routeLineDto1.getType();
|
||||
String[] str = path1.split("->");
|
||||
|
||||
List<String> pathlist1 = Arrays.asList(str);
|
||||
int index = 0;
|
||||
for (int m = 0; m < pathlist1.size(); m++) {
|
||||
String deviceType1 = appService.findDeviceByCode(pathlist1.get(m)).getDevice_type();
|
||||
if(deviceType1.equals(DeviceType.stacker.name())){
|
||||
index = m + 1;
|
||||
break;
|
||||
}
|
||||
/*if (pathlist1.get(m).equals(start_device_code)) {
|
||||
|
||||
}*/
|
||||
}
|
||||
next_device_code = pathlist1.get(index);
|
||||
} else {
|
||||
next_device_code = this_coevice_code;
|
||||
}
|
||||
//校验路由关系
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
if (ObjectUtils.isEmpty(shortPathsList) || shortPathsList.size()<1) {
|
||||
throw new RuntimeException("路由不通!");
|
||||
}
|
||||
// Device startdevice = appService.findDeviceByCode(start_device_code);
|
||||
// Device nextdevice = appService.findDeviceByCode(next_device_code);
|
||||
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
|
||||
next_point_code = next_device_code + "-" + taskDto.getTo_y() + "-" + taskDto.getTo_z();
|
||||
} else {
|
||||
next_point_code = next_device_code;
|
||||
}
|
||||
//单台堆垛机最多只能创建固定数量指令
|
||||
Instruction instruction = new Instruction();
|
||||
instruction.setInstruction_status("1");
|
||||
@@ -234,7 +275,7 @@ public class CreateDDJInst {
|
||||
String[] path1 = routeLineDto1.getPath().split("->");
|
||||
List<String> pathlist1 = Arrays.asList(path1);
|
||||
if (pathlist1.size() < 3 || pathlist1.get(1).equals(DeviceType.stacker.name())) {
|
||||
return;
|
||||
//return;
|
||||
}
|
||||
if (pathlist1.get(1).equals(pathlist.get(1))) {
|
||||
max++;
|
||||
|
||||
@@ -3,3 +3,12 @@ task_insHas=指令已存在
|
||||
task_insRun=有指令未完成
|
||||
task_isNull={0}查询信息不存在
|
||||
starting_point_isNull=请选择起点
|
||||
endpoint_layer=货位信息终点需要包含层信息
|
||||
endpoint_column=货位信息终点需要包含列信息
|
||||
start_point_layer=货位信息起点需要包含层信息
|
||||
start_point_column=货位信息起点需要包含列信息
|
||||
an_endpoint=只能选择一个终点
|
||||
material_information=请填写物料信息
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,3 +3,9 @@ task_insHas=Instruction already exists
|
||||
task_insRun=There are instructions that are not completed
|
||||
task_isNull={0}query is null
|
||||
starting_point_isNull = Please select starting point
|
||||
endpoint_layer=The destination of the storage location information needs to include the floor information
|
||||
endpoint_column=The location information endpoint needs to contain column information
|
||||
start_point_layer=The starting point of the storage location information needs to include the floor information
|
||||
start_point_column=The starting point of the storage location information needs to contain column information
|
||||
an_endpoint=Only one endpoint can be selected
|
||||
material_information=Please fill in the material information!
|
||||
|
||||
@@ -3,3 +3,9 @@ task_insHas=Instruksi sudah ada
|
||||
task_insRun=Ada instruksi yang belum selesai
|
||||
task_isNull={0}Pertanyaan Tidak ada
|
||||
starting_point_isNull = Silakan pilih titik awal
|
||||
endpoint_layer=Tujuan informasi lokasi penyimpanan perlu mencakup informasi lantai.
|
||||
endpoint_column=Tujuan informasi lokasi penyimpanan perlu mencakup informasi kolom.
|
||||
start_point_layer=Titik awal perlu mencakup informasi lantai.
|
||||
start_point_column=Titik awal perlu mencakup informasi kolom.
|
||||
an_endpoint=Hanya satu tujuan yang dapat dipilih.
|
||||
material_information=Silakan isi informasi material!
|
||||
|
||||
@@ -2,3 +2,10 @@ task_checkExist={0}任务已存在
|
||||
task_insHas=指令已存在
|
||||
task_insRun=有指令未完成
|
||||
task_isNull={0}查询信息不存在
|
||||
starting_point_isNull=请选择起点
|
||||
endpoint_layer=货位信息终点需要包含层信息
|
||||
endpoint_column=货位信息终点需要包含列信息
|
||||
start_point_layer=货位信息起点需要包含层信息
|
||||
start_point_column=货位信息起点需要包含列信息
|
||||
an_endpoint=只能选择一个终点
|
||||
material_information=请填写物料信息
|
||||
|
||||
Reference in New Issue
Block a user