Ver Fonte

'APP销售运输预约'

HUJIANGUO há 3 anos atrás
pai
commit
7a7712036d

+ 7 - 0
src/main/java/com/steerinfo/dil/controller/AmsDispatchSaleOrderController.java

@@ -48,6 +48,13 @@ public class AmsDispatchSaleOrderController extends BaseRESTfulController {
         return success(list);
     }
 
+    @ApiOperation(value="查询app端已抢的销售订单")
+    @PostMapping("/getLockDispatchSaleOrderList")
+    public RESTfulResult getLockDispatchSaleOrderList(Integer carrierId){
+        List<Map<String, Object>> list = amsDispatchSaleOrderService.getLockDispatchSaleOrderList(carrierId);
+        return success(list);
+    }
+
     @ApiOperation(value="抢单/接收订单锁定")
     @PostMapping("/lockDispatchSaleOrder")
     public RESTfulResult lockDispatchSaleOrder(@RequestParam Integer dispatchId,

+ 3 - 0
src/main/java/com/steerinfo/dil/mapper/AmsDispatchSaleOrderMapper.java

@@ -22,4 +22,7 @@ public interface AmsDispatchSaleOrderMapper extends IBaseMapper<AmsDispatchSaleO
     List<Map<String, Object>> getDispatchSaleOrderList();
 
     List<Map<String,Object>> getMaterialMessages(BigDecimal dispatchId);
+
+    // 查询app端已抢的销售订单
+    List<Map<String, Object>> getLockDispatchSaleOrderList(BigDecimal carrierId);
 }

+ 7 - 0
src/main/java/com/steerinfo/dil/service/IAmsDispatchSaleOrderService.java

@@ -43,4 +43,11 @@ public interface IAmsDispatchSaleOrderService{
      * @return
      */
     int lockDispatchSaleOrder(BigDecimal dispatchId,BigDecimal carrierId);
+
+    /**
+     * 查询app端已抢的销售订单
+     * @param carrierId
+     * @return
+     */
+    List<Map<String, Object>> getLockDispatchSaleOrderList(Integer carrierId);
 }

+ 94 - 7
src/main/java/com/steerinfo/dil/service/impl/AmsDispatchSaleOrderServiceImpl.java

@@ -75,15 +75,34 @@ public class AmsDispatchSaleOrderServiceImpl extends BaseServiceImpl<AmsDispatch
                 isDeal = "未成交";
             }
             map.put("isDeal",isDeal);
-            // 先把map中的key-value放到新的saleMap里面
-            Map<String,Object> saleMap = new HashMap<>();
-            saleMap.putAll(map);
+//            // 先把map中的key-value放到新的saleMap里面
+//            Map<String,Object> saleMap = new HashMap<>();
+//            saleMap.putAll(map);
             // 使用Map清空工具迭代删除map中的所有key-value
-            MapRemoveUtil.removeMap(map);
+//            MapRemoveUtil.removeMap(map);
             List<Map<String, Object>> materialMessages = amsDispatchSaleOrderMapper.getMaterialMessages(dispatchId);
-            // 将已经清空的map里面put进一个map和一个list<Map>
-            map.put("materialMessages",materialMessages);
-            map.put("saleMap",saleMap);
+            String allMaterialName = "";
+            String allMaterialNumber = "";
+            String allMaterialTheoreticalWeight = "";
+            for (Map<String,Object> materialMap : materialMessages) {
+                String materialName = (String) materialMap.get("materialName");
+                allMaterialName += materialName + "/";
+                String materialTheoreticalWeight = materialMap.get("materialTheoreticalWeight").toString();
+                if (materialTheoreticalWeight != null) {
+                    allMaterialTheoreticalWeight += materialTheoreticalWeight + "/";
+                }
+                String saleOrderMaterialNumber =  materialMap.get("saleOrderMaterialNumber").toString();
+                allMaterialNumber += saleOrderMaterialNumber + "/";
+            }
+            String subMaterialName = allMaterialName.substring(0,allMaterialName.length() - 2);
+            String subMaterialNumber = allMaterialNumber.substring(0,allMaterialNumber.length() - 2);
+            String subMaterialTheoreticalWeight = allMaterialTheoreticalWeight.substring(0,allMaterialTheoreticalWeight.length() - 2);
+//            // 将已经清空的map里面put进一个map和一个list<Map>
+//            map.put("materialMessages",materialMessages);
+//            map.put("saleMap",saleMap);
+            map.put("allMaterialName",subMaterialName);
+            map.put("allMaterialNumber",subMaterialNumber);
+            map.put("allMaterialTheoreticalWeight",subMaterialTheoreticalWeight);
         }
         return dispatchSaleOrderList;
     }
