Explorar o código

王子文 月报Shutdown Hour

wangggziwen %!s(int64=2) %!d(string=hai) anos
pai
achega
553b2adf33

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

@@ -36,6 +36,16 @@ public class TMonthlyProductionReportController extends BaseController
     @Autowired
     private ITMonthlyProductionReportService tMonthlyProductionReportService;
 
+    /**
+     * 修改Shoudown Hour
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:edit')")
+    @PutMapping(value = "/shoudownHour")
+    public AjaxResult updateShoudownHour(@RequestBody MonthlyUpdateVO monthlyUpdateVO)
+    {
+        return toAjax(tMonthlyProductionReportService.updateShoudownHour(monthlyUpdateVO));
+    }
+
     /**
      * 修改Aromatics Utility Consumption
      */

+ 169 - 1
master/src/main/java/com/ruoyi/project/production/domain/TMonthlyProductionReport.java

@@ -9,7 +9,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
  * 每月生产报告对象 t_monthly_production_report
  *
  * @author ruoyi
- * @date 2022-11-14
+ * @date 2022-11-15
  */
 public class TMonthlyProductionReport extends BaseEntity
 {
@@ -506,6 +506,54 @@ public class TMonthlyProductionReport extends BaseEntity
     @Excel(name = "Aromatics Energy Consumption Energy/ethylene")
     private String aromaticsEnergyEeKgect;
 
+    /** Shutdown Hour operation time */
+    @Excel(name = "Shutdown Hour operation time")
+    private String shutdouwnOpt;
+
+    /** Shutdown Hour operation hour */
+    @Excel(name = "Shutdown Hour operation hour")
+    private String shutdouwnOph;
+
+    /** Shutdown Hour equipment time */
+    @Excel(name = "Shutdown Hour equipment time")
+    private String shutdouwnEqt;
+
+    /** Shutdown Hour equipment hour */
+    @Excel(name = "Shutdown Hour equipment hour")
+    private String shutdouwnEqh;
+
+    /** Shutdown Hour instrument time */
+    @Excel(name = "Shutdown Hour instrument time")
+    private String shutdouwnIt;
+
+    /** Shutdown Hour instrument hour */
+    @Excel(name = "Shutdown Hour instrument hour")
+    private String shutdouwnIth;
+
+    /** Shutdown Hour electric time */
+    @Excel(name = "Shutdown Hour electric time")
+    private String shutdouwnElt;
+
+    /** Shutdown Hour electric hour */
+    @Excel(name = "Shutdown Hour electric hour")
+    private String shutdouwnElth;
+
+    /** Shutdown Hour otherwise time */
+    @Excel(name = "Shutdown Hour otherwise time")
+    private String shutdouwnOt;
+
+    /** Shutdown Hour otherwise hour */
+    @Excel(name = "Shutdown Hour otherwise hour")
+    private String shutdouwnOth;
+
+    /** Shutdown Hour total time */
+    @Excel(name = "Shutdown Hour total time")
+    private String shutdouwnTt;
+
+    /** Shutdown Hour total hour */
+    @Excel(name = "Shutdown Hour total hour")
+    private String shutdouwnTh;
+
     public void setId(Long id)
     {
         this.id = id;
@@ -1613,6 +1661,114 @@ public class TMonthlyProductionReport extends BaseEntity
     {
         return aromaticsEnergyEeKgect;
     }
+    public void setShutdouwnOpt(String shutdouwnOpt)
+    {
+        this.shutdouwnOpt = shutdouwnOpt;
+    }
+
+    public String getShutdouwnOpt()
+    {
+        return shutdouwnOpt;
+    }
+    public void setShutdouwnOph(String shutdouwnOph)
+    {
+        this.shutdouwnOph = shutdouwnOph;
+    }
+
+    public String getShutdouwnOph()
+    {
+        return shutdouwnOph;
+    }
+    public void setShutdouwnEqt(String shutdouwnEqt)
+    {
+        this.shutdouwnEqt = shutdouwnEqt;
+    }
+
+    public String getShutdouwnEqt()
+    {
+        return shutdouwnEqt;
+    }
+    public void setShutdouwnEqh(String shutdouwnEqh)
+    {
+        this.shutdouwnEqh = shutdouwnEqh;
+    }
+
+    public String getShutdouwnEqh()
+    {
+        return shutdouwnEqh;
+    }
+    public void setShutdouwnIt(String shutdouwnIt)
+    {
+        this.shutdouwnIt = shutdouwnIt;
+    }
+
+    public String getShutdouwnIt()
+    {
+        return shutdouwnIt;
+    }
+    public void setShutdouwnIth(String shutdouwnIth)
+    {
+        this.shutdouwnIth = shutdouwnIth;
+    }
+
+    public String getShutdouwnIth()
+    {
+        return shutdouwnIth;
+    }
+    public void setShutdouwnElt(String shutdouwnElt)
+    {
+        this.shutdouwnElt = shutdouwnElt;
+    }
+
+    public String getShutdouwnElt()
+    {
+        return shutdouwnElt;
+    }
+    public void setShutdouwnElth(String shutdouwnElth)
+    {
+        this.shutdouwnElth = shutdouwnElth;
+    }
+
+    public String getShutdouwnElth()
+    {
+        return shutdouwnElth;
+    }
+    public void setShutdouwnOt(String shutdouwnOt)
+    {
+        this.shutdouwnOt = shutdouwnOt;
+    }
+
+    public String getShutdouwnOt()
+    {
+        return shutdouwnOt;
+    }
+    public void setShutdouwnOth(String shutdouwnOth)
+    {
+        this.shutdouwnOth = shutdouwnOth;
+    }
+
+    public String getShutdouwnOth()
+    {
+        return shutdouwnOth;
+    }
+    public void setShutdouwnTt(String shutdouwnTt)
+    {
+        this.shutdouwnTt = shutdouwnTt;
+    }
+
+    public String getShutdouwnTt()
+    {
+        return shutdouwnTt;
+    }
+    public void setShutdouwnTh(String shutdouwnTh)
+    {
+        this.shutdouwnTh = shutdouwnTh;
+    }
+
+    public String getShutdouwnTh()
+    {
+        return shutdouwnTh;
+    }
 
     @Override
     public String toString() {
@@ -1740,6 +1896,18 @@ public class TMonthlyProductionReport extends BaseEntity
             .append("aromaticsEnergyTeTec", getAromaticsEnergyTeTec())
             .append("aromaticsEnergyEeKgeot", getAromaticsEnergyEeKgeot())
             .append("aromaticsEnergyEeKgect", getAromaticsEnergyEeKgect())
+            .append("shutdouwnOpt", getShutdouwnOpt())
+            .append("shutdouwnOph", getShutdouwnOph())
+            .append("shutdouwnEqt", getShutdouwnEqt())
+            .append("shutdouwnEqh", getShutdouwnEqh())
+            .append("shutdouwnIt", getShutdouwnIt())
+            .append("shutdouwnIth", getShutdouwnIth())
+            .append("shutdouwnElt", getShutdouwnElt())
+            .append("shutdouwnElth", getShutdouwnElth())
+            .append("shutdouwnOt", getShutdouwnOt())
+            .append("shutdouwnOth", getShutdouwnOth())
+            .append("shutdouwnTt", getShutdouwnTt())
+            .append("shutdouwnTh", getShutdouwnTh())
             .toString();
     }
 }

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

@@ -191,4 +191,9 @@ public interface ITMonthlyProductionReportService
      * 修改Aromatics Utility Consumption
      */
     public int updateAromaticsUtilityConsumption(MonthlyUpdateVO monthlyUpdateVO);
+
+    /**
+     * 修改Shoudown Hour
+     */
+    public int updateShoudownHour(MonthlyUpdateVO monthlyUpdateVO);
 }

