rev:新增驱动

This commit is contained in:
2024-01-16 13:38:05 +08:00
parent 2fad2071b3
commit ac611aa823
51 changed files with 2488 additions and 978 deletions

View File

@@ -9,12 +9,14 @@ 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.DeviceService;
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.ext.wms.service.AcsToWmsService;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
@@ -44,19 +46,21 @@ import java.util.List;
public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
protected StandardItemProtocol standardItemProtocol = new StandardItemProtocol(this);
@Autowired
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
@Autowired
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
@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);
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
//工作模式
int mode = 0;

View File

@@ -1,392 +0,0 @@
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;
}
}

View File

@@ -11,7 +11,7 @@ import java.util.LinkedList;
import java.util.List;
/**
* 一楼木箱出入库标准站点
* 一楼木箱出入库站点
*
*/
@Service
@@ -23,12 +23,12 @@ public class BoxStorageOutConveyorDefination implements OpcDeviceDriverDefinatio
@Override
public String getDriverName() {
return "一楼木箱入库标准站点";
return "一楼木箱入库站点";
}
@Override
public String getDriverDescription() {
return "一楼木箱入库标准站点";
return "一楼木箱入库站点";
}
@Override

View File

@@ -0,0 +1,159 @@
package org.nl.acs.device_driver.paper_tube_pick_site;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Data
public class ItemProtocol {
//心跳
public static String item_heartbeat = "heartbeat";
//工作模式
public static String item_mode = "mode";
//光电信号
public static String item_move = "move";
//动作信号
public static String item_action = "action";
//总数量
public static String item_qty = "qty";
//报警
public static String item_error = "error";
//物料
public static String item_material = "material";
//物料直径
public static String item_size = "size";
//物料长度
public static String item_len = "len";
//明细数量
public static String item_Itemized_qty = "Itemized_qty";
//下发命令
public static String item_to_command = "to_command";
//下发物料类型
public static String item_to_material = "to_material";
//下发命令
public static String item_to_size = "to_size";
//下发命令
public static String item_to_len = "to_len";
//下发命令
public static String item_to_qty = "to_qty";
private PaperTubePickSiteDeviceDriver driver;
public ItemProtocol(PaperTubePickSiteDeviceDriver driver){this.driver=driver;}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getMove() {
return this.getOpcIntegerValue(item_move);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getQty() {
return this.getOpcIntegerValue(item_qty);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public String getMaterial() {
return this.getOpcStringValue(item_material);
}
public int getSize() {
return this.getOpcIntegerValue(item_size);
}
public int getLen() {
return this.getOpcIntegerValue(item_len);
}
public int getItemized_qty() {
return this.getOpcIntegerValue(item_Itemized_qty);
}
public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
}
public String getTo_material() {
return this.getOpcStringValue(item_to_material);
}
public int getTo_size() {
return this.getOpcIntegerValue(item_to_size);
}
public int getTo_len() {
return this.getOpcIntegerValue(item_to_len);
}
public int getTo_qty() {
return this.getOpcIntegerValue(item_to_qty);
}
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isBlank(value)) {
} else {
return value;
}
return "0";
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
list.add(new ItemDto(item_move, "光电信号", "DB1.B2"));
list.add(new ItemDto(item_action, "取放信号", "DB1.B3"));
list.add(new ItemDto(item_error, "报警", "DB1001.B4"));
list.add(new ItemDto(item_qty, "总数量", "DB1001.B5"));
list.add(new ItemDto(item_material, "物料类型", "DB1.B6"));
list.add(new ItemDto(item_size, "物料直径", "DB1.B7"));
list.add(new ItemDto(item_len, "物料长度", "DB1.B8"));
list.add(new ItemDto(item_Itemized_qty, "物料明细数量", "DB1.B9"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0"));
list.add(new ItemDto(item_to_material, "下发物料类型", "DB2.W2"));
list.add(new ItemDto(item_to_size, "下发物料直径", "DB2.W4"));
list.add(new ItemDto(item_to_len, "下发物料长度", "DB2.W6"));
list.add(new ItemDto(item_to_qty, "下发物料数量", "DB2.W8"));
return list;
}
}

View File

@@ -0,0 +1,61 @@
package org.nl.acs.device_driver.paper_tube_pick_site;
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.nl.acs.device_driver.two_conveyor.pull_head_manipulator.ItemProtocol;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
@Service
public class PaperTubePickSiteDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "paper_tube_pick_size";
}
@Override
public String getDriverName() {
return "纸管抓取位";
}
@Override
public String getDriverDescription() {
return "纸管抓取位";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new PaperTubePickSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return PaperTubePickSiteDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,238 @@
package org.nl.acs.device_driver.paper_tube_pick_site;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
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.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(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);
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private Date instruction_apply_time = new Date();
private int instruction_require_time_out = 3000;
//工作模式
int mode = 0;
int last_mode = 0;
//光电信号
int move = 0;
int last_move = 0;
//动作信号
int action = 0;
int last_action = 0;
//总数量
int qty = 0;
int last_qty = 0;
//物料类型
String material = null;
String last_material = null;
//物料直径
int size =0;
int last_size =0;
//物料长度
int len = 0;
int last_len = 0;
//物料明细数量
int Itemized_qty = 0;
int last_Itemized_qty = 0;
//报警信号
int error = 0;
int last_error = 0;
int heartbeat = 0;
int last_heartbeat = 0;
int to_command = 0;
int last_to_command = 0;
//下发物料类型
String to_material =null;
String last_to_material =null;
//下发物料直径
int to_size = 0;
int last_to_size = 0;
//下发物料长度
int to_len=0;
int last_to_len=0;
//下发物料数量
int to_qty=0;
int last_to_qty=0;
Boolean isonline = true;
Boolean iserror = false;
/**
* 1-执行任务2-取货完成3-放货完成;
*/
int flag;
String device_code;
@Override
public Device getDevice() {
return this.device;
}
/**
* 请求成功标记
*/
Boolean requireSucess = false;
@Override
public void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError();
move = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
if (mode != last_mode) {
this.setRequireSucess(false);
if (mode == 2) {
this.writing(0);
}
}
if (move != last_move) {
}
if (error != last_error) {
}
} catch (Exception var17) {
return;
}
if (!this.itemProtocol.getIsonline()) {
this.setIsonline(false);
this.setIserror(true);
message = "信号量同步异常";
//未联机
} else if (mode == 0) {
this.setIsonline(false);
this.setIserror(true);
message = "未联机";
//有报警
} else if (error != 0) {
this.setIsonline(false);
this.setIserror(true);
message = "有报警";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
return;
case 2:
break;
case 3:
break;
default:
break;
}
switch (flag) {
//取货完成
case 1:
writing(3);
return;
//放货完成
case 2:
writing(5);
return;
default:
break;
}
}
}
protected void thingToNothing() {
this.setRequireSucess(false);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.ItemProtocol.item_to_command;
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
this.control(itemMap);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", "联机");
jo.put("action", action);
jo.put("isOnline", true);
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.blank_manipulator;
package org.nl.acs.device_driver.two_conveyor.blank_manipulator;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.blank_manipulator;
package org.nl.acs.device_driver.two_conveyor.blank_manipulator;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.blank_manipulator;
package org.nl.acs.device_driver.two_conveyor.blank_manipulator;
import cn.hutool.core.util.StrUtil;
import lombok.Data;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.blanking_button;
package org.nl.acs.device_driver.two_conveyor.blanking_button;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -0,0 +1,327 @@
package org.nl.acs.device_driver.two_conveyor.blanking_button;
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.AcsConfig;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
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.ext.wms.data.BlankingButtonRequest;
import org.nl.acs.ext.wms.data.BlankingButtonResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService;
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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 下料按钮
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class);
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean(RouteLineService.class);
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@Autowired
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
@Autowired
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class);
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
private String error_type = "hx_error_type";
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private Date instruction_apply_time = new Date();
private int instruction_require_time_out = 3000;
public int heartbeat = 0;
public int mode = 0;
public int move = 0;
public int action = 0;
public int error = 0;
public int last_heartbeat = 0;
public int last_mode = 0;
public int last_move = 0;
public int last_action = 0;
public int last_error = 0;
Boolean isonline = true;
Boolean iserror = false;
String device_code;
String message = null;
@Override
public Device getDevice() {
return this.device;
}
//请求成功标记
Boolean requireSucess = false;
@Override
public void execute() {
device_code = this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
mode = this.itemProtocol.getItem_mode();
move = this.itemProtocol.getItem_move();
action = this.itemProtocol.getItem_action();
error = this.itemProtocol.getItem_error();
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 (mode == 0) {
this.setIsonline(false);
message = "未联机";
// 有报警
// } else if (error != 0) {
// this.setIsonline(false);
// this.setIserror(true);
// message = "有报警";
// //无报警
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
}
message = "";
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 2:
log.debug("设备运转模式:等待工作");
break;
case 3:
log.debug("设备运转模式:等待工作");
break;
case 9:
// 表处下满料请求
if (move > 0 && !requireSucess) {
applyTakeFullVolume();
}
break;
case 10:
//表处上空轴请求
if (move > 0 && !requireSucess) {
applyTakeEmptyShaft();
}
break;
case 11:
// 取消任务
if (move > 0 && !requireSucess) {
cancelTask();
}
break;
default:
break;
}
}
last_mode = mode;
last_move = move;
last_action = action;
last_error = error;
}
/**
* 表处下满料请求
*/
public synchronized void applyTakeFullVolume() {
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;
} else {
this.instruction_require_time = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "申请下满料请求中...";
BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest();
blankingButtonRequest.setDevice_code(device_code);
blankingButtonRequest.setType("1");
BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest);
if (ObjectUtil.isEmpty(response)) {
message = "申请下满料任务接口不通";
} else {
if (response.getCode()== 200) {
this.writing("to_command","9");
message = "申请下满料任务成功";
requireSucess = true;
} else {
requireSucess = false;
message = "申请下满料任务失败," + response.getMessage();
this.writing("to_command","99");
}
}
}
}
}
/**
* 申请取消任务
*/
public synchronized void applyTakeEmptyShaft() {
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;
} else {
this.instruction_require_time = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "申请取消任务中...";
BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest();
blankingButtonRequest.setDevice_code(device_code);
blankingButtonRequest.setType("2");
BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest);
if (ObjectUtil.isEmpty(response)) {
message = "申请取消任务接口不通";
} else {
if (response.getCode()== 200) {
this.writing("to_command","10");
message = "申请取消任务成功";
requireSucess = true;
} else {
requireSucess = false;
message = "申请取消任务失败," + response.getMessage();
this.writing("to_command","99");
}
}
}
}
}
/**
* 取消任务
*/
public synchronized void cancelTask() {
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;
} else {
this.instruction_require_time = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "申请取消任务中...";
BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest();
blankingButtonRequest.setDevice_code(device_code);
blankingButtonRequest.setType("2");
BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest);
if (ObjectUtil.isEmpty(response)) {
message = "申请AGV搬运任务接口不通";
} else {
if (response.getCode()== 200) {
this.writing("to_command","10");
message = "申请AGV搬运任务成功";
requireSucess = true;
} else {
requireSucess = false;
message = "申请AGV搬运任务失败," + response.getMessage();
this.writing("to_command","99");
}
}
}
}
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}
@Override
public JSONObject feedLmsRealFailedInfo() {
return null;
}
@Override
public JSONObject getDeviceStatusName() throws Exception {
return null;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.blanking_button;
package org.nl.acs.device_driver.two_conveyor.blanking_button;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.green_foil_machine_button;
package org.nl.acs.device_driver.two_conveyor.green_foil_machine_button;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,14 +1,12 @@
package org.nl.acs.device_driver.green_foil_machine_button;
package org.nl.acs.device_driver.two_conveyor.green_foil_machine_button;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.AgvService;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
@@ -17,13 +15,10 @@ 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.ext.wms.data.ApplyLabelingAndBindingRequest;
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse;
import org.nl.acs.ext.wms.data.ApplyGreenFoilButtonRequest;
import org.nl.acs.ext.wms.data.ApplyGreenFoilButtonResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
@@ -167,7 +162,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
case 4:
// 申请AGV取空取满放空放满任务
if (move > 0 && !requireSucess) {
// applyFourPointAgvTask();
applyAgvTask(mode);
}
break;
case 5:
@@ -175,31 +170,31 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
* 申请AGV取空放空的任务
*/
if (move > 0 && !requireSucess) {
applyTakeEmptyAgvTask();
applyAgvTask(mode);
}
break;
case 6:
// 申请取满放满任务
if (move > 0 && !requireSucess) {
// applyTakeFullAgvTask();
applyAgvTask(mode);
}
break;
case 7:
// 允许AGV进入
if (move == 0 && !requireSucess) {
// allowAgvEntry();
applyAgvTask(mode);
}
break;
case 8:
// 允许AGV离开
if (move == 0 && !requireSucess) {
// allowAgvLeave();
applyAgvTask(mode);
}
break;
case 9:
// 取消任务
if (move == 0 && !requireSucess) {
// cancelTask();
applyAgvTask(mode);
}
break;
default:
@@ -217,9 +212,9 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
}
/**
* 申请AGV取空放空的任务
* 申请AGV任务
*/
public synchronized void applyTakeEmptyAgvTask() {
public synchronized void applyAgvTask(int mode) {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime()
< (long) this.instruction_require_time_out) {
@@ -229,20 +224,27 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
this.instruction_require_time = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "申请AGV搬运任务中...";
JSONObject apply = new JSONObject();
apply.put("device_code", device_code);
apply.put("type", CommonFinalParam.ONE);
String str = acsToWmsService.applyTaskToWms(apply);
JSONObject jo = JSON.parseObject(str);
if (ObjectUtil.isEmpty(jo)) {
ApplyGreenFoilButtonRequest applyGreenFoilButtonRequest = new ApplyGreenFoilButtonRequest();
applyGreenFoilButtonRequest.setDevice_code(device_code);
applyGreenFoilButtonRequest.setType(String.valueOf(mode));
ApplyGreenFoilButtonResponse response = acsToWmsService.applyGreenFoilButtonTask(applyGreenFoilButtonRequest);
if (ObjectUtil.isEmpty(response)) {
message = "申请AGV搬运任务接口不通";
} else {
if (jo.getInteger("status") == 200) {
if (response.getCode()== 200) {
if (mode==4){
this.writing("to_command","4");
}else if (mode==5){
this.writing("to_command","5");
}else if (mode==9){
this.writing("to_command","9");
}
message = "申请AGV搬运任务成功";
requireSucess = true;
} else {
requireSucess = false;
message = "申请AGV搬运任务失败," + jo.get("message").toString();
message = "申请AGV搬运任务失败," + response.getMessage();
this.writing("to_command","99");
}
}
}

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.green_foil_machine_button;
package org.nl.acs.device_driver.two_conveyor.green_foil_machine_button;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.conveyor.hongxiang_conveyor;
package org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.conveyor.hongxiang_conveyor;
package org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.conveyor.hongxiang_conveyor;
package org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.hongxiang_device;
package org.nl.acs.device_driver.two_conveyor.hongxiang_device;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,8 +1,6 @@
package org.nl.acs.device_driver.hongxiang_device;
package org.nl.acs.device_driver.two_conveyor.hongxiang_device;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -15,8 +13,6 @@ 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.ext.wms.data.ApplyLabelingAndBindingRequest;
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.hongxiang_device;
package org.nl.acs.device_driver.two_conveyor.hongxiang_device;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

View File

@@ -0,0 +1,59 @@
package org.nl.acs.device_driver.two_conveyor.inflatable_shaft_library;
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 InflatableShaftLibraryDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "inflatable_shaft_library";
}
@Override
public String getDriverName() {
return "气涨轴缓存库";
}
@Override
public String getDriverDescription() {
return "气涨轴缓存库";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new InflatableShaftLibraryDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return InflatableShaftLibraryDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -1,59 +1,80 @@
package org.nl.acs.device_driver.blanking_button;
package org.nl.acs.device_driver.two_conveyor.inflatable_shaft_library;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.dto.DeviceErrorLogDto;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
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.HashMap;
import java.util.Map;
/**
* 下料按钮
* 气涨轴缓存库
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
protected ItemProtocol itemProtocol = new ItemProtocol(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);
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
private String error_type = "hx_error_type";
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private Date instruction_apply_time = new Date();
private int instruction_require_time_out = 3000;
//心跳
public int heartbeat = 0;
public int mode = 0;
public int move = 0;
public int action = 0;
public int error = 0;
public int last_heartbeat = 0;
public int last_mode = 0;
public int last_move = 0;
public int last_action = 0;
public int last_error = 0;
//工作模式
int mode = 0;
int last_mode = 0;
//光电信号
int move = 0;
int last_move = 0;
//动作信号
int action = 0;
int last_action = 0;
//报警信号
int error = 0;
int last_error = 0;
//数量
int qty = 0;
int last_qty = 0;
//类型
int type = 0;
int last_type = 0;
int to_command = 0;
int last_to_command = 0;
Boolean isonline = true;
@@ -64,7 +85,6 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
String message = null;
@Override
public Device getDevice() {
return this.device;
@@ -82,7 +102,8 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
move = this.itemProtocol.getItem_move();
action = this.itemProtocol.getItem_action();
error = this.itemProtocol.getItem_error();
qty = this.itemProtocol.getItem_qty();
type = this.itemProtocol.getItem_type();
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
@@ -100,18 +121,29 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (qty != last_qty) {
logServer.deviceItemValue(this.device_code, "weight", String.valueOf(qty));
logServer.deviceExecuteLog(this.device_code, "", "", "信号qty" + last_qty + "->" + qty);
}
if (type != last_type) {
logServer.deviceItemValue(this.device_code, "weight", String.valueOf(type));
logServer.deviceExecuteLog(this.device_code, "", "", "信号type" + last_type + "->" + type);
}
if (move==1&&!requireSucess){
this.writing("to_command","1");
}
last_mode = mode;
last_move = move;
last_action = action;
last_error = error;
last_qty = qty;
last_type = type;
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()

View File

@@ -0,0 +1,102 @@
package org.nl.acs.device_driver.two_conveyor.inflatable_shaft_library;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Data
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_move = "move";
public static String item_action = "action";
public static String item_error = "error";
public static String item_qty = "qty";
public static String item_type = "type";
public static String item_to_command = "to_command";
private InflatableShaftLibraryDeviceDriver driver;
public ItemProtocol(InflatableShaftLibraryDeviceDriver driver){
this.driver=driver;
}
public int getItem_heartbeat(){
return this.getOpcIntegerValue(item_heartbeat);
} ;
public int getItem_mode(){
return this.getOpcIntegerValue(item_mode);
} ;
public int getItem_move(){
return this.getOpcIntegerValue(item_move);
} ;
public int getItem_action(){
return this.getOpcIntegerValue(item_action);
};
public int getItem_error(){
return this.getOpcIntegerValue(item_error);
}
public int getItem_qty(){
return this.getOpcIntegerValue(item_qty);
}
public int getItem_type(){
return this.getItem_type();
}
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getDoubleValue(protocol);
if (value == null) {
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0L;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
list.add(new ItemDto(item_move, "光电信号", "DB1.B2"));
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
list.add(new ItemDto(item_qty, "数量", "DB1.B4"));
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
list.add(new ItemDto(item_type, "类型", "DB1.B6"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0"));
return list;
}
@Override
public String toString() {
return "";
}
}

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.three_color.lamp_three_color;
package org.nl.acs.device_driver.two_conveyor.lamp_three_color;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.three_color.lamp_three_color;
package org.nl.acs.device_driver.two_conveyor.lamp_three_color;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.three_color.lamp_three_color;
package org.nl.acs.device_driver.two_conveyor.lamp_three_color;
import lombok.Data;
import lombok.RequiredArgsConstructor;

View File

@@ -0,0 +1,166 @@
package org.nl.acs.device_driver.two_conveyor.oven_manipulator;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Data
public class ItemProtocol {
//心跳
public static String item_heartbeat = "heartbeat";
//工作模式
public static String item_mode = "mode";
//光电信号
public static String item_move = "move";
//动作信号
public static String item_action = "action";
//行走列
public static String item_walk_y = "walk_y";
//任务号
public static String item_task = "task";
//报警
public static String item_error = "error";
//x轴坐标
public static String item_x_position = "x_position";
//y轴坐标
public static String item_y_position = "y_position";
//下发命令
public static String item_to_command = "to_command";
//下发起始站
public static String item_to_onset = "to_onset";
//下发目标站
public static String item_to_target = "to_target";
//下发任务号
public static String item_to_task = "to_task";
private OvenGantryManipulatorDeviceDriver driver;
public ItemProtocol(OvenGantryManipulatorDeviceDriver driver){
this.driver=driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getMove() {
return this.getOpcIntegerValue(item_move);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getWalk_y() {
return this.getOpcIntegerValue(item_walk_y);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getTask() {
return this.getOpcIntegerValue(item_task);
}
public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
}
public int getTo_target() {
return this.getOpcIntegerValue(item_to_target);
}
public int getTo_task() {
return this.getOpcIntegerValue(item_to_task);
}
public int getTo_onset() {
return this.getOpcIntegerValue(item_to_onset);
}
public float getX_position() {
return this.getOpcFloatValue(item_x_position);
}
public float getY_position() {
return this.getOpcFloatValue(item_y_position);
}
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
} else {
return value;
}
return "0";
}
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getDoubleValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
list.add(new ItemDto(item_move, "光电信号", "DB1.B2"));
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
list.add(new ItemDto(item_x_position, "x坐标", "DB1.REAL10"));
list.add(new ItemDto(item_y_position, "y坐标", "DB1.REAL14"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0"));
list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2"));
list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4"));
list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6"));
return list;
}
@Override
public String toString() {
return "";
}
}

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.manipulator.standard_manipulator;
package org.nl.acs.device_driver.two_conveyor.oven_manipulator;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;
@@ -9,26 +9,32 @@ import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
/**
* 烘箱-行架机械手
*
*/
@Service
public class StandarManipulatorDefination implements OpcDeviceDriverDefination {
public class OvenGantryManipulatorDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "standar_manipulator";
return "oven_manipulator";
}
@Override
public String getDriverName() {
return "标准机械手";
return "烘箱-行架机械手";
}
@Override
public String getDriverDescription() {
return "标准机械手";
return "烘箱-行架机械手";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new OvenGantryManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
@@ -45,13 +51,13 @@ public class StandarManipulatorDefination implements OpcDeviceDriverDefination {
@Override
public List<ItemDto> getReadableItemDtos() {
return StandardItemProtocol.getReadableItemDtos();
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return StandardItemProtocol.getWriteableItemDtos();
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.conveyor.plug_pull_device_site;
package org.nl.acs.device_driver.two_conveyor.plug_pull_device_site;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.conveyor.plug_pull_device_site;
package org.nl.acs.device_driver.two_conveyor.plug_pull_device_site;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.conveyor.plug_pull_device_site;
package org.nl.acs.device_driver.two_conveyor.plug_pull_device_site;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -237,6 +237,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
}
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
@@ -289,7 +290,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
break;
case 8:
if (!requireSucess && task > 0) {
//缓存线已满生成行架任务
//缓存线已满申请行架任务
// applyTask();
}
break;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.pull_head_manipulator;
package org.nl.acs.device_driver.two_conveyor.pull_head_manipulator;
import cn.hutool.core.util.StrUtil;
import lombok.Data;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.pull_head_manipulator;
package org.nl.acs.device_driver.two_conveyor.pull_head_manipulator;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.pull_head_manipulator;
package org.nl.acs.device_driver.two_conveyor.pull_head_manipulator;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
@@ -17,6 +17,7 @@ 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.device_driver.two_conveyor.pull_head_manipulator.ItemProtocol;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.pull_tail_manipulator;
package org.nl.acs.device_driver.two_conveyor.pull_tail_manipulator;
import cn.hutool.core.util.StrUtil;
import lombok.Data;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.pull_tail_manipulator;
package org.nl.acs.device_driver.two_conveyor.pull_tail_manipulator;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.pull_tail_manipulator;
package org.nl.acs.device_driver.two_conveyor.pull_tail_manipulator;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
@@ -243,13 +243,14 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
}
//反馈重量
if (mode == 3 && action == 5 && move == 0 && task > 0) {
if (mode == 3 && action == 5 && move == 0 && task > 0 && !requireSucess) {
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
if (ObjectUtil.isNotEmpty(inst2)) {
Map<String, Object> map = new LinkedHashMap<>();
//todo:反馈重量
map.put("to_command", "5");
this.writing(map);
this.requireSucess = true;
} else {
logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许取货now_steps_type=3");
}
@@ -270,7 +271,7 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
}
//任务完成
if (mode == 3 && action == 6 && move == 0 && task > 0) {
if (mode == 3 && action == 6 && move == 0 && task > 0 && !requireSucess) {
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
@@ -279,6 +280,7 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "6");
this.writing(map);
this.requireSucess = true;
} catch (Exception e) {
e.printStackTrace();
}
@@ -338,6 +340,32 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
this.setNotCreateTaskMessage(remark);
//}
}
switch (action) {
case 1:
//取货中
break;
case 2:
//取货完成
/*if (move > 0 && !requireSucess) {
instruction_require();
}*/
break;
case 3:
//放货中
break;
case 4:
//放货完成
if (move == 1 && !requireSucess && task > 0) {
//申请套管校验
// apply_for_casing_inspection(material1, material2);
// bushingSucess();
}
break;
default:
log.info("未知模式");
break;
}
}
}

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.conveyor.slit_two_manipulator;
package org.nl.acs.device_driver.two_conveyor.slit_two_manipulator;
import cn.hutool.core.util.StrUtil;
import lombok.Data;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.conveyor.slit_two_manipulator;
package org.nl.acs.device_driver.two_conveyor.slit_two_manipulator;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,10 +1,9 @@
package org.nl.acs.device_driver.conveyor.slit_two_manipulator;
package org.nl.acs.device_driver.two_conveyor.slit_two_manipulator;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -14,7 +13,6 @@ import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
@@ -62,7 +60,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//分切行架机械手是否禁用 0否 1是
private int is_disable = 0;
/**
/**
* 工作模式
*/
int mode = 0;
@@ -80,7 +78,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
int last_action1 = 0;
int action2 = 0;
int last_action2 = 0;
/**
/**
* 报警
*/
int error = 0;
@@ -107,6 +105,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
int hasGoods = 0;
String message = null;
Boolean iserror = false;
private Date instruction_update_time = new Date();
private int instruction_update_time_out = 500;
int branchProtocol = 0;
@@ -213,467 +213,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
logServer.deviceExecuteLog(this.device_code, "", "", "信号task2" + last_task2 + "->" + task2);
}
//单任务 前工位任务更新指令状态
if (task1 > 0 && type == 1) {
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
//当前执行步骤为更新任务状态
inst1.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
inst1.setExecute_device_code(this.getDevice_code());
instructionService.update(inst1);
// TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
// if (!ObjectUtil.isEmpty(taskDto)) {
// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
// JSONArray array = new JSONArray();
// JSONObject map = new JSONObject();
// map.put("task_id", taskDto.getExt_task_id());
// map.put("task_status", CommonFinalParam.ONE);
// array.add(map);
// acsToWmsService.feedbackTaskStatusToWms(array);
// }
// }
;
//this.setNow_steps_type1(1);
}
}
}
//单任务 后工位任务更新指令状态
if (task2 > 0 && type == 2) {
//inst_message
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
//指令更新状态
now_steps_type2 = 1;
inst2.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
inst2.setExecute_device_code(this.device_code);
instructionService.update(inst2);
// TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
// if (!ObjectUtil.isEmpty(taskDto)) {
// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
// JSONArray array = new JSONArray();
// JSONObject map = new JSONObject();
// map.put("task_id", taskDto.getExt_task_id());
// map.put("task_status", CommonFinalParam.ONE);
// array.add(map);
// acsToWmsService.feedbackTaskStatusToWms(array);
// }
// }
;
// this.setNow_steps_type2(1);
}
}
}
//双任务更新指令状态
if (task2 > 0 && task1 > 0 && type == 3) {
//inst_message
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
//指令更新状态
inst2.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
inst2.setExecute_device_code(this.device_code);
instructionService.update(inst2);
// TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
// if (!ObjectUtil.isEmpty(taskDto)) {
// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
// JSONArray array = new JSONArray();
// JSONObject map = new JSONObject();
// map.put("task_id", taskDto.getExt_task_id());
// map.put("task_status", CommonFinalParam.ONE);
// array.add(map);
// acsToWmsService.feedbackTaskStatusToWms(array);
// }
// }
;
}
}
}
//双任务/单任务 后工位取空时判断动作信号并反馈
if (mode == 3 && action2 == 1 && move2 == 0 && task2 > 0) {
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2));
String start_device_code = inst1.getStart_device_code();
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
if (ObjectUtil.isEmpty(startDevice)) {
feedMessage = "后工位取货位:" + start_device_code + "为空!";
logServer.deviceExecuteLog(this.getDeviceCode(), "", "", "后工位取货位:" + start_device_code + "为空!");
throw new BadRequestException("后工位取货位:" + start_device_code + "为空!");
}
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startDevice.getDeviceDriver();
int move = siemensConveyorDeviceDriver.getMove();
int mode = siemensConveyorDeviceDriver.getMode();
if (mode == 2 && move == 1) {
this.writing("to_command2", "2");
if (type == 2) {
this.setNow_steps_type2(3);
} else if (type == 3) {
this.setNow_steps_type3(3);
}
} else {
log.warn("后工位取货位无货,取货位:{},mode:{},move:{}", start_device_code, mode, move);
if (this.getNow_steps_type2() == 2 || this.getNow_steps_type3() == 2) {
feedMessage = "后工位未取货原因-->";
if (mode != 2) {
feedMessage += "后工位取货位工作模式不为待机(mode != 2),";
} else if (move != 1) {
feedMessage += "后工位取货位无货(move != 1)";
}
}
}
}
} else {
if (this.getNow_steps_type2() == 2 || this.getNow_steps_type3() == 2) {
feedMessage = "后工位未取货原因-->";
if (mode != 3) {
feedMessage += "行架工作模式不为运行中(mode != 3),";
}
if (action2 != 1) {
feedMessage += "后工位动作信号不为取货中(action2 != 1),";
}
if (move2 != 0) {
feedMessage += "后工位光电信号不为空(move2 != 0),";
}
if (task2 == 0) {
feedMessage += "后工位没有任务(task2 == 0)";
}
}
}
//单任务/或双任务 后工位收到取货完成信号并反馈
if (mode == 3 && action2 == 2 && move2 == 1 && task2 > 0) {
this.writing("to_command2", "3");
if (type == 2) {
this.setNow_steps_type2(4);
}
if (type == 3) {
this.setNow_steps_type3(4);
}
} else {
if (this.getNow_steps_type2() == 3 || this.getNow_steps_type3() == 3) {
feedMessage = "后工位取货完成后未反馈原因-->";
if (mode != 3) {
feedMessage += "行架工作模式不为运行中(mode != 3),";
}
if (action2 != 2) {
feedMessage += "后工位未取货完成(action2 != 2),";
}
if (move2 == 0) {
feedMessage += "后工位光电信号为空(move2 == 0),";
}
if (task2 == 0) {
feedMessage += "后工位没有任务(task2 == 0)";
}
}
}
//单任务/双任务 前工位取货时判断动作信号并反馈
if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0) {
this.writing("to_command1", "2");
if (type == 1) {
this.setNow_steps_type1(3);
} else if (type == 3) {
this.setNow_steps_type3(5);
}
} else {
if (this.getNow_steps_type1() == 2 || this.getNow_steps_type3() == 4) {
feedMessage = "前工位未取货原因";
if (mode != 3) {
feedMessage += "行架工作模式不为运行中(mode != 3),";
}
if (action1 != 1) {
feedMessage += "前工位动作信号不为取货中(action2 != 1),";
}
if (move1 != 0) {
feedMessage += "前工位光电信号不为空(move2 != 0),";
}
if (task1 == 0) {
feedMessage += "前工位没有任务(task2 == 0)";
}
}
}
//单任务/双任务 前工位取货完成并反馈
if (mode == 3 && action1 == 2 && move1 == 1 && task1 > 0) {
this.writing("to_command1", "3");
if (type == 1) {
this.setNow_steps_type1(4);
}
if (type == 3) {
this.setNow_steps_type3(6);
}
} else {
if (this.getNow_steps_type1() == 3 || this.getNow_steps_type3() == 5) {
feedMessage = "前工位取货完成后未反馈原因";
if (mode != 3) {
feedMessage += "行架工作模式不为运行中(mode != 3),";
}
if (action1 != 2) {
feedMessage += "前工位未取货完成(action2 != 2),";
}
if (move1 == 0) {
feedMessage += "前工位光电信号为空(move2 == 0),";
}
if (task1 == 0) {
feedMessage += "前工位没有任务(task2 == 0)";
}
}
}
//单任务/双任务 后工位放货时判断信号并反馈
if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) {
this.writing("to_command2", "4");
if (type == 2) {
this.setNow_steps_type2(5);
} else if (type == 3) {
this.setNow_steps_type3(7);
}
} else {
if (this.getNow_steps_type2() == 4 || this.getNow_steps_type3() == 6) {
feedMessage = "后工位未放货原因-->";
if (mode != 3) {
feedMessage += "行架工作模式不为运行中(mode != 3),";
}
if (action2 != 3) {
feedMessage += "后工位动作信号不为放货中(action2 != 3),";
}
if (move2 == 0) {
feedMessage += "后工位光电信号为空(move2 == 0),";
}
if (task2 == 0) {
feedMessage += "后工位没有任务(task2 == 0)";
}
}
}
//单任务 后工位放货完成 任务完成
if (mode == 3 && action2 == 4 && move2 == 0 && task2 > 0 && type == 2) {
//inst_message
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
finish_instruction(inst2);
TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
if (!ObjectUtil.isEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
}
;
this.writing("to_command2", "5");
this.setNow_steps_type2(6);
this.setNow_steps_type2(0);
}
}
} else {
if (this.getNow_steps_type2() == 5) {
feedMessage = "单任务后工位放货完成后未反馈原因-->";
if (mode != 3) {
feedMessage += "行架工作模式不为运行中(mode != 3),";
}
if (action2 != 4) {
feedMessage += "后工位未放货完成(action2 != 4),";
}
if (move2 != 0) {
feedMessage += "后工位光电信号为有货(move2 != 0),";
}
if (task2 == 0) {
feedMessage += "后工位没有任务(task2 == 0),";
}
if (type != 2) {
feedMessage += "不是后工位单任务(type != 2)";
}
}
}
//双任务 后工位反馈任务完成 并反馈
if (mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3) {
this.writing("to_command2", "5");
this.setNow_steps_type3(8);
} else {
if (this.getNow_steps_type3() == 7) {
feedMessage = "双任务后工位放货完成后未反馈原因-->";
if (mode != 3) {
feedMessage += "行架工作模式不为运行中(mode != 3),";
}
if (action2 != 4) {
feedMessage += "后工位未放货完成(action2 != 4),";
}
if (move2 != 0) {
feedMessage += "后工位光电信号为有货(move2 != 0),";
}
if (task1 == 0) {
feedMessage += "前工位没有任务(task1 == 0),";
}
if (task2 == 0) {
feedMessage += "后工位没有任务(task2 == 0),";
}
if (type != 3) {
feedMessage += "不是双任务(type != 3)";
}
}
}
//单任务/双任务 前工位放货时判断放货位光电信号
if (mode == 3 && action1 == 3 && move1 == 1 && task1 > 0) {
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
String next_device_code = "";
if (type == 1) {
next_device_code = inst1.getNext_device_code();
} else if (type == 3) {
next_device_code = inst1.getNext_device_code2();
}
Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code);
if (ObjectUtil.isEmpty(nextDevice)) {
feedMessage = "前工位放货位:" + next_device_code + "为空!";
throw new BadRequestException("前工位放货位:" + next_device_code + "为空!");
}
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver();
int move = siemensConveyorDeviceDriver.getMove();
int mode = siemensConveyorDeviceDriver.getMode();
if (move == 1 && mode == 2) {
this.writing("to_command1", "4");
if (type == 1) {
this.setNow_steps_type1(5);
} else if (type == 3) {
this.setNow_steps_type3(9);
}
} else {
log.warn("后工位放货位有货,放货位:{},mode:{},move:{}", next_device_code, mode, move);
if (this.getNow_steps_type1() == 4 || this.getNow_steps_type3() == 8) {
feedMessage = "前工位未放货原因-->";
if (mode != 2) {
feedMessage += "前工位放货位工作模式不为待机(mode != 2),";
} else if (move == 0) {
feedMessage += "前工位放货位无货(move == 0)";
}
}
}
}
} else {
if (this.getNow_steps_type1() == 4 || this.getNow_steps_type3() == 8) {
feedMessage = "前工位未放货原因-->";
if (mode != 3) {
feedMessage += "行架工作模式不为运行中(mode != 3),";
}
if (action1 != 3) {
feedMessage += "前工位动作信号不为放货中(action1 != 3),";
}
if (move1 == 0) {
feedMessage += "前工位光电信号为空(move1 == 0),";
}
if (task1 == 0) {
feedMessage += "前工位没有任务(task1 == 0),";
}
}
}
//单任务前工位放货完成 任务完成
if (mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && type == 1) {
//inst_message
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
this.finish_instruction(inst1);
TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
if (!ObjectUtil.isEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
}
;
this.writing("to_command1", "5");
this.setNow_steps_type1(6);
this.setNow_steps_type1(0);
}
}
} else {
if (this.getNow_steps_type1() == 5) {
feedMessage = "单任务前工位放货完成后未反馈原因-->";
if (mode != 3) {
feedMessage += "行架工作模式不为运行中(mode != 3),";
}
if (action1 != 4) {
feedMessage += "前工位未放货完成(action1 != 4),";
}
if (move1 != 0) {
feedMessage += "前工位光电信号为有货(move1 != 0),";
}
if (task1 == 0) {
feedMessage += "前工位没有任务(task1 == 0),";
}
if (type != 1) {
feedMessage += "不为前工位单任务(type != 1)";
}
}
}
//双工位 任务完成 前工位反馈4
if (mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && task2 > 0 && type == 3) {
//inst_message
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
this.finish_instruction(inst1);
TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
if (!ObjectUtil.isEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
}
;
this.writing("to_command1", "5");
this.setNow_steps_type3(10);
this.setNow_steps_type3(0);
}
}
} else {
if (this.getNow_steps_type3() == 9) {
feedMessage = "双任务前工位放货完成后未反馈原因-->";
if (mode != 3) {
feedMessage += "行架工作模式不为运行中(mode != 3),";
}
if (action1 != 4) {
feedMessage += "前工位未放货完成(action1 != 4),";
}
if (move1 != 0) {
feedMessage += "前工位光电信号为有货(move1 != 0),";
}
if (task1 == 0) {
feedMessage += "前工位没有任务(task1 == 0),";
}
if (task2 == 0) {
feedMessage += "后工位没有任务(task2 == 0),";
}
if (type != 3) {
feedMessage += "不是双任务(type != 3)";
}
}
if (task1 > 0 && task2 > 0 && !requireSucess) {
update_instruction_status1();
}
@@ -706,7 +247,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
return;
case 2:
//申请任务
if (mode == 2 && move1 == 0 && move2 == 0 && action1 == 0 && action2 == 0 && task1 == 0 && task2 == 0 && !requireSucess) {
if (move1 == 0 && move2 == 0 && action1 == 0 && action2 == 0 && task1 == 0 && task2 == 0 && !requireSucess) {
//获取关联设备驱动信息 判断关联设备是否禁用
String link_device_code = String.valueOf(this.getDevice().getExtraValue().get("link_device_code"));
Device device = deviceAppservice.findDeviceByCode(link_device_code);
@@ -728,11 +269,13 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
}
//没有生成异常取放货工位的任务 就生成正常关联取放货工位的任务
instruction_require();
feedMessage = "";
notCreateInstMessage = "";
notCreateTaskMessage = "";
logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",action1:" + action1 + ",requireSucess:" + requireSucess);
boolean res = applyTask();
if (res) {
feedMessage = "";
notCreateInstMessage = "";
notCreateTaskMessage = "";
logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",action1:" + action1 + ",requireSucess:" + requireSucess);
}
} else {
// if (!requireSucess) {
// remark = remark + "请求标记为true,请检查mode是否由其他值变为2";
@@ -784,6 +327,36 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
last_task2 = task2;
}
/**
* 更新分切机下双卷指令状态
*/
public synchronized void update_instruction_status1() throws Exception {
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 (task1 > 0 && type == 1) {
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
//当前执行步骤为更新任务状态
inst1.setInstruction_status("1");
inst1.setExecute_device_code(this.getDevice_code());
instructionService.update(inst1);
}
}
}
// if (mode = 3 && move1 = 0 && move2 = 0 && action1 = 5 && action2 = 5) {
//
// }
}
}
//关联设备异常申请任务
public synchronized boolean instruction_require2() {
Boolean flag = false;
@@ -858,7 +431,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
//正常申请任务
public synchronized boolean instruction_require() {
public synchronized boolean applyTask() {
boolean flag = false;
Date date = new Date();
if (date.getTime() - this.instruction_head_time.getTime() < (long) this.instruction_require_time_out) {
@@ -880,6 +453,18 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
//分切机出双卷任务
if (StrUtil.equals(taskDto.getTruss_type(), "1")) {
inst_require1(taskDto, getDeviceCodeList, backGetDeviceCodeList);
}
//分切机出上卷-行架取单轴
else if (StrUtil.equals(taskDto.getTruss_type(), "2")) {
// inst_require2(taskDto, getDeviceCodeList, backGetDeviceCodeList);
}
//分切机出下卷-行架取单轴
else if (StrUtil.equals(taskDto.getTruss_type(), "3")) {
// inst_require3(taskDto, getDeviceCodeList, backGetDeviceCodeList);
}
flag = this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return flag;
} else {
@@ -932,6 +517,75 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
return flag;
}
//执行重新生成分切机出双卷的任务
public synchronized boolean inst_require1(TaskDto taskDto, List<String> getDeviceCodeList, List<String> backGetDeviceCodeList) {
boolean flag = false;
//获取指令信息
Instruction instructionDto = instructionService.findByTaskcodeAndStatus(taskDto.getTask_code());
//获取指令表中的取货点1
String start_device_code = instructionDto.getStart_device_code();
//获取指令表中的取货点2
String start_device_code2 = instructionDto.getStart_device_code2();
//获取指令表中的放货点1
String next_device_code = instructionDto.getNext_device_code();
//获取指令表中的放货点2
String next_device_code2 = instructionDto.getNext_device_code2();
//判断任务点位是否配置电气信号
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
Device startDevice2 = deviceAppservice.findDeviceByCode(start_device_code2);
Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code);
Device nextDevice2 = deviceAppservice.findDeviceByCode(next_device_code2);
this.isSetAddress(startDevice);
this.isSetAddress(nextDevice);
this.isSetAddress(startDevice2);
this.isSetAddress(nextDevice2);
//修改指令状态
instructionDto.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
instructionDto.setUpdate_time(DateUtil.now());
instructionService.update(instructionDto);
flag = true;
//下发电气信号
this.sendSignal(instructionDto, taskDto);
//请求任务成功
requireSucess = true;
return flag;
}
//下发电气信号
public synchronized void sendSignal(Instruction dto, TaskDto taskDto) {
logServer.deviceExecuteLog(this.getDeviceCode(), "", "", "开始下发电气信号,即下发电气指令信息为:"
+ dto.toString());
String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code();
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code);
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
String start_device_code2 = dto.getStart_device_code2();
String next_device_code2 = dto.getNext_device_code2();
Device startDevice2 = deviceAppservice.findDeviceByCode(start_device_code2);
Device nextDevice2 = deviceAppservice.findDeviceByCode(next_device_code2);
String start_addr2 = startDevice2.getExtraValue().get("address").toString();
String next_addr2 = nextDevice2.getExtraValue().get("address").toString();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_onset1", start_addr2);
map.put("to_target1", next_addr2);
map.put("to_task1", dto.getInstruction_code());
map.put("to_onset2", start_addr);
map.put("to_target2", next_addr);
map.put("to_task2", dto.getInstruction_code());
map.put("to_type", taskDto.getTruss_type());
map.put("to_command1", CommonFinalParam.ONE);
map.put("to_command2", CommonFinalParam.ONE);
this.writing(map);
logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发分切机出双卷任务");
this.setNow_steps_type3(2);
}
//执行重新生成指令的任务
public synchronized boolean executeBusiness(TaskDto taskDto, List<String> getDeviceCodeList, List<String> backGetDeviceCodeList) {
boolean flag = false;
@@ -1563,4 +1217,32 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
this.requireSucess = true;
}
}
/**
* 抽取统一下发电气信号前缀
*
* @return
*/
public String getToParam() {
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
/**
* 多个信号一起下发电气
*
* @param map
*/
public void writing(Map<String, Object> map) {
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
if (ObjectUtil.isNotEmpty(value)) {
itemMap.put(getToParam() + key, value);
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.control(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
}
}
}

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.subvolume_weighing_station;
package org.nl.acs.device_driver.two_conveyor.subvolume_weighing_station;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.subvolume_weighing_station;
package org.nl.acs.device_driver.two_conveyor.subvolume_weighing_station;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.subvolume_weighing_station;
package org.nl.acs.device_driver.two_conveyor.subvolume_weighing_station;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.waste_foil_weighing_station;
package org.nl.acs.device_driver.two_conveyor.waste_foil_weighing_station;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.waste_foil_weighing_station;
package org.nl.acs.device_driver.two_conveyor.waste_foil_weighing_station;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.waste_foil_weighing_station;
package org.nl.acs.device_driver.two_conveyor.waste_foil_weighing_station;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;