Merge branch '0.8.X' of http://49.232.154.205:10100/DeXun/klp-oa into 0.8.X
This commit is contained in:
@@ -48,6 +48,8 @@ public class CostItem extends BaseEntity {
|
|||||||
* 查询条件(JSON格式)
|
* 查询条件(JSON格式)
|
||||||
*/
|
*/
|
||||||
private String queryCondition;
|
private String queryCondition;
|
||||||
|
|
||||||
|
private Long productionLineId;
|
||||||
/**
|
/**
|
||||||
* 删除标识 0=正常 2=删除
|
* 删除标识 0=正常 2=删除
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.klp.cost.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("wms_production_line")
|
||||||
|
public class WmsProductionLineSimple {
|
||||||
|
|
||||||
|
@TableId(value = "line_id")
|
||||||
|
private Long lineId;
|
||||||
|
|
||||||
|
private String lineName;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -52,5 +52,7 @@ public class CostItemBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String queryCondition;
|
private String queryCondition;
|
||||||
|
|
||||||
|
private Long productionLineId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,5 +61,10 @@ public class CostItemVo {
|
|||||||
@ExcelProperty(value = "查询条件(JSON格式)")
|
@ExcelProperty(value = "查询条件(JSON格式)")
|
||||||
private String queryCondition;
|
private String queryCondition;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "产线ID")
|
||||||
|
private Long productionLineId;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "产线")
|
||||||
|
private String productionLineName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,28 @@
|
|||||||
package com.klp.cost.service.impl;
|
package com.klp.cost.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.klp.common.core.page.TableDataInfo;
|
import com.klp.common.core.page.TableDataInfo;
|
||||||
import com.klp.common.core.domain.PageQuery;
|
import com.klp.common.core.domain.PageQuery;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||||
import com.klp.common.utils.StringUtils;
|
import com.klp.common.utils.StringUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.klp.cost.domain.bo.CostItemBo;
|
import com.klp.cost.domain.bo.CostItemBo;
|
||||||
import com.klp.cost.domain.vo.CostItemVo;
|
import com.klp.cost.domain.vo.CostItemVo;
|
||||||
import com.klp.cost.domain.CostItem;
|
import com.klp.cost.domain.CostItem;
|
||||||
|
import com.klp.cost.domain.WmsProductionLineSimple;
|
||||||
import com.klp.cost.mapper.CostItemMapper;
|
import com.klp.cost.mapper.CostItemMapper;
|
||||||
import com.klp.cost.service.ICostItemService;
|
import com.klp.cost.service.ICostItemService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成本项目配置Service业务层处理
|
* 成本项目配置Service业务层处理
|
||||||
@@ -36,7 +41,11 @@ public class CostItemServiceImpl implements ICostItemService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CostItemVo queryById(Long itemId){
|
public CostItemVo queryById(Long itemId){
|
||||||
return baseMapper.selectVoById(itemId);
|
CostItemVo vo = baseMapper.selectVoById(itemId);
|
||||||
|
if (vo != null) {
|
||||||
|
fillProductionLineName(CollUtil.newArrayList(vo));
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,6 +55,7 @@ public class CostItemServiceImpl implements ICostItemService {
|
|||||||
public TableDataInfo<CostItemVo> queryPageList(CostItemBo bo, PageQuery pageQuery) {
|
public TableDataInfo<CostItemVo> queryPageList(CostItemBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<CostItem> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<CostItem> lqw = buildQueryWrapper(bo);
|
||||||
Page<CostItemVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<CostItemVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
fillProductionLineName(result.getRecords());
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +65,9 @@ public class CostItemServiceImpl implements ICostItemService {
|
|||||||
@Override
|
@Override
|
||||||
public List<CostItemVo> queryList(CostItemBo bo) {
|
public List<CostItemVo> queryList(CostItemBo bo) {
|
||||||
LambdaQueryWrapper<CostItem> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<CostItem> lqw = buildQueryWrapper(bo);
|
||||||
return baseMapper.selectVoList(lqw);
|
List<CostItemVo> list = baseMapper.selectVoList(lqw);
|
||||||
|
fillProductionLineName(list);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LambdaQueryWrapper<CostItem> buildQueryWrapper(CostItemBo bo) {
|
private LambdaQueryWrapper<CostItem> buildQueryWrapper(CostItemBo bo) {
|
||||||
@@ -66,9 +78,32 @@ public class CostItemServiceImpl implements ICostItemService {
|
|||||||
lqw.eq(StringUtils.isNotBlank(bo.getCategory()), CostItem::getCategory, bo.getCategory());
|
lqw.eq(StringUtils.isNotBlank(bo.getCategory()), CostItem::getCategory, bo.getCategory());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), CostItem::getUnit, bo.getUnit());
|
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), CostItem::getUnit, bo.getUnit());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getQueryCondition()), CostItem::getQueryCondition, bo.getQueryCondition());
|
lqw.eq(StringUtils.isNotBlank(bo.getQueryCondition()), CostItem::getQueryCondition, bo.getQueryCondition());
|
||||||
|
lqw.eq(bo.getProductionLineId() != null, CostItem::getProductionLineId, bo.getProductionLineId());
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fillProductionLineName(List<CostItemVo> voList) {
|
||||||
|
if (CollUtil.isEmpty(voList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Long> lineIds = voList.stream()
|
||||||
|
.map(CostItemVo::getProductionLineId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollUtil.isEmpty(lineIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<Long, String> lineNameMap = Db.lambdaQuery(WmsProductionLineSimple.class)
|
||||||
|
.in(WmsProductionLineSimple::getLineId, lineIds)
|
||||||
|
.select(WmsProductionLineSimple::getLineId, WmsProductionLineSimple::getLineName)
|
||||||
|
.list()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(WmsProductionLineSimple::getLineId, WmsProductionLineSimple::getLineName, (a, b) -> a));
|
||||||
|
|
||||||
|
voList.forEach(v -> v.setProductionLineName(lineNameMap.get(v.getProductionLineId())));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增成本项目配置
|
* 新增成本项目配置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="unit" column="unit"/>
|
<result property="unit" column="unit"/>
|
||||||
<result property="remark" column="remark"/>
|
<result property="remark" column="remark"/>
|
||||||
<result property="queryCondition" column="query_condition"/>
|
<result property="queryCondition" column="query_condition"/>
|
||||||
|
<result property="productionLineId" column="production_line_id"/>
|
||||||
<result property="delFlag" column="del_flag"/>
|
<result property="delFlag" column="del_flag"/>
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
|
|||||||
@@ -42,6 +42,17 @@
|
|||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="产线" prop="productionLineId">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.productionLineId"
|
||||||
|
placeholder="请选择产线"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
@change="handleQuery"
|
||||||
|
>
|
||||||
|
<el-option v-for="l in lineOptions" :key="l.lineId" :label="l.lineName" :value="l.lineId" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="查询条件" prop="queryCondition">
|
<el-form-item label="查询条件" prop="queryCondition">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.queryCondition"
|
v-model="queryParams.queryCondition"
|
||||||
@@ -105,6 +116,7 @@
|
|||||||
<el-table-column label="成本项目名称" align="center" prop="itemName" />
|
<el-table-column label="成本项目名称" align="center" prop="itemName" />
|
||||||
<el-table-column label="成本分类" align="center" prop="category" />
|
<el-table-column label="成本分类" align="center" prop="category" />
|
||||||
<el-table-column label="计量单位" align="center" prop="unit" />
|
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||||
|
<el-table-column label="产线" align="center" prop="productionLineName" />
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="查询条件" align="center" prop="queryCondition" />
|
<el-table-column label="查询条件" align="center" prop="queryCondition" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
@@ -157,6 +169,11 @@
|
|||||||
<el-form-item label="计量单位" prop="unit">
|
<el-form-item label="计量单位" prop="unit">
|
||||||
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="产线" prop="productionLineId">
|
||||||
|
<el-select v-model="form.productionLineId" placeholder="请选择产线" clearable filterable style="width:100%">
|
||||||
|
<el-option v-for="l in lineOptions" :key="l.lineId" :label="l.lineName" :value="l.lineId" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -174,6 +191,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listItem, getItem, delItem, addItem, updateItem } from "@/api/cost/item";
|
import { listItem, getItem, delItem, addItem, updateItem } from "@/api/cost/item";
|
||||||
|
import { listProductionLine } from "@/api/wms/productionLine";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Item",
|
name: "Item",
|
||||||
@@ -195,6 +213,7 @@ export default {
|
|||||||
total: 0,
|
total: 0,
|
||||||
// 成本项目配置表格数据
|
// 成本项目配置表格数据
|
||||||
itemList: [],
|
itemList: [],
|
||||||
|
lineOptions: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
@@ -207,6 +226,7 @@ export default {
|
|||||||
itemName: undefined,
|
itemName: undefined,
|
||||||
category: undefined,
|
category: undefined,
|
||||||
unit: undefined,
|
unit: undefined,
|
||||||
|
productionLineId: undefined,
|
||||||
queryCondition: undefined,
|
queryCondition: undefined,
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
@@ -217,9 +237,15 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.loadLines();
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
loadLines() {
|
||||||
|
listProductionLine({ pageSize: 9999 }).then(res => {
|
||||||
|
this.lineOptions = res.rows || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
/** 查询成本项目配置列表 */
|
/** 查询成本项目配置列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@@ -242,6 +268,7 @@ export default {
|
|||||||
itemName: undefined,
|
itemName: undefined,
|
||||||
category: undefined,
|
category: undefined,
|
||||||
unit: undefined,
|
unit: undefined,
|
||||||
|
productionLineId: undefined,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
queryCondition: undefined,
|
queryCondition: undefined,
|
||||||
delFlag: undefined,
|
delFlag: undefined,
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE `cost_item`
|
||||||
|
ADD COLUMN `production_line_id` bigint NULL COMMENT '产线ID' AFTER `query_condition`;
|
||||||
|
|
||||||
|
CREATE INDEX `idx_cost_item_production_line_id` ON `cost_item` (`production_line_id`);
|
||||||
|
|
||||||
Reference in New Issue
Block a user