Browse Source

终点寻找起点路由生成指令改造

master
pangshenghao 1 year ago
parent
commit
9a4cd15463
  1. 5
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java
  2. 159
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
  3. 8
      acs/hd/nladmin-system/src/main/java/org/nl/acs/stage/service/impl/StageActorServiceImpl.java
  4. 28
      acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java
  5. 3
      acs/qd/src/views/acs/monitor/device/index.vue

5
acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java

@ -1098,6 +1098,11 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
standardInspectSiteDeviceDriver.setBatch(batch); standardInspectSiteDeviceDriver.setBatch(batch);
device.setMaterial_type(material_type); device.setMaterial_type(material_type);
device.setBatch(batch); device.setBatch(batch);
if (!StrUtil.isEmpty(hasGoodStatus)) {
standardInspectSiteDeviceDriver.setHasGoods(Integer.parseInt(hasGoodStatus));
device.setHas_goods(Integer.parseInt(hasGoodStatus));
standardInspectSiteDeviceDriver.setMove(Integer.parseInt(hasGoodStatus));
}
} else if (device.getDeviceDriver() instanceof YkbkSpecialDeviceDriver) { } else if (device.getDeviceDriver() instanceof YkbkSpecialDeviceDriver) {
ykbkSpecialDeviceDriver = (YkbkSpecialDeviceDriver) device.getDeviceDriver(); ykbkSpecialDeviceDriver = (YkbkSpecialDeviceDriver) device.getDeviceDriver();
ykbkSpecialDeviceDriver.setMaterial(material_type); ykbkSpecialDeviceDriver.setMaterial(material_type);

159
acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -15,6 +15,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver; import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
@ -141,9 +142,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
devicecode = this.getDeviceCode(); devicecode = this.getDeviceCode();
mode = this.itemProtocol.getMode(); mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError(); error = this.itemProtocol.getError();
move = this.itemProtocol.getMove();
task = this.itemProtocol.getTask(); task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.getMove();
if (mode != last_mode) { if (mode != last_mode) {
this.setEmptyrequireSucess(false); this.setEmptyrequireSucess(false);
@ -295,7 +294,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
case 3: case 3:
if (!inrequireSucess) { if (!inrequireSucess) {
if (move == 1){ if (move != 0) {
this.execute_log.log("设备:" + devicecode + ",move:" + move); this.execute_log.log("设备:" + devicecode + ",move:" + move);
this.apply_in_require(container); this.apply_in_require(container);
} }
@ -308,21 +307,15 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
break; break;
case 5: case 5:
if (!emptyrequireSucess){ //终点查找起点是否有货,生成任务
//mode = 5 并且工位上无货时申请空托盘 if (!inrequireSucess) {
if (move == 0){
this.execute_log.log("设备:" + devicecode + ",move:" + move); this.execute_log.log("设备:" + devicecode + ",move:" + move);
this.apply_empty_require(container); this.apply_in_require_endPoint(container);
}
} }
break; break;
case 6: case 6:
if (!inrequireSucess){ this.cancle_require_endpoint();
if (move == 1){ //终点取消任务
this.execute_log.log("设备:" + devicecode + ",move:" + move);
this.apply_in_require(container);
}
}
break; break;
} }
@ -443,16 +436,21 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
public boolean instruction_require(String container_code) { public boolean instruction_require(String container_code) {
return instruction_require(container_code, WcsConfig.task_container_type_default_desc); return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
} }
public synchronized boolean apply_empty_require(String container_code) { public synchronized boolean apply_empty_require(String container_code) {
return apply_empty_require(container_code, WcsConfig.task_container_type_default_desc); return apply_empty_require(container_code, WcsConfig.task_container_type_default_desc);
} }
public synchronized boolean apply_in_require(String container_code) { public synchronized boolean apply_in_require(String container_code) {
return apply_in_require(container_code, WcsConfig.task_container_type_default_desc); return apply_in_require(container_code, WcsConfig.task_container_type_default_desc);
} }
public synchronized boolean apply_in_require_endPoint(String container_code) {
return apply_in_require_endPoint(container_code, WcsConfig.task_container_type_default_desc);
}
/** /**
* 请求取消指令 * 请求取消指令
*
*/ */
public synchronized boolean cancle_require() throws Exception { public synchronized boolean cancle_require() throws Exception {
Date date = new Date(); Date date = new Date();
@ -481,6 +479,31 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
} }
} }
/**
* 终点请求取消指令
*/
public synchronized boolean cancle_require_endpoint() throws Exception {
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);
return false;
} else {
this.instruction_require_time = date;
TaskDto task = taskserver.findByNextCode(this.devicecode);
try {
Instruction inst = instructionService.findByTaskCodeFromCache(task.getTask_code());
if (ObjectUtil.isNotEmpty(inst)) {
instructionService.cancel(inst.getInstruction_id());
}
taskserver.cancel(task.getTask_id());
} catch (Exception e) {
e.printStackTrace();
}
writing(6);
return true;
}
}
/** /**
* 请求指令 * 请求指令
@ -588,6 +611,112 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
} }
} }
/**
* 终点请求指令
*
* @param container_code
* @param container_type
*/
public synchronized boolean apply_in_require_endPoint(String container_code, String container_type) {
WQLObject runpointwo = WQLObject.getWQLObject("acs_device_runpoint");
Date date = new Date();
Boolean flag = false;
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return false;
} else {
this.instruction_require_time = date;
//查询该设备所有路由
List<RouteLineDto> pathLinesByCode = routelineserver.getPathLinesByCode(this.getDevice().getDevice_code(), "normal");
StandardOrdinarySiteDeviceDriver standardInspectSiteDeviceDriver;
for (int i = 0; i < pathLinesByCode.size(); i++) {
RouteLineDto routeLineDto = pathLinesByCode.get(i);
//获取该路由的起点设备编码
String start_device_code = routeLineDto.getDevice_code();
//获取该路由的终点设备编码
String next_device_code = routeLineDto.getNext_device_code();
//获取该路由终点设备信息
Device route_link_device = deviceAppservice.findDeviceByCode(start_device_code);
//判断终点设备驱动是否为检测站点驱动
if (route_link_device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
// standardInspectSiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) route_link_device.getDeviceDriver();
// //判断该终点设备是否无货,无货就结束循环
// if (standardInspectSiteDeviceDriver.getHasGoods() == 0) {
// continue;
// }
//判断是否已经有该起点设备的任务,如果有就结束循环
int num1 = taskserver.querySameOriginTask(start_device_code);
if (num1 != 0) {
continue;
}
//判断是否有相同终点的任务,有就结束本次循环
int num = taskserver.querySameDestinationTask(next_device_code);
if (num != 0) {
continue;
}
/* //判断检测站点是否锁定,如果锁定就结束本次循环
JSONObject jsonObject = runpointwo.query("device_code = '" + next_device_code + "' and islock = '1'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)) {
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备," + next_device_code + "已锁定");
continue;
}*/
//创建任务
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setVehicle_code(container_code);
dto.setVehicle_type(container_type);
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("1");
dto.setMaterial(this.getDevice().getMaterial_type());
dto.setUpdate_time(now);
dto.setCreate_time(now);
dto.setStart_device_code(start_device_code);
dto.setStart_point_code(start_device_code);
dto.setNext_device_code(next_device_code);
dto.setNext_point_code(next_device_code);
try {
//判断是否已经有该起点设备的任务,如果有就结束循环
int num2 = taskserver.querySameOriginTask(start_device_code);
if (num2 != 0) {
continue;
}
//判断是否有相同终点的任务,有就结束本次循环
int num3 = taskserver.querySameDestinationTask(next_device_code);
if (num3 != 0) {
continue;
}
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 + "'");*/
flag = true;
writing(5);
break;
} catch (Exception e) {
this.execute_log.log("设备:" + devicecode + "", "", "创建任务失败");
}
}
}
//生成任务成功
if (flag) {
inrequireSucess = true;
this.execute_log.log("设备:" + devicecode + "", "", "对应路由设备,生成任务成功已锁定");
}
return true;
}
}
/** /**
* 请求指令 * 请求指令
* *

8
acs/hd/nladmin-system/src/main/java/org/nl/acs/stage/service/impl/StageActorServiceImpl.java

@ -517,16 +517,18 @@ public class StageActorServiceImpl implements StageActorService {
} else if (standardInspectSiteDevicedriver.getMode() == 2) { } else if (standardInspectSiteDevicedriver.getMode() == 2) {
mode = "联机"; mode = "联机";
} }
if (standardInspectSiteDevicedriver.getMove() == 0) { if (standardInspectSiteDevicedriver.getHasGoods() == 0) {
move = "无货"; move = "无货";
} else if (standardInspectSiteDevicedriver.getMove() == 1) { } else if (standardInspectSiteDevicedriver.getHasGoods() == 1) {
move = "有货"; move = "有货";
} else if (standardInspectSiteDevicedriver.getMove() == 2) { } else if (standardInspectSiteDevicedriver.getHasGoods() == 2) {
move = "有托盘有货"; move = "有托盘有货";
} }
obj.put("device_name", standardInspectSiteDevicedriver.getDevice().getDevice_name()); obj.put("device_name", standardInspectSiteDevicedriver.getDevice().getDevice_name());
jo.put("mode", mode); jo.put("mode", mode);
jo.put("move", move); jo.put("move", move);
//点击弹出
jo.put("is_click", true);
jo.put("hasGoods", standardInspectSiteDevicedriver.getHasGoods()); jo.put("hasGoods", standardInspectSiteDevicedriver.getHasGoods());
jo.put("isOnline", standardInspectSiteDevicedriver.getIsonline()); jo.put("isOnline", standardInspectSiteDevicedriver.getIsonline());
jo.put("error", standardInspectSiteDevicedriver.getError()); jo.put("error", standardInspectSiteDevicedriver.getError());

28
acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java

@ -279,22 +279,22 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
//普通站点 //普通站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); // standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.IGNOREHASGOODS), "1")) { // if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.IGNOREHASGOODS), "1")) {
inst.setExecute_status("1"); // inst.setExecute_status("1");
instructionService.update(inst); // instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
if (device.getHas_goods() != 0) {
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0); data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true; flag = true;
} else { // } else {
log.info("AGV请求取货设备{}无货,无法反馈", device_code); // if (device.getHas_goods() != 0) {
} // inst.setExecute_status("1");
} // instructionService.update(inst);
// data = AgvService.sendAgvOneModeInst(phase, index, 0);
// flag = true;
// } else {
// log.info("AGV请求取货设备{}无货,无法反馈", device_code);
// }
// }
} }
//标准版-货架 //标准版-货架

3
acs/qd/src/views/acs/monitor/device/index.vue

@ -137,8 +137,7 @@
<el-form-item label="设备状态" label-width="80px"> <el-form-item label="设备状态" label-width="80px">
<el-radio-group v-model="form.hasGoodStatus"> <el-radio-group v-model="form.hasGoodStatus">
<el-radio-button :label="0">无货</el-radio-button> <el-radio-button :label="0">无货</el-radio-button>
<el-radio-button :label="1">有托盘</el-radio-button> <el-radio-button :label="1">有货</el-radio-button>
<el-radio-button :label="2">有托盘有货</el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-form> </el-form>

Loading…
Cancel
Save