feat: 排产计划主表加了一些字段展示

This commit is contained in:
JR
2025-07-29 17:09:44 +08:00
parent ecb5ec77d4
commit 6191c039af
8 changed files with 170 additions and 15 deletions

View File

@@ -22,7 +22,7 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
@@ -31,7 +31,7 @@
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
@@ -42,7 +42,7 @@
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
@@ -53,7 +53,7 @@
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
@@ -63,17 +63,33 @@
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="schedulePlanList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="排产计划ID" align="center" prop="planId" v-if="true"/>
<!-- <el-table-column label="排产计划ID" align="center" prop="planId" v-if="true"/>-->
<el-table-column label="排产计划编号" align="center" prop="planCode" />
<el-table-column label="关联订单ID" align="center" prop="orderId" />
<el-table-column label="工艺路线" align="center" prop="processRoute" />
<el-table-column label="开始时间" align="center" prop="startDate">
<template slot-scope="scope">
{{ scope.row.startDate ? scope.row.startDate.substr(0, 10) : '' }}
</template>
</el-table-column>
<el-table-column label="结束时间" align="center" prop="endDate">
<template slot-scope="scope">
{{ scope.row.endDate ? scope.row.endDate.substr(0, 10) : '' }}
</template>
</el-table-column>
<el-table-column label="优先级" align="center" prop="priority">
<template slot-scope="scope">
<dict-tag :options="dict.type.schedule_plan_priority" :value="scope.row.priority" />
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<el-tag :type="statusTagType(scope.row.status)" disable-transitions>
@@ -82,6 +98,12 @@
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@@ -89,14 +111,14 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
<el-button
size="mini"
@@ -107,7 +129,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@@ -115,7 +137,7 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改排产计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
@@ -130,6 +152,19 @@
<el-option v-for="item in orderList" :key="item.orderId" :label="item.orderCode || item.orderId" :value="item.orderId" />
</el-select>
</el-form-item>
<el-form-item label="优先级" prop="priority">
<el-select v-model="form.priority" placeholder="请选择优先级">
<el-option
v-for="dict in dict.type.schedule_plan_priority"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="工艺路线" prop="processRoute">
<el-input v-model="form.processRoute" placeholder="请输入工艺路线" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
@@ -141,13 +176,14 @@
</el-dialog>
</div>
</template>
<script>
import { listSchedulePlan, getSchedulePlan, delSchedulePlan, addSchedulePlan, updateSchedulePlan } from "@/api/wms/schedulePlan";
import { listOrder } from "@/api/wms/order";
export default {
name: "SchedulePlan",
dicts: ['schedule_plan_priority'],
data() {
return {
// 按钮loading
@@ -218,7 +254,11 @@
createTime: undefined,
createBy: undefined,
updateTime: undefined,
updateBy: undefined
updateBy: undefined,
priority: undefined,
processRoute: undefined,
startDate: undefined,
endDate: undefined,
};
this.resetForm("form");
},
@@ -354,4 +394,3 @@
}
};
</script>

View File

@@ -51,4 +51,13 @@ public class WmsSchedulePlan extends BaseEntity {
@TableLogic
private Integer delFlag;
/**
* 优先级(0=低1=中2=高3=vip ....)
*/
private Long priority;
/**
* 工艺路线
*/
private String processRoute;
}

View File

@@ -47,5 +47,13 @@ public class WmsSchedulePlanBo extends BaseEntity {
*/
private String remark;
/**
* 优先级(0=低1=中2=高3=vip ....)
*/
private Long priority;
/**
* 工艺路线
*/
private String processRoute;
}

View File

@@ -0,0 +1,15 @@
package com.klp.domain.vo;
import lombok.Data;
import java.util.Date;
/**
* 用于计算排产计划开始结束时间的聚合类
*/
@Data
public class PlanTimeAgg {
private Long planId;
private Date startDate;
private Date endDate;
}

View File

