This commit is contained in:
2024-11-04 19:16:48 +08:00
parent 3620f6e20b
commit d93283701b
17 changed files with 280 additions and 208 deletions

View File

@@ -1138,8 +1138,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (StrUtil.isNotEmpty(taskDto.getOven_time())) { if (StrUtil.isNotEmpty(taskDto.getOven_time())) {
//下发烘箱时间 //下发烘箱时间
int time = Integer.parseInt(taskDto.getOven_time()); int time = Integer.parseInt(taskDto.getOven_time());
int hours = (time % (60 * 60 * 24)) / (60 * 60); int hours = (time / (60 * 60)); // 整数小时
int minutes = (time % (60 * 60)) / 60; int minutes = (time % (60 * 60)) / 60; // 剩余分钟
hongXiangConveyorDeviceDriver.writing("to_time_house", String.valueOf(hours)); hongXiangConveyorDeviceDriver.writing("to_time_house", String.valueOf(hours));
hongXiangConveyorDeviceDriver.writing("to_time_min", String.valueOf(minutes)); hongXiangConveyorDeviceDriver.writing("to_time_min", String.valueOf(minutes));
} }

View File

@@ -84,6 +84,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
if (!StrUtil.equals(agv_system_type, "1")) { if (!StrUtil.equals(agv_system_type, "1")) {
String instcode = inst.getInstruction_code(); String instcode = inst.getInstruction_code();
int type = Integer.parseInt(inst.getAgv_inst_type()); int type = Integer.parseInt(inst.getAgv_inst_type());
int carNo = Integer.parseInt(inst.getCarno());
int priority = Integer.parseInt(inst.getPriority()) + 128; int priority = Integer.parseInt(inst.getPriority()) + 128;
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
@@ -95,6 +96,8 @@ public class NDCAgvServiceImpl implements NDCAgvService {
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode)); byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
byte typehigh = (byte) IntToHexHigh(type); byte typehigh = (byte) IntToHexHigh(type);
byte typelow = (byte) IntToHexLow(type); byte typelow = (byte) IntToHexLow(type);
byte agvnohigh = (byte) IntToHexHigh(carNo);
byte agvnolow = (byte) IntToHexLow(carNo);
byte qhdhigh = (byte) IntToHexHigh(startAddress); byte qhdhigh = (byte) IntToHexHigh(startAddress);
byte qhdlow = (byte) IntToHexLow(startAddress); byte qhdlow = (byte) IntToHexLow(startAddress);
byte qhdhigh2 = (byte) IntToHexHigh(startAddress2); byte qhdhigh2 = (byte) IntToHexHigh(startAddress2);
@@ -125,6 +128,8 @@ public class NDCAgvServiceImpl implements NDCAgvService {
str += "优先级 /priority:" + (priority); str += "优先级 /priority:" + (priority);
str1 += "优先级 /priority:" + hexToString(prioritylow & 0xFF); str1 += "优先级 /priority:" + hexToString(prioritylow & 0xFF);
str += "agv车号 /carNo:" + (carNo);
str1 += "agv车号 /carNo:" + hexToString(agvnolow & 0xFF);
byte[] b = new byte[]{}; byte[] b = new byte[]{};
if (type == 1) { if (type == 1) {

View File

@@ -9,7 +9,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.agv.server.impl.XianGongAgvServiceImpl;
import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.common.base.CommonFinalParam;
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;

View File

@@ -470,6 +470,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
String bindingTemplate = jo.get("bindingTemplate").toString(); String bindingTemplate = jo.get("bindingTemplate").toString();
String printDevice = jo.get("printDevice").toString(); String printDevice = jo.get("printDevice").toString();
String bundleTimes = jo.get("bundleTimes").toString(); String bundleTimes = jo.get("bundleTimes").toString();
String to_case = jo.get("box_structure").toString();
List list = new ArrayList(); List list = new ArrayList();
@@ -522,6 +523,10 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
map12.put("code", "to_labeling_template"); map12.put("code", "to_labeling_template");
map12.put("value", labelingTemplate); map12.put("value", labelingTemplate);
list.add(map12); list.add(map12);
Map map13 = new HashMap();
map13.put("code", "to_case");
map13.put("value", to_case);
list.add(map13);
} }
if (mode == 13) { if (mode == 13) {
Map map = new HashMap(); Map map = new HashMap();
@@ -544,6 +549,10 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
map11.put("code", "to_binding_times"); map11.put("code", "to_binding_times");
map11.put("value", bundleTimes); map11.put("value", bundleTimes);
list.add(map11); list.add(map11);
Map map13 = new HashMap();
map13.put("code", "to_case");
map13.put("value", to_case);
list.add(map13);
} }
if (mode == 14) { if (mode == 14) {
Map map4 = new HashMap(); Map map4 = new HashMap();
@@ -582,6 +591,10 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
map11.put("code", "to_binding_times"); map11.put("code", "to_binding_times");
map11.put("value", bundleTimes); map11.put("value", bundleTimes);
list.add(map11); list.add(map11);
Map map13 = new HashMap();
map13.put("code", "to_case");
map13.put("value", to_case);
list.add(map13);
} }
if (mode == 17) { if (mode == 17) {
@@ -607,6 +620,10 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
map11.put("code", "to_binding_times"); map11.put("code", "to_binding_times");
map11.put("value", bundleTimes); map11.put("value", bundleTimes);
list.add(map11); list.add(map11);
Map map6 = new HashMap();
map6.put("code", "to_case");
map.put("value", to_case);
list.add(map6);
if (StrUtil.isNotEmpty(case1) && !" ".equals(case1)) { if (StrUtil.isNotEmpty(case1) && !" ".equals(case1)) {
Map map12 = new HashMap(); Map map12 = new HashMap();
map12.put("code", "to_binding_times"); map12.put("code", "to_binding_times");

View File

@@ -108,6 +108,11 @@ public class ItemProtocol {
*/ */
public static String item_to_binding_times = "to_binding_times"; public static String item_to_binding_times = "to_binding_times";
/**
* 下发木箱规格
*/
public static String item_to_case = "to_case";
/** /**
@@ -239,6 +244,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W24")); list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W24"));
list.add(new ItemDto(item_to_weight, "木箱宽度", "DB601.W26")); list.add(new ItemDto(item_to_weight, "木箱宽度", "DB601.W26"));
list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W28")); list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W28"));
list.add(new ItemDto(item_to_case, "下发木箱规格", "DB601.W30"));
return list; return list;
} }

View File

@@ -497,7 +497,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
notCreateInstMessage = "universal_notCreateInstMessage"; notCreateInstMessage = "universal_notCreateInstMessage";
} }
} }
return true; return false;
} }
} }

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.pull_head_manipulator; package org.nl.acs.device_driver.two_conveyor.pull_head_manipulator;
import cn.hutool.core.collection.CollUtil;
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;
@@ -363,39 +364,25 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
List<String> putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); List<String> putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
TaskDto task = null; TaskDto task = null;
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
for (int i = 0; i < getDeviceCodeList.size(); i++) {
String startDeviceCode = getDeviceCodeList.get(i);
//先查指令 //先查指令
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus3(startDeviceCode); List<Instruction> instructionList = instructionService.findReadyIns();
if (ObjectUtil.isNotEmpty(taskDtos)) { if (CollUtil.isNotEmpty(instructionList)) {
taskDtos = this.sortTask(taskDtos); List<Instruction> instructionsReady = new ArrayList<>();
TaskDto taskDto = taskDtos.get(0); Instruction instructionReady = null;
for (Instruction instruction : instructionList) {
if (!StrUtil.equals(taskDto.getTask_type(), "6") && !StrUtil.equals(taskDto.getTask_type(), "8")) { if (getDeviceCodeList.contains(instruction.getStart_device_code())) {
taskDto = null; instructionsReady.add(instruction);
continue;
} }
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); }
if (ObjectUtil.isNotEmpty(instruction)) { if (CollUtil.isNotEmpty(instructionsReady)) {
String startCode = instruction.getStart_device_code(); List<Instruction> instructions = instructionsReady.stream().sorted(Comparator.comparing(Instruction::getCreate_time)).collect(Collectors.toList());
String nextCode = instruction.getNext_device_code(); instructionReady = instructions.get(0);
}
if (ObjectUtil.isNotEmpty(instructionReady)) {
String startCode = instructionReady.getStart_device_code();
String nextCode = instructionReady.getNext_device_code();
Device startDevice = deviceAppService.findDeviceByCode(startCode); Device startDevice = deviceAppService.findDeviceByCode(startCode);
Device nextDevice = deviceAppService.findDeviceByCode(nextCode); Device nextDevice = deviceAppService.findDeviceByCode(nextCode);
if (startDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startDevice.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getAction() != 1) {
notCreateInstMessage = startCode + "工位状态为不允许取,无法生成指令";
return false;
}
}
if (nextDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getAction() != 2) {
notCreateInstMessage = nextCode + "工位状态为不允许放,无法生成指令";
return false;
}
}
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
notCreateInstMessage = "未设置电气调度号!"; notCreateInstMessage = "未设置电气调度号!";
@@ -407,125 +394,90 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
} }
String startAddr = startDevice.getExtraValue().get("address").toString(); String startAddr = startDevice.getExtraValue().get("address").toString();
String nextAddr = nextDevice.getExtraValue().get("address").toString(); String nextAddr = nextDevice.getExtraValue().get("address").toString();
String msg = "当前设备:" + device_code + ",下发指令:" TaskDto byTaskCode = taskserver.findByTaskCode(instructionReady.getTask_code());
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code() String interactionJson = byTaskCode.getInteraction_json();
+ ",指令终点:" + instruction.getNext_device_code();
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(device_code)
.content(msg)
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
String interaction_json = taskDto.getInteraction_json();
// Map<String, Object> map = toStringObjectMap(instruction, startAddr, nextAddr, interaction_json); // Map<String, Object> map = toStringObjectMap(instruction, startAddr, nextAddr, interaction_json);
try { try {
pushPLC(instruction, startAddr, nextAddr, interaction_json); pushPLC(instructionReady, startAddr, nextAddr, interactionJson);
} catch (Exception e) { } catch (Exception e) {
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("当前设备:" + device_code + ",下发指令:" .content("当前设备:" + device_code + ",下发指令:"
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code() + instructionReady.getInstruction_code() + ",指令起点:" + instructionReady.getStart_device_code()
+ ",指令终点:" + instruction.getNext_device_code() + ",指令执行失败:" + e.getMessage()) + ",指令终点:" + instructionReady.getNext_device_code() + ",指令执行失败:" + e.getMessage())
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
} }
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
instruction.setUpdate_time(DateUtil.now());
instructionService.update(instruction);
this.setRequireSucess(true); this.setRequireSucess(true);
return true; return true;
} }
} else { } else {
List<TaskDto> taskDtoList = taskserver.findByTrappedManipulatorReady(); List<TaskDto> taskDtos = taskserver.findByTrappedManipulatorReady();
if (ObjectUtil.isNotEmpty(taskDtoList)) {
List<TaskDto> taskDtosReady = new ArrayList<>(); List<TaskDto> taskDtosReady = new ArrayList<>();
for (TaskDto taskDto1 : taskDtoList) { TaskDto taskDto = null;
if (CollUtil.isNotEmpty(taskDtos)) {
for (TaskDto taskDto1 : taskDtos) {
if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) { if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) {
taskDtosReady.add(taskDto1); taskDtosReady.add(taskDto1);
} }
} }
// task = taskDtosReady.get(0);
List<TaskDto> readyTaskDtos = new ArrayList<>();
for (int j = 0; j < taskDtosReady.size(); j++) {
task = taskDtosReady.get(j);
readyTaskDtos.add(task);
} }
//按照优先级排序 优先级相等按照创建时间排序 if (CollUtil.isNotEmpty(taskDtosReady)) {
readyTaskDtos = this.sortTask(readyTaskDtos); for (TaskDto dto : taskDtosReady) {
task = readyTaskDtos.get(0); String firstDeviceCode = dto.getStart_device_code();
}
if (ObjectUtil.isNotEmpty(task)) {
break;
}
}
}
if (!ObjectUtil.isEmpty(task)) {
String taskId = task.getTask_id();
String taskCode = task.getTask_code();
String vehicleCode = task.getVehicle_code();
String priority = task.getPriority();
String startPointCode = task.getStart_point_code();
String routePlanCode = task.getRoute_plan_code();
String nextPointCode = task.getNext_point_code();
String firstDeviceCode = task.getStart_device_code();
Device start_device = deviceAppService.findDeviceByCode(firstDeviceCode); Device start_device = deviceAppService.findDeviceByCode(firstDeviceCode);
if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver(); plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getAction() != 1) { if (plugPullDeviceSiteDeviceDriver.getAction() != 1) {
notCreateInstMessage = firstDeviceCode + "工位状态为不允许取,无法生成指令"; notCreateInstMessage = firstDeviceCode + "工位状态为不允许取,无法生成指令";
return false; continue;
} }
} }
String nextDeviceCode = task.getNext_device_code(); String nextDeviceCode = dto.getNext_device_code();
Device next_device = deviceAppService.findDeviceByCode(nextDeviceCode); Device next_device = deviceAppService.findDeviceByCode(nextDeviceCode);
if (next_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { if (next_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) next_device.getDeviceDriver(); plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) next_device.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getAction() != 2) { if (plugPullDeviceSiteDeviceDriver.getAction() != 2) {
notCreateInstMessage = nextDeviceCode + "工位状态为不允许放,无法生成指令"; notCreateInstMessage = nextDeviceCode + "工位状态为不允许放,无法生成指令";
return false; continue;
} }
} }
taskDto = dto;
if (ObjectUtil.isNotEmpty(taskDto)) {
break;
}
}
}
if (!ObjectUtil.isEmpty(taskDto)) {
String taskId = taskDto.getTask_id();
String taskCode = taskDto.getTask_code();
String vehicleCode = taskDto.getVehicle_code();
String priority = taskDto.getPriority();
String start_device_code = taskDto.getStart_device_code();
String next_device_code = taskDto.getNext_device_code();
String routePlanCode = taskDto.getRoute_plan_code();
Instruction instdto = new Instruction(); Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(routePlanCode); instdto.setRoute_plan_code(routePlanCode);
instdto.setRemark(task.getRemark()); instdto.setRemark(taskDto.getRemark());
instdto.setMaterial(task.getMaterial()); instdto.setMaterial(taskDto.getMaterial());
instdto.setQuantity(task.getQuantity()); instdto.setQuantity(taskDto.getQuantity());
instdto.setTask_id(taskId); instdto.setTask_id(taskId);
instdto.setTask_code(taskCode); instdto.setTask_code(taskCode);
instdto.setVehicle_code(vehicleCode); instdto.setVehicle_code(vehicleCode);
String now = DateUtil.now(); String now = DateUtil.now();
instdto.setCreate_time(now); instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName()); instdto.setCreate_by(SecurityUtils.getCurrentNickName());
instdto.setStart_device_code(firstDeviceCode); instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(nextDeviceCode); instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(startPointCode); instdto.setStart_point_code(start_device_code);
instdto.setNext_point_code(nextPointCode); instdto.setNext_point_code(next_device_code);
instdto.setPriority(priority); instdto.setPriority(priority);
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(startPointCode); instdto.setExecute_device_code(device_code);
try {
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + "创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
}
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code());
//创建指令后修改任务状态
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
task.setUpdate_time(DateUtil.now());
taskserver.update(task);
Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code()); Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code()); Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
@@ -542,8 +494,20 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
} }
String startAddr = startDevice.getExtraValue().get("address").toString(); String startAddr = startDevice.getExtraValue().get("address").toString();
String nextAddr = nextDevice.getExtraValue().get("address").toString(); String nextAddr = nextDevice.getExtraValue().get("address").toString();
String interaction_json = task.getInteraction_json();
// Map<String, Object> map = toStringObjectMap(instdto, startAddr, nextAddr, interaction_json); try {
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + "创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
}
String interaction_json = taskDto.getInteraction_json();
try { try {
pushPLC(instdto, startAddr, nextAddr, interaction_json); pushPLC(instdto, startAddr, nextAddr, interaction_json);
} catch (Exception e) { } catch (Exception e) {
@@ -555,13 +519,18 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
} }
//创建指令后修改任务状态
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskserver.update(taskDto);
this.setRequireSucess(true); this.setRequireSucess(true);
return true; return true;
} else { } else {
notCreateInstMessage = "找到关联设备的任务,指令无法创建"; notCreateInstMessage = "找到关联设备的任务,指令无法创建";
} }
return true; }
return false;
} }
} }

View File

@@ -226,4 +226,9 @@ public class CreateTaskRequest extends BaseRequest {
* 17 木箱堆叠行架任务 * 17 木箱堆叠行架任务
*/ */
private String class_type; private String class_type;
/**
* agv编号
*/
private String agv_no;
} }

View File

@@ -133,6 +133,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String route_plan_code = request.getRoute_plan_code(); String route_plan_code = request.getRoute_plan_code();
String task_type = request.getTask_type(); String task_type = request.getTask_type();
String class_type = request.getClass_type(); String class_type = request.getClass_type();
String agv_no = request.getAgv_no();
String truss_type = request.getTruss_type(); String truss_type = request.getTruss_type();
Integer agv_action_type = request.getAgv_action_type(); Integer agv_action_type = request.getAgv_action_type();
String empty_site = request.getEmpty_site(); String empty_site = request.getEmpty_site();
@@ -354,6 +355,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("next_device_code2", next_device_code2); jo.put("next_device_code2", next_device_code2);
jo.put("put_device_code", put_device_code); jo.put("put_device_code", put_device_code);
jo.put("agv_action_type", agv_action_type); jo.put("agv_action_type", agv_action_type);
jo.put("agv_no", agv_no);
jo.put("priority", priority); jo.put("priority", priority);
jo.put("vehicle_code", vehicle_code); jo.put("vehicle_code", vehicle_code);
jo.put("vehicle_code2", vehicle_code2); jo.put("vehicle_code2", vehicle_code2);

View File

@@ -2064,6 +2064,16 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
public List<Instruction> findReadyInstructions() {
//根据时间升序取第一个
List<Instruction> instructionsList = instructions.stream()
.filter(item -> StrUtil.equals(item.getInstruction_type(), TaskTypeEnum.Truss_Task.getIndex())
&& StrUtil.equals(item.getInstruction_status(), TaskStatusEnum.READY.getIndex())).collect(Collectors.toList());
return instructionsList;
}
private boolean regional(String start_device_code, String next_device_code) { private boolean regional(String start_device_code, String next_device_code) {
Device startdevice = deviceAppService.findDeviceByCode(start_device_code); Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextdevice = deviceAppService.findDeviceByCode(next_device_code); Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);

View File

@@ -247,6 +247,11 @@ public class Task extends CommonModel<Task> implements Serializable {
private Integer agv_action_type; private Integer agv_action_type;
/**
* agv编号
*/
private String agv_no;
/** /**
* 任务类型 * 任务类型
* 9 子卷下线行架任务 * 9 子卷下线行架任务

View File

@@ -370,4 +370,9 @@ public class TaskDto implements Serializable {
* 15 RGV输送任务 * 15 RGV输送任务
*/ */
private String class_type; private String class_type;
/**
* agv编号
*/
private String agv_no;
} }

View File

@@ -88,6 +88,7 @@ public class AutoCreateInst {
String route_plan_code = acsTask.getRoute_plan_code(); String route_plan_code = acsTask.getRoute_plan_code();
String vehicleType = acsTask.getVehicle_type(); String vehicleType = acsTask.getVehicle_type();
String agv_system_type = acsTask.getAgv_system_type(); String agv_system_type = acsTask.getAgv_system_type();
String agv_no = acsTask.getAgv_no();
String start_height = acsTask.getStart_height(); String start_height = acsTask.getStart_height();
String next_height = acsTask.getNext_height(); String next_height = acsTask.getNext_height();
@@ -166,6 +167,7 @@ public class AutoCreateInst {
instdto.setStart_height(start_height); instdto.setStart_height(start_height);
instdto.setNext_height(next_height); instdto.setNext_height(next_height);
instdto.setAgv_action_type(agvActionType); instdto.setAgv_action_type(agvActionType);
instdto.setCarno(agv_no);
//判断agv系统 //判断agv系统
//1、1楼叉车系统 //1、1楼叉车系统
//2、2楼1区域AGV系统 //2、2楼1区域AGV系统

View File

@@ -10,7 +10,7 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.67}:${DB_PORT:3306}/${DB_NAME:lzhl_acs2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root} username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456} # password: ${DB_PWD:Root.123456}

View File

@@ -12,7 +12,7 @@ spring:
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root} username: ${DB_USER:root}
password: ${DB_PWD:NLABC&hl123} password: ${DB_PWD:123456}
# password: ${DB_PWD:p@ssw0rd} # password: ${DB_PWD:p@ssw0rd}
# 初始连接数 # 初始连接数
initial-size: 5 initial-size: 5

View File

@@ -6,7 +6,7 @@ spring:
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
active: dev active: prod
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
data: data:

View File

@@ -1,6 +1,13 @@
package org.nl; package org.nl;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.unit.DataUnit;
import cn.hutool.core.util.StrUtil;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.enums.InstructionStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.system.service.user.ISysUserService; import org.nl.system.service.user.ISysUserService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -8,6 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner; import java.util.Scanner;
import java.util.concurrent.*; import java.util.concurrent.*;
@@ -23,25 +33,62 @@ public class ApplicationTest {
private Logger logger = LoggerFactory.getLogger(ApplicationTest.class); private Logger logger = LoggerFactory.getLogger(ApplicationTest.class);
private List<Person> persons = new CopyOnWriteArrayList();
@Test @Test
void contextLoads() { void contextLoads() {
Scanner scanner = new Scanner(System.in); Person person1 = new Person();
System.out.println("请输入第一个数:"); Person person2 = new Person();
int a = scanner.nextInt(); Person person3 = new Person();
System.out.println("请输入第一个数:"); String now1 = DateUtil.now();
int b = scanner.nextInt(); person1.setCreate_time(now1);
System.out.println("请输入第一个数:"); String now2 = DateUtil.now();
int c = scanner.nextInt(); String now3 = DateUtil.now();
//求最小值 person2.setCreate_time(now2);
int min = (((a < b) ? a : b) < c) ? ((a < b) ? a : b) : c; person3.setCreate_time(now3);
//求最大值 person1.setNext_device_code("CK2042");
int max = (((a > b) ? a : b) > c) ? ((a > b) ? a : b) : c; person2.setNext_device_code("CK2042");
//求中间值 person3.setNext_device_code("CK2042");
int mid = a + b + c - max - min; person1.setInstruction_status("0");
//排序 person2.setInstruction_status("0");
System.out.println("最小值为:" + min + "中间值为:" + mid + "最大值为:" + max); person3.setInstruction_status("0");
person1.setInstruction_type("6");
person2.setInstruction_type("17");
person3.setInstruction_type("7");
persons.add(person1);
persons.add(person2);
persons.add(person3);
Person person = findByNextDeviceCodeFromCache("CK2042");
System.out.println(person);
}
public Person findByNextDeviceCodeFromCache(String devicecode) {
List<Person> personList = persons;
ListUtil.sort(
personList,
new Comparator<Person>() {
@Override
public int compare(Person o1, Person o2) {
return o1.getCreate_time().compareTo(o2.getCreate_time());
}
});
Iterator<Person> it = persons.iterator();
while (it.hasNext()) {
Person person = it.next();
if (StrUtil.equals(devicecode, person.getNext_device_code()) && Integer.parseInt(person.getInstruction_status()) <= Integer.parseInt(InstructionStatusEnum.BUSY.getIndex()) && !person.getInstruction_type().equals(TaskTypeEnum.Mxddhj_Task.getIndex())&& !person.getInstruction_type().equals(TaskTypeEnum.Truss_Task.getIndex())) {
return person;
}
}
return null;
}
@Test
void contextLoads2() {
int time = Integer.parseInt("137341");
int hours = (time / (60 * 60)); // 整数小时
int minutes = (time % (60 * 60)) / 60; // 剩余分钟
System.out.println("hours:" + hours + " minutes:" + minutes);
} }
@Test @Test