rev 请求标记复位

This commit is contained in:
2023-05-17 17:27:57 +08:00
parent a72caf0a31
commit f6abc2cd3e
23 changed files with 507 additions and 313 deletions

View File

@@ -29,6 +29,7 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import java.util.Collections;
import java.util.List;
/**
@@ -278,6 +279,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -311,10 +313,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
break;
}
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
break;
}
}
@@ -346,6 +350,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -377,10 +382,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
break;
}
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -395,6 +402,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
@@ -410,6 +418,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -440,10 +449,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
break;
}
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -458,6 +469,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
@@ -473,6 +485,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -486,10 +499,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
Collections.reverse(insts);
for (Instruction inst : insts) {
//校验agv上报站点编号与指令起始点相同
if (ObjectUtil.isEmpty(inst)) {
@@ -501,7 +516,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -515,10 +530,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
Collections.reverse(insts);
for (Instruction inst : insts) {
//校验agv上报站点编号与指令起始点相同
if (ObjectUtil.isEmpty(inst)) {
@@ -530,6 +547,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -543,21 +561,25 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
Collections.reverse(insts);
for (Instruction inst : insts) {
//校验agv上报站点编号与指令起始点相同
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到关联编号{}对应的指令", ikey);
break;
}
Collections.reverse(insts);
//只有满料位到缓存线才有到达取空框2
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -571,10 +593,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
Collections.reverse(insts);
for (Instruction inst : insts) {
//校验agv上报站点编号与指令起始点相同
if (ObjectUtil.isEmpty(inst)) {
@@ -586,6 +610,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -605,6 +630,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info(agvaddr + "对应设备号为空!");
return;
}
Collections.reverse(insts);
for (Instruction inst : insts) {
//校验agv上报站点编号与指令起始点相同
if (ObjectUtil.isEmpty(inst)) {
@@ -616,10 +642,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
break;
}
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
break;
}
}
}
@@ -712,6 +740,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info(agvaddr + "对应设备号为空!");
return;
}
Collections.reverse(insts);
for (Instruction inst : insts) {
//校验agv上报站点编号与指令起始点相同
if (ObjectUtil.isEmpty(inst)) {
@@ -747,6 +776,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info(agvaddr + "对应设备号为空!");
return;
}
Collections.reverse(insts);
for (Instruction inst : insts) {
//校验agv上报站点编号与指令起始点相同
if (ObjectUtil.isEmpty(inst)) {
@@ -775,6 +805,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
} else if (phase == 0x65) {//param,重量待定
// if (agvaddr == 0) {
// agvaddr = agvaddr_copy;
// }
if (agvaddr < 1) {
log.info("phase:" + phase + "--agv地址参数有误agvaddr=" + agvaddr);
return;
}
agvaddr = agvaddr_copy;
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
//1、得到重量信息
int weight = (arr[18] * 256 + arr[19]) * 10;
for (Instruction inst : insts) {

View File

@@ -92,8 +92,10 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
//准备位条码
int prepare_barcode = 0;
int last_prepare_barcode = 0;
//对接位条码
int docking_barcode = 0;
int last_docking_barcode = 0;
//提升机条码
int hoist_barcode = 0;
@@ -247,7 +249,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
+ "," + two_barcode6 + "," + two_barcode7 + "," + two_barcode8 + "," + two_barcode9 + "," + two_barcode10
+ "," + three_barcode1 + "," + three_barcode2 + "," + three_barcode3 + "," + three_barcode4 + "," + three_barcode5
+ "," + three_barcode6 + "," + three_barcode7 + "," + three_barcode8 + "," + three_barcode9 + "," + three_barcode10
+ "," + prepare_barcode + "," + docking_barcode;
+ "," + prepare_barcode + "," + prepare_barcode;
if (!StrUtil.equals(material_spec, last_material_spec)) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号material_spec" + last_material_spec + "->" + material_spec);
@@ -327,6 +329,12 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
if (task_type != last_task_type) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号task_type" + last_task_type + "->" + task_type);
}
if (prepare_barcode != last_prepare_barcode) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号prepare_barcode" + last_prepare_barcode + "->" + prepare_barcode);
}
if (docking_barcode != last_docking_barcode) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号docking_barcode" + last_docking_barcode + "->" + docking_barcode);
}
if (isonline != last_isonline) {
feedDeviceStatusFlag = false;
logServer.deviceExecuteLog(this.device_code, "", "", "信号isonline" + last_isonline + "->" + isonline);
@@ -383,10 +391,27 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
if (mode == 1 && prepare_ready == 1 && move == 0 && in_ready == 0 && task != 0 && prepare_barcode != 99999 && (agvphase == 0x0A || agvphase == 0x21)) {
this.writing("to_agv_put_ready", "1");
this.writing("to_agv_put_finish", "0");
}
if (mode == 1 && prepare_ready == 1 && move == 0 && task != 0 && prepare_barcode != 99999 && (agvphase == 0x0E || agvphase == 0x25 || agvphase == 0x03)) {
if (inst != null) {
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.setVehicle_code(String.valueOf(prepare_barcode));
taskserver.update(taskDto);
}
}
this.writing("to_prepare_docking", "1");
}
if (mode == 1 && move == 0 && in_ready == 0 && (agvphase == 0x13 || agvphase == 0x17)) {
//送回空箱时到达点位判断缓存线是否有其他任务,有其他任务就让缓存线停止转洞
if (task > 0 && task != Integer.parseInt(inst.getInstruction_code())) {
this.writing("to_pause_out_check", "1");
}
this.writing("to_agv_put_ready", "1");
}
} catch (Exception var17) {
var17.printStackTrace();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17 + ",inst == null :" + ObjectUtil.isEmpty(inst));
@@ -416,10 +441,10 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
instructionService.update(inst);
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null);
noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
this.set(0, 0, null);
} else {
//如果上述条件不满足 先判断当前缓存线任务号是否为0
//如果为0 且agv上报的指令信息存在需要下发缓存线对应的任务信息
@@ -452,16 +477,16 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
} else if (agvphase == 0x0C || agvphase == 0x23) {
//agv送满框1完毕或送满框2完毕
//需要判断缓存线工作模式联机对接位有货任务号不为0对接位条码正常才反馈agv以及电气放货完成
if (mode == 1 && move == 1 && task != 0 && docking_barcode != 99999 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
if (mode == 1 && move == 1 && task != 0 && prepare_barcode != 99999 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
this.writing("to_agv_put_finish", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_FALL_SEND_FULL_FINISH.getCode());
instructionService.update(inst);
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null);
noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
this.set(0, 0, null);
} else {
String noFeedMessage = this.noFeedMessage();
if (move != 1) {
@@ -480,21 +505,16 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
}
} else if (agvphase == 0x0E || agvphase == 0x25) {
//agv到达取空框1或取空框2
if (mode == 1 && move == 1 && prepare_ready == 1 && task != 0 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task && docking_barcode != 99999) {
if (mode == 1 && move == 1 && out_ready == 1 && task != 0 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task && prepare_barcode != 99999) {
this.writing("to_agv_get_ready", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET_EMPTY.getCode());
instructionService.update(inst);
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.setVehicle_code(String.valueOf(docking_barcode));
taskserver.update(taskDto);
}
this.set(0, 0, null);
noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
this.set(0, 0, null);
} else {
String noFeedMessage = this.noFeedMessage();
if (move != 1) {
@@ -503,23 +523,23 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
if (prepare_ready != 1) {
noFeedMessage += "准备位未就绪,";
}
if (docking_barcode == 99999) {
if (prepare_barcode == 99999) {
noFeedMessage += "对接位条码异常,";
}
this.noFeedAgvMessage = this.replace(noFeedMessage);
}
} else if (agvphase == 0x10 || agvphase == 0x27) {
//agv取空框1完毕或取空框2完毕
if (mode == 1 && move == 0 && task != 0 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
//this.writing("to_agv_get_finish", "1");
if (mode == 1 && move == 0 && ObjectUtil.isNotEmpty(inst)) {
Map<String, Object> map = new HashMap<>();
map.put("to_agv_get_finish", "1");
map.put("to_task_finish", "1");
map.put("to_agv_put_finish", "0");
this.writing(map);
inst.setExecute_status(InstActionEnum.EXECUTE_GET_EMPTY_FINISH.getCode());
instructionService.update(inst);
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
this.writing("to_task_finish", "1");
//如果送满框1任务完成 判断是否有下一条任务 有的话立即下发缓存线
if (agvphase == 0x10) {
List<Instruction> linkNum = instructionService.findByLinkNum(inst.getLink_num());
@@ -537,10 +557,10 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
}
}
}
this.set(0, 0, null);
noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
this.set(0, 0, null);
} else {
String noFeedMessage = this.noFeedMessage();
if (move != 0) {
@@ -557,21 +577,17 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
*/
if (agvphase == 0x03) {
//缓存线出满框 到达取货点
if (mode == 1 && move == 0 && prepare_ready == 1 && out_ready == 1 && task != 0 && prepare_barcode != 99999 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
if (mode == 1 && move == 1 && out_ready == 1 && task != 0 && docking_barcode != 99999 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
this.writing("to_agv_get_ready", "1");
this.writing("to_agv_put_finish", "0");
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
instructionService.update(inst);
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.setVehicle_code(String.valueOf(docking_barcode));
taskserver.update(taskDto);
}
this.set(0, 0, null);
this.noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
this.set(0, 0, null);
} else {
if (task == 0 && ObjectUtil.isNotEmpty(inst)) {
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
@@ -605,45 +621,42 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
}
} else if (agvphase == 0x05) {
//缓存线出满框 取货完毕
if (mode == 1 && move == 0 && docking_barcode != 99999 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
if (mode == 1 && move == 0 && prepare_barcode != 99999 && ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status(InstActionEnum.EXECUTE_GET_FINISH.getCode());
instructionService.update(inst);
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
Map<String, Object> map = new HashMap<>();
map.put("to_agv_get_finish", "1");
map.put("to_task_finish", "1");
if (task == 0 || Integer.parseInt(inst.getTask_code()) == task) {
map.put("to_task_finish", "1");
}
this.writing(map);
this.set(0, 0, null);
noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
this.set(0, 0, null);
} else {
String noFeedMessage = this.noFeedMessage();
if (move != 0) {
noFeedMessage += "对接位光电有货,";
}
if (docking_barcode == 99999) {
if (prepare_barcode == 99999) {
noFeedMessage += "对接位条码异常,";
}
this.noFeedAgvMessage = this.replace(noFeedMessage);
}
} else if (agvphase == 0x13 || agvphase == 0x17) {
//缓存线出满框送回空框
if (mode == 1 && move == 0 && ObjectUtil.isNotEmpty(inst) /*&& Integer.parseInt(inst.getInstruction_code()) == task*/) {
//送回空箱时到达点位判断缓存线是否有其他任务,有其他任务就让缓存线停止转洞
if (task > 0 && task != Integer.parseInt(inst.getInstruction_code())) {
this.writing("to_pause", "1");
}
this.writing("to_agv_put_ready", "1");
if (mode == 1 && move == 0 && in_ready == 1 && ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status(InstActionEnum.EXECUTE_TO_PUT_EMPTY.getCode());
instructionService.update(inst);
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null);
noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
this.set(0, 0, null);
} else {
String notFeedAgvMessage = "到达缓存线送空框点未反馈AGV原因:";
if (mode != 1) {
@@ -659,23 +672,23 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
}
} else if (agvphase == 0x15 || agvphase == 0x19) {
//缓存线出满框送回空框完毕
if (mode == 1 && move == 1 && ObjectUtil.isNotEmpty(inst) /*&& Integer.parseInt(inst.getInstruction_code()) == task*/) {
if (mode == 1 && in_finish == 1 && ObjectUtil.isNotEmpty(inst)) {
this.writing("to_agv_put_finish", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_EMPTY_FINISH.getCode());
instructionService.update(inst);
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
if (task > 0 && task != Integer.parseInt(inst.getInstruction_code())) {
this.writing("to_pause", "0");
this.writing("to_pause_out_check", "0");
}
this.set(0, 0, null);
noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
this.set(0, 0, null);
} else {
String noFeedMessage = this.noFeedMessage();
if (move != 1) {
noFeedMessage += "对接位光电无货,";
if (in_finish != 1) {
noFeedMessage += "电气未上报对接位入箱完成,";
}
this.noFeedAgvMessage = this.replace(noFeedMessage);
}
@@ -701,6 +714,8 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
last_hoist_target_layer = hoist_target_layer;
last_task_type = task_type;
last_barcodes = barcodes;
last_docking_barcode = docking_barcode;
last_prepare_barcode = prepare_barcode;
last_isonline = isonline;
}
@@ -946,7 +961,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
jo.put("hoist_target_layer", hoist_target_layer);
jo.put("task", task);
jo.put("prepare_barcode", prepare_barcode);
jo.put("docking_barcode", docking_barcode);
jo.put("prepare_barcode", prepare_barcode);
jo.put("isOnline", this.itemProtocol.getIsonline());
jo.put("error", ErrorUtil.getDictDetail("cache_line_error_type", String.valueOf(this.getError())));
jo.put("isError", this.getIserror());

View File

@@ -167,7 +167,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
message = "未联机";
//有报警
} else {
this.setIsonline(true);
// this.setIsonline(true);
this.setIserror(false);
//申请清洗上料

View File

@@ -153,9 +153,9 @@ public class HailiangCleaningMachineStorageStationDeviceDriver extends AbstractO
//this.setIserror(true);
message = "信号量同步异常";
//未联机
} else if (mode == 0) {
} /*else if (mode == 0) {
message = "未联机";
} else {
} */ else {
this.setIsonline(true);
this.setIserror(false);
message = null;

View File

@@ -95,7 +95,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
message = "信号量同步异常";
//未联机
} else {
this.setIsonline(true);
//this.setIsonline(true);
this.setIserror(false);
message = "";
//到达AGV取货点

View File

@@ -370,7 +370,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
message = "未联机";
//有报警
} else {
this.setIsonline(true);
//this.setIsonline(true);
this.setIserror(false);
message = "";
//有货、联机、满料请求申请AGV搬运任务
@@ -585,8 +585,11 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
reqParam.put("workorder_code", this.getOrder());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true;
return true;
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
requireSucess = true;
return true;
}
}
}
return false;
@@ -618,13 +621,13 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
@Override
public void issuedOrderFinish(String autoFinish) {
Map<String, Object> map = new HashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())){
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1");
} else {
map.put("to_confirm_finished", "1");
}
map.put("to_order", "0");
map.put("to_clear", "1");
//map.put("to_order", "0");
//map.put("to_clear", "1");
this.writing(map);
}

View File

@@ -245,7 +245,7 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
message = "未联机";
//有报警
} else {
this.setIsonline(true);
// this.setIsonline(true);
this.setIserror(false);
message = "";
}
@@ -327,8 +327,8 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
} else {
map.put("to_confirm_finished", "1");
}
map.put("to_order", "0");
map.put("to_clear", "1");
//map.put("to_order", "0");
//map.put("to_clear", "1");
this.writing(map);
}

