更新
This commit is contained in:
@@ -93,6 +93,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
private int instruction_require_time_out;
|
private int instruction_require_time_out;
|
||||||
boolean requireSucess = false;
|
boolean requireSucess = false;
|
||||||
boolean inrequireSucess = false;
|
boolean inrequireSucess = false;
|
||||||
|
boolean emptyrequireSucess = false;
|
||||||
|
|
||||||
private int instruction_finished_time_out;
|
private int instruction_finished_time_out;
|
||||||
|
|
||||||
@@ -110,6 +111,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
//上次指令
|
//上次指令
|
||||||
Instruction last_inst = null;
|
Instruction last_inst = null;
|
||||||
|
|
||||||
|
Object object = new Object();
|
||||||
//触摸屏手动触发任务
|
//触摸屏手动触发任务
|
||||||
private Boolean is_has_task = false;
|
private Boolean is_has_task = false;
|
||||||
|
|
||||||
@@ -141,7 +143,12 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
hasGoods = this.itemProtocol.getMove();
|
hasGoods = this.itemProtocol.getMove();
|
||||||
|
|
||||||
if (mode != last_mode) {
|
if (mode != last_mode) {
|
||||||
this.setRequireSucess(false);
|
if (mode == 5){
|
||||||
|
this.setEmptyrequireSucess(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);
|
||||||
}
|
}
|
||||||
@@ -226,6 +233,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
message = "";
|
message = "";
|
||||||
Instruction instruction = null;
|
Instruction instruction = null;
|
||||||
List toInstructions;
|
List toInstructions;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 1:
|
case 1:
|
||||||
log.debug("设备运转模式:等待工作");
|
log.debug("设备运转模式:等待工作");
|
||||||
@@ -285,15 +293,15 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
this.instruction_require(container);
|
this.instruction_require(container);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
if (!requireSucess){
|
if (!emptyrequireSucess){
|
||||||
//mode = 5 并且工位上无货时申请空托盘
|
//mode = 5 并且工位上无货时申请空托盘
|
||||||
if (move == 0){
|
if (move == 0){
|
||||||
this.execute_log.log("设备:" + devicecode + ",move:" + move);
|
this.execute_log.log("设备:" + devicecode + ",move:" + move);
|
||||||
this.apply_empty_require(container);
|
this.apply_empty_require(container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if (!inrequireSucess){
|
if (!inrequireSucess){
|
||||||
if (move == 1){
|
if (move == 1){
|
||||||
@@ -301,6 +309,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
this.apply_in_require(container);
|
this.apply_in_require(container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
@@ -420,10 +429,10 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
public boolean instruction_require(String container_code) {
|
public boolean instruction_require(String container_code) {
|
||||||
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
|
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
|
||||||
}
|
}
|
||||||
public boolean apply_empty_require(String container_code) {
|
public synchronized boolean apply_empty_require(String container_code) {
|
||||||
return apply_empty_require(container_code, WcsConfig.task_container_type_default_desc);
|
return apply_empty_require(container_code, WcsConfig.task_container_type_default_desc);
|
||||||
}
|
}
|
||||||
public boolean apply_in_require(String container_code) {
|
public synchronized boolean apply_in_require(String container_code) {
|
||||||
return apply_in_require(container_code, WcsConfig.task_container_type_default_desc);
|
return apply_in_require(container_code, WcsConfig.task_container_type_default_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,12 +475,12 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
if (num != 0) {
|
if (num != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//判断检测站点是否锁定,如果锁定就结束本次循环
|
/* //判断检测站点是否锁定,如果锁定就结束本次循环
|
||||||
JSONObject jsonObject = runpointwo.query("device_code = '" + next_device_code + "' and islock = '1'").uniqueResult(0);
|
JSONObject jsonObject = runpointwo.query("device_code = '" + next_device_code + "' and islock = '1'").uniqueResult(0);
|
||||||
if (ObjectUtil.isNotEmpty(jsonObject)) {
|
if (ObjectUtil.isNotEmpty(jsonObject)) {
|
||||||
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备," + next_device_code + "已锁定");
|
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备," + next_device_code + "已锁定");
|
||||||
continue;
|
continue;
|
||||||
}
|
}*/
|
||||||
//创建任务
|
//创建任务
|
||||||
TaskDto dto = new TaskDto();
|
TaskDto dto = new TaskDto();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
@@ -492,12 +501,12 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
dto.setNext_point_code(next_device_code);
|
dto.setNext_point_code(next_device_code);
|
||||||
try {
|
try {
|
||||||
taskserver.create(dto);
|
taskserver.create(dto);
|
||||||
//任务创建成功 锁定终点设备
|
/* //任务创建成功 锁定终点设备
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("islock", "1");
|
map.put("islock", "true");
|
||||||
map.put("update_by", "auto");
|
map.put("update_by", "auto");
|
||||||
map.put("update_time", DateUtil.now());
|
map.put("update_time", DateUtil.now());
|
||||||
runpointwo.update(map, "device_code = '" + next_device_code + "'");
|
runpointwo.update(map, "device_code = '" + next_device_code + "'");*/
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -508,7 +517,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
|
|
||||||
//生成任务成功
|
//生成任务成功
|
||||||
if (flag) {
|
if (flag) {
|
||||||
requireSucess = false;
|
inrequireSucess = true;
|
||||||
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备,生成任务成功已锁定");
|
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备,生成任务成功已锁定");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -546,24 +555,31 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
if (route_link_device.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver){
|
if (route_link_device.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver){
|
||||||
standardEmptyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) route_link_device.getDeviceDriver();
|
standardEmptyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) route_link_device.getDeviceDriver();
|
||||||
// TODO 判断堆叠位是否有货,没货就结束本次循环
|
// TODO 判断堆叠位是否有货,没货就结束本次循环
|
||||||
if (standardEmptyPalletSiteDeviceDriver.getMove() != 1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//判断堆叠位的数量是否大于0,如果=0就结束本次循环
|
//判断堆叠位的数量是否大于0,如果=0就结束本次循环
|
||||||
if (standardEmptyPalletSiteDeviceDriver.getNumber() == 0){
|
if (standardEmptyPalletSiteDeviceDriver.getMove() != 1 || standardEmptyPalletSiteDeviceDriver.getNumber() == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//判断是否已经有到该终点设备的任务,如果有就结束循环
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
//判断是否已经有该起点设备的任务,如果有就结束循环
|
||||||
int num = taskserver.querySameOriginTask(start_device_code);
|
int num = taskserver.querySameOriginTask(start_device_code);
|
||||||
if (num != 0) {
|
if (num != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//判断终点是否锁定,如果被锁定就结束循环
|
//判断是否已经有到该起点设备的任务,如果有就结束循环
|
||||||
JSONObject jsonObject = runpointwo.query("device_code = '" + next_device_code + "' and islock = '1'").uniqueResult(0);
|
int num1 = taskserver.querySameDestinationTask(next_device_code);
|
||||||
|
if (num1 != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* //判断起点是否锁定,如果被锁定就结束循环
|
||||||
|
JSONObject jsonObject = runpointwo.query("device_code = '" + next_device_code + "' and islock = 'true'").uniqueResult(0);
|
||||||
if (ObjectUtil.isNotEmpty(jsonObject)) {
|
if (ObjectUtil.isNotEmpty(jsonObject)) {
|
||||||
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备," + next_device_code + "已锁定");
|
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备," + next_device_code + "已锁定");
|
||||||
continue;
|
continue;
|
||||||
}
|
}*/
|
||||||
//创建任务
|
//创建任务
|
||||||
TaskDto dto = new TaskDto();
|
TaskDto dto = new TaskDto();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
@@ -586,10 +602,10 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
taskserver.create(dto);
|
taskserver.create(dto);
|
||||||
//任务创建成功 锁定该终点设备
|
//任务创建成功 锁定该终点设备
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("islock", "1");
|
map.put("islock", "true");
|
||||||
map.put("update_by", "auto");
|
map.put("update_by", "auto");
|
||||||
map.put("update_time", DateUtil.now());
|
map.put("update_time", DateUtil.now());
|
||||||
runpointwo.update(map, "device_code = '" + next_device_code + "'");
|
runpointwo.update(map, "device_code = '" + start_device_code + "'");
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -600,7 +616,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
|
|
||||||
//生成任务成功
|
//生成任务成功
|
||||||
if (flag) {
|
if (flag) {
|
||||||
requireSucess = false;
|
emptyrequireSucess = true;
|
||||||
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备,生成任务成功已锁定");
|
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备,生成任务成功已锁定");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user