Ver código fonte

质量月报
- 碳三反应器性能指标表格
- S5010、S5012新增字段丙烷
- S5010、S5012查询和导入等功能相应修改
- S5010、S5012导入模板修改

wangggziwen 1 ano atrás
pai
commit
f9686c0dc2

+ 26 - 21
master/src/main/java/com/ruoyi/project/production/controller/TMonthlyQualityReportController.java

@@ -21,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -185,34 +186,34 @@ public class TMonthlyQualityReportController extends BaseController
             if (StringUtils.isNotEmpty(ma)) { maOutList.add(new BigDecimal(ma)); }
         }
         //计算sum
-        for (BigDecimal value : propaneInList) { propaneInSum.add(value); }
-        for (BigDecimal value : propyleneInList) { propyleneInSum.add(value); }
-        for (BigDecimal value : pdInList) { pdInSum.add(value); }
-        for (BigDecimal value : maInList) { maInSum.add(value); }
-        for (BigDecimal value : propaneOutList) { propaneOutSum.add(value); }
-        for (BigDecimal value : propyleneOutList) { propyleneOutSum.add(value); }
-        for (BigDecimal value : pdOutList) { pdOutSum.add(value); }
-        for (BigDecimal value : maOutList) { maOutSum.add(value); }
+        for (BigDecimal value : propaneInList) { propaneInSum = propaneInSum.add(value); }
+        for (BigDecimal value : propyleneInList) { propyleneInSum = propyleneInSum.add(value); }
+        for (BigDecimal value : pdInList) { pdInSum = pdInSum.add(value); }
+        for (BigDecimal value : maInList) { maInSum = maInSum.add(value); }
+        for (BigDecimal value : propaneOutList) { propaneOutSum = propaneOutSum.add(value); }
+        for (BigDecimal value : propyleneOutList) { propyleneOutSum = propyleneOutSum.add(value); }
+        for (BigDecimal value : pdOutList) { pdOutSum = pdOutSum.add(value); }
+        for (BigDecimal value : maOutList) { maOutSum = maOutSum.add(value); }
         //计算avg
