yourName преди 2 години
родител
ревизия
b08af5faa6

+ 1 - 0
src/main/java/com/steerinfo/baseinfo/meterbasehistaredata/mapper/MeterBaseHisTareDataMapper.java

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface MeterBaseHisTareDataMapper extends IBaseMapper<MeterBaseHisTareData, String> {

+ 5 - 0
src/main/java/com/steerinfo/baseinfo/meterbasehistaredetail/mapper/MeterBaseHisTareDetailMapper.java

@@ -5,7 +5,12 @@ import com.steerinfo.baseinfo.meterbasehistaredetail.model.MeterBaseHisTareDetai
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+import java.util.Map;
+
 @Mapper
 public interface MeterBaseHisTareDetailMapper extends IBaseMapper<MeterBaseHisTareDetail, String> {
     String getNewID(@Param(value="afl")String afl);
+
+    List<MeterBaseHisTareDetail> selectByParametersTop(Map<String, Object> map1);
 }

+ 10 - 1
src/main/java/com/steerinfo/baseinfo/meterbasehistaredetail/mapper/MeterBaseHisTareDetailMapper.xml

@@ -342,5 +342,14 @@
     SELECT LPAD(NVL(MAX(TO_NUMBER(SUBSTR(DETAIL_NO, LENGTH(DETAIL_NO) - 3))),0) + 1,4,'0') DETAIL_NO
     FROM METER_BASE_HIS_TARE_DETAIL where instr(DETAIL_NO,#{afl,jdbcType=VARCHAR})>0
   </select>
-  
+    <select id="selectByParametersTop"
+            resultMap="BaseResultMap">
+      select * from (
+        select * from METER_BASE_HIS_TARE_DETAIL t
+        <include refid="where"></include>
+        order by t.meter_time desc
+        FETCH NEXT 7 ROWS ONLY
+      ) order by METER_WEIGHT desc
+    </select>
+
 </mapper>

+ 44 - 2
src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/service/impl/MeterWorkCarActualFirstServiceImpl.java

@@ -1180,8 +1180,29 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             mbtd.setBaseSpotName(oci.getBaseSpotName());
             mbtd.setMeterWeight(Math.round(oci.getMeterWeight().doubleValue()));
             mbtd.setUpWeight(oci.getMeterWeight().longValue()); //上次皮重
+            //查询前几次皮重
+            double db = 0.0;
+            try {
+                MeterBaseHisTareDetail mbhtd = new MeterBaseHisTareDetail();
+                mbhtd.setCarNo(oci.getCarNo());
+                Map<String, Object> map1 = FieldsCollector.beanToMap(mbhtd);
+                List<MeterBaseHisTareDetail> lmd = meterBaseHisTareDetailMapper.selectByParametersTop(map1);
+                if(lmd!=null&&lmd.size()!=0){
+                    if(lmd.size()>2){//减去最大最小值
+                        lmd.remove(0);
+                        lmd.remove(lmd.size()-1);
+                    }
+                    double sum = 0.0;
+                    for (MeterBaseHisTareDetail meterBaseHisTareDetail : lmd) {
+                        sum+=meterBaseHisTareDetail.getMeterWeight();
+                    }
+                    db = sum / lmd.size();
+                }
+            } catch (Exception e) {
+                logger.error("计算平均皮重出错", e);
+            }
             //  (之前的重量*次数)/(次数+1)
-            double db = (lmOne.get(0).getAvgWeight() * lmOne.get(0).getMeterNum() + lmOne.get(0).getMeterWeight()) / (lmOne.get(0).getMeterNum() + 1);
+            //double db = (lmOne.get(0).getAvgWeight() * lmOne.get(0).getMeterNum() + lmOne.get(0).getMeterWeight()) / (lmOne.get(0).getMeterNum() + 1);
             mbtd.setAvgWeight(Math.round(db));//平均皮重
             mbtd.setMeterNum(lmOne.get(0).getMeterNum() + 1);
             mbtd.setCreateTime(new Date());
@@ -1238,8 +1259,29 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             mbtd.setBaseSpotName(oci.getBaseSpotName());
             mbtd.setMeterWeight(Math.round(oci.getMeterWeight().doubleValue()));
             mbtd.setUpWeight(oci.getMeterWeight().longValue()); //上次皮重
+            //查询前几次皮重
+            double db = 0.0;
+            try {
+                MeterBaseHisTareDetail mbhtd = new MeterBaseHisTareDetail();
+                mbhtd.setCarNo(oci.getCarNo());
+                Map<String, Object> map1 = FieldsCollector.beanToMap(mbhtd);
+                List<MeterBaseHisTareDetail> lmd = meterBaseHisTareDetailMapper.selectByParametersTop(map1);
+                if(lmd!=null&&lmd.size()!=0){
+                    if(lmd.size()>2){
+                        lmd.remove(0);
+                        lmd.remove(lmd.size()-1);
+                    }
+                    double sum = 0.0;
+                    for (MeterBaseHisTareDetail meterBaseHisTareDetail : lmd) {
+                        sum+=meterBaseHisTareDetail.getMeterWeight();
+                    }
+                    db = sum / lmd.size();
+                }
+            } catch (Exception e) {
+                logger.error("计算平均皮重出错", e);
+            }
             //  (之前的重量*次数)/(次数+1)
-            double db = (lmOne.get(0).getAvgWeight() * lmOne.get(0).getMeterNum() + lmOne.get(0).getMeterWeight()) / (lmOne.get(0).getMeterNum() + 1);
+            //double db = (lmOne.get(0).getAvgWeight() * lmOne.get(0).getMeterNum() + lmOne.get(0).getMeterWeight()) / (lmOne.get(0).getMeterNum() + 1);
             mbtd.setAvgWeight(Math.round(db));//平均皮重
             mbtd.setMeterNum(lmOne.get(0).getMeterNum() + 1);
             mbtd.setCreateTime(new Date());

+ 1 - 0
src/main/java/com/steerinfo/meterwork/meterworkdatacount/controller/MeterWorkDataCountController.java

@@ -1,5 +1,6 @@
 package com.steerinfo.meterwork.meterworkdatacount.controller;
 
+import com.steerinfo.baseinfo.combaseinfo.mapper.ComBaseInfoMapper;
 import com.steerinfo.framework.controller.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageList;

+ 227 - 15
src/main/java/com/steerinfo/meterwork/meterworkdatacount/mapper/MeterWorkDataCountMapper.xml

@@ -445,7 +445,7 @@
     select
     A.base_spot_name baseSpotName,
             A.car_no carNo,
-           case when abs(round((A.meter_weight - B.avg_weight)/1000, 2)) >= 0.5 then '皮重超过偏差'
+           case when abs(round((A.meter_weight - B.avg_weight)/1000, 2)) >= (select to_number(BASE_NAME)/1000 from com_base_info where BASE_CODE = '001067001' ) then '皮重超过偏差'
                 else '正常皮重' end alarmType,
            round(A.meter_weight/1000, 2) meterWeight,
            round(B.avg_weight/1000, 2) avgWeight,
@@ -471,7 +471,13 @@
                 else null end meterTypeName,
            A.note
       from meter_work_car_actual_first A
-      left join meter_base_his_tare_data B
+      left join (SELECT *
+                FROM (
+                SELECT t.*,
+                ROW_NUMBER() OVER (PARTITION BY t.car_no ORDER BY t.create_time DESC) AS rn
+                FROM meter_base_his_tare_data t
+                )
+                WHERE rn = 1) B
         on A.car_no = B.Car_No
      where A.weight_type = '1'
         <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
@@ -551,8 +557,33 @@
             from meter_base_operation_log A
             left join meter_work_car_actual_first B
             on A.operation_id = B.actual_first_no
-            where 1 = 1
-            and A.operation_page like '%汽车衡一次数据维护%'
+            where A.operation_page like '%汽车衡一次数据维护%'
+            <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+                and a.create_Time
+                between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+            </if>
+            <if test="carNo != null and carNo != ''">
+                and A.operation_carn_no like '%${carNo}%'
+            </if>
+            <if test="operationFunction != null and operationFunction != ''">
+                and a.operation_function in
+                <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="operationPage != null and operationPage != ''">
+                and a.operation_page in
+                <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="createManName != null and createManName != ''">
+                and a.create_man_name in
+                <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         )
         union
         (
@@ -579,6 +610,32 @@
             left join meter_work_car_actual B
             on A.operation_id = B.actual_no
             where A.operation_page like '%汽车衡净重数据维护%'
+            <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+                and a.create_Time
+                between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+            </if>
+            <if test="carNo != null and carNo != ''">
+                and A.operation_carn_no like '%${carNo}%'
+            </if>
+            <if test="operationFunction != null and operationFunction != ''">
+                and a.operation_function in
+                <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="operationPage != null and operationPage != ''">
+                and a.operation_page in
+                <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="createManName != null and createManName != ''">
+                and a.create_man_name in
+                <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         )
         union
         (
@@ -604,8 +661,33 @@
         from meter_base_operation_log A
         left join meter_work_railway_act_first B
         on A.operation_id = B.actual_first_no
-        where 1 = 1
-        and A.operation_page like '%轨道衡一次数据维护%'
+        where A.operation_page like '%轨道衡一次数据维护%'
+        <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+            and a.create_Time
+            between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+            and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+        </if>
+        <if test="carNo != null and carNo != ''">
+            and A.operation_carn_no like '%${carNo}%'
+        </if>
+        <if test="operationFunction != null and operationFunction != ''">
+            and a.operation_function in
+            <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="operationPage != null and operationPage != ''">
+            and a.operation_page in
+            <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="createManName != null and createManName != ''">
+            and a.create_man_name in
+            <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         )
         union
         (
@@ -633,6 +715,32 @@
         on A.operation_id = B.actual_first_no
         where 1 = 1
         and A.operation_page like '%吊钩秤一次数据维护%'
+        <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+            and a.create_Time
+            between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+            and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+        </if>
+        <if test="carNo != null and carNo != ''">
+            and A.operation_carn_no like '%${carNo}%'
+        </if>
+        <if test="operationFunction != null and operationFunction != ''">
+            and a.operation_function in
+            <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="operationPage != null and operationPage != ''">
+            and a.operation_page in
+            <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="createManName != null and createManName != ''">
+            and a.create_man_name in
+            <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         )
         union
         (
@@ -659,6 +767,32 @@
         left join meter_work_railway_actual B
         on A.operation_id = B.actual_no
         where A.operation_page like '%轨道衡净重数据维护%'
+        <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+            and a.create_Time
+            between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+            and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+        </if>
+        <if test="carNo != null and carNo != ''">
+            and A.operation_carn_no like '%${carNo}%'
+        </if>
+        <if test="operationFunction != null and operationFunction != ''">
+            and a.operation_function in
+            <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="operationPage != null and operationPage != ''">
+            and a.operation_page in
+            <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="createManName != null and createManName != ''">
+            and a.create_man_name in
+            <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         )
         union
         (
@@ -685,6 +819,32 @@
         left join meter_work_railway_actual B
         on A.operation_id = B.actual_no
         where A.operation_page like '%吊钩秤净重数据维护%'
+        <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+            and a.create_Time
+            between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+            and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+        </if>
+        <if test="carNo != null and carNo != ''">
+            and A.operation_carn_no like '%${carNo}%'
+        </if>
+        <if test="operationFunction != null and operationFunction != ''">
+            and a.operation_function in
+            <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="operationPage != null and operationPage != ''">
+            and a.operation_page in
+            <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="createManName != null and createManName != ''">
+            and a.create_man_name in
+            <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         )
         union
         (
@@ -711,6 +871,32 @@
             left join meter_work_railway_actual B
             on A.operation_id = B.actual_no
             where A.operation_page like '%动轨净重数据维护%'
+            <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+                and a.create_Time
+                between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+            </if>
+            <if test="carNo != null and carNo != ''">
+                and A.operation_carn_no like '%${carNo}%'
+            </if>
+            <if test="operationFunction != null and operationFunction != ''">
+                and a.operation_function in
+                <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="operationPage != null and operationPage != ''">
+                and a.operation_page in
+                <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="createManName != null and createManName != ''">
+                and a.create_man_name in
+                <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         )
         union
         (
@@ -737,6 +923,32 @@
             left join Meter_Work_Railway_Received B
             on A.operation_id = B.actual_first_no
             where A.operation_page like '%轨道衡从表数据维护%'
+            <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+                and a.create_Time
+                between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+            </if>
+            <if test="carNo != null and carNo != ''">
+                and A.operation_carn_no like '%${carNo}%'
+            </if>
+            <if test="operationFunction != null and operationFunction != ''">
+                and a.operation_function in
+                <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="operationPage != null and operationPage != ''">
+                and a.operation_page in
+                <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="createManName != null and createManName != ''">
+                and a.create_man_name in
+                <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         )
         union
         (
@@ -763,34 +975,34 @@
             left join Meter_Work_Railway_Received B
             on A.operation_id = B.actual_first_no
             where A.operation_page like '%动轨数据维护%'
-        )
-        )
-        where 1 = 1
             <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
