更新
This commit is contained in:
@@ -177,28 +177,31 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task);
|
||||
}
|
||||
|
||||
if (mode == 2 && move != 0 && task > 0) {
|
||||
if ( move != 0 && task > 0) {
|
||||
//inst_message
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1")) {
|
||||
if(StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())){
|
||||
vehicle_code = inst.getVehicle_code();
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
finish_instruction();
|
||||
} else {
|
||||
if(!StrUtil.equals(inst.getExecute_code(),this.device_code)){
|
||||
if(mode == 2){
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1")) {
|
||||
if(StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())){
|
||||
vehicle_code = inst.getVehicle_code();
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
finish_instruction();
|
||||
} else {
|
||||
if(!StrUtil.equals(inst.getExecute_code(),this.device_code)){
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
}
|
||||
} else {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -654,7 +654,11 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
}
|
||||
if(task >0 ){
|
||||
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (ObjectUtil.isEmpty(instruction)){
|
||||
instruction = instructionService.findByCode(String.valueOf(task));
|
||||
}
|
||||
vehicle_code = instruction.getVehicle_code();
|
||||
|
||||
} else {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:"+task+"异常");
|
||||
message = "申请贴标电气设备任务号:"+task+"异常";
|
||||
|
||||
@@ -140,6 +140,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
public void clearBarcode() throws Exception {
|
||||
ScannerDeviceDriver scanner = this.getScanner();
|
||||
scanner.cleanBarcode();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "清理条码");
|
||||
}
|
||||
public synchronized boolean finish_instruction() throws Exception {
|
||||
instructionService.finish(inst);
|
||||
@@ -197,6 +198,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
if (move == 0 && mode == 2) {
|
||||
message = null;
|
||||
inst_message = null;
|
||||
clearBarcode();
|
||||
thingToNothing();
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||
@@ -292,7 +294,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
last_error = error;
|
||||
last_move = move;
|
||||
last_task = task;
|
||||
|
||||
last_plcbarcode_length = plcbarcode_length;
|
||||
last_plcbarcode = plcbarcode;
|
||||
}
|
||||
|
||||
public boolean exe_error() {
|
||||
@@ -426,6 +429,11 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
TaskDto task = taskserver.findByContainer(container_code);
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
Instruction instdto = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if(!StrUtil.equals(instdto.getStart_device_code(),this.device_code)){
|
||||
message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符";
|
||||
// this.setIserror(true);
|
||||
return false;
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(instdto)){
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
@@ -484,6 +492,27 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
if (!ObjectUtil.isEmpty(taskdto)) {
|
||||
if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) {
|
||||
Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code());
|
||||
if(!StrUtil.equals(instdto.getStart_device_code(),this.device_code)){
|
||||
message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符";
|
||||
// this.setIserror(true);
|
||||
// List list = new ArrayList();
|
||||
// Map map = new HashMap();
|
||||
// map.put("code","to_target");
|
||||
// map.put("value","1011");
|
||||
// list.add(map);
|
||||
// Map map2 = new HashMap();
|
||||
// map2.put("code","to_command");
|
||||
// map2.put("value","1");
|
||||
// Map map3 = new HashMap();
|
||||
// map3.put("code","to_task");
|
||||
// map3.put("value","0");
|
||||
// list.add(map3);
|
||||
// this.writing(list);
|
||||
// this.setRequireSucess(true);
|
||||
// this.setApplySucess(true);
|
||||
return false;
|
||||
}
|
||||
this.setIserror(false);
|
||||
if (ObjectUtil.isNotEmpty(instdto)) {
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
@@ -522,6 +551,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
String taskid = taskdto.getTask_id();
|
||||
String taskcode = taskdto.getTask_code();
|
||||
String vehiclecode = taskdto.getVehicle_code();
|
||||
@@ -571,6 +601,26 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
} else {
|
||||
next_point_code = next_device_code;
|
||||
}
|
||||
|
||||
if(!StrUtil.equals(taskdto.getStart_device_code(),this.device_code)){
|
||||
message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符";
|
||||
// List list = new ArrayList();
|
||||
// Map map = new HashMap();
|
||||
// map.put("code","to_target");
|
||||
// map.put("value","1011");
|
||||
// list.add(map);
|
||||
// Map map2 = new HashMap();
|
||||
// map2.put("code","to_command");
|
||||
// map2.put("value","1");
|
||||
// Map map3 = new HashMap();
|
||||
// map3.put("code","to_task");
|
||||
// map3.put("value","0");
|
||||
// list.add(map3);
|
||||
// this.writing(list);
|
||||
// this.setRequireSucess(true);
|
||||
// this.setApplySucess(true);
|
||||
return false;
|
||||
}
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
@@ -646,7 +696,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_command");
|
||||
map2.put("value","1");
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_task");
|
||||
map3.put("value","0");
|
||||
list.add(map3);
|
||||
this.writing(list);
|
||||
message = "申请任务失败接口不通下发退回";
|
||||
} else {
|
||||
@@ -666,6 +719,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
map2.put("code","to_command");
|
||||
map2.put("value","1");
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_task");
|
||||
map3.put("value","0");
|
||||
list.add(map3);
|
||||
this.writing(list);
|
||||
message = "申请任务失败下发退回,"+message;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user