View File

@@ -145,7 +145,7 @@ public class HailiangOldSpecialEmptyStationDeviceDriver extends AbstractOpcDevic
message = "未联机";
//有报警
} else {
this.setIsonline(true);
//this.setIsonline(true);
this.setIserror(false);
message = "";
//请求放空箱

View File

@@ -166,7 +166,7 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
message = "未联机";
//有报警
} else {
this.setIsonline(true);
// this.setIsonline(true);
this.setIserror(false);
message = "";
@@ -282,8 +282,11 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
reqParam.put("workorder_code", this.getOrder());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true;
return true;
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
requireSucess = true;
return true;
}
}
}
return false;

View File

@@ -94,8 +94,8 @@ public class ItemProtocol {
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_agv_ready, "AGV取货就绪", "W112", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_agv_finish, "AGV取货完成", "W114", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_agv_ready, "AGV取货就绪", "VW112", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_agv_finish, "AGV取货完成", "VW114", Boolean.valueOf(true)));
return list;
}

View File

@@ -102,11 +102,6 @@ public class HailiangOldSpecialPickStationDeviceDriver extends AbstractOpcDevice
//this.setIserror(true);
message = "未联机";
//有报警
} else if (error != 0) {
//this.setIsonline(false);
//this.setIserror(true);
message = "有报警";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);

