Jelajahi Sumber

更换签收表

txf 3 tahun lalu
induk
melakukan
2cd1e2390e

+ 1 - 1
pom.xml

@@ -156,7 +156,7 @@
                     <!--包名-->
                     <targetPackage>com.steerinfo.dil</targetPackage>
                     <tables>
-<!--                        <param>AMS_CONTAACT_PRICE_MATERIAL</param>-->
+                        <param>TMSTRUCK_RECEIVE_RESULT</param>
 
                     </tables>
                 </configuration>

+ 0 - 4
src/main/java/com/steerinfo/dil/mapper/TmstruckReceiptResultMapper.java

@@ -21,14 +21,10 @@ public interface TmstruckReceiptResultMapper extends IBaseMapper<TmstruckReceipt
     //计皮完成后 通过总实绩ID 更新状态 为 1
     int updateByTotalResultId(TmstruckReceiptResult tmstruckReceiptResult);
 
-    //查询所有收货实绩
-    List<Map<String, Object>> getCGReceiptResult(Map<String, Object> map);
 
     //查询内转钢材到异地库收货实绩
     List<Map<String, Object>> getSteelNzReceiptResult(Map<String, Object> map);
 
-    //获取内转收货实绩
-    List<Map<String, Object>> getInwardReceipt(Map<String, Object> map);
 
     //查询是否已收过货
     Integer getReceiptResult(BigDecimal resultTotalId);

+ 8 - 0
src/main/java/com/steerinfo/dil/mapper/TmstruckReceiveResultMapper.java

@@ -6,6 +6,8 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Select;
 
 import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface TmstruckReceiveResultMapper extends IBaseMapper<TmstruckReceiveResult, BigDecimal> {
@@ -16,4 +18,10 @@ public interface TmstruckReceiveResultMapper extends IBaseMapper<TmstruckReceive
 
     //通过总实绩Id查询主键Id
     BigDecimal getReceiveResult(BigDecimal totalResultId);
+
+    //查询所有收货实绩
+    List<Map<String, Object>> getCGReceiveResult(Map<String, Object> map);
+
+    //获取内转收货实绩
+    List<Map<String, Object>> getInwardReceive(Map<String, Object> map);
 }

+ 27 - 23
src/main/java/com/steerinfo/dil/service/impl/TmstruckReceiptResultServiceImpl.java

@@ -1,6 +1,7 @@
 package com.steerinfo.dil.service.impl;
 
 import com.steerinfo.dil.mapper.TmstruckReceiptResultMapper;
+import com.steerinfo.dil.mapper.TmstruckReceiveResultMapper;
 import com.steerinfo.dil.mapper.UtilsMapper;
 import com.steerinfo.dil.model.TmstruckReceiptResult;
 import com.steerinfo.dil.service.ITmstruckReceiptResultService;
@@ -36,6 +37,9 @@ public class TmstruckReceiptResultServiceImpl implements ITmstruckReceiptResultS
     @Autowired
     private UtilsMapper utilsMapper;
 
+    @Autowired
+    private TmstruckReceiveResultMapper tmstruckReceiveResultMapper;
+
     @Autowired
     private TmstruckArrivalResultMapper tmstruckArrivalResultMapper;
 
@@ -89,10 +93,10 @@ public class TmstruckReceiptResultServiceImpl implements ITmstruckReceiptResultS
             case 8:
             case 17:
             case 18:
-                return tmstruckReceiptResultMapper.getCGReceiptResult(map); //apiId: 107
+                return tmstruckReceiveResultMapper.getCGReceiveResult(map); //apiId: 107
             case 9:
             case 10:
-                return tmstruckReceiptResultMapper.getInwardReceipt(map); //apiId: 107
+                return tmstruckReceiveResultMapper.getInwardReceive(map); //apiId: 107
             case 11:
 
         }
@@ -104,33 +108,33 @@ public class TmstruckReceiptResultServiceImpl implements ITmstruckReceiptResultS
      * @param  {resultTotalId:总实绩ID}
      * @return
      */
