fix: 修复一期内包间问题,更新二期日志

This commit is contained in:
yanps
2025-03-18 10:05:00 +08:00
parent 8caf561afb
commit c20293c9ec
19 changed files with 231 additions and 115 deletions

View File

@@ -17,7 +17,7 @@ public class CleanLog {
public void run(){ public void run(){
//delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10; //delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
WQLObject logTab = WQLObject.getWQLObject("sys_log"); WQLObject logTab = WQLObject.getWQLObject("sys_log_1");
int days = Integer.parseInt(paramService.findByCode("log_day").getValue()); int days = Integer.parseInt(paramService.findByCode("log_day").getValue());
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))"); logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
log.info("自动清理日志执行成功...!"); log.info("自动清理日志执行成功...!");

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.basedriver.indoor_manipulator; package org.nl.acs.device_driver.basedriver.indoor_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;
@@ -40,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
@@ -252,7 +254,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
inst = null; inst = null;
message = null; message = null;
} }
if(mode == 2 && requireSucess){ if (mode == 2 && requireSucess) {
this.setRequireSucess(false); this.setRequireSucess(false);
logServer.deviceExecuteLog(this.device_code, "", "", "再次信号复位requireSuccess" + requireSucess); logServer.deviceExecuteLog(this.device_code, "", "", "再次信号复位requireSuccess" + requireSucess);
} }
@@ -449,7 +451,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
//反馈尺寸 //反馈尺寸
if (mode == 3 && action == 2) { if (mode == 3 && action == 2) {
String task_code = inst1.getTask_code(); String task_code = inst1.getTask_code();
if(Long.parseLong(task_code) < 1){ if (Long.parseLong(task_code) < 1) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 2); map.put("to_command", 2);
this.writing(map); this.writing(map);
@@ -475,9 +477,9 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
} }
//申请放货点 //申请放货点
if (mode == 3 && action == 3 ) { if (mode == 3 && action == 3) {
String task_code = inst1.getTask_code(); String task_code = inst1.getTask_code();
if(Long.parseLong(task_code) < 1){ if (Long.parseLong(task_code) < 1) {
message = "任务ACS创建,不向LMS申请放货点"; message = "任务ACS创建,不向LMS申请放货点";
return; return;
} }
@@ -506,7 +508,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
//申请新取货点 //申请新取货点
if (mode == 3 && action == 4) { if (mode == 3 && action == 4) {
String task_code = inst1.getTask_code(); String task_code = inst1.getTask_code();
if(Long.parseLong(task_code) < 1){ if (Long.parseLong(task_code) < 1) {
message = "任务ACS创建,不向LMS申请新取货点"; message = "任务ACS创建,不向LMS申请新取货点";
return; return;
} }
@@ -534,7 +536,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
//申请二次放货点 //申请二次放货点
if (mode == 3 && action == 5) { if (mode == 3 && action == 5) {
String task_code = inst1.getTask_code(); String task_code = inst1.getTask_code();
if(Long.parseLong(task_code) < 1){ if (Long.parseLong(task_code) < 1) {
message = "任务ACS创建,不反馈LMS"; message = "任务ACS创建,不反馈LMS";
return; return;
} }
@@ -562,7 +564,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
//缓存库取货完成 //缓存库取货完成
if (mode == 3 && action == 6) { if (mode == 3 && action == 6) {
String task_code = inst1.getTask_code(); String task_code = inst1.getTask_code();
if(Long.parseLong(task_code) < 1){ if (Long.parseLong(task_code) < 1) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "6"); map.put("to_command", "6");
this.writing(map); this.writing(map);
@@ -589,7 +591,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
//缓存库放货完成 //缓存库放货完成
if (mode == 3 && action == 7) { if (mode == 3 && action == 7) {
String task_code = inst1.getTask_code(); String task_code = inst1.getTask_code();
if(Long.parseLong(task_code) < 1){ if (Long.parseLong(task_code) < 1) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "7"); map.put("to_command", "7");
this.writing(map); this.writing(map);
@@ -621,7 +623,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
applyManipulatorActionRequest.setType("10"); applyManipulatorActionRequest.setType("10");
applyManipulatorActionRequest.setTask_code1(task_code); applyManipulatorActionRequest.setTask_code1(task_code);
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
if(applyManipulatorActionResponse.getstatus() == HttpStatus.OK.value()) { if (applyManipulatorActionResponse.getstatus() == HttpStatus.OK.value()) {
instructionService.cancel(inst1.getInstruction_id()); instructionService.cancel(inst1.getInstruction_id());
logServer.deviceExecuteLog(this.device_code, "", "", "取消指令完成"); logServer.deviceExecuteLog(this.device_code, "", "", "取消指令完成");
TaskDto byTaskCode = taskserver.findByTaskCode(inst1.getTask_code()); TaskDto byTaskCode = taskserver.findByTaskCode(inst1.getTask_code());
@@ -634,7 +636,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
message = "异常气胀轴任务取消成功"; message = "异常气胀轴任务取消成功";
} }
} catch (Exception e) { } catch (Exception e) {
message = "取消任务或指令失败,失败原因"+ e.getMessage(); message = "取消任务或指令失败,失败原因" + e.getMessage();
feedbackSucess = false; feedbackSucess = false;
} }
} }
@@ -765,11 +767,11 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
if (this.requireSucess) { if (this.requireSucess) {
requireSucess = "1"; requireSucess = "1";
} }
if(deviceStatus && error == 0){ if (deviceStatus && error == 0) {
iserror = true; iserror = true;
message = "信号连接异常!"; message = "信号连接异常!";
} }
if(error == 0 && !deviceStatus){ if (error == 0 && !deviceStatus) {
iserror = false; iserror = false;
} }
jo.put("requireSucess", requireSucess); jo.put("requireSucess", requireSucess);
@@ -789,15 +791,15 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
action = "任务完成"; action = "任务完成";
} }
String type = ""; String type = "";
if("1".equals(this.truss_type)){ if ("1".equals(this.truss_type)) {
type = "点对点任务"; type = "点对点任务";
}else if("6".equals(this.truss_type)){ } else if ("6".equals(this.truss_type)) {
type = "下卷拔轴任务"; type = "下卷拔轴任务";
}else if("7".equals(this.truss_type)){ } else if ("7".equals(this.truss_type)) {
type = "换轴任务"; type = "换轴任务";
}else if("8".equals(this.truss_type)){ } else if ("8".equals(this.truss_type)) {
type = "放轴任务"; type = "放轴任务";
}else if("9".equals(this.truss_type)){ } else if ("9".equals(this.truss_type)) {
type = "异常气胀轴任务"; type = "异常气胀轴任务";
} }
@@ -809,7 +811,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
jo.put("walk_y", String.valueOf(this.walk_y)); jo.put("walk_y", String.valueOf(this.walk_y));
jo.put("isOnline", this.getIsonline()); jo.put("isOnline", this.getIsonline());
jo.put("error", StrUtil.isNotEmpty(ErrorUtil.getDictDetail("nbjhj_error_type", String.valueOf(this.getError()))) jo.put("error", StrUtil.isNotEmpty(ErrorUtil.getDictDetail("nbjhj_error_type", String.valueOf(this.getError())))
?ErrorUtil.getDictDetail("nbjhj_error_type", String.valueOf(this.getError())):this.getError()); ? ErrorUtil.getDictDetail("nbjhj_error_type", String.valueOf(this.getError())) : this.getError());
jo.put("isError", this.getIserror()); jo.put("isError", this.getIserror());
jo.put("message", this.getMessage()); jo.put("message", this.getMessage());
jo.put("is_click", true); jo.put("is_click", true);
@@ -867,21 +869,14 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
if (ObjectUtil.isEmpty(putDeviceCodeList)) { if (ObjectUtil.isEmpty(putDeviceCodeList)) {
putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
} }
String taskType = "9";
String taskStatus = "1";
List<TaskDto> taskDtoList1 = taskserver.queryTaskByTaskType(taskType, taskStatus);
TaskDto task = null; TaskDto task = null;
for (int i = 0; i < getDeviceCodeList.size(); i++) { if (CollUtil.isNotEmpty(taskDtoList1)) {
String startDeviceCode = getDeviceCodeList.get(i); List<TaskDto> taskDtos = taskDtoList1.stream().filter(taskDto -> CollUtil.contains(getDeviceCodeList, taskDto.getStart_device_code())).collect(Collectors.toList());
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos); taskDtos = this.sortTask(taskDtos);
TaskDto taskDto = taskDtos.get(0); for (TaskDto taskDto : taskDtos) {
truss_type = taskDto.getTruss_type();
//存在行架->暂存的AGV任务 需要过滤
// 9 行架任务
if (!StrUtil.equals(taskDto.getTask_type(), "9")) {
taskDto = null;
continue;
}
Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDto.getTask_code()); Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDto.getTask_code());
String start_device_code = instruction.getStart_device_code(); String start_device_code = instruction.getStart_device_code();
String next_device_code = instruction.getNext_device_code(); String next_device_code = instruction.getNext_device_code();
@@ -901,24 +896,15 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
String is_bushing = taskDto.getIs_bushing(); String is_bushing = taskDto.getIs_bushing();
String version = taskDto.getVersion(); String version = taskDto.getVersion();
String bushing_num = taskDto.getBushing_num(); String bushing_num = taskDto.getBushing_num();
/*Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "1");
map.put("inflatableShaftVersion", version);
map.put("tube_num", StrUtil.isEmpty(bushing_num) ? "0" : bushing_num);
map.put("is_wrapped",StrUtil.isEmpty(is_bushing) ? "0" : is_bushing );
map.put("to_task_type", taskDto.getTruss_type());
map.put("to_onset", start_addr);
map.put("to_task", instruction.getInstruction_code());
map.put("to_target", next_addr);*/
List list = new ArrayList(); List list = new ArrayList();
writing(list,"to_command","1"); writing(list, "to_command", "1");
writing(list,"inflatableShaftVersion",version); writing(list, "inflatableShaftVersion", version);
writing(list,"tube_num",StrUtil.isEmpty(bushing_num) ? "0" : bushing_num); writing(list, "tube_num", StrUtil.isEmpty(bushing_num) ? "0" : bushing_num);
writing(list,"is_wrapped",StrUtil.isEmpty(is_bushing) ? "0" : is_bushing); writing(list, "is_wrapped", StrUtil.isEmpty(is_bushing) ? "0" : is_bushing);
writing(list,"to_task_type",taskDto.getTruss_type()); writing(list, "to_task_type", taskDto.getTruss_type());
writing(list,"to_onset",start_addr); writing(list, "to_onset", start_addr);
writing(list,"to_task",instruction.getInstruction_code()); writing(list, "to_task", instruction.getInstruction_code());
writing(list,"to_target",next_addr); writing(list, "to_target", next_addr);
try { try {
this.writing(list); this.writing(list);
} catch (Exception e) { } catch (Exception e) {
@@ -927,14 +913,17 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
} }
this.setRequireSucess(true); this.setRequireSucess(true);
return true; return true;
}
} else { } else {
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); taskStatus = "0";
if (ObjectUtil.isNotEmpty(taskDtoList)) { List<TaskDto> taskDtoList2 = taskserver.queryTaskByTaskType(taskType, taskStatus);
//按照优先级排序 优先级相等按照创建时间排序 List<TaskDto> taskDtos = taskDtoList2.stream().filter(taskDto -> CollUtil.contains(getDeviceCodeList, taskDto.getStart_device_code()))
taskDtoList = this.sortTask(taskDtoList); .collect(Collectors.toList());
for (int j = 0; j < taskDtoList.size(); j++) { taskDtos = this.sortTask(taskDtos);
task = taskDtoList.get(j); for (TaskDto taskDto : taskDtos) {
Boolean flag; Boolean flag;
task = taskDto;
Device deviceByCode = deviceAppService.findDeviceByCode(task.getNext_device_code());
if ("6".equals(task.getTruss_type())) { if ("6".equals(task.getTruss_type())) {
flag = checkAgv(task); flag = checkAgv(task);
if (flag) { if (flag) {
@@ -943,20 +932,24 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
} else { } else {
message = "任务号为:" + task.getTask_code() + "的RGV条件不满足,不允许允许创建指令"; message = "任务号为:" + task.getTask_code() + "的RGV条件不满足,不允许允许创建指令";
task = null; task = null;
// logServer.deviceExecuteLog(this.device_code, "", "", "RGV条件不满足,不允许允许创建指令,任务号为:" + task); continue;
}
}
if ("1".equals(task.getTruss_type()) && deviceByCode.getDeviceDriver() instanceof RgvDeviceDriver) {
flag = verifyRgv(deviceByCode);
if (flag) {
logServer.deviceExecuteLog(this.device_code, "", "", "RGV条件满足,允许创建指令,任务号为:" + task.getTask_code());
break;
} else {
message = "任务号为:" + task.getTask_code() + "的RGV条件不满足,不允许允许创建指令";
task = null;
continue; continue;
} }
} }
// 9 行架任务 // 9 行架任务
if (ObjectUtil.isNotEmpty(task) && !StrUtil.equals(task.getTask_type(), "9")) {
task = null;
continue;
}
if (ObjectUtil.isNotEmpty(task)) break; if (ObjectUtil.isNotEmpty(task)) break;
} }
} }
}
}
if (!ObjectUtil.isEmpty(task)) { if (!ObjectUtil.isEmpty(task)) {
truss_type = task.getTruss_type(); truss_type = task.getTruss_type();
Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code()); Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code());
@@ -968,6 +961,12 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
notCreateInstMessage = "就绪任务未创建指令原因->取货位-分切输送线出口:" + siemensConveyorDeviceDriver.getDevice_code() + "光电无货,无法生成指令!"; notCreateInstMessage = "就绪任务未创建指令原因->取货位-分切输送线出口:" + siemensConveyorDeviceDriver.getDevice_code() + "光电无货,无法生成指令!";
return false; return false;
} }
} else if (nextdevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextdevice.getDeviceDriver();
if (siemensConveyorDeviceDriver.getMove() != 1) {
notCreateInstMessage = "就绪任务未创建指令原因->放货位-分切输送线出口:" + siemensConveyorDeviceDriver.getDevice_code() + "光电无货,无法生成指令!";
return false;
}
} }
String taskid = task.getTask_id(); String taskid = task.getTask_id();
@@ -1028,25 +1027,15 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
String next_addr = nextDevice.getExtraValue().get("address").toString(); String next_addr = nextDevice.getExtraValue().get("address").toString();
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code() + instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code()+ "指令号:" + instdto.getInstruction_code()+ + ",指令终点:" + instdto.getNext_device_code() + "指令号:" + instdto.getInstruction_code() +
"行架任务类型: "+ task.getTruss_type() + "起点:"+ start_addr + "终点"+ next_addr); "行架任务类型: " + task.getTruss_type() + "起点:" + start_addr + "终点" + next_addr);
/*Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "1");
map.put("to_task_type", task.getTruss_type());
map.put("to_onset", start_addr);
map.put("to_task", instdto.getInstruction_code());
map.put("to_target", next_addr);
if (!StrUtil.isEmpty(task.getVersion())) {
map.put("inflatableShaftVersion", task.getVersion());
}*/
List list = new ArrayList(); List list = new ArrayList();
writing(list,"to_command","1"); writing(list, "to_command", "1");
writing(list,"to_task_type",task.getTruss_type()); writing(list, "to_task_type", task.getTruss_type());
writing(list,"to_onset",start_addr); writing(list, "to_onset", start_addr);
writing(list,"to_task",instdto.getInstruction_code()); writing(list, "to_task", instdto.getInstruction_code());
writing(list,"to_target",next_addr); writing(list, "to_target", next_addr);
writing(list,"inflatableShaftVersion",StrUtil.isEmpty(task.getVersion()) ? "0" : task.getVersion()); writing(list, "inflatableShaftVersion", StrUtil.isEmpty(task.getVersion()) ? "0" : task.getVersion());
try { try {
this.writing(list); this.writing(list);
} catch (Exception e) { } catch (Exception e) {
@@ -1065,7 +1054,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
} }
} }
public void writing(List list,String writingName,String writeValue) { public void writing(List list, String writingName, String writeValue) {
Map map = new HashMap(); Map map = new HashMap();
map.put("code", writingName); map.put("code", writingName);
map.put("value", writeValue); map.put("value", writeValue);
@@ -1132,4 +1121,20 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
} }
return false; return false;
} }
private Boolean verifyRgv(Device deviceCode) {
RgvDeviceDriver rgvDeviceDriver;
if (deviceCode.getDeviceDriver() instanceof RgvDeviceDriver) {
rgvDeviceDriver = (RgvDeviceDriver) deviceCode.getDeviceDriver();
if (rgvDeviceDriver.getMode() == 2 && rgvDeviceDriver.getMove1() == 1 && rgvDeviceDriver.getMove2() == 0) {
return true;
} else {
notCreateInstMessage = "rgv信号不符合";
}
} else {
notCreateInstMessage = "rgv不是普通站点";
}
return false;
}
} }