+ 181 - 1
master/src/main/java/com/ruoyi/project/production/service/impl/TMonthlyProductionReportServiceImpl.java

@@ -1204,7 +1204,87 @@ public class TMonthlyProductionReportServiceImpl implements ITMonthlyProductionR
      */
     @Override
     public List<MonthlyProductionReportVO> selectShoudownHourByYear(Long year) {
-        return  null;
+        // 当前日期
+        Date currentDate = new Date();
+        // 当前年份
+        Long currentYear = Long.parseLong(currentDate.getYear() + 1900 + "");
+        // 当前月份
+        Long currentMonth = Long.parseLong(currentDate.getMonth() + 1 + "");
+        // 从数据库中查出的当前year的月报数据集合,每个元素对应当前year某个月的数据
+        List<TMonthlyProductionReport> tMonthlyProductionReports = tMonthlyProductionReportMapper.selectShoudownHourByYear(year);
+        // 前端月报数据集合,每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
+        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_opt", "operation time", "time"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_oph", "hour", "h"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_eqt", "equipment time", "time"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_eqh", "hour", "h"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_it", "instrument time", "time"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_ith", "hour", "h"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_elt", "electric time", "time"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_elth", "hour", "h"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_ot", "otherwise time", "time"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_oth", "hour", "h"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_tt", "total time", "time"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_th", "total hour", "h"));
+        // 遍历从数据库中查出的月报数据集合,结果为0~12条数据不等
+        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
+            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
+            String shutdouwnOpt = tMonthlyProductionReport.getShutdouwnOpt();
+            String shutdouwnOph = tMonthlyProductionReport.getShutdouwnOph();
+            String shutdouwnEqt = tMonthlyProductionReport.getShutdouwnEqt();
+            String shutdouwnEqh = tMonthlyProductionReport.getShutdouwnEqh();
+            String shutdouwnIt = tMonthlyProductionReport.getShutdouwnIt();
+            String shutdouwnIth = tMonthlyProductionReport.getShutdouwnIth();
+            String shutdouwnElt = tMonthlyProductionReport.getShutdouwnElt();
+            String shutdouwnElth = tMonthlyProductionReport.getShutdouwnElth();
+            String shutdouwnOt = tMonthlyProductionReport.getShutdouwnOt();
+            String shutdouwnOth = tMonthlyProductionReport.getShutdouwnOth();
+            String shutdouwnTt = tMonthlyProductionReport.getShutdouwnTt();
+            String shutdouwnTh = tMonthlyProductionReport.getShutdouwnTh();
+            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
+            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
+            // 前端数据集合的class
+            Class clazz = null;
+            // 当前元素调用的set方法
+            Method method = null;
+            try {
+                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
+                method = this.getSetMethod(reportMonth, clazz);
+                // 按照当前元素的所属月份调取相应set方法
+                method.invoke(monthlyProductionReportVOs.get(0), shutdouwnOpt);
+                method.invoke(monthlyProductionReportVOs.get(1), shutdouwnOph);
+                method.invoke(monthlyProductionReportVOs.get(2), shutdouwnEqt);
+                method.invoke(monthlyProductionReportVOs.get(3), shutdouwnEqh);
+                method.invoke(monthlyProductionReportVOs.get(4), shutdouwnIt);
+                method.invoke(monthlyProductionReportVOs.get(5), shutdouwnIth);
+                method.invoke(monthlyProductionReportVOs.get(6), shutdouwnElt);
+                method.invoke(monthlyProductionReportVOs.get(7), shutdouwnElth);
+                method.invoke(monthlyProductionReportVOs.get(8), shutdouwnOt);
+                method.invoke(monthlyProductionReportVOs.get(9), shutdouwnOth);
+                method.invoke(monthlyProductionReportVOs.get(10), shutdouwnTt);
+                method.invoke(monthlyProductionReportVOs.get(11), shutdouwnTh);
+                // 当前年份=所属年份,当前月份=所属月份
+                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
+                    monthlyProductionReportVOs.get(0).setCurrently(shutdouwnOpt);
+                    monthlyProductionReportVOs.get(1).setCurrently(shutdouwnOph);
+                    monthlyProductionReportVOs.get(2).setCurrently(shutdouwnEqt);
+                    monthlyProductionReportVOs.get(3).setCurrently(shutdouwnEqh);
+                    monthlyProductionReportVOs.get(4).setCurrently(shutdouwnIt);
+                    monthlyProductionReportVOs.get(5).setCurrently(shutdouwnIth);
+                    monthlyProductionReportVOs.get(6).setCurrently(shutdouwnElt);
+                    monthlyProductionReportVOs.get(7).setCurrently(shutdouwnElth);
+                    monthlyProductionReportVOs.get(8).setCurrently(shutdouwnOt);
+                    monthlyProductionReportVOs.get(9).setCurrently(shutdouwnOth);
+                    monthlyProductionReportVOs.get(10).setCurrently(shutdouwnTt);
+                    monthlyProductionReportVOs.get(11).setCurrently(shutdouwnTh);
+
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        this.calcTotal(monthlyProductionReportVOs);
+        return monthlyProductionReportVOs;
     }
 
     /**
@@ -1579,4 +1659,104 @@ public class TMonthlyProductionReportServiceImpl implements ITMonthlyProductionR
         }
         return affectedRows;
     }
+
+    /**
+     * 修改Shoudown Hour
+     */
+    @Override
+    public int updateShoudownHour(MonthlyUpdateVO monthlyUpdateVO) {
+        // 受影响行数
+        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);
+                Method getMethod = null;
+                String monthValue = null;
+                try {
+                    if (i == 0) { getMethod =  clazz.getDeclaredMethod("getJan"); }
+                    if (i == 1) { getMethod =  clazz.getDeclaredMethod("getFeb"); }
+                    if (i == 2) { getMethod =  clazz.getDeclaredMethod("getMar"); }
+                    if (i == 3) { getMethod =  clazz.getDeclaredMethod("getApr"); }
+                    if (i == 4) { getMethod =  clazz.getDeclaredMethod("getMay"); }
+                    if (i == 5) { getMethod =  clazz.getDeclaredMethod("getJun"); }
+                    if (i == 6) { getMethod =  clazz.getDeclaredMethod("getJul"); }
+                    if (i == 7) { getMethod =  clazz.getDeclaredMethod("getAug"); }
+                    if (i == 8) { getMethod =  clazz.getDeclaredMethod("getSep"); }
+                    if (i == 9) { getMethod =  clazz.getDeclaredMethod("getOct"); }
+                    if (i == 10) { getMethod =  clazz.getDeclaredMethod("getNov"); }
+                    if (i == 11) { getMethod =  clazz.getDeclaredMethod("getDec"); }
+                    monthValue = (String) getMethod.invoke(tableDatum);
+                } catch (NoSuchMethodException e1){
+                    e1.printStackTrace();
+                } catch (IllegalAccessException e2) {
+                    e2.printStackTrace();
+                } catch (InvocationTargetException e3) {
+                    e3.printStackTrace();
+                }
+                if (monthValue == null) {
+                    continue;
+                }
+                if ("shutdouwn_opt".equals(tableDatum.getDictLabel())) {
+                    report.setShutdouwnOpt(monthValue);
+                }
+                if ("shutdouwn_oph".equals(tableDatum.getDictLabel())) {
+                    report.setShutdouwnOph(monthValue);
+                }
+                if ("shutdouwn_eqt".equals(tableDatum.getDictLabel())) {
+                    report.setShutdouwnEqt(monthValue);
+                }
+                if ("shutdouwn_eqh".equals(tableDatum.getDictLabel())) {
+                    report.setShutdouwnEqh(monthValue);
+                }
+                if ("shutdouwn_it".equals(tableDatum.getDictLabel())) {
+                    report.setShutdouwnIt(monthValue);
+                }
+                if ("shutdouwn_ith".equals(tableDatum.getDictLabel())) {
+                    report.setShutdouwnIth(monthValue);
+                }
+                if ("shutdouwn_elt".equals(tableDatum.getDictLabel())) {
+                    report.setShutdouwnElt(monthValue);
+                }
+                if ("shutdouwn_elth".equals(tableDatum.getDictLabel())) {
+                    report.setShutdouwnElth(monthValue);
+                }
+                if ("shutdouwn_ot".equals(tableDatum.getDictLabel())) {
+                    report.setShutdouwnOt(monthValue);
+                }
+                if ("shutdouwn_oth".equals(tableDatum.getDictLabel())) {
+                    report.setShutdouwnOth(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
+                );
+                thread.run();
+            }
+        }
+        return affectedRows;
+
+    }
 }

