From 2786ed1fe266240fa6216c5dd6a9014481963d24 Mon Sep 17 00:00:00 2001
From: sfd <sun.sunshine@163.com>
Date: 星期二, 20 五月 2025 12:38:25 +0800
Subject: [PATCH] Merge branch 'dev' of http://192.168.50.149:8085/r/aps-backend into dev
---
aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlatePlanMapper.xml | 22 +
aps-modules/aps-core/src/main/resources/mapper/core/ApsWeldSeamStatisticsV2Mapper.xml | 247 +++++++++++++++++++
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateStandardRequireServiceImpl.java | 8
aps-modules/aps-core/src/main/java/com/aps/core/service/mainPlan/IApsWeldSeamStatisticsV2Service.java | 35 ++
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlatePlanMapper.java | 2
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessStatMapper.java | 4
aps-modules/aps-core/src/main/java/com/aps/core/mapper/mainPlan/ApsWeldSeamStatisticsV2Mapper.java | 84 ++++++
aps-modules/aps-core/src/main/java/com/aps/core/domain/mainPlan/ApsWeldSeamStatisticsV2.java | 74 +++++
aps-modules/aps-core/src/main/java/com/aps/core/service/mainPlan/impl/ApsWeldSeamStatisticsV2ServiceImpl.java | 206 +++++++++++++++
aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateProcessStatMapper.xml | 17
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamStatisticsV2Controller.java | 81 ++++++
11 files changed, 756 insertions(+), 24 deletions(-)
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamStatisticsV2Controller.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamStatisticsV2Controller.java
new file mode 100644
index 0000000..597c4d9
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamStatisticsV2Controller.java
@@ -0,0 +1,81 @@
+package com.aps.core.controller.mainPlan;
+
+import com.aps.common.core.utils.poi.ExcelUtil;
+import com.aps.common.core.web.controller.BaseController;
+import com.aps.common.core.web.domain.AjaxResult;
+import com.aps.common.core.web.page.TableDataInfo;
+import com.aps.common.log.annotation.Log;
+import com.aps.common.log.enums.BusinessType;
+import com.aps.common.security.annotation.RequiresPermissions;
+import com.aps.common.security.utils.SecurityUtils;
+import com.aps.core.domain.mainPlan.ApsWeldSeamStatisticsV2;
+import com.aps.core.service.mainPlan.IApsWeldSeamStatisticsV2Service;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 鐒婄紳缁熻v2Controller
+ *
+ * @author wwj
+ * @date 2025-04-09
+ */
+@RestController
+@RequestMapping("/weldSeamStatisticsV2")
+public class ApsWeldSeamStatisticsV2Controller extends BaseController {
+
+ @Autowired
+ private IApsWeldSeamStatisticsV2Service apsWeldSeamStatisticsV2Service;
+
+ /**
+ * 鏌ヨ鐒婄紳缁熻琛╒2鍒楄〃
+ */
+ @RequiresPermissions("weldSeamStatistics:weldSeamStatisticsV2:list")
+ @GetMapping("/list")
+ public TableDataInfo list(ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2)
+ {
+ // 涓嶉渶瑕佸垎椤�
+ // startPage();
+ List<ApsWeldSeamStatisticsV2> list = apsWeldSeamStatisticsV2Service.selectApsWeldSeamStatisticsV2List(apsWeldSeamStatisticsV2);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭鐒婄紳缁熻琛╒2鍒楄〃
+ */
+ @RequiresPermissions("weldSeamStatistics:weldSeamStatisticsV2:export")
+ @Log(title = "鐒婄紳缁熻琛╒2", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2)
+ {
+ List<ApsWeldSeamStatisticsV2> list = apsWeldSeamStatisticsV2Service.selectApsWeldSeamStatisticsV2List(apsWeldSeamStatisticsV2);
+ ExcelUtil<ApsWeldSeamStatisticsV2> util = new ExcelUtil<ApsWeldSeamStatisticsV2>(ApsWeldSeamStatisticsV2.class);
+ util.exportExcel(response, list, "鐒婄紳缁熻琛╒2鏁版嵁");
+ }
+
+ /**
+ * 淇敼鐒婄紳缁熻琛╒2
+ */
+ @RequiresPermissions("weldSeamStatistics:weldSeamStatisticsV2:edit")
+ @Log(title = "鐒婄紳缁熻琛╒2", businessType = BusinessType.UPDATE)
+ @PostMapping("/update")
+ public AjaxResult edit(@RequestBody ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2)
+ {
+ ApsWeldSeamStatisticsV2 updatedRecord = apsWeldSeamStatisticsV2Service.updateApsWeldSeamStatisticsV2(apsWeldSeamStatisticsV2);
+ return AjaxResult.success("淇敼鎴愬姛", updatedRecord);
+ }
+
+ /**
+ * 鍒锋柊鐒婄紳缁熻琛╒2鏁版嵁
+ */
+ @RequiresPermissions("weldSeamStatistics:weldSeamStatisticsV2:refresh")
+ @Log(title = "鐒婄紳缁熻琛╒2", businessType = BusinessType.OTHER)
+ @PostMapping("/refresh")
+ public AjaxResult refreshStatistics() {
+ String username = SecurityUtils.getUsername();
+ int count = apsWeldSeamStatisticsV2Service.refreshWeldSeamStatistics(username);
+ return success("鍒锋柊鐒婄紳缁熻琛ㄦ垚鍔燂紝鍏辨洿鏂� " + count + " 鏉¤褰�");
+ }
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/mainPlan/ApsWeldSeamStatisticsV2.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/mainPlan/ApsWeldSeamStatisticsV2.java
new file mode 100644
index 0000000..37dc742
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/mainPlan/ApsWeldSeamStatisticsV2.java
@@ -0,0 +1,74 @@
+package com.aps.core.domain.mainPlan;
+
+import com.aps.common.core.annotation.Excel;
+import com.aps.common.core.web.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+
+/**
+ * 鐒婄紳缁熻琛╒2瀵硅薄 aps_weld_seam_statistics_v2
+ *
+ * @date 2023-08-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ApsWeldSeamStatisticsV2 extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /** ID */
+ private String id;
+
+ /** 骞翠唤 */
+ @Excel(name = "骞翠唤")
+ private Integer year;
+
+ /** 鏈堜唤 */
+ @Excel(name = "鏈堜唤")
+ private Integer month;
+
+ /** 鐢熶骇鍩哄湴 */
+ @Excel(name = "鐢熶骇鍩哄湴")
+ private String productionBase;
+
+ /** 绠¤矾璁㈠崟闇�姹� */
+ @Excel(name = "绠¤矾璁㈠崟闇�姹�")
+ private BigDecimal pipingOrderRequirement;
+
+ /** 姘旀煖璁㈠崟闇�姹� */
+ @Excel(name = "姘旀煖璁㈠崟闇�姹�")
+ private BigDecimal gasOrderRequirement;
+
+ /** 绠¤矾棰勬祴闇�姹� */
+ @Excel(name = "绠¤矾棰勬祴闇�姹�")
+ private BigDecimal pipingPredictionRequirement;
+
+ /** 姘旀煖棰勬祴闇�姹� */
+ @Excel(name = "姘旀煖棰勬祴闇�姹�")
+ private BigDecimal gasPredictionRequirement;
+
+ /** 棰勭暀绱ф�ヨ鍗曚骇鍑� */
+ @Excel(name = "棰勭暀绱ф�ヨ鍗曚骇鍑�")
+ private BigDecimal reserveEmergencyOrderOutput;
+
+ /** 鍚堣 */
+ @Excel(name = "鍚堣")
+ private BigDecimal total;
+
+ /** 澶╂暟 */
+ @Excel(name = "澶╂暟")
+ private BigDecimal days;
+
+ /** 闇�姹傛棩鐒婄紳 */
+ @Excel(name = "闇�姹傛棩鐒婄紳")
+ private BigDecimal requirementDayWeldSeam;
+
+ /** 鐢熶骇鏃ョ剨缂� */
+ @Excel(name = "鐢熶骇鏃ョ剨缂�")
+ private BigDecimal productionDayWeldSeam;
+
+ /** 鏄惁婊¤冻 */
+ @Excel(name = "鏄惁婊¤冻")
+ private String isSatisfy;
+}
\ No newline at end of file
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlatePlanMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlatePlanMapper.java
index ad9cd0a..731c0e3 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlatePlanMapper.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlatePlanMapper.java
@@ -74,7 +74,7 @@
*/
public List<ApsPlatePlan> selectPlateRedundantOrderList(ApsPlatePlan apsPlatePlan);
- List<ApsPlatePlan> selectPlatePlanByPlantMajor(String plant,String professionalAffiliation);
+ List<ApsPlatePlan> selectPlatePlanByPlantMajor(String plant);
/**
* 鑾峰彇涓�鏉℃湭鍖归厤鐨勫瓙璁″垝
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessStatMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessStatMapper.java
index 9e5ab42..5f3df07 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessStatMapper.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessStatMapper.java
@@ -60,7 +60,9 @@
* @return 缁撴灉
*/
public int deleteApsPlateProcessStatByIds(String[] ids);
- /**缁熻涓存椂鏁版嵁*/
+ /**缁熻涓存椂鏁版嵁
+ * 鎵归噺璁剧疆鐨勮鍒掑畬宸ユ棩鏈�> 瀵煎叆鐨勯渶姹傛棩鏈�> 宸ュ崟鑷韩鐨勮鍒掑畬宸ユ棩鏈�
+ * */
List<ApsPlateProcessStat> queryTempStat();
/**
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/mainPlan/ApsWeldSeamStatisticsV2Mapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/mainPlan/ApsWeldSeamStatisticsV2Mapper.java
new file mode 100644
index 0000000..5f3f920
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/mainPlan/ApsWeldSeamStatisticsV2Mapper.java
@@ -0,0 +1,84 @@
+package com.aps.core.mapper.mainPlan;
+
+import com.aps.core.domain.mainPlan.ApsWeldSeamStatisticsV2;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 鐒婄紳缁熻琛╒2Mapper鎺ュ彛
+ *
+ * @date 2023-08-01
+ */
+@Mapper
+public interface ApsWeldSeamStatisticsV2Mapper {
+
+ /**
+ * 鏌ヨ鐒婄紳缁熻琛╒2
+ *
+ * @param id 鐒婄紳缁熻琛╒2涓婚敭
+ * @return 鐒婄紳缁熻琛╒2
+ */
+ public ApsWeldSeamStatisticsV2 selectApsWeldSeamStatisticsV2ById(String id);
+
+ /**
+ * 鏌ヨ鐒婄紳缁熻琛╒2鍒楄〃
+ *
+ * @param apsWeldSeamStatisticsV2 鐒婄紳缁熻琛╒2
+ * @return 鐒婄紳缁熻琛╒2闆嗗悎
+ */
+ public List<ApsWeldSeamStatisticsV2> selectApsWeldSeamStatisticsV2List(ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2);
+
+ /**
+ * 鏂板鐒婄紳缁熻琛╒2
+ *
+ * @param apsWeldSeamStatisticsV2 鐒婄紳缁熻琛╒2
+ * @return 缁撴灉
+ */
+ public int insertApsWeldSeamStatisticsV2(ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2);
+
+ /**
+ * 淇敼鐒婄紳缁熻琛╒2
+ *
+ * @param apsWeldSeamStatisticsV2 鐒婄紳缁熻琛╒2
+ * @return 缁撴灉
+ */
+ public int updateApsWeldSeamStatisticsV2(ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2);
+
+ /**
+ * 鍒犻櫎鐒婄紳缁熻琛╒2
+ *
+ * @param id 鐒婄紳缁熻琛╒2涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteApsWeldSeamStatisticsV2ById(String id);
+
+ /**
+ * 鎵归噺鍒犻櫎鐒婄紳缁熻琛╒2
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteApsWeldSeamStatisticsV2ByIds(String[] ids);
+
+ /**
+ * 娓呯┖缁熻琛�
+ */
+ public void truncateTable();
+
+ /**
+ * 鎵归噺鎻掑叆鏁版嵁
+ *
+ * @param list 鏁版嵁鍒楄〃
+ * @return 缁撴灉
+ */
+ public int batchInsert(@Param("list") List<ApsWeldSeamStatisticsV2> list);
+
+ /**
+ * 鏌ヨ缁熻鏁版嵁
+ *
+ * @return 缁熻鏁版嵁鍒楄〃
+ */
+ public List<ApsWeldSeamStatisticsV2> queryWeldSeamStatistics();
+}
\ No newline at end of file
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateStandardRequireServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateStandardRequireServiceImpl.java
index 07c1f47..e6b8cd9 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateStandardRequireServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateStandardRequireServiceImpl.java
@@ -172,10 +172,8 @@
requireBatchService.initRequireBatch();
/*瀹氫箟宸ュ巶涓哄崡閫� */
String plantCode="FORTUNA";
- /*瀹氫箟涓诲崟绫诲瀷涓洪挘閲戜富鍗�*/
- String mainOrderType = "main";
/*鑾峰彇閽i噾涓诲崟淇℃伅*/
- List<ApsPlatePlan> mainPlans = platePlanMapper.selectPlatePlanByPlantMajor(plantCode,mainOrderType);
+ List<ApsPlatePlan> mainPlans = platePlanMapper.selectPlatePlanByPlantMajor(plantCode);
Hashtable<String, ApsMaterialStorageManagement> usedStorage = new Hashtable<>();
/*鍐呭瓨涓瓨鍌ㄥ瓙浠跺伐鍗�*/
Hashtable<String, List<ApsPlatePlan>> subPlans = new Hashtable<>();
@@ -183,13 +181,9 @@
for (ApsPlatePlan mainPlan : mainPlans) {
String itemNumber = mainPlan.getItemNumber();
/*鏍规嵁鏂欏彿 鑾峰彇BOM Header */
-
-
List<ApsPlateStandardRequire> requiresList=new ArrayList<>();
List<ApsPlateStandardRequireBomStockDetail> stockDetailsList=new ArrayList<>();
List<ApsPlateStandardRequireBomOrderDetail> orderDetailsList=new ArrayList<>();
-
-
log.info("寮�濮嬬敓鎴愰渶姹傦細宸ュ崟鍙凤細"+mainPlan.getDocumentNumber());
/*褰撳墠Bom鑺傜偣澶勭悊瀹屾垚鍚庯紝澶勭悊涓嬬骇BOM*/
getBomRequires(plantCode, "0","0",itemNumber,BigDecimal.ONE, batchNum, null
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/mainPlan/IApsWeldSeamStatisticsV2Service.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/mainPlan/IApsWeldSeamStatisticsV2Service.java
new file mode 100644
index 0000000..e34d5bf
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/mainPlan/IApsWeldSeamStatisticsV2Service.java
@@ -0,0 +1,35 @@
+package com.aps.core.service.mainPlan;
+
+import com.aps.core.domain.mainPlan.ApsWeldSeamStatisticsV2;
+import java.util.List;
+
+/**
+ * 鐒婄紳缁熻琛╒2鏈嶅姟鎺ュ彛
+ *
+ * @date 2023-08-01
+ */
+public interface IApsWeldSeamStatisticsV2Service {
+ /**
+ * 鏌ヨ鐒婄紳缁熻琛╒2鍒楄〃
+ *
+ * @param apsWeldSeamStatisticsV2 鐒婄紳缁熻琛╒2
+ * @return 鐒婄紳缁熻琛╒2闆嗗悎
+ */
+ public List<ApsWeldSeamStatisticsV2> selectApsWeldSeamStatisticsV2List(ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2);
+
+ /**
+ * 淇敼鐒婄紳缁熻琛╒2
+ *
+ * @param apsWeldSeamStatisticsV2 鐒婄紳缁熻琛╒2
+ * @return 鏇存柊鍚庣殑璁板綍
+ */
+ public ApsWeldSeamStatisticsV2 updateApsWeldSeamStatisticsV2(ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2);
+
+ /**
+ * 鍒锋柊鐒婄紳缁熻琛ㄦ暟鎹�
+ *
+ * @param username 鎿嶄綔鐢ㄦ埛
+ * @return 鍙楀奖鍝嶇殑璁板綍鏁�
+ */
+ public int refreshWeldSeamStatistics(String username);
+}
\ No newline at end of file
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/mainPlan/impl/ApsWeldSeamStatisticsV2ServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/mainPlan/impl/ApsWeldSeamStatisticsV2ServiceImpl.java
new file mode 100644
index 0000000..77fd6f8
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/mainPlan/impl/ApsWeldSeamStatisticsV2ServiceImpl.java
@@ -0,0 +1,206 @@
+package com.aps.core.service.mainPlan.impl;
+
+import com.aps.common.core.utils.DateUtils;
+import com.aps.common.core.utils.uuid.IdUtils;
+import com.aps.common.core.web.page.TableDataInfo;
+import com.aps.common.security.utils.SecurityUtils;
+import com.aps.core.controller.basicData.ApsGasPipelineCapacityPlanController;
+import com.aps.core.domain.ApsGasPipelineCapacityPlan;
+import com.aps.core.domain.mainPlan.ApsWeldSeamStatisticsV2;
+import com.aps.core.mapper.mainPlan.ApsWeldSeamStatisticsV2Mapper;
+import com.aps.core.service.IApsGasPipelineCapacityPlanService;
+import com.aps.core.service.mainPlan.IApsWeldSeamStatisticsV2Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 鐒婄紳缁熻琛╒2Service涓氬姟灞傚鐞�
+ *
+ * @date 2023-08-01
+ */
+@Service
+public class ApsWeldSeamStatisticsV2ServiceImpl implements IApsWeldSeamStatisticsV2Service {
+ @Autowired
+ private ApsWeldSeamStatisticsV2Mapper apsWeldSeamStatisticsV2Mapper;
+
+ @Autowired
+ private ApsGasPipelineCapacityPlanController apsGasPipelineCapacityPlanController;
+
+ /**
+ * 鏌ヨ鐒婄紳缁熻琛╒2鍒楄〃
+ *
+ * @param apsWeldSeamStatisticsV2 鐒婄紳缁熻琛╒2
+ * @return 鐒婄紳缁熻琛╒2
+ */
+ @Override
+ public List<ApsWeldSeamStatisticsV2> selectApsWeldSeamStatisticsV2List(ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2) {
+ return apsWeldSeamStatisticsV2Mapper.selectApsWeldSeamStatisticsV2List(apsWeldSeamStatisticsV2);
+ }
+
+ /**
+ * 淇敼鐒婄紳缁熻琛╒2
+ *
+ * @param apsWeldSeamStatisticsV2 鐒婄紳缁熻琛╒2
+ * @return 鏇存柊鍚庣殑璁板綍
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public ApsWeldSeamStatisticsV2 updateApsWeldSeamStatisticsV2(ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2)
+ {
+ // 璁剧疆鏇存柊鏃堕棿
+ apsWeldSeamStatisticsV2.setUpdateTime(DateUtils.getNowDate());
+ apsWeldSeamStatisticsV2.setUpdateBy(SecurityUtils.getUsername());
+
+ // 1. 浠庢暟鎹簱鑾峰彇鍘熷璁板綍锛屼互淇濈暀鍏朵粬瀛楁涓嶅彉
+ ApsWeldSeamStatisticsV2 originalData = apsWeldSeamStatisticsV2Mapper.selectApsWeldSeamStatisticsV2ById(apsWeldSeamStatisticsV2.getId());
+ if (originalData == null) {
+ throw new RuntimeException("璁板綍涓嶅瓨鍦紝ID: " + apsWeldSeamStatisticsV2.getId());
+ }
+
+ // 2. 鍙洿鏂皉eserveEmergencyOrderOutput鍜宒ays涓や釜瀛楁
+ originalData.setReserveEmergencyOrderOutput(apsWeldSeamStatisticsV2.getReserveEmergencyOrderOutput());
+ originalData.setDays(apsWeldSeamStatisticsV2.getDays());
+ originalData.setUpdateTime(apsWeldSeamStatisticsV2.getUpdateTime());
+ originalData.setUpdateBy(apsWeldSeamStatisticsV2.getUpdateBy());
+
+ // 3. 纭繚鎵�鏈夌敤浜庤绠楃殑BigDecimal瀛楁涓嶄负null
+ java.math.BigDecimal pipingOrderReq = (originalData.getPipingOrderRequirement() != null)
+ ? originalData.getPipingOrderRequirement() : java.math.BigDecimal.ZERO;
+
+ java.math.BigDecimal pipingPredictionReq = (originalData.getPipingPredictionRequirement() != null)
+ ? originalData.getPipingPredictionRequirement() : java.math.BigDecimal.ZERO;
+
+ java.math.BigDecimal gasOrderReq = (originalData.getGasOrderRequirement() != null)
+ ? originalData.getGasOrderRequirement() : java.math.BigDecimal.ZERO;
+
+ java.math.BigDecimal gasPredictionReq = (originalData.getGasPredictionRequirement() != null)
+ ? originalData.getGasPredictionRequirement() : java.math.BigDecimal.ZERO;
+
+ java.math.BigDecimal reserveEmergencyOutput = (originalData.getReserveEmergencyOrderOutput() != null)
+ ? originalData.getReserveEmergencyOrderOutput() : java.math.BigDecimal.ZERO;
+
+ // 4. 灞炴��1锛氶噸鏂拌绠梩otal锛堝悎璁★級
+ java.math.BigDecimal total = pipingOrderReq
+ .add(pipingPredictionReq)
+ .add(gasOrderReq)
+ .add(gasPredictionReq)
+ .add(reserveEmergencyOutput);
+
+ originalData.setTotal(total);
+
+ // 5. 濡傛灉days涓嶄负绌轰笖澶т簬0锛岄噸鏂拌绠梤equirementDayWeldSeam鍜宨sSatisfy
+ if(originalData.getDays() != null && originalData.getDays().doubleValue() > 0) {
+ // 灞炴��2锛氳绠楅渶姹傛棩鐒婄紳 = 鍚堣/澶╂暟锛屽洓鑸嶄簲鍏�
+ double result = total.doubleValue() / originalData.getDays().doubleValue();
+ java.math.BigDecimal requirementDayWeldSeam = new java.math.BigDecimal(result).setScale(0, java.math.RoundingMode.HALF_UP);
+ originalData.setRequirementDayWeldSeam(requirementDayWeldSeam);
+
+ // 灞炴��3锛氬垽鏂槸鍚︽弧瓒�
+ if(originalData.getProductionDayWeldSeam() != null) {
+ if(originalData.getProductionDayWeldSeam().compareTo(requirementDayWeldSeam) >= 0) {
+ originalData.setIsSatisfy("1"); // 婊¤冻
+ } else {
+ originalData.setIsSatisfy("0"); // 涓嶆弧瓒�
+ }
+ } else {
+ originalData.setIsSatisfy("0"); // 榛樿涓嶆弧瓒�
+ }
+ } else {
+ // 濡傛灉澶╂暟涓虹┖鎴栦负0锛岃缃负涓嶆弧瓒�
+ originalData.setIsSatisfy("0");
+ }
+
+ // 6. 鏇存柊鏁版嵁搴�
+ apsWeldSeamStatisticsV2Mapper.updateApsWeldSeamStatisticsV2(originalData);
+
+ // 7. 杩斿洖鏇存柊鍚庣殑瀹屾暣璁板綍
+ return originalData;
+ }
+
+ /**
+ * 鍒锋柊鐒婄紳缁熻琛ㄦ暟鎹�
+ *
+ * @param username 鎿嶄綔鐢ㄦ埛
+ * @return 鍙楀奖鍝嶇殑璁板綍鏁�
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int refreshWeldSeamStatistics(String username) {
+ // 1. 娓呯┖缁熻琛�
+ apsWeldSeamStatisticsV2Mapper.truncateTable();
+
+ // 2. 鑾峰彇鏈�鏂扮殑缁熻鏁版嵁
+ List<ApsWeldSeamStatisticsV2> statisticsList = apsWeldSeamStatisticsV2Mapper.queryWeldSeamStatistics();
+
+ // 3. 璁剧疆鍒涘缓淇℃伅鍜孖D锛屽苟鑾峰彇鐢熶骇鏃ョ剨缂濇暟鎹�
+ Date now = new Date();
+ for (ApsWeldSeamStatisticsV2 statistics : statisticsList) {
+ // 浣跨敤UUID浣滀负ID
+ statistics.setId(IdUtils.fastUUID());
+ statistics.setCreateBy(username);
+ statistics.setCreateTime(now);
+
+ // 鍏堣绠楅渶姹傛棩鐒婄紳(requirementDayWeldSeam)
+ if(statistics.getDays() != null && statistics.getDays().doubleValue() > 0 && statistics.getTotal() != null) {
+ // 璁$畻闇�姹傛棩鐒婄紳 = 鍚堣/澶╂暟锛屽洓鑸嶄簲鍏�
+ double result = statistics.getTotal().doubleValue() / statistics.getDays().doubleValue();
+ BigDecimal requirementDayWeldSeam = new BigDecimal(result).setScale(0, java.math.RoundingMode.HALF_UP);
+ statistics.setRequirementDayWeldSeam(requirementDayWeldSeam);
+ } else if (statistics.getRequirementDayWeldSeam() == null) {
+ // 濡傛灉鏃犳硶璁$畻涓斾箣鍓嶆病鏈夊�硷紝璁剧疆榛樿鍊�
+ statistics.setRequirementDayWeldSeam(BigDecimal.ZERO);
+ }
+
+ // 璁剧疆鐢熶骇鏃ョ剨缂�(productionDayWeldSeam)
+ // 鏍规嵁year銆乵onth銆乸roductionBase鏌ヨ瀵瑰簲鐨勭敓浜ф棩鐒婄紳鏁版嵁
+ if (statistics.getYear() != null && statistics.getMonth() != null && statistics.getProductionBase() != null) {
+ // 鍒涘缓鏌ヨ鏉′欢
+ ApsGasPipelineCapacityPlan queryParam = new ApsGasPipelineCapacityPlan();
+ queryParam.setYear(statistics.getYear().toString());
+ queryParam.setMonth(statistics.getMonth().toString());
+ queryParam.setOrgCode(statistics.getProductionBase());
+
+ // 鐩存帴璋冪敤Controller鐨刲ist鏂规硶鑾峰彇鏁版嵁
+ TableDataInfo tableDataInfo = apsGasPipelineCapacityPlanController.list(queryParam);
+ List<ApsGasPipelineCapacityPlan> capacityPlans = (List<ApsGasPipelineCapacityPlan>) tableDataInfo.getRows();
+
+ // 閬嶅巻鎵惧埌processName涓�"姘斾綋绠¤矾杞ㄩ亾鐒婃帴缁�"鐨勮褰�
+ for (ApsGasPipelineCapacityPlan plan : capacityPlans) {
+ if ("姘斾綋绠¤矾杞ㄩ亾鐒婃帴缁�".equals(plan.getProcessName()) && plan.getDayProduceAllNum() != null) {
+ // 璁剧疆鐢熶骇鏃ョ剨缂濆��
+ statistics.setProductionDayWeldSeam(plan.getDayProduceAllNum());
+ break; // 鎵惧埌鍖归厤璁板綍鍚庨��鍑哄惊鐜�
+ }
+ }
+ }
+
+ // 濡傛灉娌℃湁鎵惧埌鍖归厤鐨勪骇鑳借鍒掓暟鎹紝璁剧疆榛樿鐘舵��
+ if (statistics.getProductionDayWeldSeam() == null) {
+ statistics.setProductionDayWeldSeam(BigDecimal.ZERO);
+ }
+
+ // 鏈�鍚庣粺涓�璁$畻isSatisfy锛堟槸鍚︽弧瓒筹級
+ // 褰撶敓浜ф棩鐒婄紳 >= 闇�姹傛棩鐒婄紳鏃朵负婊¤冻锛屽惁鍒欎负涓嶆弧瓒�
+ if (statistics.getRequirementDayWeldSeam() != null &&
+ statistics.getProductionDayWeldSeam() != null &&
+ statistics.getProductionDayWeldSeam().compareTo(statistics.getRequirementDayWeldSeam()) >= 0) {
+ statistics.setIsSatisfy("1"); // 婊¤冻
+ } else {
+ statistics.setIsSatisfy("0"); // 涓嶆弧瓒�
+ }
+ }
+
+ // 4. 鎵归噺鎻掑叆鏁版嵁
+ int count = 0;
+ if (!statisticsList.isEmpty()) {
+ count = apsWeldSeamStatisticsV2Mapper.batchInsert(statisticsList);
+ }
+
+ return count;
+ }
+}
\ No newline at end of file
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlatePlanMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlatePlanMapper.xml
index 3a38efa..c075b48 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlatePlanMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlatePlanMapper.xml
@@ -277,15 +277,19 @@
</update>
<select id="selectPlatePlanByPlantMajor" parameterType="com.aps.core.domain.ApsPlate.ApsPlatePlan" resultMap="ApsPlatePlanResult">
- select id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity,require_id,
- unmatched_quantity,version, production_base,plan_end_day,order_create_time,low_order_code
- from aps_plate_plan
- <where>
- <if test="plant != null "> and plant = #{plant} </if>
- <if test="professionalAffiliation != null "> and professional_affiliation = 'main' </if>
- and del_flag='0'
- </where>
- order by document_number asc,id asc
+ with rd as (
+ select doc_no,require_date from aps_plate_require_date where del_flag=0
+ )
+ select
+ app.id,app.document_number,app.main_part_number,app.item_number,app.plant,app.professional_affiliation,app.production_quantity,app.require_id,
+ app.unmatched_quantity,app.version, app.production_base,app.order_create_time,app.low_order_code,
+ app.plan_end_day as orign_end_day,
+ COALESCE(rd.require_date,app.plan_end_day) as plan_end_day
+ from aps_plate_plan as app
+ left join rd on app.document_number=rd.doc_no
+ where app.del_flag='0' and app.professional_affiliation = 'main'
+ <if test="plant != null "> and plant = #{plant} </if>
+ order by document_number ,id
</select>
<select id="selectUnMatchPlateSubPlan" parameterType="com.aps.core.domain.ApsPlate.ApsPlatePlan" resultMap="ApsPlatePlanResult">
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateProcessStatMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateProcessStatMapper.xml
index b25cfcc..a7f7adc 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateProcessStatMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateProcessStatMapper.xml
@@ -133,8 +133,10 @@
</delete>
<select id="queryTempStat" resultMap="ApsPlateProcessStatResult">
+ with dt as ( select doc_no,require_date from aps_plate_require_date where del_flag=0),
+ rd as ( select doc_no,plan_end_day from aps_plate_standard_require_order_end_day where del_flag=0)
select row_number() over (partition by rt.work_order_no order by rt.process_number desc ) as num,
- rt.work_order_no,
+ rt.work_order_no,
rt.process_name,
cast(rt.process_number as numeric(18, 2)) as route_process_number,
cast(pl.process_number as numeric(18, 2)) as current_process_number,
@@ -144,13 +146,16 @@
rt.process_plan_start_day,
rt.process_plan_end_day,
pl.plan_end_day,
- COALESCE(rd.plan_end_day,pl.plan_end_day) as order_plan_end_day
+ rd.plan_end_day as modify_day,
+ dt.require_date,
+ COALESCE(rd.plan_end_day, COALESCE(dt.require_date, pl.plan_end_day) ) as order_plan_end_day
from aps_plate_plan as pl
left join aps_process_route as rt on pl.document_number = rt.work_order_no
- left join aps_plate_standard_require_order_end_day as rd on pl.document_number = rd.doc_no and rd.del_flag =0
- where pl.document_number is not null and rt.work_order_no is not null and
- (pl.plan_end_day is not null or rd.plan_end_day is not null )
- order by rt.work_order_no asc, rt.process_number desc
+ left join rd on pl.document_number = rd.doc_no
+ left join dt on pl.document_number=dt.doc_no
+ where pl.document_number is not null
+ and rt.work_order_no is not null
+ order by rt.work_order_no, rt.process_number desc
</select>
<update id="removeOtherStat" parameterType="String">
delete from aps_plate_process_stat where batch_number != #{batchNumber}
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsWeldSeamStatisticsV2Mapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsWeldSeamStatisticsV2Mapper.xml
new file mode 100644
index 0000000..42e3648
--- /dev/null
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsWeldSeamStatisticsV2Mapper.xml
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.aps.core.mapper.mainPlan.ApsWeldSeamStatisticsV2Mapper">
+
+ <resultMap type="com.aps.core.domain.mainPlan.ApsWeldSeamStatisticsV2" id="ApsWeldSeamStatisticsV2Result">
+ <id property="id" column="id"/>
+ <result property="year" column="year"/>
+ <result property="month" column="month"/>
+ <result property="productionBase" column="production_base"/>
+ <result property="pipingOrderRequirement" column="piping_order_requirement"/>
+ <result property="gasOrderRequirement" column="gas_order_requirement"/>
+ <result property="pipingPredictionRequirement" column="piping_prediction_requirement"/>
+ <result property="gasPredictionRequirement" column="gas_prediction_requirement"/>
+ <result property="reserveEmergencyOrderOutput" column="reserve_emergency_order_output"/>
+ <result property="total" column="total"/>
+ <result property="days" column="days"/>
+ <result property="requirementDayWeldSeam" column="requirement_day_weld_seam"/>
+ <result property="productionDayWeldSeam" column="production_day_weld_seam"/>
+ <result property="isSatisfy" column="is_satisfy"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ </resultMap>
+
+ <sql id="selectApsWeldSeamStatisticsV2Vo">
+ select id, year, month, production_base, piping_order_requirement, gas_order_requirement,
+ piping_prediction_requirement, gas_prediction_requirement, reserve_emergency_order_output,
+ total, days, requirement_day_weld_seam, production_day_weld_seam, is_satisfy,
+ create_by, create_time, update_by, update_time
+ from aps_weld_seam_statistics_v2
+ </sql>
+
+ <select id="selectApsWeldSeamStatisticsV2ById" parameterType="String" resultMap="ApsWeldSeamStatisticsV2Result">
+ <include refid="selectApsWeldSeamStatisticsV2Vo"/>
+ where id = #{id}
+ </select>
+
+ <select id="selectApsWeldSeamStatisticsV2List" parameterType="com.aps.core.domain.mainPlan.ApsWeldSeamStatisticsV2" resultMap="ApsWeldSeamStatisticsV2Result">
+ <include refid="selectApsWeldSeamStatisticsV2Vo"/>
+ <where>
+ <if test="params.beginYear != null and params.beginYear != '' and params.endYear != null and params.endYear != ''"> and year between #{params.beginYear} and #{params.endYear}</if>
+ <if test="params.beginMonth != null and params.beginMonth != '' and params.endMonth != null and params.endMonth != ''"> and month between #{params.beginMonth} and #{params.endMonth}</if>
+ <if test="productionBase != null and productionBase != ''"> and production_base like '%'|| #{productionBase}|| '%'</if>
+ </where>
+ order by year, month, production_base
+ </select>
+
+ <insert id="insertApsWeldSeamStatisticsV2" parameterType="com.aps.core.domain.mainPlan.ApsWeldSeamStatisticsV2">
+ insert into aps_weld_seam_statistics_v2
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">id,</if>
+ <if test="year != null">year,</if>
+ <if test="month != null">month,</if>
+ <if test="productionBase != null">production_base,</if>
+ <if test="pipingOrderRequirement != null">piping_order_requirement,</if>
+ <if test="gasOrderRequirement != null">gas_order_requirement,</if>
+ <if test="pipingPredictionRequirement != null">piping_prediction_requirement,</if>
+ <if test="gasPredictionRequirement != null">gas_prediction_requirement,</if>
+ <if test="reserveEmergencyOrderOutput != null">reserve_emergency_order_output,</if>
+ <if test="total != null">total,</if>
+ <if test="days != null">days,</if>
+ <if test="requirementDayWeldSeam != null">requirement_day_weld_seam,</if>
+ <if test="productionDayWeldSeam != null">production_day_weld_seam,</if>
+ <if test="isSatisfy != null">is_satisfy,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="updateBy != null">update_by,</if>
+ <if test="updateTime != null">update_time,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">#{id},</if>
+ <if test="year != null">#{year},</if>
+ <if test="month != null">#{month},</if>
+ <if test="productionBase != null">#{productionBase},</if>
+ <if test="pipingOrderRequirement != null">#{pipingOrderRequirement},</if>
+ <if test="gasOrderRequirement != null">#{gasOrderRequirement},</if>
+ <if test="pipingPredictionRequirement != null">#{pipingPredictionRequirement},</if>
+ <if test="gasPredictionRequirement != null">#{gasPredictionRequirement},</if>
+ <if test="reserveEmergencyOrderOutput != null">#{reserveEmergencyOrderOutput},</if>
+ <if test="total != null">#{total},</if>
+ <if test="days != null">#{days},</if>
+ <if test="requirementDayWeldSeam != null">#{requirementDayWeldSeam},</if>
+ <if test="productionDayWeldSeam != null">#{productionDayWeldSeam},</if>
+ <if test="isSatisfy != null">#{isSatisfy},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="updateBy != null">#{updateBy},</if>
+ <if test="updateTime != null">#{updateTime},</if>
+ </trim>
+ </insert>
+
+ <update id="updateApsWeldSeamStatisticsV2" parameterType="com.aps.core.domain.mainPlan.ApsWeldSeamStatisticsV2">
+ update aps_weld_seam_statistics_v2
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="year != null">year = #{year},</if>
+ <if test="month != null">month = #{month},</if>
+ <if test="productionBase != null">production_base = #{productionBase},</if>
+ <if test="pipingOrderRequirement != null">piping_order_requirement = #{pipingOrderRequirement},</if>
+ <if test="gasOrderRequirement != null">gas_order_requirement = #{gasOrderRequirement},</if>
+ <if test="pipingPredictionRequirement != null">piping_prediction_requirement = #{pipingPredictionRequirement},</if>
+ <if test="gasPredictionRequirement != null">gas_prediction_requirement = #{gasPredictionRequirement},</if>
+ <if test="reserveEmergencyOrderOutput != null">reserve_emergency_order_output = #{reserveEmergencyOrderOutput},</if>
+ <if test="total != null">total = #{total},</if>
+ <if test="days != null">days = #{days},</if>
+ <if test="requirementDayWeldSeam != null">requirement_day_weld_seam = #{requirementDayWeldSeam},</if>
+ <if test="productionDayWeldSeam != null">production_day_weld_seam = #{productionDayWeldSeam},</if>
+ <if test="isSatisfy != null">is_satisfy = #{isSatisfy},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="updateBy != null">update_by = #{updateBy},</if>
+ <if test="updateTime != null">update_time = #{updateTime},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteApsWeldSeamStatisticsV2ById" parameterType="String">
+ delete from aps_weld_seam_statistics_v2 where id = #{id}
+ </delete>
+
+ <delete id="deleteApsWeldSeamStatisticsV2ByIds" parameterType="String">
+ delete from aps_weld_seam_statistics_v2 where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+
+ <update id="truncateTable">
+ TRUNCATE TABLE aps_weld_seam_statistics_v2
+ </update>
+
+ <insert id="batchInsert" parameterType="java.util.List">
+ INSERT INTO aps_weld_seam_statistics_v2 (
+ id, year, month, production_base,
+ piping_order_requirement, gas_order_requirement,
+ piping_prediction_requirement, gas_prediction_requirement,
+ reserve_emergency_order_output, total, days,
+ requirement_day_weld_seam, production_day_weld_seam,
+ is_satisfy, create_by, create_time
+ ) VALUES
+ <foreach collection="list" item="item" separator=",">
+ (
+ #{item.id}, #{item.year}, #{item.month}, #{item.productionBase},
+ #{item.pipingOrderRequirement}, #{item.gasOrderRequirement},
+ #{item.pipingPredictionRequirement}, #{item.gasPredictionRequirement},
+ #{item.reserveEmergencyOrderOutput}, #{item.total}, #{item.days},
+ #{item.requirementDayWeldSeam}, #{item.productionDayWeldSeam},
+ #{item.isSatisfy}, #{item.createBy}, #{item.createTime}
+ )
+ </foreach>
+ </insert>
+
+ <select id="queryWeldSeamStatistics" resultMap="ApsWeldSeamStatisticsV2Result">
+ WITH 宸ュ崟鐒婄紳璁$畻 AS (
+ -- 璁$畻宸ュ崟鐨勭剨缂濇暟閲�
+ SELECT
+ mo.factory as 鐢熶骇鍩哄湴,
+ mo.material_code as 鏂欏彿,
+ EXTRACT(YEAR FROM mo.plan_end) as 骞翠唤,
+ EXTRACT(MONTH FROM mo.plan_end) as 鏈堜唤,
+ mo.quantity * COALESCE(ws.hup_qty, 0) as 宸ュ崟鐒婄紳鏁�,
+ mgm.domain as 涓撲笟
+ FROM aps_gas_pipeline_mo mo
+ LEFT JOIN aps_weld_seam_standard ws ON mo.material_code = ws.item_code AND ws.del_flag = 0
+ LEFT JOIN aps_material_product_group_management mgm ON mo.material_code = mgm.material_code
+ ),
+ 棰勬祴鐒婄紳璁$畻 AS (
+ -- 璁$畻棰勬祴鐨勭剨缂濇暟閲�
+ SELECT
+ gp.factory as 鐢熶骇鍩哄湴,
+ gp.material_code as 鏂欏彿,
+ EXTRACT(YEAR FROM gp.predict_date) as 骞翠唤,
+ EXTRACT(MONTH FROM gp.predict_date) as 鏈堜唤,
+ gp.predict_quantity * COALESCE(ws.hup_qty, 0) as 棰勬祴鐒婄紳鏁�,
+ mgm.domain as 涓撲笟
+ FROM aps_gas_pipeline_prediction gp
+ LEFT JOIN aps_weld_seam_standard ws ON gp.material_code = ws.item_code AND ws.del_flag = 0
+ LEFT JOIN aps_material_product_group_management mgm ON gp.material_code = mgm.material_code
+ ),
+ 姹囨�绘暟鎹� AS (
+ SELECT
+ 骞翠唤,
+ 鏈堜唤,
+ 鐢熶骇鍩哄湴,
+ -- 绠¤矾璁㈠崟闇�姹�
+ COALESCE(SUM(CASE
+ WHEN 涓撲笟 = 'GL' AND 绫诲瀷 = '宸ュ崟'
+ THEN 鐒婄紳鏁� ELSE 0
+ END), 0) as 绠¤矾璁㈠崟闇�姹�,
+ -- 姘旀煖璁㈠崟闇�姹�
+ COALESCE(SUM(CASE
+ WHEN 涓撲笟 = 'QG' AND 绫诲瀷 = '宸ュ崟'
+ THEN 鐒婄紳鏁� ELSE 0
+ END), 0) as 姘旀煖璁㈠崟闇�姹�,
+ -- 绠¤矾棰勬祴闇�姹�
+ COALESCE(SUM(CASE
+ WHEN 涓撲笟 = 'GL' AND 绫诲瀷 = '棰勬祴'
+ THEN 鐒婄紳鏁� ELSE 0
+ END), 0) as 绠¤矾棰勬祴闇�姹�,
+ -- 姘旀煖棰勬祴闇�姹�
+ COALESCE(SUM(CASE
+ WHEN 涓撲笟 = 'QG' AND 绫诲瀷 = '棰勬祴'
+ THEN 鐒婄紳鏁� ELSE 0
+ END), 0) as 姘旀煖棰勬祴闇�姹�
+ FROM (
+ SELECT
+ 骞翠唤,
+ 鏈堜唤,
+ 鐢熶骇鍩哄湴,
+ 宸ュ崟鐒婄紳鏁� as 鐒婄紳鏁�,
+ '宸ュ崟' as 绫诲瀷,
+ 涓撲笟
+ FROM 宸ュ崟鐒婄紳璁$畻
+ UNION ALL
+ SELECT
+ 骞翠唤,
+ 鏈堜唤,
+ 鐢熶骇鍩哄湴,
+ 棰勬祴鐒婄紳鏁� as 鐒婄紳鏁�,
+ '棰勬祴' as 绫诲瀷,
+ 涓撲笟
+ FROM 棰勬祴鐒婄紳璁$畻
+ ) 鍚堝苟鏁版嵁
+ GROUP BY 骞翠唤, 鏈堜唤, 鐢熶骇鍩哄湴
+ )
+ SELECT
+ s.骞翠唤 as "year",
+ s.鏈堜唤 as "month",
+ s.鐢熶骇鍩哄湴 as "production_base",
+ ROUND(s.绠¤矾璁㈠崟闇�姹�, 4) as "piping_order_requirement",
+ ROUND(s.姘旀煖璁㈠崟闇�姹�, 4) as "gas_order_requirement",
+ ROUND(s.绠¤矾棰勬祴闇�姹�, 4) as "piping_prediction_requirement",
+ ROUND(s.姘旀煖棰勬祴闇�姹�, 4) as "gas_prediction_requirement",
+ 0 as "reserve_emergency_order_output",
+ ROUND(s.绠¤矾璁㈠崟闇�姹� + s.姘旀煖璁㈠崟闇�姹� + s.绠¤矾棰勬祴闇�姹� + s.姘旀煖棰勬祴闇�姹�, 4) as "total",
+ 0 as "days",
+ 0 as "requirement_day_weld_seam",
+ 0 as "production_day_weld_seam",
+ '0' as "is_satisfy",
+ 'system' as "create_by",
+ CURRENT_TIMESTAMP as "create_time"
+ FROM 姹囨�绘暟鎹� s
+ ORDER BY s.骞翠唤, s.鏈堜唤, s.鐢熶骇鍩哄湴
+ </select>
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3