|
@@ -449,14 +449,39 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
|
|
|
|
|
|
// 热送统计
|
|
|
try {
|
|
|
- JsonNode rollDetails = objectMapper.readTree(record.getRollClubOneDetails());
|
|
|
- JsonNode lengthGroupCount = rollDetails.path("lengthGroupCount");
|
|
|
+ if (StringUtils.isNotBlank(record.getRollClubOneDetails())) {
|
|
|
+ JsonNode rollDetails = objectMapper.readTree(record.getRollClubOneDetails());
|
|
|
+ JsonNode lengthGroupCount = rollDetails.path("lengthGroupCount");
|
|
|
+
|
|
|
+ if (lengthGroupCount.isObject()) {
|
|
|
+ for (Iterator<Map.Entry<String, JsonNode>> it = lengthGroupCount.fields(); it.hasNext(); ) {
|
|
|
+ Map.Entry<String, JsonNode> entry = it.next();
|
|
|
+ String mm = entry.getKey();
|
|
|
+ int count = entry.getValue().asInt(0);
|
|
|
+
|
|
|
+ BigDecimal singleWeight = new BigDecimal(mm)
|
|
|
+ .divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP)
|
|
|
+ .multiply(meterWeightFactor)
|
|
|
+ .setScale(3, RoundingMode.HALF_UP);
|
|
|
+
|
|
|
+ BigDecimal weight = singleWeight.multiply(BigDecimal.valueOf(count));
|
|
|
+
|
|
|
+ mergedCountHotSend.merge(mm, count, Integer::sum);
|
|
|
+ mergedWeightHotSend.merge(mm, weight, BigDecimal::add);
|
|
|
+ mergedCount.merge(mm, count, Integer::sum);
|
|
|
+ mergedWeight.merge(mm, weight, BigDecimal::add);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
|
|
|
- if (lengthGroupCount.isObject()) {
|
|
|
- for (Iterator<Map.Entry<String, JsonNode>> it = lengthGroupCount.fields(); it.hasNext(); ) {
|
|
|
- Map.Entry<String, JsonNode> entry = it.next();
|
|
|
- String mm = entry.getKey();
|
|
|
- int count = entry.getValue().asInt(0);
|
|
|
+ // 热装统计
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(record.getHotChargeLength())) {
|
|
|
+ JsonNode hotArray = objectMapper.readTree(record.getHotChargeLength());
|
|
|
+ for (JsonNode node : hotArray) {
|
|
|
+ String mm = node.path("hotChargeLength").asText();
|
|
|
+ int count = node.path("totalCount").asInt(0);
|
|
|
|
|
|
BigDecimal singleWeight = new BigDecimal(mm)
|
|
|
.divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP)
|
|
@@ -465,134 +490,106 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
|
|
|
|
|
|
BigDecimal weight = singleWeight.multiply(BigDecimal.valueOf(count));
|
|
|
|
|
|
- mergedCountHotSend.merge(mm, count, Integer::sum);
|
|
|
- mergedWeightHotSend.merge(mm, weight, BigDecimal::add);
|
|
|
-
|
|
|
+ mergedCountHotFeign.merge(mm, count, Integer::sum);
|
|
|
+ mergedWeightHotFeign.merge(mm, weight, BigDecimal::add);
|
|
|
mergedCount.merge(mm, count, Integer::sum);
|
|
|
mergedWeight.merge(mm, weight, BigDecimal::add);
|
|
|
}
|
|
|
}
|
|
|
- } catch (Exception ignored) {
|
|
|
- }
|
|
|
-
|
|
|
- // 热装统计
|
|
|
- try {
|
|
|
- JsonNode hotArray = objectMapper.readTree(record.getHotChargeLength());
|
|
|
- for (JsonNode node : hotArray) {
|
|
|
- String mm = node.path("hotChargeLength").asText();
|
|
|
- int count = node.path("totalCount").asInt(0);
|
|
|
-
|
|
|
- BigDecimal singleWeight = new BigDecimal(mm)
|
|
|
- .divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP)
|
|
|
- .multiply(meterWeightFactor)
|
|
|
- .setScale(3, RoundingMode.HALF_UP);
|
|
|
-
|
|
|
- BigDecimal weight = singleWeight.multiply(BigDecimal.valueOf(count));
|
|
|
-
|
|
|
- mergedCountHotFeign.merge(mm, count, Integer::sum);
|
|
|
- mergedWeightHotFeign.merge(mm, weight, BigDecimal::add);
|
|
|
-
|
|
|
- mergedCount.merge(mm, count, Integer::sum);
|
|
|
- mergedWeight.merge(mm, weight, BigDecimal::add);
|
|
|
- }
|
|
|
- } catch (Exception ignored) {
|
|
|
- }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
|
|
|
// 堆垛统计
|
|
|
try {
|
|
|
- JsonNode stackArray = objectMapper.readTree(record.getStackLength());
|
|
|
- for (JsonNode node : stackArray) {
|
|
|
- String mm = node.path("stackingLength").asText();
|
|
|
- int count = node.path("stackingCount").asInt(0);
|
|
|
-
|
|
|
- BigDecimal singleWeight = new BigDecimal(mm)
|
|
|
- .divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP)
|
|
|
- .multiply(meterWeightFactor)
|
|
|
- .setScale(3, RoundingMode.HALF_UP);
|
|
|
+ if (StringUtils.isNotBlank(record.getStackLength())) {
|
|
|
+ JsonNode stackArray = objectMapper.readTree(record.getStackLength());
|
|
|
+ for (JsonNode node : stackArray) {
|
|
|
+ String mm = node.path("stackingLength").asText();
|
|
|
+ int count = node.path("stackingCount").asInt(0);
|
|
|
|
|
|
- BigDecimal weight = singleWeight.multiply(BigDecimal.valueOf(count));
|
|
|
-
|
|
|
- mergedCountStack.merge(mm, count, Integer::sum);
|
|
|
- mergedWeightStack.merge(mm, weight, BigDecimal::add);
|
|
|
+ BigDecimal singleWeight = new BigDecimal(mm)
|
|
|
+ .divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP)
|
|
|
+ .multiply(meterWeightFactor)
|
|
|
+ .setScale(3, RoundingMode.HALF_UP);
|
|
|
|
|
|
- mergedCount.merge(mm, count, Integer::sum);
|
|
|
- mergedWeight.merge(mm, weight, BigDecimal::add);
|
|
|
- }
|
|
|
- } catch (Exception ignored) {
|
|
|
- }
|
|
|
+ BigDecimal weight = singleWeight.multiply(BigDecimal.valueOf(count));
|
|
|
|
|
|
- try {
|
|
|
- JsonNode hotArray = objectMapper.readTree(record.getHotChargeLength());
|
|
|
- for (JsonNode node : hotArray) {
|
|
|
- String mm = node.path("hotChargeLength").asText(); // 定尺
|
|
|
- int count = node.path("totalCount").asInt(0);
|
|
|
- String destination = node.path("hotChargeDestination").asText(); // 目的地
|
|
|
-
|
|
|
- if (!destinationCountMap.containsKey(destination)) {
|
|
|
- continue; // 不属于目标五类,跳过
|
|
|
+ mergedCountStack.merge(mm, count, Integer::sum);
|
|
|
+ mergedWeightStack.merge(mm, weight, BigDecimal::add);
|
|
|
+ mergedCount.merge(mm, count, Integer::sum);
|
|
|
+ mergedWeight.merge(mm, weight, BigDecimal::add);
|
|
|
}
|
|
|
-
|
|
|
- // 单重
|
|
|
- BigDecimal singleWeight = new BigDecimal(mm)
|
|
|
- .divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP)
|
|
|
- .multiply(meterWeightFactor)
|
|
|
- .setScale(3, RoundingMode.HALF_UP);
|
|
|
-
|
|
|
- // 总重
|
|
|
- BigDecimal totalWeightForThis = singleWeight.multiply(BigDecimal.valueOf(count));
|
|
|
-
|
|
|
- // 累加支数
|
|
|
- Map<String, Integer> countMap = destinationCountMap.get(destination);
|
|
|
- countMap.merge(mm, count, Integer::sum);
|
|
|
-
|
|
|
- // 累加重量
|
|
|
- Map<String, BigDecimal> weightMap = destinationWeightMap.get(destination);
|
|
|
- weightMap.merge(mm, totalWeightForThis, BigDecimal::add);
|
|
|
}
|
|
|
- } catch (Exception ignored) {
|
|
|
- }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
|
|
|
+ // 热装目的地分类统计
|
|
|
try {
|
|
|
- JsonNode rollClubOneNode = objectMapper.readTree(record.getRollClubOneDetails());
|
|
|
- JsonNode lengthGroupNode = rollClubOneNode.path("lengthGroupCount");
|
|
|
-
|
|
|
- if (lengthGroupNode.isObject()) {
|
|
|
- for (Iterator<Map.Entry<String, JsonNode>> it = lengthGroupNode.fields(); it.hasNext(); ) {
|
|
|
- Map.Entry<String, JsonNode> entry = it.next();
|
|
|
- String length = entry.getKey();
|
|
|
- int count = entry.getValue().asInt(0);
|
|
|
+ if (StringUtils.isNotBlank(record.getHotChargeLength())) {
|
|
|
+ JsonNode hotArray = objectMapper.readTree(record.getHotChargeLength());
|
|
|
+ for (JsonNode node : hotArray) {
|
|
|
+ String mm = node.path("hotChargeLength").asText();
|
|
|
+ int count = node.path("totalCount").asInt(0);
|
|
|
+ String destination = node.path("hotChargeDestination").asText();
|
|
|
+
|
|
|
+ if (!destinationCountMap.containsKey(destination)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- BigDecimal singleWeight = new BigDecimal(length)
|
|
|
+ BigDecimal singleWeight = new BigDecimal(mm)
|
|
|
.divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP)
|
|
|
.multiply(meterWeightFactor)
|
|
|
.setScale(3, RoundingMode.HALF_UP);
|
|
|
|
|
|
- BigDecimal totalWeight = singleWeight.multiply(BigDecimal.valueOf(count)).setScale(4, RoundingMode.HALF_UP);
|
|
|
-
|
|
|
- DestinationStatisticsDetails stat = rollClubOneMap.get(length);
|
|
|
- if (stat == null) {
|
|
|
- stat = new DestinationStatisticsDetails();
|
|
|
- stat.setSize(length);
|
|
|
- stat.setNums(count);
|
|
|
- stat.setBlankOutput(totalWeight.doubleValue());
|
|
|
- stat.setCcmNo(billetHotsendChangeShift.getCcmNo());
|
|
|
- rollClubOneMap.put(length, stat);
|
|
|
- } else {
|
|
|
- stat.setNums(stat.getNums() + count);
|
|
|
- double updatedWeight = BigDecimal.valueOf(stat.getBlankOutput())
|
|
|
- .add(totalWeight)
|
|
|
- .setScale(3, RoundingMode.HALF_UP)
|
|
|
- .doubleValue();
|
|
|
-
|
|
|
- stat.setBlankOutput(updatedWeight);
|
|
|
+ BigDecimal totalWeightForThis = singleWeight.multiply(BigDecimal.valueOf(count));
|
|
|
+
|
|
|
+ destinationCountMap.get(destination).merge(mm, count, Integer::sum);
|
|
|
+ destinationWeightMap.get(destination).merge(mm, totalWeightForThis, BigDecimal::add);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
+
|
|
|
+ // 单条 RollClubOneDetails 统计封装到 DestinationStatisticsDetails
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(record.getRollClubOneDetails())) {
|
|
|
+ JsonNode rollClubOneNode = objectMapper.readTree(record.getRollClubOneDetails());
|
|
|
+ JsonNode lengthGroupNode = rollClubOneNode.path("lengthGroupCount");
|
|
|
+
|
|
|
+ if (lengthGroupNode.isObject()) {
|
|
|
+ for (Iterator<Map.Entry<String, JsonNode>> it = lengthGroupNode.fields(); it.hasNext(); ) {
|
|
|
+ Map.Entry<String, JsonNode> entry = it.next();
|
|
|
+ String length = entry.getKey();
|
|
|
+ int count = entry.getValue().asInt(0);
|
|
|
+
|
|
|
+ BigDecimal singleWeight = new BigDecimal(length)
|
|
|
+ .divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP)
|
|
|
+ .multiply(meterWeightFactor)
|
|
|
+ .setScale(3, RoundingMode.HALF_UP);
|
|
|
+
|
|
|
+ BigDecimal totalWeight = singleWeight.multiply(BigDecimal.valueOf(count)).setScale(4, RoundingMode.HALF_UP);
|
|
|
+
|
|
|
+ DestinationStatisticsDetails stat = rollClubOneMap.get(length);
|
|
|
+ if (stat == null) {
|
|
|
+ stat = new DestinationStatisticsDetails();
|
|
|
+ stat.setSize(length);
|
|
|
+ stat.setNums(count);
|
|
|
+ stat.setBlankOutput(totalWeight.doubleValue());
|
|
|
+ stat.setCcmNo(billetHotsendChangeShift.getCcmNo());
|
|
|
+ rollClubOneMap.put(length, stat);
|
|
|
+ } else {
|
|
|
+ stat.setNums(stat.getNums() + count);
|
|
|
+ double updatedWeight = BigDecimal.valueOf(stat.getBlankOutput())
|
|
|
+ .add(totalWeight)
|
|
|
+ .setScale(3, RoundingMode.HALF_UP)
|
|
|
+ .doubleValue();
|
|
|
+ stat.setBlankOutput(updatedWeight);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- } catch (Exception ignored) {
|
|
|
- }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// 汇总热送
|
|
|
int totalHotSendCount = mergedCountHotSend.values().stream().mapToInt(Integer::intValue).sum();
|
|
|
BigDecimal totalHotSendWeight = mergedWeightHotSend.values().stream().reduce(BigDecimal.ZERO, BigDecimal::add);
|