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

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