修改
This commit is contained in:
@@ -11,7 +11,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海亮迅捷plc测试
|
* 货梯对接线
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class CargoLiftConveyorDefination implements OpcDeviceDriverDefination {
|
public class CargoLiftConveyorDefination implements OpcDeviceDriverDefination {
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
package org.nl.acs.device_driver.basedriver.cargo_lift_conveyor;
|
package org.nl.acs.device_driver.basedriver.cargo_lift_conveyor;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.nl.acs.agv.server.AgvService;
|
import org.nl.acs.agv.server.AgvService;
|
||||||
|
import org.nl.acs.config.AcsConfig;
|
||||||
import org.nl.acs.config.server.AcsConfigService;
|
import org.nl.acs.config.server.AcsConfigService;
|
||||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
@@ -19,18 +27,17 @@ import org.nl.acs.log.service.LogServer;
|
|||||||
import org.nl.acs.opc.Device;
|
import org.nl.acs.opc.Device;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
import org.nl.acs.route.service.RouteLineService;
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
|
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
import org.nl.utils.SpringContextHolder;
|
import org.nl.utils.SpringContextHolder;
|
||||||
import org.openscada.opc.lib.da.Server;
|
import org.openscada.opc.lib.da.Server;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海亮清洗机储料仓
|
* 货梯对接线
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
@@ -91,7 +98,7 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
Boolean requireSucess = false;
|
Boolean requireSucess = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() throws Exception {
|
||||||
String message = null;
|
String message = null;
|
||||||
|
|
||||||
device_code = this.getDeviceCode();
|
device_code = this.getDeviceCode();
|
||||||
@@ -136,6 +143,16 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
message = "";
|
message = "";
|
||||||
Instruction instruction = null;
|
Instruction instruction = null;
|
||||||
List toInstructions;
|
List toInstructions;
|
||||||
|
switch (mode) {
|
||||||
|
case 1:
|
||||||
|
log.debug("设备运转模式:等待工作");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
//申请任务
|
||||||
|
if (move > 0 && !requireSucess) {
|
||||||
|
instruction_require();
|
||||||
|
}
|
||||||
|
}
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
//取货完成
|
//取货完成
|
||||||
case 1:
|
case 1:
|
||||||
@@ -167,6 +184,97 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized boolean instruction_require() throws Exception {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
this.instruction_require_time = date;
|
||||||
|
//container_code
|
||||||
|
TaskDto task = taskserver.queryTaskByDeviceCode(device_code).get(0);
|
||||||
|
if (!ObjectUtil.isEmpty(task)) {
|
||||||
|
if (!ObjectUtils.isEmpty(instructionService.findByDeviceCodeFromCache(device_code))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String taskid = task.getTask_id();
|
||||||
|
String taskcode = task.getTask_code();
|
||||||
|
String vehiclecode = task.getVehicle_code();
|
||||||
|
String priority = task.getPriority();
|
||||||
|
String start_point_code = task.getStart_point_code();
|
||||||
|
String start_device_code = task.getStart_device_code();
|
||||||
|
String route_plan_code = task.getRoute_plan_code();
|
||||||
|
String next_device_code = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始平均分配
|
||||||
|
*/
|
||||||
|
String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
|
||||||
|
if (StrUtil.isEmpty(this_coevice_code)) {
|
||||||
|
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
|
||||||
|
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||||
|
|
||||||
|
String path = routeLineDto.getPath();
|
||||||
|
String type = routeLineDto.getType();
|
||||||
|
String[] str = path.split("->");
|
||||||
|
if (!StrUtil.equals(type, "0")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
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 + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next_device_code = pathlist.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)) {
|
||||||
|
throw new RuntimeException("路由不通!");
|
||||||
|
}
|
||||||
|
|
||||||
|
Device startdevice = deviceAppservice.findDeviceByCode(start_device_code);
|
||||||
|
Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code);
|
||||||
|
String next_point_code;
|
||||||
|
if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) {
|
||||||
|
next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z();
|
||||||
|
} else {
|
||||||
|
next_point_code = next_device_code;
|
||||||
|
}
|
||||||
|
Instruction instdto = new Instruction();
|
||||||
|
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||||
|
instdto.setRoute_plan_code(route_plan_code);
|
||||||
|
instdto.setRemark(task.getRemark());
|
||||||
|
instdto.setMaterial(task.getMaterial());
|
||||||
|
instdto.setQuantity(task.getQuantity());
|
||||||
|
instdto.setTask_id(taskid);
|
||||||
|
instdto.setTask_code(taskcode);
|
||||||
|
instdto.setVehicle_code(vehiclecode);
|
||||||
|
String now = DateUtil.now();
|
||||||
|
instdto.setCreate_time(now);
|
||||||
|
instdto.setCreate_by("auto");
|
||||||
|
instdto.setStart_device_code(start_device_code);
|
||||||
|
instdto.setNext_device_code(next_device_code);
|
||||||
|
instdto.setStart_point_code(start_point_code);
|
||||||
|
instdto.setNext_point_code(next_point_code);
|
||||||
|
instdto.setPriority(priority);
|
||||||
|
instdto.setInstruction_status("0");
|
||||||
|
instdto.setExecute_device_code(start_point_code);
|
||||||
|
instructionService.create(instdto);
|
||||||
|
//创建指令后修改任务状态
|
||||||
|
task.setTask_status("1");
|
||||||
|
taskserver.update(task);
|
||||||
|
requireSucess = true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void thingToNothing() {
|
protected void thingToNothing() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ public class ItemProtocol {
|
|||||||
public static String item_to_command = "to_command";
|
public static String item_to_command = "to_command";
|
||||||
public static String item_to_target = "to_target";
|
public static String item_to_target = "to_target";
|
||||||
public static String item_to_task = "to_task";
|
public static String item_to_task = "to_task";
|
||||||
|
public static String item_to_door = "to_door";
|
||||||
|
public static String item_to_floor = "to_floor";
|
||||||
|
|
||||||
|
|
||||||
private CargoLiftConveyorDeviceDriver driver;
|
private CargoLiftConveyorDeviceDriver driver;
|
||||||
@@ -86,6 +88,8 @@ public class ItemProtocol {
|
|||||||
list.add(new ItemDto(item_to_command, "下发命令", "VW102"));
|
list.add(new ItemDto(item_to_command, "下发命令", "VW102"));
|
||||||
list.add(new ItemDto(item_to_target, "下发目标站", "VW104"));
|
list.add(new ItemDto(item_to_target, "下发目标站", "VW104"));
|
||||||
list.add(new ItemDto(item_to_task, "任务号", "VD108"));
|
list.add(new ItemDto(item_to_task, "任务号", "VD108"));
|
||||||
|
list.add(new ItemDto(item_to_door, "门", "VD112"));
|
||||||
|
list.add(new ItemDto(item_to_floor, "楼层", "VD114"));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海亮迅捷plc测试
|
* 空托盘叠盘位
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class EmptyVehicleStackingPositionDefination implements OpcDeviceDriverDefination {
|
public class EmptyVehicleStackingPositionDefination implements OpcDeviceDriverDefination {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海亮清洗机储料仓
|
* 空托盘叠盘位
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海亮迅捷plc测试
|
* 三工位
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class HailiangSmartplcTestDefination implements OpcDeviceDriverDefination {
|
public class HailiangSmartplcTestDefination implements OpcDeviceDriverDefination {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海亮清洗机储料仓
|
* 三工位
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海亮迅捷plc测试
|
* 豪凯自动对接线
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class HaoKaiAutoConveyorDefination implements OpcDeviceDriverDefination {
|
public class HaoKaiAutoConveyorDefination implements OpcDeviceDriverDefination {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海亮清洗机储料仓
|
* 豪凯自动对接线
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海亮迅捷plc测试
|
* 油漆线
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class PaintConveyorDefination implements OpcDeviceDriverDefination {
|
public class PaintConveyorDefination implements OpcDeviceDriverDefination {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海亮清洗机储料仓
|
* 油漆线
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ public class ItemProtocol {
|
|||||||
public static String item_to_command = "to_command";
|
public static String item_to_command = "to_command";
|
||||||
public static String item_to_target = "to_target";
|
public static String item_to_target = "to_target";
|
||||||
public static String item_to_task = "to_task";
|
public static String item_to_task = "to_task";
|
||||||
|
public static String item_to_door = "to_door";
|
||||||
|
public static String item_to_floor = "to_floor";
|
||||||
|
|
||||||
|
|
||||||
private StandardCoveyorControlWithScannerDeviceDriver driver;
|
private StandardCoveyorControlWithScannerDeviceDriver driver;
|
||||||
@@ -84,6 +86,8 @@ public class ItemProtocol {
|
|||||||
list.add(new ItemDto(item_to_command, "下发命令", "VW102"));
|
list.add(new ItemDto(item_to_command, "下发命令", "VW102"));
|
||||||
list.add(new ItemDto(item_to_target, "下发目标站", "VW104"));
|
list.add(new ItemDto(item_to_target, "下发目标站", "VW104"));
|
||||||
list.add(new ItemDto(item_to_task, "任务号", "VD108"));
|
list.add(new ItemDto(item_to_task, "任务号", "VD108"));
|
||||||
|
list.add(new ItemDto(item_to_door, "门", "VD112"));
|
||||||
|
list.add(new ItemDto(item_to_floor, "楼层", "VD114"));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -259,7 +259,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void set_last_container_type_desc(String type) {
|
public void set_last_container_type_desc(String type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,6 +305,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
+ "." + ItemProtocol.item_to_target;
|
+ "." + ItemProtocol.item_to_target;
|
||||||
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + ItemProtocol.item_to_task;
|
+ "." + ItemProtocol.item_to_task;
|
||||||
|
String to_door = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + ItemProtocol.item_to_door;
|
||||||
|
String to_floor = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + ItemProtocol.item_to_floor;
|
||||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
Server server = ReadUtil.getServer(opcservcerid);
|
Server server = ReadUtil.getServer(opcservcerid);
|
||||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
@@ -316,6 +319,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
|
|
||||||
} else if (type == 3) {
|
} else if (type == 3) {
|
||||||
itemMap.put(to_task, command);
|
itemMap.put(to_task, command);
|
||||||
|
} else if (type == 4) {
|
||||||
|
itemMap.put(to_door, command);
|
||||||
|
} else if (type == 5) {
|
||||||
|
itemMap.put(to_floor, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadUtil.write(itemMap, server);
|
ReadUtil.write(itemMap, server);
|
||||||
@@ -436,7 +443,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
//container_code
|
//container_code
|
||||||
TaskDto task = taskserver.findByContainer(container_code);
|
TaskDto task = taskserver.findByContainer(container_code);
|
||||||
if (!ObjectUtil.isEmpty(task)) {
|
if (!ObjectUtil.isEmpty(task)) {
|
||||||
if(!ObjectUtils.isEmpty(instructionService.findByBarcodeFromCache(container_code))){
|
if (!ObjectUtils.isEmpty(instructionService.findByBarcodeFromCache(container_code))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String taskid = task.getTask_id();
|
String taskid = task.getTask_id();
|
||||||
@@ -517,9 +524,9 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS).toString(), "1")) {
|
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS).toString(), "1")) {
|
||||||
message = "申请任务中...";
|
message = "申请任务中...";
|
||||||
JSONObject apply = new JSONObject();
|
JSONObject apply = new JSONObject();
|
||||||
apply.put("type","6");
|
apply.put("type", "6");
|
||||||
apply.put("vehicle_code",container_code);
|
apply.put("vehicle_code", container_code);
|
||||||
apply.put("point_code",device_code);
|
apply.put("point_code", device_code);
|
||||||
String str = acsToWmsService.applyTaskToWms(apply);
|
String str = acsToWmsService.applyTaskToWms(apply);
|
||||||
JSONObject jo = JSON.parseObject(str);
|
JSONObject jo = JSON.parseObject(str);
|
||||||
if (ObjectUtil.isEmpty(jo)) {
|
if (ObjectUtil.isEmpty(jo)) {
|
||||||
|
|||||||
@@ -315,23 +315,83 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
if (startdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
|
||||||
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) startdevice.getDeviceDriver();
|
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||||
cargoLiftConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
cargoLiftConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
||||||
|
if (nextdevice.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver){
|
||||||
|
standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
|
standardCoveyorControlWithScannerDeviceDriver.writing(1,1);
|
||||||
|
String address = standardCoveyorControlWithScannerDeviceDriver.getExtraValue().get("address").toString();
|
||||||
|
if (StrUtil.isEmpty(address)){
|
||||||
|
throw new BadRequestException("设备:"+nextdevice.getDevice_code()+"未设置电气调度号!");
|
||||||
|
}
|
||||||
|
String door = standardCoveyorControlWithScannerDeviceDriver.getExtraValue().get("door").toString();
|
||||||
|
if (StrUtil.isEmpty(door)){
|
||||||
|
throw new BadRequestException("设备:"+nextdevice.getDevice_code()+"未设置门!");
|
||||||
|
}
|
||||||
|
String floor = standardCoveyorControlWithScannerDeviceDriver.getExtraValue().get("floor").toString();
|
||||||
|
if (StrUtil.isEmpty(floor)){
|
||||||
|
throw new BadRequestException("设备:"+nextdevice.getDevice_code()+"未设置楼层!");
|
||||||
|
}
|
||||||
|
standardCoveyorControlWithScannerDeviceDriver.writing(2, Integer.parseInt(address));
|
||||||
|
standardCoveyorControlWithScannerDeviceDriver.writing(3, Integer.parseInt(task_code));
|
||||||
|
standardCoveyorControlWithScannerDeviceDriver.writing(4, Integer.parseInt(door));
|
||||||
|
standardCoveyorControlWithScannerDeviceDriver.writing(5, Integer.parseInt(floor));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (startdevice.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
|
||||||
standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) startdevice.getDeviceDriver();
|
standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) startdevice.getDeviceDriver();
|
||||||
standardCoveyorControlWithScannerDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
standardCoveyorControlWithScannerDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
||||||
|
if (nextdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver){
|
||||||
|
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
|
cargoLiftConveyorDeviceDriver.writing(1,1);
|
||||||
|
String address = cargoLiftConveyorDeviceDriver.getExtraValue().get("address").toString();
|
||||||
|
if (StrUtil.isEmpty(address)){
|
||||||
|
throw new BadRequestException("设备:"+nextdevice.getDevice_code()+"未设置电气调度号!");
|
||||||
|
}
|
||||||
|
String door = cargoLiftConveyorDeviceDriver.getExtraValue().get("door").toString();
|
||||||
|
if (StrUtil.isEmpty(door)){
|
||||||
|
throw new BadRequestException("设备:"+nextdevice.getDevice_code()+"未设置门!");
|
||||||
|
}
|
||||||
|
String floor = cargoLiftConveyorDeviceDriver.getExtraValue().get("floor").toString();
|
||||||
|
if (StrUtil.isEmpty(floor)){
|
||||||
|
throw new BadRequestException("设备:"+nextdevice.getDevice_code()+"未设置楼层!");
|
||||||
|
}
|
||||||
|
cargoLiftConveyorDeviceDriver.writing(2, Integer.parseInt(address));
|
||||||
|
cargoLiftConveyorDeviceDriver.writing(3, Integer.parseInt(task_code));
|
||||||
|
cargoLiftConveyorDeviceDriver.writing(4, Integer.parseInt(door));
|
||||||
|
cargoLiftConveyorDeviceDriver.writing(5, Integer.parseInt(floor));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (nextdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) {
|
||||||
haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) startdevice.getDeviceDriver();
|
haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||||
haoKaiAutoConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
haoKaiAutoConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HttpResponse result = agvService.sendAgvInstToZDAgv(dto);
|
String start_device_code = task.getStart_device_code();
|
||||||
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
String next_device_code = task.getNext_device_code();
|
||||||
dto.setSend_status("2");
|
String route_plan_code = task.getRoute_plan_code();
|
||||||
} else {
|
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||||
dto.setSend_status("1");
|
RouteLineDto route = null;
|
||||||
|
for (int i = 0; i < shortPathsList.size(); i++) {
|
||||||
|
RouteLineDto routeLineDto = shortPathsList.get(i);
|
||||||
|
String route_device = routeLineDto.getDevice_code();
|
||||||
|
String route_next_device = routeLineDto.getNext_device_code();
|
||||||
|
if (route_device.equals(dto.getStart_device_code()) && route_next_device.equals(dto.getNext_device_code())){
|
||||||
|
route = routeLineDto;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (ObjectUtil.isEmpty(route)){
|
||||||
|
throw new BadRequestException("未查询到相关路由!");
|
||||||
|
}
|
||||||
|
if (StrUtil.equals(route.getType(), "1")) {
|
||||||
|
HttpResponse result = agvService.sendAgvInstToZDAgv(dto);
|
||||||
|
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||||
|
dto.setSend_status("2");
|
||||||
|
} else {
|
||||||
|
dto.setSend_status("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
dto.setSend_status("2");
|
dto.setSend_status("2");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -1115,7 +1175,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
for (int i = 0; i < this.instructions.size(); i++) {
|
for (int i = 0; i < this.instructions.size(); i++) {
|
||||||
Instruction inst = instructions.get(i);
|
Instruction inst = instructions.get(i);
|
||||||
if (StrUtil.equals(devicecode, inst.getExecute_code())) {
|
if (StrUtil.equals(devicecode, inst.getStart_device_code()) && inst.getInstruction_status().equals("0")) {
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user