txf 3 年之前
父节点
当前提交
182640ef6d

+ 5 - 0
src/main/java/com/steerinfo/dil/mapper/UtilsMapper.java

@@ -29,6 +29,7 @@ public interface UtilsMapper {
 
     //通过运输Id 或者运输订单号修改 路段顺序号
     int updateLineSeqByOrderIdOrNum(Map<String, Object> map);
+    int updateLineSeqByOrderIdOrNum2(Map<String, Object> map);
 
     //通过运力ID 或车牌号 修改运力状态
     int updateCapacityByCarIdOrNum(Map<String, Object> map);
@@ -68,4 +69,8 @@ public interface UtilsMapper {
 
     //查询订单是否已经签收过
     Integer checkoutReceipt(String orderNumber);
+
+    //通过订单号查询订单路段顺序号
+    Integer getLineSequenceByOrderNumber(String orderNumber);
+
 }

+ 32 - 1
src/main/java/com/steerinfo/dil/model/TmstruckWeightResult.java

@@ -3,6 +3,7 @@ package com.steerinfo.dil.model;
 import com.steerinfo.framework.model.IBasePO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -21,7 +22,7 @@ public class TmstruckWeightResult implements IBasePO<BigDecimal> {
     private BigDecimal resultTotalId;
 
     /**
-     * 磅单号(RESULT_POUND_NO,VARCHAR,20)
+     * 磅单号(RESULT_POUND_NO,VARCHAR,100)
      */
     @ApiModelProperty(value="磅单号",required=false)
     private String resultPoundNo;
@@ -128,6 +129,18 @@ public class TmstruckWeightResult implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="是否完成扣水扣杂(0:否,1:是)",required=false)
     private BigDecimal isquality;
 
+    /**
+     * 毛重路段顺序号(GROSS_SEGMENT_SQE,DECIMAL,0)
+     */
+    @ApiModelProperty(value="毛重路段顺序号",required=false)
+    private BigDecimal grossSegmentSqe;
+
+    /**
+     * 皮重路段顺序号(TARE_SEGMENT_SQE,DECIMAL,0)
+     */
+    @ApiModelProperty(value="皮重路段顺序号",required=false)
+    private BigDecimal tareSegmentSqe;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -300,6 +313,22 @@ public class TmstruckWeightResult implements IBasePO<BigDecimal> {
         this.isquality = isquality;
     }
 
+    public BigDecimal getGrossSegmentSqe() {
+        return grossSegmentSqe;
+    }
+
+    public void setGrossSegmentSqe(BigDecimal grossSegmentSqe) {
+        this.grossSegmentSqe = grossSegmentSqe;
+    }
+
+    public BigDecimal getTareSegmentSqe() {
+        return tareSegmentSqe;
+    }
+
+    public void setTareSegmentSqe(BigDecimal tareSegmentSqe) {
+        this.tareSegmentSqe = tareSegmentSqe;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -326,6 +355,8 @@ public class TmstruckWeightResult implements IBasePO<BigDecimal> {
         sb.append(", materialId=").append(materialId);
         sb.append(", isdeduct=").append(isdeduct);
         sb.append(", isquality=").append(isquality);
+        sb.append(", grossSegmentSqe=").append(grossSegmentSqe);
+        sb.append(", tareSegmentSqe=").append(tareSegmentSqe);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 54 - 20
src/main/java/com/steerinfo/dil/service/impl/TmstruckWeightResultServiceImpl.java

@@ -119,27 +119,14 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
      */
     public String addTruckWeightResult(Map<String, Object> map) {
         //首先通过运输订单号查询订单类型
-        Map<String, Object> oneMap = utilsMapper.getOrderTypeByOrderNumber((String) map.get("orderNumber"));
+        Map<String, Object> oneMap = utilsMapper.getOrderTypeByOrderNumber((String) map.get("orderNumber")); //用于判断订单类型
         if(oneMap == null){
             return map.get("orderNumber") + "系统无此订单";
         }
         Integer orderType= DataChange.dataToBigDecimal(oneMap.get("orderType")).intValue();
-//        if(orderType == 11){
-//            TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
-//            tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
-//            tmstruckWeightResult.setMaterialId(DataChange.dataToBigDecimal(map.get("materialId")));
-//            //首先查询这个订单号的这个物资ID是否有计量实绩
-//            Map<String, Object> twoMap = tmstruckWeightResultMapper.selectResultIdByOrderNoAndMaterialId(map);
-//            if(twoMap == null){//如果查出来为空,则进行新增操作
-//                tmstruckWeightResult.setId(tmstruckWeightResultMapper.selectMaxId()); //新增主键
-//                tmstruckWeightResult.setResultTotalId(DataChange.dataToBigDecimal(oneMap.get("totalId"))); //新增总实绩ID
-//                try {
-//                    addWeightResult(tmstruckWeightResult, map);
-//                } catch (Exception e) {
-//                    e.printStackTrace();
-//                }
-//            }
-//        }
+        if(orderType == 11){
+            return insertWeightResultBy11(map, oneMap);
+        }
         //通过运输订单号查询计量实绩Id
         Map<String, Object> stringObjectMap = tmstruckWeightResultMapper.selectWeightIdByOrderId(map);
         if(stringObjectMap == null){
@@ -384,14 +371,61 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
     }
 
     /**
+     * 纯内转订单类型
      * @Author TXF
      * @Date 2022/2/18 9:55
-     * @param tmstruckWeightResult
      * @param map
      * @return
      **/
-    public void insertWeightResultBy11(TmstruckWeightResult tmstruckWeightResult, Map<String, Object> map){
-
+    public String insertWeightResultBy11(Map<String, Object> map, Map<String, Object> oneMap){
+        TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
+        tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
+        tmstruckWeightResult.setMaterialId(DataChange.dataToBigDecimal(map.get("materialId")));
+        Integer sqe = DataChange.dataToBigDecimal(oneMap.get("Sqe")).intValue(); //获取订单路段顺序号
+        sqe = sqe + 1;
+        Map<String, Object> threeMap = new HashMap<>(); //用于更新路段顺序号
+        threeMap.put("orderLineSequence", sqe);
+        threeMap.put("orderNumber", map.get("orderNumber"));
+        utilsMapper.updateLineSeqByOrderIdOrNum2(threeMap); //更新订单路段顺序号
+        //首先查询这个订单号的这个物资ID是否有计量实绩
+        Map<String, Object> twoMap = tmstruckWeightResultMapper.selectResultIdByOrderNoAndMaterialId(map); //判断这个物资是否已经计量过
+        Object resultCrossWeightTime = map.get("resultCrossWeightTime");
+        if(twoMap == null){//如果查出来为空,则进行新增操作
+            tmstruckWeightResult.setId(tmstruckWeightResultMapper.selectMaxId()); //新增主键
+            tmstruckWeightResult.setResultTotalId(DataChange.dataToBigDecimal(oneMap.get("totalId"))); //新增总实绩ID
+            if(resultCrossWeightTime == null || "".equals(String.valueOf(resultCrossWeightTime))){//只有一条数据的情况
+                tmstruckWeightResult.setTareSegmentSqe(new BigDecimal(sqe));
+            }
+            else {
+                tmstruckWeightResult.setTareSegmentSqe(new BigDecimal(sqe));
+                tmstruckWeightResult.setGrossSegmentSqe(new BigDecimal(sqe));
+            }
+            try {
+                addWeightResult(tmstruckWeightResult, map);
+            } catch (Exception e) {
+                return e.getMessage();
+            }
+            tmstruckWeightResultMapper.insertSelective(tmstruckWeightResult); //新增计量实绩
+        }else {
+            //如果不为空则证明进行过至少一次计量
+            tmstruckWeightResult.setId(DataChange.dataToBigDecimal(twoMap.get("weightTaskResultId")));
+            //取出计量数据与传进来的毛皮数据进行对比
+            BigDecimal inTareWeight = DataChange.dataToBigDecimal(twoMap.get("resultTareWeight"));
+            if(inTareWeight.compareTo(DataChange.dataToBigDecimal(map.get("resultTareWeight"))) > 0){
+                //如果取出来的皮重 大于 传进来的皮重   则需要调换路段顺序号
+                tmstruckWeightResult.setGrossSegmentSqe(DataChange.dataToBigDecimal(twoMap.get("tareSegmentSqe")));
+                tmstruckWeightResult.setTareSegmentSqe(new BigDecimal(sqe));
+            }
+            try {
+                addWeightResult(tmstruckWeightResult, map);
+            } catch (Exception e) {
+                return e.getMessage();
+            }
+            tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
+        }
+        //推送数据
+        utilsService.pushMesToWebsocket((String) oneMap.get("capacityNumber"), "计量");
+        return map.get("orderNumber") + "成功";
     }
 
     /**

+ 93 - 42
src/main/resources/com/steerinfo/dil/mapper/TmstruckWeightResultMapper.xml

@@ -22,25 +22,28 @@
         <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
         <result column="ISDEDUCT" jdbcType="DECIMAL" property="isdeduct" />
         <result column="ISQUALITY" jdbcType="DECIMAL" property="isquality" />
+        <result column="GROSS_SEGMENT_SQE" jdbcType="DECIMAL" property="grossSegmentSqe" />
+        <result column="TARE_SEGMENT_SQE" jdbcType="DECIMAL" property="tareSegmentSqe" />
     </resultMap>
     <sql id="columns">
         WEIGHT_TASK_RESULT_ID, RESULT_TOTAL_ID, RESULT_POUND_NO, RESULT_GROSS_WEIGHT, RESULT_GROSS_WEIGHT_TIME,
     RESULT_TARE_WEIGHT, RESULT_TARE_WEIGHT_TIME, RESULT_NET_WEIGHT, INSERT_USERNAME,
     INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, DELETE_NAME, DELETE_TIME,
-    RESULT_GROSS_PLACE_ID, RESULT_TARE_PLACE_ID, MATERIAL_ID, ISDEDUCT, ISQUALITY
+    RESULT_GROSS_PLACE_ID, RESULT_TARE_PLACE_ID, MATERIAL_ID, ISDEDUCT, ISQUALITY, GROSS_SEGMENT_SQE,
+    TARE_SEGMENT_SQE
     </sql>
     <sql id="columns_alias">
         t.WEIGHT_TASK_RESULT_ID, t.RESULT_TOTAL_ID, t.RESULT_POUND_NO, t.RESULT_GROSS_WEIGHT,
     t.RESULT_GROSS_WEIGHT_TIME, t.RESULT_TARE_WEIGHT, t.RESULT_TARE_WEIGHT_TIME, t.RESULT_NET_WEIGHT,
     t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
     t.DELETE_NAME, t.DELETE_TIME, t.RESULT_GROSS_PLACE_ID, t.RESULT_TARE_PLACE_ID, t.MATERIAL_ID,
-    t.ISDEDUCT, t.ISQUALITY
+    t.ISDEDUCT, t.ISQUALITY, t.GROSS_SEGMENT_SQE, t.TARE_SEGMENT_SQE
     </sql>
     <sql id="select">
-        SELECT <include refid="columns" /> FROM TMSTRUCK_WEIGHT_RESULT
+        SELECT <include refid="columns"/> FROM TMSTRUCK_WEIGHT_RESULT
     </sql>
     <sql id="select_alias">
-        SELECT <include refid="columns_alias" /> FROM TMSTRUCK_WEIGHT_RESULT t
+        SELECT <include refid="columns_alias"/> FROM TMSTRUCK_WEIGHT_RESULT t
     </sql>
     <sql id="where">
         <where>
@@ -104,6 +107,12 @@
             <if test="isquality != null">
                 and ISQUALITY = #{isquality}
             </if>
+            <if test="grossSegmentSqe != null">
+                and GROSS_SEGMENT_SQE = #{grossSegmentSqe}
+            </if>
+            <if test="tareSegmentSqe != null">
+                and TARE_SEGMENT_SQE = #{tareSegmentSqe}
+            </if>
         </where>
     </sql>
     <sql id="whereLike">
@@ -168,9 +177,15 @@
             <if test="isquality != null">
                 and ISQUALITY = #{isquality}
             </if>
+            <if test="grossSegmentSqe != null">
+                and GROSS_SEGMENT_SQE = #{grossSegmentSqe}
+            </if>
+            <if test="tareSegmentSqe != null">
+                and TARE_SEGMENT_SQE = #{tareSegmentSqe}
+            </if>
         </where>
     </sql>
-    <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
         delete from TMSTRUCK_WEIGHT_RESULT
         where WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL}
     </delete>
@@ -234,6 +249,12 @@
         <if test="isquality != null">
             or ISQUALITY = #{isquality}
         </if>
+        <if test="grossSegmentSqe != null">
+            or GROSS_SEGMENT_SQE = #{grossSegmentSqe}
+        </if>
+        <if test="tareSegmentSqe != null">
+            or TARE_SEGMENT_SQE = #{tareSegmentSqe}
+        </if>
     </delete>
     <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckWeightResult">
         insert into TMSTRUCK_WEIGHT_RESULT (WEIGHT_TASK_RESULT_ID, RESULT_TOTAL_ID,
@@ -243,7 +264,8 @@
                                             UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
                                             DELETE_NAME, DELETE_TIME, RESULT_GROSS_PLACE_ID,
                                             RESULT_TARE_PLACE_ID, MATERIAL_ID, ISDEDUCT,
-                                            ISQUALITY)
+                                            ISQUALITY, GROSS_SEGMENT_SQE, TARE_SEGMENT_SQE
+        )
         values (#{weightTaskResultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL},
                 #{resultPoundNo,jdbcType=VARCHAR}, #{resultGrossWeight,jdbcType=DECIMAL}, #{resultGrossWeightTime,jdbcType=TIMESTAMP},
                 #{resultTareWeight,jdbcType=DECIMAL}, #{resultTareWeightTime,jdbcType=TIMESTAMP},
@@ -251,7 +273,8 @@
                 #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
                 #{deleteName,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{resultGrossPlaceId,jdbcType=DECIMAL},
                 #{resultTarePlaceId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}, #{isdeduct,jdbcType=DECIMAL},
-                #{isquality,jdbcType=DECIMAL})
+                #{isquality,jdbcType=DECIMAL}, #{grossSegmentSqe,jdbcType=DECIMAL}, #{tareSegmentSqe,jdbcType=DECIMAL}
+               )
     </insert>
     <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckWeightResult">
         insert into TMSTRUCK_WEIGHT_RESULT
@@ -316,6 +339,12 @@
             <if test="isquality != null">
                 ISQUALITY,
             </if>
+            <if test="grossSegmentSqe != null">
+                GROSS_SEGMENT_SQE,
+            </if>
+            <if test="tareSegmentSqe != null">
+                TARE_SEGMENT_SQE,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="weightTaskResultId != null">
@@ -378,6 +407,12 @@
             <if test="isquality != null">
                 #{isquality,jdbcType=DECIMAL},
             </if>
+            <if test="grossSegmentSqe != null">
+                #{grossSegmentSqe,jdbcType=DECIMAL},
+            </if>
+            <if test="tareSegmentSqe != null">
+                #{tareSegmentSqe,jdbcType=DECIMAL},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckWeightResult">
@@ -400,7 +435,9 @@
             RESULT_TARE_PLACE_ID = #{resultTarePlaceId,jdbcType=DECIMAL},
             MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
             ISDEDUCT = #{isdeduct,jdbcType=DECIMAL},
-            ISQUALITY = #{isquality,jdbcType=DECIMAL}
+            ISQUALITY = #{isquality,jdbcType=DECIMAL},
+            GROSS_SEGMENT_SQE = #{grossSegmentSqe,jdbcType=DECIMAL},
+            TARE_SEGMENT_SQE = #{tareSegmentSqe,jdbcType=DECIMAL}
         where WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL}
     </update>
     <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckWeightResult">
@@ -463,20 +500,26 @@
             <if test="isquality != null">
                 ISQUALITY = #{isquality,jdbcType=DECIMAL},
             </if>
+            <if test="grossSegmentSqe != null">
+                GROSS_SEGMENT_SQE = #{grossSegmentSqe,jdbcType=DECIMAL},
+            </if>
+            <if test="tareSegmentSqe != null">
+                TARE_SEGMENT_SQE = #{tareSegmentSqe,jdbcType=DECIMAL},
+            </if>
         </set>
         where WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL}
     </update>
-    <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
-        <include refid="select" />
+    <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
+        <include refid="select"/>
         where WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL}
     </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 TMSTRUCK_WEIGHT_RESULT
@@ -489,7 +532,8 @@
         UPDATE_TIME, INSERT_UPDATE_REMARK,
         DELETE_NAME, DELETE_TIME, RESULT_GROSS_PLACE_ID,
         RESULT_TARE_PLACE_ID, MATERIAL_ID,
-        ISDEDUCT, ISQUALITY)
+        ISDEDUCT, ISQUALITY, GROSS_SEGMENT_SQE,
+        TARE_SEGMENT_SQE)
         ( <foreach collection="list" item="item" separator="union all">
         select
         #{item.weightTaskResultId,jdbcType=DECIMAL},
@@ -501,101 +545,110 @@
         #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
         #{item.deleteName,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=TIMESTAMP}, #{item.resultGrossPlaceId,jdbcType=DECIMAL},
         #{item.resultTarePlaceId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL},
-        #{item.isdeduct,jdbcType=DECIMAL}, #{item.isquality,jdbcType=DECIMAL} from dual
+        #{item.isdeduct,jdbcType=DECIMAL}, #{item.isquality,jdbcType=DECIMAL}, #{item.grossSegmentSqe,jdbcType=DECIMAL},
+        #{item.tareSegmentSqe,jdbcType=DECIMAL} from dual
     </foreach> )
     </insert>
     <update id="batchUpdate" parameterType="java.util.List">
         update TMSTRUCK_WEIGHT_RESULT
         set
         WEIGHT_TASK_RESULT_ID=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.weightTaskResultId,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_TOTAL_ID=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_POUND_NO=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultPoundNo,jdbcType=VARCHAR}
         </foreach>
         ,RESULT_GROSS_WEIGHT=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultGrossWeight,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_GROSS_WEIGHT_TIME=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultGrossWeightTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_TARE_WEIGHT=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultTareWeight,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_TARE_WEIGHT_TIME=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultTareWeightTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_NET_WEIGHT=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultNetWeight,jdbcType=DECIMAL}
         </foreach>
         ,INSERT_USERNAME=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
         </foreach>
         ,INSERT_TIME=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
         </foreach>
         ,UPDATE_USERNAME=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
         </foreach>
         ,UPDATE_TIME=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
         </foreach>
         ,INSERT_UPDATE_REMARK=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
         </foreach>
         ,DELETE_NAME=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.deleteName,jdbcType=VARCHAR}
         </foreach>
         ,DELETE_TIME=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.deleteTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_GROSS_PLACE_ID=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultGrossPlaceId,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_TARE_PLACE_ID=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultTarePlaceId,jdbcType=DECIMAL}
         </foreach>
         ,MATERIAL_ID=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
         </foreach>
         ,ISDEDUCT=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.isdeduct,jdbcType=DECIMAL}
         </foreach>
         ,ISQUALITY=
-        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.isquality,jdbcType=DECIMAL}
         </foreach>
+        ,GROSS_SEGMENT_SQE=
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+            when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.grossSegmentSqe,jdbcType=DECIMAL}
+        </foreach>
+        ,TARE_SEGMENT_SQE=
+        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+            when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.tareSegmentSqe,jdbcType=DECIMAL}
+        </foreach>
         where WEIGHT_TASK_RESULT_ID in
-        <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
+        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
             #{item.weightTaskResultId,jdbcType=DECIMAL}
         </foreach>
     </update>
     <delete id="batchDelete" parameterType="java.util.List">
         delete from TMSTRUCK_WEIGHT_RESULT
         where WEIGHT_TASK_RESULT_ID in
-        <foreach close=")" collection="list" item="id" open="(" separator=",">
+        <foreach collection="list" item="id" open="(" close=")" separator=",">
             #{id}
         </foreach>
     </delete>
@@ -724,7 +777,6 @@
                         OO.ORDER_TYPE             "orderTypee",
                         TWR.WEIGHT_TASK_RESULT_ID "weightTaskResultId",
                         TTR.RESULT_TOTAL_ID       "resultTotalId",
-                        RC.CAPACITY_NUMBER        "capacityNumber",
                         TWR.TARE_SEGMENT_SQE      "tareSegmentSqe",
                         TWR.GROSS_SEGMENT_SQE     "grossSegmentSqe"
 
@@ -733,8 +785,6 @@
                                     on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
                           left join OMSTRUCK_ORDER OO
                                     on OO.ORDER_ID = TTR.ORDER_ID
-                          left join RMS_CAPACITY RC
-                                    on RC.CAPACITY_ID = OO.CAPACITY_ID
                  where OO.ORDER_NUMBER = #{orderNumber}
                    and TWR.RESULT_NET_WEIGHT is null
                  order by "tareSegmentSqe"
@@ -788,7 +838,8 @@
 
     <select id="selectResultIdByOrderNoAndMaterialId" parameterType="map" resultType="java.util.Map">
         select TWR.WEIGHT_TASK_RESULT_ID    "weightTaskResultId",
-                TTR.RESULT_TOTAL_ID         "resultTotalId"
+               TWR.RESULT_TARE_WEIGHT       "resultTareWeight",
+               TWR.TARE_SEGMENT_SQE         "tareSegmentSqe"
         from OMSTRUCK_ORDER OO
             left join TMSTRUCK_TOTAL_RESULT TTR
                 on TTR.ORDER_ID = OO.ORDER_ID

+ 18 - 2
src/main/resources/com/steerinfo/dil/mapper/UtilsMapper.xml

@@ -37,6 +37,12 @@
         where OO.ORDER_ID = #{orderId}
     </update>
 
+    <update id="updateLineSeqByOrderIdOrNum2" parameterType="java.util.Map">
+        update OMSTRUCK_ORDER OO
+        set OO.ORDER_LINE_SEQUENCE = #{orderLineSequence}
+        where OO.ORDER_NUMBER = #{orderNumber}
+    </update>
+
 <!--   通过仓库名称查询仓库Id -->
     <select id="queryWarehouseIdByName" parameterType="string" resultType="java.lang.Integer">
         select RW.WAREHOUSE_ID
@@ -148,12 +154,22 @@
         where OO.ORDER_NUMBER = #{orderNumber} and TRR.status = 1
     </select>
 
+    <select id="getLineSequenceByOrderNumber" parameterType="string" resultType="java.lang.Integer">
+        select OO.ORDER_LINE_SEQUENCE
+        from OMSTRUCK_ORDER OO
+        where OO.ORDER_NUMBER = #{orderNumber}
+    </select>
+
     <select id="getOrderTypeByOrderNumber" parameterType="string" resultType="map">
         select OO.ORDER_TYPE "orderType",
-               TTR.RESULT_TOTAL_ID  "totalId"
+               TTR.RESULT_TOTAL_ID  "totalId",
+               Rc.CAPACITY_NUMBER   "capacityNumber",
+               OO.ORDER_LINE_SEQUENCE   "Sqe"
         from OMSTRUCK_ORDER OO
                  left join TMSTRUCK_TOTAL_RESULT TTR
                            on TTR.ORDER_ID = OO.ORDER_ID
-        where  OO.ORDER_ID=#{orderNumber}
+                 left join RMS_CAPACITY RC
+                           on RC.CAPACITY_ID = OO.CAPACITY_ID
+        where  OO.ORDER_NUMBER = #{orderNumber}
     </select>
 </mapper>