View File

@@ -133,7 +133,7 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) {
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), this.getStorage_stock_num());
}
if (storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num")))) {
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) {
requireSucess = false;
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号storage_stock_num" + last_storage_stock_num + "->" + storage_stock_num);
@@ -156,17 +156,17 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
message = "未联机";
//有报警
} else {
this.setIsonline(true);
//this.setIsonline(true);
this.setIserror(false);
if (mode == 1 && !requireSucess && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= this.storage_stock_num) {
if (mode == 1 && !requireSucess && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= this.storage_stock_num && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) {
boolean flag = applyOutCacheLineTask();
this.noApplyTaskMessage = null;
if (flag) {
this.message = "申请缓存线任务成功";
}
} else {
if (Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num) {
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num) {
String notApplyTaskMessage = "";
if (mode != 1) {
notApplyTaskMessage += "设备未联机,";
@@ -252,8 +252,11 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
reqParam.put("workorder_code", this.getOrder());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (httpResponse != null && httpResponse.getStatus() == 200) {
requireSucess = true;
return true;
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
requireSucess = true;
return true;
}
}
}
return false;

View File

@@ -554,8 +554,11 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
reqParam.put("workorder_code", this.getOrder());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true;
return true;
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
requireSucess = true;
return true;
}
}
}
return false;
@@ -596,8 +599,8 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
} else {
map.put("to_confirm_finished", "1");
}
map.put("to_order", "0");
map.put("to_clear", "1");
//map.put("to_order", "0");
//map.put("to_clear", "1");
this.writing(map);
}

View File

@@ -241,7 +241,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_tap_close_pos, "阀门关定位", "DB1.B1.2"));
list.add(new ItemDto(item_agv_abutment_error, "AGV对接故障", "DB1.B1.3"));
list.add(new ItemDto(item_order_finish, "订单完成", "DB1.B1.5"));
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1.7"));
list.add(new ItemDto(item_mode, "工作模式", "DB1.B0.6"));
list.add(new ItemDto(item_lack_req, "请求料", "DB1.B2.0"));
list.add(new ItemDto(item_hopper_already, "料斗已经到位", "DB1.B2.1"));
list.add(new ItemDto(item_req_task_empty, "请求取空料斗", "DB1.B2.6"));

View File

@@ -294,8 +294,8 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
} else {
map.put("to_confirm_finished", "1");
}
map.put("to_order", "0");
map.put("to_clear", "1");
//map.put("to_order", "0");
//map.put("to_clear", "1");
this.writing(map);
}

View File

