fix: 堆垛机对接位到货架修改
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.conveyor.belt_conveyor;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -463,65 +464,66 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
requireSucess = true;
|
||||
return true;
|
||||
} else {
|
||||
//判断是否有相同起点的,任务状态就绪的任务
|
||||
TaskDto taskdto = taskserver.findByStartCodeAndReady(device_code);
|
||||
if (ObjectUtil.isNull(taskdto)) {
|
||||
//补码生成堆垛机对接位到货架的指令
|
||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||
TaskDto taskDtoHandCode = taskserver.findByVehicleCodeCodeAndReady(hand_barcode);
|
||||
if (Objects.nonNull(taskDtoHandCode)) {
|
||||
String taskid = taskDtoHandCode.getTask_id();
|
||||
String taskcode = taskDtoHandCode.getTask_code();
|
||||
String priority = taskDtoHandCode.getPriority();
|
||||
String start_point_code = taskDtoHandCode.getStart_point_code();
|
||||
String start_device_code = "";
|
||||
String route_plan_code = taskDtoHandCode.getRoute_plan_code();
|
||||
String next_device_code = taskDtoHandCode.getNext_device_code();
|
||||
String interactionJson = taskDtoHandCode.getInteraction_json();
|
||||
String containerType = "";
|
||||
if (StrUtil.isNotEmpty(interactionJson)) {
|
||||
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
|
||||
containerType = interactionJsonDTO.getContainerType();
|
||||
}
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(taskDtoHandCode.getStart_device_code(), next_device_code, route_plan_code);
|
||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
String path = routeLineDto.getPath();
|
||||
String[] str = path.split("->");
|
||||
List<String> pathlist = Arrays.asList(str);
|
||||
int index = 0;
|
||||
for (int m = 0; m < pathlist.size(); m++) {
|
||||
if (pathlist.get(m).equals(next_device_code)) {
|
||||
index = m - 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
start_device_code = pathlist.get(index);
|
||||
//校验路由关系
|
||||
List<RouteLineDto> shortPathsList2 = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
if (ObjectUtils.isEmpty(shortPathsList2) || shortPathsList2.size() < 1) {
|
||||
throw new RuntimeException("路由不通!");
|
||||
}
|
||||
Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code);
|
||||
String next_point_code;
|
||||
if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) {
|
||||
next_point_code = taskDtoHandCode.getTo_x() + "-" + taskDtoHandCode.getTo_y() + "-" + taskDtoHandCode.getTo_z();
|
||||
Instruction instdto = new Instruction();
|
||||
packageData(instdto, route_plan_code, taskDtoHandCode, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority, containerType);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("指令创建失败!,{}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return updateTask(taskDtoHandCode, nextdevice, instdto);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
//补码生成堆垛机对接位到货架的指令
|
||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||
TaskDto taskDtoHandCode = taskserver.findByVehicleCodeCodeAndReady(hand_barcode);
|
||||
if (Objects.nonNull(taskDtoHandCode)) {
|
||||
String taskid = taskDtoHandCode.getTask_id();
|
||||
String taskcode = taskDtoHandCode.getTask_code();
|
||||
String priority = taskDtoHandCode.getPriority();
|
||||
String start_point_code = taskDtoHandCode.getStart_point_code();
|
||||
String start_device_code = "";
|
||||
String route_plan_code = taskDtoHandCode.getRoute_plan_code();
|
||||
String next_device_code = taskDtoHandCode.getNext_device_code();
|
||||
String interactionJson = taskDtoHandCode.getInteraction_json();
|
||||
String containerType = "";
|
||||
if (StrUtil.isNotEmpty(interactionJson)) {
|
||||
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
|
||||
containerType = interactionJsonDTO.getContainerType();
|
||||
}
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(taskDtoHandCode.getStart_device_code(), next_device_code, route_plan_code);
|
||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
String path = routeLineDto.getPath();
|
||||
String[] str = path.split("->");
|
||||
List<String> pathlist = Arrays.asList(str);
|
||||
int index = 0;
|
||||
for (int m = 0; m < pathlist.size(); m++) {
|
||||
if (pathlist.get(m).equals(start_device_code)) {
|
||||
index = m + 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
start_device_code = pathlist.get(index);
|
||||
//校验路由关系
|
||||
List<RouteLineDto> shortPathsList2 = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
if (ObjectUtils.isEmpty(shortPathsList2) || shortPathsList2.size() < 1) {
|
||||
throw new RuntimeException("路由不通!");
|
||||
}
|
||||
Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code);
|
||||
String next_point_code;
|
||||
if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) {
|
||||
next_point_code = next_device_code + "-" + taskDtoHandCode.getTo_y() + "-" + taskDtoHandCode.getTo_z();
|
||||
Instruction instdto = new Instruction();
|
||||
packageData(instdto, route_plan_code, taskDtoHandCode, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority, containerType);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("指令创建失败!,{}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return updateTask(taskDtoHandCode, nextdevice, instdto);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 目前没有从标准输送线为起点的任务
|
||||
*/
|
||||
//判断是否有相同起点的,任务状态就绪的任务
|
||||
/**
|
||||
TaskDto taskdto = taskserver.findByStartCodeAndReady(device_code);
|
||||
if (ObjectUtil.isNotNull(taskdto)) {
|
||||
//判断指令的起点和当前的设备号相同
|
||||
if (!taskdto.getStart_device_code().equals(device_code)) {
|
||||
@@ -541,9 +543,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
|
||||
containerType = interactionJsonDTO.getContainerType();
|
||||
}
|
||||
/**
|
||||
* 开始平均分配
|
||||
*/
|
||||
|
||||
String this_coevice_code = taskserver.queryAssignedByDevice(device_code, taskdto.getNext_device_code());
|
||||
if (StrUtil.isEmpty(this_coevice_code)) {
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, taskdto.getNext_device_code(), route_plan_code);
|
||||
@@ -590,6 +590,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
}
|
||||
return updateTask(taskdto, nextdevice, instdto);
|
||||
}
|
||||
**/
|
||||
|
||||
}
|
||||
return false;
|
||||
@@ -602,7 +603,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
requireSucess = true;
|
||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||
List list = new ArrayList();
|
||||
writeData(next_addr, list, instdto);
|
||||
// writeData(next_addr, list, instdto);
|
||||
// led_message = getLedMessage(instdto);
|
||||
requireSucess = true;
|
||||
return true;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package org.nl.acs.device_driver.storage.standard_storage;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
Reference in New Issue
Block a user