Эх сурвалжийг харах

王子文 生产月报 编辑

wangggziwen 2 жил өмнө
parent
commit
8d2776195e

+ 99 - 0
master/src/main/java/com/ruoyi/project/production/controller/TMonthlyProductionReportController.java

@@ -47,6 +47,105 @@ public class TMonthlyProductionReportController extends BaseController
         return tMonthlyProductionReportService.export(year);
     }
 
+    /**
+     * 修改Cracker Raw Material
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/crackerRawMaterial")
+    public AjaxResult updateCrackerRawMaterial(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updateCrackerRawMaterial(monthlyUpdateVO));
+    }
+
+    /**
+     * 修改Cracker Output Product
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/crackerOutputProduct")
+    public AjaxResult updateCrackerOutputProduct(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updateCrackerOutputProduct(monthlyUpdateVO));
+    }
+
+    /**
+     * 修改Aromatics Raw Material
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/aAromaticsRawMaterial")
+    public AjaxResult updateAromaticsRawMaterial(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updateAromaticsRawMaterial(monthlyUpdateVO));
+    }
+
+    /**
+     * 修改Aromatics Output Product
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/aromaticsOutputProduct")
+    public AjaxResult updateAromaticsOutputProduct(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updateAromaticsOutputProduct(monthlyUpdateVO));
+    }
+
+    /**
+     * 修改Product Yield
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/productYield")
+    public AjaxResult updateProductYield(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updateProductYield(monthlyUpdateVO));
+    }
+
+    /**
+     * 修改Cracker Energy Consumption
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/crackerEnergyConsumption")
+    public AjaxResult updateCrackerEnergyConsumption(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updateCrackerEnergyConsumption(monthlyUpdateVO));
+    }
+
+    /**
+     * 修改Aromatics Energy Consumption
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/aromaticsEnergyConsumption")
+    public AjaxResult updateAromaticsEnergyConsumption(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updateAromaticsEnergyConsumption(monthlyUpdateVO));
+    }
+
+    /**
+     * 修改Plant Load
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/plantLoad")
+    public AjaxResult updatePlantLoad(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updatePlantLoad(monthlyUpdateVO));
+    }
+
+    /**
+     * 修改Otherside
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/otherside")
+    public AjaxResult updateOtherside(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updateOtherside(monthlyUpdateVO));
+    }
+
+    /**
+     * 修改SCTU Utility Consumption
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/sctuUtilityConsumption")
+    public AjaxResult updateSctuUtilityConsumption(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updateSctuUtilityConsumption(monthlyUpdateVO));
+    }
+
+    /**
+     * 修改Summary
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/summary")
+    public AjaxResult updateSummary(@RequestBody MonthlyUpdateVO monthlyUpdateVO) {
+        return toAjax(tMonthlyProductionReportService.updateSummary(monthlyUpdateVO));
+    }
+
     /**
      * 修改SUB Utility Consumption
      */

+ 44 - 0
master/src/main/java/com/ruoyi/project/production/service/ITMonthlyProductionReportService.java

@@ -228,17 +228,61 @@ public interface ITMonthlyProductionReportService
      */
     public int updateKbi(MonthlyUpdateVO monthlyUpdateVO);
 
