|
|
@ -12,8 +12,13 @@ import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; |
|
|
|
import org.nl.acs.device.service.DeviceService; |
|
|
|
import org.nl.acs.device_driver.DeviceDriver; |
|
|
|
import org.nl.acs.device_driver.RouteableDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.lnsh.lnsh_package_site.LnshPackageSiteDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver; |
|
|
|
import org.nl.acs.instruction.service.InstructionService; |
|
|
|
import org.nl.acs.instruction.service.dto.Instruction; |
|
|
|
import org.nl.acs.log.service.DeviceExecuteLogService; |
|
|
@ -296,38 +301,201 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
update_instruction_status(); |
|
|
|
} |
|
|
|
|
|
|
|
//双任务下 后工位取货完成,然后给前工位下发取满盘任务取货命令
|
|
|
|
if (mode == 3 && action_2 == 2 && action_1 == 0 && move_2 != 0 && move_1 == 0 && task2 > 0 && to_task1 > 0 && to_task2 > 0) { |
|
|
|
if (to_command1 != 1) { |
|
|
|
writing("to_command1", "1"); |
|
|
|
//前工位取货时判断取货位光电信号
|
|
|
|
if (mode == 3 && error == 0 && status != 3 && action_1 == 1 && move_1 == 0 && task1 > 0 && action_2 != 1) { |
|
|
|
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); |
|
|
|
String start_device_code = inst1.getStart_device_code(); |
|
|
|
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code); |
|
|
|
if (startDevice.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) { |
|
|
|
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)) { |
|
|
|
this.writing("to_command1", "2"); |
|
|
|
driver.setMessage(""); |
|
|
|
logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", "允许RGV前工位取货。"); |
|
|
|
} else { |
|
|
|
String msg = ""; |
|
|
|
if (driver.getMode() == 0) { |
|
|
|
msg += "站点未联机,"; |
|
|
|
} else { |
|
|
|
if (driver.getMove() == 0) { |
|
|
|
msg += "站点无货,"; |
|
|
|
} |
|
|
|
if (driver.getIo_action() != 3 && driver.getIo_action() != 1) { |
|
|
|
msg += "站点不允许进入,"; |
|
|
|
} |
|
|
|
if (driver.getAction() != 3 && driver.getAction() != 1) { |
|
|
|
msg += "站点不允许取货,"; |
|
|
|
} |
|
|
|
|
|
|
|
//双任务下发 前后工位取货完成 给后工位放货命令
|
|
|
|
if (mode == 3 && action_2 == 2 && action_1 == 2 && move_2 != 0 && move_1 != 0 && task2 > 0 && task1 > 0) { |
|
|
|
if (to_command2 != 2) { |
|
|
|
writing("to_command2", "2"); |
|
|
|
} |
|
|
|
msg += "不允许RGV前工位取货。"; |
|
|
|
driver.setMessage(msg); |
|
|
|
logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", msg); |
|
|
|
} |
|
|
|
} else if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
this.writing("to_command1", "2"); |
|
|
|
logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", "允许RGV前工位取货。"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//双任务下发 后工位放货完成 给前工位下发放货
|
|
|
|
if (mode == 3 && action_2 == 4 && action_1 == 2 && move_2 == 0 && move_1 != 0 && task2 > 0 && task1 > 0) { |
|
|
|
if (to_command1 != 2) { |
|
|
|
writing("to_command1", "2"); |
|
|
|
//前工位放货时判断放货位光电信号
|
|
|
|
if (mode == 3 && error == 0 && status != 3 && action_1 == 3 && move_1 != 0 && task1 > 0 && action_2 != 3) { |
|
|
|
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); |
|
|
|
String next_device_code = inst1.getNext_device_code(); |
|
|
|
Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code); |
|
|
|
if (nextDevice.getDeviceDriver() instanceof LnshStationDeviceDriver) { |
|
|
|
LnshStationDeviceDriver driver = (LnshStationDeviceDriver) nextDevice.getDeviceDriver(); |
|
|
|
if (driver.getMode() != 0 |
|
|
|
&& driver.getMove() == 0 |
|
|
|
&& (driver.getAction() == 2 || driver.getAction() == 3) |
|
|
|
&& (driver.getIo_action() == 1 || driver.getIo_action() == 3)) { |
|
|
|
this.writing("to_command1", "3"); |
|
|
|
driver.setMessage(""); |
|
|
|
logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", "允许RGV前工位放货。"); |
|
|
|
} else { |
|
|
|
String msg = ""; |
|
|
|
if (driver.getMode() == 0) { |
|
|
|
msg += "站点未联机,"; |
|
|
|
} else { |
|
|
|
if (driver.getMove() != 0) { |
|
|
|
msg += "站点有货,"; |
|
|
|
} |
|
|
|
if (driver.getIo_action() != 1 && driver.getIo_action() != 3) { |
|
|
|
msg += "站点不允许进入,"; |
|
|
|
} |
|
|
|
if (driver.getAction() != 2 && driver.getAction() != 3) { |
|
|
|
msg += "站点不允许放货,"; |
|
|
|
} |
|
|
|
} |
|
|
|
msg += "不允许RGV前工位放货。"; |
|
|
|
driver.setMessage(msg); |
|
|
|
logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", msg); |
|
|
|
} |
|
|
|
} else if (nextDevice.getDeviceDriver() instanceof LnshPackageSiteDeviceDriver) { |
|
|
|
LnshPackageSiteDeviceDriver driver = (LnshPackageSiteDeviceDriver) nextDevice.getDeviceDriver(); |
|
|
|
if (driver.getMode() != 0 |
|
|
|
&& driver.getMove() == 0 |
|
|
|
&& (driver.getAction() == 2 || driver.getAction() == 3) |
|
|
|
&& (driver.getIoaction() == 1 || driver.getIoaction() == 3)) { |
|
|
|
this.writing("to_command1", "3"); |
|
|
|
driver.setMessage(""); |
|
|
|
logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", "允许RGV前工位放货。"); |
|
|
|
} else { |
|
|
|
String msg = ""; |
|
|
|
if (driver.getMode() == 0) { |
|
|
|
msg += "站点未联机,"; |
|
|
|
} else { |
|
|
|
if (driver.getMove() != 0) { |
|
|
|
msg += "站点有货,"; |
|
|
|
} |
|
|
|
if (driver.getIoaction() != 1 && driver.getIoaction() != 3) { |
|
|
|
msg += "站点不允许进入,"; |
|
|
|
} |
|
|
|
if (driver.getAction() != 2 && driver.getAction() != 3) { |
|
|
|
msg += "站点不允许放货,"; |
|
|
|
} |
|
|
|
} |
|
|
|
msg += "不允许RGV前工位放货。"; |
|
|
|
driver.setMessage(msg); |
|
|
|
logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", msg); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//后工位单任务下发 空托或者半托缓存任务
|
|
|
|
if (mode == 3 && action_2 == 2 && action_1 == 0 && move_2 > 0 && move_1 == 0 && task2 > 0 && task1 == 0 && to_task1 == 0) { |
|
|
|
if (to_command2 != 2) { |
|
|
|
writing("to_command2", "2"); |
|
|
|
//后工位取货时判断取货位光电信号
|
|
|
|
if (mode == 3 && error == 0 && status != 3 && action_2 == 1 && move_2 == 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); |
|
|
|
if (startDevice.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) { |
|
|
|
LnshLaminatingMachineDeviceDriver driver = (LnshLaminatingMachineDeviceDriver) startDevice.getDeviceDriver(); |
|
|
|
if (driver.getMode() != 0 |
|
|
|
&& driver.getMove() != 0) { |
|
|
|
this.writing("to_command2", "2"); |
|
|
|
driver.setMessage(""); |
|
|
|
logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", "允许RGV后工位取货。"); |
|
|
|
} else { |
|
|
|
String msg = ""; |
|
|
|
if (driver.getMode() == 0) { |
|
|
|
msg += "站点未联机,"; |
|
|
|
} else { |
|
|
|
if (driver.getMove() == 0) { |
|
|
|
msg += "站点无货,"; |
|
|
|
} |
|
|
|
} |
|
|
|
msg += "不允许RGV后工位取货。"; |
|
|
|
driver.setMessage(msg); |
|
|
|
logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", msg); |
|
|
|
} |
|
|
|
} else if (startDevice.getDeviceDriver() instanceof LnshStationDeviceDriver) { |
|
|
|
LnshStationDeviceDriver driver = (LnshStationDeviceDriver) startDevice.getDeviceDriver(); |
|
|
|
if (driver.getMode() != 0 |
|
|
|
&& driver.getMove() != 0 |
|
|
|
&& (driver.getIo_action() == 3 || driver.getIo_action() == 1) |
|
|
|
&& (driver.getAction() == 3 || driver.getAction() == 1)) { |
|
|
|
this.writing("to_command2", "2"); |
|
|
|
driver.setMessage(""); |
|
|
|
logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", "允许RGV后工位取货。"); |
|
|
|
} else { |
|
|
|
String msg = ""; |
|
|
|
if (driver.getMode() == 0) { |
|
|
|
msg += "站点未联机,"; |
|
|
|
} else { |
|
|
|
if (driver.getMove() == 0) { |
|
|
|
msg += "站点无货,"; |
|
|
|
} |
|
|
|
if (driver.getIo_action() != 3 && driver.getIo_action() != 1) { |
|
|
|
msg += "站点不允许进入,"; |
|
|
|
} |
|
|
|
if (driver.getAction() != 3 && driver.getAction() != 1) { |
|
|
|
msg += "站点不允许取货,"; |
|
|
|
} |
|
|
|
} |
|
|
|
msg += "不允许RGV后工位取货。"; |
|
|
|
driver.setMessage(msg); |
|
|
|
logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", msg); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//前工位单任务下发 强制包装的任务
|
|
|
|
if (mode == 3 && action_1 == 2 && action_2 == 0 && move_1 > 0 && move_2 == 0 && task1 > 0 && task2 == 0 && to_task2 == 0) { |
|
|
|
if (to_command1 != 2) { |
|
|
|
writing("to_command1", "2"); |
|
|
|
//后工位放货时判断放货位光电信号
|
|
|
|
if (mode == 3 && error == 0 && status != 3 && action_2 == 3 && move_2 != 0 && task2 > 0 && action_1 != 1) { |
|
|
|
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2)); |
|
|
|
String next_device_code = inst1.getNext_device_code(); |
|
|
|
Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code); |
|
|
|
if (nextDevice.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) { |
|
|
|
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)) { |
|
|
|
this.writing("to_command2", "3"); |
|
|
|
driver.setMessage(""); |
|
|
|
logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", "允许RGV后工位放货。"); |
|
|
|
} else { |
|
|
|
String msg = ""; |
|
|
|
if (driver.getMode() == 0) { |
|
|
|
msg += "站点未联机,"; |
|
|
|
} else { |
|
|
|
if (driver.getMove() != 0) { |
|
|
|
msg += "站点有货,"; |
|
|
|
} |
|
|
|
if (driver.getIo_action() != 1 && driver.getIo_action() != 3) { |
|
|
|
msg += "站点不允许进入,"; |
|
|
|
} |
|
|
|
if (driver.getAction() != 2 && driver.getAction() != 3) { |
|
|
|
msg += "站点不允许放货,"; |
|
|
|
} |
|
|
|
} |
|
|
|
msg += "不允许RGV后工位放货。"; |
|
|
|
driver.setMessage(msg); |
|
|
|
logServer.deviceExecuteLog(device_code, "", "", msg); |
|
|
|
} |
|
|
|
} else if (nextDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
this.writing("to_command2", "3"); |
|
|
|
logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", "允许RGV后工位放货。"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -496,10 +664,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi |
|
|
|
sendHeadBackSignalType(instdto); |
|
|
|
requireSucess1 = true; |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请前后工位任务成功,requireSucess1" + requireSucess1 + ",指令号:" + instdto.getInstruction_code()); |
|
|
|
if(ObjectUtil.isNotEmpty(start_device_code)){ |
|
|
|
writing("to_command1", "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"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
//申请后工位任务
|
|
|
|