|
|
@ -95,14 +95,14 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
String device_code; |
|
|
|
int status = 0; |
|
|
|
int last_status = 0; |
|
|
|
int move_1 = 0; |
|
|
|
int last_move_1 = 0; |
|
|
|
int move_2 = 0; |
|
|
|
int last_move_2 = 0; |
|
|
|
int action_1 = 0; |
|
|
|
int last_action_1 = 0; |
|
|
|
int action_2 = 0; |
|
|
|
int last_action_2 = 0; |
|
|
|
int move1 = 0; |
|
|
|
int last_move1 = 0; |
|
|
|
int move2 = 0; |
|
|
|
int last_move2 = 0; |
|
|
|
int action1 = 0; |
|
|
|
int last_action1 = 0; |
|
|
|
int action2 = 0; |
|
|
|
int last_action2 = 0; |
|
|
|
int walk_y = 0; |
|
|
|
int last_walk_y = 0; |
|
|
|
int task1 = 0; |
|
|
@ -184,10 +184,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
device_code = this.getDeviceCode(); |
|
|
|
mode = this.itemProtocol.getMode(); |
|
|
|
status = this.itemProtocol.getStatus(); |
|
|
|
move_1 = this.itemProtocol.getMove1(); |
|
|
|
move_2 = this.itemProtocol.getMove2(); |
|
|
|
action_1 = this.itemProtocol.getAction1(); |
|
|
|
action_2 = this.itemProtocol.getAction2(); |
|
|
|
move1 = this.itemProtocol.getMove1(); |
|
|
|
move2 = this.itemProtocol.getMove2(); |
|
|
|
action1 = this.itemProtocol.getAction1(); |
|
|
|
action2 = this.itemProtocol.getAction2(); |
|
|
|
walk_y = this.itemProtocol.getWalk_y(); |
|
|
|
error = this.itemProtocol.getError(); |
|
|
|
task1 = this.itemProtocol.getTask1(); |
|
|
@ -224,26 +224,26 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status)); |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + "->" + status); |
|
|
|
} |
|
|
|
if (move_1 != last_move_1) { |
|
|
|
if (move_1 == 0) { |
|
|
|
if (move1 != last_move1) { |
|
|
|
if (move1 == 0) { |
|
|
|
this.setRequireSucess1(false); |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "前工位有货变无货,复位前工位请求标记requireSucess1:" + requireSucess1); |
|
|
|
} |
|
|
|
logServer.deviceItemValue(this.device_code, "move_1", String.valueOf(move_1)); |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号move_1:" + last_move_1 + "->" + move_1); |
|
|
|
logServer.deviceItemValue(this.device_code, "move1", String.valueOf(move1)); |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号move1:" + last_move1 + "->" + move1); |
|
|
|
} |
|
|
|
if (move_2 != last_move_2) { |
|
|
|
if (move_2 == 0) { |
|
|
|
if (move2 != last_move2) { |
|
|
|
if (move2 == 0) { |
|
|
|
this.setRequireSucess2(false); |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "后工位有货变无货,复位后工位请求标记requireSucess2:" + requireSucess2); |
|
|
|
} |
|
|
|
// logServer.deviceExecuteLog(this.device_code, "", "", "信号move_2:" + last_move_2 + "->" + move_2);
|
|
|
|
// logServer.deviceExecuteLog(this.device_code, "", "", "信号move2:" + last_move2 + "->" + move2);
|
|
|
|
} |
|
|
|
if (action_1 != last_action_1) { |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号action_1:" + last_action_1 + "->" + action_1); |
|
|
|
if (action1 != last_action1) { |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号action1:" + last_action1 + "->" + action1); |
|
|
|
} |
|
|
|
if (action_2 != last_action_2) { |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号action_2:" + last_action_2 + "->" + action_2); |
|
|
|
if (action2 != last_action2) { |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号action2:" + last_action2 + "->" + action2); |
|
|
|
} |
|
|
|
if (walk_y != last_walk_y) { |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y:" + last_walk_y + "->" + walk_y); |
|
|
@ -302,7 +302,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
} |
|
|
|
|
|
|
|
//前工位取货时判断取货位光电信号
|
|
|
|
if (mode == 3 && error == 0 && status != 3 && action_1 == 1 && move_1 == 0 && task1 > 0 && action_2 != 1) { |
|
|
|
if (mode == 3 && error == 0 && status != 3 && action1 == 1 && move1 == 0 && task1 > 0 && action2 != 1) { |
|
|
|
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); |
|
|
|
String start_device_code = inst1.getStart_device_code(); |
|
|
|
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code); |
|
|
@ -310,8 +310,9 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
LnshPalletizingManipulatorSiteDeviceDriver driver = (LnshPalletizingManipulatorSiteDeviceDriver) startDevice.getDeviceDriver(); |
|
|
|
if (driver.getMode() != 0 |
|
|
|
&& driver.getMove() != 0 |
|
|
|
&& (driver.getIo_action() == 3 || driver.getIo_action() == 1) |
|
|
|
&& (driver.getAction() == 3 || driver.getAction() == 1)) { |
|
|
|
// && (driver.getIo_action() == 3 || driver.getIo_action() == 1)
|
|
|
|
// && (driver.getAction() == 3 || driver.getAction() == 1)
|
|
|
|
) { |
|
|
|
this.writing("to_command1", "2"); |
|
|
|
driver.setMessage(""); |
|
|
|
logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", "允许RGV前工位取货。"); |
|
|
@ -341,7 +342,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
} |
|
|
|
|
|
|
|
//前工位放货时判断放货位光电信号
|
|
|
|
if (mode == 3 && error == 0 && status != 3 && action_1 == 3 && move_1 != 0 && task1 > 0 && action_2 != 3) { |
|
|
|
if (mode == 3 && error == 0 && status != 3 && action1 == 3 && move1 != 0 && task1 > 0 && action2 != 3) { |
|
|
|
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); |
|
|
|
String next_device_code = inst1.getNext_device_code(); |
|
|
|
Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code); |
|
|
@ -405,7 +406,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
} |
|
|
|
|
|
|
|
//后工位取货时判断取货位光电信号
|
|
|
|
if (mode == 3 && error == 0 && status != 3 && action_2 == 1 && move_2 == 0 && task2 > 0) { |
|
|
|
if (mode == 3 && error == 0 && status != 3 && action2 == 1 && move2 == 0 && task2 > 0) { |
|
|
|
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2)); |
|
|
|
String start_device_code = inst1.getStart_device_code(); |
|
|
|
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code); |
|
|
@ -461,7 +462,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
} |
|
|
|
|
|
|
|
//后工位放货时判断放货位光电信号
|
|
|
|
if (mode == 3 && error == 0 && status != 3 && action_2 == 3 && move_2 != 0 && task2 > 0 && action_1 != 1) { |
|
|
|
if (mode == 3 && error == 0 && status != 3 && action2 == 3 && move2 != 0 && task2 > 0 && action1 != 1) { |
|
|
|
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2)); |
|
|
|
String next_device_code = inst1.getNext_device_code(); |
|
|
|
Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code); |
|
|
@ -469,8 +470,9 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
LnshPalletizingManipulatorSiteDeviceDriver driver = (LnshPalletizingManipulatorSiteDeviceDriver) nextDevice.getDeviceDriver(); |
|
|
|
if (driver.getMode() != 0 |
|
|
|
&& driver.getMove() == 0 |
|
|
|
&& (driver.getIo_action() == 1 || driver.getIo_action() == 3) |
|
|
|
&& (driver.getAction() == 2 || driver.getAction() == 3)) { |
|
|
|
// && (driver.getIo_action() == 1 || driver.getIo_action() == 3)
|
|
|
|
// && (driver.getAction() == 2 || driver.getAction() == 3)
|
|
|
|
) { |
|
|
|
this.writing("to_command2", "3"); |
|
|
|
driver.setMessage(""); |
|
|
|
logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", "允许RGV后工位放货。"); |
|
|
@ -526,7 +528,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
return; |
|
|
|
case 2: |
|
|
|
// 申请任务
|
|
|
|
if (move_1 == 0 && move_2 == 0 && action_1 == 0 && action_2 == 0 && task1 == 0 && task2 == 0 && !requireSucess1) { |
|
|
|
if (move1 == 0 && move2 == 0 && action1 == 0 && action2 == 0 && task1 == 0 && task2 == 0 && !requireSucess1) { |
|
|
|
instruction_require(); |
|
|
|
} |
|
|
|
break; |
|
|
@ -550,10 +552,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
last_mode = mode; |
|
|
|
last_error = error; |
|
|
|
last_status = status; |
|
|
|
last_move_1 = move_1; |
|
|
|
last_move_2 = move_2; |
|
|
|
last_action_1 = action_1; |
|
|
|
last_action_2 = action_2; |
|
|
|
last_move1 = move1; |
|
|
|
last_move2 = move2; |
|
|
|
last_action1 = action1; |
|
|
|
last_action2 = action2; |
|
|
|
last_walk_y = walk_y; |
|
|
|
last_task1 = task1; |
|
|
|
last_task2 = task2; |
|
|
@ -658,21 +660,29 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
//创建指令后修改任务状态
|
|
|
|
task.setTask_status("1"); |
|
|
|
taskserver.update(task); |
|
|
|
|
|
|
|
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver; |
|
|
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); |
|
|
|
Device addressdevice = appService.findDeviceByCode(start_device_code); |
|
|
|
//下发4个点任务
|
|
|
|
if (ObjectUtil.isNotEmpty(start_device_code2) && ObjectUtil.isNotEmpty(next_device_code2)) { |
|
|
|
sendHeadBackSignalType(instdto); |
|
|
|
requireSucess1 = true; |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请前后工位任务成功,requireSucess1" + requireSucess1 + ",指令号:" + instdto.getInstruction_code()); |
|
|
|
if(ObjectUtil.isNotEmpty(start_device_code)){ |
|
|
|
writing("to_command1", "1"); |
|
|
|
if (addressdevice.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) { |
|
|
|
lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
lnshLaminatingMachineDeviceDriver.writing("to_command", "1"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
sendHeadSignalType(instdto); |
|
|
|
requireSucess1 = true; |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请后工位任务成功,requireSucess1" + requireSucess1 + ",指令号:" + instdto.getInstruction_code()); |
|
|
|
if(ObjectUtil.isNotEmpty(start_device_code)){ |
|
|
|
writing("to_command1", "1"); |
|
|
|
if (addressdevice.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) { |
|
|
|
lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
lnshLaminatingMachineDeviceDriver.writing("to_command", "1"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
@ -872,10 +882,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
@Override |
|
|
|
public JSONObject getDeviceStatusName() { |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
String move_1 = ""; |
|
|
|
String move_2 = ""; |
|
|
|
String action_1 = ""; |
|
|
|
String action_2 = ""; |
|
|
|
String move1 = ""; |
|
|
|
String move2 = ""; |
|
|
|
String action1 = ""; |
|
|
|
String action2 = ""; |
|
|
|
String walk_y = ""; |
|
|
|
String mode = ""; |
|
|
|
String status = ""; |
|
|
@ -898,40 +908,40 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
status = "故障"; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.getMove_1() == 0) { |
|
|
|
move_1 = "无货"; |
|
|
|
} else if (this.getMove_1() == 1) { |
|
|
|
move_1 = "有货"; |
|
|
|
} else if (this.getMove_1() == 2) { |
|
|
|
move_1 = "有托盘有货"; |
|
|
|
if (this.getMove1() == 0) { |
|
|
|
move1 = "无货"; |
|
|
|
} else if (this.getMove1() == 1) { |
|
|
|
move1 = "有货"; |
|
|
|
} else if (this.getMove1() == 2) { |
|
|
|
move1 = "有托盘有货"; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.getMove_2() == 0) { |
|
|
|
move_2 = "无货"; |
|
|
|
} else if (this.getMove_2() == 1) { |
|
|
|
move_2 = "有货"; |
|
|
|
} else if (this.getMove_2() == 2) { |
|
|
|
move_2 = "有托盘有货"; |
|
|
|
if (this.getMove2() == 0) { |
|
|
|
move2 = "无货"; |
|
|
|
} else if (this.getMove2() == 1) { |
|
|
|
move2 = "有货"; |
|
|
|
} else if (this.getMove2() == 2) { |
|
|
|
move2 = "有托盘有货"; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.getAction_1() == 1) { |
|
|
|
action_1 = "取货中"; |
|
|
|
} else if (this.getAction_1() == 2) { |
|
|
|
action_1 = "取货完成"; |
|
|
|
} else if (this.getAction_1() == 3) { |
|
|
|
action_1 = "放货中"; |
|
|
|
} else if (this.getAction_1() == 4) { |
|
|
|
action_1 = "放货完成"; |
|
|
|
if (this.getAction1() == 1) { |
|
|
|
action1 = "取货中"; |
|
|
|
} else if (this.getAction1() == 2) { |
|
|
|
action1 = "取货完成"; |
|
|
|
} else if (this.getAction1() == 3) { |
|
|
|
action1 = "放货中"; |
|
|
|
} else if (this.getAction1() == 4) { |
|
|
|
action1 = "放货完成"; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.getAction_2() == 1) { |
|
|
|
action_2 = "取货中"; |
|
|
|
} else if (this.getAction_2() == 2) { |
|
|
|
action_2 = "取货完成"; |
|
|
|
} else if (this.getAction_2() == 3) { |
|
|
|
action_2 = "放货中"; |
|
|
|
} else if (this.getAction_2() == 4) { |
|
|
|
action_2 = "放货完成"; |
|
|
|
if (this.getAction2() == 1) { |
|
|
|
action2 = "取货中"; |
|
|
|
} else if (this.getAction2() == 2) { |
|
|
|
action2 = "取货完成"; |
|
|
|
} else if (this.getAction2() == 3) { |
|
|
|
action2 = "放货中"; |
|
|
|
} else if (this.getAction2() == 4) { |
|
|
|
action2 = "放货完成"; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.getWalk_y() == 0) { |
|
|
@ -943,10 +953,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
jo.put("device_name", this.getDevice().getDevice_name()); |
|
|
|
jo.put("mode", mode); |
|
|
|
jo.put("status", status); |
|
|
|
jo.put("move_1", move_1); |
|
|
|
jo.put("move_2", move_2); |
|
|
|
jo.put("action_1", action_1); |
|
|
|
jo.put("action_2", action_2); |
|
|
|
jo.put("move1", move1); |
|
|
|
jo.put("move2", move2); |
|
|
|
jo.put("action1", action1); |
|
|
|
jo.put("action2", action2); |
|
|
|
jo.put("walk_y", walk_y); |
|
|
|
if (this.getIserror()) { |
|
|
|
jo.put("error", "设备有故障"); |
|
|
@ -985,7 +995,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
} else { |
|
|
|
this.instruction_update_time = date; |
|
|
|
|
|
|
|
if (task1 > 0 && task2 > 0 && action_1 == 4 && action_2 == 4 && move_1 == 0 && move_2 == 0) { |
|
|
|
if (task1 > 0 && task2 > 0 && action1 == 4 && action2 == 4 && move1 == 0 && move2 == 0) { |
|
|
|
//inst_message
|
|
|
|
inst1 = checkInst(); |
|
|
|
if (inst1 != null) { |
|
|
@ -1008,7 +1018,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
} |
|
|
|
this.requireSucess1 = false; |
|
|
|
//单独的后工位任务
|
|
|
|
} else if (action_2 == 4 && move_2 == 0 && task2 > 0 && action_1 == 0 && move_2 == 0 && task1 == 0) { |
|
|
|
} else if (action2 == 4 && move2 == 0 && task2 > 0 && action1 == 0 && move2 == 0 && task1 == 0) { |
|
|
|
//inst_message
|
|
|
|
inst2 = checkInst(); |
|
|
|
if (inst2 != null) { |
|
|
@ -1025,7 +1035,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
|
|
|
|
} |
|
|
|
this.requireSucess1 = false; |
|
|
|
} else if (action_1 == 4 && move_1 == 0 && task1 > 0 && action_2 == 0 && move_2 == 0 && task2 == 0) { |
|
|
|
} else if (action1 == 4 && move1 == 0 && task1 > 0 && action2 == 0 && move2 == 0 && task2 == 0) { |
|
|
|
inst1 = checkInst(); |
|
|
|
if (inst1 != null) { |
|
|
|
try { |
|
|
|