-    public int addReceiptResult(BigDecimal resultTotalId){
-        //根据总实绩ID查询收货实绩查看是否已收货
-        Integer receiptResult = tmstruckReceiptResultMapper.getReceiptResult(resultTotalId);
-        if(receiptResult != null){
-            return 0;
-        }
-        //新增完卸车实绩后新增一条收货实绩
-        TmstruckReceiptResult tmstruckReceiptResult = new TmstruckReceiptResult();
-        tmstruckReceiptResult.setId(tmstruckReceiptResultMapper.selectMaxId());//添加主键
-        tmstruckReceiptResult.setResultTotalId(resultTotalId);//添加总实绩Id
-        tmstruckReceiptResult.setStatus(new BigDecimal(0)); // 卸货完成后添加的为虚拟收货实绩
-        return tmstruckReceiptResultMapper.insertSelective(tmstruckReceiptResult);
-    }
+//    public int addReceiptResult(BigDecimal resultTotalId){
+//        //根据总实绩ID查询收货实绩查看是否已收货
+//        Integer receiptResult = tmstruckReceiptResultMapper.getReceiptResult(resultTotalId);
+//        if(receiptResult != null){
+//            return 0;
+//        }
+//        //新增完卸车实绩后新增一条收货实绩
+//        TmstruckReceiptResult tmstruckReceiptResult = new TmstruckReceiptResult();
+//        tmstruckReceiptResult.setId(tmstruckReceiptResultMapper.selectMaxId());//添加主键
+//        tmstruckReceiptResult.setResultTotalId(resultTotalId);//添加总实绩Id
+//        tmstruckReceiptResult.setStatus(new BigDecimal(0)); // 卸货完成后添加的为虚拟收货实绩
+//        return tmstruckReceiptResultMapper.insertSelective(tmstruckReceiptResult);
+//    }
 
     /**
      * 确认收货(修改收货实绩为真实收货实绩)
      * @param map {resultTotalId:总实绩ID}
      * @return
      */
-    public int updateReceiptResult(Map<String, Object> map){
-        TmstruckReceiptResult tmstruckReceiptResult = new TmstruckReceiptResult();
-        tmstruckReceiptResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
-        tmstruckReceiptResult.setStatus(new BigDecimal(1));
-        tmstruckReceiptResult.setInsertUsername("admin");
-        tmstruckReceiptResult.setInsertTime(new Date());
-        return tmstruckReceiptResultMapper.updateByTotalResultId(tmstruckReceiptResult);
-    }
+//    public int updateReceiptResult(Map<String, Object> map){
+//        TmstruckReceiptResult tmstruckReceiptResult = new TmstruckReceiptResult();
+//        tmstruckReceiptResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
+//        tmstruckReceiptResult.setStatus(new BigDecimal(1));
+//        tmstruckReceiptResult.setInsertUsername("admin");
+//        tmstruckReceiptResult.setInsertTime(new Date());
+//        return tmstruckReceiptResultMapper.updateByTotalResultId(tmstruckReceiptResult);
+//    }
 
     /**
      * 新增钢材到异地库达州站驻港人员确定收货

+ 1 - 1
src/main/java/com/steerinfo/dil/service/impl/TmstruckReceiveResultServiceImpl.java

@@ -35,7 +35,7 @@ public class TmstruckReceiveResultServiceImpl{
      * @param  {resultTotalId:总实绩ID}
      * @return
      */
