fix: 现场入库联调出库联调修改
This commit is contained in:
@@ -357,7 +357,7 @@ public class BoxManipulatorSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -462,7 +462,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
this.instruction_require_time = date;
|
this.instruction_require_time = date;
|
||||||
//查找有没有对应的指令
|
//查找有没有对应的指令
|
||||||
Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
|
Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
|
||||||
if (ObjectUtil.isNotNull(inst) && CommonFinalParam.ONE.equals(inst.getInstruction_type())) {
|
if (ObjectUtil.isNotNull(inst)) {
|
||||||
List<RouteLineDto> routeLineDtos = routeLineService.selectDeviceCodeList(this.device_code);
|
List<RouteLineDto> routeLineDtos = routeLineService.selectDeviceCodeList(this.device_code);
|
||||||
if (routeLineDtos.size() < 1) {
|
if (routeLineDtos.size() < 1) {
|
||||||
return false;
|
return false;
|
||||||
@@ -606,7 +606,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
//判断是否存在终点到达ddj对接位的指令(包含货架到达ddj对接位的指令、输送线到对接位的指令)
|
//判断是否存在终点到达ddj对接位的指令(包含货架到达ddj对接位的指令、输送线到对接位的指令)
|
||||||
Instruction byNextDeviceCodeDDJ = instructionService.findByNextDeviceCodeFromCache(next_device_code);
|
Instruction byNextDeviceCodeDDJ = instructionService.findByNextDeviceCodeFromCache(next_device_code);
|
||||||
if (ObjectUtil.isNotEmpty(byNextDeviceCodeDDJ)) {
|
if (ObjectUtil.isNotEmpty(byNextDeviceCodeDDJ)) {
|
||||||
this.setNotCreateInstMessage("存在相同路线的指令");
|
this.setNotCreateInstMessage("universal_notCreateInstMessage5");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
//判断下一个输送线点位是否有货
|
//判断下一个输送线点位是否有货
|
||||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||||
@@ -617,6 +618,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
this.setNotCreateInstMessage("universal_notCreateInstMessage4");
|
this.setNotCreateInstMessage("universal_notCreateInstMessage4");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
//下一个设备不是输送线指令
|
||||||
|
this.setNotCreateInstMessage("下一个设备不是输送线指令");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
Instruction instdto = new Instruction();
|
Instruction instdto = new Instruction();
|
||||||
packageData(instdto, route_plan_code, taskdto, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority, containerType);
|
packageData(instdto, route_plan_code, taskdto, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority, containerType);
|
||||||
@@ -785,8 +790,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("error", this.getError());
|
jo.put("error", this.getError());
|
||||||
String move = "无货";
|
String move = "无货";
|
||||||
|
jo.put("hasGoods", false);
|
||||||
if (this.move == 1) {
|
if (this.move == 1) {
|
||||||
move = "有货";
|
move = "有货";
|
||||||
|
jo.put("hasGoods", true);
|
||||||
}
|
}
|
||||||
String container_type = "";
|
String container_type = "";
|
||||||
if (this.container_type == 1) {
|
if (this.container_type == 1) {
|
||||||
@@ -801,7 +808,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
jo.put("isOnline", this.getIsonline());
|
jo.put("isOnline", this.getIsonline());
|
||||||
jo.put("requireSucess", requireSucess);
|
jo.put("requireSucess", requireSucess);
|
||||||
jo.put("hand_barcode", hand_barcode);
|
jo.put("hand_barcode", hand_barcode);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -346,7 +346,7 @@
|
|||||||
// jo.put("isError", this.getIserror());
|
// jo.put("isError", this.getIserror());
|
||||||
// jo.put("message", LangProcess.msg(message));
|
// jo.put("message", LangProcess.msg(message));
|
||||||
// jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
// jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
// jo.put("notCreateInstMessage", notCreateInstMessage);
|
// jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
// jo.put("feedMessage", LangProcess.msg(feedMessage));
|
// jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
// jo.put("driver_type", "siemens_conveyor");
|
// jo.put("driver_type", "siemens_conveyor");
|
||||||
// jo.put("is_click", true);
|
// jo.put("is_click", true);
|
||||||
|
|||||||
@@ -345,7 +345,7 @@
|
|||||||
// jo.put("isError", this.getIserror());
|
// jo.put("isError", this.getIserror());
|
||||||
// jo.put("message", LangProcess.msg(message));
|
// jo.put("message", LangProcess.msg(message));
|
||||||
// jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
// jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
// jo.put("notCreateInstMessage", notCreateInstMessage);
|
// jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
// jo.put("feedMessage", LangProcess.msg(feedMessage));
|
// jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
// jo.put("driver_type", "siemens_conveyor");
|
// jo.put("driver_type", "siemens_conveyor");
|
||||||
// jo.put("is_click", true);
|
// jo.put("is_click", true);
|
||||||
|
|||||||
@@ -351,7 +351,7 @@
|
|||||||
// jo.put("isError", this.getIserror());
|
// jo.put("isError", this.getIserror());
|
||||||
// jo.put("message", LangProcess.msg(message));
|
// jo.put("message", LangProcess.msg(message));
|
||||||
// jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
// jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
// jo.put("notCreateInstMessage", notCreateInstMessage);
|
// jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
// jo.put("feedMessage", LangProcess.msg(feedMessage));
|
// jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
// jo.put("driver_type", "siemens_conveyor");
|
// jo.put("driver_type", "siemens_conveyor");
|
||||||
// jo.put("is_click", true);
|
// jo.put("is_click", true);
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
jo.put("requireSucess", requireSucess);
|
jo.put("requireSucess", requireSucess);
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
jo.put("requireSucess", requireSucess);
|
jo.put("requireSucess", requireSucess);
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
|
|||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
jo.put("requireSucess", requireSucess);
|
jo.put("requireSucess", requireSucess);
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package org.nl.acs.device_driver.one_conveyor.fold_disc_site;
|
package org.nl.acs.device_driver.one_conveyor.fold_disc_site;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
@@ -8,6 +11,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.nl.acs.common.base.CommonFinalParam;
|
import org.nl.acs.common.base.CommonFinalParam;
|
||||||
import org.nl.acs.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
import org.nl.acs.device.service.DeviceExtraService;
|
import org.nl.acs.device.service.DeviceExtraService;
|
||||||
@@ -17,6 +21,8 @@ import org.nl.acs.device_driver.FeedLmsRealFailed;
|
|||||||
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.led.led_screen.LedScreenDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.InteractionJsonDTO;
|
||||||
import org.nl.acs.enums.StorageTypeEnum;
|
import org.nl.acs.enums.StorageTypeEnum;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.history.ErrorUtil;
|
import org.nl.acs.history.ErrorUtil;
|
||||||
@@ -30,8 +36,14 @@ import org.nl.acs.monitor.DeviceStageMonitor;
|
|||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
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.impl.RouteLineServiceImpl;
|
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||||
|
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||||
|
import org.nl.acs.task.enums.TaskTypeEnum;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.nl.config.language.LangProcess;
|
import org.nl.config.language.LangProcess;
|
||||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||||
@@ -66,6 +78,9 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||||
|
|
||||||
|
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
||||||
|
|
||||||
//工作模式
|
//工作模式
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
int last_mode = 0;
|
int last_mode = 0;
|
||||||
@@ -221,7 +236,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType());
|
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType());
|
||||||
List list1 = new ArrayList();
|
List list1 = new ArrayList();
|
||||||
Map map = new HashMap();
|
Map map = new HashMap();
|
||||||
map.put("code", "mode");
|
map.put("code", "to_command");
|
||||||
map.put("value", 9);
|
map.put("value", 9);
|
||||||
list1.add(map);
|
list1.add(map);
|
||||||
this.writing(list1);
|
this.writing(list1);
|
||||||
@@ -233,7 +248,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType());
|
applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType());
|
||||||
List list1 = new ArrayList();
|
List list1 = new ArrayList();
|
||||||
Map map = new HashMap();
|
Map map = new HashMap();
|
||||||
map.put("code", "mode");
|
map.put("code", "to_command");
|
||||||
map.put("value", 8);
|
map.put("value", 8);
|
||||||
list1.add(map);
|
list1.add(map);
|
||||||
this.writing(list1);
|
this.writing(list1);
|
||||||
@@ -241,14 +256,14 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//行架机械手申请任务
|
//碟盘位申请任务
|
||||||
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
|
if (mode == 2 && move == 1 && !requireSucess) {
|
||||||
// boolean res = applyTask();
|
boolean res = instruction_require();
|
||||||
// if (res) {
|
if (res) {
|
||||||
// notCreateInstMessage = "";
|
notCreateInstMessage = "";
|
||||||
// notCreateTaskMessage = "";
|
notCreateTaskMessage = "";
|
||||||
// feedMessage = "";
|
feedMessage = "";
|
||||||
// }
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mode == 2) {
|
if (mode == 2) {
|
||||||
//if (!requireSucess) {
|
//if (!requireSucess) {
|
||||||
@@ -288,6 +303,212 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
last_carrier_direction = carrier_direction;
|
last_carrier_direction = carrier_direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求指令
|
||||||
|
*/
|
||||||
|
public synchronized boolean instruction_require() {
|
||||||
|
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 taskdto = taskserver.findByStartCodeAndReady(device_code);
|
||||||
|
if (!ObjectUtil.isEmpty(taskdto)) {
|
||||||
|
//需要判断当前设备是否已经存在就绪的指令 如果存在就直接下发 不存在则创建
|
||||||
|
Instruction inst = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code());
|
||||||
|
if (ObjectUtil.isNotEmpty(inst)) {
|
||||||
|
List list = new ArrayList();
|
||||||
|
Map map2 = new HashMap();
|
||||||
|
map2.put("code", "to_task");
|
||||||
|
map2.put("value", inst.getInstruction_code());
|
||||||
|
list.add(map2);
|
||||||
|
Map map3 = new HashMap();
|
||||||
|
map3.put("code", "to_command");
|
||||||
|
map3.put("value", "1");
|
||||||
|
list.add(map3);
|
||||||
|
this.writing(list);
|
||||||
|
requireSucess = true;
|
||||||
|
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||||
|
, inst.getInstruction_code())) {
|
||||||
|
this.writing(list);
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) {
|
||||||
|
requireSucess = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
message = "universal_message5";
|
||||||
|
requireSucess = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
String taskid = taskdto.getTask_id();
|
||||||
|
String taskcode = taskdto.getTask_code();
|
||||||
|
String vehiclecode = taskdto.getVehicle_code();
|
||||||
|
String priority = taskdto.getPriority();
|
||||||
|
String start_point_code = taskdto.getStart_point_code();
|
||||||
|
String start_device_code = taskdto.getStart_device_code();
|
||||||
|
String route_plan_code = taskdto.getRoute_plan_code();
|
||||||
|
String next_device_code = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始平均分配
|
||||||
|
*/
|
||||||
|
String this_coevice_code = taskserver.queryAssignedByDevice(device_code, taskdto.getNext_device_code());
|
||||||
|
if (StrUtil.isEmpty(this_coevice_code)) {
|
||||||
|
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, taskdto.getNext_device_code(), route_plan_code);
|
||||||
|
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||||
|
|
||||||
|
String path = routeLineDto.getPath();
|
||||||
|
String type = routeLineDto.getType();
|
||||||
|
String[] str = path.split("->");
|
||||||
|
|
||||||
|
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_coevice_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 = taskdto.getTo_x() + "-" + taskdto.getTo_y() + "-" + taskdto.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(taskdto.getRemark());
|
||||||
|
instdto.setMaterial(taskdto.getMaterial());
|
||||||
|
instdto.setQuantity(taskdto.getQuantity());
|
||||||
|
instdto.setTask_id(taskid);
|
||||||
|
instdto.setTask_code(taskcode);
|
||||||
|
instdto.setVehicle_code(vehiclecode);
|
||||||
|
String now = DateUtil.now();
|
||||||
|
instdto.setCreate_time(now);
|
||||||
|
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
|
||||||
|
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) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("指令创建失败!", e.getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//创建指令后修改任务状态
|
||||||
|
taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||||
|
taskserver.update(taskdto);
|
||||||
|
requireSucess = true;
|
||||||
|
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||||
|
|
||||||
|
List list = new ArrayList();
|
||||||
|
Map map = new HashMap();
|
||||||
|
map.put("code", "to_target");
|
||||||
|
map.put("value", next_addr);
|
||||||
|
list.add(map);
|
||||||
|
Map map2 = new HashMap();
|
||||||
|
map2.put("code", "to_task");
|
||||||
|
map2.put("value", instdto.getInstruction_code());
|
||||||
|
list.add(map2);
|
||||||
|
Map map3 = new HashMap();
|
||||||
|
map3.put("code", "to_command");
|
||||||
|
map3.put("value", "1");
|
||||||
|
list.add(map3);
|
||||||
|
this.writing(list);
|
||||||
|
requireSucess = true;
|
||||||
|
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||||
|
, instdto.getInstruction_code())) {
|
||||||
|
this.writing(list);
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(device_code)
|
||||||
|
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
|
||||||
|
.build();
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(taskserver.findByCode(taskdto.getTask_code()))) {
|
||||||
|
requireSucess = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//如果不存在则直接找对应指令
|
||||||
|
Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
|
||||||
|
if (ObjectUtil.isEmpty(inst)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
||||||
|
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||||
|
|
||||||
|
List list = new ArrayList();
|
||||||
|
Map map = new HashMap();
|
||||||
|
map.put("code", "to_target");
|
||||||
|
map.put("value", next_addr);
|
||||||
|
list.add(map);
|
||||||
|
Map map2 = new HashMap();
|
||||||
|
map2.put("code", "to_task");
|
||||||
|
map2.put("value", inst.getInstruction_code());
|
||||||
|
list.add(map2);
|
||||||
|
Map map3 = new HashMap();
|
||||||
|
map3.put("code", "to_command");
|
||||||
|
map3.put("value", "1");
|
||||||
|
list.add(map3);
|
||||||
|
this.writing(list);
|
||||||
|
requireSucess = true;
|
||||||
|
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||||
|
, inst.getInstruction_code())) {
|
||||||
|
this.writing(list);
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(device_code)
|
||||||
|
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
|
||||||
|
.build();
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(instructionService.findByDeviceCodeFromCache(this.device_code))) {
|
||||||
|
requireSucess = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void writing(List list) {
|
public void writing(List list) {
|
||||||
|
|
||||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
@@ -411,7 +632,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -739,7 +739,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "conveyor_with_scanner_weight");
|
jo.put("driver_type", "conveyor_with_scanner_weight");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -632,7 +632,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "box_package_manipulator");
|
jo.put("driver_type", "box_package_manipulator");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -577,7 +577,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "box_storage_manipulator");
|
jo.put("driver_type", "box_storage_manipulator");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -598,7 +598,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -1013,7 +1013,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
jo.put("stopReceiveTask", this.stopReceiveTask);
|
jo.put("stopReceiveTask", this.stopReceiveTask);
|
||||||
jo.put("requireSucess", requireSucess);
|
jo.put("requireSucess", requireSucess);
|
||||||
jo.put("driver_type", "standard_stacker");
|
jo.put("driver_type", "standard_stacker");
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package org.nl.acs.device_driver.storage.standard_storage;
|
package org.nl.acs.device_driver.storage.standard_storage;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
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.StorageDeviceDriver;
|
import org.nl.acs.device_driver.StorageDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||||
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
|
import org.nl.config.language.LangProcess;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,7 +16,7 @@ import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
public class StandardStorageDeviceDriver extends AbstractDeviceDriver implements RouteableDeviceDriver, StorageDeviceDriver, DeviceDriver {
|
public class StandardStorageDeviceDriver extends AbstractDeviceDriver implements RouteableDeviceDriver, StorageDeviceDriver, DeviceDriver, DeviceStageMonitor {
|
||||||
public StandardStorageDeviceDriver() {
|
public StandardStorageDeviceDriver() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -29,7 +32,18 @@ public class StandardStorageDeviceDriver extends AbstractDeviceDriver implements
|
|||||||
public boolean fixTypes(Integer type) {
|
public boolean fixTypes(Integer type) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public JSONObject getDeviceStatusName() throws Exception {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("mode", 2);
|
||||||
|
jo.put("isOnline", true);
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDeviceStatus(JSONObject data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -695,7 +695,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -1128,7 +1128,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", message);
|
jo.put("message", message);
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", feedMessage);
|
jo.put("feedMessage", feedMessage);
|
||||||
jo.put("requireActionSucess", requireActionSucess);
|
jo.put("requireActionSucess", requireActionSucess);
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
|
|||||||
@@ -708,7 +708,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -643,7 +643,7 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -762,7 +762,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
jo.put("driver_type", "slit_two_manipulator");
|
jo.put("driver_type", "slit_two_manipulator");
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user