Browse Source

修改停机时间记录方式,主轴转速=0的才算停机。修改首页重量计算。添加绩效的毛高

wukai 5 months ago
parent
commit
387d3cbb0f

+ 4 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/domain/TwinCalcHourSpec.java

@@ -55,6 +55,10 @@ public class TwinCalcHourSpec extends BaseEntity {
     @ApiModelProperty("织造米数")
     private BigDecimal length;
 
+    @Excel(name = "毛高")
+    @ApiModelProperty("毛高")
+    private BigDecimal height;
+
     /**
      * 规格
      */

+ 7 - 3
ruoyi-admin/src/main/java/com/ruoyi/biz/service/impl/ApiServiceImpl.java

@@ -65,9 +65,13 @@ public class ApiServiceImpl implements IApiService {
         efficiency.setTotalLength(calcDay.getLength().floatValue());
         efficiency.setALength(calcDay.getLengthA().floatValue());
         efficiency.setBLength(calcDay.getLengthB().floatValue());
-        efficiency.setTotalWeight(calcDay.getWeight().floatValue());
-        efficiency.setAWeight(calcDay.getWeightA().floatValue());
-        efficiency.setBWeight(calcDay.getWeightB().floatValue());
+        //界面上重新计算重量 2024-12-25 用总长度除以373
+        BigDecimal tw = calcDay.getLength().divide(BigDecimal.valueOf(373), 2, BigDecimal.ROUND_HALF_UP);
+        BigDecimal aw = calcDay.getLengthA().divide(BigDecimal.valueOf(373), 2, BigDecimal.ROUND_HALF_UP);
+        BigDecimal bw = calcDay.getLengthB().divide(BigDecimal.valueOf(373), 2, BigDecimal.ROUND_HALF_UP);
+        efficiency.setTotalWeight(tw.floatValue());
+        efficiency.setAWeight(aw.floatValue());
+        efficiency.setBWeight(bw.floatValue());
         efficiency.setATime(calcDay.getOpenTimeA().divide(BigDecimal.valueOf(3600), 2, BigDecimal.ROUND_HALF_UP).floatValue());
         efficiency.setBTime(calcDay.getOpenTimeB().divide(BigDecimal.valueOf(3600), 2, BigDecimal.ROUND_HALF_UP).floatValue());
         indexData.setEfficiency(efficiency);

+ 18 - 5
ruoyi-admin/src/main/java/com/ruoyi/biz/service/impl/AsyncServiceImpl.java

@@ -108,7 +108,7 @@ public class AsyncServiceImpl {
             "Alarm_unit_19", "Alarm_unit_20", "Alarm_unit_21", "Alarm_unit_22", "Alarm_unit_23",
             "Alarm_unit_24", "Alarm_unit_25", "Alarm_unit_26", "Alarm_unit_27", "Capacity_data_33",
             "Capacity_data_15", "Capacity_data_16", "Capacity_data_17", "Capacity_data_18", "Capacity_data_19",
-            "Capacity_data_34", "Formula_data_24"
+            "Capacity_data_34", "Formula_data_24", "Formula_data_15", "Capacity_data_1"
     };
 
 
@@ -156,6 +156,8 @@ public class AsyncServiceImpl {
         int lastMkz = 0;
         //卷曲幅宽
         float lastFk = 0f;
+        //毛高
+        float lastHeight = 0f;
         //上次密度记录的米长
         float lastSpecLength = 0f;
         //开始不为0的电能
@@ -185,6 +187,7 @@ public class AsyncServiceImpl {
             int[] currPan = {da.getInt(fieldList.indexOf("Capacity_data_15")), da.getInt(fieldList.indexOf("Capacity_data_16")), da.getInt(fieldList.indexOf("Capacity_data_17")),
                     da.getInt(fieldList.indexOf("Capacity_data_18")), da.getInt(fieldList.indexOf("Capacity_data_19"))};
             int curr48 = da.getInt(7);
+            int speed = da.getInt(fieldList.indexOf("Capacity_data_1"));
 
             if (i == 0) {
                 //第一次数据是上次最后一条,只做记录用,不做处理
@@ -193,15 +196,22 @@ public class AsyncServiceImpl {
                 lastPanHead = currPan.clone();
                 lastMkz = da.getInt(8);
                 lastFk = da.getFloat(9);
+                lastHeight = da.getFloat(fieldList.indexOf("Formula_data_15"));
                 last48 = curr48;
                 startKwh = da.getFloat(fieldList.indexOf("Capacity_data_34"));
                 continue;
             }
+
+            if (speed == 0) {
+                //如果转速等于0,则表示停机
+                total[4]++;
+            }
+
             //计算盘头
             calcPan(currPan, lastPanHead, panHeadInfo, timestamps.getLong(i));
             //计算规格米长
             if (last[2] != curr[2]) {
-                calcSpec(total[0], lastSpecLength, last[2], lastMkz, specList);
+                calcSpec(total[0], lastSpecLength, last[2], lastMkz, lastHeight, specList);
                 lastSpecLength = total[0];
             }
             //处理电量跳点
@@ -232,6 +242,7 @@ public class AsyncServiceImpl {
             lastPanHead = currPan.clone();
             lastMkz = da.getInt(8);
             lastFk = da.getFloat(9);
+            lastHeight = da.getFloat(fieldList.indexOf("Formula_data_15"));
             last48 = curr48;
         }
         //最后再补一次计算
@@ -241,7 +252,7 @@ public class AsyncServiceImpl {
 //        }
         //还是只计算米长
         calcTotal(0, last, first, total, lastMkz, lastFk);
-        calcSpec(total[0], lastSpecLength, last[2], lastMkz, specList);
+        calcSpec(total[0], lastSpecLength, last[2], lastMkz, lastHeight, specList);
         //计算电量
         total[1] = endKwh - startKwh;
 
@@ -271,7 +282,7 @@ public class AsyncServiceImpl {
      * @param lastMkz     米克重
      * @param specList    列表
      */
-    private void calcSpec(float len, float lastLen, float lastDensity, int lastMkz, List<TwinCalcHourSpec> specList) {
+    private void calcSpec(float len, float lastLen, float lastDensity, int lastMkz, float lastHeight, List<TwinCalcHourSpec> specList) {
         //计算规格米长
         //如果密度有变化,就记录下来
         TwinCalcHourSpec spec = new TwinCalcHourSpec();
@@ -279,6 +290,7 @@ public class AsyncServiceImpl {
         float len1 = len - lastLen;
         spec.setLength(BigDecimal.valueOf(len1));
         spec.setMick(lastMkz);
+        spec.setHeight(BigDecimal.valueOf(lastHeight));
         specList.add(spec);
     }
 
@@ -342,7 +354,8 @@ public class AsyncServiceImpl {
             return;
         }
         if (curr != 0) {
-            total[4]++;
+//            开机时间不再根据停机状态计算,需要根据主轴运行转速来计算 2024-12-23
+//            total[4]++;
             if (curr != last) {
                 if (last != 0) {
                     //记录上个停机类型的结束时间

+ 6 - 1
ruoyi-admin/src/main/resources/mapper/biz/TwinCalcHourSpecMapper.xml

@@ -12,13 +12,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="length"    column="LENGTH"    />
         <result property="spec"    column="SPEC"    />
         <result property="mick"    column="MICK"    />
+        <result property="height"    column="HEIGHT"    />
         <result property="density"    column="DENSITY"    />
         <result property="price"    column="PRICE"    />
         <result property="remark"    column="REMARK"    />
     </resultMap>
 
     <sql id="selectTwinCalcHourSpecVo">
-        select ID, DATA_DATE, HOUR, DEVICE_ID, LENGTH, SPEC, MICK, DENSITY, PRICE, REMARK from twin_calc_hour_spec
+        select ID, DATA_DATE, HOUR, DEVICE_ID, LENGTH,HEIGHT, SPEC, MICK, DENSITY, PRICE, REMARK from twin_calc_hour_spec
     </sql>
 
     <select id="selectTwinCalcHourSpecList" parameterType="TwinCalcHourSpec" resultMap="TwinCalcHourSpecResult">
@@ -28,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="hour != null "> and HOUR = #{hour}</if>
             <if test="deviceId != null "> and DEVICE_ID = #{deviceId}</if>
             <if test="length != null "> and LENGTH = #{length}</if>
+            <if test="height != null "> and height = #{height}</if>
             <if test="spec != null  and spec != ''"> and SPEC = #{spec}</if>
             <if test="mick != null "> and MICK = #{mick}</if>
             <if test="density != null "> and DENSITY = #{density}</if>
@@ -51,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="hour != null">HOUR,</if>
             <if test="deviceId != null">DEVICE_ID,</if>
             <if test="length != null">LENGTH,</if>
+            <if test="height != null "> HEIGHT,</if>
             <if test="spec != null">SPEC,</if>
             <if test="mick != null">MICK,</if>
             <if test="density != null">DENSITY,</if>
@@ -62,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="hour != null">#{hour},</if>
             <if test="deviceId != null">#{deviceId},</if>
             <if test="length != null">#{length},</if>
+            <if test="height != null "> #{height},</if>
             <if test="spec != null">#{spec},</if>
             <if test="mick != null">#{mick},</if>
             <if test="density != null">#{density},</if>
@@ -77,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="hour != null">HOUR = #{hour},</if>
             <if test="deviceId != null">DEVICE_ID = #{deviceId},</if>
             <if test="length != null">LENGTH = #{length},</if>
+            <if test="height != null "> HEIGHT = #{height},</if>
             <if test="spec != null">SPEC = #{spec},</if>
             <if test="mick != null">MICK = #{mick},</if>
             <if test="density != null">DENSITY = #{density},</if>