rev:优化烘箱行架任务逻辑

This commit is contained in:
2024-11-18 13:43:57 +08:00
parent 32b0710a37
commit 4135200271
20 changed files with 194 additions and 174 deletions

View File

@@ -1,5 +1,6 @@
package org.nl.acs.agv.server.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -109,8 +110,16 @@ public class NDCAgvServiceImpl implements NDCAgvService {
byte fhdlow2 = (byte) IntToHexLow(nextAddress2);
byte prioritylow = (byte) IntToHexLow(priority);
String str = "十进制下发:";
String str1 = "十六进制下发:";
if (ObjectUtil.isNotEmpty(inst.getCarno())) {
int carNo = Integer.parseInt(inst.getCarno());
byte agvnohigh = (byte) IntToHexHigh(carNo);
byte agvnolow = (byte) IntToHexLow(carNo);
str += "agv车号 /carNo:" + (carNo);
str1 += "agv车号 /carNo:" + hexToString(agvnolow & 0xFF);
}
str += "任务号 ikey:" + (Integer.parseInt(instcode));
str1 += "任务号 ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
@@ -132,6 +141,28 @@ public class NDCAgvServiceImpl implements NDCAgvService {
byte[] b = new byte[]{};
if (type == 1) {
if (ObjectUtil.isNotEmpty(inst.getCarno())) {
int carNo = Integer.parseInt(inst.getCarno());
byte agvnohigh = (byte) IntToHexHigh(carNo);
byte agvnolow = (byte) IntToHexLow(carNo);
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X18,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X14,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) qhdhigh2, (byte) qhdlow2,
(byte) fhdhigh, (byte) fhdlow,
(byte) fhdhigh2, (byte) fhdlow2,
(byte) agvnohigh, (byte) agvnolow
};
} else {
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X16,
@@ -148,6 +179,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
(byte) fhdhigh, (byte) fhdlow,
(byte) fhdhigh2, (byte) fhdlow2
};
}
} else if (type == 2) {
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,

View File

@@ -465,7 +465,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "上报满卷重量,weight:" + weight);
message = "上报满卷重量,weight:" + weight + ",指令号:" + ikey;
task.setWeight(String.valueOf(weight));
task.setCarno(this.device_code);
task.setCar_no(this.device_code);
taskService.update(task);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);

View File

@@ -146,4 +146,6 @@ public class CreateTaskRequest extends BaseRequest {
private String paper_array;
private String car_no;
}

View File

@@ -774,6 +774,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String route_plan_code = request.getRoute_plan_code();
String task_type = request.getTask_type();
String truss_type = request.getTruss_type();
String car_no = request.getCar_no();
String is_bushing = request.getIs_bushing();
String version = request.getVersion();
String bushing_num = request.getBushing_num();
@@ -968,6 +969,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("vehicle_type", vehicle_type);
jo.put("storage_task_type", storage_task_type);
jo.put("agv_system_type", agv_system_type);
jo.put("car_no", car_no);
jo.put("start_height", start_height);
jo.put("next_height", next_height);
jo.put("oven_time", (int) Math.ceil(oven_time));

View File

