This commit is contained in:
loujf
2022-07-20 10:17:19 +08:00
parent f63b484aa0
commit 1d3d164dfc
3 changed files with 43 additions and 6 deletions

View File

@@ -625,7 +625,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
//查询关联设备数量
List<String> list = deviceservice.queryLinkDeviceByCode(next_point_code);
List<String> list = deviceservice.queryLinkDeviceByCode(next_device_code);
//查询此终点的指令数量
List<Instruction> byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
if (byNextDeviceCode.size() >= list.size()) {
@@ -689,7 +689,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
//查询关联设备数量
List<String> list = deviceservice.queryLinkDeviceByCode(next_point_code);
List<String> list = deviceservice.queryLinkDeviceByCode(next_device_code);
//查询此终点的指令数量
List<Instruction> byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
if (byNextDeviceCode.size() >= list.size()) {
@@ -743,7 +743,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
//查询关联设备数量
List<String> list = deviceservice.queryLinkDeviceByCode(next_point_code);
List<String> list = deviceservice.queryLinkDeviceByCode(next_device_code);
//查询此终点的指令数量
List<Instruction> byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
if (byNextDeviceCode.size() >= list.size()) {
@@ -995,7 +995,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
instdto.setExecute_device_code(start_point_code);
//查询关联设备数量
List<String> list = deviceservice.queryLinkDeviceByCode(next_point_code);
List<String> list = deviceservice.queryLinkDeviceByCode(next_device_code);
//查询此终点的指令数量
List<Instruction> byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
if (byNextDeviceCode.size() >= list.size()) {
@@ -1060,7 +1060,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
//查询关联设备数量
List<String> list = deviceservice.queryLinkDeviceByCode(next_point_code);
List<String> list = deviceservice.queryLinkDeviceByCode(next_device_code);
//查询此终点的指令数量
List<Instruction> byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
if (byNextDeviceCode.size() >= list.size()) {
@@ -1115,7 +1115,7 @@ public synchronized boolean instruction_apply(String container_code) throws Exce
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
//查询关联设备数量
List<String> list = deviceservice.queryLinkDeviceByCode(next_point_code);
List<String> list = deviceservice.queryLinkDeviceByCode(next_device_code);
//查询此终点的指令数量
List<Instruction> byNextDeviceCode = instructionService.findByNextDeviceCode(next_device_code);
if (byNextDeviceCode.size() >= list.size()) {

View File

@@ -88,6 +88,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
TaskService taskService;
@Autowired
LogServer logServer;
@Autowired
DeviceService deviceService;
@Override
@@ -1143,6 +1145,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code());
if (deviceByCode.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
scannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) deviceByCode.getDeviceDriver();
//此字段只为识别1002
String apply_task = scannerDeviceDriver.getDevice().getExtraValue().get("apply_task").toString();
//如果此站点为1002并且指令创建锁是打开的话则不需要再次创建
if (ObjectUtil.isNotEmpty(apply_task) && apply_task.equals("true")
@@ -1284,6 +1287,33 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
instdto.setInstruction_status("0");
instdto.setExecute_device_code(dto.getNext_device_code());
logServer.log(instdto.getTask_code(),"finishAndCreateNextInst","",JSONObject.fromObject(dto).toString(),"","",now,instdto.getCarno());
List<RouteLineDto> routeLineDtoList = routeLineService.getShortPathLines(instdto.getStart_device_code(), instdto.getNext_device_code(), instdto.getRoute_plan_code());
String type = routeLineDtoList.get(0).getType();
if (type.equals("0")) {
//查询关联设备数量
List<String> deviceList = deviceService.queryLinkDeviceByCode(next_device_code);
//查询此终点的指令数量
List<Instruction> byNextDeviceCode = this.findByNextDeviceCode(next_device_code);
if (byNextDeviceCode.size() >= deviceList.size()) {
return;
}
int count = 0;
for (int i = 0; i < deviceList.size(); i++) {
String code = deviceList.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()) {
return;
}
}
this.create(instdto);
}

View File

@@ -1227,9 +1227,16 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
// }
// if (!conveyLock) {
//查询所有的关联设备
List<String> list1 = deviceService.queryLinkDeviceByCode(this_device_code);
int count = 0;
//查询此终点的指令数量
List<Instruction> byNextDeviceCode = instructionService.findByNextDeviceCode(this_device_code);
if (byNextDeviceCode.size() >= list1.size()) {
break;
}
for (int z = 0; z < list1.size(); z++) {
String code = list1.get(i);
Device device = deviceAppService.findDeviceByCode(code);