+ 59 - 18
master/src/main/java/com/ruoyi/project/production/service/impl/thread/SyncAfterMonthlyUpdateThread.java

@@ -47,23 +47,38 @@ public class SyncAfterMonthlyUpdateThread extends Thread {
         TMonthlyProductionReport report = tMonthlyProductionReportMapper
                 .selectTMonthlyProductionReportByDate(this.reportYear, this.reportMonth);
 
-        BigDecimal ethylenProduced = new BigDecimal(report.getEthylenProduced());
-        BigDecimal fuelGasOffgasCracker  = new BigDecimal(report.getFuelGasOffgasCracker());
-        BigDecimal shpCracker = new BigDecimal(report.getShpCracker());
-        BigDecimal hpCracker = new BigDecimal(report.getHpCracker());
-        BigDecimal mpCracker = new BigDecimal(report.getMpCracker());
-        BigDecimal lpCracker = new BigDecimal(report.getLpCracker());
-        BigDecimal electricityCracker = new BigDecimal(report.getElectricityCracker());
-        BigDecimal coolingWaterCracker = new BigDecimal(report.getCoolingWaterCracker());
-        BigDecimal n2Cracker = new BigDecimal(report.getN2Cracker());
-        BigDecimal hpBfwCracker = new BigDecimal(report.getHpBfwCracker());
-        BigDecimal polishedConCracker = new BigDecimal(report.getPolishedConCracker());
-        BigDecimal turbineConCracker = new BigDecimal(report.getTurbineConCracker());
-        BigDecimal crackerConsumptionIa = new BigDecimal(report.getCrackerConsumptionIa());
-        BigDecimal paIaCracker = new BigDecimal(report.getPaIaCracker());
-        BigDecimal crackerConsumptionPw = new BigDecimal(report.getCrackerConsumptionPw());
-        BigDecimal prodWaterCracker = new BigDecimal(report.getProdWaterCracker());
-
+        String ethylenProducedStr = report.getEthylenProduced();
+        String fuelGasOffgasCrackerStr = report.getFuelGasOffgasCracker();
+        String shpCrackerStr = report.getShpCracker();
+        String hpCrackerStr = report.getHpCracker();
+        String mpCrackerStr = report.getMpCracker();
+        String lpCrackerStr = report.getLpCracker();
+        String electricityCrackerStr = report.getElectricityCracker();
+        String coolingWaterCrackerStr = report.getCoolingWaterCracker();
+        String n2CrackerStr = report.getN2Cracker();
+        String hpBfwCrackerStr = report.getHpBfwCracker();
+        String polishedConCrackerStr = report.getPolishedConCracker();
+        String turbineConCrackerStr = report.getTurbineConCracker();
+        String crackerConsumptionIaStr = report.getCrackerConsumptionIa();
+        String paIaCrackerStr = report.getPaIaCracker();
+        String crackerConsumptionPwStr = report.getCrackerConsumptionPw();
+        String prodWaterCrackerStr = report.getProdWaterCracker();
+        BigDecimal ethylenProduced = new BigDecimal(ethylenProducedStr == null ? "0" : ethylenProducedStr);
+        BigDecimal fuelGasOffgasCracker = new BigDecimal(fuelGasOffgasCrackerStr == null ? "0" : fuelGasOffgasCrackerStr);
+        BigDecimal shpCracker = new BigDecimal(shpCrackerStr == null ? "0" : shpCrackerStr);
+        BigDecimal hpCracker = new BigDecimal(hpCrackerStr == null ? "0" : hpCrackerStr);
+        BigDecimal mpCracker = new BigDecimal(mpCrackerStr == null ? "0" : mpCrackerStr);
+        BigDecimal lpCracker = new BigDecimal(lpCrackerStr == null ? "0" : lpCrackerStr);
+        BigDecimal electricityCracker = new BigDecimal(electricityCrackerStr == null ? "0" : electricityCrackerStr);
+        BigDecimal coolingWaterCracker = new BigDecimal(coolingWaterCrackerStr == null ? "0" : coolingWaterCrackerStr);
+        BigDecimal n2Cracker = new BigDecimal(n2CrackerStr == null ? "0" : n2CrackerStr);
+        BigDecimal hpBfwCracker = new BigDecimal(hpBfwCrackerStr == null ? "0" : hpBfwCrackerStr);
+        BigDecimal polishedConCracker = new BigDecimal(polishedConCrackerStr == null ? "0" : polishedConCrackerStr);
+        BigDecimal turbineConCracker = new BigDecimal(turbineConCrackerStr == null ? "0" : turbineConCrackerStr);
+        BigDecimal crackerConsumptionIa = new BigDecimal(crackerConsumptionIaStr == null ? "0" : crackerConsumptionIaStr);
+        BigDecimal paIaCracker = new BigDecimal(paIaCrackerStr == null ? "0" : paIaCrackerStr);
+        BigDecimal crackerConsumptionPw = new BigDecimal(crackerConsumptionPwStr == null ? "0" : crackerConsumptionPwStr);
+        BigDecimal prodWaterCracker = new BigDecimal(prodWaterCrackerStr == null ? "0" : prodWaterCrackerStr);
         BigDecimal crackerEnergyTeTeo = new BigDecimal("0");
         crackerEnergyTeTeo = (fuelGasOffgasCracker.multiply(new BigDecimal("1.2")))
                 .add(shpCracker.multiply(new BigDecimal("0.092")))
@@ -91,12 +106,38 @@ public class SyncAfterMonthlyUpdateThread extends Thread {
             crackerEnergyEeKgect = crackerEnergyTeTec.divide(ethylenProduced, 2, RoundingMode.HALF_UP)
                     .multiply(new BigDecimal("1000"));
         }
-
         report.setCrackerEnergyTeTeo(crackerEnergyTeTeo.toString());
         report.setCrackerEnergyTeTec(crackerEnergyTeTec.toString());
         report.setCrackerEnergyEeKgeot(crackerEnergyEeKgeot.toString());
         report.setCrackerEnergyEeKgect(crackerEnergyEeKgect.toString());
 
+        String shutdouwnOptStr = report.getShutdouwnOpt();
+        String shutdouwnOphStr = report.getShutdouwnOph();
+        String shutdouwnEqtStr = report.getShutdouwnEqt();
+        String shutdouwnEqhStr = report.getShutdouwnEqh();
+        String shutdouwnItStr = report.getShutdouwnIt();
+        String shutdouwnIthStr = report.getShutdouwnIth();
+        String shutdouwnEltStr = report.getShutdouwnElt();
+        String shutdouwnElthStr = report.getShutdouwnElth();
+        String shutdouwnOtStr = report.getShutdouwnOt();
+        String shutdouwnOthStr = report.getShutdouwnOth();
+        BigDecimal shutdouwnOpt = new BigDecimal(shutdouwnOptStr == null ? "0" : shutdouwnOptStr);
+        BigDecimal shutdouwnOph = new BigDecimal(shutdouwnOphStr == null ? "0" : shutdouwnOphStr);
+        BigDecimal shutdouwnEqt = new BigDecimal(shutdouwnEqtStr == null ? "0" : shutdouwnEqtStr);
+        BigDecimal shutdouwnEqh = new BigDecimal(shutdouwnEqhStr == null ? "0" : shutdouwnEqhStr);
+        BigDecimal shutdouwnIt = new BigDecimal(shutdouwnItStr == null ? "0" : shutdouwnItStr);
+        BigDecimal shutdouwnIth = new BigDecimal(shutdouwnIthStr == null ? "0" : shutdouwnIthStr);
+        BigDecimal shutdouwnElt = new BigDecimal(shutdouwnEltStr == null ? "0" : shutdouwnEltStr);
+        BigDecimal shutdouwnElth = new BigDecimal(shutdouwnElthStr == null ? "0" : shutdouwnElthStr);
+        BigDecimal shutdouwnOt = new BigDecimal(shutdouwnOtStr == null ? "0" : shutdouwnOtStr);
+        BigDecimal shutdouwnOth = new BigDecimal(shutdouwnOthStr == null ? "0" : shutdouwnOthStr);
+        BigDecimal shutdouwnTt = new BigDecimal("0");
+        BigDecimal shutdouwnTh = new BigDecimal("0");
+        shutdouwnTt = shutdouwnOpt.add(shutdouwnEqt).add(shutdouwnIt).add(shutdouwnElt).add(shutdouwnOt);
+        shutdouwnTh = shutdouwnOph.add(shutdouwnEqh).add(shutdouwnIth).add(shutdouwnElth).add(shutdouwnOth);
+        report.setShutdouwnTt(shutdouwnTt.toString());
+        report.setShutdouwnTh(shutdouwnTh.toString());
+
         tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
 
     }

+ 57 - 1
master/src/main/resources/mybatis/production/TMonthlyProductionReportMapper.xml

@@ -128,6 +128,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="aromaticsEnergyTeTec"     column="aromatics_energy_te_tec"    />
         <result property="aromaticsEnergyEeKgeot"   column="aromatics_energy_ee_kgeot"    />
         <result property="aromaticsEnergyEeKgect"   column="aromatics_energy_ee_kgect"    />
+        <result property="shutdouwnOpt"             column="shutdouwn_opt"    />
+        <result property="shutdouwnOph"             column="shutdouwn_oph"    />
+        <result property="shutdouwnEqt"             column="shutdouwn_eqt"    />
+        <result property="shutdouwnEqh"             column="shutdouwn_eqh"    />
+        <result property="shutdouwnIt"              column="shutdouwn_it"    />
+        <result property="shutdouwnIth"             column="shutdouwn_ith"    />
+        <result property="shutdouwnElt"             column="shutdouwn_elt"    />
+        <result property="shutdouwnElth"            column="shutdouwn_elth"    />
+        <result property="shutdouwnOt"              column="shutdouwn_ot"    />
+        <result property="shutdouwnOth"             column="shutdouwn_oth"    />
+        <result property="shutdouwnTt"              column="shutdouwn_tt"    />
+        <result property="shutdouwnTh"              column="shutdouwn_th"    />
     </resultMap>
 
     <select id="selectCrackerRawMaterialByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult">
