add: 木箱入库、装箱入库、空木箱出库驱动开发(后端)
This commit is contained in:
@@ -182,20 +182,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
if (error != last_error) {
|
if (error != last_error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == 2 && move != 0 && task > 0) {
|
// updateInstruct();
|
||||||
//inst_message
|
|
||||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
|
||||||
if (inst != null) {
|
|
||||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
|
||||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
|
||||||
finish_instruction();
|
|
||||||
}
|
|
||||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
|
||||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
|
||||||
instructionService.update(inst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WaitingInstructionDeque deque = null;
|
WaitingInstructionDeque deque = null;
|
||||||
// deque = instructionService.findByStategy(this.getDeviceCode(), "deviceCustomerDequeStrategy");
|
// deque = instructionService.findByStategy(this.getDeviceCode(), "deviceCustomerDequeStrategy");
|
||||||
|
|
||||||
@@ -232,7 +219,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
case 2:
|
case 2:
|
||||||
//申请任务
|
//申请任务
|
||||||
if (!StrUtil.isEmpty(material) && !StrUtil.isEmpty(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) {
|
if (!StrUtil.isEmpty(material) && !StrUtil.isEmpty(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) {
|
||||||
this.instruction_require(container);
|
// this.instruction_require(container);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@@ -282,6 +269,23 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
last_task = task;
|
last_task = task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateInstruct() throws Exception {
|
||||||
|
if (mode == 2 && move != 0 && task > 0) {
|
||||||
|
//inst_message
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
if (inst != null) {
|
||||||
|
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||||
|
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||||
|
finish_instruction();
|
||||||
|
}
|
||||||
|
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||||
|
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||||
|
instructionService.update(inst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean exe_error() {
|
public boolean exe_error() {
|
||||||
if (this.error == 0) {
|
if (this.error == 0) {
|
||||||
return true;
|
return true;
|
||||||
@@ -440,10 +444,6 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
|||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
|
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
|
||||||
//
|
|
||||||
// wo.insert(json);
|
|
||||||
Task entity = ConvertUtil.convert(dto, Task.class);
|
Task entity = ConvertUtil.convert(dto, Task.class);
|
||||||
taskMapper.insert(entity);
|
taskMapper.insert(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package org.nl.acs.device_driver.manipulator.standard_manipulator;
|
||||||
|
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
@Service
|
||||||
|
public class StandarManipulatorDefination implements OpcDeviceDriverDefination {
|
||||||
|
@Override
|
||||||
|
public String getDriverCode() {
|
||||||
|
return "standar_manipulator";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverName() {
|
||||||
|
return "标准机械手";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverDescription() {
|
||||||
|
return "标准机械手";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceDriver getDriverInstance(Device device) {
|
||||||
|
return (new OvenGantryManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||||
|
return OvenGantryManipulatorDeviceDriver.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceType> getFitDeviceTypes() {
|
||||||
|
List<DeviceType> types = new LinkedList();
|
||||||
|
types.add(DeviceType.station);
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getReadableItemDtos() {
|
||||||
|
return StandardItemProtocol.getReadableItemDtos();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getWriteableItemDtos() {
|
||||||
|
return StandardItemProtocol.getWriteableItemDtos();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,392 @@
|
|||||||
|
package org.nl.acs.device_driver.manipulator.standard_manipulator;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.common.base.CommonFinalParam;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.service.DeviceExtraService;
|
||||||
|
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||||
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
|
import org.nl.acs.history.ErrorUtil;
|
||||||
|
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||||
|
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||||
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
|
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.config.SpringContextHolder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class StandarManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||||
|
|
||||||
|
protected StandardItemProtocol standardItemProtocol = new StandardItemProtocol(this);
|
||||||
|
@Autowired
|
||||||
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||||
|
|
||||||
|
//工作模式
|
||||||
|
int mode = 0;
|
||||||
|
int last_mode = 0;
|
||||||
|
//光电信号
|
||||||
|
int move = 0;
|
||||||
|
int last_move = 0;
|
||||||
|
//动作信号
|
||||||
|
int action = 0;
|
||||||
|
int last_action = 0;
|
||||||
|
//行走列
|
||||||
|
int walk_y = 0;
|
||||||
|
int last_walk_y = 0;
|
||||||
|
//报警信号
|
||||||
|
int error = 0;
|
||||||
|
int last_error = 0;
|
||||||
|
//任务号
|
||||||
|
int task = 0;
|
||||||
|
int last_task = 0;
|
||||||
|
// x坐标
|
||||||
|
float x_position = 0;
|
||||||
|
float last_x_position = 0;
|
||||||
|
// y坐标
|
||||||
|
float y_position = 0;
|
||||||
|
float last_y_position = 0;
|
||||||
|
|
||||||
|
int heartbeat = 0;
|
||||||
|
int last_heartbeat = 0;
|
||||||
|
int to_command = 0;
|
||||||
|
int last_to_command = 0;
|
||||||
|
|
||||||
|
int to_target = 0;
|
||||||
|
int last_to_target = 0;
|
||||||
|
|
||||||
|
int to_task = 0;
|
||||||
|
int last_to_task = 0;
|
||||||
|
|
||||||
|
int to_onset = 0;
|
||||||
|
int last_to_onset = 0;
|
||||||
|
|
||||||
|
Boolean isonline = true;
|
||||||
|
int hasGoods = 0;
|
||||||
|
String message = null;
|
||||||
|
Boolean iserror = false;
|
||||||
|
private Date instruction_update_time = new Date();
|
||||||
|
private int instruction_update_time_out = 1000;
|
||||||
|
Integer heartbeat_tag;
|
||||||
|
private Date instruction_require_time = new Date();
|
||||||
|
|
||||||
|
private int instruction_require_time_out = 3000;
|
||||||
|
//行架机械手申请任务成功标识
|
||||||
|
boolean requireSucess = false;
|
||||||
|
|
||||||
|
private int instruction_finished_time_out;
|
||||||
|
|
||||||
|
int branchProtocol = 0;
|
||||||
|
private String error_type = "hxhj_error_type";
|
||||||
|
|
||||||
|
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||||
|
int flag;
|
||||||
|
|
||||||
|
String device_code;
|
||||||
|
|
||||||
|
//当前指令
|
||||||
|
Instruction inst = null;
|
||||||
|
|
||||||
|
|
||||||
|
//0 无任务执行 1更新指令状态 2下发电气信号 3允许取货 允许放货 5放货完成
|
||||||
|
int now_steps_type = 0;
|
||||||
|
String notCreateTaskMessage = "";
|
||||||
|
String notCreateInstMessage = "";
|
||||||
|
String feedMessage = "";
|
||||||
|
|
||||||
|
|
||||||
|
List<String> getDeviceCodeList = null;
|
||||||
|
|
||||||
|
List<String> putDeviceCodeList = null;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice() {
|
||||||
|
return this.device;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
String message = null;
|
||||||
|
try {
|
||||||
|
device_code = this.getDeviceCode();
|
||||||
|
mode = this.standardItemProtocol.getMode(device_code);
|
||||||
|
move = this.standardItemProtocol.getMove(device_code);
|
||||||
|
action = this.standardItemProtocol.getAction(device_code);
|
||||||
|
walk_y = this.standardItemProtocol.getWalk_y(device_code);
|
||||||
|
error = this.standardItemProtocol.getError(device_code);
|
||||||
|
task = this.standardItemProtocol.getTask(device_code);
|
||||||
|
heartbeat = this.standardItemProtocol.getHeartbeat(device_code);
|
||||||
|
to_command = this.standardItemProtocol.getTo_command(device_code);
|
||||||
|
to_target = this.standardItemProtocol.getTo_target(device_code);
|
||||||
|
to_task = this.standardItemProtocol.getTo_task(device_code);
|
||||||
|
to_onset = this.standardItemProtocol.getTo_onset(device_code);
|
||||||
|
x_position = this.standardItemProtocol.getX_position(device_code);
|
||||||
|
y_position = this.standardItemProtocol.getY_position(device_code);
|
||||||
|
|
||||||
|
if (to_onset != last_to_onset) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_onset:" + last_to_onset + "->" + to_onset);
|
||||||
|
}
|
||||||
|
if (to_command != last_to_command) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command:" + last_to_command + "->" + to_command);
|
||||||
|
}
|
||||||
|
if (to_target != last_to_target) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target:" + last_to_target + "->" + to_target);
|
||||||
|
}
|
||||||
|
if (to_task != last_to_task) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task:" + last_to_task + "->" + to_task);
|
||||||
|
}
|
||||||
|
if (mode != last_mode) {
|
||||||
|
requireSucess = false;
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
||||||
|
}
|
||||||
|
if (move != last_move) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||||
|
}
|
||||||
|
if (action != last_action) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + "->" + action);
|
||||||
|
}
|
||||||
|
if (error != last_error) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
|
||||||
|
}
|
||||||
|
if (walk_y != last_walk_y) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y:" + last_walk_y + "->" + walk_y);
|
||||||
|
}
|
||||||
|
if (task != last_task) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task);
|
||||||
|
}
|
||||||
|
if (x_position != last_x_position) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(x_position));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position:" + last_x_position + "->" + x_position);
|
||||||
|
}
|
||||||
|
if (y_position != last_y_position) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(y_position));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position:" + last_y_position + "->" + y_position);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新指令状态
|
||||||
|
if (mode == 3 && task > 0) {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.instruction_update_time = date;
|
||||||
|
//更改指令状态
|
||||||
|
if (task > 0) {
|
||||||
|
Instruction inst = checkInst();
|
||||||
|
if (inst != null) {
|
||||||
|
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||||
|
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||||
|
inst.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception var17) {
|
||||||
|
var17.printStackTrace();
|
||||||
|
feedMessage = var17.getMessage();
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.standardItemProtocol));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == 0) {
|
||||||
|
this.setIsonline(false);
|
||||||
|
message = "未联机";
|
||||||
|
//有报警
|
||||||
|
} else if (error != 0) {
|
||||||
|
this.setIserror(true);
|
||||||
|
message = "有报警";
|
||||||
|
//无报警
|
||||||
|
} else {
|
||||||
|
this.setIsonline(true);
|
||||||
|
this.setIserror(false);
|
||||||
|
message = "";
|
||||||
|
Instruction instruction = null;
|
||||||
|
List toInstructions;
|
||||||
|
|
||||||
|
//行架机械手申请任务
|
||||||
|
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
|
||||||
|
// boolean res = applyTask();
|
||||||
|
// if (res) {
|
||||||
|
// notCreateInstMessage = "";
|
||||||
|
// notCreateTaskMessage = "";
|
||||||
|
// feedMessage = "";
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
|
if (mode == 2) {
|
||||||
|
//if (!requireSucess) {
|
||||||
|
String remark = "未查找任务原因为:";
|
||||||
|
if (mode != 2) {
|
||||||
|
remark = remark + "工作模式(mode)不是待机状态,";
|
||||||
|
}
|
||||||
|
if (move != 0) {
|
||||||
|
remark = remark + "光电信号(move)为有货状态,";
|
||||||
|
}
|
||||||
|
if (task != 0) {
|
||||||
|
remark = remark + "当前上报任务号(task)应该为0,";
|
||||||
|
if (ObjectUtil.isNotEmpty(this.inst)) {
|
||||||
|
this.inst = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requireSucess) {
|
||||||
|
remark = remark + "请右击该图标,将请求任务复位标记(requireSucess)改为否。";
|
||||||
|
}
|
||||||
|
this.setNotCreateTaskMessage(remark);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
last_mode = mode;
|
||||||
|
last_move = move;
|
||||||
|
last_action = action;
|
||||||
|
last_walk_y = walk_y;
|
||||||
|
last_error = error;
|
||||||
|
last_task = task;
|
||||||
|
last_heartbeat = heartbeat;
|
||||||
|
last_to_task = to_task;
|
||||||
|
last_to_command = to_command;
|
||||||
|
last_to_target = to_target;
|
||||||
|
last_to_onset = to_onset;
|
||||||
|
last_x_position = x_position;
|
||||||
|
last_y_position = y_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getDeviceStatusName() {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
String mode = "";
|
||||||
|
String move = "";
|
||||||
|
String action = "";
|
||||||
|
String walk_y = "";
|
||||||
|
if (this.getMode() == 0) {
|
||||||
|
mode = "脱机";
|
||||||
|
} else if (this.getMode() == 1) {
|
||||||
|
mode = "单机";
|
||||||
|
} else if (this.getMode() == 2) {
|
||||||
|
mode = "待机";
|
||||||
|
} else if (this.getMode() == 3) {
|
||||||
|
mode = "运行中";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getMove() == 0) {
|
||||||
|
move = "无货";
|
||||||
|
} else if (this.getMove() == 1) {
|
||||||
|
move = "有货";
|
||||||
|
}
|
||||||
|
|
||||||
|
String requireSucess = "0";
|
||||||
|
if (this.requireSucess) {
|
||||||
|
requireSucess = "1";
|
||||||
|
}
|
||||||
|
jo.put("requireSucess", requireSucess);
|
||||||
|
if (this.getAction() == 1) {
|
||||||
|
action = "取货中";
|
||||||
|
} else if (this.getAction() == 2) {
|
||||||
|
action = "取货完成";
|
||||||
|
} else if (this.getAction() == 3) {
|
||||||
|
action = "放货中";
|
||||||
|
} else if (this.getAction() == 4) {
|
||||||
|
action = "放货完成";
|
||||||
|
}
|
||||||
|
|
||||||
|
jo.put("device_name", this.getDevice().getDevice_name());
|
||||||
|
jo.put("mode", mode);
|
||||||
|
jo.put("move", move);
|
||||||
|
jo.put("action", action);
|
||||||
|
jo.put("task", task);
|
||||||
|
jo.put("walk_y", walk_y);
|
||||||
|
jo.put("isOnline", this.getIsonline());
|
||||||
|
jo.put("error", ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(this.getError())));
|
||||||
|
jo.put("isError", this.getIserror());
|
||||||
|
jo.put("message", this.getMessage());
|
||||||
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
|
jo.put("notCreateInstMessage", notCreateInstMessage);
|
||||||
|
jo.put("feedMessage", feedMessage);
|
||||||
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
|
jo.put("is_click", true);
|
||||||
|
jo.put("x", x_position);
|
||||||
|
jo.put("y", y_position);
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDeviceStatus(JSONObject data) {
|
||||||
|
String requestSucess = data.getString("requireSucess");
|
||||||
|
if (StrUtil.equals(requestSucess, "0")) {
|
||||||
|
this.requireSucess = false;
|
||||||
|
} else if (StrUtil.equals(requestSucess, "1")) {
|
||||||
|
this.requireSucess = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject feedLmsRealFailedInfo() {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("device_code", this.getDevice().getDevice_code());
|
||||||
|
jo.put("device_name", this.getDevice().getDevice_name());
|
||||||
|
jo.put("fault_code", String.valueOf(error));
|
||||||
|
jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
|
||||||
|
jo.put("fault_type", error_type);
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Instruction checkInst() {
|
||||||
|
if (ObjectUtil.isNotEmpty(this.inst)) {
|
||||||
|
if (this.task > 0) {
|
||||||
|
if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) {
|
||||||
|
return this.inst;
|
||||||
|
} else {
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一楼木箱出入库站点
|
* 一楼木箱出入库标准站点
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@@ -23,12 +23,12 @@ public class BoxStorageOutConveyorDefination implements OpcDeviceDriverDefinatio
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDriverName() {
|
public String getDriverName() {
|
||||||
return "一楼木箱入库站点";
|
return "一楼木箱出入库标准站点";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDriverDescription() {
|
public String getDriverDescription() {
|
||||||
return "一楼木箱入库站点";
|
return "一楼木箱出入库标准站点";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,24 +23,32 @@ import org.nl.acs.history.service.DeviceErrorLogService;
|
|||||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||||
import org.nl.acs.instruction.domain.Instruction;
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
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.domain.Task;
|
||||||
|
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||||
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.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||||
|
import org.nl.acs.utils.ConvertUtil;
|
||||||
|
import org.nl.common.utils.CodeUtil;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
||||||
|
|
||||||
import org.openscada.opc.lib.da.Server;
|
import org.openscada.opc.lib.da.Server;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一楼木箱入库站点
|
* 一楼木箱出入库标准站点
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
@@ -69,6 +77,10 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||||
|
|
||||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TaskMapper taskMapper;
|
||||||
|
|
||||||
//当前指令
|
//当前指令
|
||||||
Instruction inst = null;
|
Instruction inst = null;
|
||||||
|
|
||||||
@@ -108,6 +120,8 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
int last_to_weight = 0;
|
int last_to_weight = 0;
|
||||||
int to_height = 0;
|
int to_height = 0;
|
||||||
int last_to_height = 0;
|
int last_to_height = 0;
|
||||||
|
int container_type = 0;
|
||||||
|
int last_container_type = 0;
|
||||||
|
|
||||||
int phase = 0;
|
int phase = 0;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
@@ -169,7 +183,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
to_target = this.itemProtocol.getTo_target();
|
to_target = this.itemProtocol.getTo_target();
|
||||||
to_task = this.itemProtocol.getTo_task();
|
to_task = this.itemProtocol.getTo_task();
|
||||||
heartbeat = this.itemProtocol.getHeartbeat();
|
heartbeat = this.itemProtocol.getHeartbeat();
|
||||||
|
container_type = this.itemProtocol.getContainer_Type();
|
||||||
|
|
||||||
if (to_strap_times != last_to_strap_times) {
|
if (to_strap_times != last_to_strap_times) {
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_strap_times:" + last_to_strap_times + "->" + to_strap_times);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_strap_times:" + last_to_strap_times + "->" + to_strap_times);
|
||||||
@@ -210,16 +224,12 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
dto.setError_info(errorInfo);
|
dto.setError_info(errorInfo);
|
||||||
deviceErrorLogService.create(dto);
|
deviceErrorLogService.create(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
|
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
|
||||||
}
|
}
|
||||||
if (move != 0 && task > 0) {
|
if (move != 0 && task > 0) {
|
||||||
|
|
||||||
update_instruction_status();
|
updateInstruct();
|
||||||
}
|
}
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
var17.printStackTrace();
|
var17.printStackTrace();
|
||||||
@@ -248,7 +258,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
log.debug("设备运转模式:等待工作");
|
log.debug("设备运转模式:等待工作");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//木箱出库申请任务
|
//申请输送任务
|
||||||
if (move > 0 && !requireSucess) {
|
if (move > 0 && !requireSucess) {
|
||||||
instruction_require();
|
instruction_require();
|
||||||
}
|
}
|
||||||
@@ -305,50 +315,28 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
this.control(itemMap);
|
this.control(itemMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void updateInstruct() throws Exception {
|
||||||
* 更新指令状态
|
if (mode == 2 && move != 0 && task > 0) {
|
||||||
*/
|
//inst_message
|
||||||
public synchronized void update_instruction_status() throws Exception {
|
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
Date date = new Date();
|
|
||||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.instruction_update_time = date;
|
|
||||||
inst = checkInst();
|
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||||
vehicle_code = inst.getVehicle_code();
|
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||||
task_code = inst.getTask_code();
|
|
||||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
|
||||||
inst.setInstruction_status("1");
|
|
||||||
inst.setExecute_device_code(this.device_code);
|
|
||||||
instructionService.update(inst);
|
|
||||||
logServer.deviceExecuteLog(device_code, "", "", "纸箱入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task + ",载具号:" + inst.getVehicle_code());
|
|
||||||
}
|
|
||||||
if (StrUtil.equals(inst.getInstruction_status(), "1") || StrUtil.equals(inst.getInstruction_status(), "0")) {
|
|
||||||
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
|
||||||
vehicle_code = inst.getVehicle_code();
|
|
||||||
inst.setExecute_device_code(this.device_code);
|
|
||||||
if (mode == 2) {
|
|
||||||
finish_instruction();
|
finish_instruction();
|
||||||
}
|
}
|
||||||
logServer.deviceExecuteLog(device_code, "", "", "纸箱入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task + ",载具号:" + inst.getVehicle_code());
|
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||||
} else {
|
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||||
|
instructionService.update(inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// message = "输送线任务反馈状态,查询不到指令号:" + task +"指令已完成";
|
|
||||||
inst_message = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求指令
|
* 请求指令
|
||||||
|
*
|
||||||
|
* @param
|
||||||
*/
|
*/
|
||||||
public synchronized boolean instruction_require() {
|
public synchronized boolean instruction_require() {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
|||||||
@@ -94,6 +94,10 @@ public class ItemProtocol {
|
|||||||
return this.getOpcIntegerValue(item_carrier_direction);
|
return this.getOpcIntegerValue(item_carrier_direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getContainer_Type() {
|
||||||
|
return this.getOpcIntegerValue(item_container_type);
|
||||||
|
}
|
||||||
|
|
||||||
public int getError() {
|
public int getError() {
|
||||||
return this.getOpcIntegerValue(item_error);
|
return this.getOpcIntegerValue(item_error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class ItemProtocol {
|
|||||||
public static String item_container_type = "container_type";
|
public static String item_container_type = "container_type";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料类型
|
* 物料编码
|
||||||
*/
|
*/
|
||||||
public static String item_material_barcode = "material_barcode";
|
public static String item_material_barcode = "material_barcode";
|
||||||
|
|
||||||
@@ -53,6 +53,7 @@ public class ItemProtocol {
|
|||||||
*/
|
*/
|
||||||
public static String item_action = "action";
|
public static String item_action = "action";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下发命令
|
* 下发命令
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -234,26 +234,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新指令状态
|
// 更新指令状态
|
||||||
if (mode == 3 && task > 0) {
|
updateInstruct();
|
||||||
Date date = new Date();
|
|
||||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.instruction_update_time = date;
|
|
||||||
//更改指令状态
|
|
||||||
if (task > 0) {
|
|
||||||
Instruction inst = checkInst();
|
|
||||||
if (inst != null) {
|
|
||||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
|
||||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
|
||||||
inst.setExecute_device_code(this.device_code);
|
|
||||||
instructionService.update(inst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
var17.printStackTrace();
|
var17.printStackTrace();
|
||||||
@@ -276,7 +257,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
message = "";
|
message = "";
|
||||||
Instruction instruction = null;
|
Instruction instruction = null;
|
||||||
List toInstructions;
|
List toInstructions;
|
||||||
//申请入库任务
|
//木箱入库申请入库任务
|
||||||
if (mode == 6 && !requireSucess){
|
if (mode == 6 && !requireSucess){
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -331,6 +312,28 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
last_barcode = barcode;
|
last_barcode = barcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateInstruct() {
|
||||||
|
if (mode == 3 && task > 0) {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.instruction_update_time = date;
|
||||||
|
//更改指令状态
|
||||||
|
if (task > 0) {
|
||||||
|
Instruction inst = checkInst();
|
||||||
|
if (inst != null) {
|
||||||
|
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||||
|
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||||
|
inst.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -70,6 +70,19 @@ public class ItemProtocol {
|
|||||||
*/
|
*/
|
||||||
public static String item_to_task = "to_task";
|
public static String item_to_task = "to_task";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*木箱长度
|
||||||
|
*/
|
||||||
|
public static String item_to_length = "to_length";
|
||||||
|
/**
|
||||||
|
*木箱宽度
|
||||||
|
*/
|
||||||
|
public static String item_to_weight = "to_weight";
|
||||||
|
/**
|
||||||
|
*木箱高度
|
||||||
|
*/
|
||||||
|
public static String item_to_height = "to_height";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private UnBoxLableConveyorDeviceDriver driver;
|
private UnBoxLableConveyorDeviceDriver driver;
|
||||||
@@ -163,6 +176,9 @@ public class ItemProtocol {
|
|||||||
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
|
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
|
||||||
list.add(new ItemDto(item_container_type, "托盘类型", "DB101.B7"));
|
list.add(new ItemDto(item_container_type, "托盘类型", "DB101.B7"));
|
||||||
list.add(new ItemDto(item_task, "任务号", "DB600.D10"));
|
list.add(new ItemDto(item_task, "任务号", "DB600.D10"));
|
||||||
|
list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W24"));
|
||||||
|
list.add(new ItemDto(item_to_weight, "木箱宽度", "DB601.W26"));
|
||||||
|
list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W28"));
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import java.util.*;
|
|||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一楼木箱入库站点
|
* 一楼申请开箱位、贴标位
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
@@ -205,11 +205,6 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (move != 0 && task > 0) {
|
|
||||||
|
|
||||||
update_instruction_status();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
var17.printStackTrace();
|
var17.printStackTrace();
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
|
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
|
||||||
@@ -220,7 +215,6 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
this.setIsonline(false);
|
this.setIsonline(false);
|
||||||
message = "未联机";
|
message = "未联机";
|
||||||
//有报警
|
//有报警
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.setIsonline(true);
|
this.setIsonline(true);
|
||||||
this.setIserror(false);
|
this.setIserror(false);
|
||||||
@@ -228,21 +222,30 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
this.setIserror(true);
|
this.setIserror(true);
|
||||||
message = "有报警";
|
message = "有报警";
|
||||||
}
|
}
|
||||||
|
|
||||||
Instruction instruction = null;
|
|
||||||
List toInstructions;
|
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 1:
|
case 1:
|
||||||
log.debug("设备运转模式:等待工作");
|
log.debug("设备运转模式:等待工作");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//申请任务
|
//存在任务号创建指令
|
||||||
|
if (move == 1 && task > 0 && !requireSucess){
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
//申请是否允许开箱
|
||||||
if (move > 0 && !requireSucess) {
|
if (move > 0 && !requireSucess) {
|
||||||
instruction_require();
|
applyUnBox();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
//申请是否允许贴标
|
||||||
|
if (move > 0 && !requireSucess) {
|
||||||
|
applyLable();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
last_mode = mode;
|
last_mode = mode;
|
||||||
last_move = move;
|
last_move = move;
|
||||||
@@ -259,6 +262,12 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
last_to_height = to_height;
|
last_to_height = to_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyLable() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyUnBox() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean exe_error() {
|
public boolean exe_error() {
|
||||||
if (this.error == 0) {
|
if (this.error == 0) {
|
||||||
|
|||||||
@@ -325,6 +325,38 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//放货完成
|
||||||
|
if (mode == 3 && action == 4 && move == 0) {
|
||||||
|
if (inst != null) {
|
||||||
|
try {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "放货完成");
|
||||||
|
finish_instruction(inst);
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("to_command", 5);
|
||||||
|
this.writing(map);
|
||||||
|
message = "放货完成";
|
||||||
|
} catch (Exception e) {
|
||||||
|
message = "放货失败";
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
feedMessage = "";
|
||||||
|
} else {
|
||||||
|
feedMessage = "行架机械手:";
|
||||||
|
if (mode != 3) {
|
||||||
|
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||||
|
}
|
||||||
|
if (action != 8) {
|
||||||
|
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
|
||||||
|
}
|
||||||
|
if (move != 0) {
|
||||||
|
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||||
|
}
|
||||||
|
if (task == 0) {
|
||||||
|
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -339,7 +371,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
//找符合条件的任务
|
//找符合条件的任务
|
||||||
BoxOutSubvolumesConveyorDeviceDriver boxOutSubvolumesConveyorDeviceDriver = new BoxOutSubvolumesConveyorDeviceDriver();
|
BoxOutSubvolumesConveyorDeviceDriver boxOutSubvolumesConveyorDeviceDriver = new BoxOutSubvolumesConveyorDeviceDriver();
|
||||||
String deviceCode = boxOutSubvolumesConveyorDeviceDriver.getDevice_code();
|
String deviceCode = boxOutSubvolumesConveyorDeviceDriver.getDevice_code();
|
||||||
TaskDto taskDto = taskserver.findByEndCodeAndReady(deviceCode, TaskTypeEnum.Truss_Task.getIndex());
|
TaskDto taskDto = taskserver.findByEndCodeAndReady(deviceCode, TaskTypeEnum.Box_Package.getIndex());
|
||||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||||
|
|
||||||
String interactionJson = taskDto.getInteraction_json();
|
String interactionJson = taskDto.getInteraction_json();
|
||||||
@@ -418,6 +450,13 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
|
||||||
|
instructionService.finish(inst);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下发
|
* 下发
|
||||||
* @param map
|
* @param map
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ 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.one_conveyor.box_out_subvolumes_conveyor.BoxOutSubvolumesConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.one_conveyor.box_storage_out_conveyor.BoxStorageOutConveyorDeviceDriver;
|
import org.nl.acs.device_driver.one_conveyor.box_storage_out_conveyor.BoxStorageOutConveyorDeviceDriver;
|
||||||
import org.nl.acs.history.ErrorUtil;
|
import org.nl.acs.history.ErrorUtil;
|
||||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||||
@@ -277,7 +278,41 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//放货完成
|
||||||
|
if (mode == 3 && action == 4 && move == 0) {
|
||||||
|
if (inst != null) {
|
||||||
|
try {
|
||||||
|
logServer.deviceExecuteLog(this.device_code,"","","放货完成");
|
||||||
|
finish_instruction(inst);
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("to_command", 5);
|
||||||
|
this.writing(map);
|
||||||
|
message = "放货完成";
|
||||||
|
} catch (Exception e) {
|
||||||
|
message = "放货失败";
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
feedMessage = "";
|
||||||
|
}else {
|
||||||
|
feedMessage = "行架机械手:";
|
||||||
|
if (mode != 3) {
|
||||||
|
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||||
|
}
|
||||||
|
if (action != 8) {
|
||||||
|
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
|
||||||
|
}
|
||||||
|
if (move != 0) {
|
||||||
|
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||||
|
}
|
||||||
|
if (task == 0) {
|
||||||
|
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,8 +324,8 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
} else {
|
} else {
|
||||||
this.instruction_require_time = date;
|
this.instruction_require_time = date;
|
||||||
//找终点为入库输送线工位任务类型为行架的任务
|
//找终点为入库输送线工位任务类型为行架的任务
|
||||||
BoxStorageOutConveyorDeviceDriver boxStorageConveyorDeviceDriver = new BoxStorageOutConveyorDeviceDriver();
|
BoxOutSubvolumesConveyorDeviceDriver boxOutSubvolumesConveyorDeviceDriver = new BoxOutSubvolumesConveyorDeviceDriver();
|
||||||
String deviceCode = boxStorageConveyorDeviceDriver.getDevice_code();
|
String deviceCode = boxOutSubvolumesConveyorDeviceDriver.getDevice_code();
|
||||||
TaskDto taskDto = taskserver.findByEndCodeAndReady(deviceCode, TaskTypeEnum.Box_Storage.getIndex());
|
TaskDto taskDto = taskserver.findByEndCodeAndReady(deviceCode, TaskTypeEnum.Box_Storage.getIndex());
|
||||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||||
|
|
||||||
@@ -395,6 +430,11 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
|
||||||
|
instructionService.finish(inst);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 抽取统一下发电气信号前缀
|
* 抽取统一下发电气信号前缀
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ public enum TaskTypeEnum {
|
|||||||
Inner_Truss_Task("9", "9", "内包间行架任务"),
|
Inner_Truss_Task("9", "9", "内包间行架任务"),
|
||||||
|
|
||||||
Stacker_Task("11", "11", "堆垛机任务"),
|
Stacker_Task("11", "11", "堆垛机任务"),
|
||||||
Box_Storage("12", "12", "木箱入库任务"),
|
Box_Storage("12", "12", "木箱入库行架任务"),
|
||||||
Return_Good("13", "13", "退货入库任务");
|
Box_Package("13", "13", "装箱入库行架任务"),
|
||||||
|
Return_Good("14", "14", "退货入库任务");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 索引
|
* 索引
|
||||||
|
|||||||
Reference in New Issue
Block a user