diff --git a/acs/hd/nladmin-system/pom.xml b/acs/hd/nladmin-system/pom.xml
index 05c4eb9..dc7e45b 100644
--- a/acs/hd/nladmin-system/pom.xml
+++ b/acs/hd/nladmin-system/pom.xml
@@ -48,6 +48,12 @@
lucene-core
8.4.0
+
+ com.alibaba
+ fastjson
+ 1.2.76
+
+
org.apache.lucene
lucene-analyzers-common
diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java
index c8e9819..612ab06 100644
--- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java
+++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java
@@ -81,6 +81,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
int task = 0;
//出入库模式
int operation_type = 0;
+ int last_operation_type = 0;
int height = 0;
int last_mode = 0;
int last_error = 0;
@@ -165,6 +166,10 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
this.execute_log.setResource(this.device_code, this.device_code);
this.execute_log.log("设备:" + device_code + ",last_mode -> mode:" + last_mode + "->" + mode);
}
+ if (operation_type != last_operation_type) {
+ this.execute_log.setResource(this.device_code, this.device_code);
+ this.execute_log.log("设备:" + device_code + ",last_operation_type -> operation_type:" + last_operation_type + "->" + last_operation_type);
+ }
if (move != last_move) {
this.execute_log.setResource(this.device_code, this.device_code);
this.execute_log.log("设备:" + device_code + ",last_move -> move:" + last_mode + "->" + move);
@@ -188,7 +193,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
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(mode == 2){
+ if (mode == 2) {
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
// try{
// finish_instruction();
@@ -249,27 +254,27 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
if (hasGoods > 0 && error == 0 && !StrUtil.isEmpty(container) && !requireSucess) {
instruction_require(container);
} else {
- if(StrUtil.isEmpty(container) ){
- message ="申请任务托盘号为空无法申请指令";
+ if (StrUtil.isEmpty(container)) {
+ message = "申请任务托盘号为空无法申请指令";
}
- if(error > 0){
- message ="申请任务error>0无法申请指令";
+ if (error > 0) {
+ message = "申请任务error>0无法申请指令";
}
- if(requireSucess){
- message ="申请任务请求成功标记未复位无法申请指令";
+ if (requireSucess) {
+ message = "申请任务请求成功标记未复位无法申请指令";
}
}
if (hasGoods > 0 && error == 0 && !StrUtil.isEmpty(container) && !applySucess) {
instruction_apply(container);
} else {
- if(StrUtil.isEmpty(container) ){
- message ="申请指令托盘号为空无法申请指令";
+ if (StrUtil.isEmpty(container)) {
+ message = "申请指令托盘号为空无法申请指令";
}
- if(error > 0){
- message ="申请指令error>0无法申请指令";
+ if (error > 0) {
+ message = "申请指令error>0无法申请指令";
}
- if(applySucess){
- message ="申请指令请求成功标记未复位无法申请指令";
+ if (applySucess) {
+ message = "申请指令请求成功标记未复位无法申请指令";
}
}
break;
@@ -316,6 +321,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
last_move = move;
last_task = task;
last_height = height;
+ last_operation_type = operation_type;
}
public boolean exe_error() {
@@ -437,7 +443,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
}
-// public boolean instruction_apply() throws Exception {
+ // public boolean instruction_apply() throws Exception {
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
@@ -521,292 +527,302 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
// }
// return true;
// }
-public synchronized boolean instruction_apply(String container_code) throws Exception {
- Date date = new Date();
- if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
- log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
- return false;
- } else {
- this.instruction_apply_time = date;
- //container_code
- TaskDto task = taskserver.findByContainer(container_code);
- Instruction inst = instructionService.findByDeviceCodeFromCache(container_code);
- if(!ObjectUtil.isEmpty(inst) && StrUtil.equals(inst.getInstruction_status(),"0")){
- this.setInst(inst);
- writing();
- applySucess = true;
- this.setContainer("");
- return true;
- }
- if (!ObjectUtil.isEmpty(task)) {
- String taskid = task.getTask_id();
- String taskcode = task.getTask_code();
- String vehiclecode = task.getVehicle_code();
- String priority = task.getPriority();
- String start_point_code = this.device_code;
- String start_device_code = this.device_code;
- String route_plan_code = task.getRoute_plan_code();
- String next_device_code = "";
+ public synchronized boolean instruction_apply(String container_code) throws Exception {
+ Date date = new Date();
+ if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
+ log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
+ return false;
+ } else {
+ this.instruction_apply_time = date;
+ //container_code
+ TaskDto task = taskserver.findByContainer(container_code);
+ Instruction inst = instructionService.findByDeviceCodeFromCache(container_code);
+ if (!ObjectUtil.isEmpty(inst) && StrUtil.equals(inst.getInstruction_status(), "0")) {
+ this.setInst(inst);
+ writing();
+ applySucess = true;
+ this.setContainer("");
+ return true;
+ }
+ if (!ObjectUtil.isEmpty(task)) {
+ String taskid = task.getTask_id();
+ String taskcode = task.getTask_code();
+ String vehiclecode = task.getVehicle_code();
+ String priority = task.getPriority();
+ String start_point_code = this.device_code;
+ String start_device_code = this.device_code;
+ String route_plan_code = task.getRoute_plan_code();
+ String next_device_code = "";
- /**
- * 开始平均分配
- */
- String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
- if (StrUtil.isEmpty(this_device_code)) {
- List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
- RouteLineDto routeLineDto = shortPathsList.get(0);
+ /**
+ * 开始平均分配
+ */
+ String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
+ if (StrUtil.isEmpty(this_device_code)) {
+ List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
+ RouteLineDto routeLineDto = shortPathsList.get(0);
- String path = routeLineDto.getPath();
- String type = routeLineDto.getType();
- String[] str = path.split("->");
- if (!StrUtil.equals(type, "0")) {
- return false;
- }
- List pathlist = Arrays.asList(str);
- int index = 0;
- for (int m = 0; m < pathlist.size(); m++) {
- if (pathlist.get(m).equals(start_device_code)) {
- index = m + 1;
- break;
+ String path = routeLineDto.getPath();
+ String type = routeLineDto.getType();
+ String[] str = path.split("->");
+ if (!StrUtil.equals(type, "0")) {
+ return false;
}
+ List pathlist = Arrays.asList(str);
+ int index = 0;
+ for (int m = 0; m < pathlist.size(); m++) {
+ if (pathlist.get(m).equals(start_device_code)) {
+ index = m + 1;
+ break;
+ }
+ }
+ next_device_code = pathlist.get(index);
+ } else {
+ next_device_code = this_device_code;
+ }
+ //校验路由关系
+ List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
+ if (ObjectUtils.isEmpty(shortPathsList)) {
+ throw new RuntimeException("路由不通!");
}
- next_device_code = pathlist.get(index);
- } else {
- next_device_code = this_device_code;
- }
- //校验路由关系
- List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
- if (ObjectUtils.isEmpty(shortPathsList)) {
- throw new RuntimeException("路由不通!");
- }
- Device startdevice = deviceAppservice.findDeviceByCode(start_device_code);
- Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code);
- String next_point_code;
- if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) {
- next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z();
- } else {
- next_point_code = next_device_code;
- }
+ Device startdevice = deviceAppservice.findDeviceByCode(start_device_code);
+ Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code);
+ String next_point_code;
+ if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) {
+ next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z();
+ } else {
+ next_point_code = next_device_code;
+ }
- Device deviceByCode = deviceAppservice.findDeviceByCode(task.getStart_device_code());
- StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
- if (deviceByCode.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
- standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) deviceByCode.getDeviceDriver();
- createLock = standardCoveyorControlWithScannerDeviceDriver.getCreateLock();
- }
- if (!createLock) {
- //几台入库模式的agv 就能生成几个agv_type =3 的指令
- //指令类型为3的指令数
- List insts = instructionService.queryAgvInstByThree();
- Integer agvQty = deviceservice.queryAgvQty();
- List deviceByType = deviceAppservice.findDevice(DeviceType.agv);
- if (insts.size() < agvQty) {
- String carno = "";
- Boolean flag = false;
- for (int j = 0; j < deviceByType.size(); j++) {
- Device device = deviceByType.get(j);
- JMAgvDeviceDriver jmAgvDeviceDriver;
- if (device.getDeviceDriver() instanceof JMAgvDeviceDriver) {
- jmAgvDeviceDriver = (JMAgvDeviceDriver) device.getDeviceDriver();
- String agvTaskType = jmAgvDeviceDriver.getAgvTaskType();
- List instructions = instructionService.findAllInstFromCache();
- if (instructions.size() == 0) {
- if (agvTaskType.equals("0") || agvTaskType.equals("1")) {
- carno = device.getDevice_code();
- flag = true;
+ Device deviceByCode = deviceAppservice.findDeviceByCode(task.getStart_device_code());
+ StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
+ if (deviceByCode.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
+ standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) deviceByCode.getDeviceDriver();
+ createLock = standardCoveyorControlWithScannerDeviceDriver.getCreateLock();
+ }
+ if (!createLock) {
+ //几台入库模式的agv 就能生成几个agv_type =3 的指令
+ //指令类型为3的指令数
+ List insts = instructionService.queryAgvInstByThree();
+ Integer agvQty = deviceservice.queryAgvQty();
+ List deviceByType = deviceAppservice.findDevice(DeviceType.agv);
+ if (insts.size() < agvQty) {
+ String carno = "";
+ Boolean flag = false;
+ for (int j = 0; j < deviceByType.size(); j++) {
+ Device device = deviceByType.get(j);
+ JMAgvDeviceDriver jmAgvDeviceDriver;
+ if (device.getDeviceDriver() instanceof JMAgvDeviceDriver) {
+ jmAgvDeviceDriver = (JMAgvDeviceDriver) device.getDeviceDriver();
+ String agvTaskType = jmAgvDeviceDriver.getAgvTaskType();
+ List instructions = instructionService.findAllInstFromCache();
+ if (instructions.size() == 0) {
+ if (agvTaskType.equals("0") || agvTaskType.equals("1")) {
+ carno = device.getDevice_code();
+ flag = true;
+ break;
+ }
+ }
+ for (int z = 0; z < instructions.size(); z++) {
+ Instruction instruction = instructions.get(z);
+ if (ObjectUtil.isNotEmpty(instruction.getCarno())
+ && instruction.getCarno().equals(device.getDevice_code())) {
+ break;
+ } else if (z == instructions.size() - 1 && (agvTaskType.equals("0") || agvTaskType.equals("1"))) {
+ carno = device.getDevice_code();
+ flag = true;
+ break;
+ }
+ }
+ if (flag) {
break;
}
}
- for (int z = 0; z < instructions.size(); z++) {
- Instruction instruction = instructions.get(z);
- if (ObjectUtil.isNotEmpty(instruction.getCarno())
- && instruction.getCarno().equals(device.getDevice_code())) {
- break;
- } else if (z == instructions.size() - 1 && (agvTaskType.equals("0") || agvTaskType.equals("1"))) {
- carno = device.getDevice_code();
- flag = true;
- break;
+ }
+ if (flag) {
+ Instruction instdto = new Instruction();
+ instdto.setInstruction_id(IdUtil.simpleUUID());
+ instdto.setRoute_plan_code(route_plan_code);
+ instdto.setRemark(task.getRemark());
+ instdto.setMaterial(task.getMaterial());
+ instdto.setQuantity(task.getQuantity());
+ instdto.setTask_id(taskid);
+ instdto.setTask_code(taskcode);
+ instdto.setVehicle_code(vehiclecode);
+ String now = DateUtil.now();
+ instdto.setCreate_time(now);
+ instdto.setCreate_by("auto");
+ instdto.setStart_device_code(start_device_code);
+ instdto.setNext_device_code(next_device_code);
+ instdto.setStart_point_code(start_point_code);
+ instdto.setNext_point_code(next_point_code);
+ instdto.setPriority(priority);
+ instdto.setInstruction_status("0");
+ instdto.setExecute_device_code(start_point_code);
+ //查询关联设备数量
+ List list = deviceservice.queryLinkDeviceByCode(next_device_code);
+ //查询此终点的指令数量
+ List byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
+ if (byNextDeviceCode.size() >= list.size()) {
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点的指令数量:" + byNextDeviceCode.size() + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
+ message = "查询此终点的指令数量异常(661)";
+ return true;
+ }
+
+ int count = 0;
+ for (int i = 0; i < list.size(); i++) {
+ String code = list.get(i);
+ Device device = deviceAppservice.findDeviceByCode(code);
+ StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
+ if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
+ standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
+ if (standardCoveyorControlDeviceDriver.getMove() != 0) count += 1;
}
}
- if (flag) {
- break;
+ //如果当前关联的设备中都有货的话,就返回
+ if (count != 0 && count >= list.size()) {
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点关联设备中,有货的设备数量:" + count + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
+ message = "当前关联的设备中都有货,异常(678)";
+ return true;
}
+ instructionService.create(instdto);
+
+ Instruction instdto2 = new Instruction();
+ instdto2.setInstruction_id(IdUtil.simpleUUID());
+ instdto2.setRoute_plan_code(route_plan_code);
+ instdto2.setRemark(task.getRemark());
+ instdto2.setMaterial(task.getMaterial());
+ instdto2.setQuantity(task.getQuantity());
+ instdto2.setTask_id(taskid);
+ instdto2.setTask_code(taskcode);
+ instdto2.setVehicle_code(vehiclecode);
+ instdto2.setCreate_time(now);
+ instdto2.setCreate_by("auto");
+ instdto2.setStart_device_code(next_device_code);
+ instdto2.setNext_device_code(task.getNext_device_code());
+ instdto2.setStart_point_code(next_point_code);
+ instdto2.setNext_point_code(task.getNext_point_code());
+ instdto2.setPriority(priority);
+ instdto2.setInstruction_status("0");
+ instdto2.setExecute_device_code(start_point_code);
+ instdto2.setCarno(carno);
+ instructionService.createSecond(instdto2);
+ } else {
+ Instruction instdto = new Instruction();
+ instdto.setInstruction_id(IdUtil.simpleUUID());
+ instdto.setRoute_plan_code(route_plan_code);
+ instdto.setRemark(task.getRemark());
+ instdto.setMaterial(task.getMaterial());
+ instdto.setQuantity(task.getQuantity());
+ instdto.setTask_id(taskid);
+ instdto.setTask_code(taskcode);
+ instdto.setVehicle_code(vehiclecode);
+ String now = DateUtil.now();
+ instdto.setCreate_time(now);
+ instdto.setCreate_by("auto");
+ instdto.setStart_device_code(start_device_code);
+ instdto.setNext_device_code(next_device_code);
+ instdto.setStart_point_code(start_point_code);
+ instdto.setNext_point_code(next_point_code);
+ instdto.setPriority(priority);
+ instdto.setInstruction_status("0");
+ instdto.setExecute_device_code(start_point_code);
+ //查询关联设备数量
+ List list = deviceservice.queryLinkDeviceByCode(next_device_code);
+ //查询此终点的指令数量
+ List byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
+ if (byNextDeviceCode.size() >= list.size()) {
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点的指令数量:" + byNextDeviceCode.size() + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
+ message = "查询此终点的指令数量,异常(729)";
+ return true;
+ }
+
+ int count = 0;
+ for (int i = 0; i < list.size(); i++) {
+ String code = list.get(i);
+ Device device = deviceAppservice.findDeviceByCode(code);
+ StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
+ if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
+ standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
+ if (standardCoveyorControlDeviceDriver.getMove() != 0) count += 1;
+ }
+ }
+ //如果当前关联的设备中都有货的话,就返回
+ if (count != 0 && count >= list.size()) {
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点关联设备中,有货的设备数量:" + count + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
+ message = "当前关联的设备中都有货的话,就返回异常(746)";
+ return true;
+ }
+ instructionService.create(instdto);
+
+ //创建指令后修改任务状态
+ WQLObject taskwo = WQLObject.getWQLObject("acs_task");
+ task.setTask_status("1");
+ JSONObject json = JSONObject.fromObject(task);
+ taskwo.update(json);
+ applySucess = true;
+ this.setContainer("");
+ return true;
}
}
- if (flag) {
- Instruction instdto = new Instruction();
- instdto.setInstruction_id(IdUtil.simpleUUID());
- instdto.setRoute_plan_code(route_plan_code);
- instdto.setRemark(task.getRemark());
- instdto.setMaterial(task.getMaterial());
- instdto.setQuantity(task.getQuantity());
- instdto.setTask_id(taskid);
- instdto.setTask_code(taskcode);
- instdto.setVehicle_code(vehiclecode);
- String now = DateUtil.now();
- instdto.setCreate_time(now);
- instdto.setCreate_by("auto");
- instdto.setStart_device_code(start_device_code);
- instdto.setNext_device_code(next_device_code);
- instdto.setStart_point_code(start_point_code);
- instdto.setNext_point_code(next_point_code);
- instdto.setPriority(priority);
- instdto.setInstruction_status("0");
- instdto.setExecute_device_code(start_point_code);
- //查询关联设备数量
- List list = deviceservice.queryLinkDeviceByCode(next_device_code);
- //查询此终点的指令数量
- List byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
- if (byNextDeviceCode.size() >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点的指令数量:" + byNextDeviceCode.size() + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
- message = "查询此终点的指令数量异常(661)";
- return true;
- }
-
- int count = 0;
- for (int i = 0; i < list.size(); i++) {
- String code = list.get(i);
- Device device = deviceAppservice.findDeviceByCode(code);
- StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
- if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
- standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
- if (standardCoveyorControlDeviceDriver.getMove() != 0) count += 1;
- }
- }
- //如果当前关联的设备中都有货的话,就返回
- if (count != 0 && count >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点关联设备中,有货的设备数量:" + count + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
- message = "当前关联的设备中都有货,异常(678)";
- return true;
- }
- instructionService.create(instdto);
-
- Instruction instdto2 = new Instruction();
- instdto2.setInstruction_id(IdUtil.simpleUUID());
- instdto2.setRoute_plan_code(route_plan_code);
- instdto2.setRemark(task.getRemark());
- instdto2.setMaterial(task.getMaterial());
- instdto2.setQuantity(task.getQuantity());
- instdto2.setTask_id(taskid);
- instdto2.setTask_code(taskcode);
- instdto2.setVehicle_code(vehiclecode);
- instdto2.setCreate_time(now);
- instdto2.setCreate_by("auto");
- instdto2.setStart_device_code(next_device_code);
- instdto2.setNext_device_code(task.getNext_device_code());
- instdto2.setStart_point_code(next_point_code);
- instdto2.setNext_point_code(task.getNext_point_code());
- instdto2.setPriority(priority);
- instdto2.setInstruction_status("0");
- instdto2.setExecute_device_code(start_point_code);
- instdto2.setCarno(carno);
- instructionService.createSecond(instdto2);
- } else {
- Instruction instdto = new Instruction();
- instdto.setInstruction_id(IdUtil.simpleUUID());
- instdto.setRoute_plan_code(route_plan_code);
- instdto.setRemark(task.getRemark());
- instdto.setMaterial(task.getMaterial());
- instdto.setQuantity(task.getQuantity());
- instdto.setTask_id(taskid);
- instdto.setTask_code(taskcode);
- instdto.setVehicle_code(vehiclecode);
- String now = DateUtil.now();
- instdto.setCreate_time(now);
- instdto.setCreate_by("auto");
- instdto.setStart_device_code(start_device_code);
- instdto.setNext_device_code(next_device_code);
- instdto.setStart_point_code(start_point_code);
- instdto.setNext_point_code(next_point_code);
- instdto.setPriority(priority);
- instdto.setInstruction_status("0");
- instdto.setExecute_device_code(start_point_code);
- //查询关联设备数量
- List list = deviceservice.queryLinkDeviceByCode(next_device_code);
- //查询此终点的指令数量
- List byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
- if (byNextDeviceCode.size() >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点的指令数量:" + byNextDeviceCode.size() + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
- message = "查询此终点的指令数量,异常(729)";
- return true;
- }
-
- int count = 0;
- for (int i = 0; i < list.size(); i++) {
- String code = list.get(i);
- Device device = deviceAppservice.findDeviceByCode(code);
- StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
- if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
- standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
- if (standardCoveyorControlDeviceDriver.getMove() != 0) count += 1;
- }
- }
- //如果当前关联的设备中都有货的话,就返回
- if (count != 0 && count >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点关联设备中,有货的设备数量:" + count + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
- message = "当前关联的设备中都有货的话,就返回异常(746)";
- return true;
- }
- instructionService.create(instdto);
-
- //创建指令后修改任务状态
- WQLObject taskwo = WQLObject.getWQLObject("acs_task");
- task.setTask_status("1");
- JSONObject json = JSONObject.fromObject(task);
- taskwo.update(json);
- applySucess = true;
- this.setContainer("");
+ } else {
+ Instruction instdto = new Instruction();
+ instdto.setInstruction_id(IdUtil.simpleUUID());
+ instdto.setRoute_plan_code(route_plan_code);
+ instdto.setRemark(task.getRemark());
+ instdto.setMaterial(task.getMaterial());
+ instdto.setQuantity(task.getQuantity());
+ instdto.setTask_id(taskid);
+ instdto.setTask_code(taskcode);
+ instdto.setVehicle_code(vehiclecode);
+ String now = DateUtil.now();
+ instdto.setCreate_time(now);
+ instdto.setCreate_by("auto");
+ instdto.setStart_device_code(start_device_code);
+ instdto.setNext_device_code(next_device_code);
+ instdto.setStart_point_code(start_point_code);
+ instdto.setNext_point_code(next_point_code);
+ instdto.setPriority(priority);
+ instdto.setInstruction_status("0");
+ instdto.setExecute_device_code(start_point_code);
+ //查询关联设备数量
+ List list = deviceservice.queryLinkDeviceByCode(next_device_code);
+ //查询此终点的指令数量
+ List byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
+ if (byNextDeviceCode.size() >= list.size()) {
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点的指令数量:" + byNextDeviceCode.size() + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
+ message = "查询此终点的指令数量返回异常(787)";
return true;
}
- }
- } else {
- Instruction instdto = new Instruction();
- instdto.setInstruction_id(IdUtil.simpleUUID());
- instdto.setRoute_plan_code(route_plan_code);
- instdto.setRemark(task.getRemark());
- instdto.setMaterial(task.getMaterial());
- instdto.setQuantity(task.getQuantity());
- instdto.setTask_id(taskid);
- instdto.setTask_code(taskcode);
- instdto.setVehicle_code(vehiclecode);
- String now = DateUtil.now();
- instdto.setCreate_time(now);
- instdto.setCreate_by("auto");
- instdto.setStart_device_code(start_device_code);
- instdto.setNext_device_code(next_device_code);
- instdto.setStart_point_code(start_point_code);
- instdto.setNext_point_code(next_point_code);
- instdto.setPriority(priority);
- instdto.setInstruction_status("0");
- instdto.setExecute_device_code(start_point_code);
- //查询关联设备数量
- List list = deviceservice.queryLinkDeviceByCode(next_device_code);
- //查询此终点的指令数量
- List byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
- if (byNextDeviceCode.size() >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点的指令数量:" + byNextDeviceCode.size() + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
- message = "查询此终点的指令数量返回异常(787)";
- return true;
- }
- int count = 0;
- for (int i = 0; i < list.size(); i++) {
- String code = list.get(i);
- Device device = deviceAppservice.findDeviceByCode(code);
- StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
- if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
- standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
- if (standardCoveyorControlDeviceDriver.getMove() != 0) count += 1;
+ int count = 0;
+ for (int i = 0; i < list.size(); i++) {
+ String code = list.get(i);
+ Device device = deviceAppservice.findDeviceByCode(code);
+ StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
+ if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
+ standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
+ if (standardCoveyorControlDeviceDriver.getMove() != 0) count += 1;
+ }
}
- }
- //如果当前关联的设备中都有货的话,就返回
- if (count != 0 && count >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点关联设备中,有货的设备数量:" + count + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
- message = "当前关联的设备中都有货返回异常(804)";
+ //如果当前关联的设备中都有货的话,就返回
+ if (count != 0 && count >= list.size()) {
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点关联设备中,有货的设备数量:" + count + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
+ message = "当前关联的设备中都有货返回异常(804)";
+ return true;
+ }
+ instructionService.create(instdto);
+
+ //创建指令后修改任务状态
+ WQLObject taskwo = WQLObject.getWQLObject("acs_task");
+ task.setTask_status("1");
+ JSONObject json = JSONObject.fromObject(task);
+ taskwo.update(json);
+ applySucess = true;
+ this.setContainer("");
return true;
}
- instructionService.create(instdto);
//创建指令后修改任务状态
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
@@ -815,22 +831,12 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
taskwo.update(json);
applySucess = true;
this.setContainer("");
- return true;
+ } else {
+ log.info("未找到载具号{}对应任务", container);
}
-
- //创建指令后修改任务状态
- WQLObject taskwo = WQLObject.getWQLObject("acs_task");
- task.setTask_status("1");
- JSONObject json = JSONObject.fromObject(task);
- taskwo.update(json);
- applySucess = true;
- this.setContainer("");
- } else {
- log.info("未找到载具号{}对应任务", container);
}
+ return true;
}
- return true;
-}
public void writing() {
@@ -1047,7 +1053,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
//查询此终点的指令数量
List byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
if (byNextDeviceCode.size() >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点的指令数量:" + byNextDeviceCode.size() + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点的指令数量:" + byNextDeviceCode.size() + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
message = "查询此终点的指令数量返回异常(1051)";
return true;
}
@@ -1064,7 +1070,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
}
//如果当前关联的设备中都有货的话,就返回
if (count != 0 && count >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点关联设备中,有货的设备数量:" + count + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点关联设备中,有货的设备数量:" + count + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
message = "当前关联的设备中都有货返回异常(1068)";
return true;
}
@@ -1116,7 +1122,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
//查询此终点的指令数量
List byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
if (byNextDeviceCode.size() >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点的指令数量:" + byNextDeviceCode.size() + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点的指令数量:" + byNextDeviceCode.size() + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
message = "当前关联的设备中都有货返回异常(1120)";
return true;
}
@@ -1133,7 +1139,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
}
//如果当前关联的设备中都有货的话,就返回
if (count != 0 && count >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点关联设备中,有货的设备数量:" + count + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点关联设备中,有货的设备数量:" + count + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
message = "当前关联的设备中都有货返回异常(1137)";
return true;
}
@@ -1175,7 +1181,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
//查询此终点的指令数量
List byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
if (byNextDeviceCode.size() >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点的指令数量:" + byNextDeviceCode.size() + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点的指令数量:" + byNextDeviceCode.size() + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
message = "查询此终点的指令数量返回异常(1179)";
return true;
}
@@ -1192,7 +1198,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
}
//如果当前关联的设备中都有货的话,就返回
if (count != 0 && count >= list.size()) {
- logServer.log(taskcode,"当前分配的终点设备:"+ next_device_code +"","400","当前终点关联设备中,有货的设备数量:" + count + "","当前终点设备关联设备数量:"+ list.size() +"","","",this.container);
+ logServer.log(taskcode, "当前分配的终点设备:" + next_device_code + "", "400", "当前终点关联设备中,有货的设备数量:" + count + "", "当前终点设备关联设备数量:" + list.size() + "", "", "", this.container);
message = "当前关联的设备中都有货(1196)";
return true;
}
@@ -1246,15 +1252,21 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
}
public void apply_OutEmpty() {
- String result = acsToWmsService.apply_OutEmpty(this.getDeviceCode());
- JSONObject jo = JSONObject.fromObject(result);
- if (ObjectUtil.isEmpty(jo)) {
- message = "接口不通";
+ Date date = new Date();
+ if (date.getTime() - this.instruction_require_time.getTime() < 6000) {
+ log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
} else {
- if (jo.getInt("status") == 200) {
- this.setRequireSucess(true);
+ this.instruction_require_time = date;
+ String result = acsToWmsService.apply_OutEmpty(this.getDeviceCode());
+ JSONObject jo = JSONObject.fromObject(result);
+ if (ObjectUtil.isEmpty(jo)) {
+ message = "接口不通";
} else {
- this.setRequireSucess(false);
+ if (jo.getInt("status") == 200) {
+ this.setRequireSucess(true);
+ } else {
+ this.setRequireSucess(false);
+ }
}
}
}
diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
index 2feea76..9399cee 100644
--- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
+++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
@@ -256,7 +256,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
try {
result2 = HttpRequest.post(url)
.header("Authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyNDY0ZDY4OTNjYTA0ZWVmOWI5MWYwYTExYWY1MzYzMyIsImF1dGgiOiJhZG1pbiIsInN1YiI6ImFkbWluIn0.0SW4TtIMZ79RhkWg4YOsm7_hfEWUaQLnuNsRxJI38GQbXxs8mMWBd972jNQIfTMS8DB3aVMH9QyNpSzuRdfD7A")
- .body(String.valueOf(jo))
+ .body(jo.toString())
.execute().body();
System.out.println(result2);
log.info("apply_OutEmpty----返回参数{}", result2);
diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
index ae2ff13..77c370e 100644
--- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
+++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
@@ -949,7 +949,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
//如果此站点为1002,并且指令创建锁是打开的话,则不需要再次创建
if (ObjectUtil.isNotEmpty(apply_task) && apply_task.equals("true")
&& !scannerDeviceDriver.getCreateLock()) {
- obj.setRequest_again("1");
+ // obj.setRequest_again("1");
}
}
//如果为输送指令
@@ -986,6 +986,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
// }
+ entity.setInstruction_status("2");
+ JSONObject json = JSONObject.fromObject(entity);
+ wo.update(json);
+
+ removeByCodeFromCache(entity.getInstruction_code());
+
// =0 则不用再次请求
if (StrUtil.equals(obj.getRequest_again(), "0")) {
@@ -998,9 +1004,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
finishAndCreateNextInst(entity);
}
}
- entity.setInstruction_status("2");
- JSONObject json = JSONObject.fromObject(entity);
- wo.update(json);
+
//将指令条码写入终点设备中去
if (ObjectUtil.isNotEmpty(vehicle_code)) {
@@ -1022,7 +1026,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
lampThreecolorDeviceDriver.writing(0);
}
}
- removeByCodeFromCache(entity.getInstruction_code());
}
@Override
diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
index 546fa46..521abea 100644
--- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
+++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
@@ -9,7 +9,6 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
-import javafx.concurrent.Task;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
@@ -591,7 +590,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
}
@Override
- @Transactional(rollbackFor = Exception.class)
+ //@Transactional(rollbackFor = Exception.class)
public void update(TaskDto dto) {
TaskDto entity = this.findById(dto.getTask_id());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java b/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java
index 69c44c2..c367ee1 100644
--- a/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java
+++ b/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java
@@ -717,7 +717,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
inst.setAgv_jobno(String.valueOf(index));
inst.setSend_status("1");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
flag = true;
}
@@ -739,7 +739,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (standardInspectSiteDeviceDriver.getMove() != 0) {
inst.setExecute_status("1");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
log.info("AGV请求取货设备{}无货,无法反馈", device_code);
@@ -750,7 +750,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (standardEmptyPalletSiteDeviceDriver.getMove() != 0) {
inst.setExecute_status("1");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
log.info("AGV请求取货设备{}无货,无法反馈", device_code);
@@ -758,13 +758,13 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
}
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
- if (standardCoveyorControlDeviceDriver.getMove() != 0) {
+ if (standardCoveyorControlDeviceDriver.getMove() != 0 ) {
inst.setExecute_status("1");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
- log.info("AGV请求取货设备{}无货,无法反馈", device_code);
+ log.info("AGV请求取货设备{}无货,无法反馈", device_code, inst.getInstruction_code(), standardCoveyorControlDeviceDriver.getTask());
}
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
@@ -772,13 +772,13 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.IGNOREHASGOODS), "1")) {
inst.setExecute_status("1");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
if (device.getHas_goods() != 0) {
inst.setExecute_status("1");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
log.info("AGV请求取货设备{}无货,无法反馈", device_code);
@@ -789,7 +789,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
inst.setExecute_status("1");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
}
}
@@ -802,7 +802,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
int start_point_address = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
int next_point_address = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
- data = AgvService.sendAgvOneModeInst(phase, index, start_point_address,next_point_address);
+ data = AgvService.sendAgvOneModeInst(phase, index, start_point_address, next_point_address);
}
@@ -817,14 +817,14 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
inst.setExecute_status("5");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
}
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
inst.setExecute_status("5");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
standardCoveyorControlDeviceDriver.writing(1, 2);
standardCoveyorControlDeviceDriver.writing(1, 2);
log.info("AGV取货完成,下发输送取货完成,指令号{}", ikey);
@@ -834,14 +834,14 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
standardEmptyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) device.getDeviceDriver();
inst.setExecute_status("5");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
inst.setExecute_status("5");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
JSONObject jo = new JSONObject();
jo.put("device_code", device.getDevice_code());
@@ -852,7 +852,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
inst.setExecute_status("5");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
}
}
@@ -863,12 +863,12 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
log.info("未找到指令号{}对应的指令", ikey);
break;
}
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
}
// 球磨车间上料完成请求离开
else if (phase == 0x09) {
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
}
//请求放货库位
@@ -899,7 +899,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
}
int next_point_address = deviceService.queryAddressBydeviceCode(next_point);
- data = AgvService.sendAgvOneModeInst(phase, index, next_point_address,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, next_point_address, 0);
TaskDto task = taskService.findByCodeFromCache(inst.getTask_code());
task.setNext_device_code(next_device);
@@ -922,7 +922,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (standardInspectSiteDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
log.info("AGV请求放货设备{}有货,无法反馈", device_code);
@@ -931,10 +931,10 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//空盘堆叠站点
if (device.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver) {
standardEmptyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) device.getDeviceDriver();
- if (standardEmptyPalletSiteDeviceDriver.getNumber() < Integer.parseInt(emptyNum)) {
+ if (standardEmptyPalletSiteDeviceDriver.getNumber() <= Integer.parseInt(emptyNum)) {
inst.setExecute_status("5");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
log.info("AGV请求放货设备{}数量异常,无法反馈", device_code);
@@ -945,7 +945,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (standardCoveyorControlDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
log.info("AGV请求放货设备{}有货,无法反馈", device_code);
@@ -956,7 +956,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.IGNOREHASGOODS), "1")) {
inst.setExecute_status("3");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
JSONObject jo = new JSONObject();
jo.put("device_code", device.getDevice_code());
@@ -967,7 +967,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getHas_goods() == 0) {
inst.setExecute_status("3");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
JSONObject jo = new JSONObject();
jo.put("device_code", device.getDevice_code());
@@ -982,7 +982,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
inst.setExecute_status("3");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
}
}
@@ -1001,12 +1001,12 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (StrUtil.equals(dto.getTask_status(), "1") || StrUtil.equals(dto.getTask_status(), "0")) {
inst.setExecute_status("5");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
} else {
inst.setExecute_status("5");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
} else {
log.info("AGV放货完成设备{}数量异常,无法反馈", device_code);
@@ -1017,7 +1017,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (standardInspectSiteDeviceDriver.getMove() != 0) {
inst.setExecute_status("6");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
log.info("AGV放货完成请求离开设备{}无货,无法反馈", device_code);
@@ -1028,10 +1028,10 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (standardCoveyorControlDeviceDriver.getMove() != 0) {
inst.setExecute_status("6");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
standardCoveyorControlDeviceDriver.writing(1, 3);
standardCoveyorControlDeviceDriver.writing(1, 3);
- log.info("AGV放货完成,下发输送放货完成,设备号{},指令号{}",device_code, ikey);
+ log.info("AGV放货完成,下发输送放货完成,设备号{},指令号{}", device_code, ikey);
flag = true;
} else {
log.info("AGV放货完成请求离开设备{}无货,无法反馈", device_code);
@@ -1042,13 +1042,13 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.IGNOREHASGOODS), "1")) {
inst.setExecute_status("6");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
if (device.getHas_goods() != 0) {
inst.setExecute_status("6");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
flag = true;
} else {
log.info("AGV放货完成请求离开设备{}无货,无法反馈", device_code);
@@ -1059,7 +1059,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
inst.setExecute_status("6");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
}
//任务完毕
@@ -1069,12 +1069,12 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
inst.setInstruction_status("2");
instructionService.finish(inst);
}
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
//请求删除任务
else if (phase == 0x30) {
flag = true;
- data = AgvService.sendAgvOneModeInst(0x8F, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(0x8F, index, 0, 0);
}
//任务删除确认
//(需要WCS反馈)
@@ -1083,7 +1083,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (!ObjectUtil.isEmpty(inst)) {
instructionService.cancelNOSendAgv(inst.getInstruction_id());
}
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
} else if (phase == 0x50)//进入区域
{
//开门
@@ -1097,16 +1097,16 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
standardAutodoorDeviceDriver.setLock_name(String.valueOf(index));
standardAutodoorDeviceDriver.setIs_lock(true);
standardAutodoorDeviceDriver.OpenOrClose("1");
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
//如果是同一辆车发起的二次请求就允许
else if (standardAutodoorDeviceDriver.getAction() == 1
- && standardAutodoorDeviceDriver.getLock_name().equals(String.valueOf(index))){
+ && standardAutodoorDeviceDriver.getLock_name().equals(String.valueOf(index))) {
standardAutodoorDeviceDriver.setLock_name(String.valueOf(index));
standardAutodoorDeviceDriver.setIs_lock(true);
standardAutodoorDeviceDriver.OpenOrClose("1");
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
}
if (device.getDeviceDriver() instanceof ManipulatorInspectSiteNDCDeviceDriver) {
@@ -1118,7 +1118,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) relevance_device.getDeviceDriver();
int io_action = standardManipulatorInspectSiteDeviceDriver.getIo_action();
if (io_action == 1 || io_action == 3) {
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
}
}
@@ -1132,7 +1132,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (String.valueOf(index).equals(standardAutodoorDeviceDriver.getLock_name()) || !standardAutodoorDeviceDriver.getIs_lock()) {
standardAutodoorDeviceDriver.setLock_name("");
standardAutodoorDeviceDriver.setIs_lock(false);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
}
if (device.getDeviceDriver() instanceof ManipulatorInspectSiteNDCDeviceDriver) {
@@ -1144,13 +1144,13 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) relevance_device.getDeviceDriver();
int io_action = standardManipulatorInspectSiteDeviceDriver.getIo_action();
if (io_action == 2 || io_action == 3) {
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
}
}
} else if (phase == 0x64) {
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
//上报异常
else if (phase == 0x67) {
@@ -1240,7 +1240,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
inst.setAgv_jobno(String.valueOf(index));
inst.setSend_status("1");
instructionService.update(inst);
- data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, 0, 0);
}
flag = true;
}
@@ -1406,7 +1406,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
}
int next_point_address = deviceService.queryAddressBydeviceCode(next_point);
- data = AgvService.sendAgvOneModeInst(phase, index, next_point_address,0);
+ data = AgvService.sendAgvOneModeInst(phase, index, next_point_address, 0);
TaskDto task = taskService.findByCodeFromCache(inst.getTask_code());
task.setNext_device_code(next_device);
@@ -2605,7 +2605,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (standardEmptyPalletSiteDeviceDriver.getNumber() == Integer.parseInt(emptyNum)) {
if (standardEmptyPalletSiteDeviceDriver.getNumber() == Integer.parseInt(device.getExtraValue().get("max_emptypalletnum").toString())) {
TaskDto dto = taskService.findByStartCode(device_code);
- if(!ObjectUtil.isEmpty(dto)){
+ if (!ObjectUtil.isEmpty(dto)) {
if (StrUtil.equals(dto.getTask_status(), "1")) {
inst.setExecute_status("5");
instructionService.update(inst);