feat(wms): 增加根据实际库区查询钢卷分布的接口及相关字段

This commit is contained in:
2025-11-17 17:57:57 +08:00
parent 3f507cef5b
commit 0b29ce7f50
6 changed files with 155 additions and 27 deletions

View File

@@ -86,5 +86,7 @@ public interface IWmsMaterialCoilService {
List<WmsMaterialCoilVo> getDistributionByItemType(String itemType, Long itemId);
List<WmsMaterialCoilVo> getDistributionByActualWarehouse(String itemType, Long itemId);
List<WmsMaterialCoilVo> getDistributionByActualItemType(String itemType, Long itemId);
}

View File

@@ -39,14 +39,8 @@ import com.klp.domain.vo.WmsActualWarehouseVo;
import com.klp.domain.vo.WmsProductVo;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
import java.util.Collection;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.*;
import java.util.stream.Collectors;
import java.util.HashSet;
import java.util.Set;
import java.math.BigDecimal;
/**
@@ -1233,12 +1227,12 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
LambdaQueryWrapper<com.klp.domain.WmsGenerateRecord> splitWrapper = Wrappers.lambdaQuery();
splitWrapper.like(com.klp.domain.WmsGenerateRecord::getSerialNumber, enterCoilNo + "-");
List<WmsGenerateRecordVo> splitRecords = generateRecordMapper.selectVoList(splitWrapper);
// 去重使用recordId作为唯一标识
Set<Long> existingRecordIds = allQrRecords.stream()
.map(WmsGenerateRecordVo::getRecordId)
.collect(Collectors.toSet());
for (WmsGenerateRecordVo record : splitRecords) {
if (record.getRecordId() != null && !existingRecordIds.contains(record.getRecordId())) {
allQrRecords.add(record);
@@ -1252,7 +1246,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
// 优化2: ObjectMapper在循环外创建避免重复创建
ObjectMapper objectMapper = new ObjectMapper();
// 2. 合并所有二维码的steps信息去重并重新编号
Map<String, Map<String, Object>> uniqueSteps = new HashMap<>(); // 用于去重
Set<String> allCoilNos = new HashSet<>();
@@ -1472,6 +1466,9 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
List<Map<String, Object>> mapList = baseMapper.getDistributionByActualWarehouse(itemType, itemId);
return convertMapListToVoListActual(mapList);
}
private List<WmsMaterialCoilVo> convertMapListToVoListActual(List<Map<String, Object>> mapList) {
List<WmsMaterialCoilVo> voList = new ArrayList<>();
for (Map<String, Object> map : mapList) {
@@ -1483,6 +1480,13 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
vo.setCoilCount(map.get("coil_count") != null ? Long.valueOf(map.get("coil_count").toString()) : 0L);
vo.setTotalGrossWeight(map.get("total_gross_weight") != null ? new BigDecimal(map.get("total_gross_weight").toString()) : BigDecimal.ZERO);
vo.setTotalNetWeight(map.get("total_net_weight") != null ? new BigDecimal(map.get("total_net_weight").toString()) : BigDecimal.ZERO);
vo.setItemName(map.get("itemName") != null ? map.get("itemName").toString() : null);
vo.setItemCode(map.get("itemCode") != null ? map.get("itemCode").toString() : null);
vo.setSpecification(map.get("specification") != null ? map.get("specification").toString() : null);
vo.setMaterial(map.get("material") != null ? map.get("material").toString() : null);
vo.setSurfaceTreatmentDesc(map.get("surfaceTreatmentDesc") != null ? map.get("surfaceTreatmentDesc").toString() : null);
vo.setZincLayer(map.get("zincLayer") != null ? map.get("zincLayer").toString() : null);
vo.setManufacturer(map.get("manufacturer") != null ? map.get("manufacturer").toString() : null);
voList.add(vo);
}
return voList;
@@ -1515,9 +1519,22 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
vo.setCoilCount(map.get("coil_count") != null ? Long.valueOf(map.get("coil_count").toString()) : 0L);
vo.setTotalGrossWeight(map.get("total_gross_weight") != null ? new BigDecimal(map.get("total_gross_weight").toString()) : BigDecimal.ZERO);
vo.setTotalNetWeight(map.get("total_net_weight") != null ? new BigDecimal(map.get("total_net_weight").toString()) : BigDecimal.ZERO);
vo.setItemName(map.get("itemName") != null ? map.get("itemName").toString() : null);
vo.setItemCode(map.get("itemCode") != null ? map.get("itemCode").toString() : null);
vo.setSpecification(map.get("specification") != null ? map.get("specification").toString() : null);
vo.setMaterial(map.get("material") != null ? map.get("material").toString() : null);
vo.setSurfaceTreatmentDesc(map.get("surfaceTreatmentDesc") != null ? map.get("surfaceTreatmentDesc").toString() : null);
vo.setZincLayer(map.get("zincLayer") != null ? map.get("zincLayer").toString() : null);
vo.setManufacturer(map.get("manufacturer") != null ? map.get("manufacturer").toString() : null);
voList.add(vo);
}
return voList;
}
@Override
public List<WmsMaterialCoilVo> getDistributionByActualItemType(String itemType, Long itemId) {
List<Map<String, Object>> mapList = baseMapper.getDistributionByActualItemType(itemType, itemId);
return convertMapListToVoListActual(mapList);
}
}