add:新增内包间行架驱动
This commit is contained in:
@@ -55,7 +55,10 @@ public enum DriverTypeEnum {
|
|||||||
|
|
||||||
PAPER_TUBE_DEVICE(22, "paper_tube_conveyor", "纸管库设备", "conveyor"),
|
PAPER_TUBE_DEVICE(22, "paper_tube_conveyor", "纸管库设备", "conveyor"),
|
||||||
|
|
||||||
DEVICE_STATUS(23,"device_status","立库设备状态","conveyor");
|
DEVICE_STATUS(23,"device_status","立库设备状态","conveyor"),
|
||||||
|
|
||||||
|
INDOOR_MANIPULATOR(24,"indoor_manipulator","内包间-行架机械手","station");
|
||||||
|
|
||||||
|
|
||||||
//驱动索引
|
//驱动索引
|
||||||
private int index;
|
private int index;
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,61 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.indoor_manipulator;
|
||||||
|
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||||
|
import org.nl.acs.opc.Device;
|
||||||
|
import org.nl.acs.opc.DeviceType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内包间-行架机械手
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class IndoorManipulatorDefination implements OpcDeviceDriverDefination {
|
||||||
|
@Override
|
||||||
|
public String getDriverCode() {
|
||||||
|
return "indoor_manipulator";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverName() {
|
||||||
|
return "内包间-行架机械手";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverDescription() {
|
||||||
|
return "内包间-行架机械手";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceDriver getDriverInstance(Device device) {
|
||||||
|
return (new IndoorManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||||
|
return IndoorManipulatorDeviceDriver.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceType> getFitDeviceTypes() {
|
||||||
|
List<DeviceType> types = new LinkedList();
|
||||||
|
types.add(DeviceType.station);
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getReadableItemDtos() {
|
||||||
|
return ItemProtocol.getReadableItemDtos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getWriteableItemDtos() {
|
||||||
|
return ItemProtocol.getWriteableItemDtos();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,842 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.indoor_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.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
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.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.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.lamp_three_color.LampThreecolorDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||||
|
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.ApplyManipulatorActionRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse;
|
||||||
|
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.dto.DeviceErrorLogDto;
|
||||||
|
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
|
import org.nl.acs.opc.Device;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.system.service.ParamService;
|
||||||
|
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内包间-行架机械手
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
|
||||||
|
protected org.nl.acs.device_driver.basedriver.indoor_manipulator.ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
@Autowired
|
||||||
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.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 inflatable_shaft_size = 0;
|
||||||
|
int last_inflatable_shaft_size = 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;
|
||||||
|
|
||||||
|
int to_putpoint = 0;
|
||||||
|
int last_to_putpoint = 0;
|
||||||
|
|
||||||
|
int to_new_getpoint = 0;
|
||||||
|
int last_to_new_getpoint = 0;
|
||||||
|
|
||||||
|
int to_two_putpoint = 0;
|
||||||
|
int last_to_two_putpoint = 0;
|
||||||
|
|
||||||
|
int to_task_type = 0;
|
||||||
|
int last_to_task_type = 0;
|
||||||
|
|
||||||
|
//气胀轴代数
|
||||||
|
int inflatableShaftVersion = 0;
|
||||||
|
int last_inflatableShaftVersion = 0;
|
||||||
|
|
||||||
|
//套管数量
|
||||||
|
int tube_num = 0;
|
||||||
|
int last_tube_num = 0;
|
||||||
|
|
||||||
|
//是否套轴
|
||||||
|
int is_wrapped = 0;
|
||||||
|
int last_is_wrapped = 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;
|
||||||
|
private Date instruction_apply_time = new Date();
|
||||||
|
//行架机械手申请任务成功标识
|
||||||
|
boolean requireSucess = false;
|
||||||
|
//反馈成功表示
|
||||||
|
boolean feedbackSucess = 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.itemProtocol.getMode();
|
||||||
|
move = this.itemProtocol.getMove();
|
||||||
|
if(mode==2){
|
||||||
|
log.info("123");
|
||||||
|
}
|
||||||
|
action = this.itemProtocol.getAction();
|
||||||
|
walk_y = this.itemProtocol.getWalk_y();
|
||||||
|
error = this.itemProtocol.getError();
|
||||||
|
task = this.itemProtocol.getTask();
|
||||||
|
heartbeat = this.itemProtocol.getHeartbeat();
|
||||||
|
to_command = this.itemProtocol.getTo_command();
|
||||||
|
to_target = this.itemProtocol.getTo_target();
|
||||||
|
to_task = this.itemProtocol.getTo_task();
|
||||||
|
to_onset = this.itemProtocol.getTo_onset();
|
||||||
|
x_position = this.itemProtocol.getX_position();
|
||||||
|
y_position = this.itemProtocol.getY_position();
|
||||||
|
inflatable_shaft_size = this.itemProtocol.getInflatable_shaft_size();
|
||||||
|
to_putpoint = this.itemProtocol.getTo_putpoint();
|
||||||
|
to_new_getpoint = this.itemProtocol.getTo_new_getpoint();
|
||||||
|
to_two_putpoint = this.itemProtocol.getTo_two_putpoint();
|
||||||
|
to_task_type = this.itemProtocol.getTo_task_type();
|
||||||
|
tube_num = this.itemProtocol.getTube_num();
|
||||||
|
inflatableShaftVersion = this.itemProtocol.getInflatableShaftVersion();
|
||||||
|
is_wrapped = this.itemProtocol.getIs_wrapped();
|
||||||
|
|
||||||
|
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) {
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("device_code", this.device_code);
|
||||||
|
param.put("mode", Math.min(mode, 3));
|
||||||
|
param.put("device_name", this.getDevice().getDevice_name());
|
||||||
|
param.put("device_type", "2");
|
||||||
|
param.put("product_area", paramService.findByCode("productArea").getValue());
|
||||||
|
acsToWmsService.sendDeviceStatus(param);
|
||||||
|
|
||||||
|
if (mode == 2) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号复位前requireSuccess:" + requireSucess);
|
||||||
|
this.setRequireSucess(false);
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号复位后requireSuccess:" + requireSucess);
|
||||||
|
// if (move == 0 && task == 0 && action == 0 && this.getNow_steps_type() != 0){
|
||||||
|
// logServer.deviceExecuteLog(this.device_code, "", "", "当前执行步骤复位前:" + this.getNow_steps_type());
|
||||||
|
// this.setNow_steps_type(0);
|
||||||
|
// logServer.deviceExecuteLog(this.device_code, "", "", "当前执行步骤复位后:" + this.getNow_steps_type());
|
||||||
|
// }
|
||||||
|
feedMessage = "";
|
||||||
|
notCreateInstMessage = "";
|
||||||
|
notCreateTaskMessage = "";
|
||||||
|
inst = null;
|
||||||
|
message = null;
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
this.setFeedbackSucess(false);
|
||||||
|
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + "->" + action);
|
||||||
|
}
|
||||||
|
if (error != last_error) {
|
||||||
|
if (error != 0) {
|
||||||
|
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||||
|
dto.setDevice_code(device_code);
|
||||||
|
dto.setError_code(String.valueOf(error));
|
||||||
|
String errorInfo = ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(error));
|
||||||
|
dto.setError_info(errorInfo);
|
||||||
|
deviceErrorLogService.create(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("device_code", this.device_code);
|
||||||
|
param.put("error", error);
|
||||||
|
param.put("error_msg", error == 0 ? "" : ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(error)));
|
||||||
|
param.put("device_name", this.getDevice().getDevice_name());
|
||||||
|
param.put("device_type", "2");
|
||||||
|
param.put("product_area", paramService.findByCode("productArea").getValue());
|
||||||
|
acsToWmsService.sendDeviceStatus(param);
|
||||||
|
|
||||||
|
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 (inflatable_shaft_size != last_inflatable_shaft_size) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "inflatable_shaft_size", String.valueOf(inflatable_shaft_size));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号inflatable_shaft_size:" + last_inflatable_shaft_size + "->" + inflatable_shaft_size);
|
||||||
|
}
|
||||||
|
if (task > 0) {
|
||||||
|
update_instruction_status();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception var17) {
|
||||||
|
var17.printStackTrace();
|
||||||
|
feedMessage = var17.getMessage();
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
|
||||||
|
|
||||||
|
}
|
||||||
|
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 && !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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode == 3 && !feedbackSucess && action > 0) {
|
||||||
|
apply_feedback();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
last_inflatable_shaft_size = inflatable_shaft_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抽取统一下发电气信号前缀
|
||||||
|
*
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized boolean apply_feedback() {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||||
|
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||||
|
if (action == 2) {
|
||||||
|
this.instruction_apply_time = date;
|
||||||
|
message = "完成反馈LMS...";
|
||||||
|
JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0);
|
||||||
|
String start_point_code = null;
|
||||||
|
if (!ObjectUtil.isEmpty(device_json)) {
|
||||||
|
start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code");
|
||||||
|
}
|
||||||
|
applyManipulatorActionRequest.setDevice_code(start_point_code);
|
||||||
|
applyManipulatorActionRequest.setType("2");
|
||||||
|
applyManipulatorActionRequest.setTask_code(String.valueOf(task));
|
||||||
|
applyManipulatorActionRequest.setSize(String.valueOf(inflatable_shaft_size));
|
||||||
|
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "反馈请求参数:" + JSON.toJSONString(applyManipulatorActionRequest));
|
||||||
|
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||||
|
requireSucess = true;
|
||||||
|
message = "反馈LMS成功...";
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||||
|
String version = applyManipulatorActionResponse.getVersion();
|
||||||
|
String bushing_num = applyManipulatorActionResponse.getBushing_num();
|
||||||
|
String is_bushing = applyManipulatorActionResponse.getIs_bushing();
|
||||||
|
String detail_type = applyManipulatorActionResponse.getDetail_type();
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("to_command", "2");
|
||||||
|
map.put("to_task_type", detail_type);
|
||||||
|
map.put("inflatableShaftVersion", version);
|
||||||
|
map.put("tube_num", bushing_num);
|
||||||
|
map.put("is_wrapped", is_bushing);
|
||||||
|
this.writing(map);
|
||||||
|
this.setFeedbackSucess(true);
|
||||||
|
} else {
|
||||||
|
requireSucess = true;
|
||||||
|
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (action == 3) {
|
||||||
|
applyManipulatorActionRequest.setType("3");
|
||||||
|
applyManipulatorActionRequest.setTask_code(String.valueOf(task));
|
||||||
|
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||||
|
String put_device_code = applyManipulatorActionResponse.getPut_device_code();
|
||||||
|
String detail_type = applyManipulatorActionResponse.getDetail_type();
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("to_command", "3");
|
||||||
|
map.put("to_task_type", detail_type);
|
||||||
|
map.put("to_putpoint", put_device_code);
|
||||||
|
this.writing(map);
|
||||||
|
this.setFeedbackSucess(true);
|
||||||
|
}
|
||||||
|
if (action == 4) {
|
||||||
|
applyManipulatorActionRequest.setType("4");
|
||||||
|
applyManipulatorActionRequest.setTask_code(String.valueOf(task));
|
||||||
|
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||||
|
String get_device_code = applyManipulatorActionResponse.getGet_device_code();
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("to_command", "4");
|
||||||
|
map.put("to_new_getpoint", get_device_code);
|
||||||
|
this.writing(map);
|
||||||
|
this.setFeedbackSucess(true);
|
||||||
|
}
|
||||||
|
if (action == 5) {
|
||||||
|
applyManipulatorActionRequest.setType("5");
|
||||||
|
applyManipulatorActionRequest.setTask_code(String.valueOf(task));
|
||||||
|
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||||
|
String put_device_code2 = applyManipulatorActionResponse.getPut_device_code2();
|
||||||
|
String detail_type = applyManipulatorActionResponse.getDetail_type();
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("to_command", "5");
|
||||||
|
map.put("to_task_type", detail_type);
|
||||||
|
map.put("to_two_putpoint", put_device_code2);
|
||||||
|
this.writing(map);
|
||||||
|
this.setFeedbackSucess(true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
|
||||||
|
instructionService.finish(inst);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void update_instruction_status() {
|
||||||
|
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 && action == 2) {
|
||||||
|
//inst_message
|
||||||
|
Instruction inst1 = checkInst();
|
||||||
|
if (inst1 != null) {
|
||||||
|
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||||
|
inst1.setInstruction_status("1");
|
||||||
|
inst1.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task > 0 && action == 3) {
|
||||||
|
//inst_message
|
||||||
|
Instruction inst1 = checkInst();
|
||||||
|
if (inst1 != null) {
|
||||||
|
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||||
|
inst1.setInstruction_status("1");
|
||||||
|
inst1.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task > 0 && action == 4) {
|
||||||
|
//inst_message
|
||||||
|
Instruction inst1 = checkInst();
|
||||||
|
if (inst1 != null) {
|
||||||
|
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||||
|
inst1.setInstruction_status("1");
|
||||||
|
inst1.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task > 0 && action == 5) {
|
||||||
|
//inst_message
|
||||||
|
Instruction inst1 = checkInst();
|
||||||
|
if (inst1 != null) {
|
||||||
|
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||||
|
inst1.setInstruction_status("1");
|
||||||
|
inst1.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//放货完成
|
||||||
|
if (mode == 3 && action == 6 && move == 0 && task > 0) {
|
||||||
|
Instruction inst2 = checkInst();
|
||||||
|
if (inst2 != null) {
|
||||||
|
try {
|
||||||
|
finish_instruction(inst2);
|
||||||
|
this.writing("to_command", "6");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
feedMessage = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
feedMessage = "行架机械手:";
|
||||||
|
if (mode != 3) {
|
||||||
|
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||||
|
}
|
||||||
|
if (action != 6) {
|
||||||
|
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
|
||||||
|
}
|
||||||
|
if (move != 0) {
|
||||||
|
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||||
|
}
|
||||||
|
if (task == 0) {
|
||||||
|
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean exe_error() {
|
||||||
|
if (this.error == 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
log.debug("设备报警");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//将扩展表中的字符串数据转换成集合
|
||||||
|
public List<String> getExtraDeviceCodes(String extraName) {
|
||||||
|
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
|
||||||
|
if (StrUtil.isEmpty(extraValue)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
String devicesString = extraValue.substring(1, extraValue.length() - 1);
|
||||||
|
List<String> devicesList = new ArrayList<>();
|
||||||
|
String[] devices = devicesString.split(",");
|
||||||
|
for (int i = 0; i < devices.length; i++) {
|
||||||
|
String s = devices[i].replace("\"", "").replace("\"", "");
|
||||||
|
devicesList.add(s);
|
||||||
|
}
|
||||||
|
return devicesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TaskDto> sortTask(List<TaskDto> taskDtos) {
|
||||||
|
Collections.sort(taskDtos, new Comparator<TaskDto>() {
|
||||||
|
@Override
|
||||||
|
public int compare(TaskDto t1, TaskDto t2) {
|
||||||
|
//优先级从大到小
|
||||||
|
int i = t2.getPriority().compareTo(t1.getPriority());
|
||||||
|
//如果优先级相等
|
||||||
|
if (i == 0) {
|
||||||
|
//时间从早到晚
|
||||||
|
i = t1.getCreate_time().compareTo(t2.getCreate_time());
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return taskDtos;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
//String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
|
//Server server = ReadUtil.getServer(opcservcerid);
|
||||||
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
itemMap.put(to_param, Integer.parseInt(value));
|
||||||
|
// itemMap.put(to_param, Integer.parseInt(value));
|
||||||
|
this.control(itemMap);
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请任务
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
public synchronized boolean applyTask() {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
this.instruction_require_time = date;
|
||||||
|
//抓取工位
|
||||||
|
if (ObjectUtil.isEmpty(getDeviceCodeList)) {
|
||||||
|
getDeviceCodeList = this.getExtraDeviceCodes("get_device_code");
|
||||||
|
}
|
||||||
|
//放货工位
|
||||||
|
if (ObjectUtil.isEmpty(putDeviceCodeList)) {
|
||||||
|
putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
|
||||||
|
}
|
||||||
|
TaskDto task = null;
|
||||||
|
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
||||||
|
String startDeviceCode = getDeviceCodeList.get(i);
|
||||||
|
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
|
||||||
|
if (ObjectUtil.isNotEmpty(taskDtos)) {
|
||||||
|
//按照优先级排序 优先级相等按照创建时间排序
|
||||||
|
taskDtos = this.sortTask(taskDtos);
|
||||||
|
TaskDto taskDto = taskDtos.get(0);
|
||||||
|
|
||||||
|
//存在行架->暂存的AGV任务 需要过滤
|
||||||
|
// 9 行架任务
|
||||||
|
if (!StrUtil.equals(taskDto.getTask_type(), "9")) {
|
||||||
|
taskDto = null;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDto.getTask_code());
|
||||||
|
String start_device_code = instruction.getStart_device_code();
|
||||||
|
String next_device_code = instruction.getNext_device_code();
|
||||||
|
Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||||
|
Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||||
|
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||||
|
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||||
|
instruction.setInstruction_status("1");
|
||||||
|
instruction.setUpdate_time(DateUtil.now());
|
||||||
|
instructionService.update(instruction);
|
||||||
|
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||||
|
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||||
|
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
||||||
|
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
|
||||||
|
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||||
|
}
|
||||||
|
String start_addr = startDevice.getExtraValue().get("address").toString();
|
||||||
|
String next_addr = nextDevice.getExtraValue().get("address").toString();
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
|
||||||
|
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
|
||||||
|
+ ",指令终点:" + instruction.getNext_device_code());
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("to_command", "1");
|
||||||
|
map.put("to_onset", start_addr);
|
||||||
|
map.put("to_task", instruction.getInstruction_code());
|
||||||
|
map.put("to_target", next_addr);
|
||||||
|
this.writing(map);
|
||||||
|
this.setRequireSucess(true);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||||
|
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||||
|
for (int j = 0; j < taskDtoList.size(); j++) {
|
||||||
|
//按照优先级排序 优先级相等按照创建时间排序
|
||||||
|
taskDtoList = this.sortTask(taskDtoList);
|
||||||
|
task = taskDtoList.get(j);
|
||||||
|
// 9 行架任务
|
||||||
|
if (!StrUtil.equals(task.getTask_type(), "9")) {
|
||||||
|
task = null;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(task)) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ObjectUtil.isEmpty(task)) {
|
||||||
|
Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code());
|
||||||
|
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
|
||||||
|
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||||
|
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||||
|
if (startdevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||||
|
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||||
|
if (siemensConveyorDeviceDriver.getMove() != 1) {
|
||||||
|
notCreateInstMessage = "就绪任务未创建指令原因->取货位-分切输送线出口:" + siemensConveyorDeviceDriver.getDevice_code() + "光电无货,无法生成指令!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String taskid = task.getTask_id();
|
||||||
|
String taskcode = task.getTask_code();
|
||||||
|
String vehiclecode = task.getVehicle_code();
|
||||||
|
String priority = task.getPriority();
|
||||||
|
String start_point_code = task.getStart_point_code();
|
||||||
|
String start_device_code = task.getStart_device_code();
|
||||||
|
String route_plan_code = task.getRoute_plan_code();
|
||||||
|
String next_point_code = task.getNext_point_code();
|
||||||
|
String next_device_code = task.getNext_device_code();
|
||||||
|
|
||||||
|
Instruction instdto = new Instruction();
|
||||||
|
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||||
|
instdto.setRoute_plan_code(route_plan_code);
|
||||||
|
instdto.setRemark(task.getRemark());
|
||||||
|
instdto.setMaterial(task.getMaterial());
|
||||||
|
instdto.setQuantity(task.getQuantity());
|
||||||
|
instdto.setTask_id(taskid);
|
||||||
|
instdto.setTask_code(taskcode);
|
||||||
|
instdto.setVehicle_code(vehiclecode);
|
||||||
|
String now = DateUtil.now();
|
||||||
|
instdto.setCreate_time(now);
|
||||||
|
instdto.setCreate_by("auto");
|
||||||
|
instdto.setStart_device_code(start_device_code);
|
||||||
|
instdto.setNext_device_code(next_device_code);
|
||||||
|
instdto.setStart_point_code(start_point_code);
|
||||||
|
instdto.setNext_point_code(next_point_code);
|
||||||
|
instdto.setPriority(priority);
|
||||||
|
instdto.setInstruction_status("0");
|
||||||
|
instdto.setExecute_device_code(start_point_code);
|
||||||
|
|
||||||
|
try {
|
||||||
|
instructionService.create(instdto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
notCreateInstMessage = e.getMessage();
|
||||||
|
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//创建指令后修改任务状态
|
||||||
|
task.setTask_status("1");
|
||||||
|
task.setUpdate_time(DateUtil.now());
|
||||||
|
taskserver.update(task);
|
||||||
|
|
||||||
|
Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
|
||||||
|
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
|
||||||
|
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
||||||
|
notCreateInstMessage = "设备:" + startDevice.getDevice_code() + "未设置电气调度号!";
|
||||||
|
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||||
|
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
|
||||||
|
notCreateInstMessage = "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!";
|
||||||
|
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||||
|
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||||
|
}
|
||||||
|
String start_addr = startDevice.getExtraValue().get("address").toString();
|
||||||
|
String next_addr = nextDevice.getExtraValue().get("address").toString();
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
|
||||||
|
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
|
||||||
|
+ ",指令终点:" + instdto.getNext_device_code());
|
||||||
|
this.writing("to_command", "1");
|
||||||
|
this.writing("to_onset", start_addr);
|
||||||
|
this.writing("to_target", next_addr);
|
||||||
|
this.writing("to_task", instdto.getInstruction_code());
|
||||||
|
this.writing("to_task_type", "1");
|
||||||
|
this.setRequireSucess(true);
|
||||||
|
notCreateInstMessage = "";
|
||||||
|
notCreateTaskMessage = "";
|
||||||
|
} else {
|
||||||
|
notCreateInstMessage = "未找到关联设备的任务,指令无法创建";
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,224 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.indoor_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_inflatable_shaft_size = "inflatable_shaft_size";
|
||||||
|
|
||||||
|
//下发命令
|
||||||
|
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";
|
||||||
|
//反馈放货点
|
||||||
|
public static String item_to_putpoint = "to_putpoint";
|
||||||
|
//反馈新取货点
|
||||||
|
public static String item_to_new_getpoint = "to_new_getpoint";
|
||||||
|
//反馈二次放货点
|
||||||
|
public static String item_to_two_putpoint = "to_two_putpoint";
|
||||||
|
//下发任务类型
|
||||||
|
public static String item_to_task_type = "to_task_type";
|
||||||
|
//气胀轴代数
|
||||||
|
public static String item_inflatableShaftVersion = "inflatableShaftVersion";
|
||||||
|
//套管数量
|
||||||
|
public static String item_tube_num = "tube_num";
|
||||||
|
//是否套轴
|
||||||
|
public static String item_is_wrapped = "is_wrapped";
|
||||||
|
|
||||||
|
|
||||||
|
private IndoorManipulatorDeviceDriver driver;
|
||||||
|
|
||||||
|
public ItemProtocol(IndoorManipulatorDeviceDriver 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 getInflatable_shaft_size() {
|
||||||
|
return this.getOpcIntegerValue(item_inflatable_shaft_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_putpoint() {
|
||||||
|
return this.getOpcIntegerValue(item_to_putpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_new_getpoint() {
|
||||||
|
return (int) this.getOpcIntegerValue(item_to_new_getpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_two_putpoint() {
|
||||||
|
return this.getOpcIntegerValue(item_to_two_putpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_task_type() {
|
||||||
|
return this.getOpcIntegerValue(item_to_task_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTube_num() {
|
||||||
|
return this.getOpcIntegerValue(item_tube_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInflatableShaftVersion() {
|
||||||
|
return this.getOpcIntegerValue(item_inflatableShaftVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIs_wrapped() {
|
||||||
|
return this.getOpcIntegerValue(item_is_wrapped);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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"));
|
||||||
|
list.add(new ItemDto(item_inflatable_shaft_size, "气胀轴尺寸", "DB1.C1"));
|
||||||
|
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.D1"));
|
||||||
|
list.add(new ItemDto(item_to_putpoint, "反馈放货点", "DB2.D2"));
|
||||||
|
list.add(new ItemDto(item_to_new_getpoint, "反馈新取货点", "DB2.D3"));
|
||||||
|
list.add(new ItemDto(item_to_two_putpoint, "反馈二次放货点", "DB2.D4"));
|
||||||
|
list.add(new ItemDto(item_to_task_type, "下发任务类型", "DB2.D5"));
|
||||||
|
list.add(new ItemDto(item_inflatableShaftVersion, "气胀轴代数", "DB2.D6"));
|
||||||
|
list.add(new ItemDto(item_tube_num, "套管数量", "DB2.D7"));
|
||||||
|
list.add(new ItemDto(item_is_wrapped, "是否套轴", "DB2.D8"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.nl.acs.ext.wms.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplyManipulatorActionRequest extends BaseRequest {
|
||||||
|
private String vehicle_code;
|
||||||
|
private String device_code;
|
||||||
|
/**
|
||||||
|
* 2-尺寸交互反馈,反馈任务类型
|
||||||
|
* 3-反馈新放货点
|
||||||
|
* 4-反馈新取货点
|
||||||
|
* 5-反馈二次放货点
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务号
|
||||||
|
*/
|
||||||
|
private String task_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 气胀轴尺寸 3/6寸
|
||||||
|
*/
|
||||||
|
private String size;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package org.nl.acs.ext.wms.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplyManipulatorActionResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private Map<String, String> data = new HashMap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 放货点
|
||||||
|
*/
|
||||||
|
private String put_device_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取货点
|
||||||
|
*/
|
||||||
|
private String get_device_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二次放货点
|
||||||
|
*/
|
||||||
|
private String put_device_code2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下发的指令类型
|
||||||
|
*/
|
||||||
|
private String detail_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 气胀轴代数
|
||||||
|
*/
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套管数量
|
||||||
|
*/
|
||||||
|
private String bushing_num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否套管
|
||||||
|
*/
|
||||||
|
private String is_bushing;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest;
|
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.ApplyManipulatorActionRequest;
|
||||||
import org.nl.acs.ext.wms.data.LiKuApplyTaskRequest;
|
import org.nl.acs.ext.wms.data.LiKuApplyTaskRequest;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.modules.logging.InterfaceLogType;
|
import org.nl.modules.logging.InterfaceLogType;
|
||||||
@@ -99,6 +100,13 @@ public class AcsToWmsController {
|
|||||||
return new ResponseEntity<>(acstowmsService.applyLabelingAndBindingRequest(param), HttpStatus.OK);
|
return new ResponseEntity<>(acstowmsService.applyLabelingAndBindingRequest(param), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/applyManipulatorActionRequest")
|
||||||
|
@Log(value = "申请行架任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS)
|
||||||
|
@ApiOperation("申请行架任务")
|
||||||
|
public ResponseEntity<Object> applyManipulatorActionRequest(@RequestBody ApplyManipulatorActionRequest param) {
|
||||||
|
return new ResponseEntity<>(acstowmsService.applyManipulatorActionRequest(param), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/liKuApplyTaskRequest")
|
@PostMapping("/liKuApplyTaskRequest")
|
||||||
@Log(value = "立库申请任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS)
|
@Log(value = "立库申请任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS)
|
||||||
@ApiOperation("立库申请任务")
|
@ApiOperation("立库申请任务")
|
||||||
|
|||||||
@@ -106,4 +106,6 @@ public interface AcsToWmsService {
|
|||||||
HttpResponse shipDeviceUpdate(JSONObject param);
|
HttpResponse shipDeviceUpdate(JSONObject param);
|
||||||
|
|
||||||
void sendDeviceStatus(JSONObject param);
|
void sendDeviceStatus(JSONObject param);
|
||||||
|
|
||||||
|
ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -414,6 +414,40 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param) {
|
||||||
|
try {
|
||||||
|
MDC.put(log_file_type, log_type);
|
||||||
|
ApplyManipulatorActionResponse applyManipulatorActionResponse = new ApplyManipulatorActionResponse();
|
||||||
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||||
|
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||||
|
AddressDto addressDto = addressService.findByCode("applyLabelingAndBinding");
|
||||||
|
String methods_url = addressDto.getMethods_url();
|
||||||
|
String url = wmsUrl + methods_url;
|
||||||
|
log.info("ApplyManipulatorActionRequest----请求参数{}", param);
|
||||||
|
try {
|
||||||
|
// String result = "";
|
||||||
|
String result = HttpRequest.post(url)
|
||||||
|
.body(JSON.toJSONString(param))
|
||||||
|
.execute().body();
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
log.info("ApplyManipulatorActionResponse----返回参数{}", result);
|
||||||
|
applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("status", 400);
|
||||||
|
map.put("message", e.getMessage());
|
||||||
|
return JSONObject.toJavaObject(map, ApplyManipulatorActionResponse.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return applyManipulatorActionResponse;
|
||||||
|
} finally {
|
||||||
|
MDC.remove(log_file_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param) {
|
public ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -127,6 +127,14 @@ public interface TaskService {
|
|||||||
*/
|
*/
|
||||||
List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code);
|
List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务类型查询
|
||||||
|
* @param task_type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TaskDto> queryTaskByType(String task_type);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据前工位取货点查找执行中的任务
|
* 根据前工位取货点查找执行中的任务
|
||||||
* @param head_start_device_code
|
* @param head_start_device_code
|
||||||
|
|||||||
@@ -402,6 +402,20 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TaskDto> queryTaskByType(String task_type) {
|
||||||
|
List<TaskDto> list = new ArrayList<>();
|
||||||
|
Iterator<TaskDto> iterator = tasks.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
TaskDto task = iterator.next();
|
||||||
|
if (!StrUtil.equals(task.getTask_type(), task_type)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list.add(task);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
public List<TaskDto> queryTaskByStartAndIntStatus(String head_start_device_code) {
|
public List<TaskDto> queryTaskByStartAndIntStatus(String head_start_device_code) {
|
||||||
List<TaskDto> list = new ArrayList<>();
|
List<TaskDto> list = new ArrayList<>();
|
||||||
Iterator<TaskDto> iterator = tasks.iterator();
|
Iterator<TaskDto> iterator = tasks.iterator();
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ import standard_autodoor from '@/views/acs/device/driver/standard_autodoor'
|
|||||||
import lamp_three_color from '@/views/acs/device/driver/lamp_three_color'
|
import lamp_three_color from '@/views/acs/device/driver/lamp_three_color'
|
||||||
import paper_tube_conveyor from '@/views/acs/device/driver/paper_tube_conveyor'
|
import paper_tube_conveyor from '@/views/acs/device/driver/paper_tube_conveyor'
|
||||||
import device_status from '@/views/acs/device/driver/device_status'
|
import device_status from '@/views/acs/device/driver/device_status'
|
||||||
|
import indoor_manipulator from '@/views/acs/device/driver/indoor_manipulator'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DeviceConfig',
|
name: 'DeviceConfig',
|
||||||
@@ -132,7 +133,8 @@ export default {
|
|||||||
standard_autodoor,
|
standard_autodoor,
|
||||||
lamp_three_color,
|
lamp_three_color,
|
||||||
paper_tube_conveyor,
|
paper_tube_conveyor,
|
||||||
device_status
|
device_status,
|
||||||
|
indoor_manipulator
|
||||||
},
|
},
|
||||||
dicts: ['device_type'],
|
dicts: ['device_type'],
|
||||||
mixins: [crud],
|
mixins: [crud],
|
||||||
|
|||||||
@@ -0,0 +1,546 @@
|
|||||||
|
<template>
|
||||||
|
<!--内包间行架机械手-->
|
||||||
|
<div>
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">设备协议:</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
OpcServer:
|
||||||
|
<el-select
|
||||||
|
v-model="opc_id"
|
||||||
|
placeholder="无"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
@change="changeOpc"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dataOpcservers"
|
||||||
|
:key="item.opc_id"
|
||||||
|
:label="item.opc_name"
|
||||||
|
:value="item.opc_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
PLC:
|
||||||
|
<el-select
|
||||||
|
v-model="plc_id"
|
||||||
|
placeholder="无"
|
||||||
|
clearable
|
||||||
|
@change="changePlc"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dataOpcPlcs"
|
||||||
|
:key="item.plc_id"
|
||||||
|
:label="item.plc_name"
|
||||||
|
:value="item.plc_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">输送系统:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="电气调度号" label-width="150px">
|
||||||
|
<el-input v-model="form.OPCServer" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">指令相关:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="检验有货">
|
||||||
|
<el-switch v-model="form.inspect_in_stocck" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="忽视取货校验" label-width="150px">
|
||||||
|
<el-switch v-model="form.ignore_pickup_check" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="忽视放货校验" label-width="150px">
|
||||||
|
<el-switch v-model="form.ignore_release_check" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="呼叫">
|
||||||
|
<el-switch v-model="form.apply_task" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="响应" label-width="150px">
|
||||||
|
<el-switch v-model="form.manual_create_task" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="关联设备" prop="device_code">
|
||||||
|
<el-select
|
||||||
|
v-model="form.link_device_code"
|
||||||
|
filterable
|
||||||
|
multiple
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_code"
|
||||||
|
:label="item.device_name"
|
||||||
|
:value="item.device_code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
|
||||||
|
<el-select
|
||||||
|
v-model="form.link_three_lamp"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_code"
|
||||||
|
:label="item.device_name"
|
||||||
|
:value="item.device_code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="是否输入物料" label-width="150px">
|
||||||
|
<el-switch v-model="form.input_material" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="取货点" prop="device_code">
|
||||||
|
<el-select
|
||||||
|
v-model="form.get_device_code"
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
reserve-keyword
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:label="item.device_name"
|
||||||
|
:value="item.device_code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="放货点" prop="device_code" label-width="100px">
|
||||||
|
<el-select
|
||||||
|
v-model="form.put_device_code"
|
||||||
|
filterable
|
||||||
|
reserve-keyword
|
||||||
|
multiple
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_code"
|
||||||
|
:label="item.device_name"
|
||||||
|
:value="item.device_code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">AGV相关:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="取货">
|
||||||
|
<el-switch v-model="form.is_pickup" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="放货">
|
||||||
|
<el-switch v-model="form.is_release" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">PLC读取字段:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-table
|
||||||
|
v-loading="false"
|
||||||
|
:data="data1"
|
||||||
|
:max-height="550"
|
||||||
|
size="small"
|
||||||
|
style="width: 100%;margin-bottom: 15px"
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-table-column prop="name" label="用途" />
|
||||||
|
<el-table-column prop="code" label="别名要求" />
|
||||||
|
<el-table-column prop="db" label="DB块">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model="data1[scope.$index].db"
|
||||||
|
size="mini"
|
||||||
|
class="edit-input"
|
||||||
|
@input="finishReadEdit(data1[scope.$index])"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dbr_value">
|
||||||
|
<template slot="header">
|
||||||
|
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">PLC写入字段:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-table
|
||||||
|
v-loading="false"
|
||||||
|
:data="data2"
|
||||||
|
:max-height="550"
|
||||||
|
size="small"
|
||||||
|
style="width: 100%;margin-bottom: 15px"
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-table-column prop="name" label="用途" />
|
||||||
|
<el-table-column prop="code" label="别名要求" />
|
||||||
|
<el-table-column prop="db" label="DB块">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model="data2[scope.$index].db"
|
||||||
|
size="mini"
|
||||||
|
class="edit-input"
|
||||||
|
@input="finishWriteEdit(data2[scope.$index])"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dbr_value2">
|
||||||
|
<template slot="header">
|
||||||
|
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dbw_value">
|
||||||
|
<template slot="header">
|
||||||
|
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span" />
|
||||||
|
<el-button
|
||||||
|
:loading="false"
|
||||||
|
icon="el-icon-check"
|
||||||
|
size="mini"
|
||||||
|
style="float: right; padding: 6px 9px"
|
||||||
|
type="primary"
|
||||||
|
@click="doSubmit"
|
||||||
|
>保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
queryDriverConfig,
|
||||||
|
updateConfig,
|
||||||
|
testRead,
|
||||||
|
testwrite
|
||||||
|
} from '@/api/acs/device/driverConfig'
|
||||||
|
import { selectOpcList } from '@/api/acs/device/opc'
|
||||||
|
import { selectPlcList } from '@/api/acs/device/opcPlc'
|
||||||
|
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
||||||
|
|
||||||
|
import crud from '@/mixins/crud'
|
||||||
|
import deviceCrud from '@/api/acs/device/device'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'IndoorManipulator',
|
||||||
|
mixins: [crud],
|
||||||
|
props: {
|
||||||
|
parentForm: {
|
||||||
|
type: Object,
|
||||||
|
require: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
device_code: '',
|
||||||
|
device_id: '',
|
||||||
|
plc_id: '',
|
||||||
|
plc_code: '',
|
||||||
|
opc_id: '',
|
||||||
|
opc_code: '',
|
||||||
|
load_device_code: '',
|
||||||
|
configLoading: false,
|
||||||
|
dataOpcservers: [],
|
||||||
|
dataOpcPlcs: [],
|
||||||
|
deviceList: [],
|
||||||
|
data1: [],
|
||||||
|
data2: [],
|
||||||
|
form: {
|
||||||
|
inspect_in_stocck: true,
|
||||||
|
ignore_pickup_check: true,
|
||||||
|
ignore_release_check: true,
|
||||||
|
apply_task: true,
|
||||||
|
link_three_lamp: '',
|
||||||
|
manual_create_task: true,
|
||||||
|
is_pickup: true,
|
||||||
|
is_release: true,
|
||||||
|
link_device_code: [],
|
||||||
|
get_device_code: [],
|
||||||
|
put_device_code: []
|
||||||
|
},
|
||||||
|
rules: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
// 从父表单获取设备编码
|
||||||
|
this.device_id = this.$props.parentForm.device_id
|
||||||
|
this.device_code = this.$props.parentForm.device_code
|
||||||
|
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
||||||
|
// 给表单赋值,并且属性不能为空
|
||||||
|
if (data.form) {
|
||||||
|
const arr = Object.keys(data.form)
|
||||||
|
// 不为空
|
||||||
|
if (arr.length > 0) {
|
||||||
|
this.form = data.form
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 给表单赋值,并且属性不能为空
|
||||||
|
if (data.parentForm) {
|
||||||
|
const arr = Object.keys(data.parentForm)
|
||||||
|
// 不为空
|
||||||
|
if (arr.length > 0) {
|
||||||
|
this.opc_code = data.parentForm.opc_code
|
||||||
|
this.plc_code = data.parentForm.plc_code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.data1 = data.rs
|
||||||
|
this.data2 = data.ws
|
||||||
|
this.sliceItem()
|
||||||
|
})
|
||||||
|
selectPlcList().then(data => {
|
||||||
|
this.dataOpcPlcs = data
|
||||||
|
this.plc_id = this.$props.parentForm.opc_plc_id
|
||||||
|
})
|
||||||
|
selectOpcList().then(data => {
|
||||||
|
this.dataOpcservers = data
|
||||||
|
this.opc_id = this.$props.parentForm.opc_server_id
|
||||||
|
})
|
||||||
|
deviceCrud.selectDeviceList().then(data => {
|
||||||
|
this.deviceList = data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
finishReadEdit(data) {
|
||||||
|
// 编辑的是code列,并且值包含mode
|
||||||
|
if (data.code.indexOf('mode') !== -1) {
|
||||||
|
debugger
|
||||||
|
const dbValue = data.db
|
||||||
|
// .之前的字符串
|
||||||
|
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||||
|
// .之后的字符串
|
||||||
|
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||||
|
// 取最后数字
|
||||||
|
const endNumber = afterStr.substring(1)
|
||||||
|
// 最后为非数字
|
||||||
|
if (isNaN(parseInt(endNumber))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// for (const val in this.data1) {
|
||||||
|
// if (this.data1[val].code.indexOf('move') !== -1) {
|
||||||
|
// this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||||
|
// }
|
||||||
|
// if (this.data1[val].code.indexOf('error') !== -1) {
|
||||||
|
// this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
|
||||||
|
// }
|
||||||
|
// if (this.data1[val].code.indexOf('task') !== -1) {
|
||||||
|
// this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
finishWriteEdit(data) {
|
||||||
|
// 编辑的是code列,并且值包含mode
|
||||||
|
if (data.code.indexOf('to_command') !== -1) {
|
||||||
|
const dbValue = data.db
|
||||||
|
// .之前的字符串
|
||||||
|
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||||
|
// .之后的字符串
|
||||||
|
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||||
|
// 取最后数字
|
||||||
|
const endNumber = afterStr.substring(1)
|
||||||
|
// 最后为非数字
|
||||||
|
if (isNaN(parseInt(endNumber))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// for (const val in this.data2) {
|
||||||
|
// if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||||
|
// this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||||
|
// }
|
||||||
|
// if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||||
|
// this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeOpc(val) {
|
||||||
|
this.dataOpcservers.forEach(item => {
|
||||||
|
if (item.opc_id === val) {
|
||||||
|
this.opc_code = item.opc_code
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
selectListByOpcID(val).then(data => {
|
||||||
|
this.dataOpcPlcs = data
|
||||||
|
this.plc_id = ''
|
||||||
|
this.plc_code = ''
|
||||||
|
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
|
||||||
|
this.plc_id = this.dataOpcPlcs[0].plc_id
|
||||||
|
this.plc_code = this.dataOpcPlcs[0].plc_code
|
||||||
|
}
|
||||||
|
this.sliceItem()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changePlc(val) {
|
||||||
|
this.dataOpcPlcs.forEach(item => {
|
||||||
|
if (item.plc_id === val) {
|
||||||
|
this.plc_code = item.plc_code
|
||||||
|
this.sliceItem()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
test_read1() {
|
||||||
|
testRead(this.data1, this.opc_id).then(data => {
|
||||||
|
this.data1 = data
|
||||||
|
this.notify('操作成功!', 'success')
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
test_read2() {
|
||||||
|
testRead(this.data2, this.opc_id).then(data => {
|
||||||
|
this.data2 = data
|
||||||
|
console.log(this.data2)
|
||||||
|
this.notify('操作成功!', 'success')
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
test_write1() {
|
||||||
|
testwrite(this.data2, this.opc_id).then(data => {
|
||||||
|
this.notify('操作成功!', 'success')
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
doSubmit() {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.configLoading = true
|
||||||
|
// 根据驱动类型判断是否为路由设备
|
||||||
|
const parentForm = this.parentForm
|
||||||
|
parentForm.is_route = true
|
||||||
|
parentForm.plc_id = this.plc_id
|
||||||
|
parentForm.opc_id = this.opc_id
|
||||||
|
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
||||||
|
this.notify('保存成功', 'success')
|
||||||
|
this.configLoading = false
|
||||||
|
}).catch(err => {
|
||||||
|
this.configLoading = false
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sliceItem() { // 拼接DB的Item值
|
||||||
|
this.data1.forEach(item => {
|
||||||
|
const str = item.code
|
||||||
|
// 是否包含.
|
||||||
|
if (str.search('.') !== -1) {
|
||||||
|
// 截取最后一位
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||||
|
} else {
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.data2.forEach(item => {
|
||||||
|
const str = item.code
|
||||||
|
// 是否包含.
|
||||||
|
if (str.search('.') !== -1) {
|
||||||
|
// 截取最后一位
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||||
|
} else {
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user