123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.steerinfo.dil.mapper.StatisticalReportMapper">
- <sql id="orderBy">
- <if test="orderField != null and orderField != ''">
- order by "${orderField}"
- <if test="orderType != null and orderType != ''">
- ${orderType}
- </if>
- </if>
- </sql>
- <!--查询采购统计报表-->
- <select id="getAllPurchaseFLRLReport" parameterType="map" resultType="java.util.Map">
- select *
- from (select
- OO.ORDER_NUMBER "orderNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
- TWR.RESULT_NET_WEIGHT "resultNetWeight",
- TQR.RESULT_DEDUCTION "resultDeduction",
- TUR.RESULT_END_TIME "resultEndTime",
- RW.WAREHOUSE_NAME "warehouseName",
- TRR.INSERT_TIME "insertTime",
- TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
- OO.INSERT_TIME "insertTimee",
- RGEN.GATEPOST_NAME "enGatepostName",
- RGOUT.GATEPOST_NAME "outGatepostName",
- RTCMAO.TRUCK_CALCULATE_NUMBER "grossCalculateNum",
- RTCPI.TRUCK_CALCULATE_NUMBER "tareCalculateNum",
- TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
- RM.MATERIAL_NAME "materialName",
- CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode",
- <if test="orderTypee == 17 or orderTypee == 18">
- RS.SUPPLIER_NAME "supplierName",
- RCON.CONSIGNEE_COMPANY_NAME "receiveName",
- </if>
- TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime"
- from OMSTRUCK_ORDER OO
- left join TMSTRUCK_TOTAL_RESULT TTR
- on TTR.ORDER_ID = OO.ORDER_ID
- left join RMS_CAPACITY RC
- on RC.CAPACITY_ID = OO.CAPACITY_ID
- left join TMSTRUCK_ENFACTORY_RESULT TER
- on TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
- left join RMS_GATEPOST RGEN --进厂门岗
- on RGEN.GATEPOST_ID = TER.GATEPOST_ID
- left join OMSTRUCK_ORDER_MATERIAL OOM
- on OOM.ORDER_ID = OO.ORDER_ID
- left join RMS_MATERIAL RM
- on RM.MATERIAL_ID = OOM.MATERIAL_ID
- left join TMSTRUCK_WEIGHT_RESULT TWR
- on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_TRUCK_CALCULATE RTCMAO --毛重汽车衡
- on RTCMAO.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
- left join RMS_TRUCK_CALCULATE RTCPI --皮重汽车衡
- on RTCPI.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
- left join TMSTRUCK_UNLOAD_RESULT TUR
- on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_WAREHOUSE RW
- on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
- left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
- on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_GATEPOST RGOUT --出厂门岗
- on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
- left join TMSTRUCK_RECEIPT_RESULT TRR
- on TRR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join TMSTRUCK_QUALITY_RESULT TQR
- on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
- <if test="orderTypee == 17 or orderTypee == 18">
- left join AMS_PURCHASE_ORDER APO
- on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
- left join RMS_SUPPLIER RS
- on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
- left join RMS_CONSIGNEE RCON
- on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
- </if>
- where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
- and OO.ORDER_TYPE = #{orderTypee}
- <if test="oneDate != null">
- and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd') <= TER.RESULT_ENTRY_GATE_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
- </if>
- )
- <where>
- <if test="orderNumber != null">
- <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="resultEntryGateTime != null">
- and
- <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
- "resultEntryGateTime" 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="resultDeduction != null">
- and
- <foreach collection="resultDeduction" item="item" open="(" separator="or" close=")">
- "resultDeduction" like '%${item}%'
- </foreach>
- </if>
- <if test="resultEndTime != null">
- and
- <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
- "resultEndTime" 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="insertTime != null">
- and
- <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
- "insertTime" like '%${item}%'
- </foreach>
- </if>
- <if test="resultOutGateTime != null">
- and
- <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
- "resultOutGateTime" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- <if test="orderField == null">
- order by "insertTimee" desc
- </if>
- </select>
- <!-- 查询销售统计报表 -->
- <select id="getAllSaleReport" parameterType="java.util.Map" resultType="java.util.Map">
- select
- *
- from (
- select OO.ORDER_NUMBER "orderNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
- TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
- TWR.RESULT_TARE_WEIGHT "resultTareWeight",
- TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
- RW.WAREHOUSE_NAME "warehouseName",
- TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
- TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
- TWR.RESULT_NET_WEIGHT "resultNetWeight",
- TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
- RTCMAO.TRUCK_CALCULATE_NUMBER "maoCalculate",
- RTCPI.TRUCK_CALCULATE_NUMBER "piCalculate",
- RGEN.GATEPOST_NAME "enGatepostName",
- RGOUT.GATEPOST_NAME "outGatepostName",
- RCON.CONSIGNEE_COMPANY_NAME "receiveName",
- RS.SUPPLIER_NAME "sendName",
- RM.MATERIAL_NAME "materialName",
- TLR.INSERT_UPDATE_REMARK "materialRemark",
- ASO.SALE_NUMBER "saleNumber",
- CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
- from OMSTRUCK_ORDER OO
- left join AMS_SALE_ORDER_MATERIAL ASOM
- on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
- left join AMS_SALE_ORDER ASO
- on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- left join RMS_CONSIGNEE RCON
- on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
- left join RMS_SUPPLIER RS
- on RS.SUPPLIER_ID = ASO.SHIPPER_ID
- join TMSTRUCK_TOTAL_RESULT TTR
- on TTR.ORDER_ID = OO.ORDER_ID
- join TMSTRUCK_LOAD_RESULT TLR
- on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_WAREHOUSE RW
- on RW.WAREHOUSE_ID = TLR.LOADING_ID
- join TMSTRUCK_WEIGHT_RESULT TWR
- on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_TRUCK_CALCULATE RTCMAO
- on TWR.RESULT_GROSS_PLACE_ID = RTCMAO.TRUCK_CALCULATE_ID
- left join RMS_TRUCK_CALCULATE RTCPI
- on TWR.RESULT_TARE_PLACE_ID = RTCPI.TRUCK_CALCULATE_ID
- join TMSTRUCK_ENFACTORY_RESULT TER
- on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_GATEPOST RGEN
- on RGEN.GATEPOST_ID = TER.GATEPOST_ID
- join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
- on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_GATEPOST RGOUT
- on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
- join RMS_CAPACITY RC
- on RC.CAPACITY_ID = OO.CAPACITY_ID
- join OMSTRUCK_ORDER_MATERIAL OOM
- on OOM.ORDER_ID = OO.ORDER_ID
- join RMS_MATERIAL RM
- on RM.MATERIAL_ID = OOM.MATERIAL_ID
- <if test="carrierSsoId != null">
- join RMS_CARRIER RCA
- on RCA.CARRIER_ID = RC.CARRIER_ID
- </if>
- where OO.ORDER_TYPE in (1, 2)
- <if test="carrierSsoId != null">
- and RCA.CARRIER_SSO_ID = #{carrierSsoId}
- </if>
- <if test="oneDate != null">
- and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd') <= TER.RESULT_ENTRY_GATE_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
- </if>
- )
- <where>
- <if test="orderNumber != null">
- <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="receiveName != null">
- and
- <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
- "receiveName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialRemark != null">
- and
- <foreach collection="materialRemark" item="item" open="(" separator="or" close=")">
- "materialRemark" like '%${item}%'
- </foreach>
- </if>
- <if test="sendName != null">
- and
- <foreach collection="sendName" item="item" open="(" separator="or" close=")">
- "sendName" like '%${item}%'
- </foreach>
- </if>
- <if test="resultEntryGateTime != null">
- and
- <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
- "resultEntryGateTime" like '%${item}%'
- </foreach>
- </if>
- <if test="resultTareWeightTime != null">
- and
- <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
- "resultTareWeightTime" like '%${item}%'
- </foreach>
- </if>
- <if test="resultTareWeight != null">
- and
- <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
- "resultTareWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="resultLoadEndTime != null">
- and
- <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
- "resultLoadEndTime" 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="resultGrossWeightTime != null">
- and
- <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
- "resultGrossWeightTime" like '%${item}%'
- </foreach>
- </if>
- <if test="resultGrossWeight != null">
- and
- <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
- "resultGrossWeight" 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="resultNetWeight != null">
- and
- <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
- "resultNetWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="resultOutGateTime != null">
- and
- <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
- "resultOutGateTime" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- <if test="orderField == null">
- order by "resultOutGateTime" desc, "resultEntryGateTime" desc
- </if>
- </select>
- <!-- 查询零星进厂物资统计报表-->
- <select id="getSporadicSuppliesReport1" resultType="java.util.Map">
- select
- *
- from (
- select OO.ORDER_NUMBER "orderNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
- TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
- TWR.RESULT_TARE_WEIGHT "resultTareWeight",
- TUR.RESULT_END_TIME "resultEndTime",
- RW.WAREHOUSE_NAME "warehouseName",
- TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
- TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
- TWR.RESULT_NET_WEIGHT "resultNetWeight",
- TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
- -- 查询进厂门岗
- RG2.GATEPOST_NAME "gatepostEntryName",
- -- 出厂门岗
- RG.GATEPOST_NAME "gatepostOutName",
- -- 计皮汽车衡
- RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
- -- 计毛汽车衡
- RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
- RCON.CONSIGNEE_COMPANY_NAME "receiveName",
- RS.SUPPLIER_NAME "sendName",
- RM.MATERIAL_NAME "materialName",
- CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
- from OMSTRUCK_ORDER OO
- join TMSTRUCK_TOTAL_RESULT TTR
- on TTR.ORDER_ID = OO.ORDER_ID
- join TMSTRUCK_UNLOAD_RESULT TUR
- on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_WAREHOUSE RW
- on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
- join TMSTRUCK_WEIGHT_RESULT TWR
- on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_TRUCK_CALCULATE RTC2
- on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
- left join RMS_TRUCK_CALCULATE RTC1
- on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
- join TMSTRUCK_ENFACTORY_RESULT TER
- on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_GATEPOST RG2
- on RG2.GATEPOST_ID =TER.GATEPOST_ID
- join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
- on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_GATEPOST RG
- on TLFR.GATEPOST_ID =RG.GATEPOST_ID
- left join RMS_CAPACITY RC
- on RC.CAPACITY_ID = OO.CAPACITY_ID
- left join AMSTRUCK_SPORADIC_ORDER ASO
- on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
- left join RMS_SUPPLIER RS
- on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
- left join RMS_CONSIGNEE RCON
- on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
- join OMSTRUCK_ORDER_MATERIAL OOM
- on OOM.ORDER_ID = OO.ORDER_ID
- join RMS_MATERIAL RM
- on RM.MATERIAL_ID = OOM.MATERIAL_ID
- <if test="carrierSsoId != null">
- join RMS_CARRIER RCA
- on RCA.CARRIER_ID = RC.CARRIER_ID
- </if>
- where OO.ORDER_TYPE in (12,15)
- <if test="carrierSsoId != null">
- and RCA.CARRIER_SSO_ID = #{carrierSsoId}
- </if>
- <if test="oneDate != null">
- and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd') <= TER.RESULT_ENTRY_GATE_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
- </if>
- <if test="con!=null">
- where "receiveName" like #{con} or "sendName" like #{con} or "materialName" like #{con}
- or "capacityNumber" like #{con}
- </if>
- <if test="userId!=null">
- and ASO.INSERT_USERNAME=#{userId}
- </if>
- <if test="userIds!=null">
- and ASO.UPDATE_USERNAME=#{userIds}
- </if>
- <if test="orderType!=null">
- and OO.ORDER_TYPE=#{orderType}
- </if>
- )
- <where>
- <if test="receiveName != null">
- and
- <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
- "receiveName" like '%${item}%'
- </foreach>
- </if>
- <if test="sendName != null">
- and
- <foreach collection="sendName" item="item" open="(" separator="or" close=")">
- "sendName" 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">
- <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="resultEntryGateTime != null">
- and
- <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
- "resultEntryGateTime" like '%${item}%'
- </foreach>
- </if>
- <if test="resultTareWeightTime != null">
- and
- <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
- "resultTareWeightTime" like '%${item}%'
- </foreach>
- </if>
- <if test="resultTareWeight != null">
- and
- <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
- "resultTareWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="resultEndTime != null">
- and
- <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
- "resultEndTime" 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="resultGrossWeightTime != null">
- and
- <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
- "resultGrossWeightTime" like '%${item}%'
- </foreach>
- </if>
- <if test="resultGrossWeight != null">
- and
- <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
- "resultGrossWeight" 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="resultOutGateTime != null">
- and
- <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
- "resultOutGateTime" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- <if test="orderField == null">
- order by "resultOutGateTime" desc, "resultEntryGateTime" desc
- </if>
- </select>
- <!-- 查询零星出厂物资统计报表-->
- <select id="getSporadicSuppliesReport2" resultType="java.util.Map">
- select
- *
- from (
- select OO.ORDER_NUMBER "orderNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
- TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
- TWR.RESULT_TARE_WEIGHT "resultTareWeight",
- TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
- RW.WAREHOUSE_NAME "warehouseName",
- TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
- TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
- TWR.RESULT_NET_WEIGHT "resultNetWeight",
- TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
- -- 查询进厂门岗
- RG2.GATEPOST_NAME "gatepostEntryName",
- -- 出厂门岗
- RG.GATEPOST_NAME "gatepostOutName",
- -- 计皮汽车衡
- RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
- -- 计毛汽车衡
- RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
- RCON.CONSIGNEE_COMPANY_NAME "receiveName",
- RS.SUPPLIER_NAME "sendName",
- RM.MATERIAL_NAME "materialName",
- CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
- from OMSTRUCK_ORDER OO
- join TMSTRUCK_TOTAL_RESULT TTR
- on TTR.ORDER_ID = OO.ORDER_ID
- join TMSTRUCK_LOAD_RESULT TLR
- on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_WAREHOUSE RW
- on RW.WAREHOUSE_ID = TLR.LOADING_ID
- join TMSTRUCK_WEIGHT_RESULT TWR
- on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_TRUCK_CALCULATE RTC2
- on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
- left join RMS_TRUCK_CALCULATE RTC1
- on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
- join TMSTRUCK_ENFACTORY_RESULT TER
- on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_GATEPOST RG2
- on RG2.GATEPOST_ID =TER.GATEPOST_ID
- join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
- on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join RMS_GATEPOST RG
- on TLFR.GATEPOST_ID =RG.GATEPOST_ID
- left join RMS_CAPACITY RC
- on RC.CAPACITY_ID = OO.CAPACITY_ID
- left join AMSTRUCK_SPORADIC_ORDER ASO
- on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
- left join RMS_SUPPLIER RS
- on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
- left join RMS_CONSIGNEE RCON
- on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
- join OMSTRUCK_ORDER_MATERIAL OOM
- on OOM.ORDER_ID = OO.ORDER_ID
- join RMS_MATERIAL RM
- on RM.MATERIAL_ID = OOM.MATERIAL_ID
- <if test="carrierSsoId != null">
- join RMS_CARRIER RCA
- on RCA.CARRIER_ID = RC.CARRIER_ID
- </if>
- where OO.ORDER_TYPE in (13,16)
- <if test="carrierSsoId != null">
- and RCA.CARRIER_SSO_ID = #{carrierSsoId}
- </if>
- <if test="oneDate != null">
- and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd') <= TER.RESULT_ENTRY_GATE_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
- </if>
- <if test="con!=null">
- where "receiveName" like #{con} or "sendName" like #{con} or "materialName" like #{con}
- or "capacityNumber" like #{con}
- </if>
- <if test="userId!=null">
- and ASO.INSERT_USERNAME=#{userId}
- </if>
- <if test="userIds!=null">
- and ASO.UPDATE_USERNAME=#{userIds}
- </if>
- <if test="orderType!=null">
- and OO.ORDER_TYPE=#{orderType}
- </if>
- )
- <where>
- <if test="receiveName != null">
- and
- <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
- "receiveName" like '%${item}%'
- </foreach>
- </if>
- <if test="sendName != null">
- and
- <foreach collection="sendName" item="item" open="(" separator="or" close=")">
- "sendName" 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">
- <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="resultEntryGateTime != null">
- and
- <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
- "resultEntryGateTime" like '%${item}%'
- </foreach>
- </if>
- <if test="resultTareWeightTime != null">
- and
- <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
- "resultTareWeightTime" like '%${item}%'
- </foreach>
- </if>
- <if test="resultTareWeight != null">
- and
- <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
- "resultTareWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="resultLoadEndTime != null">
- and
- <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
- "resultLoadEndTime" 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="resultGrossWeightTime != null">
- and
- <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
- "resultGrossWeightTime" like '%${item}%'
- </foreach>
- </if>
- <if test="resultGrossWeight != null">
- and
- <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
- "resultGrossWeight" 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="resultOutGateTime != null">
- and
- <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
- "resultOutGateTime" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- <if test="orderField == null">
- order by "resultOutGateTime" desc, "resultEntryGateTime" desc
- </if>
- </select>
- </mapper>
|