Browse Source

opt:设备状态测试问题修改

master
zds 3 months ago
parent
commit
f60edffaf9
  1. 18
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/impl/DeviceStatusServiceImpl.java
  2. 21
      lms/nladmin-ui/src/views/wms/agvrush/devicestatus/index.vue

18
lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/impl/DeviceStatusServiceImpl.java

@ -1,6 +1,7 @@
package org.nl.wms.basedata.master.devicestatus.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -53,8 +54,9 @@ public class DeviceStatusServiceImpl extends ServiceImpl<DeviceStatusMapper, Dev
DeviceStatus deviceStatus = deviceStatusMapper.selectOne(lam);
if (ObjectUtil.isNotEmpty(deviceStatus)) {
throw new BadRequestException("已存在相同的设备编码!");
throw new BadRequestException("已存在相同的设备编码:"+jo.getDevice_code()+",请检查!");
}else{//新增
jo.setDevicestatus_id(IdUtil.getSnowflake(1, 1).nextId()+"");
deviceStatusMapper.insert(jo);
}
}
@ -62,19 +64,19 @@ public class DeviceStatusServiceImpl extends ServiceImpl<DeviceStatusMapper, Dev
@Override
@Transactional(rollbackFor = Exception.class)
public void update(DeviceStatus jo) {
LambdaQueryWrapper<DeviceStatus> lam = new LambdaQueryWrapper<DeviceStatus>();
lam.eq(DeviceStatus::getDevice_code,jo.getDevice_code());
DeviceStatus deviceStatus = deviceStatusMapper.selectOne(lam);
//如果存在相同设备编码
if (ObjectUtil.isNotEmpty(deviceStatus)) {
String devicestatus_id = deviceStatus.getDevicestatus_id();
if(devicestatus_id.equals(jo.getDevicestatus_id())){
deviceStatusMapper.updateById(jo);
}else{
throw new BadRequestException("已存在相同的设备编码!");
//判断是否当前修改的id
if(!devicestatus_id.equals(jo.getDevicestatus_id())){
throw new BadRequestException("已存在相同的设备编码:"+jo.getDevice_code()+",请检查!");
}
}else{//新增
deviceStatusMapper.insert(jo);
}
//不存在相同编码,直接更新
deviceStatusMapper.updateById(jo);
}
}

21
lms/nladmin-ui/src/views/wms/agvrush/devicestatus/index.vue

@ -137,7 +137,7 @@
</el-col>
<el-col :span="8">
<el-form-item label="联系人" prop="upload_user">
<el-select v-model="form.upload_user" placeholder="请选择" filterable multiple clearable style="width: 200px">
<el-select v-model="form.upload_user2" placeholder="请选择" filterable multiple clearable style="width: 200px">
<el-option
v-for="item in userList"
:key="item.username"
@ -219,12 +219,21 @@ import pagination from '@crud/Pagination'
import crudUser from '@/views/system/user/user'
const defaultForm = {
devicestatus_id: null,
device_code: null,
device_name: null,
product_area: null,
device_type: null,
upload_flag: null,
upload_user: []
upload_flag: '0',
mode: '',
mode_update_time: '',
error: '',
error_msg: '',
error_update_time: '',
is_upload: '0',
upload_time: '',
upload_user2: [],
upload_user: null
}
export default {
name: 'DeviceStatus',
@ -295,13 +304,13 @@ export default {
[CRUD.HOOK.afterToEdit](crud, form) {
this.getUserList()
if (form.upload_user && form.upload_user !== '') {
form.upload_user = form.upload_user.split(',')
form.upload_user2 = form.upload_user.split(',')
} else {
form.upload_user = null
form.upload_user2 = []
}
},
[CRUD.HOOK.beforeSubmit](crud) {
const arr = crud.form.upload_user
const arr = crud.form.upload_user2
const regionCodes = arr.map(user => user).join(',')
this.crud.form.upload_user = regionCodes
},

Loading…
Cancel
Save