dengyj 4 éve
szülő
commit
66262bc082

+ 25 - 5
src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/service/impl/MeterWorkCarActualFirstServiceImpl.java

@@ -60,6 +60,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import javax.annotation.Resource;
 import java.lang.reflect.Field;
@@ -513,6 +514,14 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             if (models.size() <= 0 || models == null) {
                 throw new MarkerMetException(500, "参数为空!!");
             }
+
+            for(MeterWorkCarActualFirst model: models) {
+                PreTrackScale pls = preTrackScaleMapper.selectByPrimaryKey(model.getPredictionNo());
+                if(pls.getValueFlag().equals("9")) {
+                    throw new MarkerMetException(500, "一次数据中包含已结算的委托!!");
+                }
+            }
+
             for (MeterWorkCarActualFirst model : models) {
                 if (model.getPredictionNo() == null && "".equals(model.getPredictionNo())) {
                     throw new MarkerMetException(500, "该条数据还未匹配!!");
@@ -1151,8 +1160,15 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
                 preTrackScale.setValueFlag("2");
                 preTrackScale.setUploadFlag("1");
                 preTrackScaleMapper.updateByPrimaryKeySelective(preTrackScale);
+
+                PreTrackScale pres = preTrackScaleMapper.selectBypredictionNo(netDb.getPredictionNo());
+                if(pres.getReceiverRemark().equals("H01") || pres.getReceiverRemark().equals("H02")){
+                    netDb.setPredictionType("7");
+                }
             }
 
+
+
             // 判断当前数据是否存在委托
 //            if (netDb.getPredictionNo() != null && "".equals(netDb.getPredictionNo())) {
 //                MeterWorkCarActualFirst gross = meterWorkCarActualFirstMapper.selectByPrimaryKey(netDb.getActualFirst1No());
@@ -1360,10 +1376,10 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
 //            netDb.setActualNo(afl + no1);
 
             String no1 = PublicMethod.IdCreate(3);
-            secondDb.setActualFirstNo(no1);
+            netDb.setActualNo(no1);
 
-            netDb.setActualFirst2No(formatter.format(new Date()) + no);
-            netDb.setActualFirst1No(formatter.format(new Date()) + noHZ);
+            netDb.setActualFirst2No(no);
+            netDb.setActualFirst1No(noHZ);
             if (netDb != null && netDb.getNetWeight() != null) {
                 //2021年3月7日 净重保留两位小数;
                 BigDecimal net;
@@ -1440,6 +1456,7 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             rm.setData(null);
             rm.setMessage(e.getMessage());
             e.printStackTrace();
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return rm;
         }
     }
@@ -2820,8 +2837,8 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
         rm.setFailed();
 
         try {
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-            String afl = sdf.format(new Date());
+//            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+//            String afl = sdf.format(new Date());
 
             //存储当前计量的数据
 //            String firstNo01 = sdf.format(new Date()) + meterWorkCarActualFirstMapper.getNewID(afl);
@@ -3002,6 +3019,7 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
         }catch(Exception e) {
             e.printStackTrace();
             rm.setMessage("操作异常,请确认!!>>>>" + e.getMessage());
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return rm;
         }
     }
@@ -3210,6 +3228,7 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
         }catch(Exception e) {
             e.printStackTrace();
             rm.setMessage("操作异常,请确认!!>>>>" + e.getMessage());
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
         }
         return rm;
     }
@@ -4347,6 +4366,7 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
 //                String afl = sdf.format(new Date());
 //                String no = meterWorkCarActualMapper.getNewID(sdf.format(new Date()));
 //                model.setActualNo(sdf.format(new Date()) + no);
+
                 String no = PublicMethod.IdCreate(3);
                 model.setActualNo(no);
                 model.setNetTime(new Date());

+ 5 - 3
src/main/java/com/steerinfo/meterwork/meterworkrailwayactfirst/service/impl/MeterWorkRailwayActFirstServiceImpl.java

