This commit is contained in:
USER-20220102CG\noblelift
2023-08-01 13:48:11 +08:00
parent 4725294230
commit 6ccfd5eceb
3 changed files with 64 additions and 103 deletions

View File

@@ -143,6 +143,9 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
int to_target2 =0;
int to_task2 =0;
int to_container_type = 0;
int last_to_container_type = 0;
int last_to_command2 =0;
int last_to_oneset2 =0;
int last_to_target2 =0;
@@ -200,7 +203,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
to_command2 = this.itemProtocol.getTo_command2();
to_oneset2 = this.itemProtocol.getTo_onset2();
to_target2 = this.itemProtocol.getTo_target2();
to_container_type = this.itemProtocol.getTo_container_type();
if (mode != last_mode) {
if(mode==2){
inst = null;
@@ -213,6 +216,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (to_container_type != to_container_type) {
logServer.deviceItemValue(this.device_code, "to_container_type", String.valueOf(to_container_type));
logServer.deviceExecuteLog(this.device_code, "", "", "信号container_type" + last_to_container_type + "->" + to_container_type);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
@@ -234,143 +241,70 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
this.setRequireSucess2(false);
logServer.deviceExecuteLog(this.device_code, "", "", "后工位有货变无货复位后工位请求标记requireSucess2:" + requireSucess2);
}
logServer.deviceItemValue(this.device_code, "move_2", String.valueOf(move_2));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move_2" + last_move_2 + "->" + 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.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.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.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.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.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));
// logServer.deviceExecuteLog(this.device_code,"","","信号open_time" + last_open_time + "->" + open_time);
// }
// if (standby_time != last_standby_time) {
// logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time));
// logServer.deviceExecuteLog(this.device_code,"","","信号standby_time" + last_standby_time + "->" + standby_time);
// }
// if (production_time != last_production_time) {
// logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time));
// logServer.deviceExecuteLog(this.device_code,"","","信号production_time" + last_production_time + "->" + production_time);
// }
// if (error_time != last_error_time) {
// logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time));
// 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.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.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.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.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);
// logServer.deviceExecuteLog(this.device_code, "", "", "信号specifications" + last_specifications + "->" + specifications);
}
if (to_task1 != last_to_task1) {
logServer.deviceItemValue(this.device_code, "to_task1",String.valueOf(to_task1));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task1" + last_to_task1 + "->" + to_task1);
// logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task1" + last_to_task1 + "->" + to_task1);
}
if (to_target1 != last_to_target1) {
logServer.deviceItemValue(this.device_code, "to_task1",String.valueOf(to_target1));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target1" + last_to_target1 + "->" + to_target1);
// logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target1" + last_to_target1 + "->" + to_target1);
}
if (to_oneset1 != last_to_oneset1) {
logServer.deviceItemValue(this.device_code, "to_task1",String.valueOf(to_oneset1));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_oneset1" + last_to_oneset1 + "->" + to_oneset1);
// logServer.deviceExecuteLog(this.device_code, "", "", "信号to_oneset1" + last_to_oneset1 + "->" + to_oneset1);
}
if (to_command1 != last_to_command1) {
logServer.deviceItemValue(this.device_code, "to_task1",String.valueOf(to_command1));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command1" + last_to_command1 + "->" + to_command1);
// logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command1" + last_to_command1 + "->" + to_command1);
}
if (to_task2 != last_to_task2) {
logServer.deviceItemValue(this.device_code, "to_task1",String.valueOf(to_task2));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task2" + last_to_task2 + "->" + to_task2);
// logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task2" + last_to_task2 + "->" + to_task2);
}
if (to_target2 != last_to_target2) {
logServer.deviceItemValue(this.device_code, "to_task2",String.valueOf(to_task2));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target2" + last_to_target2 + "->" + to_target2);
// logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target2" + last_to_target2 + "->" + to_target2);
}
if (to_oneset2 != last_to_oneset2) {
logServer.deviceItemValue(this.device_code, "to_task2",String.valueOf(to_oneset2));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_oneset2" + last_to_oneset2 + "->" + to_oneset2);
// logServer.deviceExecuteLog(this.device_code, "", "", "信号to_oneset2" + last_to_oneset2 + "->" + to_oneset2);
}
if (to_command2 != last_to_command2) {
logServer.deviceItemValue(this.device_code, "to_command2",String.valueOf(to_command2));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command2" + last_to_command2 + "->" + to_command2);
// logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command2" + last_to_command2 + "->" + to_command2);
}
// if (move_1 == 0 && task1 == 0) {
// this.setRequireSucess1(false);
// logServer.deviceExecuteLog(this.device_code, "", "", "前工位无货且无任务复位前工位请求标记requireSucess1:" + requireSucess1);
// }
// if (move_2 == 0 && task2 == 0) {
// this.setRequireSucess2(false);
// logServer.deviceExecuteLog(this.device_code, "", "", "后工位无货且无任务复位后工位请求标记requireSucess2:" + requireSucess1);
// }
if(task1 > 0 || task2 > 0){
update_instruction_status();
}
// //执行双任务下的业务逻辑
// //给后工位下发空盘放货信号
// if (mode == 3 && action_1 == 2 && action_2 == 2 && move_1 != 0 && move_2 != 0 && task1 > 0 && task2 > 0) {
// if(to_command2 !=2 ){
// writing("to_command2", "2");
// }
// }
// //给前工位下发放货信号
// if (mode == 3 && action_2 == 4 && move_1 != 0 && move_2 == 0 && task1 > 0) {
// if(to_command2 !=2 ) {
// writing("to_command1", "2");
// }
// }
//
// //执行单任务下的业务逻辑
// //给后工位下发空盘放货信号
// //判断条件 前工位无任务、无货 后工位有任务取货完成
// if (mode == 3 && action_2 == 2 && move_2 != 0 && move_1 == 0 && task2 > 0 && task1 == 0) {
// if(to_command2 !=2 ) {
// writing("to_command2", "2");
// }
// }
// //给前工位取满托下发放货信号
// if (mode == 3 && action_1 == 2 && move_1 != 0 && move_2 == 0 && task1 > 0 && task2 == 0) {
// if(to_command2 !=2 ) {
// writing("to_command1", "2");
// }
// }
//双任务下 后工位取货完成,然后给前工位下发取满盘任务取货命令
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 ){
@@ -411,12 +345,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
return;
}
if (!this.itemProtocol.getIsonline()) {
this.setIsonline(false);
this.setIserror(true);
message = "信号量同步异常";
//未联机
} else if (mode == 0) {
if (mode == 0) {
this.setIsonline(false);
this.setIserror(true);
message = "未联机";
@@ -564,7 +493,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
instdto.setPriority(priority);
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
instdto.setVehicle_type(task.getVehicle_type());
try {
instructionService.create(instdto);
} catch (Exception e) {
@@ -596,6 +525,8 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset2", start_addr2);
writing("to_target1", next_addr2);
writing("to_task2", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task2").toString()
, instdto.getInstruction_code())) {
writing("to_onset1", start_addr);
@@ -605,6 +536,8 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset2", start_addr2);
writing("to_target2", next_addr2);
writing("to_task2", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
@@ -628,12 +561,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset1", start_addr);
writing("to_target1", next_addr);
writing("to_task1", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task1").toString()
, instdto.getInstruction_code())) {
writing("to_command1", "1");
writing("to_onset1", start_addr);
writing("to_target1", next_addr);
writing("to_task1", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
@@ -650,12 +587,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset2", start_addr);
writing("to_target2", next_addr);
writing("to_task2", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task2").toString()
, instdto.getInstruction_code())) {
writing("to_command2", "1");
writing("to_onset2", start_addr);
writing("to_target2", next_addr);
writing("to_task2", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
@@ -730,6 +671,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
instdto.setPriority(priority);
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
instdto.setVehicle_type(task2.getVehicle_type());
try {
instructionService.create(instdto);
@@ -761,6 +703,8 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset2", start_addr2);
writing("to_target1", next_addr2);
writing("to_task2", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task2").toString()
, instdto.getInstruction_code())) {
writing("to_onset1", start_addr);
@@ -770,6 +714,8 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset2", start_addr2);
writing("to_target2", next_addr2);
writing("to_task2", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
@@ -793,12 +739,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset1", start_addr);
writing("to_target1", next_addr);
writing("to_task1", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task1").toString()
, instdto.getInstruction_code())) {
writing("to_command1", "1");
writing("to_onset1", start_addr);
writing("to_target1", next_addr);
writing("to_task1", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
@@ -815,12 +765,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset2", start_addr);
writing("to_target2", next_addr);
writing("to_task2", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task2").toString()
, instdto.getInstruction_code())) {
writing("to_command2", "1");
writing("to_onset2", start_addr);
writing("to_target2", next_addr);
writing("to_task2", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
@@ -917,6 +871,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset2", start_addr);
writing("to_target2", next_addr);
writing("to_task2", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task2").toString()
, instdto.getInstruction_code())) {
@@ -925,6 +880,8 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset2", start_addr);
writing("to_target2", next_addr);
writing("to_task2", instdto.getInstruction_code());
writing("to_container_type", instdto.getVehicle_type());
logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
@@ -1176,6 +1133,8 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset2", "0");
writing("to_target2", "0");
writing("to_task2", "0");
writing("to_container_type", "0");
}
this.requireSucess1 = false;
//单独的后工位任务
@@ -1193,6 +1152,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset2", "0");
writing("to_target2", "0");
writing("to_task2", "0");
writing("to_container_type", "0");
}
this.requireSucess1 = false;
@@ -1209,6 +1169,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
writing("to_onset1", "0");
writing("to_target1", "0");
writing("to_task1", "0");
writing("to_container_type", "0");
}
this.requireSucess1 = false;
}

View File

@@ -212,7 +212,7 @@ public class InstructionDto implements Serializable {
/**
* 载具类型
*/
private String vehicle_type;
private String vehicle_type = "0";
/**
* agv车号

View File

@@ -31,7 +31,7 @@ public class TaskDto implements Serializable {
/**
* 载具类型
*/
private String vehicle_type;
private String vehicle_type ="0";
/**
* 任务类型