View File

@@ -134,6 +134,12 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command); logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
} }
if(to_command == 1 && move1 == 1){
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "0");
this.writing(map);
}
} catch (Exception var17) { } catch (Exception var17) {
var17.printStackTrace(); var17.printStackTrace();

View File

@@ -1279,7 +1279,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
vehicle_code = inst.getVehicle_code(); vehicle_code = inst.getVehicle_code();
inst.setExecute_device_code(this.device_code); inst.setExecute_device_code(this.device_code);
if (mode == 2 || mode == 0) { if (mode == 2 || mode == 8) {
finish_instruction(); finish_instruction();
} }
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task + ",载具号:" + inst.getVehicle_code()); logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task + ",载具号:" + inst.getVehicle_code());

View File

@@ -736,6 +736,12 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} else if (backGetIndex != -1) { } else if (backGetIndex != -1) {
//后工位 //后工位
type = "2"; type = "2";
if(startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver && nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver){
boolean head_point = Boolean.parseBoolean(startDevice.getExtraValue().get("back_point").toString());
if(head_point){
type = "4"; //后工位
}
}
} }
this.isSetAddress(startDevice); this.isSetAddress(startDevice);
this.isSetAddress(nextDevice); this.isSetAddress(nextDevice);
@@ -749,7 +755,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
if (StrUtil.equals(type, "1")) { if (StrUtil.equals(type, "1")) {
this.setNow_steps_type1(1); this.setNow_steps_type1(1);
} }
if (StrUtil.equals(type, "2")) { if (StrUtil.equals(type, "2") || StrUtil.equals(type, "4")) {
this.setNow_steps_type2(1); this.setNow_steps_type2(1);
} }
if (StrUtil.equals(type, "3")) { if (StrUtil.equals(type, "3")) {
@@ -807,7 +813,14 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
type = "1"; //前工位 type = "1"; //前工位
} else if (backGetIndex != -1) { } else if (backGetIndex != -1) {
type = "2"; //后工位 type = "2"; //后工位
if(startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver && nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver){
/*boolean head_point = Boolean.parseBoolean(startDevice.getExtraValue().get("back_point").toString());
if(head_point){*/
type = "4"; //后工位
/*}*/
} }
}
logServer.deviceExecuteLog(this.getDeviceCode(), "", "", "" + logServer.deviceExecuteLog(this.getDeviceCode(), "", "", "" +
"执行就绪状态下的任务生成指令时:起点1为:" + start_device_code + "起点2为:" + start_device_code2 "执行就绪状态下的任务生成指令时:起点1为:" + start_device_code + "起点2为:" + start_device_code2
+ "type值为:" + type + ",任务信息为:" + taskDto.toString()); + "type值为:" + type + ",任务信息为:" + taskDto.toString());
@@ -995,6 +1008,35 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发双工位任务"); logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发双工位任务");
this.setNow_steps_type3(2); this.setNow_steps_type3(2);
} else if (StrUtil.equals(type, "4")) {
Map map1 = new HashMap();
map1.put("code", "to_onset2");
map1.put("value", start_addr);
list.add(map1);
Map map2 = new HashMap();
map2.put("code", "to_target2");
map2.put("value", next_addr);
list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_task2");
map3.put("value", dto.getInstruction_code());
list.add(map3);
Map map4 = new HashMap();
map4.put("code", "to_type");
map4.put("value", "4");
list.add(map4);
Map map5 = new HashMap();
map5.put("code", "to_command2");
map5.put("value", "1");
list.add(map5);
HashMap map6 = new HashMap() {{
put("code", "to_command1");
put("value", "0");
}};
list.add(map6);
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发后工位任务");
this.setNow_steps_type2(2);
} }
if (task1 != Integer.parseInt(dto.getInstruction_code()) || task2 != Integer.parseInt(dto.getInstruction_code())) { if (task1 != Integer.parseInt(dto.getInstruction_code()) || task2 != Integer.parseInt(dto.getInstruction_code())) {
@@ -1346,7 +1388,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
//单任务 后工位任务更新指令状态 //单任务 后工位任务更新指令状态
if (task2 > 0 && type == 2) { if (task2 > 0 && (type == 2 || type == 4)) {
//inst_message //inst_message
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2)); Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
if (inst2 != null) { if (inst2 != null) {
@@ -1554,7 +1596,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
//单任务 后工位放货完成 任务完成 //单任务 后工位放货完成 任务完成
if (mode == 3 && action2 == 4 && move2 == 0 && task2 > 0 && type == 2) { if (mode == 3 && action2 == 4 && move2 == 0 && task2 > 0 && (type == 2 || type == 4)) {
//inst_message //inst_message
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2)); Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
if (inst2 != null) { if (inst2 != null) {

View File

@@ -3,6 +3,7 @@ package org.nl.acs.ext.wms.rest;
import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@@ -154,7 +155,8 @@ public class WmsToAcsController {
@PostMapping("/queryRGVStatus") @PostMapping("/queryRGVStatus")
@Log(value = "WMS查询RGV状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @Log(value = "WMS查询RGV状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
@SaIgnore @SaIgnore
public ResponseEntity<Object> queryRGVStatus(@RequestBody JSONObject jsonObject){ public ResponseEntity<Object> queryRGVStatus(@RequestBody JSONArray jsonArray){
JSONObject jsonObject = jsonArray.getJSONObject(0);
return new ResponseEntity<>(wmstoacsService.queryRGVStatus(jsonObject),HttpStatus.OK); return new ResponseEntity<>(wmstoacsService.queryRGVStatus(jsonObject),HttpStatus.OK);
} }
} }

View File

@@ -211,6 +211,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
PluggingUnpluggingMachineDeviceDriver pluggingUnpluggingMachineDeviceDriver; PluggingUnpluggingMachineDeviceDriver pluggingUnpluggingMachineDeviceDriver;
SiemensWeightConveyorDeviceDriver siemensWeightConveyorDeviceDriver; SiemensWeightConveyorDeviceDriver siemensWeightConveyorDeviceDriver;
RgvDeviceDriver rgvDeviceDriver;
if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
hongXiangStationDeviceDriver.writing(code, value); hongXiangStationDeviceDriver.writing(code, value);
@@ -231,7 +232,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
siemensWeightConveyorDeviceDriver = (SiemensWeightConveyorDeviceDriver) device.getDeviceDriver(); siemensWeightConveyorDeviceDriver = (SiemensWeightConveyorDeviceDriver) device.getDeviceDriver();
siemensWeightConveyorDeviceDriver.writing(code, value); siemensWeightConveyorDeviceDriver.writing(code, value);
} }
if (device.getDeviceDriver() instanceof RgvDeviceDriver) {
rgvDeviceDriver = (RgvDeviceDriver) device.getDeviceDriver();
if (rgvDeviceDriver.getMove1() != 1) {
rgvDeviceDriver.writing(code, value);
}
}
} }
response.setStatus(200); response.setStatus(200);
response.setMessage("success"); response.setMessage("success");

View File

@@ -339,5 +339,11 @@ public interface TaskService {
*/ */
Integer querySameDeviceReadyTask(String start_device,String next_device,String status); Integer querySameDeviceReadyTask(String start_device,String next_device,String status);
/**
* 根据任务类型查询执行中的任务
* @param taskType 任务类型
* @return 任务
*/
List<TaskDto> queryTaskByTaskType(String taskType,String taskStatus);
} }

View File

@@ -1535,6 +1535,19 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
return num; return num;
} }
@Override
public List<TaskDto> queryTaskByTaskType(String taskType,String taskStatus) {
List<TaskDto> taskDtoList = new ArrayList<>();
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto taskDto = iterator.next();
if(taskDto.getTask_type().equals(taskType) && taskStatus.equals(taskDto.getTask_status())){
taskDtoList.add(taskDto);
}
}
return taskDtoList;
}
@Override @Override
public Integer querySameTaskByType(String taskType) { public Integer querySameTaskByType(String taskType) {

View File

@@ -31,7 +31,7 @@ import java.sql.Timestamp;
@Entity @Entity
@Getter @Getter
@Setter @Setter
@Table(name = "sys_log") @Table(name = "sys_log_1")
@NoArgsConstructor @NoArgsConstructor
public class Log implements Serializable { public class Log implements Serializable {

View File

@@ -34,6 +34,6 @@ public interface LogRepository extends JpaRepository<Log,Long>, JpaSpecification
* @param logType 日志类型 * @param logType 日志类型
*/ */
@Modifying @Modifying
@Query(value = "delete from sys_log where log_type = ?1", nativeQuery = true) @Query(value = "delete from sys_log_1 where log_type = ?1", nativeQuery = true)
void deleteByLogType(String logType); void deleteByLogType(String logType);
} }

View File

@@ -106,7 +106,7 @@
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:key="item.device_code" :key="item.device_code"
:label="item.device_name" :label="item.device_code"
:value="item.device_code" :value="item.device_code"
/> />
</el-select> </el-select>
@@ -147,7 +147,8 @@
> >
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:label="item.device_name" :key="item.device_code"
:label="item.device_code"
:value="item.device_code" :value="item.device_code"
/> />
</el-select> </el-select>
@@ -165,7 +166,7 @@
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:key="item.device_code" :key="item.device_code"
:label="item.device_name" :label="item.device_code"
:value="item.device_code" :value="item.device_code"
/> />
</el-select> </el-select>
@@ -184,7 +185,8 @@
> >
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:label="item.device_name" :key="item.device_code"
:label="item.device_code"
:value="item.device_code" :value="item.device_code"
/> />
</el-select> </el-select>
@@ -202,7 +204,7 @@
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:key="item.device_code" :key="item.device_code"
:label="item.device_name" :label="item.device_code"
:value="item.device_code" :value="item.device_code"
/> />
</el-select> </el-select>
@@ -222,7 +224,8 @@
> >
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:label="item.device_name" :key="item.device_code"
:label="item.device_code"
:value="item.device_code" :value="item.device_code"
/> />
</el-select> </el-select>
@@ -240,7 +243,7 @@
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:key="item.device_code" :key="item.device_code"
:label="item.device_name" :label="item.device_code"
:value="item.device_code" :value="item.device_code"
/> />
</el-select> </el-select>
@@ -259,7 +262,8 @@
> >
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:label="item.device_name" :key="item.device_code"
:label="item.device_code"
:value="item.device_code" :value="item.device_code"
/> />
</el-select> </el-select>
@@ -277,7 +281,7 @@
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:key="item.device_code" :key="item.device_code"
:label="item.device_name" :label="item.device_code"
:value="item.device_code" :value="item.device_code"
/> />
</el-select> </el-select>

View File

@@ -74,10 +74,15 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="是否开启等待" label-width="150px"> <el-form-item label="是否开启等待" label-width="80px">
<el-switch v-model="form.wait" /> <el-switch v-model="form.wait" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="后工位" label-width="150px">
<el-switch v-model="form.back_point" />
</el-form-item>
</el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">

View File

@@ -180,13 +180,16 @@ public class DeviceController {
} }
@PostMapping({"/testRead"}) @PostMapping({"/testRead"})
@Log("读信号")
public ResponseEntity<Object> testRead(@RequestBody Map map) { public ResponseEntity<Object> testRead(@RequestBody Map map) {
return new ResponseEntity(deviceService.testRead(map), HttpStatus.OK); return new ResponseEntity(deviceService.testRead(map), HttpStatus.OK);
} }
@PostMapping({"/testWrite"}) @PostMapping({"/testWrite"})
@Log("写信号")
public ResponseEntity<Object> testWrite(@RequestBody Map map) { public ResponseEntity<Object> testWrite(@RequestBody Map map) {
deviceService.testWrite(map); deviceService.testWrite(map);
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);

View File

@@ -522,7 +522,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
.device_code(device_code) .device_code(device_code)
.content("下发多个电气信号" + itemMap) .content("下发多个电气信号" + itemMap)
.build(); .build();
logDto.setLog_level(2); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try { try {

View File

@@ -292,6 +292,10 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
private void creatAGV(Integer actionType, int toCommand) { private void creatAGV(Integer actionType, int toCommand) {
Instruction instruction = checkInst(); Instruction instruction = checkInst();
if(ObjectUtil.isEmpty(instruction)){
log.info("指令不存在");
return;
}
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("taskCode", instruction.getTask_code()); param.put("taskCode", instruction.getTask_code());
param.put("actionType",actionType ); param.put("actionType",actionType );
@@ -636,6 +640,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
.device_code(device_code) .device_code(device_code)
.content("下发多个电气信号" + itemMap) .content("下发多个电气信号" + itemMap)
.build(); .build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try { try {

View File

@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
/** /**
@@ -37,7 +38,8 @@ public class WmsToAcsController {
@PostMapping("/task") @PostMapping("/task")
@Log(value = "ACS接收WMS任务") @Log(value = "ACS接收WMS任务")
@SaIgnore @SaIgnore
public ResponseEntity<Object> createFromWms(@RequestBody String whereJson) { public ResponseEntity<Object> createFromWms(@RequestBody String whereJson, HttpServletRequest request) {
log.info("wms下发任务的ip:{},端口号:{},地址:{}", request.getRemoteAddr(),request.getRemotePort(),request.getRemoteHost());
return new ResponseEntity<>(wmstoacsService.crateTask(whereJson), HttpStatus.OK); return new ResponseEntity<>(wmstoacsService.crateTask(whereJson), HttpStatus.OK);
} }

View File

@@ -1,11 +1,16 @@
/*
package org.nl.config; package org.nl.config;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.yomahub.tlog.id.TLogIdGenerator; import com.yomahub.tlog.id.TLogIdGenerator;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class TlogIdGenerator extends TLogIdGenerator { public class TlogIdGenerator extends TLogIdGenerator {
@Override @Override
public String generateTraceId() { public String generateTraceId() {
log.info("TlogIdGenerator generateTraceId");
return IdUtil.getSnowflake(1, 1).nextIdStr(); return IdUtil.getSnowflake(1, 1).nextIdStr();
} }
} }
*/

View File

@@ -118,12 +118,23 @@ public class AutoCreateInst {
String[] str = path.split("->"); String[] str = path.split("->");
List<String> pathlist = Arrays.asList(str); List<String> pathlist = Arrays.asList(str);
int index = 0; int index = 0;
boolean flag = false;
for (int m = 0; m < pathlist.size(); m++) { for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(start_device_code)) { if (pathlist.get(m).equals(start_device_code)) {
if("1".equals(acsTask.getTask_type()) && !pathlist.get(m+1).equals(next_device_code)){
flag = true;
break;
}
index = m + 1; index = m + 1;
break; break;
} }
} }
if (flag) {
acsTask.setRemark("路由不通无法生成指令");
taskserver.update(acsTask);
taskserver.updateByCodeFromCache(acsTask);
continue;
}
next_device_code = pathlist.get(index); next_device_code = pathlist.get(index);
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
@@ -215,6 +226,7 @@ public class AutoCreateInst {
//创建指令后修改任务状态 //创建指令后修改任务状态
acsTask.setTask_status(TaskStatusEnum.BUSY.getIndex()); acsTask.setTask_status(TaskStatusEnum.BUSY.getIndex());
acsTask.setUpdate_time(DateUtil.now()); acsTask.setUpdate_time(DateUtil.now());
acsTask.setRemark(" ");
taskserver.update(acsTask); taskserver.update(acsTask);
} }