fix: 堆垛机对接位到货架修改
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.acs.device_driver.conveyor.belt_conveyor;
|
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.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
@@ -463,65 +464,66 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//判断是否有相同起点的,任务状态就绪的任务
|
//补码生成堆垛机对接位到货架的指令
|
||||||
TaskDto taskdto = taskserver.findByStartCodeAndReady(device_code);
|
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||||
if (ObjectUtil.isNull(taskdto)) {
|
TaskDto taskDtoHandCode = taskserver.findByVehicleCodeCodeAndReady(hand_barcode);
|
||||||
//补码生成堆垛机对接位到货架的指令
|
if (Objects.nonNull(taskDtoHandCode)) {
|
||||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
String taskid = taskDtoHandCode.getTask_id();
|
||||||
TaskDto taskDtoHandCode = taskserver.findByVehicleCodeCodeAndReady(hand_barcode);
|
String taskcode = taskDtoHandCode.getTask_code();
|
||||||
if (Objects.nonNull(taskDtoHandCode)) {
|
String priority = taskDtoHandCode.getPriority();
|
||||||
String taskid = taskDtoHandCode.getTask_id();
|
String start_point_code = taskDtoHandCode.getStart_point_code();
|
||||||
String taskcode = taskDtoHandCode.getTask_code();
|
String start_device_code = "";
|
||||||
String priority = taskDtoHandCode.getPriority();
|
String route_plan_code = taskDtoHandCode.getRoute_plan_code();
|
||||||
String start_point_code = taskDtoHandCode.getStart_point_code();
|
String next_device_code = taskDtoHandCode.getNext_device_code();
|
||||||
String start_device_code = "";
|
String interactionJson = taskDtoHandCode.getInteraction_json();
|
||||||
String route_plan_code = taskDtoHandCode.getRoute_plan_code();
|
String containerType = "";
|
||||||
String next_device_code = taskDtoHandCode.getNext_device_code();
|
if (StrUtil.isNotEmpty(interactionJson)) {
|
||||||
String interactionJson = taskDtoHandCode.getInteraction_json();
|
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
|
||||||
String containerType = "";
|
containerType = interactionJsonDTO.getContainerType();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
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 (ObjectUtil.isNotNull(taskdto)) {
|
||||||
//判断指令的起点和当前的设备号相同
|
//判断指令的起点和当前的设备号相同
|
||||||
if (!taskdto.getStart_device_code().equals(device_code)) {
|
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);
|
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
|
||||||
containerType = interactionJsonDTO.getContainerType();
|
containerType = interactionJsonDTO.getContainerType();
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 开始平均分配
|
|
||||||
*/
|
|
||||||
String this_coevice_code = taskserver.queryAssignedByDevice(device_code, taskdto.getNext_device_code());
|
String this_coevice_code = taskserver.queryAssignedByDevice(device_code, taskdto.getNext_device_code());
|
||||||
if (StrUtil.isEmpty(this_coevice_code)) {
|
if (StrUtil.isEmpty(this_coevice_code)) {
|
||||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, taskdto.getNext_device_code(), route_plan_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 updateTask(taskdto, nextdevice, instdto);
|
||||||
}
|
}
|
||||||
|
**/
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -602,7 +603,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||||
List list = new ArrayList();
|
List list = new ArrayList();
|
||||||
writeData(next_addr, list, instdto);
|
// writeData(next_addr, list, instdto);
|
||||||
// led_message = getLedMessage(instdto);
|
// led_message = getLedMessage(instdto);
|
||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package org.nl.acs.device_driver.storage.standard_storage;
|
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.domain.Device;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||||
import org.nl.acs.device.enums.DeviceType;
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
|
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|||||||
Reference in New Issue
Block a user