This commit is contained in:
USER-20220102CG\noblelift
2024-04-17 10:39:23 +08:00
34 changed files with 983 additions and 175 deletions

View File

@@ -1,6 +1,7 @@
package org.nl.acs.agv.server;
import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.instruction.domain.InstructionMybatis;
import java.util.Map;

View File

@@ -24,6 +24,9 @@ import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.Manipulator
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
@@ -57,6 +60,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
TwoAgvPhase twoAgvPhase = new TwoAgvPhase();
@@ -70,6 +74,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
int phase = 0;
int region = 0;
int error = 0;
int last_error = 0;
private Instruction instruction;
String message = null;
int x = 0; //x坐标
@@ -218,10 +223,27 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("wait"))
&& StrUtil.equals("true", device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
String task_code = standardOrdinarySiteDeviceDriver.getTask_code();
log.info("当前任务号{},创建任务号{}", task.getTask_code(), task_code);
if (StrUtil.isEmpty(task_code) || !task_code.equals(task.getTask_code())) {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{},任务号{}", device_code, ikey, task.getTask_code());
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}else {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{}", device_code, ikey);
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey);
}
}else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
@@ -340,10 +362,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get("wait"))
&& StrUtil.equals("true", this.device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
standardOrdinarySiteDeviceDriver.setOption(0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
@@ -455,10 +482,30 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (StrUtil.equals(agv_inst_type, CommonFinalParam.ONE) || StrUtil.equals(agv_inst_type, "3")) {
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
standardOrdinarySiteDeviceDriver.setAgvphase(0);
String task_code = standardOrdinarySiteDeviceDriver.getTask_code();
log.info("当前任务号{},创建任务号{}", task.getTask_code(), task_code);
if (StrUtil.isEmpty(task_code) || !task_code.equals(task.getTask_code())) {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{},任务号{}", device_code, ikey, task.getTask_code());
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{}", device_code, ikey);
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code());
}
}else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
@@ -568,6 +615,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (StrUtil.equals(agv_inst_type, CommonFinalParam.ONE) || StrUtil.equals(agv_inst_type, "3")) {
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
standardOrdinarySiteDeviceDriver.setOption(0);
}else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
@@ -651,6 +705,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
weight = agvaddr;
inst.setWeight(String.valueOf(weight));
instructionService.update(inst);
if (ObjectUtil.isNotEmpty(task)) {
logServer.deviceExecuteLog(this.device_code, "", "", "上报满卷重量,weight:" + weight);
message = "上报满卷重量,weight:" + weight + ",指令号:" + ikey;
task.setWeight(String.valueOf(weight));
task.setCarno(this.device_code);
taskService.update(task);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
@@ -817,9 +879,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
@@ -929,9 +989,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
@@ -1037,9 +1095,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
@@ -1130,32 +1186,10 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
last_status = status;
} //进入区域phase值
else if (phase == 0x50) {
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
region = agvaddr;
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
//离开区域phase值
else if (phase == 0x51) {
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
region = agvaddr;
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
//上报异常信息
@@ -1170,11 +1204,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
String info = error.get("info");
this.setErrorInfo(ikey, code, info);
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
if (error != last_error) {
DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(this.getDevice().getDevice_code());
dto.setError_code(String.valueOf(error_code));
dto.setError_info(error_message);
deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", error == 0 ? "" : this.getError_message());
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "4");
param.put("product_area", ISysParamService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
last_error = error;
}
if (!ObjectUtil.isEmpty(data)) {
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -1183,11 +1229,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
// if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
TwoNDCSocketConnectionAutoRun.write(data);
// TwoNDCSocketConnectionAutoRun.write(data);
// }
// else if (StrUtil.equals(inst.getAgv_system_type(), "3")) {
// TwoNDC2SocketConnectionAutoRun.write(data);
// }
if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
TwoNDCSocketConnectionAutoRun.write(data);
}
}
}

View File

@@ -39,6 +39,8 @@ import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
@@ -77,6 +79,9 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
@Autowired
StorageCellMapper storageCellMapper;
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
/**
* 当前指令
*/
@@ -561,7 +566,11 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
if (task != Integer.parseInt(inst.getInstruction_code())) {
this.writing(list);
message = "重新下发电气信号";
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
message = "下发电气任务号成功";
requireSucess = true;
@@ -668,7 +677,11 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
if (task != Integer.parseInt(inst.getInstruction_code())) {
this.writing(list);
message = "重新下发电气信号";
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
//如果不存在则直接找对应指令
@@ -696,7 +709,11 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
this.writing(list);
if (task != Integer.parseInt(inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
requireSucess = true;
}

View File

@@ -38,6 +38,8 @@ import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
@@ -84,6 +86,9 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
@Autowired
StorageCellMapper storageCellMapper;
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
/**
* 当前指令
*/
@@ -689,7 +694,11 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
this.writing(list);
if (task != Integer.parseInt(inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
// 如果不存在则直接找对应指令
@@ -720,7 +729,11 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
this.writing(list);
if (task != Integer.parseInt(inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
return true;

View File

@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.conveyor.standard_ordinary_site;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -61,6 +62,9 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
Boolean iserror = false;
Boolean islock = false;
// 1 上位系统允许进入 2 上位系统允许离开
int option = 0;
int branchProtocol = 0;
int last_branchProtocol = 0;
/**
@@ -223,6 +227,14 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
String mode = "";
String action = "";
String move = "";
String option = "";
if(this.getOption() == 0){
option ="禁止进出";
} else if(this.getOption() == 1){
option ="允许进入";
} else if(this.getOption() == 2){
option ="允许离开";
}
if (this.getMode() == 0) {
mode = LangProcess.msg("universal_off-line");
} else if (this.getMode() == 1) {
@@ -252,13 +264,18 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
jo.put("isOnline", true);
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("option", option);
jo.put("is_click", true);
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
String flag = data.getString("option");
if(StrUtil.isNotEmpty(flag)){
option = Integer.parseInt(flag);
}
}
}

View File

@@ -391,7 +391,6 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
@@ -503,7 +502,11 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, instdto.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -542,7 +545,11 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
@@ -652,6 +659,11 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
itemMap.put(to_param, json.getString("value"));
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);

View File

@@ -35,6 +35,8 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.openscada.opc.lib.da.Server;
@@ -71,6 +73,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
//当前指令
Instruction inst = null;
@@ -355,6 +358,11 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
itemMap.put(to_param, json.getString("value"));
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);
@@ -400,7 +408,11 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
@@ -512,7 +524,11 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, instdto.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -551,7 +567,11 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(500);
} catch (InterruptedException e) {

View File

@@ -166,7 +166,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
String device_code;
@Override
public Device getDevice() {
return this.device;
@@ -273,36 +272,36 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
//
Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task));
if (StrUtil.isEmpty(inst.getVehicle_code())) {
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11");
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11");
return;
}
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("vehicle_code", inst.getVehicle_code());
param.put("type", AcsToLmsApplyTaskTypeEnum.LABEL_BIND.getType());
String response = acsToWmsService.deviceApplyTwo(param);
String response = acsToWmsService.deviceApplyTwo(param);
JSONObject jo = JSON.parseObject(response);
if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请捆扎,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请捆扎,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
// Map datas = applyLabelingAndBindingResponse.getData();
packagePLCData(jo.getString("data"));
requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请捆扎失败,接口返回:" + jo.getString("body"))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
packagePLCData(jo.getString("data"));
requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请捆扎失败,接口返回:" + jo.getString("body"))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
}
}
private void packagePLCData(String datas) {
JSONObject jo = JSON.parseObject(datas);
@@ -504,6 +503,11 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
itemMap.put(to_param, json.getString("value"));
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);
@@ -549,7 +553,11 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
@@ -661,7 +669,11 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, instdto.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -700,7 +712,11 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(500);
} catch (InterruptedException e) {

View File

@@ -558,7 +558,11 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, instdto.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -648,6 +652,11 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
itemMap.put(to_param, json.getString("value"));
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);

View File

@@ -38,6 +38,8 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.openscada.opc.lib.da.Server;
@@ -76,6 +78,9 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
//当前指令
Instruction inst = null;
@@ -495,7 +500,6 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
@@ -607,7 +611,11 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, instdto.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -646,7 +654,11 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
Thread.sleep(500);
} catch (InterruptedException e) {

View File

@@ -40,6 +40,8 @@ import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.*;
@@ -59,6 +61,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
//工作模式
int mode = 0;
@@ -425,7 +428,11 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code+"创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
}
//创建指令后修改任务状态
@@ -446,9 +453,11 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
try {
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9,map10);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString() + ",指令执行失败:" + e.getMessage());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code+"创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
this.setRequireSucess(true);
return true;
@@ -544,6 +553,11 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
itemMap.put(to_param, json.getString("value"));
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);

View File

@@ -374,8 +374,11 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
return false;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code+"创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto); return false;
}
//创建指令后修改任务状态
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
@@ -394,9 +397,11 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
try {
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8, map9);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString() + ",指令执行失败:" + e.getMessage());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code+"创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
this.setRequireSucess(true);
return true;
@@ -488,6 +493,11 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
itemMap.put(to_param, json.getString("value"));
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);

View File

@@ -43,6 +43,8 @@ import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.*;
@@ -70,6 +72,8 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
int mode = 0;
int last_mode = 0;
@@ -395,8 +399,11 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
return false;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code+"创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto); return false;
}
//创建指令后修改任务状态
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
@@ -415,9 +422,11 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
try {
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8, map9);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString() + ",指令执行失败:" + e.getMessage());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code+"创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
this.setRequireSucess(true);
return true;
@@ -505,6 +514,11 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
itemMap.put(to_param, json.getString("value"));
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);

View File

@@ -38,4 +38,9 @@ public class InteractionJsonDTO {
*/
private String isBinding;
/**
*木箱条码
*/
private String barcode;
}

View File

@@ -102,7 +102,10 @@ public class ItemProtocol {
*/
public static String item_to_is_binding = "to_is_binding";
/**
* 下发木箱条码
*/
public static String item_to_material = "to_material";
private TrappedManipulatorManipulatorDeviceDriver driver;
@@ -223,6 +226,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W14"));
list.add(new ItemDto(item_to_template, "堆叠模板", "DB601.W16"));
list.add(new ItemDto(item_to_is_binding, "下发是否捆轧", "DB601.D10"));
list.add(new ItemDto(item_to_material, "木箱条码", "DB601.D12"));
return list;
}

View File

@@ -1,7 +1,6 @@
package org.nl.acs.device_driver.one_manipulator.trapped_manipulator;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -17,9 +16,7 @@ import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.box_manipulator_site.BoxManipulatorSiteDeviceDriver;
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.history.ErrorUtil;
@@ -41,6 +38,8 @@ import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.*;
@@ -67,6 +66,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
int mode = 0;
@@ -339,8 +339,9 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
Map<String, Object> map8 = new HashMap<>();
Map<String, Object> map9 = new HashMap<>();
Map<String, Object> map10 = new HashMap<>();
Map<String, Object> map11 = new HashMap<>();
try {
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8, map9,map10);
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8, map9,map10,map11);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
@@ -391,8 +392,11 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
return false;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code+"创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto); return false;
}
//创建指令后修改任务状态
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
@@ -409,12 +413,15 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
Map<String, Object> map8 = new HashMap<>();
Map<String, Object> map9 = new HashMap<>();
Map<String, Object> map10 = new HashMap<>();
Map<String, Object> map11 = new HashMap<>();
try {
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8, map9,map10);
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8, map9,map10, map11);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString() + ",指令执行失败:" + e.getMessage());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code+"创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
this.setRequireSucess(true);
return true;
@@ -429,7 +436,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
private void pushPLC(Map<String, Object> map1, Map<String, Object> map2, String next_addr, Map<String, Object> map3, String start_addr, Map<String, Object> map4, String task, InteractionJsonDTO interactionJsonDTO, Map<String, Object> map5, Map<String, Object> map6, Map<String, Object> map7, Map<String, Object> map8, Map<String, Object> map9,Map<String, Object> map10) {
private void pushPLC(Map<String, Object> map1, Map<String, Object> map2, String next_addr, Map<String, Object> map3, String start_addr, Map<String, Object> map4, String task, InteractionJsonDTO interactionJsonDTO, Map<String, Object> map5, Map<String, Object> map6, Map<String, Object> map7, Map<String, Object> map8, Map<String, Object> map9, Map<String, Object> map10, Map<String, Object> map11) {
List list = new ArrayList();
map1.put("code", "to_command");
@@ -475,6 +482,11 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
map10.put("value", interactionJsonDTO.getIsBinding());
list.add(map10);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getIsBinding())) {
map10.put("code", "to_material");
map10.put("value", interactionJsonDTO.getBarcode());
list.add(map11);
}
}
this.writing(list);
@@ -521,6 +533,11 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
itemMap.put(to_param, json.getString("value"));
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);

View File

@@ -42,6 +42,8 @@ import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.*;
@@ -69,6 +71,8 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
int mode = 0;
int last_mode = 0;
@@ -294,16 +298,16 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
} else {
feedMessage = "universal_feedMessage5";
if (mode != 3) {
feedMessage = "universal_feedMessage1";
feedMessage = "universal_feedMessage1";
}
if (action != 8) {
feedMessage = "universal_feedMessage2";
feedMessage = "universal_feedMessage2";
}
if (move != 0) {
feedMessage = "universal_feedMessage3";
feedMessage = "universal_feedMessage3";
}
if (task == 0) {
feedMessage = "universal_feedMessage4";
feedMessage = "universal_feedMessage4";
}
}
}
@@ -357,16 +361,16 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
Map<String, Object> map7 = new HashMap<>();
try {
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), map5, map6,map7,taskDtoIns);
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), map5, map6, map7, taskDtoIns);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
+ ",指令终点:" + instruction.getNext_device_code() + ",指令执行失败:" + e.getMessage());
+ ",指令终点:" + instruction.getNext_device_code() + ",指令执行失败:" + e.getMessage());
}
this.setRequireSucess(true);
return true;
}
}else {
} else {
TaskDto taskDto = taskserver.findByStartCodeAndReady(startDeviceCode);
if (ObjectUtil.isNotEmpty(taskDto) && TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) {
String start_device_code = taskDto.getStart_device_code();
@@ -398,7 +402,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriverStar;
if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) {
manipulatorCacheDeviceDriverStar = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorCacheDeviceDriverStar.getMode() != 2 && manipulatorCacheDeviceDriverStar.getMode() !=1) {
if (manipulatorCacheDeviceDriverStar.getMode() != 2 && manipulatorCacheDeviceDriverStar.getMode() != 1) {
notCreateInstMessage = "universal_notCreateInstMessage3";
return false;
}
@@ -407,7 +411,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriverEnd;
if (nextDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) {
manipulatorCacheDeviceDriverEnd = (ManipulatorCacheDeviceDriver) nextDevice.getDeviceDriver();
if (manipulatorCacheDeviceDriverEnd.getMode() != 2 && manipulatorCacheDeviceDriverEnd.getMode() !=1) {
if (manipulatorCacheDeviceDriverEnd.getMode() != 2 && manipulatorCacheDeviceDriverEnd.getMode() != 1) {
notCreateInstMessage = "universal_notCreateInstMessage3";
return false;
}
@@ -420,12 +424,16 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
String next_point_code = taskDto.getNext_point_code();
String route_plan_code = taskDto.getRoute_plan_code();
Instruction instdto = new Instruction();
packageData(instdto, route_plan_code, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code,start_device_code2,next_device_code2);
packageData(instdto, route_plan_code, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, start_device_code2, next_device_code2);
try {
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + 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 + ",下发指令:"
@@ -444,7 +452,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
Map<String, Object> map6 = new HashMap<>();
Map<String, Object> map7 = new HashMap<>();
try {
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), map5, map6,map7,taskDto);
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), map5, map6, map7, taskDto);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
@@ -553,6 +561,11 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
itemMap.put(to_param, json.getString("value"));
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);

View File

@@ -318,7 +318,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
if (startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
/*if (startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
@@ -347,7 +347,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
return false;
}
}
}*/
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 1) {
@@ -459,7 +459,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
if (startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
/*if (startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
@@ -477,7 +477,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
if (ovenInspectSiteDeviceDriver.getMove() == 1 || standardInspectSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
"无货,无法下发指令或" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!" + "!任务号:" + task.getTask_code();
return false;
@@ -488,7 +488,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + task.getStart_device_code() + ",放货位:" + task.getNext_device_code() + ",存在关联的同一列烘箱设备未关门!任务号:" + task.getTask_code();
return false;
}
}
}*/
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 1) {
@@ -668,7 +668,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
//判断关联设备是否开门
if (hongXiangConveyorDeviceDriver.getDoor() == 1) {
if (hongXiangConveyorDeviceDriver.getDoor() != 2) {
notCreateInstMessage = "关联设备->" + device + "烘箱门未关闭!";
flag = false;
break;
@@ -707,7 +707,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver();
//判断关联设备是否开门
if (hongXiangConveyorDeviceDriver.getDoor() == 1 || hongXiangConveyorDeviceDriver.getError1() != 0
if (hongXiangConveyorDeviceDriver.getDoor() != 2 || hongXiangConveyorDeviceDriver.getError1() != 0
|| hongXiangConveyorDeviceDriver.getError() != 0) {
isClose = true;
notCreateInstMessage = start_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!";
@@ -733,7 +733,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver();
//判断关联设备是否开门
if (hongXiangConveyorDeviceDriver.getDoor() == 1 || hongXiangConveyorDeviceDriver.getError1() != 0
if (hongXiangConveyorDeviceDriver.getDoor() != 2 || hongXiangConveyorDeviceDriver.getError1() != 0
|| hongXiangConveyorDeviceDriver.getError() != 0) {
isClose = true;
notCreateInstMessage = next_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!";
@@ -1125,7 +1125,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
jo.put("message", message);
jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage", notCreateInstMessage);
jo.put("feedMessage", LangProcess.msg(feedMessage));
jo.put("feedMessage", feedMessage);
jo.put("driver_type", "siemens_conveyor");
jo.put("is_click", true);
jo.put("x", x_position);

View File

@@ -308,17 +308,30 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
String number = data.get("number");
String leftSize = data.get("left_size");
String rightSize = data.get("right_size");
//套管1物料
String to_material1 = data.get("left");
//套管2物料
String to_material2 = data.get("right");
//套管1规格
String to_spec1 = data.get("leftSpec");
//套管2规格
String to_spec2 = data.get("rightSpec");
Map<String, Object> map = new LinkedHashMap<>();
//下发纸管信息
//todo:纸管规格待定
map.put("to_material1", material1);
map.put("to_material2", material2);
map.put("to_material1", to_material1);
map.put("to_material2", to_material2);
if (StrUtil.isNotEmpty(leftSize)){
map.put("to_size1", leftSize);
}
if (StrUtil.isNotEmpty(rightSize)){
map.put("to_size2", rightSize);
}
map.put("to_spec1", to_spec1);
if (ObjectUtil.isNotEmpty(to_spec2)) {
map.put("to_spec2", to_spec2);
}
map.put("to_command", mode);
map.put("to_qty1", number);
this.writing(map);
@@ -406,11 +419,33 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
Map<String, String> data = applyPlugPullSitResponse.getData();
String leftSize = data.get("left_size");
String rightSzie = data.get("right_szie");
//拔管1物料
Object to_material3 = data.get("currentLeft");
//拔管2物料
Object to_material4 = data.get("currentRight");
//拔管1尺寸
Object to_size3 = data.get("currentLeftSize");
//拔管2尺寸
Object to_size4 = data.get("currentRightSize");
//拔管1规格
Object to_spec3 = data.get("currentLeftSpec");
//拔管2规格
Object to_spec4 = data.get("currentRightSpec");
Object to_qty2 = data.get("pullCount");
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_size3", leftSize);
map.put("to_size4", rightSzie);
map.put("to_material3", to_material3);
if (ObjectUtil.isNotEmpty(to_material4)) {
map.put("to_material4", to_material4);
}
map.put("to_size3", to_size3);
if (ObjectUtil.isNotEmpty(to_size4)) {
map.put("to_size4", to_size4);
}
map.put("to_spec3", to_spec3);
if (ObjectUtil.isNotEmpty(to_spec4)) {
map.put("to_spec4", to_spec4);
}
map.put("to_qty2", to_qty2);
map.put("to_qzz_type", size);
map.put("to_command", mode);
this.writing(map);

View File

@@ -360,29 +360,66 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
String nextAddr = nextDevice.getExtraValue().get("address").toString();
String interaction_json = taskDto.getInteraction_json();
JSONObject jsonObject = JSONObject.parseObject(interaction_json);
//所需纸管信息(左边)
Object left = jsonObject.get("left");
//所需纸管信息(右边)
Object right = jsonObject.get("right");
//当前纸管信息(左边)
Object currentLeft = jsonObject.get("currentLeft");
//当前纸管信息(右边)
Object currentRight = jsonObject.get("currentRight");
//套管1物料
Object to_material1 = jsonObject.get("left");
//套管2物料
Object to_material2 = jsonObject.get("right");
//套管1规格
Object to_spec1 = jsonObject.get("leftSpec");
//套管2规格
Object to_spec2 = jsonObject.get("rightSpec");
//套管1尺寸
Object to_size1 = jsonObject.get("leftSize");
//套管2尺寸
Object to_size2 = jsonObject.get("rightSize");
//拔管1物料
Object to_material3 = jsonObject.get("currentLeft");
//拔管2物料
Object to_material4 = jsonObject.get("currentRight");
//拔管1尺寸
Object to_size3 = jsonObject.get("currentLeftSize");
//拔管2尺寸
Object to_size4 = jsonObject.get("currentRightSize");
//拔管1规格
Object to_spec3 = jsonObject.get("currentLeftSpec");
//拔管2规格
Object to_spec4 = jsonObject.get("currentRightSpec");
//套管数量
Object casingCount = jsonObject.get("casingCount");
Object to_qty1 = jsonObject.get("casingCount");
//拔管数量
Object pullCount = jsonObject.get("pullCount");
Object to_qty2 = jsonObject.get("pullCount");
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", CommonFinalParam.ONE);
map.put("to_onset", startAddr);
map.put("to_task", instruction.getInstruction_code());
map.put("to_target", nextAddr);
map.put("left", left);
map.put("right", right);
map.put("currentLeft", currentLeft);
map.put("currentRight", currentRight);
map.put("casingCount", casingCount);
map.put("pullCount", pullCount);
map.put("to_material1", to_material1);
if (ObjectUtil.isNotEmpty(to_material2)) {
map.put("to_material2", to_material2);
}
map.put("to_spec1", to_spec1);
if (ObjectUtil.isNotEmpty(to_spec2)) {
map.put("to_spec2", to_spec2);
}
map.put("to_size1", to_size1);
if (ObjectUtil.isNotEmpty(to_size2)) {
map.put("to_size2", to_size2);
}
map.put("to_material3", to_material3);
if (ObjectUtil.isNotEmpty(to_material4)) {
map.put("to_material4", to_material4);
}
map.put("to_size3", to_size3);
if (ObjectUtil.isNotEmpty(to_size4)) {
map.put("to_size4", to_size4);
}
map.put("to_spec3", to_spec3);
if (ObjectUtil.isNotEmpty(to_spec4)) {
map.put("to_spec4", to_spec4);
}
map.put("to_qty1", to_qty1);
map.put("to_qty2", to_qty2);
this.writing(map);
this.setRequireSucess(true);
return true;
@@ -433,8 +470,11 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
return false;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code+"创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto); return false;
}
//创建指令后修改任务状态
task.setTask_status(TaskStatusEnum.BUSY.getIndex());

View File

@@ -439,8 +439,11 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
return false;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code+"创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto); return false;
}
//创建指令后修改任务状态
task.setTask_status(TaskStatusEnum.BUSY.getIndex());

View File

@@ -54,6 +54,13 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK);
}
@PostMapping("/updateTask")
@Log(value = "WMS更新任务点位状态")
@SaIgnore
public ResponseEntity<Object> updateTask(@RequestBody String whereJson){
return new ResponseEntity<>(wmstoacsService.updateTask(whereJson), HttpStatus.OK);
}
@PostMapping("/areaControl")
@Log(value = "区域控制")
public ResponseEntity<Object> areaControl(@RequestBody JSONObject whereJson) {

View File

@@ -25,6 +25,14 @@ public interface WmsToAcsService {
*/
CreateTaskResponse crateTask(List<CreateTaskRequest> reqs);
/**
* 更新任务点位状态
*
* @param whereJson 条件
* @return Map<String, Object>
*/
Map<String, Object> updateTask(String whereJson);
/**
* 取消任务

View File

@@ -15,7 +15,9 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.BoxPackageManipulatorDeviceDriver;
import org.nl.acs.device_driver.conveyor.box_palletizing_manipulator.BoxPalletizingManipulatorDeviceDriver;
import org.nl.acs.device_driver.paper_tube_device2.PaperTubeConveyor2DeviceDriver;
@@ -34,6 +36,7 @@ import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.ext.wms.service.WmsToAcsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.storage_cell.domain.StorageCell;
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
@@ -68,6 +71,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Autowired
private LuceneExecuteLogService luceneExecuteLogService;
@Autowired
private InstructionService instructionService;
@Autowired
private AcsToLiKuService acsToLiKuService;
@@ -387,6 +393,74 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
return null;
}
@Override
public Map<String, Object> updateTask(String whereJson) {
JSONArray datas = JSONArray.parseArray(whereJson);
log.info("updateTask--------------:输入参数" + datas.toString());
JSONArray errArr = new JSONArray();
if (datas.size() > 0) {
for (int i = 0; i < datas.size(); i++) {
JSONObject jsonObject = datas.getJSONObject(i);
String device_code = jsonObject.getString("device_code");
String task_code = jsonObject.getString("task_code");
//1-允许取放; 2-允许离开
String option = jsonObject.getString("option");
Instruction inst = instructionService.findByTaskcode(task_code);
if (ObjectUtil.isEmpty(inst)) {
JSONObject jo = new JSONObject();
jo.put("task_code", task_code);
jo.put("message", "未找到对应任务");
errArr.add(jo);
continue;
} else {
String carNo = inst.getCarno();
if (ObjectUtil.isEmpty(carNo)) {
JSONObject jo = new JSONObject();
jo.put("task_code", task_code);
jo.put("message", "未找到任务对应车号");
errArr.add(jo);
continue;
} else {
Device device = deviceAppService.findDeviceByCode(carNo);
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
int phase = agvNdcTwoDeviceDriver.getPhase();
if (phase == 0x03 || phase == 0x05 || phase == 0x08) {
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
Device deviceByCode = deviceAppService.findDeviceByCode(device_code);
if (deviceByCode.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) deviceByCode.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
standardOrdinarySiteDeviceDriver.setTask_code(task_code);
}
} else {
JSONObject jo = new JSONObject();
jo.put("task_code", task_code);
jo.put("message", "AGV未就绪无法设置");
errArr.add(jo);
continue;
}
}
}
}
}
}
JSONObject resultJson = new JSONObject();
if (ObjectUtil.isEmpty(errArr)) {
resultJson.put("status", HttpStatus.OK.value());
resultJson.put("message", "操作成功");
} else {
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "操作失败");
if (ObjectUtil.isNotEmpty(errArr)) {
resultJson.put("errArr", errArr);
}
}
return resultJson;
}
@Override
public org.nl.acs.ext.wms.data.one.CancelTaskResponse cancelFromWms(List<org.nl.acs.ext.wms.data.one.CancelTaskRequest> reqs) throws Exception {
return null;

View File

@@ -54,6 +54,11 @@ public class TaskDto implements Serializable {
*/
private String task_status;
/**
* 车号
*/
private String carno;
/**
* 复合任务
*/

View File

@@ -1007,6 +1007,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
map.put("路由方案编码", acsTask.getRoute_plan_code());
map.put("是否需要反馈上位系统", acsTask.getIs_needfeedback());
map.put("备注", acsTask.getRemark());
map.put("agv车号", acsTask.getCarno());
map.put("是否启用", acsTask.getIs_active());
map.put("是否删除", acsTask.getIs_delete());
map.put("创建者", acsTask.getCreate_by());
@@ -1588,6 +1589,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
feed_jo.put("task_id", entity.getExt_task_id());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());
if (ObjectUtil.isNotEmpty(entity.getWeight())) {
feed_jo.put("weight", entity.getWeight());
}
if (ObjectUtil.isNotEmpty(entity.getCarno())) {
feed_jo.put("car_no", entity.getCarno());
}
JSONArray ja = new JSONArray();
ja.add(feed_jo);
//TODO 有需要根据上位系统反馈的信息再做进一步处理

View File

@@ -0,0 +1,37 @@
package org.nl.hand.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Author : TuQiang
* @create 2024/4/15 13:59
*/
@Data
public class B2HeadDto implements Serializable {
/**
* 起始设备编码1
*/
private String start_device_code1;
/**
* 目标设备编码1
*/
private String next_device_code1;
/**
* 起始设备编码2
*/
private String start_device_code2;
/**
* 目标设备编码2
*/
private String next_device_code2;
/**
* 任务类型
*/
private String task_type;
}

View File

@@ -0,0 +1,26 @@
package org.nl.hand.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Author : TuQiang
* @create 2024/4/15 15:04
*/
@Data
public class HeadDeviceDto implements Serializable {
/**
* 设备号
*/
private String device_code;
/**
* 操作类型
* 0-禁止进出;
* 1-允许取放
* 2-允许离开
*
*/
private String option;
}

View File

@@ -0,0 +1,83 @@
package org.nl.hand.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.logging.annotation.Log;
import org.nl.hand.dto.B2HeadDto;
import org.nl.hand.dto.HeadDeviceDto;
import org.nl.hand.dto.RegionDto;
import org.nl.hand.service.B2HandService;
import org.nl.hand.service.HandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author : TuQiang
* @create 2024/4/15 13:50
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "手持接口")
@RequestMapping("api/hands")
@Slf4j
public class B2HandController {
@Autowired
private B2HandService b2HandService;
@Autowired
private HandService handService;
@PostMapping("/queryArea")
@Log("查询区域")
@ApiOperation("查询区域")
@SaIgnore
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> queryArea() {
return new ResponseEntity<>(handService.queryArea(), HttpStatus.OK);
}
@PostMapping("/queryPointByArea")
@Log("根据区域编码查点位")
@ApiOperation("根据区域编码查点位")
@SaIgnore
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> queryPointByArea(@RequestBody RegionDto dto) {
String region_code = dto.getRegion_code();
return new ResponseEntity<>(handService.queryPointByArea(region_code), HttpStatus.OK);
}
@PostMapping("/callTask")
@Log("手持创建任务")
@ApiOperation("手持创建任务")
@SaIgnore
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> callTask(@RequestBody B2HeadDto dto) {
return new ResponseEntity<>(b2HandService.callTask(dto), HttpStatus.OK);
}
@PostMapping("/queryDevices")
@Log("查询所有设备")
@ApiOperation("查询所有设备")
@SaIgnore
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> queryDevices() {
return new ResponseEntity<>(b2HandService.queryDevices(), HttpStatus.OK);
}
@PostMapping("/updateDeviceStatus")
@Log("更新设备状态")
@ApiOperation("更新设备状态")
@SaIgnore
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> updateDeviceStatus(@RequestBody HeadDeviceDto dto) {
return new ResponseEntity<>(b2HandService.updateDeviceStatus(dto), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,25 @@
package org.nl.hand.service;
import org.nl.hand.dto.B2HeadDto;
import org.nl.hand.dto.HeadDeviceDto;
import java.util.Map;
/**
* @Author : TuQiang
* @create 2024/4/15 13:52
*/
public interface B2HandService {
/**
* 手持创建任务
*
* @param dto
* @return
*/
Map<String, Object> callTask(B2HeadDto dto);
Map<String, Object> queryDevices();
Map<String, Object> updateDeviceStatus(HeadDeviceDto dto);
}

View File

@@ -0,0 +1,191 @@
package org.nl.hand.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
import org.nl.hand.dto.B2HeadDto;
import org.nl.hand.dto.HeadDeviceDto;
import org.nl.hand.service.B2HandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* @Author : TuQiang
* @create 2024/4/15 13:52
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class B2HandServiceImpl implements B2HandService {
@Autowired
private TaskService taskserver;
@Autowired
private DeviceService deviceService;
@Autowired
private DeviceAppService deviceAppService;
@Autowired
private InstructionService instructionService;
@Override
public Map<String, Object> callTask(B2HeadDto dto) {
JSONArray errArr = new JSONArray();
String start_device_code = dto.getStart_device_code1();
String next_device_code = dto.getNext_device_code1();
String start_device_code2 = dto.getStart_device_code2();
String next_device_code2 = dto.getNext_device_code2();
String task_type = dto.getTask_type();
if (StrUtil.isEmpty(start_device_code)) {
JSONObject json = new JSONObject();
json.put("message", "起点1不能为空");
errArr.add(json);
}
if (StrUtil.isEmpty(next_device_code)) {
JSONObject json = new JSONObject();
json.put("message", "终点1不能为空");
errArr.add(json);
}
if (StrUtil.isEmpty(task_type)) {
JSONObject json = new JSONObject();
json.put("message", "任务类型不能为空");
errArr.add(json);
}
JSONObject jo = new JSONObject();
if (StrUtil.equals(task_type, CommonFinalParam.TYPE_ONE)) {
jo.put("start_device_code2", start_device_code2);
jo.put("next_device_code2", next_device_code2);
jo.put("start_point_code2", start_device_code2);
jo.put("next_point_code2", next_device_code2);
} else if (StrUtil.equals(task_type, CommonFinalParam.TYPE_TWO)) {
jo.put("start_device_code2", start_device_code2);
jo.put("next_device_code2", next_device_code2);
jo.put("start_point_code2", start_device_code2);
jo.put("next_point_code2", next_device_code2);
}
jo.put("start_device_code", start_device_code);
jo.put("next_device_code", next_device_code);
jo.put("start_point_code", start_device_code);
jo.put("next_point_code", next_device_code);
jo.put("start_device_code2", start_device_code2);
jo.put("next_device_code2", next_device_code2);
jo.put("start_point_code2", start_device_code2);
jo.put("next_point_code2", next_device_code2);
jo.put("task_type", task_type);
jo.put("agv_system_type", "2");
jo.put("priority", "1");
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try {
taskserver.create(task_dto);
} catch (Exception e) {
// e.printStackTrace();
JSONObject json = new JSONObject();
json.put("message", e.getMessage());
errArr.add(json);
}
JSONArray data = new JSONArray();
JSONObject resultJson = new JSONObject();
if (ObjectUtil.isEmpty(errArr)) {
resultJson.put("message", "操作成功");
resultJson.put("data", data);
} else {
resultJson.put("message", "操作失败");
resultJson.put("data", data);
}
return resultJson;
}
@Override
public Map<String, Object> queryDevices() {
JSONArray data = new JSONArray();
//查询所有生箔区的设备
List<Device> list = deviceService.lambdaQuery()
.eq(Device::getRegion, "2")
.list();
if (CollectionUtil.isEmpty(list)) {
throw new BadRequestException("未查到该区域的设备!");
}
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
for (int i = 0; i < list.size(); i++) {
JSONObject jo = new JSONObject();
Device device = list.get(i);
String device_id = device.getDevice_id();
String device_code = device.getDevice_code();
Device deviceCode = deviceAppService.findDeviceByCode(device_code);
int option = 0;
if (deviceCode.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) deviceCode.getDeviceDriver();
option = standardOrdinarySiteDeviceDriver.getOption();
}
String device_name = device.getDevice_name();
BigDecimal seq_num = device.getSeq_num();
jo.put("device_id", device_id);
jo.put("device_code", device_code);
jo.put("device_name", device_name);
jo.put("seq_num", seq_num);
jo.put("option", option);
data.add(jo);
}
JSONObject resultJson = new JSONObject();
resultJson.put("message", "操作成功");
resultJson.put("data", data);
return resultJson;
}
@Override
public Map<String, Object> updateDeviceStatus(HeadDeviceDto dto) {
JSONArray errArr = new JSONArray();
String device_code = dto.getDevice_code();
String option = dto.getOption();
if (StrUtil.isEmpty(device_code)) {
JSONObject json = new JSONObject();
json.put("message", "设备号不能为空");
errArr.add(json);
}
if (StrUtil.isEmpty(option)) {
JSONObject json = new JSONObject();
json.put("message", "操作不能为空");
errArr.add(json);
}
if (device_code.contains("M")&&(!"1".equals(option))){
throw new BadRequestException("该设备为满轴位,不能进行该操作");
}
if (device_code.contains("K")&&(!"2".equals(option))){
throw new BadRequestException("该设备为空轴位,不能进行该操作");
}
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
Device device = deviceAppService.findDeviceByCode(device_code);
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
JSONArray data = new JSONArray();
JSONObject resultJson = new JSONObject();
if (ObjectUtil.isEmpty(errArr)) {
resultJson.put("message", "操作成功");
resultJson.put("data", data);
} else {
resultJson.put("message", "操作失败");
resultJson.put("data", data);
}
return resultJson;
}
}

View File

@@ -24,6 +24,8 @@ import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.domain.InstructionMybatis;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.InstructionDto;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.task.domain.Task;
import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.service.TaskService;
@@ -31,6 +33,7 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.dto.TaskIdAndStatusDTO;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
import org.nl.config.SpringContextHolder;
import org.nl.hand.dto.HeadDto;
import org.nl.hand.dto.HeadInstDto;
import org.nl.hand.dto.HeadTaskDto;
@@ -66,6 +69,8 @@ public class HandServiceImpl implements HandService {
private InstructionService instructionService;
@Autowired
NDCAgvService ndcAgvService;
@Autowired
DeviceAppService deviceAppService;
@@ -129,22 +134,42 @@ public class HandServiceImpl implements HandService {
String next_device_code2 = "";
JSONObject jo = new JSONObject();
if (StrUtil.equals(task_type, CommonFinalParam.TYPE_ONE)) {
String s = start_device_code.substring(9);
String s = start_device_code.substring(start_device_code.length() - 1);
if (StrUtil.equals("K", s)) {
start_device_code2 = next_device_code.substring(0, 10) + "M";
next_device_code2 = start_device_code.substring(0, 9) + "M";
start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "M";
next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "M";
jo.put("start_device_code2", start_device_code2);
jo.put("next_device_code2", next_device_code2);
jo.put("start_point_code2", start_device_code2);
jo.put("next_point_code2", next_device_code2);
}else{
throw new BadRequestException("起点设备名称不符");
}
} else if (StrUtil.equals(task_type, CommonFinalParam.TYPE_TWO)) {
start_device_code2 = next_device_code.substring(0, 9) + "K";
next_device_code2 = start_device_code.substring(0, 9) + "K";
jo.put("start_device_code2", start_device_code2);
jo.put("next_device_code2", next_device_code2);
jo.put("start_point_code2", start_device_code2);
jo.put("next_point_code2", next_device_code2);
String s = start_device_code.substring(start_device_code.length() - 1);
String n = next_device_code.substring(next_device_code.length() - 1);
if (StrUtil.equals("M", s) && StrUtil.equals("M", n)) {
start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "K";
next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "K";
jo.put("start_device_code2", start_device_code2);
jo.put("next_device_code2", next_device_code2);
jo.put("start_point_code2", start_device_code2);
jo.put("next_point_code2", next_device_code2);
}else if(StrUtil.equals("S", n) && StrUtil.equals("M", s)){
start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "X";
next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "K";
jo.put("start_device_code2", start_device_code2);
jo.put("next_device_code2", next_device_code2);
jo.put("start_point_code2", start_device_code2);
jo.put("next_point_code2", next_device_code2);
}else{
throw new BadRequestException("起点设备名称不符");
}
}
Device startDevice = deviceAppService.findDeviceByCode(start_device_code2);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code2);
if(StrUtil.isAllNotEmpty(start_device_code2,next_device_code2) && ObjectUtil.isAllEmpty(startDevice,nextDevice)){
throw new BadRequestException("起点终点设备不存在");
}
jo.put("start_device_code", start_device_code);
jo.put("next_device_code", next_device_code);
@@ -162,6 +187,7 @@ public class HandServiceImpl implements HandService {
JSONObject json = new JSONObject();
json.put("message", e.getMessage());
errArr.add(json);
throw new RuntimeException(e.getMessage());
}
JSONArray data = new JSONArray();
JSONObject resultJson = new JSONObject();