@@ -293,9 +293,9 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
             map.put("actualFirstNo", model.getActualFirstNo());
             List<MeterWorkRailwayActual> rows = meterWorkRailwayActualMapper.selectByAcatualFristNo(map);
             if(rows.size() >= 1) {
-                model.setValueFlag("2");
-            }else {
                 model.setValueFlag("1");
+            }else {
+                model.setValueFlag("0");
             }
             /*if(model.getWeightType().equals("0")) {
                 map.put("actualFirst1No", model.getActualFirstNo());
@@ -2444,12 +2444,14 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
             }
 
             PreRailwayScale pls = preRailwayScaleMapper.selectByPrimaryKey(model.getPredictionNo());
+            if(pls.getPredictionNo().equals("9")) {
+                throw new MarkerMetException(500, "该条数据匹配的委托已结算不能解除匹配!!");
+            }
             pls.setPredictionNo(model.getPredictionNo());
             pls.setUpdateManName("轨道衡一次计量解除委托操作");
             pls.setUpdateTime(new Date());
             pls.setValueFlag("1");
             pls.setUploadFlag("1");
-
             preRailwayScaleMapper.updateByPrimaryKeySelective(pls);
             MeterWorkRailwayActFirst mwcaf = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirstNo());
             mwcaf.setValueFlag("1");

+ 3 - 0
src/main/java/com/steerinfo/meterwork/meterworkrailwayactual/controller/MeterWorkRailwayActualController.java

@@ -765,6 +765,9 @@ public class MeterWorkRailwayActualController extends BaseRESTfulController {
     public RESTfulResult firstAndEntrustById(@RequestBody HashMap params) {
         RESTfulResult rm = failed();
         try {
+            if(params.get("actualNo") == null) {
+                return rm;
+            }
             String actualNo = params.get("actualNo") == null ? "" : params.get("actualNo").toString();
             rm = meterWorkRailwayActualService.firstAndEntrustById(actualNo);
             if (rm.getData() != null) {

+ 154 - 127
src/main/java/com/steerinfo/meterwork/meterworkrailwayactual/mapper/MeterWorkRailwayActualMapper.xml

@@ -111,6 +111,7 @@
     <result column="IS_BOUND_LIST" jdbcType="VARCHAR" property="isBoundList" />
     <result column="CONTRACT_ID" jdbcType="VARCHAR" property="contractId" />
     <result column="IS_BOUND_LIST_DOWNLOADED" jdbcType="VARCHAR" property="isBoundListDownloaded" />
+    <result column="DOCUMENT_ID" jdbcType="VARCHAR" property="documentId" />
   </resultMap>
   <sql id="columns">
     ACTUAL_NO, PREDICTION_NO, NOTICE_NO, RAILWAY_NO, RAILWAY_CARRIAGE_NO, MATTER_NO, 
@@ -131,7 +132,7 @@
     MEASURE_BATCH, MEASURE_BATCH_COUNT, SENDER_TYPE, SENDER_REMARK, RECEIVER_TYPE, RECEIVER_REMARK, 
     AMOUNT_UNIT, MEASURE_OBJECT_TYPE, MEASURE_TASK_NUM, BILL_TYPE, CREATE_MAN_NAME, CREATE_TIME, 
     DATA_SOURCE, NOTE, IS_PRE_SACALE, LC_NO, PREDICTION_TYPE, PREDICTION_COMBINATION, 
-    BOUND_LIST_URL, IS_BOUND_LIST, CONTRACT_ID, IS_BOUND_LIST_DOWNLOADED
+    BOUND_LIST_URL, IS_BOUND_LIST, CONTRACT_ID, IS_BOUND_LIST_DOWNLOADED, DOCUMENT_ID
   </sql>
   <sql id="columns_alias">
     t.ACTUAL_NO, t.PREDICTION_NO, t.NOTICE_NO, t.RAILWAY_NO, t.RAILWAY_CARRIAGE_NO, t.MATTER_NO, 
@@ -154,13 +155,13 @@
     t.SENDER_REMARK, t.RECEIVER_TYPE, t.RECEIVER_REMARK, t.AMOUNT_UNIT, t.MEASURE_OBJECT_TYPE, 
     t.MEASURE_TASK_NUM, t.BILL_TYPE, t.CREATE_MAN_NAME, t.CREATE_TIME, t.DATA_SOURCE, 
     t.NOTE, t.IS_PRE_SACALE, t.LC_NO, t.PREDICTION_TYPE, t.PREDICTION_COMBINATION, t.BOUND_LIST_URL, 
-    t.IS_BOUND_LIST, t.CONTRACT_ID, t.IS_BOUND_LIST_DOWNLOADED
+    t.IS_BOUND_LIST, t.CONTRACT_ID, t.IS_BOUND_LIST_DOWNLOADED, t.DOCUMENT_ID
   </sql>
   <sql id="select">
-    SELECT <include refid="columns"/> FROM METER_WORK_RAILWAY_ACTUAL
+    SELECT <include refid="columns" /> FROM METER_WORK_RAILWAY_ACTUAL
   </sql>
   <sql id="select_alias">
-    SELECT <include refid="columns_alias"/> FROM METER_WORK_RAILWAY_ACTUAL t
+    SELECT <include refid="columns_alias" /> FROM METER_WORK_RAILWAY_ACTUAL t
   </sql>
   <sql id="where">
     <where> 
@@ -491,6 +492,9 @@
       <if test="isBoundListDownloaded != null and isBoundListDownloaded != ''">
         and IS_BOUND_LIST_DOWNLOADED = #{isBoundListDownloaded}
       </if>
+      <if test="documentId != null and documentId != ''">
+        and DOCUMENT_ID = #{documentId}
+      </if>
     </where>
   </sql>
   <sql id="whereLike">
@@ -822,6 +826,9 @@
       <if test="isBoundListDownloaded != null and isBoundListDownloaded != ''">
         and IS_BOUND_LIST_DOWNLOADED LIKE '%${isBoundListDownloaded}%'
       </if>
+      <if test="documentId != null and documentId != ''">
+        and DOCUMENT_ID LIKE '%${documentId}%'
+      </if>
     </where>
   </sql>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
@@ -1155,6 +1162,9 @@
       <if test="isBoundListDownloaded != null and isBoundListDownloaded != ''">
         or IS_BOUND_LIST_DOWNLOADED = #{isBoundListDownloaded}
       </if>
+      <if test="documentId != null and documentId != ''">
+        or DOCUMENT_ID = #{documentId}
+      </if>
   </delete>
   <insert id="insert" parameterType="com.steerinfo.meterwork.meterworkrailwayactual.model.MeterWorkRailwayActual">
     insert into METER_WORK_RAILWAY_ACTUAL (ACTUAL_NO, PREDICTION_NO, NOTICE_NO, 
@@ -1194,7 +1204,7 @@
       NOTE, IS_PRE_SACALE, LC_NO, 
       PREDICTION_TYPE, PREDICTION_COMBINATION, 
       BOUND_LIST_URL, IS_BOUND_LIST, CONTRACT_ID, 
-      IS_BOUND_LIST_DOWNLOADED)
+      IS_BOUND_LIST_DOWNLOADED, DOCUMENT_ID)
     values (#{actualNo,jdbcType=VARCHAR}, #{predictionNo,jdbcType=VARCHAR}, #{noticeNo,jdbcType=VARCHAR}, 
       #{railwayNo,jdbcType=VARCHAR}, #{railwayCarriageNo,jdbcType=VARCHAR}, #{matterNo,jdbcType=VARCHAR}, 
       #{matterName,jdbcType=VARCHAR}, #{contractNo,jdbcType=VARCHAR}, #{batchNo,jdbcType=VARCHAR}, 
@@ -1232,7 +1242,7 @@
       #{note,jdbcType=VARCHAR}, #{isPreSacale,jdbcType=VARCHAR}, #{lcNo,jdbcType=VARCHAR}, 
       #{predictionType,jdbcType=VARCHAR}, #{predictionCombination,jdbcType=VARCHAR}, 
       #{boundListUrl,jdbcType=VARCHAR}, #{isBoundList,jdbcType=VARCHAR}, #{contractId,jdbcType=VARCHAR}, 
-      #{isBoundListDownloaded,jdbcType=VARCHAR})
+      #{isBoundListDownloaded,jdbcType=VARCHAR}, #{documentId,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.steerinfo.meterwork.meterworkrailwayactual.model.MeterWorkRailwayActual">
     insert into METER_WORK_RAILWAY_ACTUAL
@@ -1564,6 +1574,9 @@
       <if test="isBoundListDownloaded != null">
         IS_BOUND_LIST_DOWNLOADED,
       </if>
+      <if test="documentId != null">
+        DOCUMENT_ID,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="actualNo != null">
@@ -1893,6 +1906,9 @@
       <if test="isBoundListDownloaded != null">
         #{isBoundListDownloaded,jdbcType=VARCHAR},
       </if>
+      <if test="documentId != null">
+        #{documentId,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.steerinfo.meterwork.meterworkrailwayactual.model.MeterWorkRailwayActual">
@@ -2004,7 +2020,8 @@
       BOUND_LIST_URL = #{boundListUrl,jdbcType=VARCHAR},
       IS_BOUND_LIST = #{isBoundList,jdbcType=VARCHAR},
       CONTRACT_ID = #{contractId,jdbcType=VARCHAR},
-      IS_BOUND_LIST_DOWNLOADED = #{isBoundListDownloaded,jdbcType=VARCHAR}
+      IS_BOUND_LIST_DOWNLOADED = #{isBoundListDownloaded,jdbcType=VARCHAR},
+      DOCUMENT_ID = #{documentId,jdbcType=VARCHAR}
     where ACTUAL_NO = #{actualNo,jdbcType=VARCHAR}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.meterwork.meterworkrailwayactual.model.MeterWorkRailwayActual">
@@ -2334,20 +2351,23 @@
       <if test="isBoundListDownloaded != null">
         IS_BOUND_LIST_DOWNLOADED = #{isBoundListDownloaded,jdbcType=VARCHAR},
       </if>
+      <if test="documentId != null">
+        DOCUMENT_ID = #{documentId,jdbcType=VARCHAR},
+      </if>
     </set>
     where ACTUAL_NO = #{actualNo,jdbcType=VARCHAR}
   </update>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
-    <include refid="select"/>
+    <include refid="select" />
     where ACTUAL_NO = #{actualNo,jdbcType=VARCHAR}
   </select>
   <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-    <include refid="select"/>
-    <include refid="where"/>
+    <include refid="select" />
+    <include refid="where" />
   </select>
   <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-    <include refid="select"/>
-    <include refid="whereLike"/>
+    <include refid="select" />
+    <include refid="whereLike" />
   </select>
   <insert id="batchInsert" parameterType="java.util.List">
     insert into METER_WORK_RAILWAY_ACTUAL 
@@ -2391,8 +2411,8 @@
       CREATE_TIME, DATA_SOURCE, NOTE, 
       IS_PRE_SACALE, LC_NO, PREDICTION_TYPE, 
       PREDICTION_COMBINATION, BOUND_LIST_URL, 
-      IS_BOUND_LIST, CONTRACT_ID, IS_BOUND_LIST_DOWNLOADED
-      )
+      IS_BOUND_LIST, CONTRACT_ID, IS_BOUND_LIST_DOWNLOADED, 
+      DOCUMENT_ID)
     ( <foreach collection="list" item="item" separator="union all"> 
    select  
       #{item.actualNo,jdbcType=VARCHAR}, 
@@ -2435,458 +2455,462 @@
       #{item.createTime,jdbcType=TIMESTAMP}, #{item.dataSource,jdbcType=VARCHAR}, #{item.note,jdbcType=VARCHAR}, 
       #{item.isPreSacale,jdbcType=VARCHAR}, #{item.lcNo,jdbcType=VARCHAR}, #{item.predictionType,jdbcType=VARCHAR}, 
       #{item.predictionCombination,jdbcType=VARCHAR}, #{item.boundListUrl,jdbcType=VARCHAR}, 
-      #{item.isBoundList,jdbcType=VARCHAR}, #{item.contractId,jdbcType=VARCHAR}, #{item.isBoundListDownloaded,jdbcType=VARCHAR}
-       from dual  
+      #{item.isBoundList,jdbcType=VARCHAR}, #{item.contractId,jdbcType=VARCHAR}, #{item.isBoundListDownloaded,jdbcType=VARCHAR}, 
+      #{item.documentId,jdbcType=VARCHAR} from dual  
    </foreach> )
   </insert>
   <update id="batchUpdate" parameterType="java.util.List">
      update METER_WORK_RAILWAY_ACTUAL
      set
        ACTUAL_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.actualNo,jdbcType=VARCHAR}
        </foreach>
        ,PREDICTION_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.predictionNo,jdbcType=VARCHAR}
        </foreach>
        ,NOTICE_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.noticeNo,jdbcType=VARCHAR}
        </foreach>
        ,RAILWAY_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.railwayNo,jdbcType=VARCHAR}
        </foreach>
        ,RAILWAY_CARRIAGE_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.railwayCarriageNo,jdbcType=VARCHAR}
        </foreach>
        ,MATTER_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.matterNo,jdbcType=VARCHAR}
        </foreach>
        ,MATTER_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.matterName,jdbcType=VARCHAR}
        </foreach>
        ,CONTRACT_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.contractNo,jdbcType=VARCHAR}
        </foreach>
        ,BATCH_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.batchNo,jdbcType=VARCHAR}
        </foreach>
        ,CUSTOMER_SUPPLIER_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.customerSupplierNo,jdbcType=VARCHAR}
        </foreach>
        ,CUSTOMER_SUPPLIER_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.customerSupplierName,jdbcType=VARCHAR}
        </foreach>
        ,FORWARDING_UNIT_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.forwardingUnitNo,jdbcType=VARCHAR}
        </foreach>
        ,FORWARDING_UNIT_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.forwardingUnitName,jdbcType=VARCHAR}
        </foreach>
        ,RECEIVING_UINT_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.receivingUintNo,jdbcType=VARCHAR}
        </foreach>
        ,RECEIVING_UINT_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.receivingUintName,jdbcType=VARCHAR}
        </foreach>
        ,MATERIAL_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.materialNo,jdbcType=VARCHAR}
        </foreach>
        ,MATERIAL_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.materialName,jdbcType=VARCHAR}
        </foreach>
        ,SPEC_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.specNo,jdbcType=VARCHAR}
        </foreach>
        ,SPEC_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.specName,jdbcType=VARCHAR}
        </foreach>
        ,LOAD_POINT_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.loadPointNo,jdbcType=VARCHAR}
        </foreach>
        ,LOAD_POINT_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.loadPointName,jdbcType=VARCHAR}
        </foreach>
        ,SAMPLE_VOUCHER=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.sampleVoucher,jdbcType=VARCHAR}
        </foreach>
        ,CARRIER_UNIT_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.carrierUnitNo,jdbcType=VARCHAR}
        </foreach>
        ,CARRIER_UNIT_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.carrierUnitName,jdbcType=VARCHAR}
        </foreach>
        ,METER_TYPE_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.meterTypeNo,jdbcType=VARCHAR}
        </foreach>
        ,METER_TYPE_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.meterTypeName,jdbcType=VARCHAR}
        </foreach>
        ,METER_PROCESS_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.meterProcessNo,jdbcType=VARCHAR}
        </foreach>
        ,METER_PROCESS_EDITION_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.meterProcessEditionNo,jdbcType=VARCHAR}
        </foreach>
        ,ACTUAL_FIRST1_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.actualFirst1No,jdbcType=VARCHAR}
        </foreach>
        ,GROSS_WEIGHT=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.grossWeight,jdbcType=DECIMAL}
        </foreach>
        ,GROSS_MAN_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.grossManNo,jdbcType=VARCHAR}
        </foreach>
        ,GROSS_MAN_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.grossManName,jdbcType=VARCHAR}
        </foreach>
        ,GROSS_TIME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.grossTime,jdbcType=TIMESTAMP}
        </foreach>
        ,BASE_SPOT1_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.baseSpot1No,jdbcType=VARCHAR}
        </foreach>
        ,BASE_SPOT1_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.baseSpot1Name,jdbcType=VARCHAR}
        </foreach>
        ,GROSS_CLASS=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.grossClass,jdbcType=VARCHAR}
        </foreach>
        ,GROSS_GROUP=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.grossGroup,jdbcType=VARCHAR}
        </foreach>
        ,GROSS_MODE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.grossMode,jdbcType=VARCHAR}
        </foreach>
        ,ACTUAL_FIRST2_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.actualFirst2No,jdbcType=VARCHAR}
        </foreach>
        ,TARE_WEIGHT=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.tareWeight,jdbcType=DECIMAL}
        </foreach>
        ,TARE_MAN_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.tareManNo,jdbcType=VARCHAR}
        </foreach>
        ,TARE_MAN_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.tareManName,jdbcType=VARCHAR}
        </foreach>
        ,TARE_TIME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.tareTime,jdbcType=TIMESTAMP}
        </foreach>
        ,BASE_SPOT2_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.baseSpot2No,jdbcType=VARCHAR}
        </foreach>
        ,BASE_SPOT2_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.baseSpot2Name,jdbcType=VARCHAR}
        </foreach>
        ,TARE_CLASS=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.tareClass,jdbcType=VARCHAR}
        </foreach>
        ,TARE_GROUP=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.tareGroup,jdbcType=VARCHAR}
        </foreach>
        ,TARE_MODE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.tareMode,jdbcType=VARCHAR}
        </foreach>
        ,NET_WEIGHT=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.netWeight,jdbcType=DECIMAL}
        </foreach>
        ,NET_MAN_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.netManNo,jdbcType=VARCHAR}
        </foreach>
        ,NET_MAN_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.netManName,jdbcType=VARCHAR}
        </foreach>
        ,NET_TIME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.netTime,jdbcType=TIMESTAMP}
        </foreach>
        ,NET_SPOT3_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.netSpot3No,jdbcType=VARCHAR}
        </foreach>
        ,NET_SPOT3_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.netSpot3Name,jdbcType=VARCHAR}
        </foreach>
        ,NET_CLASS=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.netClass,jdbcType=VARCHAR}
        </foreach>
        ,NET_GROUP=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.netGroup,jdbcType=VARCHAR}
        </foreach>
        ,NET_MODE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.netMode,jdbcType=VARCHAR}
        </foreach>
        ,VALUE_FLAG=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.valueFlag,jdbcType=VARCHAR}
        </foreach>
        ,UPLOAD_FLAG=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.uploadFlag,jdbcType=VARCHAR}
        </foreach>
        ,CHECK_MAN_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.checkManNo,jdbcType=VARCHAR}
        </foreach>
        ,CHECK_MAN_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.checkManName,jdbcType=VARCHAR}
        </foreach>
        ,CHECK_TIME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.checkTime,jdbcType=TIMESTAMP}
        </foreach>
        ,UPLOAD_MAN_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.uploadManNo,jdbcType=VARCHAR}
        </foreach>
        ,UPLOAD_MAN_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.uploadManName,jdbcType=VARCHAR}
        </foreach>
        ,UPLOAD_TIME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.uploadTime,jdbcType=TIMESTAMP}
        </foreach>
        ,SAMPLE_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.sampleNo,jdbcType=VARCHAR}
        </foreach>
        ,RAILWAY_TYPE_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.railwayTypeNo,jdbcType=VARCHAR}
        </foreach>
        ,RAILWAY_TYPE_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.railwayTypeName,jdbcType=VARCHAR}
        </foreach>
        ,MEMO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.memo,jdbcType=VARCHAR}
        </foreach>
        ,WATER_NUM=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.waterNum,jdbcType=DECIMAL}
        </foreach>
        ,ARRIVAL=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.arrival,jdbcType=VARCHAR}
        </foreach>
        ,STATION=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.station,jdbcType=VARCHAR}
        </foreach>
        ,UPDATE_MAN_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.updateManNo,jdbcType=VARCHAR}
        </foreach>
        ,UPDATE_MAN_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.updateManName,jdbcType=VARCHAR}
        </foreach>
        ,UPDATE_TIME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.updateTime,jdbcType=TIMESTAMP}
        </foreach>
        ,SOURCE_AREA=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.sourceArea,jdbcType=VARCHAR}
        </foreach>
        ,VOUCHER_IDENTITY=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.voucherIdentity,jdbcType=VARCHAR}
        </foreach>
        ,VOUCHER_ITEM=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.voucherItem,jdbcType=VARCHAR}
        </foreach>
        ,BUSINESS_GROUP=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.businessGroup,jdbcType=VARCHAR}
        </foreach>
        ,TEMP_CONVEYANCE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.tempConveyance,jdbcType=VARCHAR}
        </foreach>
        ,CONVEYANCE_TYPE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.conveyanceType,jdbcType=VARCHAR}
        </foreach>
        ,RESOURCE_SYSTEM=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.resourceSystem,jdbcType=VARCHAR}
        </foreach>
        ,GROUP_PACKAGE_AMOUNT=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.groupPackageAmount,jdbcType=DECIMAL}
        </foreach>
        ,GROUP_PACKAGE_UNIT=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.groupPackageUnit,jdbcType=VARCHAR}
        </foreach>
        ,PACKAGE_AMOUNT=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.packageAmount,jdbcType=DECIMAL}
        </foreach>
        ,PACKAGE_UNIT=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.packageUnit,jdbcType=VARCHAR}
        </foreach>
        ,THEORY_AMOUNT=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.theoryAmount,jdbcType=DECIMAL}
        </foreach>
        ,MEASURE_BATCH=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.measureBatch,jdbcType=VARCHAR}
        </foreach>
        ,MEASURE_BATCH_COUNT=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.measureBatchCount,jdbcType=DECIMAL}
        </foreach>
        ,SENDER_TYPE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.senderType,jdbcType=VARCHAR}
        </foreach>
        ,SENDER_REMARK=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.senderRemark,jdbcType=VARCHAR}
        </foreach>
        ,RECEIVER_TYPE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.receiverType,jdbcType=VARCHAR}
        </foreach>
        ,RECEIVER_REMARK=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.receiverRemark,jdbcType=VARCHAR}
        </foreach>
        ,AMOUNT_UNIT=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.amountUnit,jdbcType=VARCHAR}
        </foreach>
        ,MEASURE_OBJECT_TYPE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.measureObjectType,jdbcType=VARCHAR}
        </foreach>
        ,MEASURE_TASK_NUM=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.measureTaskNum,jdbcType=VARCHAR}
        </foreach>
        ,BILL_TYPE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.billType,jdbcType=VARCHAR}
        </foreach>
        ,CREATE_MAN_NAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.createManName,jdbcType=VARCHAR}
        </foreach>
        ,CREATE_TIME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
        </foreach>
        ,DATA_SOURCE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.dataSource,jdbcType=VARCHAR}
        </foreach>
        ,NOTE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.note,jdbcType=VARCHAR}
        </foreach>
        ,IS_PRE_SACALE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.isPreSacale,jdbcType=VARCHAR}
        </foreach>
        ,LC_NO=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.lcNo,jdbcType=VARCHAR}
        </foreach>
        ,PREDICTION_TYPE=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.predictionType,jdbcType=VARCHAR}
        </foreach>
        ,PREDICTION_COMBINATION=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.predictionCombination,jdbcType=VARCHAR}
        </foreach>
        ,BOUND_LIST_URL=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.boundListUrl,jdbcType=VARCHAR}
        </foreach>
        ,IS_BOUND_LIST=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.isBoundList,jdbcType=VARCHAR}
        </foreach>
        ,CONTRACT_ID=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.contractId,jdbcType=VARCHAR}
        </foreach>
        ,IS_BOUND_LIST_DOWNLOADED=
-       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_NO" close="end">
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
           when #{item.actualNo,jdbcType=VARCHAR} then #{item.isBoundListDownloaded,jdbcType=VARCHAR}
        </foreach>
+       ,DOCUMENT_ID=
+       <foreach close="end" collection="list" index="index" item="item" open="case ACTUAL_NO" separator=" ">
+          when #{item.actualNo,jdbcType=VARCHAR} then #{item.documentId,jdbcType=VARCHAR}
+       </foreach>
      where ACTUAL_NO in 
-     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+     <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
     #{item.actualNo,jdbcType=VARCHAR}
      </foreach> 
   </update>
   <delete id="batchDelete" parameterType="java.util.List">
     delete from METER_WORK_RAILWAY_ACTUAL
     where ACTUAL_NO in 
-    <foreach collection="list" item="id" open="(" close=")" separator=",">
+    <foreach close=")" collection="list" item="id" open="(" separator=",">
       #{id}
     </foreach>
   </delete>
@@ -3755,6 +3779,7 @@
     <if test="railwayNo != null and railwayNo != ''">
       and  RAILWAY_NO like '%${railwayNo}%'
     </if>
+    and value_flag != '0'
   </select>
 
 
@@ -3783,6 +3808,7 @@
     <if test="valueFlag != null and valueFlag != ''">
       and  value_flag = #{valueFlag}
     </if>
+    and value_flag != '0'
     and lc_no is not null
   </select>
 
@@ -3801,6 +3827,7 @@
   <select id="likeByDesc" parameterType="java.util.HashMap" resultMap="BaseResultMap">
     <include refid="select" />
     <include refid="whereLike" />
+    and value_flag != '0'
     order by net_time desc
   </select>
   <select id="selectByAcatualFristNo" parameterType="java.util.HashMap" resultMap="BaseResultMap">

+ 15 - 0
src/main/java/com/steerinfo/meterwork/meterworkrailwayactual/model/MeterWorkRailwayActual.java

@@ -663,6 +663,12 @@ public class MeterWorkRailwayActual implements IBasePO<String> {
     @ApiModelProperty(value="是否已从电子签章系统下载电子磅单",required=false)
     private String isBoundListDownloaded;
 
+    /**
+     * 电子签章系统合同文档ID(DOCUMENT_ID,VARCHAR,50)
+     */
+    @ApiModelProperty(value="电子签章系统合同文档ID",required=false)
+    private String documentId;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -1547,6 +1553,14 @@ public class MeterWorkRailwayActual implements IBasePO<String> {
         this.isBoundListDownloaded = isBoundListDownloaded == null ? null : isBoundListDownloaded.trim();
     }
 