@@ -237,7 +249,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectRuningRateByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult"></select>
 
-    <select id="selectShoudownHourByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult"></select>
+    <select id="selectShoudownHourByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult">
+        select
+               d.id, d.report_month, d.report_year,
+               d.shutdouwn_opt, d.shutdouwn_oph, d.shutdouwn_eqt, d.shutdouwn_eqh, d.shutdouwn_it, d.shutdouwn_ith,
+               d.shutdouwn_elt, d.shutdouwn_elth, d.shutdouwn_ot, d.shutdouwn_oth, d.shutdouwn_tt, d.shutdouwn_th
+        from
+             t_monthly_production_report d
+        where d.report_year = #{year}
+    </select>
 
     <select id="selectOthersideByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult">
         select
@@ -401,6 +421,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="aromaticsEnergyTeTec != null">aromatics_energy_te_tec,</if>
             <if test="aromaticsEnergyEeKgeot != null">aromatics_energy_ee_kgeot,</if>
             <if test="aromaticsEnergyEeKgect != null">aromatics_energy_ee_kgect,</if>
+            <if test="shutdouwnOpt != null">shutdouwn_opt,</if>
+            <if test="shutdouwnOph != null">shutdouwn_oph,</if>
+            <if test="shutdouwnEqt != null">shutdouwn_eqt,</if>
+            <if test="shutdouwnEqh != null">shutdouwn_eqh,</if>
+            <if test="shutdouwnIt != null">shutdouwn_it,</if>
+            <if test="shutdouwnIth != null">shutdouwn_ith,</if>
+            <if test="shutdouwnElt != null">shutdouwn_elt,</if>
+            <if test="shutdouwnElth != null">shutdouwn_elth,</if>
+            <if test="shutdouwnOt != null">shutdouwn_ot,</if>
+            <if test="shutdouwnOth != null">shutdouwn_oth,</if>
+            <if test="shutdouwnTt != null">shutdouwn_tt,</if>
+            <if test="shutdouwnTh != null">shutdouwn_th,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -526,6 +558,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="aromaticsEnergyTeTec != null">#{aromaticsEnergyTeTec},</if>
             <if test="aromaticsEnergyEeKgeot != null">#{aromaticsEnergyEeKgeot},</if>
             <if test="aromaticsEnergyEeKgect != null">#{aromaticsEnergyEeKgect},</if>
