|
@@ -972,6 +972,22 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
|
|
|
billetOriginalInfo.setShift(shift);
|
|
|
billetOriginalInfo.setShiftGroup(shiftGroup);
|
|
|
+
|
|
|
+ // 遍历billetOriginalProductRecordList,获取BilletOriginalProductRecord中的三个json字段, hotChargeLength、stackLength、rollClubOneDetails,对所有定尺进行统计,统计出定尺、和对应的数量
|
|
|
+ billetOriginalProductRecordList.forEach(y ->{
|
|
|
+ Map<String, Integer> lengthCountMap = new HashMap<>();
|
|
|
+ // 处理热装所有定尺字段
|
|
|
+ processHotChargeLength(y.getHotChargeLength(), lengthCountMap);
|
|
|
+
|
|
|
+ // 处理堆垛所有定尺字段
|
|
|
+ processStackLength(y.getStackLength(), lengthCountMap);
|
|
|
+
|
|
|
+ // 处理棒一所有定尺字段
|
|
|
+ processRollClubOneDetails(y.getRollClubOneDetails(), lengthCountMap);
|
|
|
+
|
|
|
+ y.setLengthDetails(JSON.toJSONString(lengthCountMap));
|
|
|
+ });
|
|
|
+
|
|
|
billetOriginalInfo.setBilletOriginalProductRecordList(billetOriginalProductRecordList);
|
|
|
billetOriginalInfo.setTotalInfo(billetOriginalProductRecordList.stream().filter(x -> x.getAmount() != null)
|
|
|
.mapToInt(BilletOriginalProductRecord::getAmount)
|
|
@@ -1220,6 +1236,76 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
.setScale(4, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 处理hotChargeLength字段,合并相同定尺
|
|
|
+ */
|
|
|
+ private void processHotChargeLength(String jsonStr, Map<String, Integer> lengthCountMap) {
|
|
|
+ if (oConvertUtils.isNotEmpty(jsonStr)) {
|
|
|
+ try {
|
|
|
+ JSONArray jsonArray = JSON.parseArray(jsonStr);
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject item = jsonArray.getJSONObject(i);
|
|
|
+ String length = item.getString("hotChargeLength");
|
|
|
+ Integer count = item.getInteger("totalCount");
|
|
|
+
|
|
|
+ if (length != null && count != null) {
|
|
|
+ // 使用merge方法自动合并相同定尺
|
|
|
+ lengthCountMap.merge(length, count, Integer::sum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("解析hotChargeLength失败: {}", jsonStr, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理stackLength字段,合并相同定尺
|
|
|
+ */
|
|
|
+ private void processStackLength(String jsonStr, Map<String, Integer> lengthCountMap) {
|
|
|
+ if (oConvertUtils.isNotEmpty(jsonStr)) {
|
|
|
+ try {
|
|
|
+ JSONArray jsonArray = JSON.parseArray(jsonStr);
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject item = jsonArray.getJSONObject(i);
|
|
|
+ String length = item.getString("stackingLength");
|
|
|
+ Integer count = item.getInteger("stackingCount");
|
|
|
+
|
|
|
+ if (length != null && count != null) {
|
|
|
+ // 使用merge方法自动合并相同定尺
|
|
|
+ lengthCountMap.merge(length, count, Integer::sum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("解析stackLength失败: {}", jsonStr, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理rollClubOneDetails字段,合并相同定尺
|
|
|
+ */
|
|
|
+ private void processRollClubOneDetails(String jsonStr, Map<String, Integer> lengthCountMap) {
|
|
|
+ if (oConvertUtils.isNotEmpty(jsonStr)) {
|
|
|
+ try {
|
|
|
+ JSONObject jsonObj = JSON.parseObject(jsonStr);
|
|
|
+ JSONObject lengthGroupCount = jsonObj.getJSONObject("lengthGroupCount");
|
|
|
+
|
|
|
+ if (lengthGroupCount != null) {
|
|
|
+ for (Map.Entry<String, Object> entry : lengthGroupCount.entrySet()) {
|
|
|
+ String length = entry.getKey();
|
|
|
+ Integer count = Integer.valueOf(entry.getValue().toString());
|
|
|
+
|
|
|
+ // 使用merge方法自动合并相同定尺
|
|
|
+ lengthCountMap.merge(length, count, Integer::sum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("解析rollClubOneDetails失败: {}", jsonStr, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 棒一统计明细查询
|
|
|
* @param ccmNo
|