-        if (propaneInList.size() != 0) { propaneInAvg = propaneInSum.divide(new BigDecimal(propaneInList.size())); }
-        if (propyleneInList.size() != 0) { propyleneInAvg = propyleneInSum.divide(new BigDecimal(propyleneInList.size())); }
-        if (pdInList.size() != 0) { pdInAvg = pdInSum.divide(new BigDecimal(pdInList.size())); }
-        if (maInList.size() != 0) { maInAvg = maInSum.divide(new BigDecimal(maInList.size())); }
-        if (propaneOutList.size() != 0) { propaneOutAvg = propaneOutSum.divide(new BigDecimal(propaneOutList.size())); }
-        if (propyleneOutList.size() != 0) { propyleneOutAvg = propyleneOutSum.divide(new BigDecimal(propyleneOutList.size())); }
-        if (pdOutList.size() != 0) { pdOutAvg = pdOutSum.divide(new BigDecimal(pdOutList.size())); }
-        if (maOutList.size() != 0) { maOutAvg = maOutSum.divide(new BigDecimal(maOutList.size())); }
+        if (propaneInList.size() != 0) { propaneInAvg = propaneInSum.divide(new BigDecimal(propaneInList.size()), 2, RoundingMode.HALF_UP); }
+        if (propyleneInList.size() != 0) { propyleneInAvg = propyleneInSum.divide(new BigDecimal(propyleneInList.size()), 2, RoundingMode.HALF_UP); }
+        if (pdInList.size() != 0) { pdInAvg = pdInSum.divide(new BigDecimal(pdInList.size()), 2, RoundingMode.HALF_UP); }
+        if (maInList.size() != 0) { maInAvg = maInSum.divide(new BigDecimal(maInList.size()), 2, RoundingMode.HALF_UP); }
+        if (propaneOutList.size() != 0) { propaneOutAvg = propaneOutSum.divide(new BigDecimal(propaneOutList.size()), 2, RoundingMode.HALF_UP); }
+        if (propyleneOutList.size() != 0) { propyleneOutAvg = propyleneOutSum.divide(new BigDecimal(propyleneOutList.size()), 2, RoundingMode.HALF_UP); }
+        if (pdOutList.size() != 0) { pdOutAvg = pdOutSum.divide(new BigDecimal(pdOutList.size()), 2, RoundingMode.HALF_UP); }
+        if (maOutList.size() != 0) { maOutAvg = maOutSum.divide(new BigDecimal(maOutList.size()), 2, RoundingMode.HALF_UP); }
         if (pdInAvg.compareTo(BigDecimal.ZERO) != 0 && maInAvg.compareTo(BigDecimal.ZERO) != 0) {
-            conversion = (pdInAvg.add(maInAvg).subtract(pdOutAvg).subtract(maOutAvg)).divide(pdInAvg.add(maInAvg));
+            conversion = BigDecimal.TEN.multiply(BigDecimal.TEN).multiply((pdInAvg.add(maInAvg).subtract(pdOutAvg).subtract(maOutAvg)).divide(pdInAvg.add(maInAvg), 2, RoundingMode.HALF_UP));
         }
         if (propaneInAvg.compareTo(BigDecimal.ZERO) != 0 && propyleneInAvg.compareTo(BigDecimal.ZERO) != 0
                 && pdInAvg.compareTo(BigDecimal.ZERO) != 0 && maInAvg.compareTo(BigDecimal.ZERO) != 0
                 && propaneOutAvg.compareTo(BigDecimal.ZERO) != 0 && propyleneOutAvg.compareTo(BigDecimal.ZERO) != 0
                 && pdOutAvg.compareTo(BigDecimal.ZERO) != 0 && maOutAvg.compareTo(BigDecimal.ZERO) != 0) {
-            propyleneSelectivity = ((propyleneOutAvg.divide(propaneOutAvg.add(propyleneOutAvg).add(pdOutAvg).add(maOutAvg)))
-                    .subtract(propyleneInAvg.divide(propaneInAvg.add(propyleneInAvg).add(pdInAvg).add(maInAvg))))
-                    .divide(((pdInAvg.add(maInAvg)).divide(propaneInAvg.add(propyleneInAvg).add(pdInAvg).add(maInAvg)))
-                    .subtract((pdOutAvg.add(maOutAvg)).divide(propaneOutAvg.add(propyleneOutAvg).add(pdOutAvg).add(maOutAvg))));
+            propyleneSelectivity = BigDecimal.TEN.multiply(BigDecimal.TEN).multiply(((propyleneOutAvg.divide(propaneOutAvg.add(propyleneOutAvg).add(pdOutAvg).add(maOutAvg), 2, RoundingMode.HALF_UP))
+                    .subtract(propyleneInAvg.divide(propaneInAvg.add(propyleneInAvg).add(pdInAvg).add(maInAvg), 2, RoundingMode.HALF_UP)))
+                    .divide(((pdInAvg.add(maInAvg)).divide(propaneInAvg.add(propyleneInAvg).add(pdInAvg).add(maInAvg), 2, RoundingMode.HALF_UP))
+                    .subtract((pdOutAvg.add(maOutAvg)).divide(propaneOutAvg.add(propyleneOutAvg).add(pdOutAvg).add(maOutAvg), 2, RoundingMode.HALF_UP)), 2, RoundingMode.HALF_UP));
         }
         C3ReactorTableVO tableVO = new C3ReactorTableVO();
         tableVO.setPropaneInAvg(propaneInAvg);