@@ -2,10 +2,14 @@ package com.klp.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.klp.common.annotation.ExcelDictFormat;
import com.klp.common.convert.ExcelDictConvert;
import lombok.Data;
import java.util.Date;
/**
* 排产计划视图对象 wms_schedule_plan
@@ -50,5 +54,38 @@ public class WmsSchedulePlanVo {
@ExcelProperty(value = "备注")
private String remark;
/**
* 创建者
*/
@ExcelProperty(value = "创建者")
private String createBy;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
* 优先级(0=低1=中2=高3=vip ....)
*/
@ExcelProperty(value = "优先级")
private Long priority;
/**
* 工艺路线
*/
@ExcelProperty(value = "工艺路线")
private String processRoute;
/**
* 计划开始日期
*/
@ExcelProperty(value = "计划开始日期")
private Date startDate;
/**
* 计划结束日期
*/
@ExcelProperty(value = "计划结束日期")
private Date endDate;
}

View File

@@ -1,8 +1,12 @@
package com.klp.mapper;
import com.klp.domain.WmsSchedulePlanDetail;
import com.klp.domain.vo.PlanTimeAgg;
import com.klp.domain.vo.WmsSchedulePlanDetailVo;
import com.klp.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 排产计划明细Mapper接口
@@ -12,4 +16,5 @@ import com.klp.common.core.mapper.BaseMapperPlus;
*/
public interface WmsSchedulePlanDetailMapper extends BaseMapperPlus<WmsSchedulePlanDetailMapper, WmsSchedulePlanDetail, WmsSchedulePlanDetailVo> {
List<PlanTimeAgg> selectPlanTimeAgg(@Param("planIds") List<Long> planIds);
}

View File

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.klp.common.utils.StringUtils;
import com.klp.domain.vo.PlanTimeAgg;
import com.klp.mapper.WmsSchedulePlanDetailMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.klp.domain.bo.WmsSchedulePlanBo;
@@ -15,9 +17,12 @@ import com.klp.domain.WmsSchedulePlan;
import com.klp.mapper.WmsSchedulePlanMapper;
import com.klp.service.IWmsSchedulePlanService;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 排产计划Service业务层处理
@@ -31,6 +36,9 @@ public class WmsSchedulePlanServiceImpl implements IWmsSchedulePlanService {
private final WmsSchedulePlanMapper baseMapper;
@Resource
private WmsSchedulePlanDetailMapper wmsSchedulePlanDetailMapper;
/**
* 查询排产计划
*/
@@ -46,6 +54,25 @@ public class WmsSchedulePlanServiceImpl implements IWmsSchedulePlanService {
public TableDataInfo<WmsSchedulePlanVo> queryPageList(WmsSchedulePlanBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<WmsSchedulePlan> lqw = buildQueryWrapper(bo);
Page<WmsSchedulePlanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
// 查排产计划总的开始结束时间
// 获取所有planId
List<Long> planIds = result.getRecords().stream()
.map(WmsSchedulePlanVo::getPlanId)
.collect(Collectors.toList());
if (!planIds.isEmpty()) {
// 查询详情表的最早/最晚时间
List<PlanTimeAgg> aggList = wmsSchedulePlanDetailMapper.selectPlanTimeAgg(planIds);
Map<Long, PlanTimeAgg> aggMap = aggList.stream()
.collect(Collectors.toMap(PlanTimeAgg::getPlanId, Function.identity()));
// 填充到VO
for (WmsSchedulePlanVo vo : result.getRecords()) {
PlanTimeAgg agg = aggMap.get(vo.getPlanId());
if (agg != null) {
vo.setStartDate(agg.getStartDate());
vo.setEndDate(agg.getEndDate());
}
}
}
return TableDataInfo.build(result);
}

View File

@@ -20,5 +20,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by"/>
</resultMap>
<select id="selectPlanTimeAgg" resultType="com.klp.domain.vo.PlanTimeAgg">
SELECT
plan_id,
MIN(start_date) AS startDate,
MAX(end_date) AS endDate
FROM
wms_schedule_plan_detail
WHERE
plan_id IN
<foreach collection="planIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
GROUP BY
plan_id
</select>
</mapper>