|
@ -90,7 +90,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp |
|
|
private Date instruction_require_time = new Date(); |
|
|
private Date instruction_require_time = new Date(); |
|
|
private Date instruction_finished_time = new Date(); |
|
|
private Date instruction_finished_time = new Date(); |
|
|
|
|
|
|
|
|
private int instruction_require_time_out; |
|
|
private int instruction_require_time_out = 3000; |
|
|
boolean requireSucess = false; |
|
|
boolean requireSucess = false; |
|
|
boolean inrequireSucess = false; |
|
|
boolean inrequireSucess = false; |
|
|
boolean emptyrequireSucess = false; |
|
|
boolean emptyrequireSucess = false; |
|
@ -134,10 +134,11 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void execute() { |
|
|
public void execute() throws Exception { |
|
|
String message = null; |
|
|
String message = null; |
|
|
try { |
|
|
try { |
|
|
String device_code = this.getDeviceCode(); |
|
|
String device_code = this.getDeviceCode(); |
|
|
|
|
|
devicecode = this.getDeviceCode(); |
|
|
mode = this.itemProtocol.getMode(); |
|
|
mode = this.itemProtocol.getMode(); |
|
|
error = this.itemProtocol.getError(); |
|
|
error = this.itemProtocol.getError(); |
|
|
move = this.itemProtocol.getMove(); |
|
|
move = this.itemProtocol.getMove(); |
|
@ -145,12 +146,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp |
|
|
hasGoods = this.itemProtocol.getMove(); |
|
|
hasGoods = this.itemProtocol.getMove(); |
|
|
|
|
|
|
|
|
if (mode != last_mode) { |
|
|
if (mode != last_mode) { |
|
|
if (mode == 5){ |
|
|
this.setEmptyrequireSucess(false); |
|
|
this.setEmptyrequireSucess(false); |
|
|
this.setInrequireSucess(false); |
|
|
} |
|
|
|
|
|
if (mode == 6){ |
|
|
|
|
|
this.setInrequireSucess(false); |
|
|
|
|
|
} |
|
|
|
|
|
this.execute_log.setResource(this.devicecode, this.device.getDevice_name()); |
|
|
this.execute_log.setResource(this.devicecode, this.device.getDevice_name()); |
|
|
this.execute_log.log("设备:" + device_code + ",last_mode -> mode:" + last_mode + "->" + mode); |
|
|
this.execute_log.log("设备:" + device_code + ",last_mode -> mode:" + last_mode + "->" + mode); |
|
|
} |
|
|
} |
|
@ -291,10 +288,25 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp |
|
|
|
|
|
|
|
|
if (material.length() > 0 && qty.length() > 0 && !requireSucess) { |
|
|
if (material.length() > 0 && qty.length() > 0 && !requireSucess) { |
|
|
this.execute_log.log("设备:" + devicecode + ",material:" + material + ",qty:" + qty); |
|
|
this.execute_log.log("设备:" + devicecode + ",material:" + material + ",qty:" + qty); |
|
|
|
|
|
|
|
|
this.instruction_require(container); |
|
|
this.instruction_require(container); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
//申请
|
|
|
|
|
|
case 3: |
|
|
|
|
|
|
|
|
|
|
|
if (!inrequireSucess){ |
|
|
|
|
|
if (move == 1){ |
|
|
|
|
|
this.execute_log.log("设备:" + devicecode + ",move:" + move); |
|
|
|
|
|
this.apply_in_require(container); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
//取消
|
|
|
|
|
|
case 4: |
|
|
|
|
|
|
|
|
|
|
|
this.cancle_require(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 5: |
|
|
case 5: |
|
|
if (!emptyrequireSucess){ |
|
|
if (!emptyrequireSucess){ |
|
|
//mode = 5 并且工位上无货时申请空托盘
|
|
|
//mode = 5 并且工位上无货时申请空托盘
|
|
@ -438,6 +450,32 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp |
|
|
return apply_in_require(container_code, WcsConfig.task_container_type_default_desc); |
|
|
return apply_in_require(container_code, WcsConfig.task_container_type_default_desc); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 请求取消指令 |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
public synchronized boolean cancle_require() throws Exception { |
|
|
|
|
|
Date date = new Date(); |
|
|
|
|
|
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { |
|
|
|
|
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); |
|
|
|
|
|
return false; |
|
|
|
|
|
} else { |
|
|
|
|
|
this.instruction_require_time = date; |
|
|
|
|
|
List<TaskDto> taskList = taskserver.queryTaskByDeviceCode(this.devicecode); |
|
|
|
|
|
if(taskList.size() != 0){ |
|
|
|
|
|
for(int i=0;i<taskList.size();i++){ |
|
|
|
|
|
TaskDto task = taskList.get(i); |
|
|
|
|
|
Instruction inst = instructionService.findByTaskCodeFromCache(task.getTask_code()); |
|
|
|
|
|
if(ObjectUtil.isNotEmpty(inst)){ |
|
|
|
|
|
instructionService.cancel(inst.getInstruction_id()); |
|
|
|
|
|
} |
|
|
|
|
|
taskserver.cancel(task.getTask_id()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 请求指令 |
|
|
* 请求指令 |
|
|