|
|
|
@ -4177,4 +4177,83 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
return emailContent.toString(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 根据site、buNo、partNo获取物料包装属性(每卷数量、每箱卷数、箱重量) |
|
|
|
* @Author AI Assistant |
|
|
|
* @Date 2025-10-15 |
|
|
|
* @param site 站点 |
|
|
|
* @param buNo 业务单元 |
|
|
|
* @param partNo 物料编号 |
|
|
|
* @return 包装属性信息Map,包含rollQty(每卷数量)、boxRolls(每箱卷数)、boxWeight(箱重量) |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String, Object> getPartPackageProperties(String site, String buNo, String partNo) { |
|
|
|
log.info("开始获取物料包装属性 - site: {}, buNo: {}, partNo: {}", site, buNo, partNo); |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
try { |
|
|
|
// 获取物料属性列表 |
|
|
|
List<PartSubPropertiesValueData> propertiesValues = coDelMapper.getPropertiesListByTypeAndCodeNo( |
|
|
|
site, "ECSSPART", "BG001", buNo, partNo); |
|
|
|
|
|
|
|
if (propertiesValues == null || propertiesValues.isEmpty()) { |
|
|
|
log.warn("未找到物料 {} 的属性配置", partNo); |
|
|
|
result.put("success", false); |
|
|
|
result.put("message", "未找到物料的属性配置"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
// 按属性项编号分组 |
|
|
|
Map<String, List<PartSubPropertiesValueData>> partNoAndItemNoMap = propertiesValues.stream() |
|
|
|
.collect(Collectors.groupingBy(PartSubPropertiesValue::getPropertiesItemNo)); |
|
|
|
|
|
|
|
// 获取每卷数量 |
|
|
|
PartSubPropertiesValueData propertiesRollQty = null; |
|
|
|
if (partNoAndItemNoMap.containsKey("ROLLQTY") && !partNoAndItemNoMap.get("ROLLQTY").isEmpty()) { |
|
|
|
propertiesRollQty = partNoAndItemNoMap.get("ROLLQTY").get(0); |
|
|
|
result.put("rollQty", propertiesRollQty.getNumValue()); |
|
|
|
} else { |
|
|
|
log.warn("物料 {} 未配置ROLLQTY属性", partNo); |
|
|
|
result.put("rollQty", null); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取每箱卷数 |
|
|
|
PartSubPropertiesValueData propertiesBoxRolls = null; |
|
|
|
if (partNoAndItemNoMap.containsKey("BOXROLLS") && !partNoAndItemNoMap.get("BOXROLLS").isEmpty()) { |
|
|
|
propertiesBoxRolls = partNoAndItemNoMap.get("BOXROLLS").get(0); |
|
|
|
result.put("boxRolls", propertiesBoxRolls.getNumValue()); |
|
|
|
} else { |
|
|
|
log.warn("物料 {} 未配置BOXROLLS属性", partNo); |
|
|
|
result.put("boxRolls", null); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取箱重量 |
|
|
|
PartSubPropertiesValueData propertiesBoxWeight = null; |
|
|
|
if (partNoAndItemNoMap.containsKey("BOXWEIGHT") && !partNoAndItemNoMap.get("BOXWEIGHT").isEmpty()) { |
|
|
|
propertiesBoxWeight = partNoAndItemNoMap.get("BOXWEIGHT").get(0); |
|
|
|
result.put("boxWeight", propertiesBoxWeight.getNumValue()); |
|
|
|
} else { |
|
|
|
log.warn("物料 {} 未配置BOXWEIGHT属性", partNo); |
|
|
|
result.put("boxWeight", null); |
|
|
|
} |
|
|
|
|
|
|
|
result.put("success", true); |
|
|
|
result.put("site", site); |
|
|
|
result.put("buNo", buNo); |
|
|
|
result.put("partNo", partNo); |
|
|
|
|
|
|
|
log.info("物料包装属性获取成功 - partNo: {}, rollQty: {}, boxRolls: {}, boxWeight: {}", |
|
|
|
partNo, result.get("rollQty"), result.get("boxRolls"), result.get("boxWeight")); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
log.error("获取物料包装属性失败 - site: {}, buNo: {}, partNo: {}, error: {}", |
|
|
|
site, buNo, partNo, e.getMessage(), e); |
|
|
|
result.put("success", false); |
|
|
|
result.put("message", "获取物料包装属性失败: " + e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
} |