洁美优化
This commit is contained in:
@@ -282,4 +282,11 @@ public interface DeviceService {
|
|||||||
List<Device> findCacheDevice();
|
List<Device> findCacheDevice();
|
||||||
|
|
||||||
void updateBarcode(JSONObject json) throws Exception;
|
void updateBarcode(JSONObject json) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询下拉框关联设备号
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> queryLinkDeviceByCode(String device_code);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1493,4 +1493,23 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
|||||||
}
|
}
|
||||||
return agvQty;
|
return agvQty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> queryLinkDeviceByCode(String device_code) {
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
|
||||||
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
|
Device device = appService.findDeviceByCode(device_code);
|
||||||
|
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("link_device_code"))) {
|
||||||
|
Object[] arr = (Object[]) device.getExtraValue().get("link_device_code");
|
||||||
|
String[] str_arr = new String[arr.length];
|
||||||
|
for (int i = 0; i < arr.length; i++) {
|
||||||
|
str_arr[i] = (String) arr[i];
|
||||||
|
}
|
||||||
|
for (int j = 0; j < str_arr.length; j++) {
|
||||||
|
list.add(str_arr[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ public class ItemProtocol {
|
|||||||
return this.getOpcIntegerValue(item_mode);
|
return this.getOpcIntegerValue(item_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return this.getOpcIntegerValue(item_height);
|
||||||
|
}
|
||||||
|
|
||||||
public int getMove() {
|
public int getMove() {
|
||||||
return this.getOpcIntegerValue(item_move);
|
return this.getOpcIntegerValue(item_move);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import lombok.Data;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.nl.acs.config.AcsConfig;
|
import org.nl.acs.config.AcsConfig;
|
||||||
import org.nl.acs.config.server.AcsConfigService;
|
import org.nl.acs.config.server.AcsConfigService;
|
||||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||||
@@ -16,14 +17,13 @@ import org.nl.acs.device_driver.DeviceDriver;
|
|||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
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.jmagv.JMAgvDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||||
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.*;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
|
||||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
|
||||||
import org.nl.acs.opc.WcsConfig;
|
|
||||||
import org.nl.acs.route.service.RouteLineService;
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
@@ -61,7 +61,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class);
|
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class);
|
||||||
String container;
|
String container = "";
|
||||||
String container_type_desc;
|
String container_type_desc;
|
||||||
String last_container_type_desc;
|
String last_container_type_desc;
|
||||||
String last_container;
|
String last_container;
|
||||||
@@ -76,10 +76,12 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
int task = 0;
|
int task = 0;
|
||||||
//出入库模式
|
//出入库模式
|
||||||
int operation_type = 0;
|
int operation_type = 0;
|
||||||
|
int height = 0;
|
||||||
int last_mode = 0;
|
int last_mode = 0;
|
||||||
int last_error = 0;
|
int last_error = 0;
|
||||||
int last_move = 0;
|
int last_move = 0;
|
||||||
int last_task = 0;
|
int last_task = 0;
|
||||||
|
int last_height = 0;
|
||||||
|
|
||||||
Boolean isonline = true;
|
Boolean isonline = true;
|
||||||
int hasGoods = 0;
|
int hasGoods = 0;
|
||||||
@@ -132,6 +134,9 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
|
|
||||||
|
//指令创建锁
|
||||||
|
Boolean createLock = false;
|
||||||
|
|
||||||
String device_code;
|
String device_code;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -151,6 +156,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
task = this.itemProtocol.getTask();
|
task = this.itemProtocol.getTask();
|
||||||
hasGoods = this.itemProtocol.getMove();
|
hasGoods = this.itemProtocol.getMove();
|
||||||
operation_type = this.itemProtocol.getOperation_type();
|
operation_type = this.itemProtocol.getOperation_type();
|
||||||
|
height = this.itemProtocol.getHeight();
|
||||||
if (mode != last_mode) {
|
if (mode != last_mode) {
|
||||||
this.execute_log.setResource(this.device_code, this.device_code);
|
this.execute_log.setResource(this.device_code, this.device_code);
|
||||||
this.execute_log.log("设备:" + device_code + ",last_mode -> mode:" + last_mode + "->" + mode);
|
this.execute_log.log("设备:" + device_code + ",last_mode -> mode:" + last_mode + "->" + mode);
|
||||||
@@ -168,6 +174,10 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
this.execute_log.setResource(this.device_code, this.device_code);
|
this.execute_log.setResource(this.device_code, this.device_code);
|
||||||
this.execute_log.log("设备:" + device_code + ",last_error -> error:" + last_error + "->" + error);
|
this.execute_log.log("设备:" + device_code + ",last_error -> error:" + last_error + "->" + error);
|
||||||
}
|
}
|
||||||
|
if (height != last_height) {
|
||||||
|
this.execute_log.setResource(this.device_code, this.device_code);
|
||||||
|
this.execute_log.log("设备:" + device_code + ",last_height -> height:" + last_height + "->" + height);
|
||||||
|
}
|
||||||
|
|
||||||
if (move != 0 && task > 0) {
|
if (move != 0 && task > 0) {
|
||||||
//inst_message
|
//inst_message
|
||||||
@@ -216,14 +226,21 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
log.debug("设备运转模式:等待工作");
|
log.debug("设备运转模式:等待工作");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
// //申请任务
|
||||||
|
// if (!StrUtil.isEmpty(material) && !StrUtil.isEmpty(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) {
|
||||||
|
// this.execute_log.log("设备:" + device_code + ",material:" + material + ",qty:" + qty);
|
||||||
|
// this.instruction_require(container);
|
||||||
|
// }
|
||||||
|
// //申请指令
|
||||||
|
// if (hasGoods > 0 && operation_type == 2 && !applySucess) {
|
||||||
|
// instruction_apply();
|
||||||
|
// }
|
||||||
//申请任务
|
//申请任务
|
||||||
if (!StrUtil.isEmpty(material) && !StrUtil.isEmpty(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) {
|
if (hasGoods > 0 && error == 0 && !StrUtil.isEmpty(container) && height > 0 && !requireSucess) {
|
||||||
this.execute_log.log("设备:" + device_code + ",material:" + material + ",qty:" + qty);
|
instruction_require(container);
|
||||||
this.instruction_require(container);
|
|
||||||
}
|
}
|
||||||
//申请指令
|
if (hasGoods > 0 && error == 0 && !StrUtil.isEmpty(container) && height > 0 && !applySucess) {
|
||||||
if (hasGoods > 0 && operation_type == 2 && !applySucess) {
|
instruction_apply(container);
|
||||||
instruction_apply();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@@ -240,10 +257,10 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
//申请入库
|
// //申请入库
|
||||||
if (move != 0 && !applySucess) {
|
// if (move != 0 && !applySucess) {
|
||||||
instruction_apply();
|
// instruction_apply();
|
||||||
}
|
// }
|
||||||
if (move != 0 && !requireSucess) {
|
if (move != 0 && !requireSucess) {
|
||||||
apply_InEmpty();
|
apply_InEmpty();
|
||||||
}
|
}
|
||||||
@@ -268,6 +285,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
last_error = error;
|
last_error = error;
|
||||||
last_move = move;
|
last_move = move;
|
||||||
last_task = task;
|
last_task = task;
|
||||||
|
last_height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean exe_error() {
|
public boolean exe_error() {
|
||||||
@@ -389,7 +407,91 @@ 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);
|
||||||
|
// return false;
|
||||||
|
// } else {
|
||||||
|
// this.instruction_apply_time = date;
|
||||||
|
// //container_code
|
||||||
|
// List<TaskDto> taskList = taskserver.queryTaskByDeviceCode(this.device_code);
|
||||||
|
// //
|
||||||
|
// if (!ObjectUtil.isEmpty(taskList)) {
|
||||||
|
// TaskDto task = taskList.get(0);
|
||||||
|
// String taskid = task.getTask_id();
|
||||||
|
// String taskcode = task.getTask_code();
|
||||||
|
// String vehiclecode = task.getVehicle_code();
|
||||||
|
// String priority = task.getPriority();
|
||||||
|
// String start_point_code = task.getStart_point_code();
|
||||||
|
// String start_device_code = task.getStart_device_code();
|
||||||
|
// String route_plan_code = task.getRoute_plan_code();
|
||||||
|
//
|
||||||
|
// List<RouteLineDto> 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<String> 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 next_device_code = pathlist.get(index);
|
||||||
|
// 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;
|
||||||
|
// }
|
||||||
|
// 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);
|
||||||
|
// try {
|
||||||
|
// instructionService.create(instdto);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// task.setRemark("指令创建失败:" + e);
|
||||||
|
// taskserver.updateByCodeFromCache(task);
|
||||||
|
// throw new RuntimeException("指令创建失败:" + e);
|
||||||
|
// }
|
||||||
|
// //创建指令后修改任务状态
|
||||||
|
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||||
|
// task.setTask_status("1");
|
||||||
|
// JSONObject json = JSONObject.fromObject(task);
|
||||||
|
// taskwo.update(json);
|
||||||
|
// applySucess = true;
|
||||||
|
// } else {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
public synchronized boolean instruction_apply(String container_code) throws Exception {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||||
@@ -397,10 +499,16 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
} else {
|
} else {
|
||||||
this.instruction_apply_time = date;
|
this.instruction_apply_time = date;
|
||||||
//container_code
|
//container_code
|
||||||
List<TaskDto> taskList = taskserver.queryTaskByDeviceCode(this.device_code);
|
TaskDto task = taskserver.findByContainer(container_code);
|
||||||
//
|
Instruction inst = instructionService.findByDeviceCodeFromCache(container_code);
|
||||||
if (!ObjectUtil.isEmpty(taskList)) {
|
if(!ObjectUtil.isEmpty(inst) && StrUtil.equals(inst.getInstruction_status(),"0")){
|
||||||
TaskDto task = taskList.get(0);
|
this.setInst(inst);
|
||||||
|
writing();
|
||||||
|
applySucess = true;
|
||||||
|
this.setContainer("");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!ObjectUtil.isEmpty(task)) {
|
||||||
String taskid = task.getTask_id();
|
String taskid = task.getTask_id();
|
||||||
String taskcode = task.getTask_code();
|
String taskcode = task.getTask_code();
|
||||||
String vehiclecode = task.getVehicle_code();
|
String vehiclecode = task.getVehicle_code();
|
||||||
@@ -408,7 +516,13 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
String start_point_code = task.getStart_point_code();
|
String start_point_code = task.getStart_point_code();
|
||||||
String start_device_code = task.getStart_device_code();
|
String start_device_code = task.getStart_device_code();
|
||||||
String route_plan_code = task.getRoute_plan_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<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
|
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
|
||||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||||
|
|
||||||
@@ -426,7 +540,16 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String next_device_code = pathlist.get(index);
|
next_device_code = pathlist.get(index);
|
||||||
|
} else {
|
||||||
|
next_device_code = this_device_code;
|
||||||
|
}
|
||||||
|
//校验路由关系
|
||||||
|
List<RouteLineDto> 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 startdevice = deviceAppservice.findDeviceByCode(start_device_code);
|
||||||
Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code);
|
Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code);
|
||||||
String next_point_code;
|
String next_point_code;
|
||||||
@@ -435,6 +558,53 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
} else {
|
} else {
|
||||||
next_point_code = next_device_code;
|
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<Instruction> insts = instructionService.queryAgvInstByThree();
|
||||||
|
Integer agvQty = deviceservice.queryAgvQty();
|
||||||
|
List<Device> 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<Instruction> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flag) {
|
||||||
Instruction instdto = new Instruction();
|
Instruction instdto = new Instruction();
|
||||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||||
instdto.setRoute_plan_code(route_plan_code);
|
instdto.setRoute_plan_code(route_plan_code);
|
||||||
@@ -454,27 +624,129 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
instdto.setPriority(priority);
|
instdto.setPriority(priority);
|
||||||
instdto.setInstruction_status("0");
|
instdto.setInstruction_status("0");
|
||||||
instdto.setExecute_device_code(start_point_code);
|
instdto.setExecute_device_code(start_point_code);
|
||||||
try {
|
|
||||||
instructionService.create(instdto);
|
instructionService.create(instdto);
|
||||||
} catch (Exception e) {
|
|
||||||
task.setRemark("指令创建失败:" + e);
|
Instruction instdto2 = new Instruction();
|
||||||
taskserver.updateByCodeFromCache(task);
|
instdto2.setInstruction_id(IdUtil.simpleUUID());
|
||||||
throw new RuntimeException("指令创建失败:" + e);
|
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);
|
||||||
|
instructionService.create(instdto);
|
||||||
|
|
||||||
//创建指令后修改任务状态
|
//创建指令后修改任务状态
|
||||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||||
task.setTask_status("1");
|
task.setTask_status("1");
|
||||||
JSONObject json = JSONObject.fromObject(task);
|
JSONObject json = JSONObject.fromObject(task);
|
||||||
taskwo.update(json);
|
taskwo.update(json);
|
||||||
applySucess = true;
|
applySucess = true;
|
||||||
|
this.setContainer("");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} 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);
|
||||||
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean instruction_require(String container_code) {
|
//创建指令后修改任务状态
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writing() {
|
||||||
|
|
||||||
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command;
|
||||||
|
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target;
|
||||||
|
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task;
|
||||||
|
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
|
Server server = ReadUtil.getServer(opcservcerid);
|
||||||
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
itemMap.put(to_command, 1);
|
||||||
|
itemMap.put(to_target, deviceAppservice.findDeviceByCode(inst.getNext_device_code()).getAddress());
|
||||||
|
itemMap.put(to_task, inst.getInstruction_code());
|
||||||
|
this.execute_log.setResource(this.device_code, device_code);
|
||||||
|
this.execute_log.log("设备:" + device_code + ",下发PLC信号" + to_command + ",value:" + 1);
|
||||||
|
this.execute_log.log("设备:" + device_code + ",下发PLC信号" + to_target + ",value:" + deviceAppservice.findDeviceByCode(inst.getNext_device_code()).getAddress());
|
||||||
|
this.execute_log.log("设备:" + device_code + ",下发PLC信号" + to_task + ",value:" + inst.getInstruction_code());
|
||||||
|
|
||||||
|
ReadUtil.write(itemMap, server);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean instruction_require(String container_code) throws Exception {
|
||||||
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
|
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,39 +756,291 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
* @param container_code
|
* @param container_code
|
||||||
* @param container_type
|
* @param container_type
|
||||||
*/
|
*/
|
||||||
public synchronized boolean instruction_require(String container_code, String container_type) {
|
// public synchronized boolean instruction_require(String container_code, String container_type) {
|
||||||
|
// 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 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.setStart_point_code(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("101");
|
||||||
|
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
||||||
|
// String next_device_codecode = jo.getNext_device_code();
|
||||||
|
// if (StrUtil.isEmpty(next_device_codecode)) {
|
||||||
|
// throw new RuntimeException("该设备未找到对应路由");
|
||||||
|
// }
|
||||||
|
// dto.setNext_point_code(next_device_codecode);
|
||||||
|
// dto.setUpdate_time(now);
|
||||||
|
// dto.setCreate_time(now);
|
||||||
|
//
|
||||||
|
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||||
|
// JSONObject json = JSONObject.fromObject(dto);
|
||||||
|
// wo.insert(json);
|
||||||
|
// requireSucess = false;
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求指令
|
||||||
|
*
|
||||||
|
* @param container_code
|
||||||
|
* @param container_type
|
||||||
|
*/
|
||||||
|
public synchronized boolean instruction_require(String container_code, String container_type) throws Exception {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.instruction_require_time = date;
|
this.instruction_require_time = date;
|
||||||
TaskDto dto = new TaskDto();
|
//container_code
|
||||||
String now = DateUtil.now();
|
TaskDto task = taskserver.findByContainer(container_code);
|
||||||
dto.setTask_id(IdUtil.simpleUUID());
|
Instruction inst = instructionService.findByDeviceCodeByContainerCode(container_code);
|
||||||
dto.setCreate_by(this.getDevice().getDevice_code());
|
if (!ObjectUtil.isEmpty(inst) && StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||||
dto.setUpdate_by(this.getDevice().getDevice_code());
|
this.setInst(inst);
|
||||||
dto.setStart_point_code(this.getDevice().getDevice_code());
|
writing();
|
||||||
dto.setVehicle_code(container_code);
|
requireSucess = true;
|
||||||
dto.setVehicle_type(container_type);
|
applySucess = true;
|
||||||
|
this.setContainer("");
|
||||||
String taskcode = CodeUtil.getNewCode("TASK_NO");
|
return true;
|
||||||
dto.setTask_code("-" + taskcode);
|
|
||||||
dto.setTask_status("0");
|
|
||||||
dto.setPriority("101");
|
|
||||||
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
|
||||||
String next_device_codecode = jo.getNext_device_code();
|
|
||||||
if (StrUtil.isEmpty(next_device_codecode)) {
|
|
||||||
throw new RuntimeException("该设备未找到对应路由");
|
|
||||||
}
|
}
|
||||||
dto.setNext_point_code(next_device_codecode);
|
if (!ObjectUtil.isEmpty(task) && ObjectUtil.isEmpty(inst)) {
|
||||||
dto.setUpdate_time(now);
|
|
||||||
dto.setCreate_time(now);
|
|
||||||
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
String taskid = task.getTask_id();
|
||||||
JSONObject json = JSONObject.fromObject(dto);
|
String taskcode = task.getTask_code();
|
||||||
wo.insert(json);
|
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<RouteLineDto> 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<String> 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<RouteLineDto> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果未锁定,就正常创建(如果锁定,就只创建输送指令)
|
||||||
|
if (!createLock) {
|
||||||
|
List<Instruction> insts = instructionService.queryAgvInstByThree();
|
||||||
|
Integer agvQty = deviceservice.queryAgvQty();
|
||||||
|
List<Device> 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<Instruction> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
instructionService.create(instdto);
|
||||||
|
|
||||||
|
//创建指令后修改任务状态
|
||||||
|
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||||
|
task.setTask_status("1");
|
||||||
|
JSONObject json = JSONObject.fromObject(task);
|
||||||
|
taskwo.update(json);
|
||||||
|
requireSucess = true;
|
||||||
|
applySucess = true;
|
||||||
|
this.setContainer("");
|
||||||
|
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);
|
||||||
|
instructionService.create(instdto);
|
||||||
|
|
||||||
|
//创建指令后修改任务状态
|
||||||
|
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||||
|
task.setTask_status("1");
|
||||||
|
JSONObject json = JSONObject.fromObject(task);
|
||||||
|
taskwo.update(json);
|
||||||
|
requireSucess = true;
|
||||||
|
applySucess = true;
|
||||||
|
this.setContainer("");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建指令后修改任务状态
|
||||||
|
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||||
|
task.setTask_status("1");
|
||||||
|
JSONObject json = JSONObject.fromObject(task);
|
||||||
|
taskwo.update(json);
|
||||||
|
requireSucess = true;
|
||||||
|
applySucess = true;
|
||||||
|
this.setContainer("");
|
||||||
|
} else {
|
||||||
|
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS).toString(), "1")) {
|
||||||
|
message = "申请任务中...";
|
||||||
|
String str = acsToWmsService.applyTaskToWms(this.getDeviceCode(), container_code, height, 0);
|
||||||
|
JSONObject jo = JSONObject.fromObject(str);
|
||||||
|
if (ObjectUtil.isEmpty(jo)) {
|
||||||
|
message = "接口不通";
|
||||||
|
} else {
|
||||||
|
if (jo.getInt("status") == 200) {
|
||||||
|
requireSucess = true;
|
||||||
|
} else {
|
||||||
requireSucess = false;
|
requireSucess = false;
|
||||||
|
message = jo.get("message").toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,8 +70,12 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
String container_type_desc;
|
String container_type_desc;
|
||||||
String last_container_type_desc;
|
String last_container_type_desc;
|
||||||
String last_container;
|
String last_container;
|
||||||
|
|
||||||
//指令创建锁
|
//指令创建锁
|
||||||
Boolean createLock = false;
|
Boolean createLock = false;
|
||||||
|
//输送锁
|
||||||
|
Boolean conveyLock = false;
|
||||||
|
|
||||||
//有货标记
|
//有货标记
|
||||||
protected boolean has_goods_tag = false;
|
protected boolean has_goods_tag = false;
|
||||||
|
|
||||||
@@ -257,6 +261,15 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
createLock = false;
|
createLock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//如果输送线无指令,则输送线解锁(输送线锁定状态时,1005与1008生成指令比例为1:1,反之则为1:3)
|
||||||
|
if (instructionService.queryConveyorInstByThree().size() == 0) {
|
||||||
|
conveyLock = false;
|
||||||
|
}
|
||||||
|
//如果输送线指令数量大于4,则输送线锁定
|
||||||
|
if (instructionService.queryConveyorInstByThree().size() >= 4) {
|
||||||
|
conveyLock = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (getBarcode() != null) {
|
if (getBarcode() != null) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -536,46 +549,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
next_point_code = next_device_code;
|
next_point_code = next_device_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!createLock) {
|
|
||||||
//几台入库模式的agv 就能生成几个agv_type =3 的指令
|
|
||||||
//指令类型为3的指令数
|
|
||||||
List<Instruction> insts = instructionService.queryAgvInstByThree();
|
|
||||||
Integer agvQty = deviceservice.queryAgvQty();
|
|
||||||
List<Device> 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<Instruction> 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (flag) {
|
|
||||||
Instruction instdto = new Instruction();
|
Instruction instdto = new Instruction();
|
||||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||||
instdto.setRoute_plan_code(route_plan_code);
|
instdto.setRoute_plan_code(route_plan_code);
|
||||||
@@ -597,92 +570,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
instdto.setExecute_device_code(start_point_code);
|
instdto.setExecute_device_code(start_point_code);
|
||||||
instructionService.create(instdto);
|
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);
|
|
||||||
instructionService.create(instdto);
|
|
||||||
|
|
||||||
//创建指令后修改任务状态
|
|
||||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
|
||||||
task.setTask_status("1");
|
|
||||||
JSONObject json = JSONObject.fromObject(task);
|
|
||||||
taskwo.update(json);
|
|
||||||
applySucess = true;
|
|
||||||
clearBarcode();
|
|
||||||
|
|
||||||
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);
|
|
||||||
instructionService.create(instdto);
|
|
||||||
|
|
||||||
//创建指令后修改任务状态
|
|
||||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
|
||||||
task.setTask_status("1");
|
|
||||||
JSONObject json = JSONObject.fromObject(task);
|
|
||||||
taskwo.update(json);
|
|
||||||
applySucess = true;
|
|
||||||
clearBarcode();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//创建指令后修改任务状态
|
//创建指令后修改任务状态
|
||||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||||
task.setTask_status("1");
|
task.setTask_status("1");
|
||||||
@@ -735,8 +622,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
/**
|
/**
|
||||||
* 开始平均分配
|
* 开始平均分配
|
||||||
*/
|
*/
|
||||||
String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
|
String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
|
||||||
if (StrUtil.isEmpty(this_coevice_code)) {
|
if (StrUtil.isEmpty(this_device_code)) {
|
||||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
|
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
|
||||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||||
|
|
||||||
@@ -756,7 +643,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
}
|
}
|
||||||
next_device_code = pathlist.get(index);
|
next_device_code = pathlist.get(index);
|
||||||
} else {
|
} else {
|
||||||
next_device_code = this_coevice_code;
|
next_device_code = this_device_code;
|
||||||
}
|
}
|
||||||
//校验路由关系
|
//校验路由关系
|
||||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||||
@@ -773,45 +660,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
next_point_code = next_device_code;
|
next_point_code = next_device_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果未锁定,就正常创建(如果锁定,就只创建输送指令)
|
|
||||||
if (!createLock) {
|
|
||||||
List<Instruction> insts = instructionService.queryAgvInstByThree();
|
|
||||||
Integer agvQty = deviceservice.queryAgvQty();
|
|
||||||
List<Device> 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<Instruction> 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (flag) {
|
|
||||||
Instruction instdto = new Instruction();
|
Instruction instdto = new Instruction();
|
||||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||||
instdto.setRoute_plan_code(route_plan_code);
|
instdto.setRoute_plan_code(route_plan_code);
|
||||||
@@ -833,94 +681,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
|||||||
instdto.setExecute_device_code(start_point_code);
|
instdto.setExecute_device_code(start_point_code);
|
||||||
instructionService.create(instdto);
|
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);
|
|
||||||
instructionService.create(instdto);
|
|
||||||
|
|
||||||
//创建指令后修改任务状态
|
|
||||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
|
||||||
task.setTask_status("1");
|
|
||||||
JSONObject json = JSONObject.fromObject(task);
|
|
||||||
taskwo.update(json);
|
|
||||||
requireSucess = true;
|
|
||||||
applySucess = true;
|
|
||||||
clearBarcode();
|
|
||||||
|
|
||||||
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);
|
|
||||||
instructionService.create(instdto);
|
|
||||||
|
|
||||||
//创建指令后修改任务状态
|
|
||||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
|
||||||
task.setTask_status("1");
|
|
||||||
JSONObject json = JSONObject.fromObject(task);
|
|
||||||
taskwo.update(json);
|
|
||||||
requireSucess = true;
|
|
||||||
applySucess = true;
|
|
||||||
clearBarcode();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//创建指令后修改任务状态
|
//创建指令后修改任务状态
|
||||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||||
task.setTask_status("1");
|
task.setTask_status("1");
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
@Override
|
@Override
|
||||||
public List<Instruction> queryConveyorInstByThree() {
|
public List<Instruction> queryConveyorInstByThree() {
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||||
JSONArray arr = wo.query("agv_type = 3 and is_delete = 0 and instruction_status <2").getResultJSONArray(0);
|
JSONArray arr = wo.query("is_delete = 0 and instruction_status <2").getResultJSONArray(0);
|
||||||
List<Instruction> list = JSONArray.toList(arr, Instruction.class);
|
List<Instruction> list = JSONArray.toList(arr, Instruction.class);
|
||||||
List<Instruction> list1 = new ArrayList<>();
|
List<Instruction> list1 = new ArrayList<>();
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
@@ -920,10 +920,24 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
|
JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
|
||||||
TaskDto obj = (TaskDto) JSONObject.toBean(taskjson, TaskDto.class);
|
TaskDto obj = (TaskDto) JSONObject.toBean(taskjson, TaskDto.class);
|
||||||
|
|
||||||
|
String vehicle_code = entity.getVehicle_code();
|
||||||
|
|
||||||
//如果下一条指令已存在,则不需要再次创建
|
//如果下一条指令已存在,则不需要再次创建
|
||||||
if (ObjectUtils.isNotEmpty(this.findByStartCodeNextCodeJM(instnextdevice,obj.getNext_point_code()))) {
|
if (ObjectUtils.isNotEmpty(this.findByStartCodeNextCodeJM(instnextdevice,obj.getNext_point_code()))) {
|
||||||
obj.setRequest_again("1");
|
obj.setRequest_again("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StandardCoveyorControlWithScannerDeviceDriver scannerDeviceDriver;
|
||||||
|
Device deviceByCode = deviceAppService.findDeviceByCode(entity.getStart_device_code());
|
||||||
|
if (deviceByCode.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
|
||||||
|
scannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) deviceByCode.getDeviceDriver();
|
||||||
|
String apply_task = scannerDeviceDriver.getDevice().getExtraValue().get("apply_task").toString();
|
||||||
|
//如果此站点为1002,并且指令创建锁是打开的话,则不需要再次创建
|
||||||
|
if (ObjectUtil.isNotEmpty(apply_task) && apply_task.equals("true")
|
||||||
|
&& !scannerDeviceDriver.getCreateLock()) {
|
||||||
|
obj.setRequest_again("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
//如果为输送指令
|
//如果为输送指令
|
||||||
int car_num = 0;
|
int car_num = 0;
|
||||||
// JMAgvDeviceDriver jmAgvDeviceDriver;
|
// JMAgvDeviceDriver jmAgvDeviceDriver;
|
||||||
@@ -973,6 +987,17 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
entity.setInstruction_status("2");
|
entity.setInstruction_status("2");
|
||||||
JSONObject json = JSONObject.fromObject(entity);
|
JSONObject json = JSONObject.fromObject(entity);
|
||||||
wo.update(json);
|
wo.update(json);
|
||||||
|
|
||||||
|
//将指令条码写入终点设备中去
|
||||||
|
if (ObjectUtil.isNotEmpty(vehicle_code)) {
|
||||||
|
StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
|
||||||
|
Device nextDevice = deviceAppService.findDeviceByCode(entity.getNext_device_code());
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||||
|
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
standardCoveyorControlDeviceDriver.setContainer(vehicle_code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
||||||
//变更三色灯状态
|
//变更三色灯状态
|
||||||
if (!ObjectUtils.isEmpty(device.getExtraValue().get("link_three_lamp"))) {
|
if (!ObjectUtils.isEmpty(device.getExtraValue().get("link_three_lamp"))) {
|
||||||
@@ -1049,6 +1074,19 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
if (ObjectUtils.isNotEmpty(this.findByStartCodeNextCodeJM(instnextdevice,obj.getNext_point_code()))) {
|
if (ObjectUtils.isNotEmpty(this.findByStartCodeNextCodeJM(instnextdevice,obj.getNext_point_code()))) {
|
||||||
obj.setRequest_again("1");
|
obj.setRequest_again("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StandardCoveyorControlWithScannerDeviceDriver scannerDeviceDriver;
|
||||||
|
Device deviceByCode = deviceAppService.findDeviceByCode(entity.getStart_device_code());
|
||||||
|
if (deviceByCode.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
|
||||||
|
scannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) deviceByCode.getDeviceDriver();
|
||||||
|
String apply_task = scannerDeviceDriver.getDevice().getExtraValue().get("apply_task").toString();
|
||||||
|
//如果此站点为1002,并且指令创建锁是打开的话,则不需要再次创建
|
||||||
|
if (ObjectUtil.isNotEmpty(apply_task) && apply_task.equals("true")
|
||||||
|
&& !scannerDeviceDriver.getCreateLock()) {
|
||||||
|
obj.setRequest_again("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// =0 则不用再次请求
|
// =0 则不用再次请求
|
||||||
if (StrUtil.equals(obj.getRequest_again(), "0")) {
|
if (StrUtil.equals(obj.getRequest_again(), "0")) {
|
||||||
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
|
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
|
||||||
@@ -1062,6 +1100,16 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
}
|
}
|
||||||
entity.setInstruction_status("2");
|
entity.setInstruction_status("2");
|
||||||
wo.update(json);
|
wo.update(json);
|
||||||
|
|
||||||
|
//将指令条码写入终点设备中去
|
||||||
|
if (ObjectUtil.isNotEmpty(entity.getVehicle_code())) {
|
||||||
|
StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
|
||||||
|
Device nextDevice = deviceAppService.findDeviceByCode(entity.getNext_device_code());
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||||
|
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
standardCoveyorControlDeviceDriver.setContainer(entity.getVehicle_code());
|
||||||
|
}
|
||||||
|
}
|
||||||
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
||||||
//变更三色灯状态
|
//变更三色灯状态
|
||||||
if (!ObjectUtils.isEmpty(device.getExtraValue().get("link_three_lamp"))) {
|
if (!ObjectUtils.isEmpty(device.getExtraValue().get("link_three_lamp"))) {
|
||||||
@@ -1091,6 +1139,19 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
obj.setRequest_again("1");
|
obj.setRequest_again("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StandardCoveyorControlWithScannerDeviceDriver scannerDeviceDriver;
|
||||||
|
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code());
|
||||||
|
if (deviceByCode.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
|
||||||
|
scannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) deviceByCode.getDeviceDriver();
|
||||||
|
String apply_task = scannerDeviceDriver.getDevice().getExtraValue().get("apply_task").toString();
|
||||||
|
//如果此站点为1002,并且指令创建锁是打开的话,则不需要再次创建
|
||||||
|
if (ObjectUtil.isNotEmpty(apply_task) && apply_task.equals("true")
|
||||||
|
&& !scannerDeviceDriver.getCreateLock()) {
|
||||||
|
obj.setRequest_again("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||||
// =0 则不用再次请求
|
// =0 则不用再次请求
|
||||||
if (StrUtil.equals(obj.getRequest_again(), "0")) {
|
if (StrUtil.equals(obj.getRequest_again(), "0")) {
|
||||||
@@ -1108,6 +1169,16 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
JSONObject json = JSONObject.fromObject(dto);
|
JSONObject json = JSONObject.fromObject(dto);
|
||||||
wo.update(json);
|
wo.update(json);
|
||||||
|
|
||||||
|
//将指令条码写入终点设备中去
|
||||||
|
if (ObjectUtil.isNotEmpty(dto.getVehicle_code())) {
|
||||||
|
StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
|
||||||
|
Device nextDevice = deviceAppService.findDeviceByCode(dto.getNext_device_code());
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||||
|
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
standardCoveyorControlDeviceDriver.setContainer(dto.getVehicle_code());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||||
Device device = appService.findDeviceByCode(instnextdevice);
|
Device device = appService.findDeviceByCode(instnextdevice);
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
|||||||
import org.nl.acs.device_driver.driver.OpcDeviceDriver;
|
import org.nl.acs.device_driver.driver.OpcDeviceDriver;
|
||||||
import org.nl.acs.device_driver.ndxy_special.NdxySpecialDeviceDriver;
|
import org.nl.acs.device_driver.ndxy_special.NdxySpecialDeviceDriver;
|
||||||
import org.nl.acs.device_driver.special_ordinary_site.SpecialOrdinarySiteDeviceDriver;
|
import org.nl.acs.device_driver.special_ordinary_site.SpecialOrdinarySiteDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||||
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
@@ -94,6 +96,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
DeviceAssignedService deviceAssignedService;
|
DeviceAssignedService deviceAssignedService;
|
||||||
@Autowired
|
@Autowired
|
||||||
InstructionService instructionService;
|
InstructionService instructionService;
|
||||||
|
@Autowired
|
||||||
|
DeviceService deviceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void autoInitial() throws Exception {
|
public void autoInitial() throws Exception {
|
||||||
@@ -1213,6 +1217,33 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
if (num >= Integer.parseInt(limit)) {
|
if (num >= Integer.parseInt(limit)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Boolean conveyLock = false;
|
||||||
|
Device deviceByCode = deviceAppService.findDeviceByCode(device_code);
|
||||||
|
StandardCoveyorControlWithScannerDeviceDriver scannerDeviceDriver;
|
||||||
|
if (deviceByCode.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
|
||||||
|
scannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) deviceByCode.getDeviceDriver();
|
||||||
|
conveyLock = scannerDeviceDriver.getConveyLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!conveyLock) {
|
||||||
|
//查询所有的关联设备
|
||||||
|
List<String> list1 = deviceService.queryLinkDeviceByCode(this_device_code);
|
||||||
|
int count = 0;
|
||||||
|
for (int z = 0; z < list1.size(); z++) {
|
||||||
|
String code = list1.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) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
flag1 = num;
|
flag1 = num;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,6 +194,7 @@
|
|||||||
<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="11">出库</el-radio-button>
|
<el-radio-button :label="11">出库</el-radio-button>
|
||||||
|
<el-radio-button :label="20">禁用</el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|||||||
Reference in New Issue
Block a user