From 9b3bd81d2531a82e5729ee8d6252b40ac0add600 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 31 十月 2025 13:45:06 +0800
Subject: [PATCH] 生产发货进度报表优化
---
north-glass-erp/src/main/resources/mapper/pp/Report.xml | 4
north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java | 200 +++++++++++++++++++++++++++++++++++++-------------
north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java | 2
3 files changed, 151 insertions(+), 55 deletions(-)
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java b/north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java
index c78fc33..e75dfb3 100644
--- a/north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java
@@ -159,7 +159,7 @@
@ApiOperation("鐢熶骇鍙戣揣杩涘害")
@PostMapping("/productionSchedule/{orderId}")
- public Result productionSchedule(@PathVariable String orderId, @RequestBody List<Integer> columns) {
+ public Result productionSchedule(@PathVariable String orderId, @RequestBody List<String> columns) {
return Result.success(reportService.productionScheduleSv(orderId, columns));
}
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
index aa48c94..e006a77 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
@@ -666,70 +666,166 @@
return map;
}
- public Map<String, Object> productionScheduleSv(String orderId, List<Integer> columns) {
+ public Map<String, Object> productionScheduleSv(String orderId, List<String> columns) {
+
+
Map<String, Object> map = new HashMap<>();
//鑾峰彇琛ㄦ牸鍐呭鏁版嵁
- map.put("data", reportMapper.productionScheduleMp(orderId));
+ List<Map<String, String>> dataList = reportMapper.productionScheduleMp(orderId);
+
//鑾峰彇琛ㄥご宸ュ簭绛涢�夋暟鎹�
- List<Map<String, String>> processFilterList = orderProcessDetailMapper.filterOrderProcess(orderId);
- List<Map<String, String>> processList = processFilterList;
+ List<Map<String, String>> uniqueList = orderProcessDetailMapper.filterOrderProcess(orderId);
- List<String> filterList = new ArrayList<>();
- //寰幆閬嶅巻鏁扮粍锛屽垽鏂搴忓彿褰撳墠鐨勫伐搴�
- for (int i = 1; i < processFilterList.size(); i++) {
- filterList.add(processFilterList.get(i).get("process"));
- List<Map<String, String>> lastProcessList =
- orderProcessDetailMapper.filterLastProcess(
- orderId,
- String.valueOf(processFilterList.get(i).get("order_number")),
- String.valueOf(processFilterList.get(i).get("technology_number")),
- String.valueOf(processFilterList.get(i).get("id"))
- );
- if (!lastProcessList.isEmpty()) {
- int finalI = i;
- lastProcessList.forEach(lastProcess -> {
- if (filterList.contains(lastProcess.get("process"))) {
- processList.add(lastProcess);
- }
- });
- }
-
- }
- // 浣跨敤HashSet鏉ヨ褰曞凡缁忛亣鍒扮殑value鍊�
- Set<String> seenValues = new HashSet<>();
- // 鍒涘缓涓�涓柊鐨凩ist鏉ュ瓨鍌ㄧ粨鏋�
- List<Map<String, String>> uniqueList = new ArrayList<>();
-
- // 鍙嶅悜閬嶅巻鍘熷List
- for (int i = processList.size() - 1; i >= 0; i--) {
- Map<String, String> maps = processList.get(i);
- String value = maps.values().iterator().next(); // 鍋囪姣忎釜Map鍙湁涓�涓獀alue
-
- // 濡傛灉value杩樻病鏈夎鐪嬪埌杩囷紝灏辨坊鍔犲埌缁撴灉List鍜孒ashSet涓�
- if (!seenValues.contains(value)) {
- uniqueList.add(0, maps); // 娣诲姞鍒扮粨鏋淟ist鐨勫紑澶达紝浠ヤ繚鎸佸師椤哄簭
- seenValues.add(value);
- }
- }
map.put("title", uniqueList);
+ Map<String,Integer> clos = new HashMap<>();
+ HashMap<String,HashMap<String,Map<String, Integer>>> rowCount = new HashMap<String,HashMap<String,Map<String, Integer>>>();
+ for (int i=0;i<uniqueList.size();i++){
+ //鏍规嵁娴佺▼鏌ヨ鍩虹鏁版嵁
+ BasicData basicData = basicDataMapper.selectOne(
+ new QueryWrapper<BasicData>()
+ .eq("basic_category","process")
+ .eq("basic_name",uniqueList.get(i).get("process"))
+ .last("limit 1")
+ );
+
+ //鍒ゆ柇澶硅兌鍜屽す鑳跺悗宸ュ簭
+ //Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")
+ if(Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")){
+ clos.put(uniqueList.get(i).get("process"), 14+i);
+ }
+ //鍒ゆ柇涓┖鍜屼腑绌哄悗宸ュ簭
+ //Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD")
+ if(Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD")){
+ columns.add("reportWorkQuantity."+uniqueList.get(i).get("process"));
+ }
+ }
List<Map<String, Object>> getRowCount = orderProcessDetailMapper.getGlassLRow(orderId);
- List<Map<String, Integer>> rowCount = new ArrayList<>();
- columns.forEach(col -> {
- getRowCount.forEach(row -> {
- Map<String, Integer> getRow = new HashMap<>();
- // { row: 0, col: 1, rowspan: 3, colspan: 0},
- getRow.put("row", ((Number) row.get("RowNum")).intValue());
- getRow.put("col", col);
- getRow.put("rowspan", ((Number) row.get("rowCount")).intValue());
- getRow.put("colspan", 0);
- rowCount.add(getRow);
- });
+ HashMap<Integer,Map<String, Object>> getRowCountMap = new HashMap<>();
+ getRowCount.forEach(col -> {
+ Integer getRowCountOrderNumber = ((Number) col.get("order_number")).intValue();
+ getRowCountMap.put(getRowCountOrderNumber, col);
});
+ //寰幆缁撴灉
+ for (int i=0;i<dataList.size();i++ ) {
+ Integer orderNumber = Integer.parseInt(String.valueOf(dataList.get(i).get("order_number")));
+ Integer technologyNumber = Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number")));
+ int finalI1 = i;
+ columns.forEach(col -> {
+ if(rowCount.get(col) == null){
+ rowCount.put(col, new HashMap<String,Map<String,Integer>>());
+ }
+ if(getRowCountMap.get(orderNumber) != null){
+ Map<String,Object> row = getRowCountMap.get(orderNumber);
+ Map<String, Integer> getRow = new HashMap<>();
+ //鍒ゆ柇褰撳墠姝ゆ 鏄惁涓虹涓�琛� 骞朵笖鐩稿悓搴忓彿
+ if(technologyNumber==1){
+ getRow.put("rowspan", ((Number) row.get("rowCount")).intValue());
+ getRow.put("colspan", 1);
+ }else{
+ getRow.put("rowspan", 0);
+ getRow.put("colspan", 0);
+ }
+ rowCount.get(col).put(finalI1+"_"+col, getRow);
+ }
+
+
+ });
+
+
+ Map<String, String> data = JSON.parseObject(dataList.get(i).get("reportWorkQuantity"),
+ new TypeReference<Map<String, String>>() {
+ });
+ Map<String, String> dataShow = JSON.parseObject(dataList.get(i).get("reportWorkQuantityShow"),
+ new TypeReference<Map<String, String>>() {
+ });
+ //鍒ゆ柇鍚庡伐搴忔娴佺▼鍗″彿鏄惁鏈夋鐮�
+ List<DamageDetails> hasBreak = damageDetailsMapper
+ .getNotReview(dataList.get(i).get("processId"),
+ String.valueOf(dataList.get(i).get("order_number")),
+ String.valueOf(dataList.get(i).get("technology_number"))
+ );
+
+
+
+
+
+ if(!hasBreak.isEmpty()){
+ int finalI = i;
+ data.forEach((thisProcess, index)->{
+ String behindProcess = orderProcessDetailMapper.getBehindProcess(
+ dataList.get(finalI).get("processId"),
+ String.valueOf(dataList.get(finalI).get("order_number")),
+ String.valueOf(dataList.get(finalI).get("technology_number")),
+ thisProcess,
+ orderId
+ );
+
+ if(behindProcess!=null &&!behindProcess.isEmpty()){
+ Integer behindDamageSum = damageDetailsMapper.getBehindDamageSum(
+ dataList.get(finalI).get("processId"),
+ String.valueOf(dataList.get(finalI).get("order_number")),
+ String.valueOf(dataList.get(finalI).get("technology_number")),
+ behindProcess,1
+ );
+ if(behindDamageSum>0){
+ data.put(thisProcess, String.valueOf(Integer.parseInt(data.get(thisProcess) )- behindDamageSum));
+ dataShow.put(thisProcess, String.valueOf(Integer.parseInt(dataShow.get(thisProcess) )- behindDamageSum));
+ }
+
+ }
+ });
+
+ }
+ //澶硅兌宸ュ簭鍒ゆ柇鍚堝苟琛屾暟
+ if(!clos.isEmpty()){
+
+ Integer max = orderGlassDetailMapper
+ .getMaxTechnologyNumberByGroup(dataList.get(i).get("order_id"),
+ String.valueOf(dataList.get(i).get("order_number")),
+ String.valueOf(dataList.get(i).get("group"))
+ );
+ Integer min = orderGlassDetailMapper
+ .getMinTechnologyNumberByGroup(dataList.get(i).get("order_id"),
+ String.valueOf(dataList.get(i).get("order_number")),
+ String.valueOf(dataList.get(i).get("group"))
+ );
+
+ for (String key : clos.keySet()) {
+ if(data.get(key) != null){
+ if (rowCount.get("reportWorkQuantity."+key)==null){
+ rowCount.put("reportWorkQuantity."+key, new HashMap<String,Map<String,Integer>>());
+ }
+ Map<String, Integer> getRow = new HashMap<>();
+ if(min == Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number"))) ){
+
+ // { row: 0, col: 1, rowspan: 3, colspan: 0},
+ //getRow.put("row", i );
+ getRow.put("rowspan", max-min+1);
+ getRow.put("colspan", 1);
+
+ }else{
+ getRow.put("rowspan", 0);
+ getRow.put("colspan", 0);
+ data.put(key,"0");
+ }
+ rowCount.get("reportWorkQuantity."+key).put(i+"_reportWorkQuantity."+key, getRow);
+ }
+ }
+ }
+ dataList.get(i).put("reportWorkQuantity",JSON.toJSONString(data));
+ dataList.get(i).put("reportWorkQuantityShow",JSON.toJSONString(dataShow));
+
+ }
+
+
+
+
+ map.put("data",dataList );
map.put("mergeCells", rowCount);
return map;
diff --git a/north-glass-erp/src/main/resources/mapper/pp/Report.xml b/north-glass-erp/src/main/resources/mapper/pp/Report.xml
index fae6522..d1903e4 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/Report.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/Report.xml
@@ -1042,8 +1042,8 @@
b.glass_child,
ifnull(e.reportWorkQuantity, 0) as reportWorkQuantity,
ifnull(e.reportWorkQuantityCount, 0) as reportWorkQuantityCount,
- ifnull(f.inventory, 0) as inventoryNum,
- round(ifnull(f.inventory, 0) * a.area, 2) as inventoryArea,
+ ifnull(c.received_quantity, 0) as inventoryNum,
+ round(ifnull(c.received_quantity, 0) * a.area, 2) as inventoryArea,
ifnull(dd.quantity, 0) as shippedQuantity,
ifnull(dd.area, 0) as area,
ifnull(JSON_UNQUOTE(JSON_EXTRACT(a.other_columns, '$.S01')),'') AS glassNumber
--
Gitblit v1.8.0