Explorar o código

王子文 月报 Eligible Product Rate查询

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

+ 55 - 13
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-08
+ * @date 2022-11-10
  */
 public class TMonthlyProductionReport extends BaseEntity
 {
@@ -290,30 +290,42 @@ public class TMonthlyProductionReport extends BaseEntity
     @Excel(name = "Product Yield C9")
     private String c9Yield;
 
-    /** EU loss */
-    @Excel(name = "EU loss")
+    /** Otherside EU loss */
+    @Excel(name = "Otherside EU loss")
     private String euLoss;
 
-    /** EU loss rate */
-    @Excel(name = "EU loss rate")
+    /** Otherside EU loss rate */
+    @Excel(name = "Otherside EU loss rate")
     private String euLossRate;
 
-    /** AEU loss */
-    @Excel(name = "AEU loss")
+    /** Otherside AEU loss */
+    @Excel(name = "Otherside AEU loss")
     private String aeuLoss;
 
-    /** AEU loss rate */
-    @Excel(name = "AEU loss rate")
+    /** Otherside AEU loss rate */
+    @Excel(name = "Otherside AEU loss rate")
     private String aeuLossRate;
 
-    /** Total loss */
-    @Excel(name = "Total loss")
+    /** Otherside Total loss */
+    @Excel(name = "Otherside Total loss")
     private String totalLoss;
 
-    /** Total loss rate */
-    @Excel(name = "Total loss rate")
+    /** Otherside Total loss rate */
+    @Excel(name = "Otherside Total loss rate")
     private String totalLossRate;
 
+    /** Eligible Product Rate C= */
+    @Excel(name = "Eligible Product Rate C=")
+    private String c2ProductRate;
+
+    /** Eligible Product Rate C= */
+    @Excel(name = "Eligible Product Rate C=")
+    private String c3ProductRate;
+
+    /** Eligible Product Rate C4s */
+    @Excel(name = "Eligible Product Rate C4s")
+    private String c4sProductRate;
+
     public void setId(Long id)
     {
         this.id = id;
@@ -989,6 +1001,33 @@ public class TMonthlyProductionReport extends BaseEntity
     {
         return totalLossRate;
     }
+    public void setC2ProductRate(String c2ProductRate)
+    {
+        this.c2ProductRate = c2ProductRate;
+    }
+
+    public String getC2ProductRate()
+    {
+        return c2ProductRate;
+    }
+    public void setC3ProductRate(String c3ProductRate)
+    {
+        this.c3ProductRate = c3ProductRate;
+    }
+
+    public String getC3ProductRate()
+    {
+        return c3ProductRate;
+    }
+    public void setC4sProductRate(String c4sProductRate)
+    {
+        this.c4sProductRate = c4sProductRate;
+    }
+
+    public String getC4sProductRate()
+    {
+        return c4sProductRate;
+    }
 
     @Override
     public String toString() {
@@ -1068,6 +1107,9 @@ public class TMonthlyProductionReport extends BaseEntity
             .append("aeuLossRate", getAeuLossRate())
             .append("totalLoss", getTotalLoss())
             .append("totalLossRate", getTotalLossRate())
+            .append("c2ProductRate", getC2ProductRate())
+            .append("c3ProductRate", getC3ProductRate())
+            .append("c4sProductRate", getC4sProductRate())
             .toString();
     }
 }

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

@@ -666,7 +666,50 @@ public class TMonthlyProductionReportServiceImpl implements ITMonthlyProductionR
      */
     @Override
     public List<MonthlyProductionReportVO> selectEligibleProductRateByYear(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.selectEligibleProductRateByYear(year);
+        // 前端月报数据集合,每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
+        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c2_product_rate","C2=","%"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c3_product_rate","C3=","%"));
+        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c4s_product_rate","C4's","%"));
+        // 遍历从数据库中查出的月报数据集合,结果为0~12条数据不等
+        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
+            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
+            String c2ProductRate = tMonthlyProductionReport.getC2ProductRate();
+            String c3ProductRate = tMonthlyProductionReport.getC3ProductRate();
+            String c4sProductRate = tMonthlyProductionReport.getC4sProductRate();
+            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), c2ProductRate);
+                method.invoke(monthlyProductionReportVOs.get(1), c3ProductRate);
+                method.invoke(monthlyProductionReportVOs.get(2), c4sProductRate);
+                // 当前年份=所属年份,当前月份=所属月份
+                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
+                    monthlyProductionReportVOs.get(0).setCurrently(c2ProductRate);
+                    monthlyProductionReportVOs.get(1).setCurrently(c3ProductRate);
+                    monthlyProductionReportVOs.get(2).setCurrently(c4sProductRate);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        this.calcAvg(monthlyProductionReportVOs);
+        return monthlyProductionReportVOs;
     }
 
     /**

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

@@ -80,6 +80,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="aeuLossRate"              column="aeu_loss_rate"    />
         <result property="totalLoss"                column="total_loss"    />
         <result property="totalLossRate"            column="total_loss_rate"    />
+        <result property="c2ProductRate"            column="c2_product_rate"    />
+        <result property="c3ProductRate"            column="c3_product_rate"    />
+        <result property="c4sProductRate"           column="c4s_product_rate"    />
     </resultMap>
 
     <select id="selectCrackerRawMaterialByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult">
@@ -118,7 +121,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
              t_monthly_production_report d
         where d.report_year = #{year}
     </select>
-    <select id="selectEligibleProductRateByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult"></select>
     <select id="selectProductYieldByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult">
         select
                d.id, d.report_month, d.report_year,
@@ -130,6 +132,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
              t_monthly_production_report d
         where d.report_year = #{year}
     </select>
+    <select id="selectEligibleProductRateByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult">
+        select
+               d.id, d.report_month, d.report_year, d.c2_product_rate, d.c3_product_rate, d.c4s_product_rate
+        from
+             t_monthly_production_report d
+        where d.report_year = #{year}
+    </select>
     <select id="selectCrackerUtilityConsumptionByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult"></select>
     <select id="selectCrackerEnergyConsumptionByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult"></select>
     <select id="selectAromaticsUtilityConsumptionByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult"></select>
@@ -240,6 +249,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="aeuLossRate != null">aeu_loss_rate,</if>
             <if test="totalLoss != null">total_loss,</if>
             <if test="totalLossRate != null">total_loss_rate,</if>
+            <if test="c2ProductRate != null">c2_product_rate,</if>
+            <if test="c3ProductRate != null">c3_product_rate,</if>
+            <if test="c4sProductRate != null">c4s_product_rate,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -317,6 +329,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="aeuLossRate != null">#{aeuLossRate},</if>
             <if test="totalLoss != null">#{totalLoss},</if>
             <if test="totalLossRate != null">#{totalLossRate},</if>
+            <if test="c2ProductRate != null">#{c2ProductRate},</if>
+            <if test="c3ProductRate != null">#{c3ProductRate},</if>
+            <if test="c4sProductRate != null">#{c4sProductRate},</if>
         </trim>
     </insert>
 
@@ -395,6 +410,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="aeuLossRate != null">aeu_loss_rate = #{aeuLossRate},</if>
             <if test="totalLoss != null">total_loss = #{totalLoss},</if>
             <if test="totalLossRate != null">total_loss_rate = #{totalLossRate},</if>
+            <if test="c2ProductRate != null">c2_product_rate = #{c2ProductRate},</if>
+            <if test="c3ProductRate != null">c3_product_rate = #{c3ProductRate},</if>
+            <if test="c4sProductRate != null">c4s_product_rate = #{c4sProductRate},</if>
         </trim>
         where report_month = #{reportMonth} and report_year = #{reportYear}
     </update>

+ 92 - 12
ui/src/views/production/monthly/index.vue

@@ -1,5 +1,6 @@
 <template>
   <div class="app-container" style="overflow-x: auto;">
+    <!-- 操作栏 -->
     <el-form :inline="true" label-width="68px">
       <el-form-item label="报告年份" prop="reportDate">
         <el-date-picker
@@ -10,18 +11,26 @@
           style="width: 200px"
           type="year"
           placeholder="选择报告年份"
-        >
-        </el-date-picker>
+        ></el-date-picker>
       </el-form-item>
       <el-form-item>
         <el-button
-        type="warning"
-        icon="el-icon-download"
-        size="mini"
-        v-hasPermi="['production:monthly:export']"
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          v-hasPermi="['production:monthly:export']"
         >导出</el-button>
-        </el-form-item>
+      </el-form-item>
+      <el-form-item>
+        <el-button
+          type="primary"
+          icon="el-icon-download"
+          size="mini"
+          v-hasPermi="['production:monthly:edit']"
+        >开工锅炉公用工程单价维护</el-button>
+      </el-form-item>
     </el-form>
+    <!-- Cracker Raw Material -->
     <el-table border :data="tableCrackerRawMaterial" style="width: 100%;">
       <el-table-column label="Cracker Raw Material">
         <el-table-column width="150" prop="title" label="">
@@ -46,6 +55,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Cracker Output Product -->
     <el-table border :data="tableCrackerOutputProduct" style="width: 100%;">
       <el-table-column label="Cracker Output Product">
         <el-table-column width="150" prop="title" label="">
@@ -70,6 +80,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Aromatics Raw Material -->
     <el-table border :data="tableAromaticsRawMaterial" style="width: 100%;">
       <el-table-column label="Aromatics Raw Material">
         <el-table-column width="150" prop="title" label="">
@@ -94,6 +105,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Aromatics Output Product -->
     <el-table border :data="tableAromaticsOutputProduct" style="width: 100%;">
       <el-table-column label="Aromatics Output Product">
         <el-table-column width="150" prop="title" label="">
@@ -118,6 +130,33 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Eligible Product Rate -->
+    <div class="editDiv">
+      <el-button
+        :disabled="eligibleProductRateUpdating"
+        type="primary"
+        icon="el-icon-edit"
+        size="mini"
+        @click="handleEligibleProductRateUpdate"
+        v-hasPermi="['production:monthly:edit']"
+      >{{ $t('编辑Eligible Product Rate') }}</el-button>
+      <el-button
+        :disabled="!eligibleProductRateUpdating"
+        type="success"
+        icon="el-icon-check"
+        size="mini"
+        @click="handleConfirmEligibleProductRateUpdate"
+        v-hasPermi="['production:monthly:edit']"
+      >{{ $t('保存') }}</el-button>
+      <el-button
+        :disabled="!eligibleProductRateUpdating"
+        type="info"
+        icon="el-icon-close"
+        size="mini"
+        @click="handleCancelEligibleProductRateUpdate"
+        v-hasPermi="['production:monthly:edit']"
+      >{{ $t('取消') }}</el-button>
+    </div>
     <el-table border :data="tableEligibleProductRate" style="width: 100%;">
       <el-table-column label="Eligible Product rate">
         <el-table-column width="150" prop="title" label="">
@@ -139,9 +178,10 @@
         <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="total" label="total"></el-table-column>
+        <el-table-column prop="avg" label="avg"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Product Yield -->
     <el-table border :data="tableProductYield" style="width: 100%;">
       <el-table-column label="Product yield">
         <el-table-column width="150" prop="title" label="">
@@ -166,6 +206,7 @@
         <el-table-column prop="avg" label="avg"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Cracker Utility Consumption -->
     <el-table border :data="tableCrackerUtilityConsumption" style="width: 100%;">
       <el-table-column label="Cracker Utility Consumption">
         <el-table-column width="150" prop="title" label="">
@@ -190,6 +231,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Cracker Energy Consumption -->
     <el-table border :data="tableCrackerEnergyConsumption" style="width: 100%;">
       <el-table-column label="Cracker Energy Consumption">
         <el-table-column width="150" prop="title" label="">
@@ -214,6 +256,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Aromatics Utility Consumption -->
     <el-table border :data="tableAromaticsUtilityConsumption" style="width: 100%;">
       <el-table-column label="Aromatics Utility Consumption">
         <el-table-column width="150" prop="title" label="">
@@ -238,6 +281,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Aromatics Energy Consumption -->
     <el-table border :data="tableAromaticsEnergyConsumption" style="width: 100%;">
       <el-table-column label="Cracker Aromatics Consumption">
         <el-table-column width="150" prop="title" label="">
@@ -262,6 +306,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Plant Load -->
     <el-table border :data="tablePlantLoad" style="width: 100%;">
       <el-table-column label="Plant load">
         <el-table-column width="150" prop="title" label="">
@@ -286,6 +331,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Cost Fr Ethylene -->
     <el-table border :data="tableCostFrEthylene" style="width: 100%;">
       <el-table-column label="Cost fr Ethylene">
         <el-table-column width="150" prop="title" label="">
@@ -310,6 +356,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Runing Rate -->
     <el-table border :data="tableRuningRate" style="width: 100%;">
       <el-table-column label="Runing Rate">
         <el-table-column width="150" prop="title" label="">
@@ -334,6 +381,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Shoudown Hour -->
     <el-table border :data="tableShoudownHour" style="width: 100%;">
       <el-table-column label="Shoudown Hour">
         <el-table-column width="150" prop="title" label="">
@@ -358,6 +406,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Otherside -->
     <el-table border :data="tableOtherside" style="width: 100%;">
       <el-table-column label="Otherside">
         <el-table-column width="150" prop="title" label="">
@@ -382,6 +431,7 @@
         <el-table-column prop="avg" label="avg"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- Chemical Consume -->
     <el-table border :data="tableChemicalConsume" style="width: 100%;">
       <el-table-column label="chemical consume">
         <el-table-column width="150" prop="title" label="">
@@ -406,6 +456,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- SCTU Utility Consumption -->
     <el-table border :data="tableSCTUUtilityConsumption" style="width: 100%;">
       <el-table-column label="SCTU Utility Consumption">
         <el-table-column width="150" prop="title" label="">
@@ -430,6 +481,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- SUB Utility Consumption -->
     <el-table border :data="tableSUBUtilityConsumption" style="width: 100%;">
       <el-table-column label="SUB Utility Consumption">
         <el-table-column width="150" prop="title" label="">
@@ -454,6 +506,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- SCTF Utility Consumption -->
     <el-table border :data="tableSCTFUtilityConsumption" style="width: 100%;">
       <el-table-column label="SCTF Utility Consumption">
         <el-table-column width="150" prop="title" label="">
@@ -478,6 +531,7 @@
         <el-table-column prop="total" label="total"></el-table-column>
       </el-table-column>
     </el-table>
+    <!-- KBI -->
     <el-table border :data="tableKBI" style="width: 100%;">
       <el-table-column prop="kbi" label="KBI" width="150"></el-table-column>
       <el-table-column prop="target" label="target"></el-table-column>
@@ -496,6 +550,7 @@
       <el-table-column prop="dec" :label="this.monthList[11]"></el-table-column>
       <el-table-column prop="total" label="total"></el-table-column>
     </el-table>
+    <!-- Summary -->
     <el-table border :data="tableSummary" style="width: 100%;">
       <el-table-column label="BCC装置主要原材料及公用工程消耗">
         <el-table-column prop="item" label="项目" width="150"></el-table-column>
@@ -569,6 +624,8 @@ export default {
   name: "Monthly",
   data() {
     return {
+      // Eligible Product Rate修改中
+      eligibleProductRateUpdating: false,
       // 趋势图y轴数值
       valueList: [],
       // 趋势图x轴日期
@@ -847,6 +904,27 @@ export default {
     this.getMonthlyReport();
   },
   methods: {
+    /** 编辑按钮操作 */
+    handleEligibleProductRateUpdate(row) {
+      this.eligibleProductRateUpdating = true;
+    },
+    /** 确定修改按钮操作 */
+    handleConfirmEligibleProductRateUpdate(row) {
+      this.eligibleProductRateUpdating = false;
+      // updateReport(this.reportData).then(response => {
+      //   if (response.code == 200) {
+      //     this.$message.success("修改成功");
+      //   } else {
+      //     this.$message.error("未知错误,请联系管理员");
+      //   }
+      //   this.getReport();
+      // });
+    },
+    /** 取消修改按钮操作 */
+    handleCancelEligibleProductRateUpdate(row) {
+      this.eligibleProductRateUpdating = false;
+      // this.getReport();
+    },
     /** 销毁趋势图 */
     disposeChart() {
       this.echarts.dispose(this.chart);
@@ -974,9 +1052,9 @@ export default {
       getAromaticsOutputProduct(year).then(response => {
         this.tableAromaticsOutputProduct = response.data;
       });
-      // getEligibleProductRate(year).then(response => {
-      //   this.tableEligibleProductRate = response.data;
-      // });
+      getEligibleProductRate(year).then(response => {
+        this.tableEligibleProductRate = response.data;
+      });
       getProductYield(year).then(response => {
         this.tableProductYield = response.data;
       });
@@ -1031,5 +1109,7 @@ export default {
 </script>
 
 <style scoped>
-
+  .editDiv{
+    margin-top: 20px;
+  }
 </style>