add: 关联站点开发
This commit is contained in:
@@ -42,7 +42,8 @@ public enum DriverTypeEnum {
|
|||||||
|
|
||||||
DOUBLE_STATION_STACKER(16, "double_station_stacker", "标准版-双工位堆垛机", "double_station_stacker"),
|
DOUBLE_STATION_STACKER(16, "double_station_stacker", "标准版-双工位堆垛机", "double_station_stacker"),
|
||||||
|
|
||||||
DOUBLE_BELT_CONVEYOR(17, "double_belt_conveyor", "双工位输送线", "double_belt_conveyor");
|
DOUBLE_BELT_CONVEYOR(17, "double_belt_conveyor", "双工位输送线", "conveyor"),
|
||||||
|
WITH_STATION_DEVICE_DRIVER(18, "with_station_device_driver", "输送线关联站点", "conveyor");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.nl.acs.device_driver.basedriver.belt_with_station;
|
package org.nl.acs.device_driver.conveyor.belt_with_station;
|
||||||
|
|
||||||
import org.nl.acs.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
import org.nl.acs.device.enums.DeviceType;
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
@@ -16,17 +16,17 @@ import java.util.List;
|
|||||||
public class WithStationDefination implements DeviceDriverDefination {
|
public class WithStationDefination implements DeviceDriverDefination {
|
||||||
@Override
|
@Override
|
||||||
public String getDriverCode() {
|
public String getDriverCode() {
|
||||||
return "hailiang_with_station";
|
return "with_station_device";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDriverName() {
|
public String getDriverName() {
|
||||||
return "关联驱动";
|
return "输送线关联站点";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDriverDescription() {
|
public String getDriverDescription() {
|
||||||
return "关联驱动";
|
return "输送线关联站点";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.nl.acs.device_driver.basedriver.belt_with_station;
|
package org.nl.acs.device_driver.conveyor.belt_with_station;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
@@ -16,8 +15,7 @@ import org.nl.acs.device.domain.Device;
|
|||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.belt_conveyor.BeltConveyorDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.double_belt_conveyor.DoubleBeltConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.double_belt_conveyor.DoubleBeltConveyorDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
@@ -43,6 +41,7 @@ import java.util.*;
|
|||||||
@Data
|
@Data
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -382,4 +381,5 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
option = Integer.parseInt(flag);
|
option = Integer.parseInt(flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.nl.acs.device_driver.basedriver.double_belt_conveyor;
|
package org.nl.acs.device_driver.conveyor.double_belt_conveyor;
|
||||||
|
|
||||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
import org.nl.acs.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
@@ -17,17 +17,17 @@ import java.util.List;
|
|||||||
public class DoubleBeltConveyorDefination implements OpcDeviceDriverDefination {
|
public class DoubleBeltConveyorDefination implements OpcDeviceDriverDefination {
|
||||||
@Override
|
@Override
|
||||||
public String getDriverCode() {
|
public String getDriverCode() {
|
||||||
return "belt_conveyor";
|
return "double_belt_conveyor";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDriverName() {
|
public String getDriverName() {
|
||||||
return "标准版-输送机";
|
return "双工位-输送机";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDriverDescription() {
|
public String getDriverDescription() {
|
||||||
return "标准版-输送机";
|
return "双工位-输送机";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.nl.acs.device_driver.basedriver.double_belt_conveyor;
|
package org.nl.acs.device_driver.conveyor.double_belt_conveyor;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
@@ -293,7 +293,7 @@ public class DoubleBeltConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
|
|
||||||
public void writing(int command) {
|
public void writing(int command) {
|
||||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command;
|
+ "." +ItemProtocol.item_to_command;
|
||||||
|
|
||||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
this.control(itemMap);
|
this.control(itemMap);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.nl.acs.device_driver.basedriver.double_belt_conveyor;
|
package org.nl.acs.device_driver.conveyor.double_belt_conveyor;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.nl.acs.device_driver.basedriver.double_belt_conveyor;
|
package org.nl.acs.device_driver.conveyor.double_belt_conveyor;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -17,53 +17,31 @@ import org.nl.acs.device.service.DeviceService;
|
|||||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||||
import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver;
|
import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||||
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.basedriver.casing_station.CasingStationConveyorDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.basedriver.device_status.DeviceStatusDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
||||||
import org.nl.acs.device_driver.conveyor.hongxiang_device.HongXiangConveyorDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.indoor_manipulator.IndoorManipulatorDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.three_color.lamp_three_color.LampThreecolorDeviceDriver;
|
import org.nl.acs.device_driver.three_color.lamp_three_color.LampThreecolorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.conveyor.oven_manipulator.OvenGantryManipulatorDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.oven_manipulator.OvenGantryManipulatorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.paper_tube_device.PaperTubeConveyorDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.basedriver.paper_tube_device2.Paper;
|
|
||||||
import org.nl.acs.device_driver.basedriver.paper_tube_device2.PaperTubeConveyor2DeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.conveyor.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.plugging_unplugging_machine.PluggingUnpluggingMachineDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.conveyor.siemens_conveyor_ckk.SiemensConveyorCkkDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.siemens_conveyor_ckk.SiemensConveyorCkkDeviceDriver;
|
||||||
import org.nl.acs.device_driver.conveyor.siemens_conveyor_labeling.SiemensConveyorLabelingDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.siemens_conveyor_labeling.SiemensConveyorLabelingDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor.SiemensOneFloorAGVConveyorDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.conveyor.slit_two_manipulator.SlitTwoManipulatorDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.slit_two_manipulator.SlitTwoManipulatorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.conveyor.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.data.*;
|
import org.nl.acs.ext.wms.data.*;
|
||||||
import org.nl.acs.ext.wms.liKuData.OutConfirmReportResponse;
|
|
||||||
import org.nl.acs.ext.wms.liKuData.OutConfirmRequest;
|
|
||||||
import org.nl.acs.ext.wms.liKuData.Resp;
|
import org.nl.acs.ext.wms.liKuData.Resp;
|
||||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||||
import org.nl.acs.history.ErrorUtil;
|
import org.nl.acs.history.ErrorUtil;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.instruction.service.dto.Instruction;
|
|
||||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
import org.nl.acs.opc.Device;
|
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
import org.nl.acs.opc.DeviceExtraManageDto;
|
import org.nl.acs.opc.DeviceExtraManageDto;
|
||||||
import org.nl.acs.opc.DeviceType;
|
|
||||||
import org.nl.acs.route.service.RouteLineService;
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.acs.task.service.dto.TaskDto;
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
|
||||||
import org.nl.modules.system.domain.Dict;
|
|
||||||
import org.nl.modules.system.service.DictDetailService;
|
|
||||||
import org.nl.modules.system.service.DictService;
|
|
||||||
import org.nl.modules.system.service.ParamService;
|
|
||||||
import org.nl.modules.system.service.dto.DictDetailDto;
|
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
|
||||||
import org.nl.modules.wql.exception.WDKException;
|
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -79,7 +57,61 @@ import java.util.stream.Collectors;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class WmsToAcsServiceImpl implements WmsToAcsService {
|
public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||||
|
@Override
|
||||||
|
public CreateTaskResponse crateTask(String param) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public org.nl.acs.ext.wms.data.one.CreateTaskResponse crateTask(List<org.nl.acs.ext.wms.data.one.CreateTaskRequest> reqs) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public org.nl.acs.ext.wms.data.one.CancelTaskResponse cancelFromWms(List<org.nl.acs.ext.wms.data.one.CancelTaskRequest> reqs) throws Exception {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> updateDeviceGoodsFromWms(String jsonObject) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> areaControl(JSONObject jsonObject) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PutActionResponse putAction(String jsonObject) throws Exception {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryDevice(String jsonObject) throws Exception {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryDeviceDBValue(String whereJson) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> querydevice(String whereJson) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> putPlusPullAction(String whereJson) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject notifyAcs(JSONObject param) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
private final ApplicationContext applicationContext;
|
private final ApplicationContext applicationContext;
|
||||||
|
|
||||||
private final InstructionService instructionService;
|
private final InstructionService instructionService;
|
||||||
@@ -1367,5 +1399,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
resp.put("message", "操作成功");
|
resp.put("message", "操作成功");
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
**/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ import xg_agv from '@/views/acs/device/driver/agv/xg_agv'
|
|||||||
import led_screen from './driver/led_screen'
|
import led_screen from './driver/led_screen'
|
||||||
import standard_station from '@/views/acs/device/driver/standard_station'
|
import standard_station from '@/views/acs/device/driver/standard_station'
|
||||||
import double_belt_conveyor from '@/views/acs/device/driver/double_belt_conveyor.vue'
|
import double_belt_conveyor from '@/views/acs/device/driver/double_belt_conveyor.vue'
|
||||||
|
import with_station_device from '@/views/acs/device/driver/with_station_device.vue'
|
||||||
export default {
|
export default {
|
||||||
name: 'DeviceConfig',
|
name: 'DeviceConfig',
|
||||||
components: {
|
components: {
|
||||||
@@ -133,7 +134,8 @@ export default {
|
|||||||
oven_manipulator,
|
oven_manipulator,
|
||||||
plug_pull_device_site,
|
plug_pull_device_site,
|
||||||
slit_two_manipulator,
|
slit_two_manipulator,
|
||||||
double_belt_conveyor
|
double_belt_conveyor,
|
||||||
|
with_station_device
|
||||||
|
|
||||||
},
|
},
|
||||||
dicts: ['device_type'],
|
dicts: ['device_type'],
|
||||||
|
|||||||
@@ -163,28 +163,6 @@
|
|||||||
<el-input v-model.number="form.y" />
|
<el-input v-model.number="form.y" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="等待时间:" label-width="150px" prop="apply_time">
|
|
||||||
<el-input v-model.number="form.apply_time" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="关联设备" prop="device_code">
|
|
||||||
<el-select
|
|
||||||
v-model="form.link_device_code"
|
|
||||||
clearable
|
|
||||||
filterable
|
|
||||||
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-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|||||||
@@ -0,0 +1,667 @@
|
|||||||
|
<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.address" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">指令相关:</span>
|
||||||
|
</div>
|
||||||
|
<!-- <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="检验有货">
|
||||||
|
<el-switch v-model="form.inspect_in_stocck" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="忽视取货校验" label-width="150px">
|
||||||
|
<el-switch v-model="form.ignore_pickup_check" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="忽视放货校验" label-width="150px">
|
||||||
|
<el-switch v-model="form.ignore_release_check" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="呼叫">
|
||||||
|
<el-switch v-model="form.apply_task" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="响应" label-width="150px">
|
||||||
|
<el-switch v-model="form.manual_create_task" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="关联设备" prop="device_code">
|
||||||
|
<el-select
|
||||||
|
v-model="form.link_device_code"
|
||||||
|
filterable
|
||||||
|
multiple
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_code"
|
||||||
|
:label="item.device_name"
|
||||||
|
:value="item.device_code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
|
||||||
|
<el-select
|
||||||
|
v-model="form.link_three_lamp"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_code"
|
||||||
|
:label="item.device_name"
|
||||||
|
:value="item.device_code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="是否输入物料" label-width="150px">
|
||||||
|
<el-switch v-model="form.input_material" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="是否需要反馈光电" label-width="150px">
|
||||||
|
<el-switch v-model="form.ship_device_update" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form> -->
|
||||||
|
<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" prop="x">
|
||||||
|
<el-input v-model.number="form.x" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="列:" label-width="150px" prop="z">
|
||||||
|
<el-input v-model.number="form.z" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="层:" label-width="150px" prop="yY">
|
||||||
|
<el-input v-model.number="form.y" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="等待时间:" label-width="150px" prop="apply_time">
|
||||||
|
<el-input v-model.number="form.apply_time" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="关联设备" prop="device_code">
|
||||||
|
<el-select
|
||||||
|
v-model="form.link_device_code"
|
||||||
|
multiple
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_code"
|
||||||
|
:label="item.device_name"
|
||||||
|
:value="item.device_code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">AGV相关:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="取货">
|
||||||
|
<el-switch v-model="form.is_pickup" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="放货">
|
||||||
|
<el-switch v-model="form.is_release" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">PLC读取字段:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-table
|
||||||
|
v-loading="false"
|
||||||
|
:data="data1"
|
||||||
|
:max-height="550"
|
||||||
|
size="small"
|
||||||
|
style="width: 100%;margin-bottom: 15px"
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-table-column prop="name" label="用途" />
|
||||||
|
<el-table-column prop="code" label="别名要求" />
|
||||||
|
<el-table-column prop="db" label="DB块">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model="data1[scope.$index].db"
|
||||||
|
size="mini"
|
||||||
|
class="edit-input"
|
||||||
|
@input="finishReadEdit(data1[scope.$index])"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dbr_value">
|
||||||
|
<template slot="header">
|
||||||
|
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">PLC写入字段:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-table
|
||||||
|
v-loading="false"
|
||||||
|
:data="data2"
|
||||||
|
:max-height="550"
|
||||||
|
size="small"
|
||||||
|
style="width: 100%;margin-bottom: 15px"
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-table-column prop="name" label="用途" />
|
||||||
|
<el-table-column prop="code" label="别名要求" />
|
||||||
|
<el-table-column prop="db" label="DB块">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model="data2[scope.$index].db"
|
||||||
|
size="mini"
|
||||||
|
class="edit-input"
|
||||||
|
@input="finishWriteEdit(data2[scope.$index])"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dbr_value2">
|
||||||
|
<template slot="header">
|
||||||
|
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dbw_value">
|
||||||
|
<template slot="header">
|
||||||
|
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span" />
|
||||||
|
<el-button
|
||||||
|
:loading="false"
|
||||||
|
icon="el-icon-check"
|
||||||
|
size="mini"
|
||||||
|
style="float: right; padding: 6px 9px"
|
||||||
|
type="primary"
|
||||||
|
@click="doSubmit"
|
||||||
|
>保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
queryDriverConfig,
|
||||||
|
updateConfig,
|
||||||
|
testRead,
|
||||||
|
testwrite
|
||||||
|
} from '@/api/acs/device/driverConfig'
|
||||||
|
import { selectOpcList } from '@/api/acs/device/opc'
|
||||||
|
import { selectPlcList } from '@/api/acs/device/opcPlc'
|
||||||
|
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
||||||
|
|
||||||
|
import crud from '@/mixins/crud'
|
||||||
|
import deviceCrud from '@/api/acs/device/device'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'WithStationDeviceDriver',
|
||||||
|
mixins: [crud],
|
||||||
|
props: {
|
||||||
|
parentForm: {
|
||||||
|
type: Object,
|
||||||
|
require: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
device_code: '',
|
||||||
|
device_id: '',
|
||||||
|
plc_id: '',
|
||||||
|
plc_code: '',
|
||||||
|
address: '',
|
||||||
|
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,
|
||||||
|
link_three_lamp: '',
|
||||||
|
manual_create_task: true,
|
||||||
|
is_pickup: true,
|
||||||
|
is_release: true,
|
||||||
|
link_device_code: [],
|
||||||
|
ship_device_update: true,
|
||||||
|
apply_time: ''
|
||||||
|
},
|
||||||
|
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('mode') !== -1) {
|
||||||
|
this.data1[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 0)
|
||||||
|
}
|
||||||
|
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('carrier_direction') !== -1) {
|
||||||
|
this.data1[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 2)
|
||||||
|
}
|
||||||
|
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||||
|
this.data1[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 4)
|
||||||
|
}
|
||||||
|
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||||
|
this.data1[val].db =
|
||||||
|
beforeStr + '.' + 'D' + (parseInt(endNumber) + 8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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
|
||||||
|
}
|
||||||
|
console.log(endNumber)
|
||||||
|
for (const val in this.data2) {
|
||||||
|
if (this.data2[val].code.indexOf('to_command') !== -1) {
|
||||||
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 0)
|
||||||
|
}
|
||||||
|
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_container_type') !== -1) {
|
||||||
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 4)
|
||||||
|
}
|
||||||
|
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||||
|
this.data2[val].db =
|
||||||
|
beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||||
|
}
|
||||||
|
if (this.data2[val].code.indexOf('to_strap_times') !== -1) {
|
||||||
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 10)
|
||||||
|
}
|
||||||
|
if (this.data2[val].code.indexOf('to_length') !== -1) {
|
||||||
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 12)
|
||||||
|
}
|
||||||
|
if (this.data2[val].code.indexOf('to_weight') !== -1) {
|
||||||
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 14)
|
||||||
|
}
|
||||||
|
if (this.data2[val].code.indexOf('to_height') !== -1) {
|
||||||
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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
|
||||||
|
console.log(this.data1)
|
||||||
|
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>
|
||||||
Reference in New Issue
Block a user