fix: 堆垛机联调修改

This commit is contained in:
2024-05-21 13:41:10 +08:00
parent e1de520be0
commit 78242a58e0
3 changed files with 81 additions and 71 deletions

View File

@@ -240,7 +240,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
to_target = this.itemProtocol.getTotarget(); to_target = this.itemProtocol.getTotarget();
to_task = this.itemProtocol.getTo_task(); to_task = this.itemProtocol.getTo_task();
to_container_no = this.itemProtocol.getContainer_direction(); to_container_no = this.itemProtocol.getContainer_direction();
to_height_level = this.itemProtocol.getTo_height_level();
if (mode != last_mode) { if (mode != last_mode) {

View File

@@ -63,10 +63,7 @@ public class ItemProtocol {
*/ */
public static String item_to_target = "to_target"; public static String item_to_target = "to_target";
/**
* 下发高度等级
*/
public static String item_to_height_level = "to_height_level";
@@ -129,9 +126,6 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_container_type); return this.getOpcIntegerValue(item_to_container_type);
} }
public int getTo_height_level(){
return this.getOpcIntegerValue(item_to_height_level);
}
Boolean isonline; Boolean isonline;
public int getOpcIntegerValue(String protocol) { public int getOpcIntegerValue(String protocol) {
@@ -187,7 +181,6 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_command, "下发命令", "DB102.W4")); list.add(new ItemDto(item_to_command, "下发命令", "DB102.W4"));
list.add(new ItemDto(item_to_task, "下发任务号", "DB102.D1")); list.add(new ItemDto(item_to_task, "下发任务号", "DB102.D1"));
list.add(new ItemDto(item_to_container_type, "下发托盘类型", "DB102.B5")); list.add(new ItemDto(item_to_container_type, "下发托盘类型", "DB102.B5"));
list.add(new ItemDto(item_to_height_level, "下发高度等级", "DB2.W10"));
return list; return list;
} }

View File