+    public String getDocumentId() {
+        return documentId;
+    }
+
+    public void setDocumentId(String documentId) {
+        this.documentId = documentId == null ? null : documentId.trim();
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -1662,6 +1676,7 @@ public class MeterWorkRailwayActual implements IBasePO<String> {
         sb.append(", isBoundList=").append(isBoundList);
         sb.append(", contractId=").append(contractId);
         sb.append(", isBoundListDownloaded=").append(isBoundListDownloaded);
+        sb.append(", documentId=").append(documentId);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 121 - 286
src/main/java/com/steerinfo/meterwork/meterworkrailwayactual/service/impl/MeterWorkRailwayActualServiceImpl.java

@@ -540,6 +540,12 @@ public class MeterWorkRailwayActualServiceImpl extends BaseServiceImpl<MeterWork
         if (mwcaquery == null) {
             throw new MarkerMetException(500, "不存在对应的洁净数据");
         }
+
+        PreRailwayScale scaleTemp = preRailwayScaleMapper.selectByPrimaryKey(model.getPredictionNo());
+        if(scaleTemp.getValueFlag().equals("9")) {
+            throw new MarkerMetException(500, "两个洁净数据中包含已结算的委托");
+        }
+
         UserPayload payload = UserPayload.getCurrUser();
         String userId = payload.getId();
         String userName = payload.getUserName();
@@ -596,6 +602,16 @@ public class MeterWorkRailwayActualServiceImpl extends BaseServiceImpl<MeterWork
             if (models.size() <= 0 || models == null) {
                 throw new MarkerMetException(500, "参数为空!!!");
             }
+
+            for(MeterWorkRailwayActual model: models) {
+                if (StringUtils.isNotEmpty(model.getPredictionNo())) {
+                    PreRailwayScale scaleTemp = preRailwayScaleMapper.selectByPrimaryKey(model.getPredictionNo());
+                    if(scaleTemp.getValueFlag().equals("9")) {
+                        throw new MarkerMetException(500,"洁净数据中包含已结算的委托!!!");
+                    }
+                }
+            }
+
             for (MeterWorkRailwayActual model : models) {
                 //毛重
                 MeterWorkRailwayActFirst mwcaf1 = meterWorkRailwayActFirstMapper.selectByPrimaryKey(model.getActualFirst1No());
@@ -1754,318 +1770,137 @@ public class MeterWorkRailwayActualServiceImpl extends BaseServiceImpl<MeterWork
             return rm;
         }
         //models必须是2个,而且他们的预报组合号一致
-        if(models.size() != 2 && models.get(0).getPredictionCombination().equals(models.get(1).getPredictionCombination())){
+        if(!models.get(0).getPredictionCombination().equals(models.get(1).getPredictionCombination())){
             rm.setMessage("必须选择两个预报组合号一致的洁净数据!!!");
             return rm;
         }
+        for(MeterWorkRailwayActual modelTemp: models) {
+            PreRailwayScale scaleTemp = preRailwayScaleMapper.selectByPrimaryKey(modelTemp.getPredictionNo());
+            if(scaleTemp.getValueFlag().equals("9")) {
+                rm.setMessage("两个洁净数据中包含已结算的委托!!!");
+                return rm;
+            }
+        }
 
         switch(type){
-            case "5": {
-                //类型为双委托类型
-                for (MeterWorkRailwayActual model: models) {
-                    if(!model.getPredictionType().equals("5")) {
-                        rm.setMessage("选中的计量数据当中有一条或多条不是双委托洁净数据,请确认!!");
-                        return rm;
-                    }
-                }
-                for (MeterWorkRailwayActual model: models) {
-                    //循环每一个洁净记录
-                    //判断委托是否为双委托组合的第二个委托,是:删除一次数据和洁净记录、否:修改一次记录、
-                    String combination = model.getPredictionCombination();
-                    String[] param = combination.split(",");
-
-                    if(model.getPredictionNo().equals(param[1])){
-                        // 改委托
-                        if (StringUtils.isNotEmpty(model.getPredictionNo())) {
-                            PreRailwayScale scale = preRailwayScaleMapper.selectByPrimaryKey(model.getPredictionNo());
-                            scale.setValueFlag("1");
-                            scale.setUploadFlag("1");
-                            scale.setUpdateTime(new Date());
-                            scale.setUpdateManNo("system");
-                            scale.setUpdateManName("双委托解除操作");
-                            preRailwayScaleMapper.updateByPrimaryKeySelective(scale);
-                        }
-                        // 删一次
-                        MeterWorkRailwayActFirst firstGross = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst1No());
-                        MeterWorkRailwayActFirst firstTare = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst2No());
-                        if(firstGross.getPredictionNo().equals(model.getPredictionNo())){
-                            firstGross.setValueFlag(DbConstants.VALID);
-                            firstGross.setNote(model.getNote());
-                            firstGross.setUpdateManName("system");
-                            firstGross.setUpdateManName("双委托解除更新");
-                            firstGross.setUpdateTime(new Date());
-                            firstGross.setIsPreSacale("0");
-                            meterWorkRailwayActFirstMapper.updateByPrimaryKey(firstGross);
-                            //meterWorkRailwayActFirstMapper.deleteByPrimaryKey(model.getActualFirst1No());
-                        }
-                        if(firstTare.getPredictionNo().equals(model.getPredictionNo())){
-                            firstTare.setValueFlag(DbConstants.VALID);
-                            firstTare.setNote(model.getNote());
-                            firstTare.setUpdateManName("system");
-                            firstTare.setUpdateManName("双委托解除更新");
-                            firstTare.setUpdateTime(new Date());
-                            firstTare.setIsPreSacale("0");
-                            meterWorkRailwayActFirstMapper.updateByPrimaryKey(firstTare);
-                            //meterWorkRailwayActFirstMapper.deleteByPrimaryKey(model.getActualFirst2No());
-                        }
-                        model.setUploadFlag("1");
-                        model.setValueFlag("0");
-                        // 删洁净
-                        meterWorkRailwayActualMapper.updateByPrimaryKeySelective(model);
-                        //meterWorkRailwayActualMapper.deleteByPrimaryKey(model.getActualNo());
-                    }
-                    else {
-                        // 清空毛重数据中的委托信息
-                        MeterWorkRailwayActFirst mwcafg = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst1No());
-                        if (mwcafg == null) {
-                            rm.setMessage("未查询到相应的毛重数据!!");
+            case "5":
+            case "6":
+            case "7": {
+                if(type.equals("5")){
+                    //类型为双委托类型
+                    for (MeterWorkRailwayActual model: models) {
+                        if(!model.getPredictionType().equals("5")) {
+                            rm.setMessage("选中的计量数据当中有一条或多条不是双委托洁净数据,请确认!!");
                             return rm;
                         }
-                        mwcafg.setValueFlag(DbConstants.VALID);
-                        mwcafg.setNote(model.getNote());
-                        mwcafg.setUpdateManName("system");
-                        mwcafg.setUpdateManName("双委托解除更新");
-                        mwcafg.setUpdateTime(new Date());
-                        mwcafg.setIsPreSacale("0");
-                        meterWorkRailwayActFirstMapper.updateByPrimaryKey(mwcafg);
-                        //皮重
-                        MeterWorkRailwayActFirst mwcaft = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst2No());
-                        if (mwcaft == null) {
-                            rm.setMessage("未查询到相应的皮重数据!!");
-                            return rm;
-                        }
-                        mwcaft.setValueFlag(DbConstants.VALID);
-                        mwcaft.setUpdateManName("system");
-                        mwcaft.setUpdateManName("双委托解除更新");
-                        mwcaft.setNote(model.getNote());
-                        mwcaft.setUpdateTime(new Date());
-                        mwcaft.setIsPreSacale("0");
-                        meterWorkRailwayActFirstMapper.updateByPrimaryKey(mwcaft);
-                        //修改预报
-                        if (StringUtils.isNotEmpty(model.getPredictionNo())) {
-                            PreRailwayScale scale = preRailwayScaleMapper.selectByPrimaryKey(model.getPredictionNo());
-                            scale.setValueFlag("1");
-                            scale.setUploadFlag("1");
-                            scale.setUpdateTime(new Date());
-                            scale.setUpdateManNo("system");
-                            scale.setUpdateManName("双委托解除操作");
-                            preRailwayScaleMapper.updateByPrimaryKeySelective(scale);
-                        }
-                        model.setUploadFlag("1");
-                        model.setValueFlag("0");
-                        meterWorkRailwayActualMapper.updateByPrimaryKeySelective(model);
-                        //meterWorkRailwayActualMapper.deleteByPrimaryKey(model.getActualNo());
                     }
-                }
-                rm.setSucceed();
-                rm.setMessage("操作成功!!");
-                rm.setCode("200");
-            }
-            break;
-            case "6": {         //类型为混卸类型
-                for (MeterWorkRailwayActual model: models) {
-                    if(!model.getPredictionType().equals("6")) {
-                        rm.setMessage("选中的计量数据当中有一条或多条不是混卸委托洁净数据,请确认!!");
-                    }
-                }
-                for (MeterWorkRailwayActual model: models) {
-                    //循环每一个洁净记录
-                    //判断委托是否为双委托组合的第二个委托,是:删除一次数据和洁净记录、否:修改一次记录、
-                    String combination = model.getPredictionCombination();
-                    String[] param = combination.split(",");
-
-                    if(model.getPredictionNo().equals(param[0])){
-
-                        // 改委托
-                        if (StringUtils.isNotEmpty(model.getPredictionNo())) {
-                            PreRailwayScale scale = preRailwayScaleMapper.selectByPrimaryKey(model.getPredictionNo());
-                            scale.setValueFlag("1");
-                            scale.setUploadFlag("1");
-                            scale.setUpdateTime(new Date());
-                            scale.setUpdateManNo("system");
-                            scale.setUpdateManName("混卸解除操作");
-                            preRailwayScaleMapper.updateByPrimaryKeySelective(scale);
-                        }
-                        // 删一次毛重、清空一次皮重委托信息
-                        MeterWorkRailwayActFirst firstTare = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst2No());
-                        MeterWorkRailwayActFirst firstGross = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst1No());
-                        if(firstTare.getPredictionNo().equals(model.getPredictionNo())){
-                            firstTare.setValueFlag(DbConstants.VALID);
-                            firstTare.setUpdateManName("system");
-                            firstTare.setUpdateManName("混卸解除更新");
-                            firstTare.setNote(model.getNote());
-                            firstTare.setUpdateTime(new Date());
-                            firstTare.setIsPreSacale("0");
-                            meterWorkRailwayActFirstMapper.updateByPrimaryKey(firstTare);
-                            //meterWorkRailwayActFirstMapper.deleteByPrimaryKey(model.getActualFirst2No());
+                } else if(type.equals("6")){
+                    //类型为混卸类型
+                    for (MeterWorkRailwayActual model: models) {
+                        if(!model.getPredictionType().equals("6")) {
+                            rm.setMessage("选中的计量数据当中有一条或多条不是混卸委托洁净数据,请确认!!");
                         }
-                        if(firstGross != null){
-                            firstGross.setValueFlag(DbConstants.VALID);
-                            firstGross.setUpdateManName("system");
-                            firstGross.setUpdateManName("混卸解除更新");
-                            firstGross.setNote(model.getNote());
-                            firstGross.setUpdateTime(new Date());
-                            firstGross.setIsPreSacale("0");
-                            meterWorkRailwayActFirstMapper.updateByPrimaryKey(firstGross);
-                        }
-                        // 删洁净
-                        model.setUploadFlag("1");
-                        model.setValueFlag("0");
-                        meterWorkRailwayActualMapper.updateByPrimaryKeySelective(model);
-                        //meterWorkRailwayActualMapper.deleteByPrimaryKey(model.getActualNo());
                     }
-                    else {
-                        // 清空毛重数据中的委托信息
-                        MeterWorkRailwayActFirst mwcafg = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst1No());
-                        if (mwcafg == null) {
-                            rm.setMessage("未查询到相应的毛重数据!!");
-                            return rm;
-                        }
-                        mwcafg.setValueFlag(DbConstants.VALID);
-                        mwcafg.setNote(model.getNote());
-                        mwcafg.setUpdateManName("system");
-                        mwcafg.setUpdateManName("混卸解除更新");
-                        mwcafg.setUpdateTime(new Date());
-                        mwcafg.setIsPreSacale("0");
-                        meterWorkRailwayActFirstMapper.updateByPrimaryKey(mwcafg);
-                        //皮重
-                        MeterWorkRailwayActFirst mwcaft = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst2No());
-                        if (mwcaft == null) {
-                            rm.setMessage("未查询到相应的皮重数据!!");
-                            return rm;
+                }else if(type.equals("7")){
+                    //类型为混装类型
+                    for (MeterWorkRailwayActual model: models) {
+                        if(!model.getPredictionType().equals("7")) {
+                            rm.setMessage("选中的计量数据当中有一条或多条不是混装委托洁净数据,请确认!!");
                         }
-                        mwcaft.setValueFlag(DbConstants.VALID);
-                        mwcaft.setUpdateManName("system");
-                        mwcaft.setUpdateManName("混卸解除更新");
-                        mwcaft.setNote(model.getNote());
-                        mwcaft.setUpdateTime(new Date());
-                        mwcaft.setIsPreSacale("0");
-                        meterWorkRailwayActFirstMapper.updateByPrimaryKey(mwcaft);
-                        //修改预报
-                        if (StringUtils.isNotEmpty(model.getPredictionNo())) {
-                            PreRailwayScale scale = preRailwayScaleMapper.selectByPrimaryKey(model.getPredictionNo());
-                            scale.setValueFlag("1");
-                            scale.setUploadFlag("1");
-                            scale.setUpdateTime(new Date());
-                            scale.setUpdateManNo("system");
-                            scale.setUpdateManName("混卸解除操作");
-                            preRailwayScaleMapper.updateByPrimaryKeySelective(scale);
-                        }
-                        model.setUploadFlag("1");
-                        model.setValueFlag("0");
-                        meterWorkRailwayActualMapper.updateByPrimaryKeySelective(model);
-                        //meterWorkRailwayActualMapper.deleteByPrimaryKey(model.getActualNo());
                     }
                 }
-                rm.setSucceed();
-                rm.setMessage("操作成功!!");
-                rm.setCode("200");
-            }
-            break;
-            case "7": {         //类型为混装类型
                 for (MeterWorkRailwayActual model: models) {
-                    if(!model.getPredictionType().equals("7")) {
-                        rm.setMessage("选中的计量数据当中有一条或多条不是混装委托洁净数据,请确认!!");
+                    // 改委托
+                    if (StringUtils.isNotEmpty(model.getPredictionNo())) {
+                        removeScaleEl(model.getPredictionNo());
                     }
-                }
-                for (MeterWorkRailwayActual model: models) {
-                    //循环每一个洁净记录
-                    //判断委托是否为双委托组合的第二个委托,是:删除一次数据和洁净记录、否:修改一次记录、
-                    String combination = model.getPredictionCombination();
-                    String[] param = combination.split(",");
-
-                    if(model.getPredictionNo().equals(param[0])){
-
-                        // 改委托
-                        if (StringUtils.isNotEmpty(model.getPredictionNo())) {
-                            PreRailwayScale scale = preRailwayScaleMapper.selectByPrimaryKey(model.getPredictionNo());
-                            scale.setValueFlag("1");
-                            scale.setUploadFlag("1");
-                            scale.setUpdateTime(new Date());
-                            scale.setUpdateManNo("system");
-                            scale.setUpdateManName("混装解除操作");
-                            preRailwayScaleMapper.updateByPrimaryKeySelective(scale);
-                        }
-                        // 删一次毛重、清空一次皮重委托信息
-                        MeterWorkRailwayActFirst firstGross = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst1No());
-                        MeterWorkRailwayActFirst firstTare = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst2No());
-                        if(firstTare.getPredictionNo().equals(model.getPredictionNo())){
-                            firstTare.setValueFlag(DbConstants.VALID);
-                            firstTare.setUpdateManName("system");
-                            firstTare.setUpdateManName("混装解除更新");
-                            firstTare.setNote(model.getNote());
-                            firstTare.setUpdateTime(new Date());
-                            firstTare.setIsPreSacale("0");
-                            meterWorkRailwayActFirstMapper.updateByPrimaryKey(firstTare);
-                            //meterWorkRailwayActFirstMapper.deleteByPrimaryKey(model.getActualFirst2No());
-                        }
-                        if(firstGross != null){
-                            firstGross.setValueFlag(DbConstants.VALID);
-                            firstGross.setUpdateManName("system");
-                            firstGross.setUpdateManName("混装解除更新");
-                            firstGross.setNote(model.getNote());
-                            firstGross.setUpdateTime(new Date());
-                            firstGross.setIsPreSacale("0");
-                            meterWorkRailwayActFirstMapper.updateByPrimaryKey(firstGross);
-                        }
-                        // 删洁净
-                        model.setUploadFlag("1");
-                        model.setValueFlag("0");
-                        meterWorkRailwayActualMapper.updateByPrimaryKeySelective(model);
-                        //meterWorkRailwayActualMapper.deleteByPrimaryKey(model.getActualNo());
+                    // 清空一次毛皮重委托信息
+                    MeterWorkRailwayActFirst firstGross = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst1No());
+                    MeterWorkRailwayActFirst firstTare = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst2No());
+                    if(firstGross != null){
+                        removeFirstEl(firstGross);
+                        meterWorkRailwayActFirstMapper.updateByPrimaryKey(firstGross);
                     }
-                    else {
-                        // 清空毛重数据中的委托信息
-                        MeterWorkRailwayActFirst mwcafg = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst1No());
-                        if (mwcafg == null) {
-                            rm.setMessage("未查询到相应的毛重数据!!");
-                            return rm;
-                        }
-                        mwcafg.setValueFlag(DbConstants.VALID);
-                        mwcafg.setNote(model.getNote());
-                        mwcafg.setUpdateManName("system");
-                        mwcafg.setUpdateManName("混装解除更新");
-                        mwcafg.setUpdateTime(new Date());
-                        mwcafg.setIsPreSacale("0");
-                        meterWorkRailwayActFirstMapper.updateByPrimaryKey(mwcafg);
-                        //皮重
-                        MeterWorkRailwayActFirst mwcaft = meterWorkRailwayActFirstMapper.selectAndRemove(model.getActualFirst2No());
-                        if (mwcaft == null) {
-                            rm.setMessage("未查询到相应的皮重数据!!");
-                            return rm;
-                        }
-                        mwcaft.setValueFlag(DbConstants.VALID);
-                        mwcaft.setUpdateManName("system");
-                        mwcaft.setUpdateManName("混装解除更新");
-                        mwcaft.setNote(model.getNote());
-                        mwcaft.setUpdateTime(new Date());
-                        mwcaft.setIsPreSacale("0");
-                        meterWorkRailwayActFirstMapper.updateByPrimaryKey(mwcaft);
-                        //修改预报
-                        if (StringUtils.isNotEmpty(model.getPredictionNo())) {
-                            PreRailwayScale scale = preRailwayScaleMapper.selectByPrimaryKey(model.getPredictionNo());
-                            scale.setValueFlag("1");
-                            scale.setUploadFlag("1");
-                            scale.setUpdateTime(new Date());
-                            scale.setUpdateManNo("system");
-                            scale.setUpdateManName("混装解除操作");
-                            preRailwayScaleMapper.updateByPrimaryKeySelective(scale);
-                        }
-                        model.setUploadFlag("1");
-                        model.setValueFlag("0");
-                        meterWorkRailwayActualMapper.updateByPrimaryKeySelective(model);
-                        //meterWorkRailwayActualMapper.deleteByPrimaryKey(model.getActualNo());
+                    if(firstTare != null){
+                        removeFirstEl(firstTare);
+                        meterWorkRailwayActFirstMapper.updateByPrimaryKey(firstTare);
                     }
+                    removeEl(model);
+                    meterWorkRailwayActualMapper.updateByPrimaryKeySelective(model);
                 }
                 rm.setSucceed();
                 rm.setMessage("操作成功!!");
                 rm.setCode("200");
             }
-            break;
         }
         return rm;
     }
 
