feat(wms): 新增第三个报表统计——冷硬卷统计
- 在IWmsMaterialCoilService中添加getCoilTrimStatistics方法 - 在WmsMaterialCoilController中新增trimStatistics接口 - 在WmsMaterialCoilMapper中添加selectCoilTrimStatistics查询方法 - 在WmsMaterialCoilMapper.xml中实现切边统计数据SQL查询 - 在WmsMaterialCoilServiceImpl中实现切边统计业务逻辑 - 新增CoilTrimRawVo、CoilTrimStatisticsVo和TrimWidthStatisticsVo数据传输对象 - 按厚度、宽度、切边要求(净边/毛边)统计钢卷数量和重量 - 实现数据分组和排序功能,支持前端展示需求
This commit is contained in:
@@ -18,6 +18,9 @@ import com.klp.common.utils.StringUtils;
|
||||
import com.klp.domain.*;
|
||||
import com.klp.domain.bo.*;
|
||||
import com.klp.domain.vo.*;
|
||||
import com.klp.domain.vo.dashboard.CoilTrimStatisticsVo;
|
||||
import com.klp.domain.vo.dashboard.CoilTrimRawVo;
|
||||
import com.klp.domain.vo.dashboard.TrimWidthStatisticsVo;
|
||||
import com.klp.domain.WmsCoilPendingAction;
|
||||
import com.klp.domain.bo.WmsCoilPendingActionBo;
|
||||
import com.klp.mapper.*;
|
||||
@@ -4304,5 +4307,77 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CoilTrimStatisticsVo> getCoilTrimStatistics() {
|
||||
List<CoilTrimRawVo> rawList = baseMapper.selectCoilTrimStatistics();
|
||||
|
||||
Map<String, List<CoilTrimRawVo>> byThickness = rawList.stream()
|
||||
.collect(Collectors.groupingBy(v -> v.getThickness() == null ? "空置" : v.getThickness()));
|
||||
|
||||
List<CoilTrimStatisticsVo> result = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<String, List<CoilTrimRawVo>> thicknessEntry : byThickness.entrySet()) {
|
||||
CoilTrimStatisticsVo vo = new CoilTrimStatisticsVo();
|
||||
vo.setThickness(thicknessEntry.getKey());
|
||||
|
||||
List<CoilTrimRawVo> thicknessList = thicknessEntry.getValue();
|
||||
|
||||
Map<String, List<CoilTrimRawVo>> byTrim = thicknessList.stream()
|
||||
.collect(Collectors.groupingBy(v -> v.getTrimmingRequirement() == null ? "未知" : v.getTrimmingRequirement()));
|
||||
|
||||
List<CoilTrimStatisticsVo> resultList = new ArrayList<>();
|
||||
for (Map.Entry<String, List<CoilTrimRawVo>> trimEntry : byTrim.entrySet()) {
|
||||
CoilTrimStatisticsVo trimVo = new CoilTrimStatisticsVo();
|
||||
trimVo.setThickness(trimEntry.getKey());
|
||||
|
||||
List<TrimWidthStatisticsVo> widthList = new ArrayList<>();
|
||||
for (CoilTrimRawVo raw : trimEntry.getValue()) {
|
||||
TrimWidthStatisticsVo widthVo = new TrimWidthStatisticsVo();
|
||||
widthVo.setWidth(raw.getWidth() == null ? "空置" : raw.getWidth());
|
||||
widthVo.setCoilCount(raw.getCoilCount() == null ? 0 : raw.getCoilCount());
|
||||
widthVo.setTotalWeight(raw.getTotalWeight() == null ? BigDecimal.ZERO : raw.getTotalWeight());
|
||||
widthList.add(widthVo);
|
||||
}
|
||||
trimVo.setTrimmedList(widthList);
|
||||
resultList.add(trimVo);
|
||||
}
|
||||
|
||||
List<CoilTrimRawVo> trimmedList = byTrim.getOrDefault("净边", new ArrayList<>());
|
||||
List<CoilTrimRawVo> untrimmedList = byTrim.getOrDefault("毛边", new ArrayList<>());
|
||||
|
||||
List<TrimWidthStatisticsVo> trimmedWidthList = new ArrayList<>();
|
||||
for (CoilTrimRawVo raw : trimmedList) {
|
||||
TrimWidthStatisticsVo widthVo = new TrimWidthStatisticsVo();
|
||||
widthVo.setWidth(raw.getWidth() == null ? "空置" : raw.getWidth());
|
||||
widthVo.setCoilCount(raw.getCoilCount() == null ? 0 : raw.getCoilCount());
|
||||
widthVo.setTotalWeight(raw.getTotalWeight() == null ? BigDecimal.ZERO : raw.getTotalWeight());
|
||||
trimmedWidthList.add(widthVo);
|
||||
}
|
||||
|
||||
List<TrimWidthStatisticsVo> untrimmedWidthList = new ArrayList<>();
|
||||
for (CoilTrimRawVo raw : untrimmedList) {
|
||||
TrimWidthStatisticsVo widthVo = new TrimWidthStatisticsVo();
|
||||
widthVo.setWidth(raw.getWidth() == null ? "空置" : raw.getWidth());
|
||||
widthVo.setCoilCount(raw.getCoilCount() == null ? 0 : raw.getCoilCount());
|
||||
widthVo.setTotalWeight(raw.getTotalWeight() == null ? BigDecimal.ZERO : raw.getTotalWeight());
|
||||
untrimmedWidthList.add(widthVo);
|
||||
}
|
||||
|
||||
vo.setTrimmedList(trimmedWidthList);
|
||||
vo.setUntrimmedList(untrimmedWidthList);
|
||||
result.add(vo);
|
||||
}
|
||||
|
||||
result.sort(Comparator.comparing(v -> {
|
||||
try {
|
||||
return new BigDecimal(v.getThickness());
|
||||
} catch (Exception e) {
|
||||
return new BigDecimal("999999");
|
||||
}
|
||||
}));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user