+    /**
+     * 修改修改Cracker Raw Material
+     */
     public int updateCrackerRawMaterial(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改Cracker Output Product
+     */
     public int updateCrackerOutputProduct(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改Aromatics Raw Material
+     */
     public int updateAromaticsRawMaterial(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改Aromatics Output Product
+     */
     public int updateAromaticsOutputProduct(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改Product Yield
+     */
     public int updateProductYield(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改Cracker Energy Consumption
+     */
     public int updateCrackerEnergyConsumption(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改Aromatics Energy Consumption
+     */
     public int updateAromaticsEnergyConsumption(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改Plant Load
+     */
     public int updatePlantLoad(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改Otherside
+     */
     public int updateOtherside(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改SCTU Utility Consumption
+     */
     public int updateSctuUtilityConsumption(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改Summary
+     */
     public int updateSummary(MonthlyUpdateVO monthlyUpdateVO);
 
+
     public AjaxResult export(Long year);
 }

+ 578 - 22
master/src/main/java/com/ruoyi/project/production/service/impl/TMonthlyProductionReportServiceImpl.java

@@ -2989,68 +2989,624 @@ public class TMonthlyProductionReportServiceImpl implements ITMonthlyProductionR
 
     @Override
     public int updateCrackerRawMaterial(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("nap".equals(tableDatum.getDictLabel())) { report.setNap(monthValue); }
+                if ("c5".equals(tableDatum.getDictLabel())) { report.setC5(monthValue); }
+                if ("c6_c8_na".equals(tableDatum.getDictLabel())) { report.setC6C8Na(monthValue); }
+                if ("wison_ethane".equals(tableDatum.getDictLabel())) { report.setWisonEthane(monthValue); }
+                if ("lpg_to_furnace".equals(tableDatum.getDictLabel())) { report.setLpgToFurnace(monthValue); }
+                if ("raff3_fr_bd_and_2ph".equals(tableDatum.getDictLabel())) { report.setRaff3FrBdAnd2ph(monthValue); }
+                if ("c2_fr_ldpe".equals(tableDatum.getDictLabel())) { report.setC2FrLdpe(monthValue); }
+                if ("c3_fr_oxo".equals(tableDatum.getDictLabel())) { report.setC3FrOxo(monthValue); }
+                if ("mixed_c3_c4".equals(tableDatum.getDictLabel())) { report.setMixedC3C4(monthValue); }
+                if ("hy_c9".equals(tableDatum.getDictLabel())) { report.setHyC9(monthValue); }
+                if ("pgu_offgas".equals(tableDatum.getDictLabel())) { report.setPguOffgas(monthValue); }
+                if ("wash_oil".equals(tableDatum.getDictLabel())) { report.setWashOil(monthValue); }
+                if ("toluene".equals(tableDatum.getDictLabel())) { report.setToluene(monthValue); }
+                if ("hy_c4_fr_r800".equals(tableDatum.getDictLabel())) { report.setHyC4FrR800(monthValue); }
+                if ("cracker_raw_input".equals(tableDatum.getDictLabel())) { report.setCrackerRawInput(monthValue); }
+                if ("cracker_raw_feed".equals(tableDatum.getDictLabel())) { report.setCrackerRawFeed(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     @Override
     public int updateCrackerOutputProduct(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("h2_produced".equals(tableDatum.getDictLabel())) { report.setH2Produced(monthValue); }
+                if ("ethylen_produced".equals(tableDatum.getDictLabel())) { report.setEthylenProduced(monthValue); }
+                if ("propylene_produced".equals(tableDatum.getDictLabel())) { report.setPropyleneProduced(monthValue); }
+                if ("c3_c4_lpg_produced".equals(tableDatum.getDictLabel())) { report.setC3C4LpgProduced(monthValue); }
+                if ("mixed_c4s_produced".equals(tableDatum.getDictLabel())) { report.setMixedC4sProduced(monthValue); }
+                if ("rpg_produced".equals(tableDatum.getDictLabel())) { report.setRpgProduced(monthValue); }
+                if ("po_flux_oil_produced".equals(tableDatum.getDictLabel())) { report.setPoFluxOilProduced(monthValue); }
+                if ("naphthalene_produced".equals(tableDatum.getDictLabel())) { report.setNaphthaleneProduced(monthValue); }
+                if ("ebo_produced".equals(tableDatum.getDictLabel())) { report.setEboProduced(monthValue); }
+                if ("residue_oil_produced".equals(tableDatum.getDictLabel())) { report.setResidueOilProduced(monthValue); }
+                if ("methane_produced".equals(tableDatum.getDictLabel())) { report.setMethaneProduced(monthValue); }
+                if ("offgas_produced".equals(tableDatum.getDictLabel())) { report.setOffgasProduced(monthValue); }
+                if ("cracker_output".equals(tableDatum.getDictLabel())) { report.setCrackerOutput(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     @Override
     public int updateAromaticsRawMaterial(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("pgu_rpg2".equals(tableDatum.getDictLabel())) { report.setPguRpg2(monthValue); }
+                if ("pgu_h2".equals(tableDatum.getDictLabel())) { report.setPguH2(monthValue); }
+                if ("pgu_btx_produced".equals(tableDatum.getDictLabel())) { report.setPguBtxProduced(monthValue); }
+                if ("pgu_btx_to_aeu".equals(tableDatum.getDictLabel())) { report.setPguBtxToAeu(monthValue); }
+                if ("aromatics_raw_input".equals(tableDatum.getDictLabel())) { report.setAromaticsRawInput(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     @Override
     public int updateAromaticsOutputProduct(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("aeu_benzene_produced".equals(tableDatum.getDictLabel())) { report.setAeuBenzeneProduced(monthValue); }
+                if ("aeu_toluene_produced".equals(tableDatum.getDictLabel())) { report.setAeuTolueneProduced(monthValue); }
+                if ("aeu_xylene_produced".equals(tableDatum.getDictLabel())) { report.setAeuXyleneProduced(monthValue); }
+                if ("aeu_c6_c8_na_produced".equals(tableDatum.getDictLabel())) { report.setAeuC6C8NaProduced(monthValue); }
+                if ("pgu_c5_produced".equals(tableDatum.getDictLabel())) { report.setPguC5Produced(monthValue); }
+                if ("pgu_c9_produced".equals(tableDatum.getDictLabel())) { report.setPguC9Produced(monthValue); }
+                if ("pgu_washoil_produced".equals(tableDatum.getDictLabel())) { report.setPguWashoilProduced(monthValue); }
+                if ("pgu_offgas_produced".equals(tableDatum.getDictLabel())) { report.setPguOffgasProduced(monthValue); }
+                if ("pgu_btx_change".equals(tableDatum.getDictLabel())) { report.setPguBtxChange(monthValue); }
+                if ("pgu_btx_produced".equals(tableDatum.getDictLabel())) { report.setPguBtxProduced(monthValue); }
+                if ("aeu_toluene_produced_m_eu".equals(tableDatum.getDictLabel())) { report.setAeuTolueneProducedMEu(monthValue); }
+                if ("aromatics_output".equals(tableDatum.getDictLabel())) { report.setAromaticsOutput(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     @Override
     public int updateProductYield(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("gaseity_yield".equals(tableDatum.getDictLabel())) { report.setGaseityYield(monthValue); }
+                if ("tatal_yield".equals(tableDatum.getDictLabel())) { report.setTatalYield(monthValue); }
+                if ("c3_c2_yield".equals(tableDatum.getDictLabel())) { report.setC3C2Yield(monthValue); }
+                if ("h2_yield".equals(tableDatum.getDictLabel())) { report.setH2Yield(monthValue); }
+                if ("ethylene_yield".equals(tableDatum.getDictLabel())) { report.setEthyleneYield(monthValue); }
+                if ("propylene_yield".equals(tableDatum.getDictLabel())) { report.setPropyleneYield(monthValue); }
+                if ("c3_c4_lpg_yield".equals(tableDatum.getDictLabel())) { report.setC3C4LpgYield(monthValue); }
+                if ("c4s_yield".equals(tableDatum.getDictLabel())) { report.setC4sYield(monthValue); }
+                if ("po_yield".equals(tableDatum.getDictLabel())) { report.setPoYield(monthValue); }
+                if ("naphthalene_yield".equals(tableDatum.getDictLabel())) { report.setNaphthaleneYield(monthValue); }
+                if ("ebo_yield".equals(tableDatum.getDictLabel())) { report.setEboYield(monthValue); }
+                if ("ws_yield".equals(tableDatum.getDictLabel())) { report.setWsYield(monthValue); }
+                if ("methane_yield".equals(tableDatum.getDictLabel())) { report.setMethaneYield(monthValue); }
+                if ("offage_yield".equals(tableDatum.getDictLabel())) { report.setOffageYield(monthValue); }
+                if ("rpg_yield".equals(tableDatum.getDictLabel())) { report.setRpgYield(monthValue); }
+                if ("benzene_yield".equals(tableDatum.getDictLabel())) { report.setBenzeneYield(monthValue); }
+                if ("toluene_yield".equals(tableDatum.getDictLabel())) { report.setTolueneYield(monthValue); }
+                if ("xylene_yield".equals(tableDatum.getDictLabel())) { report.setXyleneYield(monthValue); }
+                if ("c6_c8_na_yield".equals(tableDatum.getDictLabel())) { report.setC6C8NaYield(monthValue); }
+                if ("c5_yield".equals(tableDatum.getDictLabel())) { report.setC5Yield(monthValue); }
+                if ("c9_yield".equals(tableDatum.getDictLabel())) { report.setC9Yield(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     @Override
     public int updateCrackerEnergyConsumption(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("cracker_energy_te_teo".equals(tableDatum.getDictLabel())) { report.setCrackerEnergyTeTeo(monthValue); }
+                if ("cracker_energy_te_tec".equals(tableDatum.getDictLabel())) { report.setCrackerEnergyTeTec(monthValue); }
+                if ("cracker_energy_ee_kgeot".equals(tableDatum.getDictLabel())) { report.setCrackerEnergyEeKgeot(monthValue); }
+                if ("cracker_energy_ee_kgect".equals(tableDatum.getDictLabel())) { report.setCrackerEnergyEeKgect(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     @Override
     public int updateAromaticsEnergyConsumption(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("aromatics_energy_te_teo".equals(tableDatum.getDictLabel())) { report.setAromaticsEnergyTeTeo(monthValue); }
+                if ("aromatics_energy_te_tec".equals(tableDatum.getDictLabel())) { report.setAromaticsEnergyTeTec(monthValue); }
+                if ("aromatics_energy_ee_kgeot".equals(tableDatum.getDictLabel())) { report.setAromaticsEnergyEeKgeot(monthValue); }
+                if ("aromatics_energy_ee_kgect".equals(tableDatum.getDictLabel())) { report.setAromaticsEnergyEeKgect(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     @Override
     public int updatePlantLoad(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("cracker_load".equals(tableDatum.getDictLabel())) { report.setCrackerLoad(monthValue); }
+                if ("c2_c3_capacity".equals(tableDatum.getDictLabel())) { report.setC2C3Capacity(monthValue); }
+                if ("ethylene_load".equals(tableDatum.getDictLabel())) { report.setEthyleneLoad(monthValue); }
+                if ("ethylene_capacity".equals(tableDatum.getDictLabel())) { report.setEthyleneCapacity(monthValue); }
+                if ("aeu_load".equals(tableDatum.getDictLabel())) { report.setAeuLoad(monthValue); }
+                if ("btx_capacity".equals(tableDatum.getDictLabel())) { report.setBtxCapacity(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     @Override
     public int updateOtherside(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("eu_loss".equals(tableDatum.getDictLabel())) { report.setEuLoss(monthValue); }
+                if ("eu_loss_rate".equals(tableDatum.getDictLabel())) { report.setEuLossRate(monthValue); }
+                if ("aeu_loss".equals(tableDatum.getDictLabel())) { report.setAeuLoss(monthValue); }
+                if ("aeu_loss_rate".equals(tableDatum.getDictLabel())) { report.setAeuLossRate(monthValue); }
+                if ("total_loss".equals(tableDatum.getDictLabel())) { report.setTotalLoss(monthValue); }
+                if ("total_loss_rate".equals(tableDatum.getDictLabel())) { report.setTotalLossRate(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     @Override
     public int updateSctuUtilityConsumption(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("sctu_consumption_fg".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionFg(monthValue); }
+                if ("sctu_consumption_mp".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionMp(monthValue); }
+                if ("sctu_consumption_lp".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionLp(monthValue); }
+                if ("sctu_consumption_electirc".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionElectirc(monthValue); }
+                if ("sctu_consumption_cw".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionCw(monthValue); }
+                if ("sctu_consumption_pa_ia".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionPaIa(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     @Override
     public int updateSummary(MonthlyUpdateVO monthlyUpdateVO) {
-        // TODO
-        return 0;
+        // 受影响行数
+        int affectedRows = 0;
+        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
+        long year = monthlyUpdateVO.getYear();
+        Class clazz = null;
+        try {
+            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        for (MonthlyProductionReportVO tableDatum : tableData) {
+            for (int i = 0; i < 12; i++) {
+                TMonthlyProductionReport report = new TMonthlyProductionReport();
+                report.setReportMonth((long)(i + 1));
+                report.setReportYear(year);
+                String monthValue = this.getMonthValue(i, clazz, tableDatum);
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("summary_cl_yb".equals(tableDatum.getDictLabel())) { report.setSummaryClYb(monthValue); }
+                if ("summary_cl_sny".equals(tableDatum.getDictLabel())) { report.setSummaryClSny(monthValue); }
+                if ("summary_cl_c5_raff".equals(tableDatum.getDictLabel())) { report.setSummaryClC5Raff(monthValue); }
+                if ("summary_cl_yw".equals(tableDatum.getDictLabel())) { report.setSummaryClYw(monthValue); }
+                if ("summary_cl_jqtj".equals(tableDatum.getDictLabel())) { report.setSummaryClJqtj(monthValue); }
+                if ("summary_cl_yxjy".equals(tableDatum.getDictLabel())) { report.setSummaryClYxjy(monthValue); }
+                if ("summary_cl_hhc4".equals(tableDatum.getDictLabel())) { report.setSummaryClHhc4(monthValue); }
+                if ("summary_cl_sb".equals(tableDatum.getDictLabel())) { report.setSummaryClSb(monthValue); }
+                if ("summary_cl_ljtw".equals(tableDatum.getDictLabel())) { report.setSummaryClLjtw(monthValue); }
+                if ("summary_cl_ljtj".equals(tableDatum.getDictLabel())) { report.setSummaryClLjtj(monthValue); }
+                if ("summary_cl_ccsny".equals(tableDatum.getDictLabel())) { report.setSummaryClCcsny(monthValue); }
+                if ("summary_cl_zqzh".equals(tableDatum.getDictLabel())) { report.setSummaryClZqzh(monthValue); }
+                if ("summary_cl_lqs".equals(tableDatum.getDictLabel())) { report.setSummaryClLqs(monthValue); }
+                if ("summary_cl_d".equals(tableDatum.getDictLabel())) { report.setSummaryClD(monthValue); }
+                if ("summary_cl_rlq".equals(tableDatum.getDictLabel())) { report.setSummaryClRlq(monthValue); }
+                if ("summary_cl_jzs".equals(tableDatum.getDictLabel())) { report.setSummaryClJzs(monthValue); }
+                if ("summary_cl_tpny".equals(tableDatum.getDictLabel())) { report.setSummaryClTpny(monthValue); }
+                if ("summary_sl_yb".equals(tableDatum.getDictLabel())) { report.setSummarySlYb(monthValue); }
+                if ("summary_sl_sny".equals(tableDatum.getDictLabel())) { report.setSummarySlSny(monthValue); }
+                if ("summary_sl_c5_raff".equals(tableDatum.getDictLabel())) { report.setSummarySlC5Raff(monthValue); }
+                if ("summary_sl_yw".equals(tableDatum.getDictLabel())) { report.setSummarySlYw(monthValue); }
+                if ("summary_sl_jqtj".equals(tableDatum.getDictLabel())) { report.setSummarySlJqtj(monthValue); }
+                if ("summary_sl_yxjy".equals(tableDatum.getDictLabel())) { report.setSummarySlYxjy(monthValue); }
+                if ("summary_sl_hhc4".equals(tableDatum.getDictLabel())) { report.setSummarySlHhc4(monthValue); }
+                if ("summary_sl_sb".equals(tableDatum.getDictLabel())) { report.setSummarySlSb(monthValue); }
+                if ("summary_sl_ljtw".equals(tableDatum.getDictLabel())) { report.setSummarySlLjtw(monthValue); }
+                if ("summary_sl_ljtj".equals(tableDatum.getDictLabel())) { report.setSummarySlLjtj(monthValue); }
+                if ("summary_sl_ccsny".equals(tableDatum.getDictLabel())) { report.setSummarySlCcsny(monthValue); }
+                if ("summary_sl_zqzh".equals(tableDatum.getDictLabel())) { report.setSummarySlZqzh(monthValue); }
+                if ("summary_sl_lqs".equals(tableDatum.getDictLabel())) { report.setSummarySlLqs(monthValue); }
+                if ("summary_sl_d".equals(tableDatum.getDictLabel())) { report.setSummarySlD(monthValue); }
+                if ("summary_sl_rlq".equals(tableDatum.getDictLabel())) { report.setSummarySlRlq(monthValue); }
+                if ("summary_sl_jzs".equals(tableDatum.getDictLabel())) { report.setSummarySlJzs(monthValue); }
+                if ("summary_sl_tpny".equals(tableDatum.getDictLabel())) { report.setSummarySlTpny(monthValue); }
+                // 当前报告年份
+                int reportYear = Integer.parseInt(report.getReportYear().toString());
+                // 当前报告月份
+                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
+                // 查询年份=reportYear,月份=reportMonth的月报数据
+                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
+                if (count == 0) {   // 新增月报数据
+                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
+                } else {    // 更新月报数据
+                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
+                }
+                // 同步更新月报数据
+                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
+                        (int)year,
+                        (i + 1),
+                        this.tMonthlyProductionReportMapper,
+                        this.tMonthlyProductionPriceMapper
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
     }
 
     /**

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 916 - 112
ui/src/views/production/monthly/index.vue


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно