fix rgv任务
This commit is contained in:
@@ -76,6 +76,8 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
int last_barcode = 0;
|
int last_barcode = 0;
|
||||||
int to_command =0;
|
int to_command =0;
|
||||||
int last_to_command =0;
|
int last_to_command =0;
|
||||||
|
int to_task =0;
|
||||||
|
int last_to_task =0;
|
||||||
Boolean isonline = true;
|
Boolean isonline = true;
|
||||||
int hasGoods = 0;
|
int hasGoods = 0;
|
||||||
String message = null;
|
String message = null;
|
||||||
@@ -129,7 +131,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
hasGoods = this.itemProtocol.getMove();
|
hasGoods = this.itemProtocol.getMove();
|
||||||
container_type = this.itemProtocol.getContainer_type();
|
container_type = this.itemProtocol.getContainer_type();
|
||||||
to_command = this.itemProtocol.getToCommand();
|
to_command = this.itemProtocol.getToCommand();
|
||||||
|
to_task = this.itemProtocol.getToTask();
|
||||||
if (mode != last_mode) {
|
if (mode != last_mode) {
|
||||||
this.setRequireSucess(false);
|
this.setRequireSucess(false);
|
||||||
this.setResult(false);
|
this.setResult(false);
|
||||||
@@ -162,6 +164,9 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
if (to_command != last_to_command) {
|
if (to_command != last_to_command) {
|
||||||
logServer.deviceExecuteLog(this.device_code,"","","信号to_command:" + last_to_command + "->" + to_command);
|
logServer.deviceExecuteLog(this.device_code,"","","信号to_command:" + last_to_command + "->" + to_command);
|
||||||
}
|
}
|
||||||
|
if (to_task != last_to_task) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code,"","","信号to_task:" + last_to_task + "->" + to_task);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
logServer.deviceExecuteLog(this.device_code,"","","异常:"+var17.getMessage());
|
logServer.deviceExecuteLog(this.device_code,"","","异常:"+var17.getMessage());
|
||||||
@@ -238,6 +243,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
last_container_type = container_type;
|
last_container_type = container_type;
|
||||||
last_to_command= to_command;
|
last_to_command= to_command;
|
||||||
last_barcode = barcode;
|
last_barcode = barcode;
|
||||||
|
last_to_task = to_task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -319,12 +325,14 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
} else {
|
} else {
|
||||||
this.instruction_require_time = date;
|
this.instruction_require_time = date;
|
||||||
Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
if(ObjectUtil.isEmpty(inst)){
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请组盘task:"+task+"未找到对应指令");
|
||||||
|
}
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("device_code",this.device_code);
|
json.put("device_code",this.device_code);
|
||||||
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
|
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
|
||||||
json.put("task_code",inst.getTask_code());
|
json.put("task_code",inst.getTask_code());
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请组盘请求lms:"+json);
|
||||||
HttpResponse result = acsToWmsService.applyIntoKiln(json);
|
HttpResponse result = acsToWmsService.applyIntoKiln(json);
|
||||||
if (ObjectUtil.isNotEmpty(result)) {
|
if (ObjectUtil.isNotEmpty(result)) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||||
@@ -333,7 +341,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
this.setRequireSucess(true);
|
this.setRequireSucess(true);
|
||||||
this.setResult(true);
|
this.setResult(true);
|
||||||
}
|
}
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请组盘请求lms反馈:"+result);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
@Autowired
|
@Autowired
|
||||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
|
|
||||||
|
Instruction inst = null;
|
||||||
|
|
||||||
//当前指令1
|
//当前指令1
|
||||||
Instruction inst1 = null;
|
Instruction inst1 = null;
|
||||||
//当前指令2
|
//当前指令2
|
||||||
@@ -201,6 +203,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
|
|
||||||
if (mode != last_mode) {
|
if (mode != last_mode) {
|
||||||
if(mode==2){
|
if(mode==2){
|
||||||
|
inst = null;
|
||||||
this.setRequireSucess1(false);
|
this.setRequireSucess1(false);
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "模式变待机,复位前工位请求标记requireSucess1:" + requireSucess1);
|
logServer.deviceExecuteLog(this.device_code, "", "", "模式变待机,复位前工位请求标记requireSucess1:" + requireSucess1);
|
||||||
this.setRequireSucess2(false);
|
this.setRequireSucess2(false);
|
||||||
@@ -647,7 +650,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
writing("to_onset2", start_addr);
|
writing("to_onset2", start_addr);
|
||||||
writing("to_target2", next_addr);
|
writing("to_target2", next_addr);
|
||||||
writing("to_task2", instdto.getInstruction_code());
|
writing("to_task2", instdto.getInstruction_code());
|
||||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task1").toString()
|
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task2").toString()
|
||||||
, instdto.getInstruction_code())) {
|
, instdto.getInstruction_code())) {
|
||||||
writing("to_command2", "1");
|
writing("to_command2", "1");
|
||||||
writing("to_onset2", start_addr);
|
writing("to_onset2", start_addr);
|
||||||
@@ -812,7 +815,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
writing("to_onset2", start_addr);
|
writing("to_onset2", start_addr);
|
||||||
writing("to_target2", next_addr);
|
writing("to_target2", next_addr);
|
||||||
writing("to_task2", instdto.getInstruction_code());
|
writing("to_task2", instdto.getInstruction_code());
|
||||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task1").toString()
|
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task2").toString()
|
||||||
, instdto.getInstruction_code())) {
|
, instdto.getInstruction_code())) {
|
||||||
writing("to_command2", "1");
|
writing("to_command2", "1");
|
||||||
writing("to_onset2", start_addr);
|
writing("to_onset2", start_addr);
|
||||||
@@ -1157,7 +1160,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
|
|
||||||
if(task1 >0 && task2>0 && action_1 == 4 && action_2 == 4 && move_1 ==0 && move_2==0){
|
if(task1 >0 && task2>0 && action_1 == 4 && action_2 == 4 && move_1 ==0 && move_2==0){
|
||||||
//inst_message
|
//inst_message
|
||||||
inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
|
inst1 = checkInst();
|
||||||
if (inst1 != null) {
|
if (inst1 != null) {
|
||||||
try {
|
try {
|
||||||
finish_instruction(inst1);
|
finish_instruction(inst1);
|
||||||
@@ -1178,7 +1181,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
//单独的后工位任务
|
//单独的后工位任务
|
||||||
} else if (action_2 == 4 && move_2 == 0 && task2 > 0 && action_1 == 0 && move_2 == 0 && task1 == 0 ) {
|
} else if (action_2 == 4 && move_2 == 0 && task2 > 0 && action_1 == 0 && move_2 == 0 && task1 == 0 ) {
|
||||||
//inst_message
|
//inst_message
|
||||||
inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
|
inst2 = checkInst();
|
||||||
if (inst2 != null) {
|
if (inst2 != null) {
|
||||||
try {
|
try {
|
||||||
finish_instruction(inst2);
|
finish_instruction(inst2);
|
||||||
@@ -1194,7 +1197,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
}
|
}
|
||||||
this.requireSucess1 = false;
|
this.requireSucess1 = false;
|
||||||
} else if (action_1 == 4 && move_1 == 0 && task1 > 0 && action_2 == 0 && move_2 == 0 && task2 == 0 ) {
|
} else if (action_1 == 4 && move_1 == 0 && task1 > 0 && action_2 == 0 && move_2 == 0 && task2 == 0 ) {
|
||||||
inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
|
inst1 = checkInst();
|
||||||
if (inst1 != null) {
|
if (inst1 != null) {
|
||||||
try {
|
try {
|
||||||
finish_instruction(inst1);
|
finish_instruction(inst1);
|
||||||
@@ -1213,7 +1216,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
|
|
||||||
|
|
||||||
if (task1 > 0) {
|
if (task1 > 0) {
|
||||||
inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
|
inst1 = checkInst();
|
||||||
if (inst1 != null) {
|
if (inst1 != null) {
|
||||||
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||||
inst1.setInstruction_status("1");
|
inst1.setInstruction_status("1");
|
||||||
@@ -1222,7 +1225,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (task2 > 0) {
|
if (task2 > 0) {
|
||||||
inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
|
inst2 = checkInst();
|
||||||
if (inst2 != null) {
|
if (inst2 != null) {
|
||||||
if (StrUtil.equals(inst2.getInstruction_status(), "0")) {
|
if (StrUtil.equals(inst2.getInstruction_status(), "0")) {
|
||||||
inst2.setInstruction_status("1");
|
inst2.setInstruction_status("1");
|
||||||
@@ -1233,4 +1236,33 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Instruction checkInst(){
|
||||||
|
if(ObjectUtil.isNotEmpty(this.inst)){
|
||||||
|
if(this.task1>0){
|
||||||
|
if(this.inst.getInstruction_code().equals(String.valueOf(this.task1))){
|
||||||
|
return this.inst;
|
||||||
|
} else {
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task1));
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(this.inst.getInstruction_code().equals(String.valueOf(this.task2))){
|
||||||
|
return this.inst;
|
||||||
|
} else {
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task2));
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(this.task1>0){
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task1));
|
||||||
|
} else {
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task2));
|
||||||
|
}
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -447,6 +447,17 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
if (!lnshLaminatingMachineDeviceDriver.getResult()) {
|
if (!lnshLaminatingMachineDeviceDriver.getResult()) {
|
||||||
lnshLaminatingMachineDeviceDriver.writing("to_task", inst.getInstruction_code());
|
lnshLaminatingMachineDeviceDriver.writing("to_task", inst.getInstruction_code());
|
||||||
lnshLaminatingMachineDeviceDriver.writing(1);
|
lnshLaminatingMachineDeviceDriver.writing(1);
|
||||||
|
while (!StrUtil.equals(String.valueOf(lnshLaminatingMachineDeviceDriver.getTo_task()),inst.getInstruction_code())
|
||||||
|
|| !StrUtil.equals(String.valueOf(lnshLaminatingMachineDeviceDriver.getTo_command()),"1") ) {
|
||||||
|
|
||||||
|
lnshLaminatingMachineDeviceDriver.writing("to_task", inst.getInstruction_code());
|
||||||
|
lnshLaminatingMachineDeviceDriver.writing(1);
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("下发电气信号失败:" + e.getMessage());
|
log.info("下发电气信号失败:" + e.getMessage());
|
||||||
@@ -457,7 +468,14 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
//如果组盘绑定条码成功,就允许agv离开
|
//如果组盘绑定条码成功,就允许agv离开
|
||||||
if (lnshLaminatingMachineDeviceDriver.getMode() == 6 && lnshLaminatingMachineDeviceDriver.getResult()) {
|
if (lnshLaminatingMachineDeviceDriver.getMode() == 6 && lnshLaminatingMachineDeviceDriver.getResult()) {
|
||||||
try {
|
try {
|
||||||
lnshLaminatingMachineDeviceDriver.writing(6);
|
while (!StrUtil.equals(String.valueOf(lnshLaminatingMachineDeviceDriver.getTo_command()),"6") ) {
|
||||||
|
lnshLaminatingMachineDeviceDriver.writing(6);
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("下发电气信号失败:" + e.getMessage());
|
log.info("下发电气信号失败:" + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user