-                and  createTime  >= TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
-                and createTime  &lt;=  TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and a.create_Time
+                between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
             </if>
             <if test="carNo != null and carNo != ''">
-                and carNo like '%${carNo}%'
+                and a.operation_carn_no like '%${carNo}%'
             </if>
             <if test="operationFunction != null and operationFunction != ''">
-                and operationFunction in
+                and a.operation_function in
                 <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
             </if>
             <if test="operationPage != null and operationPage != ''">
-                and operationPage in
+                and a.operation_page in
                 <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
             </if>
             <if test="createManName != null and createManName != ''">
-                and createManName in
+                and a.create_man_name in
                 <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
             </if>
+        )
+        )
         order by createTime desc
     </select>
 

+ 9 - 0
src/main/java/com/steerinfo/meterwork/meterworkdatacount/model/TruckHisTareComparison.java

@@ -21,6 +21,7 @@ public class TruckHisTareComparison {
     private String meterMode;
     private String meterTypeName;
     private String note;
+    private double base;
 
     public String getBaseSpotName() {
         return baseSpotName;
@@ -157,4 +158,12 @@ public class TruckHisTareComparison {
     public void setNote(String note) {
         this.note = note;
     }
+
+    public double getBase() {
+        return base;
+    }
+
+    public void setBase(double base) {
+        this.base = base;
+    }
 }

+ 19 - 0
src/main/java/com/steerinfo/meterwork/meterworkdatacount/service/impl/MeterWorkDataCountServiceImpl.java

@@ -1,5 +1,7 @@
 package com.steerinfo.meterwork.meterworkdatacount.service.impl;
 
+import com.steerinfo.baseinfo.combaseinfo.mapper.ComBaseInfoMapper;
+import com.steerinfo.baseinfo.combaseinfo.model.ComBaseInfo;
 import com.steerinfo.baseinfo.meterbaseoperationlog.mapper.MeterBaseOperationLogMapper;
 import com.steerinfo.baseinfo.meterbasespotinfo.mapper.MeterBaseSpotInfoMapper;
 import com.steerinfo.baseinfo.meterbasespotinfo.model.MeterBaseSpotInfo;
@@ -19,6 +21,8 @@ import com.steerinfo.meterwork.meterworkrailwayactual.model.MeterWorkRailwayActu
 import com.steerinfo.util.StringUtils;
 import org.apache.poi.hssf.record.ArrayRecord;
 import org.apache.shiro.crypto.hash.Hash;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
@@ -34,6 +38,7 @@ import static java.lang.Math.abs;
 @Service
 public class MeterWorkDataCountServiceImpl implements IMeterWorkDataCountService {
 
+    private static final Logger log = LoggerFactory.getLogger(MeterWorkDataCountServiceImpl.class);
     @Resource
     private MeterWorkDataCountMapper meterWorkDataCountMapper;
 
@@ -54,6 +59,9 @@ public class MeterWorkDataCountServiceImpl implements IMeterWorkDataCountService
     @Resource
     private MeterWorkRailwayActFirstMapper meterWorkRailwayActFirstMapper;
 
+    @Resource
+    ComBaseInfoMapper comBaseInfoMapper;
+
     @Override
     public List<HashMap> countFirstAndActual(HashMap<String, Object> params) {
         List<HashMap> models = meterWorkDataCountMapper.countFirstAndActual(params);
@@ -703,8 +711,19 @@ public class MeterWorkDataCountServiceImpl implements IMeterWorkDataCountService
 
     @Override
     public PageList<TruckHisTareComparison> truckHisTareComparison(HashMap<String, Object> params) {
+        ComBaseInfo comBaseInfo = comBaseInfoMapper.selectByPrimaryKey("001067001");
+        Double base = 0.0;
+        try {
+            base = Double.parseDouble(comBaseInfo.getBaseName());
+        }catch (Exception e){
+            e.printStackTrace();
+            log.error("数据类型不符",e);
+        }
         PageHelper.startPage(Integer.parseInt(params.get("pageNum").toString()), Integer.parseInt(params.get("pageSize").toString()));
         List<TruckHisTareComparison> models = meterWorkDataCountMapper.truckHisTareComparison(params);
+        for (TruckHisTareComparison model : models) {
+            model.setBase(base);
+        }
         PageList<TruckHisTareComparison> rows = new PageList<>(models);
         return rows;
     }

+ 1 - 0
src/main/java/com/steerinfo/meterwork/meterworkhookactfirst/service/impl/MeterWorkHookActFirstServiceImpl.java

@@ -686,6 +686,7 @@ public class MeterWorkHookActFirstServiceImpl extends BaseServiceImpl<MeterWorkH
     }
 
     @Override
+    @Transactional
     public RESTfulResult doAddWfStaticTwo(PreHookScale scale, MeterWorkHookActFirst grossModel, MeterWorkHookActFirst tareModel) {
         RESTfulResult rm = new RESTfulResult();
         rm.setFailed();

+ 1 - 0
src/main/java/com/steerinfo/meterwork/meterworkparammap/service/impl/MeterWorkParamMapService.java

@@ -17,6 +17,7 @@ import io.micrometer.core.instrument.Meter;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 

+ 2 - 1
src/main/java/com/steerinfo/meterwork/meterworkrailwayactfirst/service/impl/MeterWorkRailwayActFirstServiceImpl.java

@@ -4876,7 +4876,7 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
     }
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public RESTfulResult doAddWfStaticTwo(PreRailwayScale scale, MeterWorkRailwayActFirst
             grossModel, MeterWorkRailwayActFirst tareModel, boolean needUpload) {
         RESTfulResult rm = new RESTfulResult();
@@ -4915,6 +4915,7 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
 
             if(scale == null) {
                 if (!grossModel.getRailwayNo().equals(tareModel.getRailwayNo())) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     rm.setMessage("两条一次计量数据车号不一致,请确认!!");
                     return rm;
                 }