@@ -146,12 +146,12 @@ public class HailiangSpecialEmptyStationDeviceDriver extends AbstractOpcDeviceDr
message = "未联机";
//有报警
} else {
this.setIsonline(true);
//this.setIsonline(true);
this.setIserror(false);
message = "";
//请求放空箱
if (agvphase == 0x13 || agvphase == 0x17) {
if (mode == 1 /*&& move == 1*/ && ObjectUtil.isNotEmpty(inst)) {
if (mode == 1 && move == 1 && ObjectUtil.isNotEmpty(inst)) {
writing("to_agv_ready", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_TO_PUT_EMPTY.getCode());
instructionService.update(inst);
@@ -177,8 +177,7 @@ public class HailiangSpecialEmptyStationDeviceDriver extends AbstractOpcDeviceDr
}
//放空箱完成
if (agvphase == 0x15 || agvphase == 0x19) {
if (mode == 1 /*&& move == 0*/ && ObjectUtil.isNotEmpty(inst)) {
// writing("to_agv_finish", "1");
if (mode == 1 && move == 0 && ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_EMPTY_FINISH.getCode());
instructionService.update(inst);
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);

View File

@@ -169,7 +169,7 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
message = "未联机";
//有报警
} else {
this.setIsonline(true);
//this.setIsonline(true);
this.setIserror(false);
message = "";
@@ -198,7 +198,7 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
//agv到达取货点
if (agvphase == 0x03 || agvphase == 0x07) {
if (mode == 1/* && move == 1 && full_number > 0*/ && ObjectUtil.isNotEmpty(inst)) {
if (mode == 1 && move == 1 && full_number > 0 && ObjectUtil.isNotEmpty(inst)) {
//下发取货位agv取货就绪
this.writing("to_agv_ready", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
@@ -229,7 +229,7 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
//agv取货完成
if (agvphase == 0x05 || agvphase == 0x09) {
if (mode == 1 /*&& move == 0 */ && ObjectUtil.isNotEmpty(inst)) {
if (mode == 1 && move == 0 && ObjectUtil.isNotEmpty(inst)) {
this.writing("to_agv_finish", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_GET_FINISH.getCode());
instructionService.update(inst);
@@ -286,8 +286,11 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
reqParam.put("workorder_code", this.getOrder());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true;
return true;
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
requireSucess = true;
return true;
}
}
}
return false;
@@ -330,6 +333,6 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
public void setDeviceStatus(JSONObject data) {
Boolean requireSucess = data.getBoolean("requireSucess");
if (ObjectUtil.isNotEmpty(requireSucess))
this.requireSucess = requireSucess;
this.requireSucess = requireSucess;
}
}

View File

@@ -37,12 +37,12 @@ public class HailiangSpecialPickStationDeviceDriver extends AbstractOpcDeviceDri
int mode = 0;
int error = 0;
int order = 0;
int now_one_prod_num = 0;
int now_one_box_num = 0;
int last_mode = 0;
int last_error = 0;
int last_order = 0;
int last_now_one_prod_num = 0;
int last_now_one_box_num = 0;
Boolean isonline = true;
Boolean last_isonline = true;
@@ -71,7 +71,7 @@ public class HailiangSpecialPickStationDeviceDriver extends AbstractOpcDeviceDri
device_code = this.getDeviceCode();
error = this.itemProtocol.getError();
mode = this.itemProtocol.getMode();
now_one_prod_num = this.itemProtocol.getItem_now_one_box_num();
now_one_box_num = this.itemProtocol.getItem_now_one_box_num();
order = this.itemProtocol.getOrder();
isonline = this.itemProtocol.getIsonline();
@@ -81,8 +81,8 @@ public class HailiangSpecialPickStationDeviceDriver extends AbstractOpcDeviceDri
if (order != last_order) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号order" + last_order + "->" + order);
}
if (now_one_prod_num != last_now_one_prod_num) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号now_one_prod_num" + last_now_one_prod_num + "->" + now_one_prod_num);
if (now_one_box_num != now_one_box_num) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号now_one_box_num" + last_now_one_box_num + "->" + now_one_box_num);
}
if (error != last_error) {
if (error != 0) {
@@ -110,13 +110,8 @@ public class HailiangSpecialPickStationDeviceDriver extends AbstractOpcDeviceDri
//this.setIserror(true);
message = "未联机";
//有报警
} else if (error != 0) {
//this.setIsonline(false);
//this.setIserror(true);
message = "有报警";
//无报警
} else {
this.setIsonline(true);
// this.setIsonline(true);
this.setIserror(false);
message = "";
@@ -124,7 +119,7 @@ public class HailiangSpecialPickStationDeviceDriver extends AbstractOpcDeviceDri
last_mode = mode;
last_error = error;
last_order = order;
last_now_one_prod_num = now_one_prod_num;
last_now_one_box_num = now_one_box_num;
}
@@ -132,6 +127,7 @@ public class HailiangSpecialPickStationDeviceDriver extends AbstractOpcDeviceDri
public JSONObject getDeviceStatusName() throws Exception {
JSONObject jo = new JSONObject();
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("now_one_box_num", now_one_box_num);
jo.put("isOnline", this.itemProtocol.getIsonline());
jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError())));
jo.put("driver_type", "hailiang_special_pick_station");

View File

@@ -14,7 +14,7 @@ public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_error = "error";
public static String item_now_one_box_num = "now_one_prod_num";
public static String item_now_one_box_num = "now_one_box_num";
public static String item_order = "order";

View File

@@ -135,7 +135,7 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) {
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), this.getStorage_stock_num());
}
if (storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) {
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) {
requireSucess = false;
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号storage_stock_num" + last_storage_stock_num + "->" + storage_stock_num);
@@ -162,14 +162,14 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
message = "";
//倒料位满足联机,剩余数量小于最小数量申请缓存线出库任务
if (mode == 1 && !requireSucess && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != 0) {
if (mode == 1 && !requireSucess && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) {
boolean flag = applyOutCacheLineTask();
this.noApplyTaskMessage = null;
if (flag) {
this.message = "申请缓存线任务成功";
}
} else {
if (Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num) {
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num) {
String notApplyTaskMessage = "";
if (mode != 1) {
notApplyTaskMessage += "设备未联机,";
@@ -256,8 +256,15 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
reqParam.put("workorder_code", this.getOrder());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (httpResponse != null && httpResponse.getStatus() == 200) {
requireSucess = true;
return true;
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
requireSucess = true;
return true;
} else {
message = "申请任务失败,原因:" + resp.getString("message");
}
} else {
message = "申请任务失败,原因:接口不通!";
}
}
return false;

View File

@@ -50,62 +50,62 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
@Autowired
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
//线体状态
int heartbeat = 0;
int mode = 0;
int last_mode = 0;
//线体开机状态
int line_power_status = 0;
int last_line_power_status = 0;
//线体就绪
int move = 0;
int line_ready = 0;
int last_line_ready = 0;
//所有设备就绪
int all_ready = 0;
int last_all_ready = 0;
//线体故障
int line_error = 0;
int last_line_error = 0;
//巷道有货请求
int lane_stock_req = 0;
int last_lane_stock_req = 0;
//订单完成
int finish = 0;
int last_finish = 0;
//巷道1托盘满托
int lane1_tray_full = 0;
int last_lane1_tray_full = 0;
//巷道2托盘满托
int lane2_tray_full = 0;
int last_lane2_tray_full = 0;
//巷道1托盘位允许放货
int lane1_allow_put = 0;
int last_lane1_allow_put = 0;
//巷道2托盘位允许放货
int lane2_allow_put = 0;
int last_lane2_allow_put = 0;
//巷道故障
int is_full_1 = 0;
int is_full_2 = 0;
int is_full_3 = 0;
int is_full_4 = 0;
int move_1 = 0;
int move_2 = 0;
int move_3 = 0;
int move_4 = 0;
int error = 0;
int lane_error = 0;
int last_lane_error = 0;
//巷道1号托盘当前码垛箱数
int lane1_tray_current_num = 0;
int last_lane1_tray_current_num = 0;
//巷道2号托盘当前码垛箱数
int lane2_tray_current_num = 0;
int last_lane2_tray_current_num = 0;
//巷道1号托盘模板
int lane1_tray_template = 0;
int last_lane1_tray_template = 0;
//巷道2号托盘模板
int lane2_tray_template = 0;
int last_lane2_tray_template = 0;
//订单实时
int pallet_num_1 = 0;
int pallet_num_2 = 0;
int pallet_num_3 = 0;
int pallet_num_4 = 0;
int material_1 = 0;
int material_2 = 0;
int material_3 = 0;
int material_4 = 0;
int order_now = 0;
int last_order_now = 0;
//托盘实时
int tray_now = 0;
int last_tray_now = 0;
//码盘巷道工单号
int order = 0;
int last_heartbeat = 0;
int last_mode = 0;
int last_line_power_status = 0;
int last_move = 0;
int last_line_ready = 0;
int last_all_ready = 0;
int last_finish = 0;
int last_is_full_1 = 0;
int last_is_full_2 = 0;
int last_is_full_3 = 0;
int last_is_full_4 = 0;
int last_move_1 = 0;
int last_move_2 = 0;
int last_move_3 = 0;
int last_move_4 = 0;
int last_error = 0;
int last_lane_error = 0;
int last_pallet_num_1 = 0;
int last_pallet_num_2 = 0;
int last_pallet_num_3 = 0;
int last_pallet_num_4 = 0;
int last_material_1 = 0;
int last_material_2 = 0;
int last_material_3 = 0;
int last_material_4 = 0;
int last_order_now = 0;
int last_tray_now = 0;
int last_order = 0;
@@ -133,25 +133,33 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
public void execute() {
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
line_power_status = this.itemProtocol.getLine_power_status();
line_ready = this.itemProtocol.getLine_ready();
all_ready = this.itemProtocol.getAll_ready();
line_error = this.itemProtocol.getLine_error();
lane_stock_req = this.itemProtocol.getLane_stock_req();
finish = this.itemProtocol.getFinish();
lane1_tray_full = this.itemProtocol.getLane1_tray_full();
lane2_tray_full = this.itemProtocol.getLane2_tray_full();
lane1_allow_put = this.itemProtocol.getLane1_allow_put();
lane2_allow_put = this.itemProtocol.getLane2_allow_put();
lane_error = this.itemProtocol.getLane_error();
lane1_tray_current_num = this.itemProtocol.getLane1_tray_current_num();
lane2_tray_current_num = this.itemProtocol.getLane2_tray_current_num();
lane1_tray_template = this.itemProtocol.getLane1_tray_template();
lane2_tray_template = this.itemProtocol.getLane2_tray_template();
order_now = this.itemProtocol.getOrder_now();
tray_now = this.itemProtocol.getTray_now();
order = this.itemProtocol.getOrder();
mode = this.itemProtocol.getItem_mode();
line_power_status = this.itemProtocol.getItem_line_power_status();
move = this.itemProtocol.getItem_move();
line_ready = this.itemProtocol.getItem_line_ready();
all_ready = this.itemProtocol.getItem_all_ready();
finish = this.itemProtocol.getItem_finish();
is_full_1 = this.itemProtocol.getItem_is_full_1();
is_full_2 = this.itemProtocol.getItem_is_full_2();
is_full_3 = this.itemProtocol.getItem_is_full_3();
is_full_4 = this.itemProtocol.getItem_is_full_4();
move_1 = this.itemProtocol.getItem_move_1();
move_2 = this.itemProtocol.getItem_move_2();
move_3 = this.itemProtocol.getItem_move_3();
move_4 = this.itemProtocol.getItem_move_4();
error = this.itemProtocol.getItem_error();
lane_error = this.itemProtocol.getItem_lane_error();
pallet_num_1 = this.itemProtocol.getItem_pallet_num_1();
pallet_num_2 = this.itemProtocol.getItem_pallet_num_2();
pallet_num_3 = this.itemProtocol.getItem_pallet_num_3();
pallet_num_4 = this.itemProtocol.getItem_pallet_num_4();
material_1 = this.itemProtocol.getItem_material_1();
material_2 = this.itemProtocol.getItem_material_2();
material_3 = this.itemProtocol.getItem_material_3();
material_4 = this.itemProtocol.getItem_material_4();
order_now = this.itemProtocol.getItem_order_now();
tray_now = this.itemProtocol.getItem_tray_now();
order = this.itemProtocol.getItem_order();
isonline = this.itemProtocol.getIsonline();
@@ -168,21 +176,19 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
if (all_ready != last_all_ready) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号all_ready" + last_all_ready + "->" + all_ready);
}
if (line_error != last_line_error) {
if (line_error != 0) {
if (error != last_error) {
if (error != 0) {
DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(line_error));
dto.setError_info(ErrorUtil.getDictDetail("stack_error_type", String.valueOf(line_error)));
dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("stack_error_type", String.valueOf(error)));
deviceErrorLogService.create(dto);
}
if (line_error == 1 || line_error == 51) {
feedDeviceStatusFlag = false;
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号line_error" + last_line_error + "->" + line_error);
feedDeviceStatusFlag = false;
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (lane_stock_req != last_lane_stock_req) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号lane_stock_req" + last_lane_stock_req + "->" + lane_stock_req);
if (move != last_move) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (finish != last_finish) {
if (finish == 1) {
@@ -190,32 +196,56 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号finish" + last_finish + "->" + finish);
}
if (lane1_tray_full != last_lane1_tray_full) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号lane1_tray_full" + last_lane1_tray_full + "->" + lane1_tray_full);
if (is_full_1 != last_is_full_1) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号is_full_1" + last_is_full_1 + "->" + is_full_1);
}
if (lane2_tray_full != last_lane2_tray_full) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号lane2_tray_full" + last_lane2_tray_full + "->" + lane2_tray_full);
if (is_full_2 != last_is_full_2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号is_full_2" + last_is_full_2 + "->" + is_full_2);
}
if (lane1_allow_put != last_lane1_allow_put) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号lane1_allow_put" + last_lane1_allow_put + "->" + lane1_allow_put);
if (is_full_3 != last_is_full_3) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号is_full_3" + last_is_full_3 + "->" + is_full_3);
}
if (lane2_allow_put != last_lane2_allow_put) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号lane2_allow_put" + last_lane2_allow_put + "->" + lane2_allow_put);
if (is_full_4 != last_is_full_4) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号is_full_4" + last_is_full_4 + "->" + is_full_4);
}
if (move_1 != last_move_1) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号move_1" + last_move_1 + "->" + move_1);
}
if (move_2 != last_move_2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号move_2" + last_move_2 + "->" + move_2);
}
if (move_3 != last_move_3) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号move_3" + last_move_3 + "->" + move_3);
}
if (move_4 != last_move_4) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号move_4" + last_move_4 + "->" + move_4);
}
if (lane_error != last_lane_error) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号lane_error" + last_lane_error + "->" + lane_error);
}
if (lane1_tray_current_num != last_lane1_tray_current_num) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号lane1_tray_current_num" + last_lane1_tray_current_num + "->" + lane1_tray_current_num);
if (pallet_num_1 != last_pallet_num_1) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号pallet_num_1" + last_pallet_num_1 + "->" + pallet_num_1);
}
if (lane2_tray_current_num != last_lane2_tray_current_num) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号lane2_tray_current_num" + last_lane2_tray_current_num + "->" + lane2_tray_current_num);
if (pallet_num_2 != last_pallet_num_2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号pallet_num_2" + last_pallet_num_2 + "->" + pallet_num_2);
}
if (lane1_tray_template != last_lane1_tray_template) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号lane1_tray_template" + last_lane1_tray_template + "->" + lane1_tray_template);
if (pallet_num_3 != last_pallet_num_3) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号pallet_num_3" + last_pallet_num_3 + "->" + pallet_num_3);
}
if (lane2_tray_template != last_lane2_tray_template) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号lane2_tray_template" + last_lane2_tray_template + "->" + lane2_tray_template);
if (pallet_num_4 != last_pallet_num_4) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号pallet_num_4" + last_pallet_num_4 + "->" + pallet_num_4);
}
if (material_1 != last_material_1) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号material_1" + last_material_1 + "->" + material_1);
}
if (material_2 != last_material_2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号material_2" + last_material_2 + "->" + material_2);
}
if (material_3 != last_material_3) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号material_3" + last_material_3 + "->" + material_3);
}
if (material_4 != last_material_4) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号material_4" + last_material_4 + "->" + material_4);
}
if (order_now != last_order_now) {
if (order > 0) {
@@ -244,13 +274,13 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
chm.put("error_code", "0");
acsToWmsService.feedDeviceStatusType(chm);
feedDeviceStatusFlag = true;
} else if (this.itemProtocol.getIsonline() && (line_error == 1 || line_error == 51) && !feedDeviceStatusFlag) {
} else if (this.itemProtocol.getIsonline() && error != 0 && !feedDeviceStatusFlag) {
JSONObject chm = new JSONObject();
chm.put("device_code", this.getDevice_code());
//设备报警
chm.put("status_type", StatusEnum.DEVICE_STATUS_ERROR.getCode());
chm.put("start_time", DateUtil.now());
chm.put("error_code", String.valueOf(line_error));
chm.put("error_code", String.valueOf(error));
acsToWmsService.feedDeviceStatusType(chm);
feedDeviceStatusFlag = true;
} else if (this.itemProtocol.getIsonline() && mode == 1 && order > 0 && !feedDeviceStatusFlag) {
@@ -325,24 +355,32 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
last_mode = mode;
last_line_power_status = line_power_status;
last_move = move;
last_line_ready = line_ready;
last_all_ready = all_ready;
last_line_error = line_error;
last_lane_stock_req = lane_stock_req;
last_finish = finish;
last_lane1_tray_full = lane1_tray_full;
last_lane2_tray_full = lane2_tray_full;
last_lane1_allow_put = lane1_allow_put;
last_lane2_allow_put = lane2_allow_put;
last_is_full_1 = is_full_1;
last_is_full_2 = is_full_2;
last_is_full_3 = is_full_3;
last_is_full_4 = is_full_4;
last_move_1 = move_1;
last_move_2 = move_2;
last_move_3 = move_3;
last_move_4 = move_4;
last_error = error;
last_lane_error = lane_error;
last_lane1_tray_current_num = lane1_tray_current_num;
last_lane2_tray_current_num = lane2_tray_current_num;
last_lane1_tray_template = lane1_tray_template;
last_lane2_tray_template = lane2_tray_template;
last_pallet_num_1 = pallet_num_1;
last_pallet_num_2 = pallet_num_2;
last_pallet_num_3 = pallet_num_3;
last_pallet_num_4 = pallet_num_4;
last_material_1 = material_1;
last_material_2 = material_2;
last_material_3 = material_3;
last_material_4 = material_4;
last_order_now = order_now;
last_tray_now = tray_now;
last_order = order;
last_isonline = isonline;
}
@@ -382,7 +420,7 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
} else {
map.put("to_confirm_finished", "1");
}
map.put("to_order", "0");
//map.put("to_order", "0");
this.writing(map);
}
@@ -401,23 +439,30 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
JSONObject jo = new JSONObject();
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode == 1 ? "联机" : "单机");
jo.put("lane_stock_req", lane_stock_req == 1 ? "" : "");
jo.put("finish", finish == 1 ? "" : "");
jo.put("lane1_tray_full", lane1_tray_full == 1 ? "" : "");
jo.put("lane2_tray_full", lane2_tray_full == 1 ? "" : "");
jo.put("lane1_allow_put", lane1_allow_put == 1 ? "" : "");
jo.put("lane2_allow_put", lane2_allow_put == 1 ? "" : "");
jo.put("lane1_tray_current_num", lane1_tray_current_num);
jo.put("lane2_tray_current_num", lane2_tray_current_num);
jo.put("lane1_tray_template", lane1_tray_template);
jo.put("lane2_tray_template", lane2_tray_template);
jo.put("move", move == 1 ? "" : "");
jo.put("order_finish", finish == 1 ? "" : "");
jo.put("is_full_1", is_full_1 == 1 ? "" : "");
jo.put("is_full_2", is_full_2 == 1 ? "" : "");
jo.put("is_full_3", is_full_3 == 1 ? "" : "");
jo.put("is_full_4", is_full_4 == 1 ? "" : "");
jo.put("move_1", move_1 == 1 ? "" : "");
jo.put("move_2", move_2 == 1 ? "" : "");
jo.put("move_3", move_3 == 1 ? "" : "");
jo.put("move_4", move_4 == 1 ? "" : "");
jo.put("pallet_num_1", pallet_num_1);
jo.put("pallet_num_2", pallet_num_2);
jo.put("pallet_num_3", pallet_num_3);
jo.put("pallet_num_4", pallet_num_4);
jo.put("material_1", material_1);
jo.put("material_2", material_2);
jo.put("material_3", material_3);
jo.put("material_4", material_4);
jo.put("order_now", order_now);
jo.put("tray_now", tray_now);
jo.put("order", order);
jo.put("error", ErrorUtil.getDictDetail("stack_error_type", String.valueOf(line_error)));
jo.put("lane_error", ErrorUtil.getDictDetail("stack_error_type", String.valueOf(lane_error)));
jo.put("error", ErrorUtil.getDictDetail("stack_error_type", String.valueOf(error)));
jo.put("isOnline", this.itemProtocol.getIsonline());
jo.put("isError", (this.getLane_error() != 0 || this.getLine_error() != 0) ? true : false);
jo.put("isError", error != 0 ? true : false);
jo.put("message", this.getMessage());
jo.put("driver_type", "hailiang_stacking_station");
return jo;