@@ -100,7 +119,75 @@ public class AmsDispatchSaleOrderServiceImpl extends BaseServiceImpl<AmsDispatch
         amsDispatchSaleOrder.setDispatchDealTime(new Date());
         amsDispatchSaleOrder.setCarrierId(carrierId);
         amsDispatchSaleOrder.setDispatchStatus(new BigDecimal(1));
+        amsDispatchSaleOrder.setUpdateTime(new Date());
         int result = amsDispatchSaleOrderMapper.updateByPrimaryKeySelective(amsDispatchSaleOrder);
         return result;
     }
+
+    /**
+     * 查询app端已抢的销售订单
+     * @param carrierId
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getLockDispatchSaleOrderList(Integer carrierId) {
+        List<Map<String,Object>> mapList = amsDispatchSaleOrderMapper.getLockDispatchSaleOrderList(new BigDecimal(carrierId));
+        if (mapList == null) {
+            return null;
+        }
+        for (Map<String, Object> map : mapList) {
+            BigDecimal dispatchId = (BigDecimal) map.get("dispatchId");
+            List<Map<String, Object>> materialMessages = amsDispatchSaleOrderMapper.getMaterialMessages(dispatchId);
+            String allMaterialName = "";
+            String allMaterialNumber = "";
+            String allMaterialTheoreticalWeight = "";
+            if (materialMessages != null) {
+                for (Map<String, Object> materialMap : materialMessages) {
+                    if (materialMap != null) {
+                        String materialName = (String) materialMap.get("materialName");
+                        allMaterialName += materialName + "/";
+                        String materialTheoreticalWeight = materialMap.get("materialTheoreticalWeight").toString();
+                        if (materialTheoreticalWeight != null) {
+                            allMaterialTheoreticalWeight += materialTheoreticalWeight + "/";
+                        }
+                        String saleOrderMaterialNumber = materialMap.get("saleOrderMaterialNumber").toString();
+                        allMaterialNumber += saleOrderMaterialNumber + "/";
+                    }
+                }
+                String subMaterialName = null;
+                String subMaterialNumber = null;
+                String subMaterialTheoreticalWeight = null;
+                if (allMaterialName.length() >= 2) {
+                    subMaterialName = allMaterialName.substring(0, allMaterialName.length() - 2);
+                }
+                if (allMaterialName.length() < 2) {
+                    subMaterialName = allMaterialName;
+                }
+                if (allMaterialNumber.length() >= 2) {
+                    subMaterialNumber = allMaterialNumber.substring(0, allMaterialNumber.length() - 2);
+                }
+                if (allMaterialNumber.length() < 2) {
+                    subMaterialName = allMaterialNumber;
+                }
+                if (allMaterialTheoreticalWeight.length() >= 2) {
+                    subMaterialTheoreticalWeight = allMaterialTheoreticalWeight.substring(0, allMaterialTheoreticalWeight.length() - 2);
+                }
+                if (allMaterialTheoreticalWeight.length() < 2) {
+                    subMaterialName = allMaterialTheoreticalWeight;
+                }
+                map.put("allMaterialName",subMaterialName);
+                map.put("allMaterialNumber",subMaterialNumber);
+                map.put("allMaterialTheoreticalWeight",subMaterialTheoreticalWeight);
+            }
+//            // 将已经清空的map里面put进一个map和一个list<Map>
+//            map.put("materialMessages",materialMessages);
+//            map.put("saleMap",saleMap);
+            else {
+                map.put("allMaterialName",allMaterialName);
+                map.put("allMaterialNumber",allMaterialNumber);
+                map.put("allMaterialTheoreticalWeight",allMaterialTheoreticalWeight);
+            }
+        }
+        return mapList;
+    }
 }

+ 132 - 48
src/main/resources/com/steerinfo/dil/mapper/AmsDispatchSaleOrderMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.steerinfo.dil.mapper.AmsDispatchSaleOrderMapper">
     <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsDispatchSaleOrder">
         <id column="DISPATCH_ID" jdbcType="DECIMAL" property="dispatchId"/>
-        <result column="SALE_ORDER_ID" jdbcType="DECIMAL" property="saleOrderId"/>
+        <result column="SALE_ORDER_MATERIAL_ID" jdbcType="DECIMAL" property="saleOrderMaterialId"/>
         <result column="CARRIER_ID" jdbcType="DECIMAL" property="carrierId"/>
         <result column="DISPATCH_TIME" jdbcType="TIMESTAMP" property="dispatchTime"/>
         <result column="DISPATCH_DEAL_TIME" jdbcType="TIMESTAMP" property="dispatchDealTime"/>
@@ -12,14 +12,18 @@
         <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername"/>
         <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
         <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark"/>
+        <result column="DISPATCH_TYPE" jdbcType="DECIMAL" property="dispatchType"/>
+        <result column="DISPATCH_STATUS" jdbcType="DECIMAL" property="dispatchStatus"/>
     </resultMap>
     <sql id="columns">
-        DISPATCH_ID, SALE_ORDER_ID, CARRIER_ID, DISPATCH_TIME, DISPATCH_DEAL_TIME, INSERT_USERNAME,
-    INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
+        DISPATCH_ID, SALE_ORDER_MATERIAL_ID, CARRIER_ID, DISPATCH_TIME, DISPATCH_DEAL_TIME,
+    INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
+    DISPATCH_TYPE, DISPATCH_STATUS
     </sql>
     <sql id="columns_alias">
-        t.DISPATCH_ID, t.SALE_ORDER_ID, t.CARRIER_ID, t.DISPATCH_TIME, t.DISPATCH_DEAL_TIME,
-    t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
+        t.DISPATCH_ID, t.SALE_ORDER_MATERIAL_ID, t.CARRIER_ID, t.DISPATCH_TIME, t.DISPATCH_DEAL_TIME,
+    t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
+    t.DISPATCH_TYPE, t.DISPATCH_STATUS
     </sql>
     <sql id="select">
         SELECT
@@ -36,8 +40,8 @@
             <if test="dispatchId != null">
                 and DISPATCH_ID = #{dispatchId}
             </if>
-            <if test="saleOrderId != null">
-                and SALE_ORDER_ID = #{saleOrderId}
+            <if test="saleOrderMaterialId != null">
+                and SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
             </if>
             <if test="carrierId != null">
                 and CARRIER_ID = #{carrierId}
@@ -63,6 +67,12 @@
             <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
                 and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
             </if>
+            <if test="dispatchType != null">
+                and DISPATCH_TYPE = #{dispatchType}
+            </if>
+            <if test="dispatchStatus != null">
+                and DISPATCH_STATUS = #{dispatchStatus}
+            </if>
         </where>
     </sql>
     <sql id="whereLike">
@@ -70,8 +80,8 @@
             <if test="dispatchId != null">
                 and DISPATCH_ID = #{dispatchId}
             </if>
-            <if test="saleOrderId != null">
-                and SALE_ORDER_ID = #{saleOrderId}
+            <if test="saleOrderMaterialId != null">
+                and SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
             </if>
             <if test="carrierId != null">
                 and CARRIER_ID = #{carrierId}
@@ -97,6 +107,12 @@
             <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
                 and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
             </if>
+            <if test="dispatchType != null">
+                and DISPATCH_TYPE = #{dispatchType}
+            </if>
+            <if test="dispatchStatus != null">
+                and DISPATCH_STATUS = #{dispatchStatus}
+            </if>
         </where>
     </sql>
     <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
@@ -107,8 +123,8 @@
     <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
         delete from AMS_DISPATCH_SALE_ORDER
         where 1!=1
-        <if test="saleOrderId != null">
-            or SALE_ORDER_ID = #{saleOrderId}
+        <if test="saleOrderMaterialId != null">
+            or SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
         </if>
         <if test="carrierId != null">
             or CARRIER_ID = #{carrierId}
@@ -134,17 +150,27 @@
         <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
             or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
         </if>
+        <if test="dispatchType != null">
+            or DISPATCH_TYPE = #{dispatchType}
+        </if>
+        <if test="dispatchStatus != null">
+            or DISPATCH_STATUS = #{dispatchStatus}
+        </if>
     </delete>
     <insert id="insert" parameterType="com.steerinfo.dil.model.AmsDispatchSaleOrder">
-        insert into AMS_DISPATCH_SALE_ORDER (DISPATCH_ID, SALE_ORDER_ID, CARRIER_ID,
-                                             DISPATCH_TIME, DISPATCH_DEAL_TIME, INSERT_USERNAME,
-                                             INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
-                                             INSERT_UPDATE_REMARK)
-        values (#{dispatchId,jdbcType=DECIMAL}, #{saleOrderId,jdbcType=DECIMAL}, #{carrierId,jdbcType=DECIMAL},
-                #{dispatchTime,jdbcType=TIMESTAMP}, #{dispatchDealTime,jdbcType=TIMESTAMP},
-                #{insertUsername,jdbcType=VARCHAR},
-                #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
-                #{insertUpdateRemark,jdbcType=VARCHAR})
+        insert into AMS_DISPATCH_SALE_ORDER (DISPATCH_ID, SALE_ORDER_MATERIAL_ID,
+                                             CARRIER_ID, DISPATCH_TIME, DISPATCH_DEAL_TIME,
+                                             INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
+                                             UPDATE_TIME, INSERT_UPDATE_REMARK, DISPATCH_TYPE,
+                                             DISPATCH_STATUS)
+        values (#{dispatchId,jdbcType=DECIMAL}, #{saleOrderMaterialId,jdbcType=DECIMAL},
+                #{carrierId,jdbcType=DECIMAL}, #{dispatchTime,jdbcType=TIMESTAMP},
+                #{dispatchDealTime,jdbcType=TIMESTAMP},
+                #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
+                #{updateUsername,jdbcType=VARCHAR},
+                #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
+                #{dispatchType,jdbcType=DECIMAL},
+                #{dispatchStatus,jdbcType=DECIMAL})
     </insert>
     <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsDispatchSaleOrder">
         insert into AMS_DISPATCH_SALE_ORDER
@@ -152,8 +178,8 @@
             <if test="dispatchId != null">
                 DISPATCH_ID,
             </if>
-            <if test="saleOrderId != null">
-                SALE_ORDER_ID,
+            <if test="saleOrderMaterialId != null">
+                SALE_ORDER_MATERIAL_ID,
             </if>
             <if test="carrierId != null">
                 CARRIER_ID,
@@ -179,13 +205,19 @@
             <if test="insertUpdateRemark != null">
                 INSERT_UPDATE_REMARK,
             </if>
+            <if test="dispatchType != null">
+                DISPATCH_TYPE,
+            </if>
+            <if test="dispatchStatus != null">
+                DISPATCH_STATUS,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="dispatchId != null">
                 #{dispatchId,jdbcType=DECIMAL},
             </if>
-            <if test="saleOrderId != null">
-                #{saleOrderId,jdbcType=DECIMAL},
+            <if test="saleOrderMaterialId != null">
+                #{saleOrderMaterialId,jdbcType=DECIMAL},
             </if>
             <if test="carrierId != null">
                 #{carrierId,jdbcType=DECIMAL},
@@ -211,26 +243,34 @@
             <if test="insertUpdateRemark != null">
                 #{insertUpdateRemark,jdbcType=VARCHAR},
             </if>
+            <if test="dispatchType != null">
+                #{dispatchType,jdbcType=DECIMAL},
+            </if>
+            <if test="dispatchStatus != null">
+                #{dispatchStatus,jdbcType=DECIMAL},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsDispatchSaleOrder">
         update AMS_DISPATCH_SALE_ORDER
-        set SALE_ORDER_ID        = #{saleOrderId,jdbcType=DECIMAL},
-            CARRIER_ID           = #{carrierId,jdbcType=DECIMAL},
-            DISPATCH_TIME        = #{dispatchTime,jdbcType=TIMESTAMP},
-            DISPATCH_DEAL_TIME   = #{dispatchDealTime,jdbcType=TIMESTAMP},
-            INSERT_USERNAME      = #{insertUsername,jdbcType=VARCHAR},
-            INSERT_TIME          = #{insertTime,jdbcType=TIMESTAMP},
-            UPDATE_USERNAME      = #{updateUsername,jdbcType=VARCHAR},
-            UPDATE_TIME          = #{updateTime,jdbcType=TIMESTAMP},
-            INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
+        set SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId,jdbcType=DECIMAL},
+            CARRIER_ID             = #{carrierId,jdbcType=DECIMAL},
+            DISPATCH_TIME          = #{dispatchTime,jdbcType=TIMESTAMP},
+            DISPATCH_DEAL_TIME     = #{dispatchDealTime,jdbcType=TIMESTAMP},
+            INSERT_USERNAME        = #{insertUsername,jdbcType=VARCHAR},
+            INSERT_TIME            = #{insertTime,jdbcType=TIMESTAMP},
+            UPDATE_USERNAME        = #{updateUsername,jdbcType=VARCHAR},
+            UPDATE_TIME            = #{updateTime,jdbcType=TIMESTAMP},
+            INSERT_UPDATE_REMARK   = #{insertUpdateRemark,jdbcType=VARCHAR},
+            DISPATCH_TYPE          = #{dispatchType,jdbcType=DECIMAL},
+            DISPATCH_STATUS        = #{dispatchStatus,jdbcType=DECIMAL}
         where DISPATCH_ID = #{dispatchId,jdbcType=DECIMAL}
     </update>
     <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsDispatchSaleOrder">
         update AMS_DISPATCH_SALE_ORDER
         <set>
-            <if test="saleOrderId != null">
-                SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL},
+            <if test="saleOrderMaterialId != null">
+                SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId,jdbcType=DECIMAL},
             </if>
             <if test="carrierId != null">
                 CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
@@ -256,6 +296,12 @@
             <if test="insertUpdateRemark != null">
                 INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
             </if>
+            <if test="dispatchType != null">
+                DISPATCH_TYPE = #{dispatchType,jdbcType=DECIMAL},
+            </if>
+            <if test="dispatchStatus != null">
+                DISPATCH_STATUS = #{dispatchStatus,jdbcType=DECIMAL},
+            </if>
         </set>
         where DISPATCH_ID = #{dispatchId,jdbcType=DECIMAL}
     </update>
@@ -274,20 +320,21 @@
     <insert id="batchInsert" parameterType="java.util.List">
         insert into AMS_DISPATCH_SALE_ORDER
         (DISPATCH_ID,
-        SALE_ORDER_ID, CARRIER_ID, DISPATCH_TIME,
-        DISPATCH_DEAL_TIME, INSERT_USERNAME,
-        INSERT_TIME, UPDATE_USERNAME,
-        UPDATE_TIME, INSERT_UPDATE_REMARK
-        )
+        SALE_ORDER_MATERIAL_ID, CARRIER_ID,
+        DISPATCH_TIME, DISPATCH_DEAL_TIME,
+        INSERT_USERNAME, INSERT_TIME,
+        UPDATE_USERNAME, UPDATE_TIME,
+        INSERT_UPDATE_REMARK, DISPATCH_TYPE,
+        DISPATCH_STATUS)
         ( <foreach collection="list" item="item" separator="union all">
         select
         #{item.dispatchId,jdbcType=DECIMAL},
-        #{item.saleOrderId,jdbcType=DECIMAL}, #{item.carrierId,jdbcType=DECIMAL},
-        #{item.dispatchTime,jdbcType=TIMESTAMP},
-        #{item.dispatchDealTime,jdbcType=TIMESTAMP}, #{item.insertUsername,jdbcType=VARCHAR},
-        #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
-        #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR}
-        from dual
+        #{item.saleOrderMaterialId,jdbcType=DECIMAL}, #{item.carrierId,jdbcType=DECIMAL},
+        #{item.dispatchTime,jdbcType=TIMESTAMP}, #{item.dispatchDealTime,jdbcType=TIMESTAMP},
+        #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
+        #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
+        #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.dispatchType,jdbcType=DECIMAL},
+        #{item.dispatchStatus,jdbcType=DECIMAL} from dual
     </foreach> )
     </insert>
     <update id="batchUpdate" parameterType="java.util.List">
@@ -297,9 +344,9 @@
         <foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
             when #{item.dispatchId,jdbcType=DECIMAL} then #{item.dispatchId,jdbcType=DECIMAL}
         </foreach>
-        ,SALE_ORDER_ID=
+        ,SALE_ORDER_MATERIAL_ID=
         <foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
-            when #{item.dispatchId,jdbcType=DECIMAL} then #{item.saleOrderId,jdbcType=DECIMAL}
+            when #{item.dispatchId,jdbcType=DECIMAL} then #{item.saleOrderMaterialId,jdbcType=DECIMAL}
         </foreach>
         ,CARRIER_ID=
         <foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
@@ -333,6 +380,14 @@
         <foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
             when #{item.dispatchId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
         </foreach>
+        ,DISPATCH_TYPE=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
+            when #{item.dispatchId,jdbcType=DECIMAL} then #{item.dispatchType,jdbcType=DECIMAL}
+        </foreach>
+        ,DISPATCH_STATUS=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
+            when #{item.dispatchId,jdbcType=DECIMAL} then #{item.dispatchStatus,jdbcType=DECIMAL}
+        </foreach>
         where DISPATCH_ID in
         <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
             #{item.dispatchId,jdbcType=DECIMAL}
@@ -401,4 +456,33 @@
                            ON RM.MATERIAL_ID = ASTM.MATERIAL_ID
         WHERE ADSO.DISPATCH_ID = #{dispatchId}
     </select>
+
+    <!-- 查询app端已抢的销售订单 -->
+    <select id="getLockDispatchSaleOrderList" parameterType="DECIMAL" resultType="java.util.Map">
+        SELECT ADSO.DISPATCH_ID                  AS "dispatchId",
+               ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "saleOrderMaterialTruckNo",
+               ASO.SALE_NUMBER                   AS "saleNumber",
+               ADSO.DISPATCH_DEAL_TIME           AS "dispatchDealTime",
+               RSH.SHIPPER_NAME                  AS "shipperName",
+               RC.CONSIGNEE_COMPANY_NAME         AS "consigneeCompanyName",
+               RRA.ADDRESS_DELIVERY_ADDRESS      AS "addressDeliveryAddress",
+               ASOM.SALE_ORDER_CONSIGNEE         AS "saleOrderConsignee",
+               ASOM.SALE_ORDER_CONSIGNEE_TEL     AS "saleOrderConsigneeTel",
+               RCA.CARRIER_NAME                  AS "carrierName"
+        FROM AMS_DISPATCH_SALE_ORDER ADSO
+                 LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+                           ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+                 LEFT JOIN AMS_SALE_ORDER ASO
+                           ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
+                 LEFT JOIN RMS_SHIPPER RSH
+                           ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
+                 LEFT JOIN RMS_CONSIGNEE RC
+                           ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
+                 LEFT JOIN RMS_RECEIVE_ADDRESS RRA
+                           ON ASOM.SALE_SHIPPING_ADDRESS_ID = RRA.ADDRESS_ID
+                 LEFT JOIN RMS_CARRIER RCA
+                           ON RCA.CARRIER_ID = ADSO.CARRIER_ID
+        WHERE ADSO.DISPATCH_STATUS = 1
+          AND ADSO.CARRIER_ID = #{carrierId}
+    </select>
 </mapper>