rev:优化废箔称重接口以及新增密集库到插拔轴工位行架任务逻辑
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.die_manipulator;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DieManipulatorDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "die_manipulator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "管芯行架机械手";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "管芯行架机械手";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new DieManipulatorDriver()).setDevice(device).setDriverDefination(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return DieManipulatorDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.robot);
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos(){
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos(){
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.die_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.ext.wms.data.ApplyfeedbackSubVolumeWeightRequest;
|
||||
import org.nl.acs.ext.wms.data.ApplyfeedbackSubVolumeWeightResponse;
|
||||
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.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.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.nl.config.language.LangProcess;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 管芯行架机械手
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class DieManipulatorDriver 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);
|
||||
@Autowired
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.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;
|
||||
|
||||
String device_code;
|
||||
//行架机械手申请任务成功标识
|
||||
boolean requireSucess = false;
|
||||
|
||||
private String error_type = "hxhj_error_type";
|
||||
|
||||
//当前指令
|
||||
Instruction inst = null;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
move = this.itemProtocol.getMove();
|
||||
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();
|
||||
|
||||
} 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);
|
||||
}
|
||||
|
||||
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() {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
String mode = "";
|
||||
String move = "";
|
||||
String action = "";
|
||||
String walk_y = "";
|
||||
if (this.getMode() == 0) {
|
||||
mode = LangProcess.msg("universal_off-line");
|
||||
} else if (this.getMode() == 1) {
|
||||
mode = LangProcess.msg("universal_stand-alone");
|
||||
} else if (this.getMode() == 2) {
|
||||
mode = LangProcess.msg("universal_standby");
|
||||
} else if (this.getMode() == 3) {
|
||||
mode = LangProcess.msg("universal_operation");
|
||||
}
|
||||
|
||||
if (this.getMove() == 0) {
|
||||
move = LangProcess.msg("universal_no");
|
||||
} else if (this.getMove() == 1) {
|
||||
move = LangProcess.msg("universal_yes");
|
||||
}
|
||||
|
||||
|
||||
String requireSucess = LangProcess.msg("universal_actionMessage4");
|
||||
if (this.requireSucess) {
|
||||
requireSucess = LangProcess.msg("universal_actionMessage5");
|
||||
}
|
||||
map.put("requireSucess", requireSucess);
|
||||
if (this.getAction() == 1) {
|
||||
action = LangProcess.msg("universal_delivery");
|
||||
} else if (this.getAction() == 2) {
|
||||
action = LangProcess.msg("universal_completed");
|
||||
} else if (this.getAction() == 3) {
|
||||
action = LangProcess.msg("universal_releasing");
|
||||
} else if (this.getAction() == 4) {
|
||||
action = LangProcess.msg("universal_releasing_completed");
|
||||
}else if (this.getAction() == 0){
|
||||
action = "无动作";
|
||||
}
|
||||
if(error == 0 && this.itemProtocol.isError){
|
||||
iserror = true;
|
||||
}else if(error == 0 && !(this.itemProtocol.isError)){
|
||||
iserror = false;
|
||||
}
|
||||
map.put("device_name", this.getDevice().getDevice_name());
|
||||
map.put("mode", mode);
|
||||
map.put("move", move);
|
||||
map.put("action", action);
|
||||
map.put("isOnline", this.getIsonline());
|
||||
map.put("error", ErrorUtil.getDictDetail("bhhj_error_type", String.valueOf(this.getError())));
|
||||
map.put("isError", this.getIserror());
|
||||
map.put("message", message);
|
||||
map.put("driver_type", "siemens_conveyor");
|
||||
map.put("is_click", true);
|
||||
JSONObject jo = new JSONObject(map);
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.die_manipulator;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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";
|
||||
//y轴坐标
|
||||
public static String item_y_position = "y";
|
||||
|
||||
//下发命令
|
||||
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 DieManipulatorDriver driver;
|
||||
|
||||
public ItemProtocol(DieManipulatorDriver 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_task() {
|
||||
return this.getOpcIntegerValue(item_to_task);
|
||||
}
|
||||
|
||||
public int getTo_onset() {
|
||||
return this.getOpcIntegerValue(item_to_onset);
|
||||
}
|
||||
|
||||
public int getTo_command() {
|
||||
return this.getOpcIntegerValue(item_to_command);
|
||||
}
|
||||
|
||||
public int getTo_target() {
|
||||
return this.getOpcIntegerValue(item_to_target);
|
||||
}
|
||||
|
||||
public float getX_position() {
|
||||
return this.getOpcFloatValue(item_x_position);
|
||||
}
|
||||
|
||||
public float getY_position() {
|
||||
return this.getOpcFloatValue(item_y_position);
|
||||
}
|
||||
|
||||
|
||||
Boolean isonline;
|
||||
Boolean isError = false;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if(ObjectUtil.isEmpty(value)){
|
||||
isError = true;
|
||||
}else if (item_heartbeat.equals(protocol)) {
|
||||
isError = false;
|
||||
}
|
||||
if (value == null) {
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (StrUtil.isEmpty(value)) {
|
||||
setIsonline(false);
|
||||
} 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, "心跳", "DB13.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB13.B1"));
|
||||
list.add(new ItemDto(item_move, "光电信号", "DB13.B2"));
|
||||
list.add(new ItemDto(item_action, "动作信号", "DB13.B3"));
|
||||
list.add(new ItemDto(item_walk_y, "行走列", "DB13.B4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB13.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB13.D6"));
|
||||
list.add(new ItemDto(item_x_position, "x坐标", "DB13.REAL10"));
|
||||
list.add(new ItemDto(item_y_position, "y坐标", "DB13.REAL14"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "DB14.W0"));
|
||||
list.add(new ItemDto(item_to_onset, "下发起始站", "DB14.W2"));
|
||||
list.add(new ItemDto(item_to_target, "下发目标站", "DB14.W4"));
|
||||
list.add(new ItemDto(item_to_task, "下发任务号", "DB14.D6"));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -359,7 +359,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
Device device = deviceAppService.findDeviceByCode(nextDeviceCode);
|
||||
if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() != 2 || plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2) {
|
||||
if (plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage9";
|
||||
continue;
|
||||
}
|
||||
@@ -416,11 +416,11 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
if (next_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) next_device.getDeviceDriver();
|
||||
String remark = "";
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() != 2) {
|
||||
remark = "universal_notCreateInstMessage9";
|
||||
notCreateInstMessage = remark;
|
||||
continue;
|
||||
}
|
||||
// if (plugPullDeviceSiteDeviceDriver.getMode() != 2) {
|
||||
// remark = "universal_notCreateInstMessage9";
|
||||
// notCreateInstMessage = remark;
|
||||
// continue;
|
||||
// }
|
||||
if (plugPullDeviceSiteDeviceDriver.getMove() != 0) {
|
||||
remark = "universal_notCreateInstMessage9";
|
||||
notCreateInstMessage = remark;
|
||||
@@ -592,18 +592,19 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
if (ObjectUtil.isNotEmpty(to_spec4)) {
|
||||
map.put("to_spec3", to_spec4);
|
||||
}
|
||||
}
|
||||
map.put("to_material3", to_material3);
|
||||
if (ObjectUtil.isNotEmpty(to_material4)) {
|
||||
map.put("to_material4", to_material4);
|
||||
}
|
||||
map.put("to_size3", to_size3);
|
||||
if (ObjectUtil.isNotEmpty(to_size4)) {
|
||||
map.put("to_size4", to_size4);
|
||||
}
|
||||
map.put("to_spec3", to_spec3);
|
||||
if (ObjectUtil.isNotEmpty(to_spec4)) {
|
||||
map.put("to_spec4", to_spec4);
|
||||
}else {
|
||||
map.put("to_material3", to_material3);
|
||||
if (ObjectUtil.isNotEmpty(to_material4)) {
|
||||
map.put("to_material4", to_material4);
|
||||
}
|
||||
map.put("to_size3", to_size3);
|
||||
if (ObjectUtil.isNotEmpty(to_size4)) {
|
||||
map.put("to_size4", to_size4);
|
||||
}
|
||||
map.put("to_spec3", to_spec3);
|
||||
if (ObjectUtil.isNotEmpty(to_spec4)) {
|
||||
map.put("to_spec4", to_spec4);
|
||||
}
|
||||
}
|
||||
map.put("to_qty1", to_qty1);
|
||||
map.put("to_qty2", to_qty2);
|
||||
|
||||
@@ -546,18 +546,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("RGV工位上有货申请行架任务----返回参数{}", result);
|
||||
applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyManipulatorAction", String.valueOf(applyManipulatorActionResponse.getCode()),
|
||||
JSON.toJSONString(param), String.valueOf(result), "RGV工位上有货申请行架任务");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
} catch (Exception e) {
|
||||
String message = e.getMessage();
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("RGV工位上有货申请行架任务----返回参数{}", result);
|
||||
applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyManipulatorAction", String.valueOf(applyManipulatorActionResponse.getCode()),
|
||||
JSON.toJSONString(param), message, "RGV工位上有货申请行架任务失败");
|
||||
JSON.toJSONString(param), String.valueOf(result), "RGV工位上有货申请行架任务失败");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
}
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyManipulatorAction", String.valueOf(applyManipulatorActionResponse.getCode()),
|
||||
JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "RGV工位上有货申请行架任务");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
}
|
||||
return applyManipulatorActionResponse;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||
@@ -619,31 +620,27 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
if (StrUtil.equals("1", type)) {
|
||||
wasteFoilWeighingStationDriver.writing("to_command", "6");
|
||||
Thread.sleep(1000); //休眠1秒
|
||||
while (true) {
|
||||
if (wasteFoilWeighingStationDriver.getMode() == 6) {
|
||||
while (wasteFoilWeighingStationDriver.getMode() == 6) {
|
||||
jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量
|
||||
jo.put("lastWeight", wasteFoilWeighingStationDriver.getOld_weight());//上一次重量
|
||||
jo.put("weightGap", wasteFoilWeighingStationDriver.getGap_weight());//重量差
|
||||
break;
|
||||
}
|
||||
}
|
||||
wasteFoilWeighingStationDriver.writing("to_command", "0");
|
||||
}
|
||||
//称重确认信号
|
||||
else if (StrUtil.equals("2", type)) {
|
||||
wasteFoilWeighingStationDriver.writing("to_command", "7");
|
||||
Thread.sleep(1000); //休眠1秒
|
||||
while (true) {
|
||||
if (wasteFoilWeighingStationDriver.getMode() == 7) {
|
||||
while (wasteFoilWeighingStationDriver.getMode() == 7) {
|
||||
jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量
|
||||
jo.put("lastWeight", wasteFoilWeighingStationDriver.getOld_weight());//上一次重量
|
||||
jo.put("weightGap", wasteFoilWeighingStationDriver.getGap_weight());//重量差
|
||||
break;
|
||||
}
|
||||
}
|
||||
wasteFoilWeighingStationDriver.writing("to_command", "0");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,32 +37,33 @@ public class ErrorUtil {
|
||||
for (int i = 0; i < dictDetailDtos.size(); i++) {
|
||||
Dict dictDetailDto = dictDetailDtos.get(i);
|
||||
String value = dictDetailDto.getValue();
|
||||
// String label = dictDetailDto.getLabel();
|
||||
String en_label = dictDetailDto.getEn_label();
|
||||
String in_label = dictDetailDto.getIn_label();
|
||||
String zh_label = dictDetailDto.getZh_label();
|
||||
if (StrUtil.equals(value, error_code) && ObjectUtil.isNotEmpty(language)) {
|
||||
if (language.contains("zh")){
|
||||
detail = zh_label;
|
||||
break;
|
||||
}
|
||||
if (language.contains("in")){
|
||||
detail = in_label;
|
||||
break;
|
||||
}
|
||||
if (language.contains("en")){
|
||||
detail = en_label;
|
||||
break;
|
||||
}
|
||||
if(StrUtil.isEmpty(language)){
|
||||
detail = en_label;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!StrUtil.equals(value, error_code)) {
|
||||
continue;
|
||||
}
|
||||
if (language.contains("zh")) {
|
||||
detail = zh_label;
|
||||
break;
|
||||
}
|
||||
if (language.contains("in")) {
|
||||
detail = in_label;
|
||||
break;
|
||||
}
|
||||
if (language.contains("en")) {
|
||||
detail = en_label;
|
||||
break;
|
||||
}
|
||||
if (StrUtil.isEmpty(language)) {
|
||||
detail = en_label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return detail == null ? LangProcess.msg("error_not_configured") : detail;
|
||||
}
|
||||
return detail ==null?LangProcess.msg("error_not_configured"):detail;
|
||||
}
|
||||
|
||||
public static Map<Integer, String> getDictDetailByName(String type) {
|
||||
getDict();
|
||||
@@ -100,8 +101,8 @@ public class ErrorUtil {
|
||||
String message;
|
||||
|
||||
if (agvErrorNum == 0) {
|
||||
code = "0";
|
||||
message = "正常";
|
||||
code = "0";
|
||||
message = "正常";
|
||||
} else if (agvErrorNum < 0) {
|
||||
code = "-1";
|
||||
message = "AGV上报报警代码有误";
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.nl.acs.udw.UnifiedDataAccessorFactory;
|
||||
import org.nl.acs.udw.UnifiedDataAppService;
|
||||
import org.nl.common.enums.LogTypeEnum;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.openscada.opc.lib.da.*;
|
||||
@@ -25,6 +26,7 @@ import java.util.regex.Pattern;
|
||||
public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerConnectionStateListener {
|
||||
List<OpcItemDto> protocols;
|
||||
OpcServerManageDto OpcServer;
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
int error_num;
|
||||
String message;
|
||||
int maxResartNum;
|
||||
@@ -231,6 +233,17 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("OPC数据源: {} 所有内容都为空,检查网络, all_null:{} ,暂定{}s", tag, all_null,3);
|
||||
}
|
||||
while (var18.hasNext()) {
|
||||
Item item = (Item) var18.next();
|
||||
String itemId = item.getId();
|
||||
OpcItemDto itemDto = this.getItem(itemId);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code("OPC数据源")
|
||||
.content("OPC数据源:" + tag + "内容为:" + itemDto)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
ThreadUtl.sleep( 3000);
|
||||
break start;
|
||||
} else if (this.all_null < 6) {
|
||||
|
||||
@@ -112,6 +112,7 @@ import dry_manipulator from '@/views/acs/device/driver/dry_manipulator.vue'
|
||||
import blanking_button from '@/views/acs/device/driver/blanking_button.vue'
|
||||
import pull_head_manipulator from '@/views/acs/device/driver/pull_head_manipulator.vue'
|
||||
import pull_tail_manipulator from '@/views/acs/device/driver/pull_tail_manipulator.vue'
|
||||
import die_manipulator from '@/views/acs/device/driver/die_manipulator.vue'
|
||||
import green_foil_machine_button from '@/views/acs/device/driver/green_foil_machine_button.vue'
|
||||
import inflatable_shaft_library from '@/views/acs/device/driver/inflatable_shaft_library.vue'
|
||||
import manipulator_agv_station from '@/views/acs/device/driver/manipulator_agv_station.vue'
|
||||
@@ -196,7 +197,8 @@ export default {
|
||||
volume_two_manipulator,
|
||||
manipulator_cache,
|
||||
paper_tube_pick_size,
|
||||
one_rgv
|
||||
one_rgv,
|
||||
die_manipulator
|
||||
},
|
||||
dicts: ['device_type'],
|
||||
mixins: [crud],
|
||||
|
||||
547
acs2/nladmin-ui/src/views/acs/device/driver/die_manipulator.vue
Normal file
547
acs2/nladmin-ui/src/views/acs/device/driver/die_manipulator.vue
Normal file
@@ -0,0 +1,547 @@
|
||||
<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"
|
||||
:key="item.device_code"
|
||||
:label="item.device_code"
|
||||
: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: 'DieManipulator',
|
||||
mixins: [crud],
|
||||
props: {
|
||||
parentForm: {
|
||||
type: Object,
|
||||
required: 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