|
@@ -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>
|