@@ -369,6 +369,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
message = "one_message7"; message = "one_message7";
} else { } else {
if (error != 0) { if (error != 0) {
updateEXcuteMessage(error.toString());
//满入空出或者浅货位阻挡 //满入空出或者浅货位阻挡
erroBlock(); erroBlock();
} }
@@ -457,7 +458,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
break; break;
case 5: case 5:
message = "universal_releasing_completed"; message = "universal_releasing_completed";
if (updateCommand("5")) break; if (updateCommand("11")) break;
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("code", "to_command"); map.put("code", "to_command");
map.put("value", 11); map.put("value", 11);
@@ -540,6 +541,15 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
last_fork_runingTimes = fork_runingTimes;*/ last_fork_runingTimes = fork_runingTimes;*/
} }
private void updateEXcuteMessage(String string) {
Instruction instruction0 = checkInst();
if (ObjectUtil.isEmpty(instruction0)) {
message = "universal_message4";
}
instruction0.setExecute_message(string);
instructionService.update(instruction0);
}
private static void packageDevicePoint(Device nextDevice, List list) { private static void packageDevicePoint(Device nextDevice, List list) {
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("z"))) { if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("z"))) {
Map map = new HashMap(); Map map = new HashMap();
@@ -578,8 +588,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
message = "universal_message3"; message = "universal_message3";
//指定库位满入 //指定库位满入
if (error == 5 && count < WcsConfig.stacker_error_in_count) { if (error == 5 && count < WcsConfig.stacker_error_in_count) {
//清警
cleanErro();
applyUpdatePointCode(StandarStirageErroEnum.FILL.getType()); applyUpdatePointCode(StandarStirageErroEnum.FILL.getType());
//相同任务时限制加一 //相同任务时限制加一
if (Objects.equals(task, last_task)) { if (Objects.equals(task, last_task)) {
@@ -591,8 +599,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
if (error == 6) { if (error == 6) {
try { try {
applyUpdatePointCode(StandarStirageErroEnum.VOIDANCE.getType()); applyUpdatePointCode(StandarStirageErroEnum.VOIDANCE.getType());
//清警
cleanErro();
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -600,8 +607,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
//浅货位有货 //浅货位有货
if (error == 16) { if (error == 16) {
//清警
cleanErro();
//放货 //放货
if (forkCargo == 2 && count < WcsConfig.stacker_error_in_count) { if (forkCargo == 2 && count < WcsConfig.stacker_error_in_count) {
//相同任务时限制加一 //相同任务时限制加一
@@ -651,6 +656,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
JSONObject jo = JSON.parseObject(response); JSONObject jo = JSON.parseObject(response);
if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) { if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) {
try { try {
//清警
cleanErro();
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("申请更新点位,参数,接口返回:" + jo) .content("申请更新点位,参数,接口返回:" + jo)
@@ -658,6 +665,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
logDto2.setLog_level(4); logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
String poinCode = jo.getString("point_code"); String poinCode = jo.getString("point_code");
String vehicleCode = jo.getString("vehicle_code");
if (StrUtil.isNotEmpty(poinCode)) { if (StrUtil.isNotEmpty(poinCode)) {
String[] split = poinCode.split("-"); String[] split = poinCode.split("-");
Device point = deviceAppService.findDeviceByCode(split[0]); Device point = deviceAppService.findDeviceByCode(split[0]);
@@ -665,14 +673,22 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
message = "one_message18"; message = "one_message18";
} }
if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType()) || type.equals(StandarStirageErroEnum.VOIDANCE.getType())) { if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())) {
updateData2(poinCode, instruction, point, split); updateData2(poinCode, instruction, point, split,vehicleCode);
List list = new ArrayList(); List list = new ArrayList();
String x = point.getExtraValue().get("x").toString(); String x = point.getExtraValue().get("x").toString();
String y = split[1]; String y = split[1];
String z = split[2]; String z = split[2];
pakagePLCData(list, x, y, z, "2", task.toString()); pakagePLCData(list, x, y, z, "2", task.toString());
} }
if (type.equals(StandarStirageErroEnum.VOIDANCE.getType())) {
updateData1(poinCode, instruction, point, split,vehicleCode);
List list = new ArrayList();
String x = point.getExtraValue().get("x").toString();
String y = split[1];
String z = split[2];
pakagePLCData(list, x, y, z, "1", task.toString());
}
} }
//取货潜货位阻挡做完移库任务 //取货潜货位阻挡做完移库任务
if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType())) { if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType())) {
@@ -700,6 +716,18 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
} }
private void updateData1(String poinCode, Instruction instruction, Device point, String[] split, String vehicleCode) {
Instruction instructionUpdate = checkInst();
TaskDto taskUpdate = new TaskDto();
instructionUpdate.setStart_point_code(poinCode);
instructionUpdate.setStart_device_code(split[0]);
taskUpdate.setStart_point_code(poinCode);
taskUpdate.setStart_device_code(split[0]);
taskUpdate.setTask_id(instructionUpdate.getTask_id());
instructionService.update(instructionUpdate);
taskserver.update(taskUpdate);
}
private void pakagePLCData(List list, String x, String y, String z, String toCommand, String task) { private void pakagePLCData(List list, String x, String y, String z, String toCommand, String task) {
HashMap map1 = new HashMap(); HashMap map1 = new HashMap();
map1.put("code", "to_x"); map1.put("code", "to_x");
@@ -754,7 +782,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
message = null; message = null;
} }
private void updateData2(String poinCode, Instruction instruction, Device point, String[] split) { private void updateData2(String poinCode, Instruction instruction, Device point, String[] split, String vehicleCode) {
Instruction instructionUpdate = checkInst(); Instruction instructionUpdate = checkInst();
TaskDto taskUpdate = new TaskDto(); TaskDto taskUpdate = new TaskDto();
instructionUpdate.setNext_point_code(poinCode); instructionUpdate.setNext_point_code(poinCode);
@@ -762,24 +790,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
taskUpdate.setNext_point_code(poinCode); taskUpdate.setNext_point_code(poinCode);
taskUpdate.setNext_device_code(split[0]); taskUpdate.setNext_device_code(split[0]);
taskUpdate.setTask_id(instructionUpdate.getTask_id()); taskUpdate.setTask_id(instructionUpdate.getTask_id());
pakageData2(instruction, instructionUpdate, point, split, taskUpdate);
instructionService.update(instructionUpdate); instructionService.update(instructionUpdate);
taskserver.update(taskUpdate); taskserver.update(taskUpdate);
} }
private void pakageData2(Instruction instruction, Instruction instructionUpdate, Device starPoint, String[] split, TaskDto taskUpdate) {
instructionUpdate.setTo_x(starPoint.getExtraValue().get("x").toString());
instructionUpdate.setTo_y(split[1]);
instructionUpdate.setTo_z(split[2]);
instructionUpdate.setInstruction_code(String.valueOf(task));
taskUpdate.setTo_x(starPoint.getExtraValue().get("x").toString());
taskUpdate.setTo_y(split[1]);
taskUpdate.setTo_z(split[2]);
taskUpdate.setTask_code(instruction.getTask_code());
}
/** /**
* 申请任务 * 申请任务
* *
@@ -794,53 +809,55 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
//维修解警后重新向堆垛机下发指令 //维修解警后重新向堆垛机下发指令
Instruction instructionErro = checkInst(); Instruction instructionErro = checkInst();
if (ObjectUtil.isNotEmpty(instructionErro) && InstructionStatusEnum.BUSY.getIndex().equals(instructionErro.getInstruction_status()) && StrUtil.isNotEmpty(instructionErro.getExecute_code())) { if (ObjectUtil.isNotEmpty(instructionErro) && InstructionStatusEnum.BUSY.getIndex().equals(instructionErro.getInstruction_status()) && StrUtil.isNotEmpty(instructionErro.getExecute_code())) {
String start_device_code = instructionErro.getStart_device_code(); if (StrUtil.isEmpty(instructionErro.getExecute_message())) {
Device startDevice = deviceAppService.findDeviceByCode(start_device_code); String start_device_code = instructionErro.getStart_device_code();
if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
//放货完成 if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
if (forkCargo == 0) { //放货完成
//取货中或者取货完成(分入库出库) if (forkCargo == 0) {
if ("1".equals(instructionErro.getExecute_code()) || "2".equals(instructionErro.getExecute_code())) { //取货中或者取货完成(分入库出库)
if ("1".equals(instructionErro.getExecute_code()) || "2".equals(instructionErro.getExecute_code())) {
List list = new ArrayList();
String startDeviceCode = instructionErro.getStart_device_code();
Device startDeviceError = deviceAppService.findDeviceByCode(startDeviceCode);
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
pakagePLCData(list, startDeviceError.getExtraValue().get("x").toString(), startDeviceError.getExtraValue().get("z").toString(), startDeviceError.getExtraValue().get("y").toString(), instructionErro.getExecute_code(), instructionErro.getInstruction_code());
requireSucess = true;
return true;
}
}
}
//放货中报警
if ("3".equals(instructionErro.getExecute_code()) && forkCargo == 2) {
List list = new ArrayList(); List list = new ArrayList();
String startDeviceCode = instructionErro.getStart_device_code();
Device startDeviceError = deviceAppService.findDeviceByCode(startDeviceCode);
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) { if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
pakagePLCData(list, startDeviceError.getExtraValue().get("x").toString(), startDeviceError.getExtraValue().get("z").toString(), startDeviceError.getExtraValue().get("y").toString(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); pakagePLCData(list, instructionErro.getTo_x(), instructionErro.getTo_y(), instructionErro.getTo_z(), instructionErro.getExecute_code(), instructionErro.getInstruction_code());
requireSucess = true; requireSucess = true;
return true; return true;
} }
} }
} }
//放货中报警 //出库报警
if ("3".equals(instructionErro.getExecute_code()) && forkCargo == 2) { if (startDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
List list = new ArrayList(); //取货报警
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) { if ("1".equals(instructionErro.getExecute_code()) || "2".equals(instructionErro.getExecute_code())) {
pakagePLCData(list, instructionErro.getTo_x(), instructionErro.getTo_y(), instructionErro.getTo_z(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); List list = new ArrayList();
requireSucess = true; if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
return true; pakagePLCData(list, instructionErro.getFrom_x(), instructionErro.getFrom_y(), instructionErro.getFrom_z(), instructionErro.getExecute_code(), instructionErro.getInstruction_code());
requireSucess = true;
return true;
}
} }
} //放货中报警
} if ("3".equals(instructionErro.getExecute_code()) && forkCargo == 2) {
//出库报警 String next_device_code = instructionErro.getNext_device_code();
if (startDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
//取货报警 List list = new ArrayList();
if ("1".equals(instructionErro.getExecute_code()) || "2".equals(instructionErro.getExecute_code())) { if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
List list = new ArrayList(); pakagePLCData(list, nextDevice.getExtraValue().get("x").toString(), nextDevice.getExtraValue().get("z").toString(), nextDevice.getExtraValue().get("y").toString(), instructionErro.getExecute_code(), instructionErro.getInstruction_code());
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) { requireSucess = true;
pakagePLCData(list, instructionErro.getFrom_x(), instructionErro.getFrom_y(), instructionErro.getFrom_z(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); return true;
requireSucess = true; }
return true;
}
}
//放货中报警
if ("3".equals(instructionErro.getExecute_code()) && forkCargo == 2) {
String next_device_code = instructionErro.getNext_device_code();
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
List list = new ArrayList();
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
pakagePLCData(list, nextDevice.getExtraValue().get("x").toString(), nextDevice.getExtraValue().get("z").toString(), nextDevice.getExtraValue().get("y").toString(), instructionErro.getExecute_code(), instructionErro.getInstruction_code());
requireSucess = true;
return true;
} }
} }
} }