@@ -303,7 +303,7 @@ public class TaskDto implements Serializable {
/**
* 车号
*/
private String carno;
private String car_no;
/**
* agv取货高度
@@ -353,6 +353,7 @@ public class TaskDto implements Serializable {
@Override
public String toString(){
return "task_code:" + this.getTask_code()

View File

@@ -774,8 +774,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (ObjectUtil.isNotEmpty(dto.getWeight())) {
feed_jo.put("weight", dto.getWeight());
}
if (ObjectUtil.isNotEmpty(dto.getCarno())) {
feed_jo.put("car_no", dto.getCarno());
if (ObjectUtil.isNotEmpty(dto.getCar_no())) {
feed_jo.put("car_no", dto.getCar_no());
}
JSONArray ja = new JSONArray();
ja.add(feed_jo);
@@ -1188,7 +1188,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
map.put("立库任务类型", acsTask.getStorage_task_type());
map.put("烘箱温度", acsTask.getTemperature());
map.put("烘箱时间", acsTask.getOven_time());
map.put("agv车号", acsTask.getCarno());
map.put("agv车号", acsTask.getCar_no());
map.put("路由方案名称", acsTask.getRoute_plan_name());
map.put("路由方案编码", acsTask.getRoute_plan_code());
map.put("是否需要反馈上位系统", acsTask.getIs_needfeedback());

View File

@@ -68,6 +68,7 @@ public class AutoCreateInst {
String route_plan_code = acsTask.getRoute_plan_code();
String vehicleType = acsTask.getVehicle_type();
String agv_system_type = acsTask.getAgv_system_type();
String carno = acsTask.getCar_no();
String start_height = acsTask.getStart_height();
String next_height = acsTask.getNext_height();
@@ -141,6 +142,7 @@ public class AutoCreateInst {
instdto.setExecute_device_code(start_point_code);
instdto.setVehicle_type(vehicleType);
instdto.setAgv_system_type(agv_system_type);
instdto.setCarno(carno);
instdto.setStart_height(start_height);
instdto.setNext_height(next_height);
//判断agv系统

View File

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

View File

@@ -124,4 +124,6 @@ public interface XianGongAgvService {
* @return
*/
HttpResponse sendOrderSequencesToForklift(Instruction dto, InteractionJsonDTO interactionJsonDTO);
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.agv.server.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -74,7 +75,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
}
@Override
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
log.info("sendAgvInstToNDC 指令下发NDC:" + "inst_code:" + inst.getInstruction_code() + ",agv_system_type:" + agv_system_type + ",agv_inst_type:" + inst.getAgv_inst_type() +
@@ -84,7 +84,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
if (!StrUtil.equals(agv_system_type, "1")) {
String instcode = inst.getInstruction_code();
int type = Integer.parseInt(inst.getAgv_inst_type());
int carNo = Integer.parseInt(inst.getCarno());
int priority = Integer.parseInt(inst.getPriority()) + 128;
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
@@ -96,8 +95,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
byte typehigh = (byte) IntToHexHigh(type);
byte typelow = (byte) IntToHexLow(type);
byte agvnohigh = (byte) IntToHexHigh(carNo);
byte agvnolow = (byte) IntToHexLow(carNo);
byte qhdhigh = (byte) IntToHexHigh(startAddress);
byte qhdlow = (byte) IntToHexLow(startAddress);
byte qhdhigh2 = (byte) IntToHexHigh(startAddress2);
@@ -107,7 +104,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
byte fhdhigh2 = (byte) IntToHexHigh(nextAddress2);
byte fhdlow2 = (byte) IntToHexLow(nextAddress2);
byte prioritylow = (byte) IntToHexLow(priority);
String str = "十进制下发:";
String str1 = "十六进制下发:";
str += "任务号 ikey:" + (Integer.parseInt(instcode));
@@ -128,8 +124,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
str += "优先级 /priority:" + (priority);
str1 += "优先级 /priority:" + hexToString(prioritylow & 0xFF);
str += "agv车号 /carNo:" + (carNo);
str1 += "agv车号 /carNo:" + hexToString(agvnolow & 0xFF);
byte[] b = new byte[]{};
if (type == 1) {
@@ -341,7 +335,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
}
@Override
public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity) {
public byte[] sendAgvTwoModeInst(int phase, int index, int result, int offset, int quantity) {
if (phase < 0 || index < 0)
return null;
byte indexhigh = (byte) IntToHexHigh(index);
@@ -368,7 +362,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:"
+ hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)+",是否侧移: "+(offset == 1?"侧移":"不测移") + ",偏离量: " + quantity);
+ hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF) + ",是否侧移: " + (offset == 1 ? "侧移" : "不测移") + ",偏离量: " + quantity);
System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
return b;
@@ -520,7 +514,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
}
@Override
public Map<String, AgvDto> findAllAgvFromCache() {
return AGVDeviceStatus;

View File

@@ -1082,6 +1082,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
/**
* 追加动作块
*

View File

@@ -338,8 +338,18 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
List<TaskDto> taskDtoStream = taskDtos.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
if (ObjectUtil.isNotEmpty(taskDtoStream)) {
TaskDto taskDto = taskDtos.get(0);
if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) {
//存在行架->暂存的AGV任务 需要过滤
// 6 行架任务 8烘箱任务
if (!StrUtil.equals(taskDto.getTask_type(), "6") && !StrUtil.equals(taskDto.getTask_type(), "8")) {
taskDto = null;
continue;
}
Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDto.getTask_code());
if (ObjectUtil.isEmpty(instruction)) {
break;
}
String start_device_code = instruction.getStart_device_code();
String next_device_code = instruction.getNext_device_code();
Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);
@@ -380,12 +390,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}*/
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
// if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
if (standardInspectSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code();
return false;
}
}
// }
}
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
@@ -397,12 +407,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
// if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
if (standardInspectSiteDeviceDriver.getMove() != 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code();
return false;
}
}
// }
}
if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
@@ -460,32 +470,25 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
this.writing(list);
this.setRequireSucess(true);
return true;
}
} else {
List<TaskDto> taskDtoList = taskserver.findByTrappedManipulatorReady();
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtoList)) {
List<TaskDto> taskDtosReady = new ArrayList<>();
for (TaskDto taskDto1 : taskDtoList) {
if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) {
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);
}
for (int j = 0; j < taskDtoList.size(); j++) {
//按照优先级排序 优先级相等按照创建时间排序
readyTaskDtos = this.sortTask(readyTaskDtos);
task = readyTaskDtos.get(0);
taskDtoList = this.sortTask(taskDtoList);
task = taskDtoList.get(j);
// 6 行架任务 8烘箱任务
if (!StrUtil.equals(task.getTask_type(), "6") && !StrUtil.equals(task.getTask_type(), "8")) {
task = null;
continue;
}
if (ObjectUtil.isNotEmpty(task)) {
break;
}
}
}
}
}
if (!ObjectUtil.isEmpty(task)) {
Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code());
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
@@ -524,12 +527,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}*/
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
// if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
if (standardInspectSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "光电无货,无法生成指令!";
return false;
}
}
// }
}
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
@@ -548,12 +551,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
// if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
if (standardInspectSiteDeviceDriver.getMove() != 0) {
notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "光电有货,无法生成指令!";
return false;
}
}
// }
}
String taskid = task.getTask_id();
@@ -664,11 +667,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
list.add(map3);
this.writing(list);
this.setRequireSucess(true);
return true;
} else {
notCreateInstMessage = "未找到关联设备的任务,指令无法创建";
}
return true;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -130,6 +130,9 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
}catch (Exception ex){
throw new RuntimeException();
}
if ("123456".equals(sysUser.getPassword())) {
sysUser.setPassword(SaSecureUtil.md5BySalt("123456", "salt"));
}
sysUser.setUpdate_time(new Date());
sysUser.setUpdate_id(SecurityUtils.getCurrentUserId());
this.updateById(sysUser);

View File

@@ -1,7 +1,7 @@
import store from '@/store'
export default {
inserted(el, binding) {
inserted(el, binding, vnode) {
const { value } = binding
const roles = store.getters && store.getters.roles
if (value && value instanceof Array && value.length > 0) {

View File

@@ -10,7 +10,7 @@ spring:
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# username: ${DB_USER:root}
username: ${DB_USER:root}
password: ${DB_PWD:root}
password: ${DB_PWD:123456}
# 初始连接数
initial-size: 5
# 最小连接数