@@ -1130,6 +1131,8 @@ public class TMonthlyQualityReportController extends BaseController
                         }
                     } else if (j == 3) {
                         entity.setSampleName(cellValue);
+                    } else if (j == 7) {
+                        entity.setPropane(cellValue);
                     } else if (j == 9) {
                         entity.setPropylene(cellValue);
                     } else if (j == 10) {
@@ -1172,6 +1175,8 @@ public class TMonthlyQualityReportController extends BaseController
                         entity.setSampleName(cellValue);
                     } else if (j == 3) {
                         entity.setSampleName(cellValue);
+                    } else if (j == 7) {
+                        entity.setPropane(cellValue);
                     } else if (j == 9) {
                         entity.setPropylene(cellValue);
                     } else if (j == 10) {

+ 6 - 1
master/src/main/resources/mybatis/production/TMonthlyQualityReportS5010Mapper.xml

@@ -25,10 +25,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deptName" column="dept_name" />
         <result property="startDate" column="start_date" />
         <result property="endDate" column="end_date" />
+        <result property="propane" column="propane" />
     </resultMap>
 
     <sql id="selectTMonthlyQualityReportS5010Vo">
-        select d.id, d.location_name, d.sample_point, d.sample_date, d.sample_name, d.propylene, d.propadiene, d.acetylene, d.butadiene_12, d.butadiene_13, d.methylacetylene, d.dept_id, d.del_flag, d.create_by, d.create_time, d.update_by, d.update_time ,s.dept_name from t_monthly_quality_report_s5010 d
+        select d.id, d.propane, d.location_name, d.sample_point, d.sample_date, d.sample_name, d.propylene, d.propadiene, d.acetylene, d.butadiene_12, d.butadiene_13, d.methylacetylene, d.dept_id, d.del_flag, d.create_by, d.create_time, d.update_by, d.update_time ,s.dept_name from t_monthly_quality_report_s5010 d
       left join sys_dept s on s.dept_id = d.dept_id
     </sql>
 
@@ -48,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="butadiene13 != null  and butadiene13 != ''"> and butadiene_13 = #{butadiene13}</if>
             <if test="methylacetylene != null  and methylacetylene != ''"> and methylacetylene = #{methylacetylene}</if>
             <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="propane != null "> and propane = #{propane}</if>
             and d.del_flag = 0
         </where>
         <!-- 数据范围过滤 -->
@@ -82,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
+            <if test="propane != null">propane,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -101,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
+            <if test="propane != null">#{propane},</if>
          </trim>
     </insert>
 
@@ -123,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="propane != null">propane = #{propane},</if>
         </trim>
         where id = #{id}
     </update>

+ 6 - 1
master/src/main/resources/mybatis/production/TMonthlyQualityReportS5012Mapper.xml

@@ -25,10 +25,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deptName" column="dept_name" />
         <result property="startDate" column="start_date" />
         <result property="endDate" column="end_date" />
+        <result property="propane" column="propane" />
     </resultMap>
 
     <sql id="selectTMonthlyQualityReportS5012Vo">
-        select d.id, d.location_name, d.sample_point, d.sample_date, d.sample_name, d.propylene, d.propadiene, d.acetylene, d.butadiene_12, d.butadiene_13, d.methylacetylene, d.dept_id, d.del_flag, d.create_by, d.create_time, d.update_by, d.update_time ,s.dept_name from t_monthly_quality_report_s5012 d
+        select d.id, d.propane, d.location_name, d.sample_point, d.sample_date, d.sample_name, d.propylene, d.propadiene, d.acetylene, d.butadiene_12, d.butadiene_13, d.methylacetylene, d.dept_id, d.del_flag, d.create_by, d.create_time, d.update_by, d.update_time ,s.dept_name from t_monthly_quality_report_s5012 d
       left join sys_dept s on s.dept_id = d.dept_id
     </sql>
 
@@ -48,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="butadiene13 != null  and butadiene13 != ''"> and butadiene_13 = #{butadiene13}</if>
             <if test="methylacetylene != null  and methylacetylene != ''"> and methylacetylene = #{methylacetylene}</if>
             <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="propane != null "> and propane = #{propane}</if>
             and d.del_flag = 0
         </where>
         <!-- 数据范围过滤 -->
@@ -82,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
+            <if test="propane != null">propane,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -101,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
+            <if test="propane != null">#{propane},</if>
          </trim>
     </insert>
 
@@ -123,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="propane != null">propane = #{propane},</if>
         </trim>
         where id = #{id}
     </update>

BIN
master/src/main/resources/static/template/production/quality.xlsx


+ 5 - 3
ui/src/api/production/quality.js

@@ -1,7 +1,9 @@
-// 导出质量月报
-export function exportQuality(query) {
+import request from '@/utils/request'
+
+// 碳三反应器性能指标表格
+export function c3ReactorTable(query) {
   return request({
-    url: '/production/quality/export',
+    url: '/production/quality/c3ReactorTable',
     method: 'get',
     params: query
   })

+ 81 - 8
ui/src/views/production/quality/index.vue

@@ -698,6 +698,7 @@
       <el-table-column label="1,2-丁二烯" align="center" prop="butadiene12" :show-overflow-tooltip="true"/>
       <el-table-column label="1,3-丁二烯" align="center" prop="butadiene13" :show-overflow-tooltip="true"/>
       <el-table-column label="甲基乙炔" align="center" prop="methylacetylene" :show-overflow-tooltip="true"/>
+      <el-table-column label="丙烷" align="center" prop="propane" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -732,6 +733,7 @@
       <el-table-column label="1,2-丁二烯" align="center" prop="butadiene12" :show-overflow-tooltip="true"/>
       <el-table-column label="1,3-丁二烯" align="center" prop="butadiene13" :show-overflow-tooltip="true"/>
       <el-table-column label="甲基乙炔" align="center" prop="methylacetylene" :show-overflow-tooltip="true"/>
+      <el-table-column label="丙烷" align="center" prop="propane" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -2201,6 +2203,47 @@
         </el-form-item>
       </el-form>
       <div id="chart" :style="{width:width,height:height}"></div>
+      <table v-if="showC3Table">
+        <tr>
+          <td colspan="2" class="td-transparent">BYC performance of C3 reactor </td>
+          <td class="td-transparent">R520B</td>
+        </tr>
+        <tr>
+          <td class="td-blue"></td>
+          <td class="td-blue">reactor inlet</td>
+          <td class="td-blue">reactor outlet</td>
+        </tr>
+        <tr>
+          <td class="td-blue">propane</td>
+          <td class="td-blue">{{c3ReactorTableData.propaneInAvg}}</td>
+          <td class="td-blue">{{c3ReactorTableData.propaneOutAvg}}</td>
+        </tr>
+        <tr>
+          <td class="td-blue">propylene</td>
+          <td class="td-blue">{{c3ReactorTableData.propyleneInAvg}}</td>
+          <td class="td-blue">{{c3ReactorTableData.propyleneOutAvg}}</td>
+        </tr>
+        <tr>
+          <td class="td-blue">PD</td>
+          <td class="td-blue">{{c3ReactorTableData.pdInAvg}}</td>
+          <td class="td-blue">{{c3ReactorTableData.pdOutAvg}}</td>
+        </tr>
+        <tr>
+          <td class="td-blue">MA</td>
+          <td class="td-blue">{{c3ReactorTableData.maInAvg}}</td>
+          <td class="td-blue">{{c3ReactorTableData.maOutAvg}}</td>
+        </tr>
+        <tr>
+          <td class="td-green">conversion</td>
+          <td class="td-green">{{c3ReactorTableData.conversion}}%</td>
+          <td class="td-transparent"></td>
+        </tr>
+        <tr>
+          <td class="td-green">Propylene Selectivity</td>
+          <td class="td-green">{{c3ReactorTableData.propyleneSelectivity}}%</td>
+          <td class="td-transparent"></td>
+        </tr>
+      </table>
     </el-dialog>
   </div>
 </template>
@@ -2230,7 +2273,7 @@ import { listS6101, getS6101, delS6101, addS6101, updateS6101, exportS6101 } fro
 import { listS6107, getS6107, delS6107, addS6107, updateS6107, exportS6107 } from "@/api/production/s6107";
 import { listS6301, getS6301, delS6301, addS6301, updateS6301, exportS6301 } from "@/api/production/s6301";
 import { listZ404, getZ404, delZ404, addZ404, updateZ404, exportZ404 } from "@/api/production/z404";
-import { exportQuality } from "@/api/production/quality";
+import { exportQuality, c3ReactorTable } from "@/api/production/quality";
 import { treeselect } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
@@ -2238,7 +2281,6 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 
 export default {
   props: {
-    timeliness: null,
     width: {
       type: String,
       default: '100%'
@@ -2252,6 +2294,8 @@ export default {
   components: { Treeselect },
   data() {
     return {
+      c3ReactorTableData: {},
+      showC3Table: false,
       chart: null,
       chartData : [],
       analysisOptions: [],
@@ -2423,6 +2467,7 @@ export default {
   methods: {
     /** 销毁趋势图 */
     disposeChart() {
+      this.showC3Table = false;
       if(this.chart != null) {
         this.echarts.dispose(this.chart);
       }
@@ -4095,13 +4140,17 @@ export default {
           });
           break;
         case "11":
-          listS5010(this.analysisQueryParams).then(response => {
+          // let params = {
+          //   "startDate": this.sampleDate[0],
+          //   "endDate": this.sampleDate[1]
+          // };
+          c3ReactorTable({
+            "startDate": this.analysisSampleDate[0],
+            "endDate": this.analysisSampleDate[1]
+          }).then(response => {
             let data = response.data;
-            console.log(data)
-          });
-          listS5012(this.analysisQueryParams).then(response => {
-            let data = response.data;
-            console.log(data)
+            this.c3ReactorTableData = data;
+            this.showC3Table = true;
           });
           break;
         case "12":
@@ -5107,3 +5156,27 @@ export default {
   }
 };
 </script>
+<style>
+  table {
+    border-collapse: collapse;
+    border-spacing: 0;
+  }
+  .td-blue{
+    background-color: #00CCFF;
+    color: black;
+    border: 1px solid;
+    padding: 5px;
+  }
+  .td-green{
+    background-color: #00FF00;
+    color: black;
+    border: 1px solid;
+    padding: 5px;
+  }
+  .td-transparent{
+     background-color: transparent;
+    color: black;
+    border: 1px solid;
+    padding: 5px;
+   }
+</style>