+            <if test="shutdouwnOpt != null">#{shutdouwnOpt},</if>
+            <if test="shutdouwnOph != null">#{shutdouwnOph},</if>
+            <if test="shutdouwnEqt != null">#{shutdouwnEqt},</if>
+            <if test="shutdouwnEqh != null">#{shutdouwnEqh},</if>
+            <if test="shutdouwnIt != null">#{shutdouwnIt},</if>
+            <if test="shutdouwnIth != null">#{shutdouwnIth},</if>
+            <if test="shutdouwnElt != null">#{shutdouwnElt},</if>
+            <if test="shutdouwnElth != null">#{shutdouwnElth},</if>
+            <if test="shutdouwnOt != null">#{shutdouwnOt},</if>
+            <if test="shutdouwnOth != null">#{shutdouwnOth},</if>
+            <if test="shutdouwnTt != null">#{shutdouwnTt},</if>
+            <if test="shutdouwnTh != null">#{shutdouwnTh},</if>
         </trim>
     </insert>
 
@@ -652,6 +696,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="aromaticsEnergyTeTec != null">aromatics_energy_te_tec = #{aromaticsEnergyTeTec},</if>
             <if test="aromaticsEnergyEeKgeot != null">aromatics_energy_ee_kgeot = #{aromaticsEnergyEeKgeot},</if>
             <if test="aromaticsEnergyEeKgect != null">aromatics_energy_ee_kgect = #{aromaticsEnergyEeKgect},</if>
