feat(wms): 添加钢卷类别统计——汇总统计

- 新增 CategoryWidthRawVo 和 CategoryWidthStatisticsVo 数据传输对象
- 在 IWmsMaterialCoilService 中添加 getCategoryWidthStatistics 方法定义
- 实现 WmsMaterialCoilController 的 categoryWidthStatistics 接口
- 添加 WmsMaterialCoilMapper 的 selectCategoryWidthStatistics 查询方法
- 实现 WmsMaterialCoilServiceImpl 中的 getCategoryWidthStatistics 业务逻辑
- 在 XML 映射文件中添加类别宽度统计的 SQL 查询语句
This commit is contained in:
2026-03-09 10:46:22 +08:00
parent 7736ac3311
commit 0050af7677
7 changed files with 145 additions and 0 deletions

View File

@@ -21,6 +21,8 @@ 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.vo.dashboard.CategoryWidthStatisticsVo;
import com.klp.domain.vo.dashboard.CategoryWidthRawVo;
import com.klp.domain.WmsCoilPendingAction;
import com.klp.domain.bo.WmsCoilPendingActionBo;
import com.klp.mapper.*;
@@ -4395,5 +4397,60 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
return result;
}
@Override
public List<CategoryWidthStatisticsVo> getCategoryWidthStatistics() {
List<CategoryWidthRawVo> rawList = baseMapper.selectCategoryWidthStatistics();
Map<String, List<CategoryWidthRawVo>> byCategory = rawList.stream()
.collect(Collectors.groupingBy(v -> v.getCategory() == null ? "其他" : v.getCategory()));
List<CategoryWidthStatisticsVo> result = new ArrayList<>();
for (Map.Entry<String, List<CategoryWidthRawVo>> categoryEntry : byCategory.entrySet()) {
CategoryWidthStatisticsVo vo = new CategoryWidthStatisticsVo();
vo.setCategory(categoryEntry.getKey());
BigDecimal total = BigDecimal.ZERO;
BigDecimal width1000 = BigDecimal.ZERO;
BigDecimal width1200 = BigDecimal.ZERO;
BigDecimal width1220 = BigDecimal.ZERO;
BigDecimal width1250 = BigDecimal.ZERO;
BigDecimal otherWidth = BigDecimal.ZERO;
for (CategoryWidthRawVo raw : categoryEntry.getValue()) {
BigDecimal weight = raw.getTotalWeight() == null ? BigDecimal.ZERO : raw.getTotalWeight();
String width = raw.getWidth();
String isTrimmed = raw.getIsTrimmed();
if ("净边".equals(isTrimmed)) {
if ("1000".equals(width)) {
width1000 = width1000.add(weight);
} else if ("1200".equals(width)) {
width1200 = width1200.add(weight);
} else if ("1220".equals(width)) {
width1220 = width1220.add(weight);
} else if ("1250".equals(width)) {
width1250 = width1250.add(weight);
} else {
otherWidth = otherWidth.add(weight);
}
} else {
otherWidth = otherWidth.add(weight);
}
total = total.add(weight);
}
vo.setWidth1000(width1000);
vo.setWidth1200(width1200);
vo.setWidth1220(width1220);
vo.setWidth1250(width1250);
vo.setOtherWidth(otherWidth);
vo.setTotal(total);
result.add(vo);
}
return result;
}
}