opt:优化物料创建时单位为空问题
This commit is contained in:
@@ -9,12 +9,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.common.utils.IdUtil;
|
import org.nl.common.utils.IdUtil;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||||
|
import org.nl.wms.basedata_manage.service.IMdPbMeasureunitService;
|
||||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||||
|
import org.nl.wms.basedata_manage.service.dao.MdPbMeasureunit;
|
||||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdMeMaterialbaseMapper;
|
import org.nl.wms.basedata_manage.service.dao.mapper.MdMeMaterialbaseMapper;
|
||||||
import org.nl.wms.ext_manage.service.WmsToErpService;
|
import org.nl.wms.ext_manage.service.WmsToErpService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -44,6 +47,12 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
|||||||
@Autowired
|
@Autowired
|
||||||
private WmsToErpService wmsToErpService;
|
private WmsToErpService wmsToErpService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wms调用erp服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private IMdPbMeasureunitService iMdPbMeasureunitService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<MdMeMaterialbase> queryAll(Map whereJson, PageQuery page) {
|
public IPage<MdMeMaterialbase> queryAll(Map whereJson, PageQuery page) {
|
||||||
// 查询条件
|
// 查询条件
|
||||||
@@ -62,7 +71,6 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
|
||||||
public void create(MdMeMaterialbase dto) {
|
public void create(MdMeMaterialbase dto) {
|
||||||
// 根据物料编码查询是否有相同物料编码的物料
|
// 根据物料编码查询是否有相同物料编码的物料
|
||||||
MdMeMaterialbase mdMeMaterialbase = this.baseMapper.selectOne(
|
MdMeMaterialbase mdMeMaterialbase = this.baseMapper.selectOne(
|
||||||
@@ -72,7 +80,10 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
|||||||
if (ObjectUtil.isNotEmpty(mdMeMaterialbase)) {
|
if (ObjectUtil.isNotEmpty(mdMeMaterialbase)) {
|
||||||
throw new BadRequestException("当前物料编码已存在【"+dto.getMaterial_code()+"】");
|
throw new BadRequestException("当前物料编码已存在【"+dto.getMaterial_code()+"】");
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isEmpty(dto.getQty_unit_id())){
|
||||||
|
throw new BadRequestException("创建物料失败,物料单位不能为空");
|
||||||
|
}
|
||||||
|
final MdPbMeasureunit measureunit = iMdPbMeasureunitService.getById(dto.getQty_unit_id());
|
||||||
// 新增
|
// 新增
|
||||||
dto.setMaterial_id(IdUtil.getStringId());
|
dto.setMaterial_id(IdUtil.getStringId());
|
||||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||||
@@ -81,6 +92,8 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
|||||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||||
dto.setUpdate_time(DateUtil.now());
|
dto.setUpdate_time(DateUtil.now());
|
||||||
|
dto.setQty_unit_id(measureunit.getMeasure_unit_id());
|
||||||
|
dto.setQty_unit_name(measureunit.getUnit_name());
|
||||||
this.save(dto);
|
this.save(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,13 +140,6 @@ public class Point2PointTask extends AbstractTask {
|
|||||||
.set(SchBasePoint::getIos_id, null)
|
.set(SchBasePoint::getIos_id, null)
|
||||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
||||||
);
|
);
|
||||||
iStructattrService.update(
|
|
||||||
new UpdateWrapper<Structattr>().lambda()
|
|
||||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code1())
|
|
||||||
.set(Structattr::getStoragevehicle_code, null)
|
|
||||||
.set(Structattr::getTask_code, null)
|
|
||||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
|
||||||
);
|
|
||||||
// 更新终点
|
// 更新终点
|
||||||
iSchBasePointService.update(
|
iSchBasePointService.update(
|
||||||
new UpdateWrapper<SchBasePoint>().lambda()
|
new UpdateWrapper<SchBasePoint>().lambda()
|
||||||
@@ -155,13 +148,6 @@ public class Point2PointTask extends AbstractTask {
|
|||||||
.set(SchBasePoint::getIos_id, null)
|
.set(SchBasePoint::getIos_id, null)
|
||||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有货"))
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有货"))
|
||||||
);
|
);
|
||||||
iStructattrService.update(
|
|
||||||
new UpdateWrapper<Structattr>().lambda()
|
|
||||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code2())
|
|
||||||
.set(Structattr::getStoragevehicle_code, taskObj.getVehicle_code())
|
|
||||||
.set(Structattr::getTask_code, null)
|
|
||||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
|
||||||
);
|
|
||||||
// 更新任务
|
// 更新任务
|
||||||
taskObj.setRemark("已完成");
|
taskObj.setRemark("已完成");
|
||||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
@@ -170,28 +156,6 @@ public class Point2PointTask extends AbstractTask {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void cancelTask(SchBaseTask taskObj) {
|
public void cancelTask(SchBaseTask taskObj) {
|
||||||
// 更新起点
|
|
||||||
iSchBasePointService.update(
|
|
||||||
new UpdateWrapper<SchBasePoint>().lambda()
|
|
||||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
|
||||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
|
||||||
);
|
|
||||||
iStructattrService.update(
|
|
||||||
new UpdateWrapper<Structattr>().lambda()
|
|
||||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code1())
|
|
||||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
|
||||||
);
|
|
||||||
// 更新终点
|
|
||||||
iSchBasePointService.update(
|
|
||||||
new UpdateWrapper<SchBasePoint>().lambda()
|
|
||||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
|
|
||||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
|
||||||
);
|
|
||||||
iStructattrService.update(
|
|
||||||
new UpdateWrapper<Structattr>().lambda()
|
|
||||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code2())
|
|
||||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
|
||||||
);
|
|
||||||
// 更新任务
|
// 更新任务
|
||||||
taskObj.setRemark("已取消");
|
taskObj.setRemark("已取消");
|
||||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
|
|||||||
@@ -74,6 +74,22 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="单 位" prop="qty_unit_id">
|
||||||
|
<el-select
|
||||||
|
v-model="form.qty_unit_id"
|
||||||
|
style="width: 200px"
|
||||||
|
placeholder=""
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in tableEnum.md_pb_measureunit"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="静置时间" prop="standing_time">
|
<el-form-item label="静置时间" prop="standing_time">
|
||||||
<el-input-number v-model="form.standing_time" :controls="false" :min="0" label="分钟" style="width: 200px;" />
|
<el-input-number v-model="form.standing_time" :controls="false" :min="0" label="分钟" style="width: 200px;" />
|
||||||
@@ -104,7 +120,9 @@
|
|||||||
<el-table-column prop="material_code" label="物料编码" width="160" />
|
<el-table-column prop="material_code" label="物料编码" width="160" />
|
||||||
<el-table-column prop="material_name" label="物料名称" width="160" show-overflow-tooltip />
|
<el-table-column prop="material_name" label="物料名称" width="160" show-overflow-tooltip />
|
||||||
<el-table-column prop="material_spec" label="物料规格" width="160" show-overflow-tooltip />
|
<el-table-column prop="material_spec" label="物料规格" width="160" show-overflow-tooltip />
|
||||||
<el-table-column prop="material_model" label="物料型号" width="680" show-overflow-tooltip />
|
<el-table-column prop="material_model" label="物料型号" width="160" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="qty_unit_name" label="单位" width="160" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="ext_id" label="外部标识" width="160" show-overflow-tooltip />
|
||||||
<el-table-column prop="class_name" label="物料分类" width="140" />
|
<el-table-column prop="class_name" label="物料分类" width="140" />
|
||||||
<el-table-column label="启用" align="center" prop="is_used">
|
<el-table-column label="启用" align="center" prop="is_used">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
@@ -163,7 +181,7 @@ const defaultForm = {
|
|||||||
approve_fileno: null,
|
approve_fileno: null,
|
||||||
print_no: null,
|
print_no: null,
|
||||||
material_type_id: null,
|
material_type_id: null,
|
||||||
len_unit_id: null,
|
qty_unit_id: null,
|
||||||
length: null,
|
length: null,
|
||||||
width: null,
|
width: null,
|
||||||
height: null,
|
height: null,
|
||||||
@@ -189,6 +207,7 @@ export default {
|
|||||||
name: 'Materia',
|
name: 'Materia',
|
||||||
// 数据字典
|
// 数据字典
|
||||||
dicts: ['is_used'],
|
dicts: ['is_used'],
|
||||||
|
tableEnums: ['md_pb_measureunit#unit_name#measure_unit_id'],
|
||||||
components: { UploadDialog, pagination, crudOperation, rrOperation, udOperation },
|
components: { UploadDialog, pagination, crudOperation, rrOperation, udOperation },
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
@@ -221,6 +240,9 @@ export default {
|
|||||||
material_name: [
|
material_name: [
|
||||||
{ required: true, message: '物料名称不能为空', trigger: 'blur' }
|
{ required: true, message: '物料名称不能为空', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
|
qty_unit_id: [
|
||||||
|
{ required: true, message: '单位不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
create_id: [
|
create_id: [
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user