-    public int addReceiptResult(BigDecimal resultTotalId){
+    public int addReceiveResult(BigDecimal resultTotalId){
         //根据总实绩ID查询收货实绩查看是否已收货
         BigDecimal receiveResult = tmstruckReceiveResultMapper.getReceiveResult(resultTotalId);
         if(receiveResult != null){

+ 4 - 1
src/main/java/com/steerinfo/dil/service/impl/TmstruckUnloadResultServiceImpl.java

@@ -38,6 +38,9 @@ public class TmstruckUnloadResultServiceImpl implements ITmstruckUnloadResultSer
     @Autowired
     private TmstruckReceiptResultServiceImpl tmstruckReceiptResultService;
 
+    @Autowired
+    private TmstruckReceiveResultServiceImpl tmstruckReceiveResultService;
+
     @Autowired
     private TmstruckLoadResultMapper tmstruckLoadResultMapper;
 
@@ -206,7 +209,7 @@ public class TmstruckUnloadResultServiceImpl implements ITmstruckUnloadResultSer
             case 17:
             case 18:
             case 20:
-                tmstruckReceiptResultService.addReceiptResult(DataChange.dataToBigDecimal(map.get("resultTotalId"))); //新增完卸车实绩后新增一条收货实绩
+                tmstruckReceiveResultService.addReceiveResult(DataChange.dataToBigDecimal(map.get("resultTotalId"))); //新增完卸车实绩后新增一条收货实绩
                 break;
         }
         //卸货成功后推送消息给websocket

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -1,7 +1,7 @@
 api.version: api/v1/truckTms
 spring:
   profiles:
-    include: ${SPRING_PROFILES:prod}
+    include: ${SPRING_PROFILES:dev}
   jackson:
     date-format: yyyy-MM-dd HH:mm:ss
     time-zone: GMT+8

+ 0 - 209
src/main/resources/com/steerinfo/dil/mapper/TmstruckReceiptResultMapper.xml

@@ -480,104 +480,6 @@
     </if>
   </sql>
 
-<!--  查询所有签收实绩 -->
-  <select id="getCGReceiptResult" parameterType="java.util.Map" resultType="java.util.Map">
-    select
-           *
-    from (
-           select
-                  OO.ORDER_ID                  "orderId",
-                    TRR.RESULT_ID               "resultId",
-                  APO.PURCHASE_ORDER_NO       "purchaseOrderNo",
-                  RM.MATERIAL_NAME            "materialName",
-                  OO.ORDER_NUMBER             "orderNumber",
-                  RC.CAPACITY_NUMBER          "capacityNumber",
-                  DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
-                  TUR.UNLOAD_STATUS           "unloadStatus",
-                  TWR.RESULT_NET_WEIGHT       "resultNetWeight",
-                  RW.WAREHOUSE_NAME           "warehouseName",
-                  TRR.INSERT_USERNAME         "insertUsername",
-                  TRR.INSERT_TIME             "insertTime"
-           from TMSTRUCK_RECEIPT_RESULT TRR
-                  left join TMSTRUCK_TOTAL_RESULT TTR
-                            on TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
-                  left join OMSTRUCK_ORDER OO
-                            on OO.ORDER_ID = TTR.ORDER_ID
-                  left join AMS_PURCHASE_ORDER APO
-                            on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
-                  left join DIL_BATCH DB
-                            on DB.BATCH_ID = APO.BATCH_ID
-                  left join RMS_CAPACITY RC
-                            on RC.CAPACITY_ID = OO.CAPACITY_ID
-                  left join TMSTRUCK_WEIGHT_RESULT TWR
-                            on TWR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
-                  left join TMSTRUCK_UNLOAD_RESULT TUR
-                            on TUR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
-                  left join OMSTRUCK_ORDER_MATERIAL OOM
-                            on OOM.ORDER_ID = OO.ORDER_ID
-                  left join RMS_MATERIAL RM
-                            on OOM.MATERIAL_ID = RM.MATERIAL_ID
-                  left join RMS_WAREHOUSE RW
-                            on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
-                where TRR.STATUS = 1 and OO.ORDER_TYPE = #{orderTypee}
-         )
-        <where>
-          <if test="purchaseOrderNo != null">
-            <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
-              "purchaseOrderNo" like '%${item}%'
-            </foreach>
-          </if>
-          <if test="materialName != null">
-            and
-            <foreach collection="materialName" item="item" open="(" separator="or" close=")">
-              "materialName" like '%${item}%'
-            </foreach>
-          </if>
-          <if test="orderNumber != null">
-            and
-            <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-              "orderNumber" like '%${item}%'
-            </foreach>
-          </if>
-          <if test="capacityNumber != null">
-            and
-            <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
-              "capacityNumber" like '%${item}%'
-            </foreach>
-          </if>
-          <if test="resultForeignShipName != null">
-            and
-            <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
-              "resultForeignShipName" like '%${item}%'
-            </foreach>
-          </if>
-          <if test="unloadStatus != null">
-            and
-            <foreach collection="unloadStatus" item="item" open="(" separator="or" close=")">
-              "unloadStatus" like '%${item}%'
-            </foreach>
-          </if>
-          <if test="resultNetWeight != null">
-            and
-            <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
-              "resultNetWeight" like '%${item}%'
-            </foreach>
-          </if>
-          <if test="warehouseName != null">
-            and
-            <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
-              "warehouseName" like '%${item}%'
-            </foreach>
-          </if>
-          <if test="insertUsername != null">
-            and
-            <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
-              "insertUsername" like '%${item}%'
-            </foreach>
-          </if>
-        </where>
-        <include refid="orderBy"></include>
-  </select>
 
 <!--  查询内转钢材到异地库收货实绩-->
     <select id="getSteelNzReceiptResult" parameterType="java.util.Map" resultType="java.util.Map">
@@ -635,117 +537,6 @@
       <include refid="orderBy"></include>
     </select>
 
-  <select id="getInwardReceipt" parameterType="java.util.Map" resultType="java.util.Map">
-
-    select *
-    from (
-           select TRR.RESULT_ID               "resultId",
-                  APO.PURCHASE_ORDER_NO       "purchaseOrderNo",
-                  RM.MATERIAL_NAME            "materialName",
-                  OO.ORDER_NUMBER             "orderNumber",
-                  RC.CAPACITY_NUMBER          "capacityNumber",
-                  DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
-                  TUR.UNLOAD_STATUS           "unloadStatus",
-                  TWR.RESULT_NET_WEIGHT       "resultNetWeight",
-                  tqr.result_issampling       "issampling",
-                  TRR.INSERT_USERNAME         "insertUsername",
-                  TRR.INSERT_TIME             "insertTime",
-                  RW.WAREHOUSE_NAME           "warehouseName"
-           from TMSTRUCK_RECEIPT_RESULT TRR
-                  left join TMSTRUCK_TOTAL_RESULT TTR
-                            on TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
-                  left join OMSTRUCK_ORDER OO
-                            on OO.ORDER_ID = TTR.ORDER_ID
-                  left join AMSTRUCK_INWARD_PLAN AIP
-                            on AIP.PLAN_ID = OO.ORDER_PLAN_ID
-                  left join AMSTRUCK_REQUIREMENT_PLAN ARP
-                            on ARP.PLAN_ID = AIP.PLAN_ID
-                  left join AMSTRUCK_INWARD_REQUIREMENT AIR
-                            on AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
-                  left join AMS_PURCHASE_ORDER APO
-                            on APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
-                  left join DIL_BATCH DB
-                            on DB.BATCH_ID = APO.BATCH_ID
-                  left join RMS_CAPACITY RC
-                            on RC.CAPACITY_ID = OO.CAPACITY_ID
-                  left join TMSTRUCK_WEIGHT_RESULT TWR
-                            on TWR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
-                  left join TMSTRUCK_UNLOAD_RESULT TUR
-                            on TUR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
-                  left join OMSTRUCK_ORDER_MATERIAL OOM
-                            on OOM.ORDER_ID = OO.ORDER_ID
-                  left join RMS_MATERIAL RM
-                            on OOM.MATERIAL_ID = RM.MATERIAL_ID
-                  left join tmstruck_quality_result tqr
-                            on tqr.total_result_id = ttr.result_total_id
-                  left join RMS_WAREHOUSE RW
-                            on TUR.RESULT_UNLOAD_PLACE_ID = RW.WAREHOUSE_ID
-           where TRR.STATUS = 1
-             and OO.ORDER_TYPE = #{orderTypee}
-         )
-    <where>
-      <if test="materialName != null">
-        <foreach collection="materialName" item="item" open="(" separator="or" close=")">
-          "materialName" like '%${item}%'
-        </foreach>
-      </if>
-      <if test="purchaseOrderNo != null">
-        and
-        <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
-          "purchaseOrderNo" like '%${item}%'
-        </foreach>
-      </if>
-      <if test="orderNumber != null">
-        and
-        <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-          "orderNumber" like '%${item}%'
-        </foreach>
-      </if>
-      <if test="capacityNumber != null">
-        and
-        <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
-          "capacityNumber" like '%${item}%'
-        </foreach>
-      </if>
-      <if test="resultForeignShipName != null">
-        and
-        <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
-          "resultForeignShipName" like '%${item}%'
-        </foreach>
-      </if>
-      <if test="unloadStatus != null">
-        and
-        <foreach collection="unloadStatus" item="item" open="(" separator="or" close=")">
-          "unloadStatus" like '%${item}%'
-        </foreach>
-      </if>
-      <if test="resultNetWeight != null">
-        and
-        <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
-          "resultNetWeight" like '%${item}%'
-        </foreach>
-      </if>
-      <if test="issampling != null">
-        and
-        <foreach collection="issampling" item="item" open="(" separator="or" close=")">
-          "issampling" like '%${item}%'
-        </foreach>
-      </if>
-      <if test="insertUsername != null">
-        and
-        <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
-          "insertUsername" like '%${item}%'
-        </foreach>
-      </if>
-      <if test="insertTime != null">
-        and
-        <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
-          "insertTime" like '%${item}%'
-        </foreach>
-      </if>
-    </where>
-    <include refid="orderBy"></include>
-  </select>
 
 <!-- 查询是否已收过货 -->
     <select id="getReceiptResult" parameterType="java.math.BigDecimal" resultType="java.lang.Integer">

+ 225 - 0
src/main/resources/com/steerinfo/dil/mapper/TmstruckReceiveResultMapper.xml

@@ -350,4 +350,229 @@
     where TRR.RESULT_TOTAL_ID = #{resultTotalId}
   </select>
 
+  <!--  查询所有签收实绩 -->
+  <select id="getCGReceiveResult" parameterType="java.util.Map" resultType="java.util.Map">
+    select
+    *
+    from (
+    select
+    OO.ORDER_ID                  "orderId",
+    TRR.RESULT_RECEIVE_ID               "resultId",
+    APO.PURCHASE_ORDER_NO       "purchaseOrderNo",
+    RM.MATERIAL_NAME            "materialName",
+    OO.ORDER_NUMBER             "orderNumber",
+    RC.CAPACITY_NUMBER          "capacityNumber",
+    DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
+    TUR.UNLOAD_STATUS           "unloadStatus",
+    TWR.RESULT_NET_WEIGHT       "resultNetWeight",
+    RW.WAREHOUSE_NAME           "warehouseName",
+    TRR.INSERT_USERNAME         "insertUsername",
+    TRR.INSERT_TIME             "insertTime"
+    from TMSTRUCK_RECEIVE_RESULT TRR
+    left join TMSTRUCK_TOTAL_RESULT TTR
+    on TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
+    left join OMSTRUCK_ORDER OO
+    on OO.ORDER_ID = TTR.ORDER_ID
+    left join AMS_PURCHASE_ORDER APO
+    on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
+    left join DIL_BATCH DB
+    on DB.BATCH_ID = APO.BATCH_ID
+    left join RMS_CAPACITY RC
+    on RC.CAPACITY_ID = OO.CAPACITY_ID
+    left join TMSTRUCK_WEIGHT_RESULT TWR
+    on TWR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
+    left join TMSTRUCK_UNLOAD_RESULT TUR
+    on TUR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
+    left join OMSTRUCK_ORDER_MATERIAL OOM
+    on OOM.ORDER_ID = OO.ORDER_ID
+    left join RMS_MATERIAL RM
+    on OOM.MATERIAL_ID = RM.MATERIAL_ID
+    left join RMS_WAREHOUSE RW
+    on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
+    where TRR.STATUS = 1 and OO.ORDER_TYPE = #{orderTypee}
+    )
+    <where>
+      <if test="purchaseOrderNo != null">
+        <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
+          "purchaseOrderNo" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialName != null">
+        and
+        <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+          "materialName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="orderNumber != null">
+        and
+        <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+          "orderNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="capacityNumber != null">
+        and
+        <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+          "capacityNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultForeignShipName != null">
+        and
+        <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
+          "resultForeignShipName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="unloadStatus != null">
+        and
+        <foreach collection="unloadStatus" item="item" open="(" separator="or" close=")">
+          "unloadStatus" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultNetWeight != null">
+        and
+        <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
+          "resultNetWeight" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="warehouseName != null">
+        and
+        <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
+          "warehouseName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="insertUsername != null">
+        and
+        <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
+          "insertUsername" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
+  </select>
+
+  <!--  通过签收时间排序 -->
+  <sql id="orderBy">
+    <if test="orderField != null and orderField != ''">
+      order by "${orderField}"
+      <if test="orderType != null and orderType != ''">
+        ${orderType}
+      </if>
+    </if>
+    <if test="orderField == null  ">
+      order by "insertTime" desc
+    </if>
+  </sql>
+
+
+  <select id="getInwardReceive" parameterType="java.util.Map" resultType="java.util.Map">
+
+    select *
+    from (
+    select TRR.RESULT_RECEIVE_ID       "resultId",
+    APO.PURCHASE_ORDER_NO       "purchaseOrderNo",
+    RM.MATERIAL_NAME            "materialName",
+    OO.ORDER_NUMBER             "orderNumber",
+    RC.CAPACITY_NUMBER          "capacityNumber",
+    DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
+    TUR.UNLOAD_STATUS           "unloadStatus",
+    TWR.RESULT_NET_WEIGHT       "resultNetWeight",
+    tqr.result_issampling       "issampling",
+    TRR.INSERT_USERNAME         "insertUsername",
+    TRR.INSERT_TIME             "insertTime",
+    RW.WAREHOUSE_NAME           "warehouseName"
+    from TMSTRUCK_RECEIVE_RESULT TRR
+    left join TMSTRUCK_TOTAL_RESULT TTR
+    on TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
+    left join OMSTRUCK_ORDER OO
+    on OO.ORDER_ID = TTR.ORDER_ID
+    left join AMSTRUCK_INWARD_PLAN AIP
+    on AIP.PLAN_ID = OO.ORDER_PLAN_ID
+    left join AMSTRUCK_REQUIREMENT_PLAN ARP
+    on ARP.PLAN_ID = AIP.PLAN_ID
+    left join AMSTRUCK_INWARD_REQUIREMENT AIR
+    on AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
+    left join AMS_PURCHASE_ORDER APO
+    on APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
+    left join DIL_BATCH DB
+    on DB.BATCH_ID = APO.BATCH_ID
+    left join RMS_CAPACITY RC
+    on RC.CAPACITY_ID = OO.CAPACITY_ID
+    left join TMSTRUCK_WEIGHT_RESULT TWR
+    on TWR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
+    left join TMSTRUCK_UNLOAD_RESULT TUR
+    on TUR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
+    left join OMSTRUCK_ORDER_MATERIAL OOM
+    on OOM.ORDER_ID = OO.ORDER_ID
+    left join RMS_MATERIAL RM
+    on OOM.MATERIAL_ID = RM.MATERIAL_ID
+    left join tmstruck_quality_result tqr
+    on tqr.total_result_id = ttr.result_total_id
+    left join RMS_WAREHOUSE RW
+    on TUR.RESULT_UNLOAD_PLACE_ID = RW.WAREHOUSE_ID
+    where TRR.STATUS = 1
+    and OO.ORDER_TYPE = #{orderTypee}
+    )
+    <where>
+      <if test="materialName != null">
+        <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+          "materialName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="purchaseOrderNo != null">
+        and
+        <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
+          "purchaseOrderNo" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="orderNumber != null">
+        and
+        <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+          "orderNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="capacityNumber != null">
+        and
+        <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+          "capacityNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultForeignShipName != null">
+        and
+        <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
+          "resultForeignShipName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="unloadStatus != null">
+        and
+        <foreach collection="unloadStatus" item="item" open="(" separator="or" close=")">
+          "unloadStatus" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultNetWeight != null">
+        and
+        <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
+          "resultNetWeight" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="issampling != null">
+        and
+        <foreach collection="issampling" item="item" open="(" separator="or" close=")">
+          "issampling" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="insertUsername != null">
+        and
+        <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
+          "insertUsername" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="insertTime != null">
+        and
+        <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
+          "insertTime" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
+  </select>
+
 </mapper>