rev:物料编辑出错及基础分类异常
This commit is contained in:
@@ -38,7 +38,7 @@ public interface IBmClassStandardService extends IService<BmClassStandard> {
|
||||
List<Map> loadClass(Map whereJson);
|
||||
|
||||
|
||||
List<Map> queryClassBycode(Map whereJson);
|
||||
List<Map<String, Object>>queryClassBycode(Map<String, Object> whereJson);
|
||||
|
||||
List<Map> queryClassById(Map whereJson);
|
||||
|
||||
|
||||
@@ -97,25 +97,50 @@ public class BmClassStandardServiceImpl extends ServiceImpl<BmClassStandardMappe
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map> queryClassBycode(Map whereJson) {
|
||||
BmClassStandard classstandard = null;
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_code"))) {
|
||||
classstandard = this.getOne(new QueryWrapper<BmClassStandard>().eq("class_code", whereJson.get("parent_class_code")));
|
||||
if (classstandard == null) {
|
||||
throw new BadRequestException("请输入正确的父节点编号!");
|
||||
public List<Map<String, Object>> queryClassBycode(Map<String, Object> whereJson) {
|
||||
Object parent_class_code = whereJson.get("parent_class_code");
|
||||
String parent_class_id = "0";
|
||||
if (!ObjectUtil.isEmpty(parent_class_code)) {
|
||||
LambdaQueryWrapper<BmClassStandard> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(BmClassStandard::getClass_code, parent_class_code.toString());
|
||||
BmClassStandard bmClassStandard = this.baseMapper.selectOne(lqw);
|
||||
if (bmClassStandard != null) {
|
||||
parent_class_id = bmClassStandard.getClass_id();
|
||||
}
|
||||
}
|
||||
QueryWrapper<BmClassStandard> query = new QueryWrapper<BmClassStandard>().eq("is_delete", false);
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("class_code"))) {
|
||||
query.in("class_code", whereJson.get("class_code"));
|
||||
LambdaQueryWrapper<BmClassStandard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(BmClassStandard::getParent_class_id, parent_class_id);
|
||||
List<BmClassStandard> bmClassStandardsFather = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (BmClassStandard bmClassStandard : bmClassStandardsFather) {
|
||||
List<Map<String, Object>> sonList = getSonList(bmClassStandard.getClass_id());
|
||||
Map<String, Object> node = new HashMap<>();
|
||||
node.put("id", bmClassStandard.getClass_id());
|
||||
node.put("label", bmClassStandard.getClass_name());
|
||||
node.put("hasChildren", CollectionUtils.isEmpty(sonList) ? false : true);
|
||||
node.put("leaf", CollectionUtils.isEmpty(sonList) ? false : true);
|
||||
node.put("children", sonList);
|
||||
result.add(node);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_code")) && !whereJson.get("parent_class_code").equals("0")) {
|
||||
query.eq("class_id", classstandard.getClass_id());
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> getSonList(String parentClassId) {
|
||||
LambdaQueryWrapper<BmClassStandard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(BmClassStandard::getParent_class_id, parentClassId);
|
||||
List<BmClassStandard> bmClassStandards = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (BmClassStandard bmClassStandard : bmClassStandards) {
|
||||
List<Map<String, Object>> sonList = getSonList(bmClassStandard.getClass_id());
|
||||
Map<String, Object> node = new HashMap<>();
|
||||
node.put("id", bmClassStandard.getClass_id());
|
||||
node.put("label", bmClassStandard.getClass_name());
|
||||
node.put("hasChildren", CollectionUtils.isEmpty(sonList) ? false : true);
|
||||
node.put("leaf", CollectionUtils.isEmpty(sonList) ? false : true);
|
||||
node.put("children", sonList);
|
||||
result.add(node);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_code")) || whereJson.get("parent_class_code").equals("0")) {
|
||||
query.eq("parent_class_id", "0").or().isNull("parent_class_id");
|
||||
}
|
||||
return getMaps(this.listMaps(query));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,8 @@ package org.nl.wms.base_manage.material.service.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
@@ -123,6 +125,7 @@ public class MdMeMaterialbase implements Serializable {
|
||||
/**
|
||||
* 单重
|
||||
*/
|
||||
@TableField(insertStrategy = FieldStrategy.NEVER,updateStrategy = FieldStrategy.NEVER)
|
||||
private BigDecimal single_weight;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,10 +15,12 @@ public class MaterialQuery extends BaseQuery<MdMeMaterialbase> {
|
||||
|
||||
|
||||
private String search;
|
||||
private String material_type_id;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("search", QParam.builder().k(new String[]{"material_code","material_name"}).type(QueryTEnum.EQ).build());
|
||||
super.doP.put("material_type_id", QParam.builder().k(new String[]{"material_type_id"}).type(QueryTEnum.EQ).build());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
class="filter-item"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
<rrOperation/>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
@@ -62,19 +62,19 @@
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料编码" prop="material_code">
|
||||
<el-input v-model="form.material_code" style="width: 200px;" />
|
||||
<el-input v-model="form.material_code" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料名称" prop="material_name">
|
||||
<el-input v-model="form.material_name" style="width: 200px;" />
|
||||
<el-input v-model="form.material_name" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
||||
<el-form-item label="规格" prop="material_spec">
|
||||
<label slot="label">规 格</label>
|
||||
<el-input v-model="form.material_spec" style="width: 200px;" />
|
||||
<el-input v-model="form.material_spec" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -82,12 +82,32 @@
|
||||
<el-col :span="8">
|
||||
<el-form-item label="型号" prop="material_model">
|
||||
<label slot="label">型 号</label>
|
||||
<el-input v-model="form.material_model" style="width: 200px;" />
|
||||
<el-input v-model="form.material_model" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="最近重量" prop="nearby_weight">
|
||||
<label slot="label">最近重量</label>
|
||||
<el-input v-model="form.nearby_weight" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="单重" prop="single_weight">
|
||||
<label slot="label">单 重</label>
|
||||
<el-input v-model="form.single_weight" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="毛重" prop="gross_weight">
|
||||
<label slot="label">毛 重</label>
|
||||
<el-input v-model="form.gross_weight" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="外部标识" prop="ext_id">
|
||||
<el-input v-model="form.ext_id" style="width: 200px;" />
|
||||
<el-input v-model="form.ext_id" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -140,14 +160,14 @@
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="material_code" label="物料编码" width="160" />
|
||||
<el-table-column prop="material_name" label="物料名称" width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="material_spec" label="物料规格" width="140" />
|
||||
<el-table-column prop="material_model" label="物料型号" />
|
||||
<el-table-column prop="class_name" label="物料分类" width="140" />
|
||||
<el-table-column prop="unit_name" label="计量单位" />
|
||||
<el-table-column prop="net_weight" label="单重(g)" />
|
||||
<el-table-column prop="product_series_name" label="系列" />
|
||||
<el-table-column prop="material_code" label="物料编码" width="160"/>
|
||||
<el-table-column prop="material_name" label="物料名称" width="180" show-overflow-tooltip/>
|
||||
<el-table-column prop="material_spec" label="物料规格" width="140"/>
|
||||
<el-table-column prop="material_model" label="物料型号"/>
|
||||
<el-table-column prop="class_name" label="物料分类" width="140"/>
|
||||
<el-table-column prop="unit_name" label="计量单位"/>
|
||||
<el-table-column prop="net_weight" label="单重(g)"/>
|
||||
<el-table-column prop="product_series_name" label="系列"/>
|
||||
<el-table-column label="启用" align="center" prop="is_used">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
@@ -158,7 +178,7 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="update_optname" label="修改人" />
|
||||
<el-table-column prop="update_optname" label="修改人"/>
|
||||
<el-table-column
|
||||
prop="update_time"
|
||||
label="修改时间"
|
||||
@@ -180,22 +200,22 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<pagination/>
|
||||
</div>
|
||||
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()" />
|
||||
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudMaterialbase from './material'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import CRUD, {crud, form, header, presenter} from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||
import Treeselect, {LOAD_CHILDREN_OPTIONS} from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
// import crudClassstandard from '@/api/wms/basedata/master/classstandard'
|
||||
import crudClassstandard from '@/views/wms/base_manage/class_standard/classstandard'
|
||||
// import crudMdPbMeasureunit from '@/api/wms/basedata/master/mdPbMeasureunit'
|
||||
import UploadDialog from './UploadDialog'
|
||||
|
||||
@@ -232,22 +252,23 @@ const defaultForm = {
|
||||
is_delete: null,
|
||||
ext_id: null,
|
||||
material_height_type: null,
|
||||
product_series: null
|
||||
product_series: null,
|
||||
nearby_weight: null
|
||||
}
|
||||
export default {
|
||||
name: 'Material',
|
||||
// 数据字典
|
||||
dicts: ['is_used'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect, UploadDialog },
|
||||
components: {pagination, crudOperation, rrOperation, udOperation, Treeselect, UploadDialog},
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '物料',
|
||||
optShow: { add: true, reset: true },
|
||||
optShow: {add: true, reset: true},
|
||||
url: 'api/bmMaterial',
|
||||
idField: 'material_id',
|
||||
sort: 'material_id,desc',
|
||||
crudMethod: { ...crudMaterialbase }
|
||||
crudMethod: {...crudMaterialbase}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
@@ -263,28 +284,28 @@ export default {
|
||||
permission: {},
|
||||
rules: {
|
||||
material_id: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
{required: true, message: '不能为空', trigger: 'blur'}
|
||||
],
|
||||
material_code: [
|
||||
{ required: true, message: '物料编码不能为空', trigger: 'blur' }
|
||||
{required: true, message: '物料编码不能为空', trigger: 'blur'}
|
||||
],
|
||||
material_name: [
|
||||
{ required: true, message: '物料名称不能为空', trigger: 'blur' }
|
||||
{required: true, message: '物料名称不能为空', trigger: 'blur'}
|
||||
],
|
||||
material_type_id: [
|
||||
{ required: true, message: '物料分类不能为空', trigger: 'blur' }
|
||||
{required: true, message: '物料分类不能为空', trigger: 'blur'}
|
||||
],
|
||||
create_id: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
{required: true, message: '不能为空', trigger: 'blur'}
|
||||
],
|
||||
create_time: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
{required: true, message: '不能为空', trigger: 'blur'}
|
||||
],
|
||||
is_used: [
|
||||
{ required: true, message: '是否启用不能为空', trigger: 'blur' }
|
||||
{required: true, message: '是否启用不能为空', trigger: 'blur'}
|
||||
],
|
||||
material_height_type: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
{required: true, message: '不能为空', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -301,7 +322,7 @@ export default {
|
||||
},
|
||||
initClass1() {
|
||||
const param = {
|
||||
parent_class_code: '09'
|
||||
parent_class_code: ''
|
||||
}
|
||||
crudClassstandard.getClassType(param).then(res => {
|
||||
const data = res.content
|
||||
@@ -314,7 +335,7 @@ export default {
|
||||
},
|
||||
initClass2() {
|
||||
const param = {
|
||||
parent_class_code: '09'
|
||||
parent_class_code: ''
|
||||
}
|
||||
crudClassstandard.getClassType(param).then(res => {
|
||||
const data = res.content
|
||||
@@ -324,7 +345,7 @@ export default {
|
||||
},
|
||||
initClass3() {
|
||||
const param = {
|
||||
parent_class_code: '07'
|
||||
parent_class_code: ''
|
||||
}
|
||||
crudClassstandard.getClassType(param).then(res => {
|
||||
const data = res.content
|
||||
@@ -402,10 +423,10 @@ export default {
|
||||
})
|
||||
},
|
||||
// 获取子节点数据
|
||||
loadChildNodes({ action, parentNode, callback }) {
|
||||
loadChildNodes({action, parentNode, callback}) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
crudClassstandard.getClass({pid: parentNode.id}).then(res => {
|
||||
parentNode.children = res.content.map(function (obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user