+            <if test="shutdouwnOpt != null">shutdouwn_opt = #{shutdouwnOpt},</if>
+            <if test="shutdouwnOph != null">shutdouwn_oph = #{shutdouwnOph},</if>
+            <if test="shutdouwnEqt != null">shutdouwn_eqt = #{shutdouwnEqt},</if>
+            <if test="shutdouwnEqh != null">shutdouwn_eqh = #{shutdouwnEqh},</if>
+            <if test="shutdouwnIt != null">shutdouwn_it = #{shutdouwnIt},</if>
+            <if test="shutdouwnIth != null">shutdouwn_ith = #{shutdouwnIth},</if>
+            <if test="shutdouwnElt != null">shutdouwn_elt = #{shutdouwnElt},</if>
+            <if test="shutdouwnElth != null">shutdouwn_elth = #{shutdouwnElth},</if>
+            <if test="shutdouwnOt != null">shutdouwn_ot = #{shutdouwnOt},</if>
+            <if test="shutdouwnOth != null">shutdouwn_oth = #{shutdouwnOth},</if>
+            <if test="shutdouwnTt != null">shutdouwn_tt = #{shutdouwnTt},</if>
+            <if test="shutdouwnTh != null">shutdouwn_th = #{shutdouwnTh},</if>
         </trim>
         where report_month = #{reportMonth} and report_year = #{reportYear}
     </update>

+ 9 - 0
ui/src/api/production/monthly.js

@@ -1,5 +1,14 @@
 import request from '@/utils/request'
 
