更新
This commit is contained in:
@@ -160,52 +160,52 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
qty = this.itemProtocol.getQty();
|
||||
|
||||
if (mode != last_mode) {
|
||||
logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode);
|
||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
||||
}
|
||||
if (error != last_error) {
|
||||
logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
|
||||
}
|
||||
if (status != last_status) {
|
||||
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status);
|
||||
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 (move_1 == 0) {
|
||||
this.setRequireSucess1(false);
|
||||
}
|
||||
}
|
||||
if (move_2 != last_move_2) {
|
||||
if(move_2 == 0){
|
||||
if (move_2 == 0) {
|
||||
this.setRequireSucess2(false);
|
||||
}
|
||||
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, "move_1", String.valueOf(move_1));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move_1:" + last_move_1 + "->" + move_1);
|
||||
}
|
||||
if (move_2 != last_move_2) {
|
||||
logServer.deviceItemValue(this.device_code,"move_2" ,String.valueOf(move_2));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号move_2:" + last_move_2 + "->" + move_2);
|
||||
logServer.deviceItemValue(this.device_code, "move_2", String.valueOf(move_2));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move_2:" + last_move_2 + "->" + move_2);
|
||||
}
|
||||
if (action_1 != last_action_1) {
|
||||
logServer.deviceItemValue(this.device_code,"action_1" ,String.valueOf(action_1));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号action_1:" + last_action_1 + "->" + action_1);
|
||||
logServer.deviceItemValue(this.device_code, "action_1", String.valueOf(action_1));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号action_1:" + last_action_1 + "->" + action_1);
|
||||
}
|
||||
if (action_2 != last_action_2) {
|
||||
logServer.deviceItemValue(this.device_code,"action_2" ,String.valueOf(action_2));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号action_2:" + last_action_2 + "->" + action_2);
|
||||
logServer.deviceItemValue(this.device_code, "action_2", String.valueOf(action_2));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号action_2:" + last_action_2 + "->" + action_2);
|
||||
}
|
||||
if (walk_y != last_walk_y) {
|
||||
logServer.deviceItemValue(this.device_code,"walk_y" ,String.valueOf(walk_y));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号walk_y:" + last_walk_y + "->" + walk_y);
|
||||
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y:" + last_walk_y + "->" + walk_y);
|
||||
}
|
||||
if (task1 != last_task1) {
|
||||
logServer.deviceItemValue(this.device_code,"task1" ,String.valueOf(task1));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号task1:" + last_task1 + "->" + task1);
|
||||
logServer.deviceItemValue(this.device_code, "task1", String.valueOf(task1));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task1:" + last_task1 + "->" + task1);
|
||||
}
|
||||
if (task2 != last_task2) {
|
||||
logServer.deviceItemValue(this.device_code,"task2" ,String.valueOf(task2));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号task2:" + last_task2 + "->" + task2);
|
||||
logServer.deviceItemValue(this.device_code, "task2", String.valueOf(task2));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task2:" + last_task2 + "->" + task2);
|
||||
}
|
||||
// if (open_time != last_open_time) {
|
||||
// logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time));
|
||||
@@ -224,24 +224,24 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
// logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time);
|
||||
// }
|
||||
if (task_qty != last_task_qty) {
|
||||
logServer.deviceItemValue(this.device_code,"task_qty" ,String.valueOf(task_qty));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号task_qty:" + last_task_qty + "->" + task_qty);
|
||||
logServer.deviceItemValue(this.device_code, "task_qty", String.valueOf(task_qty));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task_qty:" + last_task_qty + "->" + task_qty);
|
||||
}
|
||||
if (finishTask_qty != last_finishTask_qty) {
|
||||
logServer.deviceItemValue(this.device_code,"finishTask_qty" ,String.valueOf(finishTask_qty));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号finishTask_qty:" + last_finishTask_qty + "->" + finishTask_qty);
|
||||
logServer.deviceItemValue(this.device_code, "finishTask_qty", String.valueOf(finishTask_qty));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号finishTask_qty:" + last_finishTask_qty + "->" + finishTask_qty);
|
||||
}
|
||||
if (batch != last_batch) {
|
||||
logServer.deviceItemValue(this.device_code,"batch" ,String.valueOf(batch));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号batch:" + last_batch + "->" + batch);
|
||||
logServer.deviceItemValue(this.device_code, "batch", String.valueOf(batch));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号batch:" + last_batch + "->" + batch);
|
||||
}
|
||||
if (qty != last_qty) {
|
||||
logServer.deviceItemValue(this.device_code,"qty" ,String.valueOf(qty));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号qty:" + last_qty + "->" + qty);
|
||||
logServer.deviceItemValue(this.device_code, "qty", String.valueOf(qty));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号qty:" + last_qty + "->" + qty);
|
||||
}
|
||||
if (!StrUtil.equals(specifications,last_specifications)) {
|
||||
logServer.deviceItemValue(this.device_code,"specifications" ,specifications);
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号specifications:" + last_specifications + "->" + specifications);
|
||||
if (!StrUtil.equals(specifications, last_specifications)) {
|
||||
logServer.deviceItemValue(this.device_code, "specifications", specifications);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号specifications:" + last_specifications + "->" + specifications);
|
||||
}
|
||||
|
||||
|
||||
@@ -255,16 +255,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( action_1 == 4 && move_1 == 0 && task1 > 0) {
|
||||
if (action_1 == 4 && move_1 == 0 && task1 > 0) {
|
||||
//inst_message
|
||||
inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
|
||||
if (inst1 != null) {
|
||||
if (StrUtil.equals(inst1.getInstruction_status(), "1")) {
|
||||
finish_instruction(inst1);
|
||||
writing("to_command1","0");
|
||||
writing("to_onset1","0");
|
||||
writing("to_target1","0");
|
||||
writing("to_task1","0");
|
||||
writing("to_command1", "0");
|
||||
writing("to_onset1", "0");
|
||||
writing("to_target1", "0");
|
||||
writing("to_task1", "0");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -280,16 +280,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( action_2 == 4 && move_2 == 0 && task2 > 0) {
|
||||
if (action_2 == 4 && move_2 == 0 && task2 > 0) {
|
||||
//inst_message
|
||||
inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
|
||||
if (inst2 != null) {
|
||||
if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
|
||||
finish_instruction(inst2);
|
||||
writing("to_command2","0");
|
||||
writing("to_onset2","0");
|
||||
writing("to_target2","0");
|
||||
writing("to_task2","0");
|
||||
writing("to_command2", "0");
|
||||
writing("to_onset2", "0");
|
||||
writing("to_target2", "0");
|
||||
writing("to_task2", "0");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -297,23 +297,23 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
|
||||
//执行双任务下的业务逻辑
|
||||
//给后工位下发空盘放货信号
|
||||
if(mode ==3 && action_1 == 2 && action_2 == 2 && move_1 != 0 && move_2 != 0 && task1>0 && task2>0 ){
|
||||
writing("to_command2","2");
|
||||
if (mode == 3 && action_1 == 2 && action_2 == 2 && move_1 != 0 && move_2 != 0 && task1 > 0 && task2 > 0) {
|
||||
writing("to_command2", "2");
|
||||
}
|
||||
//给前工位下发放货信号
|
||||
if(mode ==3 && action_2 == 4 && move_1 != 0 && move_2 == 0 && task1>0 ){
|
||||
writing("to_command1","2");
|
||||
if (mode == 3 && action_2 == 4 && move_1 != 0 && move_2 == 0 && task1 > 0) {
|
||||
writing("to_command1", "2");
|
||||
}
|
||||
|
||||
//执行单任务下的业务逻辑
|
||||
//给后工位下发空盘放货信号
|
||||
//判断条件 前工位无任务、无货 后工位有任务取货完成
|
||||
if(mode == 3 && action_2 == 2 && move_2 != 0 && move_1 == 0 && ObjectUtil.isNotEmpty(inst2) && ObjectUtil.isEmpty(inst1) ){
|
||||
writing("to_command2","2");
|
||||
if (mode == 3 && action_2 == 2 && move_2 != 0 && move_1 == 0 && task2 > 0 && task1 == 0) {
|
||||
writing("to_command2", "2");
|
||||
}
|
||||
//给前工位取满托下发放货信号
|
||||
if(mode == 3 && action_1 == 2 && move_1 != 0 && move_2 == 0 && task1>0 && ObjectUtil.isNotEmpty(inst1) && ObjectUtil.isEmpty(inst2) ){
|
||||
writing("to_command1","2");
|
||||
if (mode == 3 && action_1 == 2 && move_1 != 0 && move_2 == 0 && task1 > 0 && task2 == 0) {
|
||||
writing("to_command1", "2");
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
@@ -347,10 +347,11 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
return;
|
||||
case 2:
|
||||
//后工位申请任务
|
||||
if (mode == 2 && move_2 == 0 && action_2 == 0 && !requireSucess2) {
|
||||
if (mode == 2 && move_2 == 0 && action_2 == 0 && !requireSucess2) {
|
||||
instruction_require2();
|
||||
}
|
||||
if (mode == 2 && move_2 == 0 && action_2 == 0 && move_1 == 0 && ObjectUtil.isEmpty(inst2) && !requireSucess1){
|
||||
//前工位申请任务
|
||||
if (mode == 2 && move_2 == 0 && action_2 == 0 && move_1 == 0 && task2 == 0 && !requireSucess1) {
|
||||
instruction_require();
|
||||
}
|
||||
break;
|
||||
@@ -404,8 +405,8 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_apply_time = date;
|
||||
String linkobj = (String)this.getDevice().getExtraValue().get("get_device_code1");
|
||||
String demosub = linkobj.substring(1,linkobj.length()-1);
|
||||
String linkobj = (String) this.getDevice().getExtraValue().get("get_device_code1");
|
||||
String demosub = linkobj.substring(1, linkobj.length() - 1);
|
||||
String demoArray[] = demosub.split(",");
|
||||
List<String> device_code_list = Arrays.asList(demoArray);
|
||||
TaskDto task = null;
|
||||
@@ -413,7 +414,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
if (ObjectUtil.isNotEmpty(taskserver.queryTaskByDeviceCode(device_code_list.get(i).replace("\"", "")))) {
|
||||
task = taskserver.queryTaskByDeviceCode(device_code_list.get(i).replace("\"", "")).get(0);
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(task)) break;
|
||||
if (ObjectUtil.isNotEmpty(task)) break;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
String taskid = task.getTask_id();
|
||||
@@ -466,10 +467,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
String start_addr = startdevice.getExtraValue().get("OPCServer").toString();
|
||||
String next_addr = nextdevice.getExtraValue().get("OPCServer").toString();
|
||||
|
||||
writing("to_command1","1");
|
||||
writing("to_onset1",start_addr);
|
||||
writing("to_target1",next_addr);
|
||||
writing("to_task1",instdto.getInstruction_code());
|
||||
writing("to_command1", "1");
|
||||
writing("to_onset1", start_addr);
|
||||
writing("to_target1", next_addr);
|
||||
writing("to_task1", instdto.getInstruction_code());
|
||||
|
||||
|
||||
} else {
|
||||
@@ -487,16 +488,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_apply_time = date;
|
||||
String linkobj = (String)this.getDevice().getExtraValue().get("get_device_code2");
|
||||
String demosub = linkobj.substring(1,linkobj.length()-1);
|
||||
String linkobj = (String) this.getDevice().getExtraValue().get("get_device_code2");
|
||||
String demosub = linkobj.substring(1, linkobj.length() - 1);
|
||||
String demoArray[] = demosub.split(",");
|
||||
List<String> device_code_list = Arrays.asList(demoArray);
|
||||
TaskDto task = null;
|
||||
for(int i=0;i<device_code_list.size();i++){
|
||||
for (int i = 0; i < device_code_list.size(); i++) {
|
||||
if (ObjectUtil.isNotEmpty(taskserver.queryTaskByDeviceCode(device_code_list.get(i).replace("\"", "")))) {
|
||||
task = taskserver.queryTaskByDeviceCode(device_code_list.get(i).replace("\"", "")).get(0);
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(task)) break;
|
||||
if (ObjectUtil.isNotEmpty(task)) break;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
String taskid = task.getTask_id();
|
||||
@@ -549,10 +550,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
String start_addr = startdevice.getExtraValue().get("OPCServer").toString();
|
||||
String next_addr = nextdevice.getExtraValue().get("OPCServer").toString();
|
||||
|
||||
writing("to_command2","1");
|
||||
writing("to_onset2",start_addr);
|
||||
writing("to_target2",next_addr);
|
||||
writing("to_task2",instdto.getInstruction_code());
|
||||
writing("to_command2", "1");
|
||||
writing("to_onset2", start_addr);
|
||||
writing("to_target2", next_addr);
|
||||
writing("to_task2", instdto.getInstruction_code());
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user