This commit is contained in:
2022-07-24 00:24:56 +08:00
parent 59a308119a
commit 9f017370b3
3 changed files with 25 additions and 11 deletions

View File

@@ -382,6 +382,12 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
if (number != max_emptypalletnum){
return true;
}
//判断检测站点是否锁定,如果锁定就结束本次循环
JSONObject jsonObject = runpointwo.query("device_code = '" + this.getDevice().getDevice_code() + "' and islock = 'true'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)) {
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备," + devicecode + "已锁定");
return true;
}
//查询该设备所有路由
List<RouteLineDto> pathLinesByCode = routelineserver.getSuperiorShortPathLinesByCode(this.getDevice().getDevice_code(), "normal");
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
@@ -410,12 +416,6 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
if (num != 0) {
continue;
}
/* //判断检测站点是否锁定,如果锁定就结束本次循环
JSONObject jsonObject = runpointwo.query("device_code = '" + start_device_code + "' and islock = 'true'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)) {
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备," + devicecode + "已锁定");
continue;
}*/
//创建任务
TaskDto dto = new TaskDto();
String now = DateUtil.now();
@@ -448,11 +448,11 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
}
taskserver.create(dto);
//任务创建成功 锁定起点设备
/* JSONObject map = new JSONObject();
JSONObject map = new JSONObject();
map.put("islock", "true");
map.put("update_by", "auto");
map.put("update_time", DateUtil.now());
runpointwo.update(map, "device_code = '" + start_device_code + "'");*/
runpointwo.update(map, "device_code = '" + start_device_code + "'");
flag = true;
break;
} catch (Exception e) {

View File

@@ -592,12 +592,12 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
if (num1 != 0) {
continue;
}
/* //判断起点是否锁定,如果被锁定就结束循环
JSONObject jsonObject = runpointwo.query("device_code = '" + next_device_code + "' and islock = 'true'").uniqueResult(0);
//判断起点是否锁定,如果被锁定就结束循环
JSONObject jsonObject = runpointwo.query("device_code = '" + start_device_code + "' and islock = 'true'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)) {
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备," + next_device_code + "已锁定");
continue;
}*/
}
//创建任务
TaskDto dto = new TaskDto();
String now = DateUtil.now();

View File

@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.standard_ordinary_site;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -151,6 +152,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
* @return
*/
public synchronized boolean autoCreateTask() {
WQLObject runpointwo = WQLObject.getWQLObject("acs_device_runpoint");
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
@@ -197,6 +199,12 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
if (number >= standardEmptyPalletSiteDeviceDriver.getMax_emptypalletnum()){
continue;
}
//判断终点是否锁定,如果被锁定就结束本次循环
JSONObject jsonObject = runpointwo.query("device_code = '" + next_device_code + "' and islock = 'true'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)) {
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备," + next_device_code + "已锁定");
continue;
}
//判断是否已经有该起点设备的任务,如果有就结束循环
int num1 = taskserver.querySameOriginTask(next_device_code);
int num2 = taskserver.querySameDestinationTask(next_device_code);
@@ -216,6 +224,12 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
//判断是否已经有该起点设备的任务,如果有就结束循环
try {
taskserver.create(dto);
//任务创建成功 锁定该终点设备
JSONObject map = new JSONObject();
map.put("islock", "true");
map.put("update_by", "auto");
map.put("update_time", DateUtil.now());
runpointwo.update(map, "device_code = '" + next_device_code + "'");
} catch (Exception e) {
e.printStackTrace();
}