rev:物料编辑出错及基础分类异常

This commit is contained in:
2024-07-16 11:26:03 +08:00
parent 898021cc8a
commit a8dbf3c7cf
6 changed files with 106 additions and 54 deletions

View File

@@ -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);

View File

@@ -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;
}
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");
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);
}
return getMaps(this.listMaps(query));
return result;
}

View File

@@ -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;
/**

View File

@@ -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;
/**

View File

@@ -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());
}

View File

@@ -85,6 +85,26 @@
<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">单&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;重</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">毛&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;重</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;"/>
@@ -195,7 +215,7 @@ import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
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,7 +252,8 @@ 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',
@@ -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