add: 增加堆垛机驱动选择策略,优化堆垛机和输送机驱动
This commit is contained in:
@@ -17,6 +17,7 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -82,4 +83,13 @@ public class CustomPolicyController {
|
|||||||
customPolicyService.updateOn(id,is_on);
|
customPolicyService.updateOn(id,is_on);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getStrategy")
|
||||||
|
@Log("自定义策略列表")
|
||||||
|
@ApiOperation("自定义策略列表")
|
||||||
|
public ResponseEntity<Object> updateOn(){
|
||||||
|
List<Map> list = customPolicyService.findDeviceStrategyOption();
|
||||||
|
return new ResponseEntity<>(list,HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.nl.acs.custompolicy.server.dto.CustomPolicyDTO;
|
|||||||
import org.nl.acs.custompolicy.server.vo.CustomPolicyPlantVO;
|
import org.nl.acs.custompolicy.server.vo.CustomPolicyPlantVO;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,4 +33,5 @@ public interface CustomPolicyService extends CommonService<CustomPolicy> {
|
|||||||
|
|
||||||
DeviceStrategy findByCode(String var1);
|
DeviceStrategy findByCode(String var1);
|
||||||
|
|
||||||
|
List<Map> findDeviceStrategyOption();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,16 +159,19 @@ public class CustomPolicyServiceImpl extends CommonServiceImpl<CustomPolicyMappe
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> findDeviceStrategyOption() {
|
public List<Map> findDeviceStrategyOption() {
|
||||||
List<DeviceStrategy> strategys = this.findAllDeviceStrategy();
|
List<DeviceStrategy> strategys = this.findAllDeviceStrategy();
|
||||||
Map<String, String> map = new HashMap();
|
Map<String, String> map = new HashMap();
|
||||||
|
List<Map> strings = new ArrayList<>();
|
||||||
Iterator var3 = strategys.iterator();
|
Iterator var3 = strategys.iterator();
|
||||||
|
|
||||||
while(var3.hasNext()) {
|
while(var3.hasNext()) {
|
||||||
DeviceStrategy strategy = (DeviceStrategy)var3.next();
|
DeviceStrategy strategy = (DeviceStrategy)var3.next();
|
||||||
map.put(strategy.getCode(), strategy.getName());
|
map.put("code",strategy.getCode());
|
||||||
|
map.put("name",strategy.getName());
|
||||||
|
strings.add(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
return map;
|
return strings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -852,6 +852,9 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
|||||||
String opc_server_id = parentForm.getString("opc_id");
|
String opc_server_id = parentForm.getString("opc_id");
|
||||||
String opc_plc_id = parentForm.getString("plc_id");
|
String opc_plc_id = parentForm.getString("plc_id");
|
||||||
String address = form.getString("address");
|
String address = form.getString("address");
|
||||||
|
String form_x = form.getString("x");
|
||||||
|
String form_z = form.getString("z");
|
||||||
|
String form_y = form.getString("y");
|
||||||
String input_material = parentForm.getString("input_material");
|
String input_material = parentForm.getString("input_material");
|
||||||
String device_type = parentForm.getString("device_type");
|
String device_type = parentForm.getString("device_type");
|
||||||
String driver_code = parentForm.getString("driver_code");
|
String driver_code = parentForm.getString("driver_code");
|
||||||
|
|||||||
@@ -4,11 +4,15 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.domain.DeviceExtra;
|
||||||
import org.nl.acs.device.enums.DeviceType;
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
|
import org.nl.acs.device.service.DeviceExtraService;
|
||||||
|
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.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.basedriver.belt_conveyor.BeltConveyorDeviceDriver;
|
||||||
@@ -49,7 +53,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
|
||||||
|
|
||||||
//心跳
|
//心跳
|
||||||
Integer heartbeat = 0;
|
Integer heartbeat = 0;
|
||||||
@@ -425,9 +430,18 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
String next_device_code = instruction.getNext_device_code();
|
String next_device_code = instruction.getNext_device_code();
|
||||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||||
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||||
map.put("to_z", nextDevice.getZ());
|
List<DeviceExtra> list = deviceExtraService.list(Wrappers.lambdaQuery(DeviceExtra.class).eq(DeviceExtra::getDevice_code, next_device_code));
|
||||||
map.put("to_x", nextDevice.getX());
|
for (DeviceExtra deviceExtra : list) {
|
||||||
map.put("to_y", nextDevice.getY());
|
if("x".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
||||||
|
map.put("to_x", deviceExtra.getExtra_value());
|
||||||
|
}
|
||||||
|
if("z".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
||||||
|
map.put("to_z", deviceExtra.getExtra_value());
|
||||||
|
}
|
||||||
|
if("y".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
||||||
|
map.put("to_y", deviceExtra.getExtra_value());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())) {
|
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())) {
|
||||||
map.put("to_z", inst.getTo_z());
|
map.put("to_z", inst.getTo_z());
|
||||||
@@ -609,9 +623,18 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
map.put("to_task", inst.getInstruction_code());
|
map.put("to_task", inst.getInstruction_code());
|
||||||
|
|
||||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||||
map.put("to_z", startDevice.getZ());
|
List<DeviceExtra> list = deviceExtraService.list(Wrappers.lambdaQuery(DeviceExtra.class).eq(DeviceExtra::getDevice_code, start_device_code));
|
||||||
map.put("to_x", startDevice.getX());
|
for (DeviceExtra deviceExtra : list) {
|
||||||
map.put("to_y", startDevice.getY());
|
if("x".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
||||||
|
map.put("to_x", deviceExtra.getExtra_value());
|
||||||
|
}
|
||||||
|
if("z".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
||||||
|
map.put("to_z", deviceExtra.getExtra_value());
|
||||||
|
}
|
||||||
|
if("y".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
||||||
|
map.put("to_y", deviceExtra.getExtra_value());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
|
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
|
||||||
map.put("to_z", inst.getFrom_z());
|
map.put("to_z", inst.getFrom_z());
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
wrapper.eq(StringUtils.isNotBlank(status),InstructionMybatis::getInstruction_status,status);
|
wrapper.eq(StringUtils.isNotBlank(status),InstructionMybatis::getInstruction_status,status);
|
||||||
wrapper.and(StringUtils.isNotBlank(point_code),instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code));
|
wrapper.and(StringUtils.isNotBlank(point_code),instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code));
|
||||||
wrapper.eq(StringUtils.isNotBlank(instruction_type),InstructionMybatis::getInstruction_type,instruction_type);
|
wrapper.eq(StringUtils.isNotBlank(instruction_type),InstructionMybatis::getInstruction_type,instruction_type);
|
||||||
|
wrapper.le(InstructionMybatis::getInstruction_status,1);
|
||||||
if (!StrUtil.isEmpty(is_over)) {
|
if (!StrUtil.isEmpty(is_over)) {
|
||||||
if (StrUtil.equals(is_over, "1")) {
|
if (StrUtil.equals(is_over, "1")) {
|
||||||
wrapper.ge(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex());
|
wrapper.ge(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex());
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.nl.acs.device_driver.RequestMethodEnum;
|
|||||||
import org.nl.acs.ext.wms.data.one.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
import org.nl.acs.ext.wms.data.one.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.instruction.domain.Instruction;
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||||
@@ -322,6 +323,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
wrapper.lt(Task::getTask_status,TaskStatusEnum.FINISHED.getIndex());
|
wrapper.lt(Task::getTask_status,TaskStatusEnum.FINISHED.getIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wrapper.le(Task::getTask_status,1);
|
||||||
IPage<Task> taskPage = taskMapper.selectPage(queryPage,wrapper);
|
IPage<Task> taskPage = taskMapper.selectPage(queryPage,wrapper);
|
||||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(taskPage, TaskDto.class));
|
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(taskPage, TaskDto.class));
|
||||||
return json;
|
return json;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export function updateConfig(plans, deviceCode, id) {
|
|||||||
data,
|
data,
|
||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectById(id) {
|
export function selectById(id) {
|
||||||
@@ -20,3 +19,11 @@ export function selectById(id) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function findDeviceStrategyOption() {
|
||||||
|
return request({
|
||||||
|
url: '/api/customPolicy/getStrategy',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { findDeviceStrategyOption }
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span class="role-span">指令相关:</span>
|
<span class="role-span">指令相关:</span>
|
||||||
</div>
|
</div>
|
||||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
<!-- <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="检验有货">
|
<el-form-item label="检验有货">
|
||||||
@@ -143,6 +143,44 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
</el-form> -->
|
||||||
|
<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" prop="x">
|
||||||
|
<el-input v-model.number="form.x" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<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="12">
|
||||||
|
<el-form-item label="层:" label-width="150px" prop="yY">
|
||||||
|
<el-input v-model.number="form.y" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="12">
|
||||||
|
<el-form-item label="最小列:" label-width="150px" prop="minY">
|
||||||
|
<el-input v-model.number="form.minY" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="最大层:" label-width="150px" prop="maxZ">
|
||||||
|
<el-input v-model.number="form.maxZ" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col> -->
|
||||||
|
<!-- <el-col :span="12">
|
||||||
|
<el-form-item label="最小层:" label-width="150px" prop="minZ">
|
||||||
|
<el-input v-model.number="form.minZ" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col> -->
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
@@ -324,7 +362,10 @@ export default {
|
|||||||
// 从父表单获取设备编码
|
// 从父表单获取设备编码
|
||||||
this.device_id = this.$props.parentForm.device_id
|
this.device_id = this.$props.parentForm.device_id
|
||||||
this.device_code = this.$props.parentForm.device_code
|
this.device_code = this.$props.parentForm.device_code
|
||||||
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
queryDriverConfig(
|
||||||
|
this.device_id,
|
||||||
|
this.$props.parentForm.driver_code
|
||||||
|
).then((data) => {
|
||||||
// 给表单赋值,并且属性不能为空
|
// 给表单赋值,并且属性不能为空
|
||||||
if (data.form) {
|
if (data.form) {
|
||||||
const arr = Object.keys(data.form)
|
const arr = Object.keys(data.form)
|
||||||
@@ -347,15 +388,15 @@ export default {
|
|||||||
this.data2 = data.ws
|
this.data2 = data.ws
|
||||||
this.sliceItem()
|
this.sliceItem()
|
||||||
})
|
})
|
||||||
selectPlcList().then(data => {
|
selectPlcList().then((data) => {
|
||||||
this.dataOpcPlcs = data
|
this.dataOpcPlcs = data
|
||||||
this.plc_id = this.$props.parentForm.opc_plc_id
|
this.plc_id = this.$props.parentForm.opc_plc_id
|
||||||
})
|
})
|
||||||
selectOpcList().then(data => {
|
selectOpcList().then((data) => {
|
||||||
this.dataOpcservers = data
|
this.dataOpcservers = data
|
||||||
this.opc_id = this.$props.parentForm.opc_server_id
|
this.opc_id = this.$props.parentForm.opc_server_id
|
||||||
})
|
})
|
||||||
deviceCrud.selectDeviceList().then(data => {
|
deviceCrud.selectDeviceList().then((data) => {
|
||||||
this.deviceList = data
|
this.deviceList = data
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -377,19 +418,36 @@ export default {
|
|||||||
}
|
}
|
||||||
for (const val in this.data1) {
|
for (const val in this.data1) {
|
||||||
if (this.data1[val].code.indexOf('mode') !== -1) {
|
if (this.data1[val].code.indexOf('mode') !== -1) {
|
||||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 0)
|
this.data1[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 0)
|
||||||
}
|
}
|
||||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
this.data1[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 1)
|
||||||
}
|
}
|
||||||
if (this.data1[val].code.indexOf('carrier_direction') !== -1) {
|
if (this.data1[val].code.indexOf('carrier_direction') !== -1) {
|
||||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
this.data1[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 2)
|
||||||
}
|
}
|
||||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
this.data1[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 4)
|
||||||
}
|
}
|
||||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 8)
|
this.data1[val].db =
|
||||||
|
beforeStr + '.' + 'D' + (parseInt(endNumber) + 8)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -411,40 +469,69 @@ export default {
|
|||||||
console.log(endNumber)
|
console.log(endNumber)
|
||||||
for (const val in this.data2) {
|
for (const val in this.data2) {
|
||||||
if (this.data2[val].code.indexOf('to_command') !== -1) {
|
if (this.data2[val].code.indexOf('to_command') !== -1) {
|
||||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 0)
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 0)
|
||||||
}
|
}
|
||||||
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 2)
|
||||||
}
|
}
|
||||||
if (this.data2[val].code.indexOf('to_container_type') !== -1) {
|
if (this.data2[val].code.indexOf('to_container_type') !== -1) {
|
||||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 4)
|
||||||
}
|
}
|
||||||
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
this.data2[val].db =
|
||||||
|
beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||||
}
|
}
|
||||||
if (this.data2[val].code.indexOf('to_strap_times') !== -1) {
|
if (this.data2[val].code.indexOf('to_strap_times') !== -1) {
|
||||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 10)
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 10)
|
||||||
}
|
}
|
||||||
if (this.data2[val].code.indexOf('to_length') !== -1) {
|
if (this.data2[val].code.indexOf('to_length') !== -1) {
|
||||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 12)
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 12)
|
||||||
}
|
}
|
||||||
if (this.data2[val].code.indexOf('to_weight') !== -1) {
|
if (this.data2[val].code.indexOf('to_weight') !== -1) {
|
||||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 14)
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 14)
|
||||||
}
|
}
|
||||||
if (this.data2[val].code.indexOf('to_height') !== -1) {
|
if (this.data2[val].code.indexOf('to_height') !== -1) {
|
||||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 16)
|
this.data2[val].db =
|
||||||
|
beforeStr +
|
||||||
|
'.' +
|
||||||
|
afterStr.substring(0, 1) +
|
||||||
|
(parseInt(endNumber) + 16)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeOpc(val) {
|
changeOpc(val) {
|
||||||
this.dataOpcservers.forEach(item => {
|
this.dataOpcservers.forEach((item) => {
|
||||||
if (item.opc_id === val) {
|
if (item.opc_id === val) {
|
||||||
this.opc_code = item.opc_code
|
this.opc_code = item.opc_code
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
selectListByOpcID(val).then(data => {
|
selectListByOpcID(val).then((data) => {
|
||||||
this.dataOpcPlcs = data
|
this.dataOpcPlcs = data
|
||||||
this.plc_id = ''
|
this.plc_id = ''
|
||||||
this.plc_code = ''
|
this.plc_code = ''
|
||||||
@@ -456,7 +543,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
changePlc(val) {
|
changePlc(val) {
|
||||||
this.dataOpcPlcs.forEach(item => {
|
this.dataOpcPlcs.forEach((item) => {
|
||||||
if (item.plc_id === val) {
|
if (item.plc_id === val) {
|
||||||
this.plc_code = item.plc_code
|
this.plc_code = item.plc_code
|
||||||
this.sliceItem()
|
this.sliceItem()
|
||||||
@@ -465,29 +552,35 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
test_read1() {
|
test_read1() {
|
||||||
testRead(this.data1, this.opc_id).then(data => {
|
testRead(this.data1, this.opc_id)
|
||||||
this.data1 = data
|
.then((data) => {
|
||||||
console.log(this.data1)
|
this.data1 = data
|
||||||
this.notify('操作成功!', 'success')
|
console.log(this.data1)
|
||||||
}).catch(err => {
|
this.notify('操作成功!', 'success')
|
||||||
console.log(err.response.data.message)
|
})
|
||||||
})
|
.catch((err) => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
test_write1() {
|
test_write1() {
|
||||||
testwrite(this.data2, this.opc_id).then(data => {
|
testwrite(this.data2, this.opc_id)
|
||||||
this.notify('操作成功!', 'success')
|
.then((data) => {
|
||||||
}).catch(err => {
|
this.notify('操作成功!', 'success')
|
||||||
console.log(err.response.data.message)
|
})
|
||||||
})
|
.catch((err) => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
test_read2() {
|
test_read2() {
|
||||||
testRead(this.data2, this.opc_id).then(data => {
|
testRead(this.data2, this.opc_id)
|
||||||
this.data2 = data
|
.then((data) => {
|
||||||
console.log(this.data2)
|
this.data2 = data
|
||||||
this.notify('操作成功!', 'success')
|
console.log(this.data2)
|
||||||
}).catch(err => {
|
this.notify('操作成功!', 'success')
|
||||||
console.log(err.response.data.message)
|
})
|
||||||
})
|
.catch((err) => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
doSubmit() {
|
doSubmit() {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
@@ -498,35 +591,66 @@ export default {
|
|||||||
parentForm.is_route = true
|
parentForm.is_route = true
|
||||||
parentForm.plc_id = this.plc_id
|
parentForm.plc_id = this.plc_id
|
||||||
parentForm.opc_id = this.opc_id
|
parentForm.opc_id = this.opc_id
|
||||||
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
updateConfig(parentForm, this.form, this.data1, this.data2)
|
||||||
this.notify('保存成功', 'success')
|
.then((res) => {
|
||||||
this.configLoading = false
|
this.notify('保存成功', 'success')
|
||||||
}).catch(err => {
|
this.configLoading = false
|
||||||
this.configLoading = false
|
})
|
||||||
console.log(err.response.data.message)
|
.catch((err) => {
|
||||||
})
|
this.configLoading = false
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
sliceItem() { // 拼接DB的Item值
|
sliceItem() {
|
||||||
this.data1.forEach(item => {
|
// 拼接DB的Item值
|
||||||
|
this.data1.forEach((item) => {
|
||||||
const str = item.code
|
const str = item.code
|
||||||
// 是否包含.
|
// 是否包含.
|
||||||
if (str.search('.') !== -1) {
|
if (str.search('.') !== -1) {
|
||||||
// 截取最后一位
|
// 截取最后一位
|
||||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
item.code =
|
||||||
|
this.opc_code +
|
||||||
|
'.' +
|
||||||
|
this.plc_code +
|
||||||
|
'.' +
|
||||||
|
this.device_code +
|
||||||
|
'.' +
|
||||||
|
str.slice(str.lastIndexOf('.') + 1)
|
||||||
} else {
|
} else {
|
||||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
item.code =
|
||||||
|
this.opc_code +
|
||||||
|
'.' +
|
||||||
|
this.plc_code +
|
||||||
|
'.' +
|
||||||
|
this.device_code +
|
||||||
|
'.' +
|
||||||
|
item.code
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.data2.forEach(item => {
|
this.data2.forEach((item) => {
|
||||||
const str = item.code
|
const str = item.code
|
||||||
// 是否包含.
|
// 是否包含.
|
||||||
if (str.search('.') !== -1) {
|
if (str.search('.') !== -1) {
|
||||||
// 截取最后一位
|
// 截取最后一位
|
||||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
item.code =
|
||||||
|
this.opc_code +
|
||||||
|
'.' +
|
||||||
|
this.plc_code +
|
||||||
|
'.' +
|
||||||
|
this.device_code +
|
||||||
|
'.' +
|
||||||
|
str.slice(str.lastIndexOf('.') + 1)
|
||||||
} else {
|
} else {
|
||||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
item.code =
|
||||||
|
this.opc_code +
|
||||||
|
'.' +
|
||||||
|
this.plc_code +
|
||||||
|
'.' +
|
||||||
|
this.device_code +
|
||||||
|
'.' +
|
||||||
|
item.code
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -535,5 +659,4 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -87,8 +87,12 @@
|
|||||||
multiple
|
multiple
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
>
|
>
|
||||||
<el-option :label="'默认'" :value="'value1'" />
|
<el-option
|
||||||
<el-option :label="'自定义'" :value="'value2'" />
|
v-for=" option in options"
|
||||||
|
:key="option.code"
|
||||||
|
:label="option.name"
|
||||||
|
:value="option.name"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -271,6 +275,7 @@ import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
|||||||
|
|
||||||
import crud from '@/mixins/crud'
|
import crud from '@/mixins/crud'
|
||||||
import deviceCrud from '@/api/acs/device/device'
|
import deviceCrud from '@/api/acs/device/device'
|
||||||
|
import { findDeviceStrategyOption } from '@/api/acs/device/customPolicyType'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OvenGantryManipulator',
|
name: 'OvenGantryManipulator',
|
||||||
@@ -294,6 +299,7 @@ export default {
|
|||||||
dataOpcservers: [],
|
dataOpcservers: [],
|
||||||
dataOpcPlcs: [],
|
dataOpcPlcs: [],
|
||||||
deviceList: [],
|
deviceList: [],
|
||||||
|
options: [],
|
||||||
data1: [],
|
data1: [],
|
||||||
data2: [],
|
data2: [],
|
||||||
form: {
|
form: {
|
||||||
@@ -354,6 +360,12 @@ export default {
|
|||||||
deviceCrud.selectDeviceList().then((data) => {
|
deviceCrud.selectDeviceList().then((data) => {
|
||||||
this.deviceList = data
|
this.deviceList = data
|
||||||
})
|
})
|
||||||
|
console.log('---------------')
|
||||||
|
findDeviceStrategyOption().then((data) => {
|
||||||
|
console.log(data)
|
||||||
|
this.options = data
|
||||||
|
})
|
||||||
|
console.log('-----eeeeeeeeeeee----------')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Reference in New Issue
Block a user