add 老车间驱动
This commit is contained in:
@@ -97,7 +97,11 @@ public enum DriverTypeEnum {
|
||||
|
||||
HAILIANG_OLD_LETTERING_PACKAGE_DRIVER(44, "hailiang_old_lettering_package_device", "老车间-刻字包装机", "conveyor"),
|
||||
|
||||
HAILIANG_OLD_PACKAGE_SSX_DRIVER(45, "hailiang_old_package_ssx_station", "老车间-刻字包装输送线", "conveyor");
|
||||
HAILIANG_OLD_PACKAGE_SSX_DRIVER(45, "hailiang_old_package_ssx_station", "老车间-刻字包装输送线", "conveyor"),
|
||||
|
||||
HAILIANG_OLD_UNBOXING_MACHINE_DRIVER(46, "hailiang_old_unboxing_machine", "海亮-老车间-开箱机", "conveyor"),
|
||||
|
||||
HAILIANG_OLD_PACKAGE_RECVIEING_DRIVER(47, "hailiang_old_package_receiving_machine", "海亮-老车间-包装接料位", "conveyor");
|
||||
|
||||
|
||||
//驱动索引
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_old_package_receiving_station;
|
||||
|
||||
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 HailiangOldPackageReceivingStationDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "hailiang_old_package_receiving_machine";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "海亮-老车间-包装接料位";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "海亮-老车间-包装接料位";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new HailiangOldPackageReceivingStationDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return HailiangOldPackageReceivingStationDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.conveyor);
|
||||
return types;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_old_package_receiving_station;
|
||||
|
||||
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.acsEnum.WorkerOrderEnum;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.service.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.order.service.dto.EalingOrderDto;
|
||||
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 包装接料位
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class HailiangOldPackageReceivingStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, IssuedDeviceOrderInfo {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
|
||||
int heartbeat = 0;
|
||||
int mode = 0;
|
||||
int unboxing_error = 0;
|
||||
int unboxing_running = 0;
|
||||
int unboxing_ready = 0;
|
||||
int order_finish = 0;
|
||||
int order_compel_finish = 0;
|
||||
int error = 0;
|
||||
int now_order_num = 0;
|
||||
int task = 0;
|
||||
int open_ready_time = 0;
|
||||
int device_running_time = 0;
|
||||
int await_time = 0;
|
||||
int order = 0;
|
||||
|
||||
int last_heartbeat = 0;
|
||||
int last_mode = 0;
|
||||
int last_unboxing_error = 0;
|
||||
int last_unboxing_running = 0;
|
||||
int last_unboxing_ready = 0;
|
||||
int last_order_finish = 0;
|
||||
int last_order_compel_finish = 0;
|
||||
int last_error = 0;
|
||||
int last_now_order_num = 0;
|
||||
int last_task = 0;
|
||||
int last_open_ready_time = 0;
|
||||
int last_device_running_time = 0;
|
||||
int last_await_time = 0;
|
||||
int last_order = 0;
|
||||
|
||||
|
||||
Boolean isonline = true;
|
||||
String message = null;
|
||||
Boolean iserror = false;
|
||||
|
||||
private int instruction_require_time_out;
|
||||
boolean requireSucess = false;
|
||||
|
||||
private int instruction_finished_time_out;
|
||||
String device_code = null;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
|
||||
|
||||
|
||||
if (mode != last_mode) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记");
|
||||
}
|
||||
if (error != last_error) {
|
||||
if (error != 0) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setError_code(String.valueOf(error));
|
||||
dto.setError_info(ErrorUtil.getDictDetail("unbox_error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error + "复位请求标记");
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
var17.printStackTrace();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17);
|
||||
}
|
||||
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
//this.setIsonline(false);
|
||||
//this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
message = "未联机";
|
||||
} else {
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
}
|
||||
last_mode = mode;
|
||||
last_unboxing_error = unboxing_error;
|
||||
last_unboxing_running = unboxing_running;
|
||||
last_unboxing_ready = unboxing_ready;
|
||||
last_order_finish = order_finish;
|
||||
last_order_compel_finish = order_compel_finish;
|
||||
last_error = error;
|
||||
last_now_order_num = now_order_num;
|
||||
last_task = task;
|
||||
last_order = order;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode == 1 ? "联机" : "未联机");
|
||||
jo.put("order_finish", order_finish == 1 ? "是" : "否");
|
||||
jo.put("order_compel_finish", order_compel_finish == 1 ? "是" : "否");
|
||||
jo.put("error", ErrorUtil.getDictDetail("unbox_error_type", String.valueOf(error)));
|
||||
jo.put("now_order_num", now_order_num);
|
||||
jo.put("task", task);
|
||||
jo.put("order", order);
|
||||
jo.put("isOnline", this.itemProtocol.getIsonline());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void issuedOrderInfo(ProduceshiftorderDto dto) {
|
||||
EalingOrderDto ealingOrderDto = dto.getEalingOrderDto();
|
||||
if (ealingOrderDto != null) {
|
||||
String is_foreward = ealingOrderDto.getIs_foreward();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_clear", "1");
|
||||
map.put("to_is_foreward", is_foreward);
|
||||
map.put("to_order_box_num", ealingOrderDto.getOrder_box_num());
|
||||
map.put("to_order", ealingOrderDto.getOrder_code());
|
||||
this.writing(map);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void issuedOrderFinish(String autoFinish) {
|
||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||
this.writing("to_order_compel_finished", "1");
|
||||
} else {
|
||||
this.writing("to_confirm_finished", "1");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toStop() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toStart() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_old_package_receiving_station;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_old_package_ssx.HailiangLetteringPackageSsxDeviceDriver;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 包装接料位
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
public class ItemProtocol {
|
||||
|
||||
public static String item_heartbeat = "heartbeat";
|
||||
public static String item_mode = "mode";
|
||||
public static String item_move = "move";
|
||||
public static String item_action = "action";
|
||||
public static String item_error = "error";
|
||||
public static String item_is_full = "is_full";
|
||||
public static String item_task = "task";
|
||||
|
||||
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_target = "to_target";
|
||||
public static String item_to_task = "to_task";
|
||||
|
||||
|
||||
|
||||
private HailiangOldPackageReceivingStationDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(HailiangOldPackageReceivingStationDeviceDriver 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 getError() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public int getIs_full() {
|
||||
return this.getOpcIntegerValue(item_is_full);
|
||||
}
|
||||
|
||||
public int getTask() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
|
||||
public int getToCommand() {
|
||||
return this.getOpcIntegerValue(item_to_command);
|
||||
}
|
||||
|
||||
public int getToTarget() {
|
||||
return this.getOpcIntegerValue(item_to_target);
|
||||
}
|
||||
|
||||
public int getToTask() {
|
||||
return this.getOpcIntegerValue(item_to_task);
|
||||
}
|
||||
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
}
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (value == null) {
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.W0"));
|
||||
list.add(new ItemDto(item_mode, "工作状态", "DB600.W2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB600.W4"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB600.W6"));
|
||||
list.add(new ItemDto(item_is_full, "是否满料", "DB600.W8"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB600.W10"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB600.D12"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发作业命令", "DB601.W2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "下发目标站", "DB601.W4"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB601.D6"));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 包装输送线
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
public class ItemProtocol {
|
||||
@@ -116,24 +118,24 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "VW0"));
|
||||
list.add(new ItemDto(item_mode, "工作状态", "VW2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "VW4"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "VW6"));
|
||||
list.add(new ItemDto(item_direction, "电机方向", "VW8"));
|
||||
list.add(new ItemDto(item_vehicle_type, "托盘类型", "VW10"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "VW12"));
|
||||
list.add(new ItemDto(item_task, "任务号", "VD14"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "WB18.20"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.W0"));
|
||||
list.add(new ItemDto(item_mode, "工作状态", "DB600.W2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB600.W4"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB600.W6"));
|
||||
list.add(new ItemDto(item_direction, "电机方向", "DB600.W8"));
|
||||
list.add(new ItemDto(item_vehicle_type, "托盘类型", "DB600.W10"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB600.W12"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB600.D14"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "DB600.STRING18.20"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发作业命令", "VW2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "下发目标站", "VW4"));
|
||||
list.add(new ItemDto(item_to_vehicle_type, "下发托盘类型", "VW6"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "VD8"));
|
||||
list.add(new ItemDto(item_to_command, "下发作业命令", "DB601.W0", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "下发目标站", "DB601.W2"));
|
||||
list.add(new ItemDto(item_to_vehicle_type, "下发托盘类型", "DB601.W4"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB601.D6"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 海亮老车间码垛机械手
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
public class ItemProtocol {
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_old_unboxing_machine;
|
||||
|
||||
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 HailiangOldUnboxingMachineDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "hailiang_old_unboxing_machine";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "海亮-老车间-开箱机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "海亮-老车间-开箱机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new HailiangOldUnboxingMachineDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return HailiangOldUnboxingMachineDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.conveyor);
|
||||
return types;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_old_unboxing_machine;
|
||||
|
||||
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.acsEnum.WorkerOrderEnum;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.service.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.order.service.dto.EalingOrderDto;
|
||||
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 开箱机
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class HailiangOldUnboxingMachineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, IssuedDeviceOrderInfo {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
|
||||
int heartbeat = 0;
|
||||
int mode = 0;
|
||||
int unboxing_error = 0;
|
||||
int unboxing_running = 0;
|
||||
int unboxing_ready = 0;
|
||||
int order_finish = 0;
|
||||
int order_compel_finish = 0;
|
||||
int error = 0;
|
||||
int now_order_num = 0;
|
||||
int task = 0;
|
||||
int open_ready_time = 0;
|
||||
int device_running_time = 0;
|
||||
int await_time = 0;
|
||||
int order = 0;
|
||||
|
||||
int last_heartbeat = 0;
|
||||
int last_mode = 0;
|
||||
int last_unboxing_error = 0;
|
||||
int last_unboxing_running = 0;
|
||||
int last_unboxing_ready = 0;
|
||||
int last_order_finish = 0;
|
||||
int last_order_compel_finish = 0;
|
||||
int last_error = 0;
|
||||
int last_now_order_num = 0;
|
||||
int last_task = 0;
|
||||
int last_open_ready_time = 0;
|
||||
int last_device_running_time = 0;
|
||||
int last_await_time = 0;
|
||||
int last_order = 0;
|
||||
|
||||
|
||||
Boolean isonline = true;
|
||||
String message = null;
|
||||
Boolean iserror = false;
|
||||
|
||||
private int instruction_require_time_out;
|
||||
boolean requireSucess = false;
|
||||
|
||||
private int instruction_finished_time_out;
|
||||
String device_code = null;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
|
||||
if (mode != last_mode) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记");
|
||||
}
|
||||
|
||||
if (error != last_error) {
|
||||
if (error != 0) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setError_code(String.valueOf(error));
|
||||
dto.setError_info(ErrorUtil.getDictDetail("unbox_error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error + "复位请求标记");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception var17) {
|
||||
var17.printStackTrace();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17);
|
||||
}
|
||||
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
//this.setIsonline(false);
|
||||
//this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
message = "未联机";
|
||||
} else {
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
}
|
||||
|
||||
|
||||
last_mode = mode;
|
||||
last_error = error;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode == 1 ? "联机" : "未联机");
|
||||
jo.put("error", ErrorUtil.getDictDetail("unbox_error_type", String.valueOf(error)));
|
||||
jo.put("now_order_num", now_order_num);
|
||||
jo.put("task", task);
|
||||
jo.put("order", order);
|
||||
jo.put("isOnline", this.itemProtocol.getIsonline());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void issuedOrderInfo(ProduceshiftorderDto dto) {
|
||||
EalingOrderDto ealingOrderDto = dto.getEalingOrderDto();
|
||||
if (ealingOrderDto != null) {
|
||||
String is_foreward = ealingOrderDto.getIs_foreward();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_clear", "1");
|
||||
map.put("to_is_foreward", is_foreward);
|
||||
map.put("to_order_box_num", ealingOrderDto.getOrder_box_num());
|
||||
map.put("to_order", ealingOrderDto.getOrder_code());
|
||||
this.writing(map);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void issuedOrderFinish(String autoFinish) {
|
||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||
this.writing("to_order_compel_finished", "1");
|
||||
} else {
|
||||
this.writing("to_confirm_finished", "1");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toStop() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toStart() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_old_unboxing_machine;
|
||||
|
||||
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_error = "error";
|
||||
//开箱机运行状态
|
||||
public static String item_status = "status";
|
||||
//开箱数量
|
||||
public static String item_qty = "qty";
|
||||
//前往1巷道数量
|
||||
public static String item_one_qty = "one_qty";
|
||||
//前往1巷道数量
|
||||
public static String item_two_qty = "two_qty";
|
||||
//前往1巷道数量
|
||||
public static String item_three_qty = "three_qty";
|
||||
//前往1巷道数量
|
||||
public static String item_four_qty = "four_qty";
|
||||
//前往1巷道数量
|
||||
public static String item_five_qty = "five_qty";
|
||||
//前往1巷道状态
|
||||
public static String item_one_status = "one_status";
|
||||
//前往2巷道状态
|
||||
public static String item_two_status = "two_status";
|
||||
//前往3巷道状态
|
||||
public static String item_three_status = "three_status";
|
||||
//前往4巷道状态
|
||||
public static String item_four_status = "four_status";
|
||||
//前往5巷道状态
|
||||
public static String item_five_status = "five_status";
|
||||
|
||||
|
||||
//前往1巷道状态
|
||||
public static String item_to_one_status = "to_one_status";
|
||||
//前往2巷道状态
|
||||
public static String item_to_two_status = "to_two_status";
|
||||
//前往3巷道状态
|
||||
public static String item_to_three_status = "to_three_status";
|
||||
//前往4巷道状态
|
||||
public static String item_to_four_status = "to_four_status";
|
||||
//前往5巷道状态
|
||||
public static String item_to_five_status = "to_five_status";
|
||||
//清零
|
||||
public static String item_to_clear = "to_clear";
|
||||
|
||||
private HailiangOldUnboxingMachineDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(HailiangOldUnboxingMachineDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
};
|
||||
|
||||
public int getError() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
};
|
||||
|
||||
public int getStatus() {
|
||||
return this.getOpcIntegerValue(item_status);
|
||||
};
|
||||
|
||||
public int getQty() {
|
||||
return this.getOpcIntegerValue(item_qty);
|
||||
};
|
||||
|
||||
public int getOne_qty() {
|
||||
return this.getOpcIntegerValue(item_one_qty);
|
||||
};
|
||||
|
||||
public int getTwo_qty() {
|
||||
return this.getOpcIntegerValue(item_two_qty);
|
||||
};
|
||||
|
||||
public int getThree_qty() {
|
||||
return this.getOpcIntegerValue(item_three_qty);
|
||||
};
|
||||
|
||||
public int getFour_qty() {
|
||||
return this.getOpcIntegerValue(item_four_qty);
|
||||
};
|
||||
|
||||
public int getFive_qty() {
|
||||
return this.getOpcIntegerValue(item_five_qty);
|
||||
};
|
||||
|
||||
public int getOne_status() {
|
||||
return this.getOpcIntegerValue(item_one_status);
|
||||
};
|
||||
|
||||
public int getTwo_status() {
|
||||
return this.getOpcIntegerValue(item_two_status);
|
||||
};
|
||||
|
||||
public int getThree_status() {
|
||||
return this.getOpcIntegerValue(item_three_status);
|
||||
};
|
||||
|
||||
public int getFour_status() {
|
||||
return this.getOpcIntegerValue(item_four_status);
|
||||
};
|
||||
|
||||
public int getFive_status() {
|
||||
return this.getOpcIntegerValue(item_five_status);
|
||||
};
|
||||
|
||||
|
||||
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 static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.W0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB600.W2"));
|
||||
list.add(new ItemDto(item_status, "状态", "DB600.W4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB600.W6"));
|
||||
list.add(new ItemDto(item_qty, "订单实时", "DB600.W8"));
|
||||
list.add(new ItemDto(item_one_qty, "1号巷道数量", "DB600.W10"));
|
||||
list.add(new ItemDto(item_two_qty, "2号巷道数量", "DB600.W12"));
|
||||
list.add(new ItemDto(item_three_qty, "3号巷道数量", "DB600.W14"));
|
||||
list.add(new ItemDto(item_four_qty, "4号巷道数量", "DB600.W16"));
|
||||
list.add(new ItemDto(item_five_qty, "5号巷道数量", "DB600.W18"));
|
||||
list.add(new ItemDto(item_one_status, "1号巷道状态", "DB600.W20"));
|
||||
list.add(new ItemDto(item_two_status, "2号巷道状态", "DB600.W22"));
|
||||
list.add(new ItemDto(item_three_status, "3号巷道状态", "DB600.W24"));
|
||||
list.add(new ItemDto(item_four_status, "4号巷道状态", "DB600.W26"));
|
||||
list.add(new ItemDto(item_five_status, "5号巷道状态", "DB600.W28"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_one_status, "禁用1号巷道状态", "DB601.W2"));
|
||||
list.add(new ItemDto(item_to_two_status, "禁用2号巷道状态", "DB600.W4"));
|
||||
list.add(new ItemDto(item_to_three_status, "禁用3号巷道状态", "DB600.W6"));
|
||||
list.add(new ItemDto(item_to_four_status, "禁用4号巷道状态", "DB600.W8"));
|
||||
list.add(new ItemDto(item_to_five_status, "禁用5号巷道状态", "DB600.W10"));
|
||||
list.add(new ItemDto(item_to_clear, "清零", "DB600.W12"));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -133,6 +133,8 @@ import hailiang_old_palletizing_station from '@/views/acs/device/driver/hailiang
|
||||
import hailiang_old_stacking_manipulator from '@/views/acs/device/driver/hailiang_old/hailiang_old_stacking_manipulator'
|
||||
import hailiang_old_package_ssx_station from '@/views/acs/device/driver/hailiang_old/hailiang_old_package_ssx_station'
|
||||
import hailiang_old_lettering_package_device from '@/views/acs/device/driver/hailiang_old/hailiang_old_lettering_package_device'
|
||||
import hailiang_old_unboxing_machine from '@/views/acs/device/driver/hailiang_old/hailiang_old_unboxing_machine'
|
||||
import hailiang_old_package_receiving_machine from '@/views/acs/device/driver/hailiang_old/hailiang_old_package_receiving_machine'
|
||||
|
||||
export default {
|
||||
name: 'DeviceConfig',
|
||||
@@ -190,7 +192,9 @@ export default {
|
||||
hailiang_old_stacking_manipulator,
|
||||
hailiang_old_palletizing_station,
|
||||
hailiang_old_package_ssx_station,
|
||||
hailiang_old_lettering_package_device
|
||||
hailiang_old_lettering_package_device,
|
||||
hailiang_old_unboxing_machine,
|
||||
hailiang_old_package_receiving_machine
|
||||
},
|
||||
dicts: ['device_type'],
|
||||
mixins: [crud],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<!---海亮-老车间码垛机械手工位-->
|
||||
<!---海亮-老车间刻字贴标机 -->
|
||||
<div>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
@@ -334,61 +334,16 @@ export default {
|
||||
}
|
||||
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('action') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('ioaction') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 3)
|
||||
if (this.data1[val].code.indexOf('number') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 5)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('weight') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 9)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('batch') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 13)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('specifications') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 17) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('material') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 273) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('barcode') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 529) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('AlongSide') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 785)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('BshortSide') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 787)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('Htrapezoidal') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 789)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('Wthickness') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 791)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('status') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'B' + (parseInt(endNumber) + 795)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('unqualified_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 795)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('encoder_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 799)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('order_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 803)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('order_No') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 807) + '.50'
|
||||
if (this.data1[val].code.indexOf('boxtype') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,545 @@
|
||||
<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.apply_empty"
|
||||
filterable
|
||||
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.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: 'LnshPalletizingManipulatorSite',
|
||||
mixins: [crud],
|
||||
props: {
|
||||
parentForm: {
|
||||
type: Object,
|
||||
require: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
device_code: '',
|
||||
device_id: '',
|
||||
plc_id: '',
|
||||
plc_code: '',
|
||||
opc_id: '',
|
||||
opc_code: '',
|
||||
configLoading: false,
|
||||
dataOpcservers: [],
|
||||
dataOpcPlcs: [],
|
||||
data1: [],
|
||||
data2: [],
|
||||
form: {
|
||||
inspect_in_stocck: true,
|
||||
ignore_pickup_check: true,
|
||||
ignore_release_check: true,
|
||||
apply_task: true,
|
||||
apply_empty: [],
|
||||
manual_create_task: true,
|
||||
is_pickup: true,
|
||||
is_release: true
|
||||
},
|
||||
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) {
|
||||
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('action') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('ioaction') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 3)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 5)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('weight') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 9)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('batch') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 13)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('specifications') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 17) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('material') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 273) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('barcode') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 529) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('AlongSide') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 785)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('BshortSide') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 787)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('Htrapezoidal') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 789)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('Wthickness') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 791)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('status') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'B' + (parseInt(endNumber) + 795)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('unqualified_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 795)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('encoder_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 799)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('order_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 803)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('order_No') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 807) + '.50'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
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) + 4)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_barcode') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 8) + '.50'
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_error') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'B' + (parseInt(endNumber) + 264)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_allow_pallet_qty') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 266)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_material_type') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 268)
|
||||
}
|
||||
// if (this.data2[val].code.indexOf('to_material_code') !== -1) {
|
||||
// this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 272)
|
||||
// }
|
||||
if (this.data2[val].code.indexOf('to_order_qty') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 276)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_product_code') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 280)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_order_No') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 284) + '.50'
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_material_code') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 540) + '.50'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
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>
|
||||
@@ -334,61 +334,19 @@ export default {
|
||||
}
|
||||
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('action') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('ioaction') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 3)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
if (this.data1[val].code.indexOf('number') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 5)
|
||||
if (this.data1[val].code.indexOf('action') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 6)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('weight') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 9)
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 8)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('batch') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 13)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('specifications') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 17) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('material') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 273) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('barcode') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 529) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('AlongSide') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 785)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('BshortSide') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 787)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('Htrapezoidal') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 789)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('Wthickness') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 791)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('status') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'B' + (parseInt(endNumber) + 795)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('unqualified_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 795)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('encoder_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 799)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('order_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 803)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('order_No') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 807) + '.50'
|
||||
if (this.data1[val].code.indexOf('boxtype') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,36 +369,6 @@ export default {
|
||||
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) + 4)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_barcode') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 8) + '.50'
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_error') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'B' + (parseInt(endNumber) + 264)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_allow_pallet_qty') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 266)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_material_type') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 268)
|
||||
}
|
||||
// if (this.data2[val].code.indexOf('to_material_code') !== -1) {
|
||||
// this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 272)
|
||||
// }
|
||||
if (this.data2[val].code.indexOf('to_order_qty') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 276)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_product_code') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 280)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_order_No') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 284) + '.50'
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_material_code') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 540) + '.50'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -0,0 +1,545 @@
|
||||
<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.apply_empty"
|
||||
filterable
|
||||
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.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: 'LnshPalletizingManipulatorSite',
|
||||
mixins: [crud],
|
||||
props: {
|
||||
parentForm: {
|
||||
type: Object,
|
||||
require: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
device_code: '',
|
||||
device_id: '',
|
||||
plc_id: '',
|
||||
plc_code: '',
|
||||
opc_id: '',
|
||||
opc_code: '',
|
||||
configLoading: false,
|
||||
dataOpcservers: [],
|
||||
dataOpcPlcs: [],
|
||||
data1: [],
|
||||
data2: [],
|
||||
form: {
|
||||
inspect_in_stocck: true,
|
||||
ignore_pickup_check: true,
|
||||
ignore_release_check: true,
|
||||
apply_task: true,
|
||||
apply_empty: [],
|
||||
manual_create_task: true,
|
||||
is_pickup: true,
|
||||
is_release: true
|
||||
},
|
||||
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) {
|
||||
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('action') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('ioaction') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 3)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 5)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('weight') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 9)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('batch') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 13)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('specifications') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 17) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('material') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 273) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('barcode') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 529) + '.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('AlongSide') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 785)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('BshortSide') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 787)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('Htrapezoidal') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 789)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('Wthickness') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 791)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('status') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'B' + (parseInt(endNumber) + 795)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('unqualified_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 795)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('encoder_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 799)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('order_qty') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 803)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('order_No') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 807) + '.50'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
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) + 4)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_barcode') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 8) + '.50'
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_error') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'B' + (parseInt(endNumber) + 264)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_allow_pallet_qty') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 266)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_material_type') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 268)
|
||||
}
|
||||
// if (this.data2[val].code.indexOf('to_material_code') !== -1) {
|
||||
// this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 272)
|
||||
// }
|
||||
if (this.data2[val].code.indexOf('to_order_qty') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 276)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_product_code') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 280)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_order_No') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 284) + '.50'
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_material_code') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 540) + '.50'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
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>
|
||||
@@ -23,7 +23,7 @@
|
||||
<el-table-column prop="requestparam" label="请求参数" />
|
||||
<el-table-column prop="responseparam" label="返回参数" />
|
||||
<el-table-column prop="logTime" width="170" label="记录时间" />
|
||||
<el-table-column prop="content" width="500" label="内容详情" min-width="300" show-overflow-tooltip/>
|
||||
<el-table-column prop="content" width="500" label="内容详情" min-width="300" show-overflow-tooltip />
|
||||
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
|
||||
Reference in New Issue
Block a user