+    //还原委托
+    public void removeScaleEl(String predictionNo){
+        String userId;
+        String userName;
+        try{
+            UserPayload payload = UserPayload.getCurrUser();
+            userId = payload.getId();
+            userName = payload.getUserName();
+        }catch(Exception e) {
+            userId = "admin";
+            userName = "admins";
+        }
+        PreRailwayScale scale = preRailwayScaleMapper.selectByPrimaryKey(predictionNo);
+        scale.setValueFlag("1");
+        scale.setUploadFlag("1");
+        scale.setUpdateTime(new Date());
+        scale.setUpdateManNo(userId);
+        scale.setUpdateManName(userName);
+        preRailwayScaleMapper.updateByPrimaryKeySelective(scale);
+    }
+
+    //还原一次
+    public void removeFirstEl(MeterWorkRailwayActFirst model) {
+        String userId;
+        String userName;
+        try{
+            UserPayload payload = UserPayload.getCurrUser();
+            userId = payload.getId();
+            userName = payload.getUserName();
+        }catch(Exception e) {
+            userId = "admin";
+            userName = "admins";
+        }
+        model.setValueFlag("0");
+        model.setUpdateManName(userId);
+        model.setUpdateManName(userName);
+        model.setUpdateTime(new Date());
+        model.setIsPreSacale("0");
+    }
+
+    //还原洁净
+    public void removeEl(MeterWorkRailwayActual model) {
+        String userId;
+        String userName;
+        try{
+            UserPayload payload = UserPayload.getCurrUser();
+            userId = payload.getId();
+            userName = payload.getUserName();
+        }catch(Exception e) {
+            userId = "admin";
+            userName = "admins";
+        }
+        model.setUpdateManNo(userId);
+        model.setUpdateManName(userName);
+        model.setUpdateTime(new Date());
+        model.setUploadFlag("1");
+        model.setIsPreSacale("0");
+        model.setValueFlag("0");
+        model.setIsBoundList("0");
+        model.setBoundListUrl("");
+        model.setContractNo("");
+        model.setIsBoundListDownloaded("0");
+        model.setDocumentId("");
+    }
+
     @Override
     public PageList<MeterWorkRailwayActual> likeByDesc(Map<String, Object> parameters, Integer pageNum, Integer pageSize) {
         PageHelper.startPage(pageNum, pageSize);