fix: 关联站点驱动测试、双工位堆垛机驱动测试
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.acs.device_driver.conveyor.belt_with_station;
|
package org.nl.acs.device_driver.conveyor.belt_with_station;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
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;
|
||||||
@@ -10,7 +11,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.nl.acs.agv.server.NDCAgvService;
|
import org.nl.acs.agv.server.NDCAgvService;
|
||||||
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
|
|
||||||
import org.nl.acs.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
@@ -21,6 +21,8 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
|||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||||
import org.nl.acs.instruction.domain.Instruction;
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||||
|
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
@@ -29,8 +31,8 @@ import org.nl.acs.route.service.RouteLineService;
|
|||||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
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.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.acs.utils.ConvertUtil;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -42,82 +44,32 @@ import java.util.*;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
||||||
@Autowired
|
|
||||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
@Autowired
|
|
||||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||||
@Autowired
|
|
||||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||||
@Autowired
|
|
||||||
TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl");
|
TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
@Autowired
|
|
||||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
||||||
@Autowired
|
|
||||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||||
@Autowired
|
|
||||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||||
@Autowired
|
|
||||||
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||||
|
|
||||||
|
|
||||||
Integer hasGoods = 0;
|
|
||||||
int error = 0;
|
int error = 0;
|
||||||
Boolean iserror = false;
|
Boolean iserror = false;
|
||||||
Boolean islock = false;
|
Boolean islock = false;
|
||||||
|
|
||||||
int branchProtocol = 0;
|
|
||||||
int last_branchProtocol = 0;
|
|
||||||
//是否需要输入物料
|
|
||||||
String input_material = "0";
|
|
||||||
//备注
|
|
||||||
String remark = "";
|
|
||||||
//数量
|
|
||||||
String qty = "";
|
|
||||||
//批次
|
|
||||||
String batch = "";
|
|
||||||
//物料
|
|
||||||
String material = "";
|
|
||||||
//目标点位
|
|
||||||
String purpose = "";
|
|
||||||
|
|
||||||
//上次指令
|
|
||||||
Instruction last_inst = null;
|
|
||||||
|
|
||||||
boolean requireSucess = false;
|
boolean requireSucess = false;
|
||||||
|
|
||||||
//触摸屏手动触发任务
|
|
||||||
private Boolean is_has_task = false;
|
|
||||||
|
|
||||||
//申请搬运任务
|
|
||||||
private Boolean apply_handling = false;
|
|
||||||
//申请物料
|
|
||||||
private Boolean apply_material = false;
|
|
||||||
|
|
||||||
// 1取货完成 2放货完成 3进入区域 4离开区域
|
|
||||||
private int flag;
|
|
||||||
|
|
||||||
//人工确认信号 默认0 agv到达后请求置1 等人工确认后变为2 反馈agv后继续为0
|
|
||||||
private int manua_confirm = 0;
|
|
||||||
|
|
||||||
String device_code = null;
|
|
||||||
String container;
|
|
||||||
String container_type_desc;
|
|
||||||
String last_container_type_desc;
|
|
||||||
String last_container;
|
|
||||||
private Date instruction_require_time = new Date();
|
private Date instruction_require_time = new Date();
|
||||||
private Date instruction_finished_time = new Date();
|
private Date instruction_finished_time = new Date();
|
||||||
|
private Date instruction_update_time = new Date();
|
||||||
private int instruction_require_time_out = 30000;
|
private int instruction_require_time_out = 30000;
|
||||||
|
private int instruction_update_time_out = 500;
|
||||||
|
|
||||||
String message;
|
String message;
|
||||||
|
|
||||||
// 1 上位系统允许进入 2 上位系统允许离开
|
// 1 上位系统允许进入 2 上位系统允许离开
|
||||||
int option = 0;
|
int option = 0;
|
||||||
|
|
||||||
//agv请求当前信息
|
|
||||||
private int agvphase = 0;
|
|
||||||
private int index = 0;
|
private int index = 0;
|
||||||
|
|
||||||
int mode = 2;
|
int mode = 2;
|
||||||
@@ -125,162 +77,105 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
int move;
|
int move;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() throws Exception {
|
||||||
|
|
||||||
device_code = this.getDeviceCode();
|
|
||||||
|
|
||||||
|
|
||||||
//取关联设备 list 要求:先配置外侧的站点
|
//取关联设备 list 要求:先配置外侧的站点
|
||||||
//遍历
|
//遍历
|
||||||
List<String> sddjExtraCodeList = this.getExtraDeviceCodes("link_device_code");
|
List<String> sddjExtraCodeList = this.getExtraDeviceCodes("link_device_code");
|
||||||
//只需要判断对接位就可以
|
//只需要判断对接位就可以
|
||||||
for (int i = 0; i < 1; i++) {
|
for (int i = 0; i < 4; ) {
|
||||||
Device sddjExtraCode1 = deviceAppservice.findDeviceByCode(sddjExtraCodeList.get(i));
|
Device sddjExtraCode1 = deviceAppservice.findDeviceByCode(sddjExtraCodeList.get(i));
|
||||||
Device sddjExtraCode2 = deviceAppservice.findDeviceByCode(sddjExtraCodeList.get(i + 1));
|
Device sddjExtraCode2 = deviceAppservice.findDeviceByCode(sddjExtraCodeList.get(i + 1));
|
||||||
DoubleBeltConveyorDeviceDriver doubleBeltConveyorDeviceDriver1;
|
Device sddjExtraCode3 = deviceAppservice.findDeviceByCode(sddjExtraCodeList.get(i + 2));
|
||||||
DoubleBeltConveyorDeviceDriver doubleBeltConveyorDeviceDriver2;
|
Device sddjExtraCode4 = deviceAppservice.findDeviceByCode(sddjExtraCodeList.get(i + 3));
|
||||||
if (sddjExtraCode1.getDeviceDriver() instanceof DoubleBeltConveyorDeviceDriver && sddjExtraCode1.getDeviceDriver() instanceof DoubleBeltConveyorDeviceDriver) {
|
DoubleBeltConveyorDeviceDriver doubleBeltConveyorDeviceDriverStart;
|
||||||
doubleBeltConveyorDeviceDriver1 = (DoubleBeltConveyorDeviceDriver) sddjExtraCode1.getDeviceDriver();
|
DoubleBeltConveyorDeviceDriver doubleBeltConveyorDeviceDriverEnd1;
|
||||||
doubleBeltConveyorDeviceDriver2 = (DoubleBeltConveyorDeviceDriver) sddjExtraCode2.getDeviceDriver();
|
DoubleBeltConveyorDeviceDriver doubleBeltConveyorDeviceDriverEnd2;
|
||||||
//判断输送线是否有任务,有任务进行创建指令。
|
DoubleBeltConveyorDeviceDriver doubleBeltConveyorDeviceDriverWith;
|
||||||
TaskDto taskDtos1 = taskServer.findByStartCodeAndReady(doubleBeltConveyorDeviceDriver1.getDevice_code());
|
if (sddjExtraCode1.getDeviceDriver() instanceof DoubleBeltConveyorDeviceDriver && sddjExtraCode2.getDeviceDriver() instanceof DoubleBeltConveyorDeviceDriver) {
|
||||||
TaskDto taskDtos2 = taskServer.findByStartCodeAndReady(doubleBeltConveyorDeviceDriver1.getDevice_code());
|
doubleBeltConveyorDeviceDriverStart = (DoubleBeltConveyorDeviceDriver) sddjExtraCode1.getDeviceDriver();
|
||||||
if (ObjectUtil.isNotEmpty(taskDtos1) && ObjectUtil.isNotEmpty(taskDtos2)) {
|
doubleBeltConveyorDeviceDriverEnd1 = (DoubleBeltConveyorDeviceDriver) sddjExtraCode2.getDeviceDriver();
|
||||||
if (doubleBeltConveyorDeviceDriver1.getMove() == 0) {
|
doubleBeltConveyorDeviceDriverEnd2 = (DoubleBeltConveyorDeviceDriver) sddjExtraCode3.getDeviceDriver();
|
||||||
requireSucess = false;
|
doubleBeltConveyorDeviceDriverWith = (DoubleBeltConveyorDeviceDriver) sddjExtraCode4.getDeviceDriver();
|
||||||
}
|
//判断输送线是否有任务
|
||||||
if (doubleBeltConveyorDeviceDriver2.getMove() == 0) {
|
List<TaskDto> tasks = taskServer.findByStartCodeAndBusy(doubleBeltConveyorDeviceDriverStart.getDevice_code());
|
||||||
requireSucess = false;
|
if (CollectionUtil.isNotEmpty(tasks) && tasks.size() == 2) {
|
||||||
}
|
String nextPointCode1 = tasks.get(0).getNext_point_code();
|
||||||
//判断任务列是否相邻
|
String nextPointCode2 = tasks.get(1).getNext_point_code();
|
||||||
String nextDeviceCode1 = taskDtos1.getNext_device_code();
|
if (StrUtil.contains(nextPointCode1, "-") && StrUtil.contains(nextPointCode2, "-")) {
|
||||||
String nextDeviceCode2 = taskDtos2.getNext_device_code();
|
//判断关联的输送线是否满足状态
|
||||||
if (StrUtil.contains(nextDeviceCode1, "-") && StrUtil.contains(nextDeviceCode2, "-")) {
|
if (doubleBeltConveyorDeviceDriverEnd1.getMode() == 2 && doubleBeltConveyorDeviceDriverEnd1.getMove() == 1) {
|
||||||
String[] split1 = nextDeviceCode1.split("-");
|
//判断任务列是否相邻
|
||||||
String nextPointCodeDown = split1[0] + "-" + (Integer.parseInt(split1[1]) - 1) + "-" + split1[2];
|
String[] split1 = nextPointCode1.split("-");
|
||||||
String nextPointCodeUp = split1[0] + "-" + (Integer.parseInt(split1[1]) + 1) + "-" + split1[2];
|
String x1;
|
||||||
if (!nextDeviceCode2.equals(nextPointCodeDown) || !nextDeviceCode2.equals(nextPointCodeUp)) {
|
String x2;
|
||||||
//创建指令
|
if (Integer.parseInt(split1[1]) < 10) {
|
||||||
if (ObjectUtil.isNotNull(taskDtos1) && "1".equals(taskDtos1.getTask_type())) {
|
x1 = "0" + (Integer.parseInt(split1[1]) - 1);
|
||||||
creatInstruction(taskDtos1);
|
x2 = "0" + (Integer.parseInt(split1[1]) + 1);
|
||||||
|
} else {
|
||||||
|
x1 = "" + (Integer.parseInt(split1[1]) - 1);
|
||||||
|
x2 = "" + (Integer.parseInt(split1[1]) + 1);
|
||||||
|
}
|
||||||
|
String nextPointCodeDown = split1[0] + "-" + x1 + "-" + split1[2];
|
||||||
|
String nextPointCodeUp = split1[0] + "-" + x2 + "-" + split1[2];
|
||||||
|
if (!nextPointCode2.equals(nextPointCodeDown) && !nextPointCode2.equals(nextPointCodeUp)) {
|
||||||
|
if ("1".equals(tasks.get(0)
|
||||||
|
.getTask_type())) {
|
||||||
|
//创建单指令
|
||||||
|
extracted(doubleBeltConveyorDeviceDriverEnd1, doubleBeltConveyorDeviceDriverWith);
|
||||||
|
log.info("虚拟工位指令创建成功");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//判断是否大于等待时间
|
||||||
|
if (null != doubleBeltConveyorDeviceDriverEnd1.getArrivalTime() && System.currentTimeMillis() - doubleBeltConveyorDeviceDriverEnd1.getArrivalTime().getTime()
|
||||||
|
< Integer.parseInt(this.getExtraValue().get("apply_time").toString()) * 1000) {
|
||||||
|
if (doubleBeltConveyorDeviceDriverEnd2.getMode() == 2 && doubleBeltConveyorDeviceDriverEnd2.getMove() == 1) {
|
||||||
|
//创建双指令
|
||||||
|
extracted(doubleBeltConveyorDeviceDriverEnd1, doubleBeltConveyorDeviceDriverWith);
|
||||||
|
extracted(doubleBeltConveyorDeviceDriverEnd2, doubleBeltConveyorDeviceDriverWith);
|
||||||
|
log.info("虚拟工位指令创建成功");
|
||||||
|
requireSucess = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
extracted(doubleBeltConveyorDeviceDriverEnd1, doubleBeltConveyorDeviceDriverWith);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
requireSucess = false;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void extracted(DoubleBeltConveyorDeviceDriver doubleBeltConveyorDeviceDriver, DoubleBeltConveyorDeviceDriver doubleBeltConveyorDeviceDriverWith) throws Exception {
|
||||||
|
if (doubleBeltConveyorDeviceDriver.getMove() != 0 && doubleBeltConveyorDeviceDriver.getTask() > 0) {
|
||||||
|
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;
|
||||||
|
Instruction inst = instructionService.findByCodeFromCache(String.valueOf(doubleBeltConveyorDeviceDriver.getTask()));
|
||||||
|
if (inst != null) {
|
||||||
|
//当货物到达b点,实现完成指令
|
||||||
|
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) || StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||||
|
inst.setExecute_device_code(doubleBeltConveyorDeviceDriver.getDevice_code());
|
||||||
|
inst.setNext_device_code(doubleBeltConveyorDeviceDriverWith.getDevice_code());
|
||||||
|
finish_instruction(inst);
|
||||||
|
logServer.deviceExecuteLog(doubleBeltConveyorDeviceDriver.getDevice_code(), "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + doubleBeltConveyorDeviceDriver.getTask());
|
||||||
|
|
||||||
//判断关联的输送线是否满足状态
|
|
||||||
if (doubleBeltConveyorDeviceDriver1.getMode() == 2 && doubleBeltConveyorDeviceDriver1.getMove() == 1 && !requireSucess && doubleBeltConveyorDeviceDriver2.getMode() == 2 && doubleBeltConveyorDeviceDriver2.getMove() == 1) {
|
|
||||||
//判断是否大于等待时间
|
|
||||||
if (System.currentTimeMillis() - doubleBeltConveyorDeviceDriver1.getInstruction_require_time().getTime()
|
|
||||||
> Integer.parseInt(this.getExtraValue().get("apply_time").toString()) * 1000) {
|
|
||||||
//创建指令
|
|
||||||
if (ObjectUtil.isNotNull(taskDtos1) && "1".equals(taskDtos1.getTask_type())) {
|
|
||||||
creatInstruction(taskDtos1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.info("单工位请求成功");
|
|
||||||
requireSucess = true;
|
|
||||||
} else {
|
|
||||||
//创建指令
|
|
||||||
if (ObjectUtil.isNotNull(taskDtos1) && "1".equals(taskDtos1.getTask_type())) {
|
|
||||||
creatInstruction(taskDtos1);
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotNull(taskDtos2) && "1".equals(taskDtos1.getTask_type())) {
|
|
||||||
creatInstruction(taskDtos2);
|
|
||||||
}
|
|
||||||
log.info("双工位指令创建成功");
|
|
||||||
requireSucess = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void creatInstruction(TaskDto taskDtos1) {
|
|
||||||
|
|
||||||
//判断当前任务号是否存在指令
|
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
|
||||||
String taskid = taskDtos1.getTask_id();
|
instructionService.finish(inst);
|
||||||
String taskcode = taskDtos1.getTask_code();
|
return true;
|
||||||
String priority = taskDtos1.getPriority();
|
|
||||||
String start_point_code = taskDtos1.getStart_point_code();
|
|
||||||
String start_device_code = taskDtos1.getStart_device_code();
|
|
||||||
String route_plan_code = taskDtos1.getRoute_plan_code();
|
|
||||||
String next_device_code = "";
|
|
||||||
/**
|
|
||||||
* 开始平均分配
|
|
||||||
*/
|
|
||||||
String this_coevice_code = taskServer.queryAssignedByDevice(device_code, taskDtos1.getNext_device_code());
|
|
||||||
if (StrUtil.isEmpty(this_coevice_code)) {
|
|
||||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, taskDtos1.getNext_device_code(), route_plan_code);
|
|
||||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
|
||||||
|
|
||||||
String path = routeLineDto.getPath();
|
|
||||||
String type = routeLineDto.getType();
|
|
||||||
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 + 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) || shortPathsList.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 = taskDtos1.getTo_x() + "-" + taskDtos1.getTo_y() + "-" + taskDtos1.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(taskDtos1.getRemark());
|
|
||||||
instdto.setMaterial(taskDtos1.getMaterial());
|
|
||||||
instdto.setQuantity(taskDtos1.getQuantity());
|
|
||||||
instdto.setTask_id(taskid);
|
|
||||||
instdto.setTask_code(taskcode);
|
|
||||||
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);
|
|
||||||
log.error("=================================,{}", instdto.getCreate_by());
|
|
||||||
try {
|
|
||||||
instructionService.create(instdto);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
log.error("指令创建失败!", e.getMessage());
|
|
||||||
}
|
|
||||||
taskDtos1.setTask_status("1");
|
|
||||||
taskServer.update(taskDtos1);
|
|
||||||
requireSucess = true;
|
|
||||||
Map map = new HashMap();
|
|
||||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
|
||||||
map.put("to_target", next_addr);
|
|
||||||
map.put("to_task", instdto.getInstruction_code());
|
|
||||||
map.put("to_command", "1");
|
|
||||||
map.put("to_container_type", "1");
|
|
||||||
map.put("to_container_no", "1");
|
|
||||||
this.writing(map);
|
|
||||||
requireSucess = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准版-输送机
|
* 双工位-输送机
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class DoubleBeltConveyorDefination implements OpcDeviceDriverDefination {
|
public class DoubleBeltConveyorDefination implements OpcDeviceDriverDefination {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.nl.acs.agv.server.AgvService;
|
import org.nl.acs.agv.server.AgvService;
|
||||||
|
import org.nl.acs.common.base.CommonFinalParam;
|
||||||
import org.nl.acs.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
@@ -36,7 +37,7 @@ import java.util.*;
|
|||||||
import static redis.clients.jedis.HostAndPort.localhost;
|
import static redis.clients.jedis.HostAndPort.localhost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 输送线
|
* 双工位输送线
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
@@ -59,6 +60,7 @@ public class DoubleBeltConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
private Date instruction_finished_time = new Date();
|
private Date instruction_finished_time = new Date();
|
||||||
private Date instruction_apply_time = new Date();
|
private Date instruction_apply_time = new Date();
|
||||||
private int instruction_require_time_out = 3000;
|
private int instruction_require_time_out = 3000;
|
||||||
|
private Date arrivalTime = null;
|
||||||
|
|
||||||
//心跳
|
//心跳
|
||||||
int heartbeat = 0;
|
int heartbeat = 0;
|
||||||
@@ -249,29 +251,28 @@ public class DoubleBeltConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
Instruction instruction = null;
|
Instruction instruction = null;
|
||||||
List toInstructions;
|
List toInstructions;
|
||||||
|
|
||||||
//纸管库申请任务
|
}
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 1:
|
case 1:
|
||||||
log.debug("弃用(留作兼容)");
|
log.debug("弃用(留作兼容)");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//申请任务
|
//申请任务
|
||||||
if (move == 1 && !requireSucess) {
|
if (move == 1 && !requireSucess) {
|
||||||
instruction_require();
|
instruction_require();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
log.info("运行中");
|
log.info("运行中");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//申请出货
|
//申请出货
|
||||||
if (move == 1 && !requireSucess) {
|
if (move == 1 && !requireSucess) {
|
||||||
//request_for_shipment(String.valueOf(mode), item_out_seq_arr, item_out_qty_arr);
|
//request_for_shipment(String.valueOf(mode), item_out_seq_arr, item_out_qty_arr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
last_heartbeat = heartbeat;
|
last_heartbeat = heartbeat;
|
||||||
last_mode = mode;
|
last_mode = mode;
|
||||||
@@ -300,17 +301,28 @@ public class DoubleBeltConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void writing(Map<String, Object> map) {
|
public void writing(List list) {
|
||||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
|
||||||
Map<String, Object> itemMap = new LinkedHashMap<>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
map.forEach((key, value) -> {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
if (ObjectUtil.isNotEmpty(value)) {
|
Object ob = list.get(i);
|
||||||
itemMap.put(getToParam() + key, value);
|
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
|
||||||
|
if (!StrUtil.isEmpty(json.getString("value"))) {
|
||||||
|
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + json.getString("code");
|
||||||
|
itemMap.put(to_param, json.getString("value"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||||
|
try {
|
||||||
|
this.checkcontrol(itemMap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
try {
|
||||||
|
this.checkcontrol(itemMap);
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
|
||||||
this.control(itemMap);
|
|
||||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,6 +385,7 @@ public class DoubleBeltConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
* 申请任务
|
* 申请任务
|
||||||
*/
|
*/
|
||||||
public synchronized Boolean instruction_require() {
|
public synchronized Boolean instruction_require() {
|
||||||
|
List<Object> list = new ArrayList<>();
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||||
@@ -395,7 +408,8 @@ public class DoubleBeltConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
map.put("to_command", "1");
|
map.put("to_command", "1");
|
||||||
map.put("to_container_type", "1");
|
map.put("to_container_type", "1");
|
||||||
map.put("to_container_no", "1");
|
map.put("to_container_no", "1");
|
||||||
this.writing(map);
|
list.add(map);
|
||||||
|
this.writing(list);
|
||||||
led_message = getLedMessage(inst);
|
led_message = getLedMessage(inst);
|
||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
return true;
|
return true;
|
||||||
@@ -491,7 +505,8 @@ public class DoubleBeltConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
map.put("to_command", "1");
|
map.put("to_command", "1");
|
||||||
map.put("to_container_type", "1");
|
map.put("to_container_type", "1");
|
||||||
map.put("to_container_no", "1");
|
map.put("to_container_no", "1");
|
||||||
this.writing(map);
|
list.add(map);
|
||||||
|
this.writing(list);
|
||||||
led_message = getLedMessage(instdto);
|
led_message = getLedMessage(instdto);
|
||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
return true;
|
return true;
|
||||||
@@ -580,7 +595,7 @@ public class DoubleBeltConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
/**
|
/**
|
||||||
* 更新指令状态
|
* 更新指令状态
|
||||||
*/
|
*/
|
||||||
public synchronized void update_instruction_status() throws Exception {
|
public synchronized void update_instruction_status() {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
@@ -588,13 +603,22 @@ public class DoubleBeltConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
this.instruction_update_time = date;
|
this.instruction_update_time = date;
|
||||||
inst = checkInst();
|
inst = checkInst();
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
//a点到b点,给状态说允许取货
|
//a点,给状态说允许取货
|
||||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||||
inst.setExecute_device_code(this.device_code);
|
inst.setExecute_device_code(this.device_code);
|
||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task);
|
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task);
|
||||||
}
|
}
|
||||||
|
//当b点存在货物的时候设置到达时间
|
||||||
|
if (StrUtil.equals(inst.getInstruction_status(), CommonFinalParam.ONE) || StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||||
|
if (!StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code()) && mode ==2 && move == 1) {
|
||||||
|
this.arrivalTime = new Date();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
message = "有报警";
|
message = "有报警";
|
||||||
} else {
|
} else {
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
List<Object> list = new ArrayList<>();
|
||||||
if (CommandEnum.STANDY.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.STANDY.getStatus())){
|
if (CommandEnum.STANDY.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.STANDY.getStatus())){
|
||||||
applyTask();
|
applyTask();
|
||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
@@ -349,7 +350,8 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(map)) {
|
if (ObjectUtil.isNotNull(map)) {
|
||||||
this.writing(map);
|
list.add(map);
|
||||||
|
this.writing(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastHeartbeat = heartbeat;
|
lastHeartbeat = heartbeat;
|
||||||
@@ -490,7 +492,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
|
|
||||||
Instruction inst = instructionList.get(0);
|
Instruction inst = instructionList.get(0);
|
||||||
LinkedList<Instruction> instructionsAll = new LinkedList<>();
|
LinkedList<Instruction> instructionsAll = new LinkedList<>();
|
||||||
|
instructionsAll.add(inst);
|
||||||
//找出有相邻的列的指令,如果没有按照单叉走,有按照双叉走
|
//找出有相邻的列的指令,如果没有按照单叉走,有按照双叉走
|
||||||
if (findInstruction(instructionList, inst, instructionsAll)) {
|
if (findInstruction(instructionList, inst, instructionsAll)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -541,6 +543,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean wirteData(LinkedList<Instruction> inst) {
|
private boolean wirteData(LinkedList<Instruction> inst) {
|
||||||
|
List<Object> list = new ArrayList<>();
|
||||||
if (StrUtil.equals(inst.get(0).getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
if (StrUtil.equals(inst.get(0).getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||||
String startDeviceCode = inst.get(0).getStart_device_code();
|
String startDeviceCode = inst.get(0).getStart_device_code();
|
||||||
Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode);
|
Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode);
|
||||||
@@ -557,23 +560,23 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
if (inst.size()==1&& ObjectUtil.isNotEmpty(inst.get(0))) {
|
if (inst.size()==1&& ObjectUtil.isNotEmpty(inst.get(0))) {
|
||||||
map.put("to_device_code", this.getDevice().getAddress());
|
map.put("to_device_code", this.getDevice().getAddress());
|
||||||
map.put("to_command", CommandEnum.PICKUP.getStatus());
|
map.put("to_command", CommandEnum.PICKUP.getStatus().toString());
|
||||||
map.put("to_front_task", inst.get(0).getInstruction_code());
|
map.put("to_front_task", inst.get(0).getInstruction_code());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (inst.size()>1 && ObjectUtil.isNotEmpty(inst.get(1))) {
|
else if (inst.size()>1 && ObjectUtil.isEmpty(inst.get(1))) {
|
||||||
map.put("to_device_code", this.getDevice().getAddress());
|
map.put("to_device_code", this.getDevice().getAddress());
|
||||||
map.put("to_command", CommandEnum.PICKUP.getStatus());
|
map.put("to_command", CommandEnum.PICKUP.getStatus().toString());
|
||||||
map.put("to_back_task", inst.get(1).getInstruction_code());
|
map.put("to_back_task", inst.get(1).getInstruction_code());
|
||||||
}else{
|
}else{
|
||||||
map.put("to_device_code", this.getDevice().getAddress());
|
map.put("to_device_code", this.getDevice().getAddress());
|
||||||
map.put("to_command", CommandEnum.PICKUP.getStatus());
|
map.put("to_command", CommandEnum.PICKUP.getStatus().toString());
|
||||||
map.put("to_front_task", inst.get(0).getInstruction_code());
|
map.put("to_front_task", inst.get(0).getInstruction_code());
|
||||||
map.put("to_back_task", inst.get(1).getInstruction_code());
|
map.put("to_back_task", inst.get(1).getInstruction_code());
|
||||||
}
|
}
|
||||||
writeStorageOrConveyor(inst, startDeviceCode, startDevice, map);
|
writeStorageOrConveyor(inst, startDeviceCode, startDevice, map);
|
||||||
|
list.add(map);
|
||||||
this.writing(map);
|
this.writing(list);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -645,12 +648,21 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
if (Integer.valueOf(splitFront[1]).equals(MIN_Y)){
|
if (Integer.valueOf(splitFront[1]).equals(MIN_Y)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
String x1 ;
|
||||||
|
String x2 ;
|
||||||
|
if (Integer.parseInt(splitFront[1])<10){
|
||||||
|
x1 = "0"+(Integer.parseInt(splitFront[1]) - 1);
|
||||||
|
x2 = "0"+(Integer.parseInt(splitFront[1]) + 1);
|
||||||
|
}else {
|
||||||
|
x1 = ""+(Integer.parseInt(splitFront[1]) - 1);
|
||||||
|
x2 = ""+(Integer.parseInt(splitFront[1]) + 1);
|
||||||
|
}
|
||||||
//根据排序进行加减
|
//根据排序进行加减
|
||||||
String nextPointCodeDown = splitFront[0] + commonFinalParam.getBARRE() + (Integer.parseInt(splitFront[1]) - 1) + commonFinalParam.getBARRE() + splitFront[2];
|
String nextPointCodeDown = splitFront[0] + commonFinalParam.getBARRE() + x1 + commonFinalParam.getBARRE() + splitFront[2];
|
||||||
String nextPointCodeUp = splitFront[0] + commonFinalParam.getBARRE() + (Integer.parseInt(splitFront[1]) + 1) + commonFinalParam.getBARRE() + splitFront[2];
|
String nextPointCodeUp = splitFront[0] + commonFinalParam.getBARRE() + x2 + commonFinalParam.getBARRE() + splitFront[2];
|
||||||
if (CollectionUtil.isNotEmpty(sort)&& SortEnum.BACK.getCode().equals(sort.get(0).getExtra_value())){
|
if (CollectionUtil.isNotEmpty(sort)&& SortEnum.BACK.getCode().equals(sort.get(0).getExtra_value())){
|
||||||
nextPointCodeDown = splitFront[0] + commonFinalParam.getBARRE() + (Integer.parseInt(splitFront[1]) + 1) + commonFinalParam.getBARRE() + splitFront[2];
|
nextPointCodeDown = splitFront[0] + commonFinalParam.getBARRE() + x2 + commonFinalParam.getBARRE() + splitFront[2];
|
||||||
nextPointCodeUp = splitFront[0] + commonFinalParam.getBARRE() + (Integer.parseInt(splitFront[1]) - 1) + commonFinalParam.getBARRE() + splitFront[2];
|
nextPointCodeUp = splitFront[0] + commonFinalParam.getBARRE() + x1 + commonFinalParam.getBARRE() + splitFront[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Integer.valueOf(splitFront[1]).equals(MAX_Y)){
|
if (Integer.valueOf(splitFront[1]).equals(MAX_Y)){
|
||||||
@@ -772,17 +784,28 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
|
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writing(Map<String, Object> map) {
|
public void writing(List list) {
|
||||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
|
||||||
Map<String, Object> itemMap = new LinkedHashMap<>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
map.forEach((key, value) -> {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
if (ObjectUtil.isNotEmpty(value)) {
|
Object ob = list.get(i);
|
||||||
itemMap.put(getToParam() + key, value);
|
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
|
||||||
|
if (!StrUtil.isEmpty(json.getString("value"))) {
|
||||||
|
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + json.getString("code");
|
||||||
|
itemMap.put(to_param, json.getString("value"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||||
|
try {
|
||||||
|
this.checkcontrol(itemMap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
try {
|
||||||
|
this.checkcontrol(itemMap);
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
|
||||||
this.control(itemMap);
|
|
||||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -406,4 +406,9 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
void downloadInstLogging(List<JSONObject> instList, HttpServletResponse response) throws IOException;
|
void downloadInstLogging(List<JSONObject> instList, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只完成指令
|
||||||
|
* @param inst2
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1622,4 +1622,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
}
|
}
|
||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class TaskController {
|
|||||||
@Log("修改任务")
|
@Log("修改任务")
|
||||||
@ApiOperation("修改任务")
|
@ApiOperation("修改任务")
|
||||||
//@PreAuthorize("@el.check('task:edit')")
|
//@PreAuthorize("@el.check('task:edit')")
|
||||||
public ResponseEntity<Object> update(@Validated @RequestBody TaskDto dto) {
|
public ResponseEntity<Object> update(@Validated @RequestBody TaskDto dto) {
|
||||||
taskService.update(dto);
|
taskService.update(dto);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -501,4 +501,5 @@ public interface TaskService extends CommonService<Task> {
|
|||||||
*/
|
*/
|
||||||
List<JSONObject> getTaskList(Map whereJson);
|
List<JSONObject> getTaskList(Map whereJson);
|
||||||
|
|
||||||
|
List<TaskDto> findByStartCodeAndBusy(String deviceCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1733,6 +1733,25 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TaskDto> findByStartCodeAndBusy(String deviceCode) {
|
||||||
|
Iterator var3 = tasks.iterator();
|
||||||
|
ArrayList<TaskDto> tasks = new ArrayList<>();
|
||||||
|
while (var3.hasNext()) {
|
||||||
|
TaskDto task = (TaskDto) var3.next();
|
||||||
|
// if (!StrUtil.equals(task.getTask_type(), "5")) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
if (StrUtil.equals(task.getStart_device_code(), deviceCode)
|
||||||
|
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex())) {
|
||||||
|
if (tasks.size()<2){
|
||||||
|
tasks.add(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer querySameTaskByType(String taskType) {
|
public Integer querySameTaskByType(String taskType) {
|
||||||
|
|||||||
Reference in New Issue
Block a user