View File

@@ -11,74 +11,97 @@ import java.util.List;
@Data
public class ItemProtocol {
//线体状态
//心跳
public static String item_heartbeat = "heartbeat";
//线体手自动||工作模式
public static String item_mode = "mode";
//线体开机状态
public static String item_line_power_status = "line_power_status";
//1、2#线有箱就绪,请求机械手
public static String item_move = "move";
//线体就绪
public static String item_line_ready = "line_ready";
//所有设备就绪
public static String item_all_ready = "all_ready";
//线体故障
public static String item_line_error = "line_error";
//巷道有货请求
public static String item_lane_stock_req = "lane_stock_req";
//订单完成
//1、2#订单完成
public static String item_finish = "finish";
//巷道1托盘满托
public static String item_lane1_tray_full = "lane1_tray_full";
//巷道2托盘满托
public static String item_lane2_tray_full = "lane2_tray_full";
//巷道1托盘位允许放货
public static String item_lane1_allow_put = "lane1_allow_put";
//巷道2托盘位允许放货
public static String item_lane2_allow_put = "lane2_allow_put";
//巷道故障
//1托盘是否满托
public static String item_is_full_1 = "is_full_1";
//2托盘是否满托
public static String item_is_full_2 = "is_full_2";
//3托盘是否满托
public static String item_is_full_3 = "is_full_3";
//4托盘是否满托
public static String item_is_full_4 = "is_full_4";
//1#托盘位置是否有托盘
public static String item_move_1 = "move_1";
//2#托盘位置是否有托盘
public static String item_move_2 = "move_2";
//3#托盘位置是否有托盘
public static String item_move_3 = "move_3";
//4#托盘位置是否有托盘
public static String item_move_4 = "move_4";
//线体故障信息
public static String item_error = "error";
//1、2#巷道故障信息
public static String item_lane_error = "lane_error";
//巷道1号托盘当前码垛箱数
public static String item_lane1_tray_current_num = "lane1_tray_current_num";
//巷道2号托盘当前码垛箱数
public static String item_lane2_tray_current_num = "lane2_tray_current_num";
//巷道1号托盘模板
public static String item_lane1_tray_template = "lane1_tray_template";
//巷道2号托盘模板
public static String item_lane2_tray_template = "lane2_tray_template";
//订单实时
//1#托盘当前码垛箱数
public static String item_pallet_num_1 = "pallet_num_1";
//2#托盘当前码垛箱数
public static String item_pallet_num_2 = "pallet_num_2";
//3#托盘当前码垛箱数
public static String item_pallet_num_3 = "pallet_num_3";
//4#托盘当前码垛箱数
public static String item_pallet_num_4 = "pallet_num_4";
//1#托盘物料信息
public static String item_material_1 = "material_1";
//2#托盘物料信息
public static String item_material_2 = "material_2";
//3#托盘物料信息
public static String item_material_3 = "material_3";
//4#托盘物料信息
public static String item_material_4 = "material_4";
//1、2#当前生产总量(订单实时)
public static String item_order_now = "order_now";
//托盘实时
//1、2#当前托盘总数(实时
public static String item_tray_now = "tray_now";
//码盘巷道工单号
//1、2#工单号
public static String item_order = "order";
//设备开关
public static String item_to_open = "to_open";
//码盘信息
//机械手启动开关
public static String item_to_open_pulator = "to_open_pulator";
//1、2 码盘信息模板号
public static String item_to_tray_info = "to_tray_info";
//当前产量清零
//1、2当前产量清零
public static String item_to_clear = "to_clear";
//确认完成(订单完成状态置零)
//1、2确认完成(订单完成状态置零)
public static String item_to_confirm_finished = "to_confirm_finished";
//巷道箱子长
//1、2巷道箱子长
public static String item_to_lane_box_l = "to_lane_box_l";
//巷道箱子宽
//1、2巷道箱子宽
public static String item_to_lane_box_w = "to_lane_box_w";
//道箱子高
//1、2巷道道箱子高
public static String item_to_lane_box_h = "to_lane_box_h";
//巷道1号托盘强制满托
public static String item_to_lane1_tray_compel_full = "to_lane1_tray_compel_full";
//巷道2号托盘强制满托
public static String item_to_lane2_tray_compel_full = "to_lane2_tray_compel_full";
//巷道禁用
//巷道3号托盘强制满托
public static String item_to_lane3_tray_compel_full = "to_lane3_tray_compel_full";
//巷道4号托盘强制满托
public static String item_to_lane4_tray_compel_full = "to_lane4_tray_compel_full";
//1、2巷道禁用
public static String item_to_lane_off = "to_lane_off";
//工单强制完成
//1、2工单强制完成
public static String item_to_compel_finish = "to_compel_finish";
//订单生产总量
//1、2订单生产总量
public static String item_to_order_prod_num = "to_order_prod_num";
//托盘总
//1、2订单需托盘总
public static String item_to_tray_num = "to_tray_num";
//工单号
//1、2工单号
public static String item_to_order = "to_order";
@@ -88,61 +111,89 @@ public class ItemProtocol {
this.driver = driver;
}
public int getMode() {
public int getItem_heartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getItem_mode() {
return this.getOpcIntegerValue(item_mode);
}
public int getLine_power_status() {
public int getItem_line_power_status() {
return this.getOpcIntegerValue(item_line_power_status);
}
public int getLine_ready () {
public int getItem_move() {
return this.getOpcIntegerValue(item_move);
}
public int getItem_line_ready() {
return this.getOpcIntegerValue(item_line_ready);
}
public int getAll_ready() {
public int getItem_all_ready() {
return this.getOpcIntegerValue(item_all_ready);
}
public int getLine_error() {
return this.getOpcIntegerValue(item_line_error);
}
public int getLane_stock_req() {
return this.getOpcIntegerValue(item_lane_stock_req);
}
public int getFinish() {
public int getItem_finish() {
return this.getOpcIntegerValue(item_finish);
}
public int getLane1_tray_full () {
return this.getOpcIntegerValue(item_lane1_tray_full);
public int getItem_is_full_1() {
return this.getOpcIntegerValue(item_is_full_1);
}
public int getLane2_tray_full () {
return this.getOpcIntegerValue(item_lane2_tray_full);
public int getItem_is_full_2() {
return this.getOpcIntegerValue(item_is_full_2);
}
public int getLane1_allow_put() {
return this.getOpcIntegerValue(item_lane1_allow_put);
public int getItem_is_full_3() {
return this.getOpcIntegerValue(item_is_full_3);
}
public int getLane2_allow_put() {
return this.getOpcIntegerValue(item_lane2_allow_put);
public int getItem_is_full_4() {
return this.getOpcIntegerValue(item_is_full_4);
}
public int getLane_error() {
public int getItem_move_1() {
return this.getOpcIntegerValue(item_move_1);
}
public int getItem_move_2() {
return this.getOpcIntegerValue(item_move_2);
}
public int getItem_move_3() {
return this.getOpcIntegerValue(item_move_3);
}
public int getItem_move_4() {
return this.getOpcIntegerValue(item_move_4);
}
public int getItem_error() {
return this.getOpcIntegerValue(item_error);
}
public int getItem_lane_error() {
return this.getOpcIntegerValue(item_lane_error);
}
public int getLane1_tray_current_num() {
return this.getOpcIntegerValue(item_lane1_tray_current_num);
public int getItem_pallet_num_1() {
return this.getOpcIntegerValue(item_pallet_num_1);
}
public int getLane2_tray_current_num () {
return this.getOpcIntegerValue(item_lane2_tray_current_num);
public int getItem_pallet_num_2() {
return this.getOpcIntegerValue(item_pallet_num_2);
}
public int getLane1_tray_template() {
return this.getOpcIntegerValue(item_lane1_tray_template);
public int getItem_pallet_num_3() {
return this.getOpcIntegerValue(item_pallet_num_3);
}
public int getLane2_tray_template() {
return this.getOpcIntegerValue(item_lane2_tray_template);
public int getItem_pallet_num_4() {
return this.getOpcIntegerValue(item_pallet_num_4);
}
public int getOrder_now() {
public int getItem_material_1() {
return this.getOpcIntegerValue(item_material_1);
}
public int getItem_material_2() {
return this.getOpcIntegerValue(item_material_2);
}
public int getItem_material_3() {
return this.getOpcIntegerValue(item_material_3);
}
public int getItem_material_4() {
return this.getOpcIntegerValue(item_material_4);
}
public int getItem_order_now() {
return this.getOpcIntegerValue(item_order_now);
}
public int getTray_now() {
public int getItem_tray_now() {
return this.getOpcIntegerValue(item_tray_now);
}
public int getOrder() {
public int getItem_order() {
return this.getOpcIntegerValue(item_order);
}
@@ -183,24 +234,33 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_mode, "线体状态", "DB1.B0.0"));
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.W82"));
list.add(new ItemDto(item_mode, "工作模式", "DB1.B0.0"));
list.add(new ItemDto(item_line_power_status, "线体开机状态", "DB1.B0.1"));
list.add(new ItemDto(item_move, "光电信号", "DB1.B1.1"));
list.add(new ItemDto(item_line_ready, "线体就绪", "DB1.B2.1"));
list.add(new ItemDto(item_all_ready, "所有设备就绪", "DB1.B2.2"));
list.add(new ItemDto(item_line_error, "线体故障", "DB1.W4"));
list.add(new ItemDto(item_lane_stock_req, "巷道有货请求", "DB1.B1.1"));
list.add(new ItemDto(item_finish, "订单完成", "DB1.B2.3"));
list.add(new ItemDto(item_lane1_tray_full, "巷道1号托盘满托", "DB1.B2.5"));
list.add(new ItemDto(item_lane2_tray_full, "巷道2号托盘满托", "DB1.B2.6"));
list.add(new ItemDto(item_lane1_allow_put, "巷道1号托盘位允许放货", "DB1.B3.1"));
list.add(new ItemDto(item_lane2_allow_put, "巷道2号托盘位允许放货", "DB1.B3.2"));
list.add(new ItemDto(item_lane_error, "巷道error", "DB1.W10"));
list.add(new ItemDto(item_lane1_tray_current_num, "巷道1号托盘当前码垛箱数", "DB1.W64"));
list.add(new ItemDto(item_lane2_tray_current_num, "巷道2号托盘当前码垛箱数", "DB1.W66"));
list.add(new ItemDto(item_lane1_tray_template, "巷道1号托盘模板", "DB1.W72"));
list.add(new ItemDto(item_lane2_tray_template, "巷道2号托盘模板", "DB1.D74"));
list.add(new ItemDto(item_order_now, "订单实时", "DB1.D84"));
list.add(new ItemDto(item_tray_now, "托盘实时", "DB1.D88"));
list.add(new ItemDto(item_finish, "工单完成", "DB1.B2.3"));
list.add(new ItemDto(item_is_full_1, "托盘1是否满托", "DB1.B2.5"));
list.add(new ItemDto(item_is_full_2, "托盘2是否满托", "DB1.B2.6"));
list.add(new ItemDto(item_is_full_3, "托盘3是否满托", "DB1.B2.7"));
list.add(new ItemDto(item_is_full_4, "托盘4是否满托", "DB1.B3.0"));
list.add(new ItemDto(item_move_1, "托盘1光电信号", "DB1.B3.1"));
list.add(new ItemDto(item_move_2, "托盘2光电信号", "DB1.B3.2"));
list.add(new ItemDto(item_move_3, "托盘3光电信号", "DB1.B3.3"));
list.add(new ItemDto(item_move_4, "托盘4光电信号", "DB1.B3.4"));
list.add(new ItemDto(item_error, "故障信息", "DB1.W4"));
list.add(new ItemDto(item_lane_error, "巷道故障", "DB1.W10"));
list.add(new ItemDto(item_pallet_num_1, "托盘1当前码垛箱数", "DB1.W64"));
list.add(new ItemDto(item_pallet_num_2, "托盘2当前码垛箱数", "DB1.W66"));
list.add(new ItemDto(item_pallet_num_3, "托盘3当前码垛箱数", "DB1.W68"));
list.add(new ItemDto(item_pallet_num_4, "托盘4当前码垛箱数", "DB1.W70"));
list.add(new ItemDto(item_material_1, "托盘1物料信息", "DB1.W72"));
list.add(new ItemDto(item_material_2, "托盘2物料信息", "DB1.W74"));
list.add(new ItemDto(item_material_3, "托盘3物料信息", "DB1.W76"));
list.add(new ItemDto(item_material_4, "托盘4物料信息", "DB1.W78"));
list.add(new ItemDto(item_order_now, "当前生产总量(订单实时)", "DB1.D84"));
list.add(new ItemDto(item_tray_now, "当前托盘总数(实时)", "DB1.D88"));
list.add(new ItemDto(item_order, "工单号", "DB1.D156"));
return list;
}
@@ -208,15 +268,18 @@ public class ItemProtocol {
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_open, "设备开关", "DB2.W4"));
list.add(new ItemDto(item_to_tray_info, "码盘信息", "DB2.W12"));
list.add(new ItemDto(item_to_open_pulator, "机械手开关", "DB2.W10"));
list.add(new ItemDto(item_to_tray_info, "码盘信息(模板号)", "DB2.W12"));
list.add(new ItemDto(item_to_clear, "当前产量清零", "DB2.W16"));
list.add(new ItemDto(item_to_confirm_finished, "订单确认完成", "DB2.W20"));
list.add(new ItemDto(item_to_lane_box_l, "巷道箱子长", "DB2.W28"));
list.add(new ItemDto(item_to_lane_box_w, "巷道箱子宽", "DB2.W30"));
list.add(new ItemDto(item_to_lane_box_h, "巷道箱子高", "DB2.W32"));
list.add(new ItemDto(item_to_lane1_tray_compel_full, "巷道1号托盘强制满托", "DB2.W40"));
list.add(new ItemDto(item_to_lane2_tray_compel_full, "巷道2号托盘强制满托", "DB2.W42"));
list.add(new ItemDto(item_to_lane_off, "巷道禁用", "DB2.W48"));
list.add(new ItemDto(item_to_lane1_tray_compel_full, "托盘1强制满托", "DB2.W40"));
list.add(new ItemDto(item_to_lane2_tray_compel_full, "托盘2强制满托", "DB2.W42"));
list.add(new ItemDto(item_to_lane3_tray_compel_full, "托盘3强制满托", "DB2.W44"));
list.add(new ItemDto(item_to_lane4_tray_compel_full, "托盘4强制满托", "DB2.W46"));
list.add(new ItemDto(item_to_lane_off, "巷道暂停", "DB2.W48"));
list.add(new ItemDto(item_to_compel_finish, "工单强制完成", "DB2.W80"));
list.add(new ItemDto(item_to_order_prod_num, "订单生产总量", "DB2.D84"));
list.add(new ItemDto(item_to_tray_num, "托盘总量", "DB2.D88"));

View File

@@ -11,7 +11,9 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
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.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
@@ -121,6 +123,13 @@ public class UnboxingMachineDeviceDriver extends AbstractOpcDeviceDriver impleme
logServer.deviceExecuteLog(this.device_code, "", "", "信号order_compel_finish" + last_order_compel_finish + "->" + order_compel_finish + "复位请求标记");
}
if (error != last_error) {
if (error != 0) {
DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("unbox_error_type", String.valueOf(error)));
deviceErrorLogService.create(dto);
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error + "复位请求标记");
}
if (now_order_num != last_now_order_num) {
@@ -166,6 +175,13 @@ public class UnboxingMachineDeviceDriver extends AbstractOpcDeviceDriver impleme
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode == 1 ? "联机" : "未联机");
jo.put("order_finish", order_finish == 1 ? "" : "");
jo.put("order_compel_finish", order_compel_finish == 1 ? "" : "");
jo.put("error", ErrorUtil.getDictDetail("unbox_error_type", String.valueOf(error)));
jo.put("now_order_num", now_order_num);
jo.put("task", task);
jo.put("order", order);
jo.put("isOnline", this.itemProtocol.getIsonline());
return jo;
}