add: 电梯驱动
This commit is contained in:
@@ -247,6 +247,15 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
inst.setInstruction_status("2");
|
||||||
|
try {
|
||||||
|
instructionService.finish(inst);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -290,17 +299,17 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
if (device.getDeviceDriver() instanceof LiftDoorDeviceDriver) {
|
if (device.getDeviceDriver() instanceof LiftDoorDeviceDriver) {
|
||||||
liftDoorDeviceDriver = (LiftDoorDeviceDriver) device.getDeviceDriver();
|
liftDoorDeviceDriver = (LiftDoorDeviceDriver) device.getDeviceDriver();
|
||||||
try {
|
try {
|
||||||
liftDoorDeviceDriver.writing("to_open1", "1");
|
liftDoorDeviceDriver.writing("to_open", "1");
|
||||||
liftDoorDeviceDriver.writing("to_close1", "0");
|
liftDoorDeviceDriver.writing("to_close", "0");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("下发电梯门电气信号失败:" + e.getMessage());
|
log.info("下发电梯门电气信号失败:" + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (liftDoorDeviceDriver.getOpen1() == 1 && liftDoorDeviceDriver.getToOpen1() == 1 ) {
|
if (liftDoorDeviceDriver.getOpen() == 1 && liftDoorDeviceDriver.getToOpen() == 1 ) {
|
||||||
log.info("下发电梯门开门信号值为:{},读取开门信号值为:{}", liftDoorDeviceDriver.getToOpen1(), liftDoorDeviceDriver.getOpen1());
|
log.info("下发电梯门开门信号值为:{},读取开门信号值为:{}", liftDoorDeviceDriver.getToOpen(), liftDoorDeviceDriver.getOpen());
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||||
} else {
|
} else {
|
||||||
log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", liftDoorDeviceDriver.getToOpen1(), liftDoorDeviceDriver.getOpen1());
|
log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", liftDoorDeviceDriver.getToOpen(), liftDoorDeviceDriver.getOpen());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.sun.xml.bind.v2.TODO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -557,7 +558,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||||
try {
|
try {
|
||||||
// manipulatorAgvStationDeviceDriver.writing(3);
|
manipulatorAgvStationDeviceDriver.writing(3);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -996,7 +997,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
String start_device_code2 = inst.getStart_device_code2();
|
String start_device_code2 = inst.getStart_device_code2();
|
||||||
String next_device_code2 = inst.getNext_device_code2();
|
String next_device_code2 = inst.getNext_device_code2();
|
||||||
//取空锟或去烘箱放货的时候需要请求进入
|
//取空锟或去烘箱放货的时候需要请求进入
|
||||||
if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, start_device_code)) {
|
|
||||||
if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||||
try {
|
try {
|
||||||
@@ -1018,7 +1018,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "mode信号:" + manipulatorAgvStationDeviceDriver.getMode() + "光电信号:" + manipulatorAgvStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件";
|
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "mode信号:" + manipulatorAgvStationDeviceDriver.getMode() + "光电信号:" + manipulatorAgvStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件";
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
.device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
|
.device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
|
||||||
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
|
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "不满足取货条件")
|
||||||
.build();
|
.build();
|
||||||
logDto.setLog_level(4);
|
logDto.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
@@ -1043,117 +1043,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code)) {
|
|
||||||
if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
|
||||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
|
||||||
|
|
||||||
try {
|
|
||||||
manipulatorAgvStationDeviceDriver.writing(4);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(this.getDeviceCode())
|
|
||||||
.content("agvphase:" + phase + "反馈:" + data)
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
} else {
|
|
||||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
|
|
||||||
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, start_device_code2)) {
|
|
||||||
if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
|
||||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
|
||||||
|
|
||||||
try {
|
|
||||||
manipulatorAgvStationDeviceDriver.writing(4);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(this.getDeviceCode())
|
|
||||||
.content("agvphase:" + phase + "反馈:" + data)
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
} else {
|
|
||||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(this.getDeviceCode())
|
|
||||||
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code2)) {
|
|
||||||
if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
|
||||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
|
||||||
try {
|
|
||||||
manipulatorAgvStationDeviceDriver.writing(6);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("ignore_release_check"))
|
|
||||||
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("ignore_release_check").toString())) {
|
|
||||||
if (manipulatorAgvStationDeviceDriver.getAction() == 1 && manipulatorAgvStationDeviceDriver.getMode() == 2 && manipulatorAgvStationDeviceDriver.getMove() == 0) {
|
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(this.getDeviceCode())
|
|
||||||
.content("agvphase:" + phase + "反馈:" + data)
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
} else {
|
|
||||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "mode信号:" + manipulatorAgvStationDeviceDriver.getMode() + "光电信号:" + manipulatorAgvStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件";
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
|
|
||||||
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(this.getDeviceCode())
|
|
||||||
.content("agvphase:" + phase + "反馈:" + data)
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
} else {
|
|
||||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
|
|
||||||
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// else {
|
|
||||||
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
|
||||||
// LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
// .device_code(this.getDeviceCode())
|
|
||||||
// .content("agvphase:" + phase + "反馈:" + data)
|
|
||||||
// .build();
|
|
||||||
// logDto.setLog_level(4);
|
|
||||||
// luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
//请求离开
|
//请求离开
|
||||||
else if (phase == 0x4E) {
|
else if (phase == 0x4E) {
|
||||||
@@ -1227,6 +1117,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取货完毕
|
// 取货完毕
|
||||||
@@ -2089,42 +1980,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
//申请烘箱行架任务
|
//申请烘箱行架任务
|
||||||
if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task"))
|
if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task"))
|
||||||
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task").toString())) {
|
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task").toString())) {
|
||||||
if (manipulatorAgvStationDeviceDriver.getTo_command() != 4) {
|
|
||||||
String task_code = inst.getTask_code();
|
String task_code = inst.getTask_code();
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("task_code", task_code);
|
jsonObject.put("task_code", task_code);
|
||||||
String response = acsToWmsService.applyOvenGantryTask(jsonObject);
|
String response = acsToWmsService.applyOvenGantryTask(jsonObject);
|
||||||
JSONObject jo = JSON.parseObject(response);
|
JSONObject jo = JSON.parseObject(response);
|
||||||
if (jo.getInteger("status") == 200) {
|
if (jo.getInteger("status") == 200) {
|
||||||
log.info("申请烘箱行架任务成功返回参数:"+ jo);
|
log.info("申请烘箱行架任务成功返回参数:" + jo);
|
||||||
try {
|
try {
|
||||||
manipulatorAgvStationDeviceDriver.writing(4);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.info("申请烘箱行架任务失败返回参数:"+ jo);
|
log.info("申请烘箱行架任务失败返回参数:" + jo);
|
||||||
}
|
}
|
||||||
}
|
manipulatorAgvStationDeviceDriver.writing(4);
|
||||||
//行架取货完成后反馈ndc
|
|
||||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 2)) {
|
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(this.getDeviceCode())
|
|
||||||
.content("agvphase:" + phase + "反馈:" + data)
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
} else {
|
} else {
|
||||||
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", manipulatorAgvStationDeviceDriver.getDeviceCode(), manipulatorAgvStationDeviceDriver.getAction(), ikey);
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
|
|
||||||
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
try {
|
try {
|
||||||
manipulatorAgvStationDeviceDriver.writing(4);
|
manipulatorAgvStationDeviceDriver.writing(4);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class AirShowerDoorDefination implements OpcDeviceDriverDefination {
|
|||||||
@Override
|
@Override
|
||||||
public List<DeviceType> getFitDeviceTypes() {
|
public List<DeviceType> getFitDeviceTypes() {
|
||||||
List<DeviceType> types = new LinkedList();
|
List<DeviceType> types = new LinkedList();
|
||||||
types.add(DeviceType.conveyor);
|
types.add(DeviceType.autodoor);
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package org.nl.acs.device_driver.autodoor.fast_door;
|
||||||
|
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快卷门驱动定义
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FastDoorDefination implements OpcDeviceDriverDefination {
|
||||||
|
@Override
|
||||||
|
public String getDriverCode() {
|
||||||
|
return "fast_door";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverName() {
|
||||||
|
return "快卷门";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverDescription() {
|
||||||
|
return "快卷门";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceDriver getDriverInstance(Device device) {
|
||||||
|
return (new FastDoorDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||||
|
return FastDoorDeviceDriver.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceType> getFitDeviceTypes() {
|
||||||
|
List<DeviceType> types = new LinkedList();
|
||||||
|
types.add(DeviceType.autodoor);
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getReadableItemDtos() {
|
||||||
|
return ItemProtocol.getReadableItemDtos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getWriteableItemDtos() {
|
||||||
|
return ItemProtocol.getWriteableItemDtos();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
package org.nl.acs.device_driver.autodoor.fast_door;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
|
import org.nl.acs.utils.ReadUtil;
|
||||||
|
import org.nl.config.SpringContextHolder;
|
||||||
|
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||||
|
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||||
|
import org.openscada.opc.lib.da.Server;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快卷门驱动
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class FastDoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor {
|
||||||
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
protected ToDoorCommandControl toDoorCommandControl = new ToDoorCommandControl(this);
|
||||||
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||||
|
|
||||||
|
int open = 0;
|
||||||
|
int close = 0;
|
||||||
|
|
||||||
|
int last_open = 0;
|
||||||
|
int last_close = 0;
|
||||||
|
|
||||||
|
int toOpen = 0;
|
||||||
|
int last_toOpen = 0;
|
||||||
|
int toClose = 0;
|
||||||
|
int last_toClose = 0;
|
||||||
|
String device_code = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice() {
|
||||||
|
return this.device;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
String message = null;
|
||||||
|
|
||||||
|
device_code = this.getDevice().getDevice_code();
|
||||||
|
open = this.itemProtocol.getOpen();
|
||||||
|
close = this.itemProtocol.getClose();
|
||||||
|
toOpen = this.itemProtocol.getToOpen();
|
||||||
|
toClose = this.itemProtocol.getToClose();
|
||||||
|
if (open != last_open) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open + "->" + open);
|
||||||
|
}
|
||||||
|
if (close != last_close) {
|
||||||
|
if(close ==1 ){
|
||||||
|
this.writing("to_close","0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
last_open = open;
|
||||||
|
last_close = close;
|
||||||
|
last_toClose = toClose;
|
||||||
|
last_toOpen = toOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void writing(String param, String value) {
|
||||||
|
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + param;
|
||||||
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
itemMap.put(to_param, Integer.parseInt(value));
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(device_code)
|
||||||
|
.content("下发多个电气信号" + itemMap)
|
||||||
|
.build();
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
try {
|
||||||
|
this.toDoorCommandControl.control(param,value);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writing(String param, int command) {
|
||||||
|
String to_command = String.format("%s.%s.%s.%s", 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_command, command);
|
||||||
|
ReadUtil.write(itemMap, server);
|
||||||
|
log.info("下发PLC信号:{},{}", to_command, command);
|
||||||
|
System.out.println("设备:" + this.device_code + ",下发PLC信号:" + to_command + ",value:" + command);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getDeviceStatusName() {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
String open = "";
|
||||||
|
String close = "";
|
||||||
|
if (this.getOpen() == 0) {
|
||||||
|
open = "未知";
|
||||||
|
} else if (this.getOpen() == 1) {
|
||||||
|
open = "开到位";
|
||||||
|
}
|
||||||
|
if (this.getClose() == 0) {
|
||||||
|
open = "未知";
|
||||||
|
} else if (this.getClose() == 1) {
|
||||||
|
open = "关到位";
|
||||||
|
}
|
||||||
|
jo.put("device_name", this.getDevice().getDevice_name());
|
||||||
|
jo.put("open", open);
|
||||||
|
jo.put("close", close);
|
||||||
|
jo.put("isOnline", true);
|
||||||
|
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDeviceStatus(JSONObject data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package org.nl.acs.device_driver.autodoor.fast_door;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class ItemProtocol {
|
||||||
|
public static String item_open = "open";
|
||||||
|
public static String item_close = "close";
|
||||||
|
public static String item_to_stop = "stop";
|
||||||
|
public static String item_to_relieve_stop = "to_relieve_stop";
|
||||||
|
public static String item_to_open = "to_open";
|
||||||
|
public static String item_to_close = "to_close";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private FastDoorDeviceDriver driver;
|
||||||
|
|
||||||
|
public ItemProtocol(FastDoorDeviceDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOpen() {
|
||||||
|
return this.getOpcIntegerValue(item_open);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getClose() {
|
||||||
|
return this.getOpcIntegerValue(item_close);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getToOpen() {
|
||||||
|
return this.getOpcIntegerValue(item_to_open);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getToClose() {
|
||||||
|
return this.getOpcIntegerValue(item_to_close);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOpcIntegerValue(String protocol) {
|
||||||
|
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||||
|
if (value == null) {
|
||||||
|
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpcStringValue(String protocol) {
|
||||||
|
String value = this.driver.getStringValue(protocol);
|
||||||
|
if (StrUtil.isEmpty(value)) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getReadableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
list.add(new ItemDto(item_open, "开到位", "10001"));
|
||||||
|
list.add(new ItemDto(item_close, "关到位", "10002"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getWriteableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
list.add(new ItemDto(item_to_open, "下发开门", "00001" ));
|
||||||
|
list.add(new ItemDto(item_to_close, "下发关门", "00002"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package org.nl.acs.device_driver.autodoor.fast_door;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ToDoorCommandControl {
|
||||||
|
|
||||||
|
private FastDoorDeviceDriver driver;
|
||||||
|
|
||||||
|
public ToDoorCommandControl(FastDoorDeviceDriver driver){
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void control(String param, String value) throws Exception {
|
||||||
|
// ItemValue[] itemValues = new ItemValue[]{new ItemValue(this.driver.getItem(ItemProtocol.item_to_command), command)};
|
||||||
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
String to_param = this.driver.getDevice().getOpc_server_code() + "." + this.driver.getDevice().getOpc_plc_code() + "." + this.driver.getDevice().getDevice_code()
|
||||||
|
+ "."+ param;
|
||||||
|
itemMap.put(to_param, Integer.parseInt(value));
|
||||||
|
try {
|
||||||
|
this.driver.checkcontrol(itemMap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,27 +22,30 @@ public class ItemProtocol {
|
|||||||
//机器人状态
|
//机器人状态
|
||||||
public static String item_robot_status = "lift_robot_status";
|
public static String item_robot_status = "lift_robot_status";
|
||||||
|
|
||||||
//主门开到位
|
//门开到位
|
||||||
public static String item_open1 = "open";
|
public static String item_open = "open";
|
||||||
|
|
||||||
|
|
||||||
|
//门关到位
|
||||||
|
public static String item_close = "close";
|
||||||
|
|
||||||
//主门关到位
|
|
||||||
public static String item_close1 = "close1";
|
|
||||||
|
|
||||||
//主门关到位
|
|
||||||
public static String item_close2 = "close2";
|
|
||||||
|
|
||||||
//楼层
|
//楼层
|
||||||
public static String item_floor= "floor";
|
public static String item_floor= "floor";
|
||||||
|
|
||||||
//开主门
|
|
||||||
public static String item_to_open1 = "to_open1";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String item_to_call= "to_call";
|
public static String item_to_call= "to_call";
|
||||||
|
|
||||||
|
//开门
|
||||||
|
public static String item_to_open = "to_open";
|
||||||
|
|
||||||
|
//关门
|
||||||
|
public static String item_to_close = "to_close";
|
||||||
|
|
||||||
|
//报警
|
||||||
|
public static String item_error = "error";
|
||||||
|
|
||||||
|
|
||||||
private LiftDoorDeviceDriver driver;
|
private LiftDoorDeviceDriver driver;
|
||||||
|
|
||||||
public ItemProtocol(LiftDoorDeviceDriver driver) {
|
public ItemProtocol(LiftDoorDeviceDriver driver) {
|
||||||
@@ -51,8 +54,8 @@ public class ItemProtocol {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int getOpen1() {
|
public int getOpen() {
|
||||||
return this.getOpcIntegerValue(item_open1);
|
return this.getOpcIntegerValue(item_open);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLiftStatus() {
|
public int getLiftStatus() {
|
||||||
@@ -71,18 +74,13 @@ public class ItemProtocol {
|
|||||||
return this.getOpcIntegerValue(item_to_call);
|
return this.getOpcIntegerValue(item_to_call);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getClose2() {
|
|
||||||
return this.getOpcIntegerValue(item_close2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getClose1() {
|
public int getClose() {
|
||||||
return this.getOpcIntegerValue(item_close1);
|
return this.getOpcIntegerValue(item_close);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getToOpen1() {
|
|
||||||
return this.getOpcIntegerValue(item_to_open1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int getHeartbeat() {
|
public int getHeartbeat() {
|
||||||
@@ -118,20 +116,21 @@ public class ItemProtocol {
|
|||||||
public static List<ItemDto> getReadableItemDtos() {
|
public static List<ItemDto> getReadableItemDtos() {
|
||||||
ArrayList list = new ArrayList();
|
ArrayList list = new ArrayList();
|
||||||
list.add(new ItemDto(item_heartbeat, "心跳", "10003"));
|
list.add(new ItemDto(item_heartbeat, "心跳", "10003"));
|
||||||
list.add(new ItemDto(item_open1, "主开到位", "10001"));
|
list.add(new ItemDto(item_open, "门开到位", "10001"));
|
||||||
list.add(new ItemDto(item_close1, "主关到位", "10002"));
|
list.add(new ItemDto(item_close, "门关到位", "10002"));
|
||||||
list.add(new ItemDto(item_close2, "副关到位", "10002"));
|
|
||||||
list.add(new ItemDto(item_mode, "工作模式", "10004"));
|
list.add(new ItemDto(item_mode, "工作模式", "10004"));
|
||||||
list.add(new ItemDto(item_lift_status, "状态(拥挤 空闲 一般)", "10002"));
|
list.add(new ItemDto(item_lift_status, "状态(拥挤 空闲 一般)", "10002"));
|
||||||
list.add(new ItemDto(item_robot_status, "机器人状态", "10002"));
|
list.add(new ItemDto(item_robot_status, "机器人状态", "10002"));
|
||||||
list.add(new ItemDto(item_floor, "楼层", "10002"));
|
list.add(new ItemDto(item_floor, "楼层", "10002"));
|
||||||
|
list.add(new ItemDto(item_error, "异常", "10002"));
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ItemDto> getWriteableItemDtos() {
|
public static List<ItemDto> getWriteableItemDtos() {
|
||||||
ArrayList list = new ArrayList();
|
ArrayList list = new ArrayList();
|
||||||
list.add(new ItemDto(item_to_open1, "下发开主门", "10002"));
|
list.add(new ItemDto(item_to_open, "下发开门", "10002"));
|
||||||
|
list.add(new ItemDto(item_to_close, "下发关门", "00002"));
|
||||||
list.add(new ItemDto(item_to_call, "呼叫", "10002"));
|
list.add(new ItemDto(item_to_call, "呼叫", "10002"));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.util.List;
|
|||||||
public class LiftDoorDefination implements OpcDeviceDriverDefination {
|
public class LiftDoorDefination implements OpcDeviceDriverDefination {
|
||||||
@Override
|
@Override
|
||||||
public String getDriverCode() {
|
public String getDriverCode() {
|
||||||
return "standard_autodoor";
|
return "lift_door";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,7 +45,7 @@ public class LiftDoorDefination implements OpcDeviceDriverDefination {
|
|||||||
@Override
|
@Override
|
||||||
public List<DeviceType> getFitDeviceTypes() {
|
public List<DeviceType> getFitDeviceTypes() {
|
||||||
List<DeviceType> types = new LinkedList();
|
List<DeviceType> types = new LinkedList();
|
||||||
types.add(DeviceType.conveyor);
|
types.add(DeviceType.autodoor);
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ public class LiftDoorDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
|||||||
@Autowired
|
@Autowired
|
||||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||||
|
|
||||||
int open1 = 0;
|
int open = 0;
|
||||||
int close1 = 0;
|
int close = 0;
|
||||||
int last_open1 = 0;
|
int last_open = 0;
|
||||||
int last_close1 = 0;
|
int last_close = 0;
|
||||||
int toOpen1 = 0;
|
int toOpen = 0;
|
||||||
int last_toOpen1 = 0;
|
int last_toOpen = 0;
|
||||||
int toClose = 0;
|
int toClose = 0;
|
||||||
int last_toClose = 0;
|
int last_toClose = 0;
|
||||||
String device_code = null;
|
String device_code = null;
|
||||||
@@ -55,22 +55,23 @@ public class LiftDoorDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
|||||||
String message = null;
|
String message = null;
|
||||||
|
|
||||||
device_code = this.getDevice().getDevice_code();
|
device_code = this.getDevice().getDevice_code();
|
||||||
open1 = this.itemProtocol.getOpen1();
|
open = this.itemProtocol.getOpen();
|
||||||
close1 = this.itemProtocol.getClose1();
|
close = this.itemProtocol.getClose();
|
||||||
toOpen1 = this.itemProtocol.getToOpen1();
|
|
||||||
|
|
||||||
if (open1 != last_open1) {
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open1 + "->" + open1);
|
if (open != last_open) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open + "->" + open);
|
||||||
}
|
}
|
||||||
if (close1 != last_close1) {
|
if (close != last_close) {
|
||||||
if(close1 ==1 ){
|
if(close ==1 ){
|
||||||
this.writing("to_close","0");
|
this.writing("to_close","0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
last_open1 = open1;
|
last_open = open;
|
||||||
last_close1 = close1;
|
last_close = close;
|
||||||
last_toOpen1 = toOpen1;
|
last_toOpen = toOpen;
|
||||||
|
last_toClose = toClose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -109,14 +110,14 @@ public class LiftDoorDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
|||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
String open = "";
|
String open = "";
|
||||||
String close = "";
|
String close = "";
|
||||||
if (this.getOpen1() == 0) {
|
if (this.getOpen() == 0) {
|
||||||
open = "未知";
|
open = "未知";
|
||||||
} else if (this.getOpen1() == 1) {
|
} else if (this.getOpen() == 1) {
|
||||||
open = "开到位";
|
open = "开到位";
|
||||||
}
|
}
|
||||||
if (this.getClose1() == 0) {
|
if (this.getClose() == 0) {
|
||||||
open = "未知";
|
open = "未知";
|
||||||
} else if (this.getClose1() == 1) {
|
} else if (this.getClose() == 1) {
|
||||||
open = "关到位";
|
open = "关到位";
|
||||||
}
|
}
|
||||||
jo.put("device_name", this.getDevice().getDevice_name());
|
jo.put("device_name", this.getDevice().getDevice_name());
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class StandardAutodoorDefination implements OpcDeviceDriverDefination {
|
|||||||
@Override
|
@Override
|
||||||
public List<DeviceType> getFitDeviceTypes() {
|
public List<DeviceType> getFitDeviceTypes() {
|
||||||
List<DeviceType> types = new LinkedList();
|
List<DeviceType> types = new LinkedList();
|
||||||
types.add(DeviceType.conveyor);
|
types.add(DeviceType.autodoor);
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -544,7 +544,19 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
Device lift2 = deviceAppService.findDeviceByCode(linkDeviceCode.get(1));
|
Device lift2 = deviceAppService.findDeviceByCode(linkDeviceCode.get(1));
|
||||||
if (lift1.getDeviceDriver() instanceof LiftDoorDeviceDriver && lift2.getDeviceDriver() instanceof LiftDoorDeviceDriver){
|
if (lift1.getDeviceDriver() instanceof LiftDoorDeviceDriver && lift2.getDeviceDriver() instanceof LiftDoorDeviceDriver){
|
||||||
// if (lift1.getDeviceDriver().get)
|
// if (lift1.getDeviceDriver().get)
|
||||||
dto.setNext_device_code(lift1.getDevice_code());
|
String nextLift1 = dto.getNext_device_code()+"_"+lift1.getDevice_code();
|
||||||
|
String nextLift2 = dto.getNext_device_code()+"_"+lift2.getDevice_code();
|
||||||
|
|
||||||
|
List<TaskDto> byStarCodeAndExcute1 = taskService.findByNextCodeAndExcute(nextLift1);
|
||||||
|
List<TaskDto> byStarCodeAndExcute2 = taskService.findByNextCodeAndExcute(nextLift2);
|
||||||
|
if (byStarCodeAndExcute1.size() <= byStarCodeAndExcute2.size() ) {
|
||||||
|
// if (lift1.getDeviceDriver()){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
dto.setNext_device_code(nextLift1);
|
||||||
|
} else {
|
||||||
|
dto.setNext_device_code(nextLift2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -556,4 +556,12 @@ public interface TaskService extends CommonService<Task> {
|
|||||||
TaskDto findByTaskCode(String task_code);
|
TaskDto findByTaskCode(String task_code);
|
||||||
|
|
||||||
List<TaskDto> queryAllHJReadyTask();
|
List<TaskDto> queryAllHJReadyTask();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据终点查询就绪执行中的任务
|
||||||
|
* @param nextLift1
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TaskDto> findByNextCodeAndExcute(String nextLift1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -971,6 +971,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
routeLineService.getShortPathLines(
|
routeLineService.getShortPathLines(
|
||||||
start_device_code, acsTask.getNext_device_code(), route_plan_code);
|
start_device_code, acsTask.getNext_device_code(), route_plan_code);
|
||||||
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||||
|
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||||
String path = routeLineDto.getPath();
|
String path = routeLineDto.getPath();
|
||||||
String type = routeLineDto.getType();
|
String type = routeLineDto.getType();
|
||||||
@@ -980,7 +981,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
for (int m = 0; m < pathlist.size(); m++) {
|
for (int m = 0; m < pathlist.size(); m++) {
|
||||||
if (pathlist.get(m).equals(start_device_code)) {
|
if (pathlist.get(m).equals(start_device_code)) {
|
||||||
//起点为货架跳过堆垛机
|
//起点为货架跳过堆垛机
|
||||||
if (startDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
if (startDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver || nextDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver ) {
|
||||||
index = m + 2;
|
index = m + 2;
|
||||||
}else {
|
}else {
|
||||||
index = m + 1;
|
index = m + 1;
|
||||||
@@ -1660,6 +1661,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TaskDto> findByNextCodeAndExcute(String nextLift) {
|
||||||
|
List<TaskDto> taskDtoList = tasks.stream()
|
||||||
|
.filter(task -> StrUtil.equals(task.getStart_device_code(), nextLift)
|
||||||
|
&& (StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex()) || StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex()))).collect(Collectors.toList());
|
||||||
|
return taskDtoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 把多个字符串拼接的inst_nextDevice_code解析成集合
|
* 把多个字符串拼接的inst_nextDevice_code解析成集合
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 8011
|
port: 8012
|
||||||
#配置数据源
|
#配置数据源
|
||||||
spring:
|
spring:
|
||||||
messages:
|
messages:
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
ENV = 'development'
|
ENV = 'development'
|
||||||
|
|
||||||
# 接口地址
|
# 接口地址
|
||||||
VUE_APP_BASE_API = 'http://localhost:8011'
|
VUE_APP_BASE_API = 'http://localhost:8012'
|
||||||
VUE_APP_WS_API = 'ws://localhost:8011'
|
VUE_APP_WS_API = 'ws://localhost:8012'
|
||||||
|
|
||||||
# 是否启用 babel-plugin-dynamic-import-node插件
|
# 是否启用 babel-plugin-dynamic-import-node插件
|
||||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||||
|
|||||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
window.g = {
|
window.g = {
|
||||||
dev: {
|
dev: {
|
||||||
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
|
VUE_APP_BASE_API: 'http://127.0.0.1:8012'
|
||||||
},
|
},
|
||||||
prod: {
|
prod: {
|
||||||
VUE_APP_BASE_API: 'http://10.1.3.96:8011'
|
VUE_APP_BASE_API: 'http://10.1.3.96:8011'
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ import crud from '@/mixins/crud'
|
|||||||
import { get, selectDriverCodeList } from '@/api/acs/device/driverConfig'
|
import { get, selectDriverCodeList } from '@/api/acs/device/driverConfig'
|
||||||
import { getDicts } from '@/views/system/dict/dict'
|
import { getDicts } from '@/views/system/dict/dict'
|
||||||
import standard_autodoor from '@/views/acs/device/driver/standard_autodoor'
|
import standard_autodoor from '@/views/acs/device/driver/standard_autodoor'
|
||||||
|
import air_shower_door from '@/views/acs/device/driver/air_shower_door'
|
||||||
|
import fast_door from '@/views/acs/device/driver/fast_door'
|
||||||
|
import lift_door from '@/views/acs/device/driver/lift_door'
|
||||||
import standard_inspect_site from './driver/standard_inspect_site'
|
import standard_inspect_site from './driver/standard_inspect_site'
|
||||||
import ranging_stations from './driver/ranging_stations'
|
import ranging_stations from './driver/ranging_stations'
|
||||||
import standard_ordinary_site from './driver/standard_ordinary_site'
|
import standard_ordinary_site from './driver/standard_ordinary_site'
|
||||||
@@ -144,6 +147,9 @@ export default {
|
|||||||
name: 'DeviceConfig',
|
name: 'DeviceConfig',
|
||||||
components: {
|
components: {
|
||||||
standard_autodoor,
|
standard_autodoor,
|
||||||
|
air_shower_door,
|
||||||
|
fast_door,
|
||||||
|
lift_door,
|
||||||
standard_ordinary_site,
|
standard_ordinary_site,
|
||||||
standard_inspect_site,
|
standard_inspect_site,
|
||||||
standard_storage,
|
standard_storage,
|
||||||
|
|||||||
413
acs2/nladmin-ui/src/views/acs/device/driver/air_shower_door.vue
Normal file
413
acs2/nladmin-ui/src/views/acs/device/driver/air_shower_door.vue
Normal file
@@ -0,0 +1,413 @@
|
|||||||
|
<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
|
||||||
|
@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="12">
|
||||||
|
<el-form-item label="电气调度号" label-width="150px">
|
||||||
|
<el-switch v-model="form.OPCServer" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="选择区域" prop="region">
|
||||||
|
<el-select
|
||||||
|
v-model="form.region"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in region"
|
||||||
|
:key="item.region_number"
|
||||||
|
:label="item.region_name"
|
||||||
|
:value="item.region_number"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="关联设备" prop="device_code" label-width="135px">
|
||||||
|
<el-select
|
||||||
|
v-model="form.link_device_code"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_name"
|
||||||
|
:label="item.device_code"
|
||||||
|
: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">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 deviceCrud from '@/api/acs/device/device'
|
||||||
|
|
||||||
|
import crud from '@/mixins/crud'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AirShowerDoor',
|
||||||
|
mixins: [crud],
|
||||||
|
props: {
|
||||||
|
parentForm: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
device_code: '',
|
||||||
|
device_id: '',
|
||||||
|
plc_id: '',
|
||||||
|
plc_code: '',
|
||||||
|
opc_id: '',
|
||||||
|
opc_code: '',
|
||||||
|
configLoading: false,
|
||||||
|
dataOpcservers: [],
|
||||||
|
dataOpcPlcs: [],
|
||||||
|
deviceList: [],
|
||||||
|
data1: [],
|
||||||
|
data2: [],
|
||||||
|
form: {
|
||||||
|
inspect_in_stocck: true,
|
||||||
|
ignore_pickup_check: true,
|
||||||
|
ignore_release_check: true,
|
||||||
|
apply_task: true,
|
||||||
|
manual_create_task: true,
|
||||||
|
is_pickup: true,
|
||||||
|
is_release: true
|
||||||
|
},
|
||||||
|
rules: {},
|
||||||
|
region: [
|
||||||
|
{ region_name: '区域一', region_number: '1' },
|
||||||
|
{ region_name: '区域二', region_number: '2' },
|
||||||
|
{ region_name: '区域三', region_number: '3' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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: {
|
||||||
|
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()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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('action') !== -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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>
|
||||||
413
acs2/nladmin-ui/src/views/acs/device/driver/fast_door.vue
Normal file
413
acs2/nladmin-ui/src/views/acs/device/driver/fast_door.vue
Normal file
@@ -0,0 +1,413 @@
|
|||||||
|
fast_door<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
|
||||||
|
@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="12">
|
||||||
|
<el-form-item label="电气调度号" label-width="150px">
|
||||||
|
<el-switch v-model="form.OPCServer" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="选择区域" prop="region">
|
||||||
|
<el-select
|
||||||
|
v-model="form.region"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in region"
|
||||||
|
:key="item.region_number"
|
||||||
|
:label="item.region_name"
|
||||||
|
:value="item.region_number"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="关联设备" prop="device_code" label-width="135px">
|
||||||
|
<el-select
|
||||||
|
v-model="form.link_device_code"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_name"
|
||||||
|
:label="item.device_code"
|
||||||
|
: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">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 deviceCrud from '@/api/acs/device/device'
|
||||||
|
|
||||||
|
import crud from '@/mixins/crud'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'FastDoor',
|
||||||
|
mixins: [crud],
|
||||||
|
props: {
|
||||||
|
parentForm: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
device_code: '',
|
||||||
|
device_id: '',
|
||||||
|
plc_id: '',
|
||||||
|
plc_code: '',
|
||||||
|
opc_id: '',
|
||||||
|
opc_code: '',
|
||||||
|
configLoading: false,
|
||||||
|
dataOpcservers: [],
|
||||||
|
dataOpcPlcs: [],
|
||||||
|
deviceList: [],
|
||||||
|
data1: [],
|
||||||
|
data2: [],
|
||||||
|
form: {
|
||||||
|
inspect_in_stocck: true,
|
||||||
|
ignore_pickup_check: true,
|
||||||
|
ignore_release_check: true,
|
||||||
|
apply_task: true,
|
||||||
|
manual_create_task: true,
|
||||||
|
is_pickup: true,
|
||||||
|
is_release: true
|
||||||
|
},
|
||||||
|
rules: {},
|
||||||
|
region: [
|
||||||
|
{ region_name: '区域一', region_number: '1' },
|
||||||
|
{ region_name: '区域二', region_number: '2' },
|
||||||
|
{ region_name: '区域三', region_number: '3' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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: {
|
||||||
|
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()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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('action') !== -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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>
|
||||||
413
acs2/nladmin-ui/src/views/acs/device/driver/lift_door.vue
Normal file
413
acs2/nladmin-ui/src/views/acs/device/driver/lift_door.vue
Normal file
@@ -0,0 +1,413 @@
|
|||||||
|
<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
|
||||||
|
@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="12">
|
||||||
|
<el-form-item label="电气调度号" label-width="150px">
|
||||||
|
<el-switch v-model="form.OPCServer" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="选择区域" prop="region">
|
||||||
|
<el-select
|
||||||
|
v-model="form.region"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in region"
|
||||||
|
:key="item.region_number"
|
||||||
|
:label="item.region_name"
|
||||||
|
:value="item.region_number"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="关联设备" prop="device_code" label-width="135px">
|
||||||
|
<el-select
|
||||||
|
v-model="form.link_device_code"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_name"
|
||||||
|
:label="item.device_code"
|
||||||
|
: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">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 deviceCrud from '@/api/acs/device/device'
|
||||||
|
|
||||||
|
import crud from '@/mixins/crud'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'LiftDoor',
|
||||||
|
mixins: [crud],
|
||||||
|
props: {
|
||||||
|
parentForm: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
device_code: '',
|
||||||
|
device_id: '',
|
||||||
|
plc_id: '',
|
||||||
|
plc_code: '',
|
||||||
|
opc_id: '',
|
||||||
|
opc_code: '',
|
||||||
|
configLoading: false,
|
||||||
|
dataOpcservers: [],
|
||||||
|
dataOpcPlcs: [],
|
||||||
|
deviceList: [],
|
||||||
|
data1: [],
|
||||||
|
data2: [],
|
||||||
|
form: {
|
||||||
|
inspect_in_stocck: true,
|
||||||
|
ignore_pickup_check: true,
|
||||||
|
ignore_release_check: true,
|
||||||
|
apply_task: true,
|
||||||
|
manual_create_task: true,
|
||||||
|
is_pickup: true,
|
||||||
|
is_release: true
|
||||||
|
},
|
||||||
|
rules: {},
|
||||||
|
region: [
|
||||||
|
{ region_name: '区域一', region_number: '1' },
|
||||||
|
{ region_name: '区域二', region_number: '2' },
|
||||||
|
{ region_name: '区域三', region_number: '3' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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: {
|
||||||
|
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()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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('action') !== -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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>
|
||||||
@@ -7,7 +7,7 @@ nl:
|
|||||||
ip: 127.0.0.1
|
ip: 127.0.0.1
|
||||||
port: 3306
|
port: 3306
|
||||||
username: root
|
username: root
|
||||||
password: 12356
|
password: 123456
|
||||||
database: ldnx_lms2
|
database: ldnx_lms2
|
||||||
redis:
|
redis:
|
||||||
ip: 127.0.0.1
|
ip: 127.0.0.1
|
||||||
|
|||||||
Reference in New Issue
Block a user