+// 修改Shoudown Hour
+export function updateShoudownHour(data) {
+  return request({
+    url: '/production/monthly/shoudownHour',
+    method: 'put',
+    data: data
+  })
+}
+
 // 修改Aromatics Utility Consumption
 export function updateAromaticsUtilityConsumption(data) {
   return request({

+ 202 - 30
ui/src/views/production/monthly/index.vue

@@ -1190,6 +1190,32 @@
       </el-table-column>
     </el-table>
     <!-- Shoudown Hour -->
+    <div class="editDiv">
+      <el-button
+        :disabled="shoudownHourUpdating"
+        type="primary"
+        icon="el-icon-edit"
+        size="mini"
+        @click="handleShoudownHourUpdate"
+        v-hasPermi="['production:monthly:edit']"
+      >{{ $t('编辑Shoudown Hour') }}</el-button>
+      <el-button
+        :disabled="!shoudownHourUpdating"
+        type="success"
+        icon="el-icon-check"
+        size="mini"
+        @click="handleConfirmShoudownHourUpdate"
+        v-hasPermi="['production:monthly:edit']"
+      >{{ $t('保存') }}</el-button>
+      <el-button
+        :disabled="!shoudownHourUpdating"
+        type="info"
+        icon="el-icon-close"
+        size="mini"
+        @click="handleCancelShoudownHourUpdate"
+        v-hasPermi="['production:monthly:edit']"
+      >{{ $t('取消') }}</el-button>
+    </div>
     <el-table border :data="tableShoudownHour" style="width: 100%;">
       <el-table-column label="Shoudown Hour">
         <el-table-column width="150" prop="title" label="">
@@ -1199,18 +1225,138 @@
         </el-table-column>
         <el-table-column prop="unit" label="unit"></el-table-column>
         <el-table-column prop="currently" label="currently"></el-table-column>
-        <el-table-column prop="jan" :label="this.monthList[0]"></el-table-column>
-        <el-table-column prop="feb" :label="this.monthList[1]"></el-table-column>
-        <el-table-column prop="mar" :label="this.monthList[2]"></el-table-column>
-        <el-table-column prop="apr" :label="this.monthList[3]"></el-table-column>
-        <el-table-column prop="may" :label="this.monthList[4]"></el-table-column>
-        <el-table-column prop="jun" :label="this.monthList[5]"></el-table-column>
-        <el-table-column prop="jul" :label="this.monthList[6]"></el-table-column>
-        <el-table-column prop="aug" :label="this.monthList[7]"></el-table-column>
-        <el-table-column prop="sep" :label="this.monthList[8]"></el-table-column>
-        <el-table-column prop="oct" :label="this.monthList[9]"></el-table-column>
-        <el-table-column prop="nov" :label="this.monthList[10]"></el-table-column>
-        <el-table-column prop="dec" :label="this.monthList[11]"></el-table-column>
+        <el-table-column prop="jan" :label="this.monthList[0]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.jan}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.jan" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.jan}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="feb" :label="this.monthList[1]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.feb}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.feb" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.feb}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="mar" :label="this.monthList[2]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.mar}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.mar" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.mar}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="apr" :label="this.monthList[3]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.apr}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.apr" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.apr}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="may" :label="this.monthList[4]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.may}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.may" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.may}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="jun" :label="this.monthList[5]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.jun}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.jun" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.jun}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="jul" :label="this.monthList[6]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.jul}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.jul" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.jul}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="aug" :label="this.monthList[7]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.aug}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.aug" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.aug}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="sep" :label="this.monthList[8]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.sep}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.sep" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.sep}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="oct" :label="this.monthList[9]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.oct}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.oct" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.oct}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="nov" :label="this.monthList[10]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.nov}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.nov" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.nov}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="dec" :label="this.monthList[11]">
+          <template slot-scope="{row}">
+            <div v-if="!shoudownHourUpdating">{{row.dec}}</div>
+            <div v-if="shoudownHourUpdating && (row.title != 'total time' && row.title != 'total hour')">
+              <el-input v-model="row.dec" clearable="true"></el-input>
+            </div>
+            <div v-if="shoudownHourUpdating && (row.title == 'total time' || row.title == 'total hour')">
+              {{row.dec}}
+            </div>
+          </template>
+        </el-table-column>
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
@@ -1430,13 +1576,16 @@ import {
   getSummary,
   updateEligibleProductRate,
   updateCrackerUtilityConsumption,
-  updateAromaticsUtilityConsumption
+  updateAromaticsUtilityConsumption,
+  updateShoudownHour
 } from "@/api/production/monthly";
 
 export default {
   name: "Monthly",
   data() {
     return {
+      // Shoudown Hour修改中
+      shoudownHourUpdating: false,
       // Aromatics Utility Consumption修改中
       aromaticsUtilityConsumptionUpdating: false,
       // Cracker Utility Consumption修改中
@@ -1510,20 +1659,7 @@ export default {
         {title: "run rate"},
         {title: "calendar hour"},
       ],
-      tableShoudownHour: [
-        {title: "operation time"},
-        {title: "hour"},
-        {title: "equipment time"},
-        {title: "hour"},
-        {title: "instrument time"},
-        {title: "hour"},
-        {title: "electric time"},
-        {title: "hour"},
-        {title: "otherwise time"},
-        {title: "hour"},
-        {title: "total time"},
-        {title: "total hour"},
-      ],
+      tableShoudownHour: [],
       tableOtherside: [],
       tableChemicalConsume: [
         {title: "Cracker and PGU"},
@@ -1669,6 +1805,9 @@ export default {
   },
   methods: {
     /** 编辑按钮操作 */
+    handleShoudownHourUpdate(row) {
+      this.shoudownHourUpdating = true;
+    },
     handleAromaticsUtilityConsumptionUpdate(row) {
       this.aromaticsUtilityConsumptionUpdating = true;
     },
@@ -1679,6 +1818,33 @@ export default {
       this.eligibleProductRateUpdating = true;
     },
     /** 确定修改按钮操作 */
+    handleConfirmShoudownHourUpdate(row) {
+      this.shoudownHourUpdating = false;
+      updateShoudownHour({
+        tableData: [
+          this.tableShoudownHour[0],
+          this.tableShoudownHour[1],
+          this.tableShoudownHour[2],
+          this.tableShoudownHour[3],
+          this.tableShoudownHour[4],
+          this.tableShoudownHour[5],
+          this.tableShoudownHour[6],
+          this.tableShoudownHour[7],
+          this.tableShoudownHour[8],
+          this.tableShoudownHour[9],
+        ],
+        year: this.year.getFullYear()
+      }).then(response => {
+        if (response.code == 200) {
+          this.$message.success("修改成功");
+        } else {
+          this.$message.error("未知错误,请联系管理员。");
+        }
+        getShoudownHour(year).then(response => {
+          this.tableShoudownHour = response.data;
+        });
+      });
+    },
     handleConfirmAromaticsUtilityConsumptionUpdate(row) {
       this.aromaticsUtilityConsumptionUpdating = false;
       updateAromaticsUtilityConsumption({
@@ -1745,6 +1911,12 @@ export default {
       });
     },
     /** 取消修改按钮操作 */
+    handleCancelShoudownHourUpdate(row) {
+      this.shoudownHourUpdating = false;
+      getShoudownHour(year).then(response => {
+        this.shoudownHourUpdating = response.data;
+      });
+    },
     handleCancelAromaticsUtilityConsumptionUpdate(row) {
       this.aromaticsUtilityConsumptionUpdating = false;
       getAromaticsUtilityConsumption(year).then(response => {
@@ -1939,9 +2111,9 @@ export default {
       // getRuningRate(year).then(response => {
       //   this.tableRuningRate = response.data;
       // });
-      // getShoudownHour(year).then(response => {
-      //   this.tableShoudownHour = response.data;
-      // });
+      getShoudownHour(year).then(response => {
+        this.tableShoudownHour = response.data;
+      });
       getOtherside(year).then(response => {
         this.tableOtherside = response.data;
       });