晟华驱动更新
This commit is contained in:
@@ -111,7 +111,9 @@ public enum DriverTypeEnum {
|
||||
|
||||
LNSH_LAMINATING_MACHINE(51, "lnsh_Laminating_machine", "晟华-覆膜机", "station"),
|
||||
|
||||
LNSH_PACKAGE_SITE(52, "lnsh_package_site", "晟华-包装线工位", "station");
|
||||
LNSH_PACKAGE_SITE(52, "lnsh_package_site", "晟华-包装线工位", "station"),
|
||||
|
||||
LNSH_CRUSHER(52, "lnsh_crusher", "晟华-破碎机", "station");
|
||||
|
||||
|
||||
//驱动索引
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
package org.nl.acs.device_driver.lnsh.lnsh_crusher;
|
||||
|
||||
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_status = "status";
|
||||
public static String item_error = "error";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_close_time = "close_time";
|
||||
public static String item_material = "material";
|
||||
public static String item_waitBroken_weight = "waitBroken_weight";
|
||||
public static String item_alreadyBroken_weight = "alreadyBroken_weight";
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_error = "to_error";
|
||||
Boolean isonline;
|
||||
|
||||
private LnshCrusherDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(LnshCrusherDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return this.getOpcIntegerValue(item_status);
|
||||
}
|
||||
|
||||
public int getError() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public int getOpen_time() {
|
||||
return this.getOpcIntegerValue(item_open_time);
|
||||
}
|
||||
|
||||
public int getStandby_time() {
|
||||
return this.getOpcIntegerValue(item_standby_time);
|
||||
}
|
||||
|
||||
public int getProduction_time() {
|
||||
return this.getOpcIntegerValue(item_production_time);
|
||||
}
|
||||
|
||||
public int getError_time() {
|
||||
return this.getOpcIntegerValue(item_error_time);
|
||||
}
|
||||
|
||||
public int getClose_time() {
|
||||
return this.getOpcIntegerValue(item_close_time);
|
||||
}
|
||||
|
||||
public String getMaterial() {
|
||||
return this.getOpcStringValue(item_material);
|
||||
}
|
||||
|
||||
public int getWaitBroken_weight() {
|
||||
return this.getOpcIntegerValue(item_waitBroken_weight);
|
||||
}
|
||||
|
||||
public int getAlreadyBroken_weight() {
|
||||
return this.getOpcIntegerValue(item_alreadyBroken_weight);
|
||||
}
|
||||
|
||||
public int getTo_command() {
|
||||
return this.getOpcIntegerValue(item_to_command);
|
||||
}
|
||||
|
||||
public int getTo_error() {
|
||||
return this.getOpcIntegerValue(item_to_error);
|
||||
}
|
||||
|
||||
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
}
|
||||
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (value == null) {
|
||||
log.error("读取错误!");
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB1.B2"));
|
||||
list.add(new ItemDto(item_error, "故障", "DB1.B3"));
|
||||
list.add(new ItemDto(item_open_time, "开机时间", "DB1.D4"));
|
||||
list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D8"));
|
||||
list.add(new ItemDto(item_production_time, "生产时间", "DB1.D12"));
|
||||
list.add(new ItemDto(item_error_time, "故障时间", "DB1.D16"));
|
||||
list.add(new ItemDto(item_close_time, "关机时间", "DB1.D20"));
|
||||
list.add(new ItemDto(item_material, "当前生产物料", "DB1.S24"));
|
||||
list.add(new ItemDto(item_waitBroken_weight, "待破碎重量", "DB1.D280"));
|
||||
list.add(new ItemDto(item_alreadyBroken_weight, "已破碎重量", "DB1.D284"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_error, "下发故障", "DB2.W2"));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package org.nl.acs.device_driver.lnsh.lnsh_crusher;
|
||||
|
||||
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.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 晟华破碎机
|
||||
*/
|
||||
@Service
|
||||
public class LnshCrusherDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "lnsh_crusher";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "晟华-破碎机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "晟华-破碎机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new LnshCrusherDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return LnshCrusherDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.station);
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "故障", "DB1.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.D4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D8"));
|
||||
list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D12"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D16"));
|
||||
list.add(new ItemDto(ItemProtocol.item_close_time, "关机时间", "DB1.D20"));
|
||||
list.add(new ItemDto(ItemProtocol.item_material, "当前生产物料", "DB1.S24"));
|
||||
list.add(new ItemDto(ItemProtocol.item_waitBroken_weight, "待破碎重量", "DB1.D280"));
|
||||
list.add(new ItemDto(ItemProtocol.item_alreadyBroken_weight, "已破碎重量", "DB1.D284"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
package org.nl.acs.device_driver.lnsh.lnsh_crusher;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 晟华破碎机
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class LnshCrusherDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
@Autowired
|
||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||
@Autowired
|
||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||
@Autowired
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean("logServerImpl");
|
||||
|
||||
String device_code;
|
||||
int mode = 0;
|
||||
int error = 0;
|
||||
int last_mode = 0;
|
||||
int last_error = 0;
|
||||
Boolean isonline = true;
|
||||
Boolean iserror = false;
|
||||
|
||||
boolean requireSucess = false;
|
||||
|
||||
int heartbeat;
|
||||
int last_heartbeat;
|
||||
private Date checkHeartbeattime = new Date();
|
||||
private Date last_checkHeartbeattime = new Date();
|
||||
|
||||
String message;
|
||||
int status = 0;
|
||||
int last_status = 0;
|
||||
//开机时间
|
||||
int open_time = 0;
|
||||
int last_open_time = 0;
|
||||
//待机时间
|
||||
int standby_time = 0;
|
||||
int last_standby_time = 0;
|
||||
//生产时间
|
||||
int production_time = 0;
|
||||
int last_production_time = 0;
|
||||
//故障时间
|
||||
int error_time = 0;
|
||||
int last_error_time = 0;
|
||||
//关机时间
|
||||
int close_time = 0;
|
||||
int last_close_time = 0;
|
||||
//待破碎重量
|
||||
int waitBroken_weight = 0;
|
||||
int last_waitBroken_weight = 0;
|
||||
|
||||
//已破碎重量
|
||||
int alreadyBroken_weight = 0;
|
||||
int last_alreadyBroken_weight = 0;
|
||||
|
||||
String material;
|
||||
String last_material;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
status = this.itemProtocol.getStatus();
|
||||
error = this.itemProtocol.getError();
|
||||
open_time = this.itemProtocol.getOpen_time();
|
||||
standby_time = this.itemProtocol.getStandby_time();
|
||||
production_time = this.itemProtocol.getProduction_time();
|
||||
error_time = this.itemProtocol.getError_time();
|
||||
close_time = this.itemProtocol.getClose_time();
|
||||
material = this.itemProtocol.getMaterial();
|
||||
waitBroken_weight = this.itemProtocol.getWaitBroken_weight();
|
||||
alreadyBroken_weight = this.itemProtocol.getAlreadyBroken_weight();
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode);
|
||||
}
|
||||
if (status != last_status) {
|
||||
logServer.deviceLog(this.device_code,"status" ,String.valueOf(status));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号status:" + last_status + "->" + status);
|
||||
}
|
||||
if (error != last_error) {
|
||||
logServer.deviceLog(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
}
|
||||
if (open_time != last_open_time) {
|
||||
logServer.deviceLog(this.device_code,"open_time" ,String.valueOf(open_time));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time);
|
||||
}
|
||||
if (standby_time != last_standby_time) {
|
||||
logServer.deviceLog(this.device_code,"standby_time" ,String.valueOf(standby_time));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time);
|
||||
}
|
||||
if (production_time != last_production_time) {
|
||||
logServer.deviceLog(this.device_code,"production_time" ,String.valueOf(production_time));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time);
|
||||
}
|
||||
if (error_time != last_error_time) {
|
||||
logServer.deviceLog(this.device_code,"error_time" ,String.valueOf(error_time));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time);
|
||||
}
|
||||
if (close_time != last_close_time) {
|
||||
logServer.deviceLog(this.device_code,"close_time" ,String.valueOf(close_time));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号close_time:" + last_close_time + "->" + close_time);
|
||||
}
|
||||
if (!StrUtil.equals(material,last_material)) {
|
||||
logServer.deviceLog(this.device_code,"barcode", material);
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号material:" + last_material + "->" + material);
|
||||
}
|
||||
if (waitBroken_weight != last_waitBroken_weight) {
|
||||
logServer.deviceLog(this.device_code,"waitBroken_weight" ,String.valueOf(waitBroken_weight));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号waitBroken_weight:" + last_waitBroken_weight + "->" + waitBroken_weight);
|
||||
}
|
||||
if (alreadyBroken_weight != last_alreadyBroken_weight) {
|
||||
logServer.deviceLog(this.device_code,"alreadyBroken_weight" ,String.valueOf(alreadyBroken_weight));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号alreadyBroken_weight:" + last_alreadyBroken_weight + "->" + alreadyBroken_weight);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
|
||||
//急停
|
||||
if (this.isStop()) {
|
||||
|
||||
//未在线无心跳
|
||||
} else if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else if (error != 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "有报警";
|
||||
//无报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
break;
|
||||
case 2:
|
||||
|
||||
break;
|
||||
case 3:
|
||||
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
last_mode = mode;
|
||||
last_status = status;
|
||||
last_error = error;
|
||||
last_open_time = open_time;
|
||||
last_standby_time = standby_time;
|
||||
last_production_time = production_time;
|
||||
last_error_time = error_time;
|
||||
last_close_time = close_time;
|
||||
last_material = material;
|
||||
last_waitBroken_weight = waitBroken_weight;
|
||||
last_alreadyBroken_weight = alreadyBroken_weight;
|
||||
}
|
||||
|
||||
|
||||
protected void thingToNothing() throws Exception {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
return true;
|
||||
} else {
|
||||
log.debug("设备报警");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean exe_business() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
public void writing(String param, String value) {
|
||||
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
|
||||
itemMap.put(to_param, value);
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class ItemProtocol {
|
||||
public static String item_status = "status";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_close_time = "close_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_container_qty = "container_qty";
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ItemProtocol {
|
||||
public static String item_mode = "mode";
|
||||
public static String item_status = "status";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_car_sum = "car_sum";
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ItemProtocol {
|
||||
public static String item_mode = "mode";
|
||||
public static String item_status = "status";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_to_command = "to_command";
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ItemProtocol {
|
||||
public static String item_status = "status";
|
||||
public static String item_error = "error";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_weight = "weight";
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ItemProtocol {
|
||||
public static String item_outKiln_barcode = "outKiln_barcode";
|
||||
public static String item_outKiln_device = "outKiln_device";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_to_command = "to_command";
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ItemProtocol {
|
||||
public static String item_mode = "mode";
|
||||
public static String item_status = "status";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_barcode = "barcode";
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ItemProtocol {
|
||||
public static String item_material = "material";
|
||||
public static String item_qty = "qty";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_order_No = "order_No";
|
||||
|
||||
@@ -120,25 +120,25 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB4.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作状态", "DB4.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB4.B2"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB4.B3"));
|
||||
list.add(new ItemDto(item_ioaction, "进出信号", "DB4.B4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB4.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB4.D6"));
|
||||
list.add(new ItemDto(item_weight, "重量", "DB4.D10"));
|
||||
list.add(new ItemDto(item_material, "物料", "DB4.S14"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "DB4.S270"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB3.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作状态", "DB3.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB3.B2"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB3.B3"));
|
||||
list.add(new ItemDto(item_ioaction, "进出信号", "DB3.B4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB3.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB3.D6"));
|
||||
list.add(new ItemDto(item_weight, "重量", "DB3.D10"));
|
||||
list.add(new ItemDto(item_material, "物料", "DB3.S14"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "DB3.S270"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "DB35.W0", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB35.W2"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB35.D4"));
|
||||
list.add(new ItemDto(item_to_isPackage, "是否包装", "DB35.D8"));
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "DB4.W0", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB4.W2"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB4.D4"));
|
||||
list.add(new ItemDto(item_to_isPackage, "是否包装", "DB4.D8"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,16 +57,16 @@ public class LnshPackageSiteDefination implements OpcDeviceDriverDefination {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
List<ItemDto> list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB4.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB4.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB4.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB4.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "DB4.B4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB4.B5"));
|
||||
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB4.D6"));
|
||||
list.add(new ItemDto(ItemProtocol.item_weight, "重量", "DB4.D10"));
|
||||
list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB4.S14"));
|
||||
list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB4.S270"));
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB3.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB3.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB3.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB3.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "DB3.B4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB3.B5"));
|
||||
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB3.D6"));
|
||||
list.add(new ItemDto(ItemProtocol.item_weight, "重量", "DB3.D10"));
|
||||
list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB3.S14"));
|
||||
list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB3.S270"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ItemProtocol {
|
||||
public static String item_status = "status";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_close_time = "close_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_tray_crib_qty = "tray_crib_qty";
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ItemProtocol {
|
||||
public static String item_material = "material";
|
||||
public static String item_encoder_qty = "encoder_qty";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_product_code = "product_code";
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ItemProtocol {
|
||||
public static String item_status = "status";
|
||||
public static String item_error = "error";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_material = "material";
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ItemProtocol {
|
||||
public static String item_task1 = "task1";
|
||||
public static String item_task2 = "task2";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_to_command = "to_command";
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ItemProtocol {
|
||||
public static String item_getStation = "getStation";
|
||||
public static String item_barcode = "barcode";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time ";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_material = "material";
|
||||
|
||||
@@ -14,6 +14,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device_driver.electric_fence.ElectricFenceDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_crusher.LnshCrusherDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.LnshFoldDiscSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_kiln_lane.LnshKilnLaneDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_kiln_truss.LnshKilnTrussDeviceDriver;
|
||||
@@ -373,6 +374,8 @@ public class StageActorServiceImpl implements StageActorService {
|
||||
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver;
|
||||
//晟华-包装线工位
|
||||
LnshPackageSiteDeviceDriver lnshPackageSiteDeviceDriver;
|
||||
//晟华-破碎机
|
||||
LnshCrusherDeviceDriver lnshCrusherDeviceDriver;
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
@@ -737,7 +740,6 @@ public class StageActorServiceImpl implements StageActorService {
|
||||
}
|
||||
obj.put("device_name", standardOrdinarySiteDeviceDriver.getDevice().getDevice_name());
|
||||
jo.put("move", move);
|
||||
jo.put("container", standardOrdinarySiteDeviceDriver.getContainer());
|
||||
jo.put("hasGoods", standardOrdinarySiteDeviceDriver.getHasGoods());
|
||||
jo.put("isOnline", true);
|
||||
//点击弹出
|
||||
@@ -1627,6 +1629,41 @@ public class StageActorServiceImpl implements StageActorService {
|
||||
jo.put("standby_time", lnshRGVDeviceDriver.getStandby_time());
|
||||
jo.put("production_time", lnshRGVDeviceDriver.getProduction_time());
|
||||
jo.put("error_time", lnshRGVDeviceDriver.getError_time());
|
||||
} else if (device.getDeviceDriver() instanceof LnshCrusherDeviceDriver) {
|
||||
lnshCrusherDeviceDriver = (LnshCrusherDeviceDriver) device.getDeviceDriver();
|
||||
if (lnshCrusherDeviceDriver.getMode() == 0) {
|
||||
mode = "未联机";
|
||||
} else if (lnshCrusherDeviceDriver.getMode() == 1) {
|
||||
mode = "单机";
|
||||
} else if (lnshCrusherDeviceDriver.getMode() == 2) {
|
||||
mode = "联机";
|
||||
} else if (lnshCrusherDeviceDriver.getMode() == 3) {
|
||||
mode = "运行中";
|
||||
}
|
||||
|
||||
if (lnshCrusherDeviceDriver.getStatus() == 1) {
|
||||
status = "待机";
|
||||
} else if (lnshCrusherDeviceDriver.getStatus() == 2) {
|
||||
status = "生产中";
|
||||
} else if (lnshCrusherDeviceDriver.getStatus() == 3) {
|
||||
status = "故障";
|
||||
}
|
||||
|
||||
obj.put("device_name", lnshCrusherDeviceDriver.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("status", status);
|
||||
jo.put("error", lnshCrusherDeviceDriver.getError());
|
||||
jo.put("isOnline", lnshCrusherDeviceDriver.getIsonline());
|
||||
jo.put("open_time", lnshCrusherDeviceDriver.getOpen_time());
|
||||
jo.put("standby_time", lnshCrusherDeviceDriver.getStandby_time());
|
||||
jo.put("production_time", lnshCrusherDeviceDriver.getProduction_time());
|
||||
jo.put("error_time", lnshCrusherDeviceDriver.getError_time());
|
||||
jo.put("close_time", lnshCrusherDeviceDriver.getClose_time());
|
||||
jo.put("material", lnshCrusherDeviceDriver.getMaterial());
|
||||
jo.put("waitBroken_weight", lnshCrusherDeviceDriver.getWaitBroken_weight());
|
||||
jo.put("alreadyBroken_weight", lnshCrusherDeviceDriver.getAlreadyBroken_weight());
|
||||
jo.put("isError", lnshCrusherDeviceDriver.getIserror());
|
||||
jo.put("message", lnshCrusherDeviceDriver.getMessage());
|
||||
}
|
||||
obj.put("data", jo);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<el-select
|
||||
v-model="form.driver_code"
|
||||
placeholder=""
|
||||
filterable
|
||||
@change="changeDriver"
|
||||
>
|
||||
<el-option
|
||||
@@ -118,6 +119,7 @@ import lnsh_package_pallet_manipulator from '@/views/acs/device/driver/lnsh/lnsh
|
||||
import lnsh_station from '@/views/acs/device/driver/lnsh/lnsh_station'
|
||||
import lnsh_Laminating_machine from '@/views/acs/device/driver/lnsh/lnsh_Laminating_machine'
|
||||
import lnsh_package_site from '@/views/acs/device/driver/lnsh/lnsh_package_site'
|
||||
import lnsh_crusher from '@/views/acs/device/driver/lnsh/lnsh_crusher'
|
||||
|
||||
export default {
|
||||
name: 'DeviceConfig',
|
||||
@@ -129,7 +131,7 @@ export default {
|
||||
standard_photoelectric_inspect_site, ndxy_special, hailiang_labeling, ndxy_special_two, whxr_storage_conveyor, whxr_ball_mill, whxr_spary_tower, whxr_weight,
|
||||
electric_fence, lnsh_mixing_mill, lnsh_press, lnsh_palletizing_manipulator, lnsh_fold_disc_site, lnsh_kiln_lane, lnsh_kiln_truss,
|
||||
lnsh_package_line, lnsh_out_kiln_truss, lnsh_package_pallet_manipulator, lnsh_pallet_storage, lnsh_labeling_machine, lnsh_split_manipulator, lnsh_rgv,
|
||||
lnsh_station, lnsh_Laminating_machine, lnsh_package_site },
|
||||
lnsh_station, lnsh_Laminating_machine, lnsh_package_site, lnsh_crusher },
|
||||
dicts: ['device_type'],
|
||||
mixins: [crud],
|
||||
data() {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
474
acs/qd/src/views/acs/device/driver/lnsh/lnsh_crusher.vue
Normal file
474
acs/qd/src/views/acs/device/driver/lnsh/lnsh_crusher.vue
Normal file
@@ -0,0 +1,474 @@
|
||||
<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="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: 'LnshCrusher',
|
||||
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('heartbeat') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) - 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('status') !== -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) + 2)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('open_time') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 3)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('standby_time') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('production_time') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 11)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error_time') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 15)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('close_time') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 19)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('material') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'S' + (parseInt(endNumber) + 23)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('waitBroken_weight') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 279)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('alreadyBroken_weight') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 283)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
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_error') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
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_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>
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
@@ -358,17 +359,41 @@ export default {
|
||||
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)
|
||||
// }
|
||||
// }
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('heartbeat') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) - 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('status') !== -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) + 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('open_time') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 3)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('standby_time') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('production_time') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 11)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error_time') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 15)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('weight') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 19)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('order_No') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'S' + (parseInt(endNumber) + 23)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('mix_num') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 279)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('material') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'S' + (parseInt(endNumber) + 283)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
finishWriteEdit(data) {
|
||||
@@ -385,14 +410,20 @@ export default {
|
||||
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)
|
||||
// }
|
||||
// }
|
||||
for (const val in this.data2) {
|
||||
if (this.data2[val].code.indexOf('to_error') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_order_No') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'S' + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_weight') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 260)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_material_code') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'S' + (parseInt(endNumber) + 264)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changeOpc(val) {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
@@ -324,6 +325,9 @@ export default {
|
||||
return
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('heartbeat') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) - 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||
}
|
||||
@@ -334,19 +338,19 @@ export default {
|
||||
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) + 5)
|
||||
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) + 8)
|
||||
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) + 12)
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 9)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('material') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 16)
|
||||
this.data1[val].db = beforeStr + '.' + 'S' + (parseInt(endNumber) + 13)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('barcode') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 66)
|
||||
this.data1[val].db = beforeStr + '.' + 'S' + (parseInt(endNumber) + 269)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -370,7 +374,10 @@ export default {
|
||||
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)
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_isPackage') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
@@ -324,6 +325,9 @@ export default {
|
||||
return
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('heartbeat') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) - 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||
}
|
||||
|
||||
@@ -359,6 +359,9 @@ export default {
|
||||
return
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('heartbeat') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) - 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<el-select
|
||||
v-model="query.opc_id"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
placeholder="Server"
|
||||
class="filter-item"
|
||||
|
||||
@@ -435,6 +435,12 @@ export default {
|
||||
} else if (val === 'container_type') {
|
||||
const obj = { name: '托盘类型', value: data[val] }
|
||||
arr.push(obj)
|
||||
} else if (val === 'waitBroken_weight') {
|
||||
const obj = { name: '待破碎重量', value: data[val] }
|
||||
arr.push(obj)
|
||||
} else if (val === 'alreadyBroken_weight') {
|
||||
const obj = { name: '已破碎重量', value: data[val] }
|
||||
arr.push(obj)
|
||||
}
|
||||
/* else {
|
||||
const obj = { name: val, value: data[val] }
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
v-model="form.device_code"
|
||||
filterable
|
||||
clearable
|
||||
reserveKeyword
|
||||
multiple
|
||||
placeholder="请选择"
|
||||
style="width: 370px;"
|
||||
@@ -107,6 +108,7 @@
|
||||
<el-select
|
||||
v-model="form.next_device_code"
|
||||
filterable
|
||||
reserveKeyword
|
||||
clearable
|
||||
multiple
|
||||
placeholder="请选择"
|
||||
|
||||
Reference in New Issue
Block a user