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

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