123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037 |
- <?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="getFuPurchaseFLRLReport" parameterType="map" resultType="java.util.Map">
- select *
- from (select
- OO.ORDER_NUMBER "orderNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- (select
- listagg(to_char(TER.RESULT_ENTRY_GATE_TIME,'yyyy-mm-dd hh24:mi:ss'), '/') within group (order by TER.RESULT_ID)
- from TMSTRUCK_ENFACTORY_RESULT TER
- where TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- ) "resultEntryGateTime",
- TWR.RESULT_NET_WEIGHT "resultNetWeight",
- TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
- TWR.RESULT_TARE_WEIGHT "resultTareWeight",
- TQR.RESULT_DEDUCTION "resultDeduction",
- TUR.RESULT_END_TIME "resultEndTime",
- RW.WAREHOUSE_NAME "warehouseName",
- TRR.INSERT_TIME "insertTime",
- (select
- listagg(to_char(TLFR.RESULT_OUT_GATE_TIME,'yyyy-mm-dd hh24:mi:ss'), '/')
- within group (order by TLFR.RESULT_ID)
- from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
- where TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- ) "resultOutGateTime",
- OO.INSERT_TIME "insertTimee",
- (
- select listagg(RG.GATEPOST_NAME, '/') within group ( order by TER2.RESULT_ID)
- from TMSTRUCK_ENFACTORY_RESULT TER2
- left join RMS_GATEPOST RG on TER2.GATEPOST_ID = RG.GATEPOST_ID
- where TER2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- ) "enGatepostName",
- (
- select listagg(RG.GATEPOST_NAME, '/') within group ( order by TLFR2.RESULT_ID)
- from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR2
- left join RMS_GATEPOST RG on TLFR2.GATEPOST_ID = RG.GATEPOST_ID
- where TLFR2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- )"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",
- APO.PURCHASE_ORDER_NO "purchaseOrderNo",
- RS.SUPPLIER_NAME "supplierName",
- RCON.CONSIGNEE_COMPANY_NAME "receiveName",
- 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 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_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
- 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
- where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
- and OO.ORDER_TYPE = #{orderTypee}
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
- </if>
- )
- <where>
- <if test="capacityNumber != null">
- and
- <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
- "capacityNumber" 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="resultGrossWeight != null">
- and
- <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
- "resultGrossWeight" 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="enGatepostName != null">
- and
- <foreach collection="enGatepostName" item="item" open="(" separator="or" close=")">
- "enGatepostName" like '%${item}%'
- </foreach>
- </if>
- <if test="outGatepostName != null">
- and
- <foreach collection="outGatepostName" item="item" open="(" separator="or" close=")">
- "outGatepostName" 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="purchaseOrderNo != null">
- and
- <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
- "purchaseOrderNo" like '%${item}%'
- </foreach>
- </if>
- <if test="supplierName != null">
- and
- <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
- "supplierName" like '%${item}%'
- </foreach>
- </if>
- <if test="receiveName != null">
- and
- <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
- "receiveName" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy">
- </include>
- <if test="orderField == null">
- order by "insertTimee" desc
- </if>
- </select>
- <!--查询采购辅料统计报表-->
- <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",
- TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
- TWR.RESULT_TARE_WEIGHT "resultTareWeight",
- 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",
- APO.PURCHASE_ORDER_NO "purchaseOrderNo",
- RS.SUPPLIER_NAME "supplierName",
- RCON.CONSIGNEE_COMPANY_NAME "receiveName",
- TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
- RL.LINE_NAME "lineName"
- 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 RMS_LINE RL on OO.LINE_ID = RL.LINE_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
- 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
- where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
- and OO.ORDER_TYPE = #{orderTypee}
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
- </if>
- )
- <where>
- <if test="capacityNumber != null">
- and
- <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
- "capacityNumber" 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="resultGrossWeight != null">
- and
- <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
- "resultGrossWeight" 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="enGatepostName != null">
- and
- <foreach collection="enGatepostName" item="item" open="(" separator="or" close=")">
- "enGatepostName" like '%${item}%'
- </foreach>
- </if>
- <if test="outGatepostName != null">
- and
- <foreach collection="outGatepostName" item="item" open="(" separator="or" close=")">
- "outGatepostName" 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="purchaseOrderNo != null">
- and
- <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
- "purchaseOrderNo" like '%${item}%'
- </foreach>
- </if>
- <if test="supplierName != null">
- and
- <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
- "supplierName" like '%${item}%'
- </foreach>
- </if>
- <if test="receiveName != null">
- and
- <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
- "receiveName" 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
- *
- from (
- select DISTINCT 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",
- TLR.CASE_NUMBER "caseNumber",
- RC2.CARRIER_NAME "carrierName",
- TAR.RESULT_ARRIVAL_ADDRESS "arrivalAddress",
- TRR.RESULT_ARRIVAL_ADDRESS "receiptAddress",
- CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
- from TMSTRUCK_WEIGHT_RESULT TWR
- left join TMSTRUCK_TOTAL_RESULT TTR
- on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join OMSTRUCK_ORDER OO
- on TTR.ORDER_ID = OO.ORDER_ID
- left join AMS_SALE_ORDER_MATERIAL ASOM
- on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
- left join AMS_DISPATCH_SALE_ORDER ADSO
- on ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- left join RMS_CARRIER RC2
- on RC2.CARRIER_ID = ADSO.CARRIER_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_LOAD_RESULT TLR
- on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- and TLR.MATERIAL_ID = TWR.MATERIAL_ID
- left join RMS_WAREHOUSE RW
- on RW.WAREHOUSE_ID = TLR.LOADING_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 RMS_MATERIAL RM
- on RM.MATERIAL_ID = TWR.MATERIAL_ID
- left join TMSTRUCK_ARRIVAL_RESULT TAR
- on TAR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- left join TMStRUCK_RECEIPT_RESULT TRR
- on TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
- WHERE OO.ORDER_TYPE = #{orderType}
- AND ASO.SHIPPER_ID = #{shipperId}
- <if test="carrierSsoId != null">
- and RC2.CARRIER_SSO_ID = #{carrierSsoId}
- </if>
- <if test="receivName != null">
- and RCON.CONSIGNEE_COMPANY_NAME like #{receivName}
- </if>
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_GROSS_WEIGHT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_GROSS_WEIGHT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_GROSS_WEIGHT_TIME
- </if>
- ) RRR
- <where>
- <if test="remark != null" >
- and RRR."materialName" LIKE #{remark} or RRR."materialRemark" LIKE #{remark}
- </if>
- </where>
- )
- <where>
- <if test="orderNumber != null">
- <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
- "orderNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="carrierName != null">
- <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
- "carrierName" like '%${item}%'
- </foreach>
- </if>
- <if test="enGatepostName != null">
- <foreach collection="enGatepostName" item="item" open="(" separator="or" close=")">
- "enGatepostName" like '%${item}%'
- </foreach>
- </if>
- <if test="outGatepostName != null">
- <foreach collection="outGatepostName" item="item" open="(" separator="or" close=")">
- "outGatepostName" like '%${item}%'
- </foreach>
- </if>
- <if test="caseNumber != null">
- <foreach collection="caseNumber" item="item" open="(" separator="or" close=")">
- "caseNumber" 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" = #{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 = 12
- <if test="carrierSsoId != null">
- and RCA.CARRIER_SSO_ID = #{carrierSsoId}
- </if>
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_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>
- )
- <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=")">
- to_char("resultTareWeightTime",'yyyy-mm-dd hh24:mi:ss') 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=")">
- to_char("resultEndTime",'yyyy-mm-dd hh24:mi:ss') 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=")">
- to_char("resultGrossWeightTime",'yyyy-mm-dd hh24:mi:ss') 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>
- <if test="gatepostEntryName != null">
- and
- <foreach collection="gatepostEntryName" item="item" open="(" separator="or" close=")">
- "gatepostEntryName" like '%${item}%'
- </foreach>
- </if>
- <if test="gatepostOutName != null">
- and
- <foreach collection="gatepostOutName" item="item" open="(" separator="or" close=")">
- "gatepostOutName" 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 = 13
- <if test="carrierSsoId != null">
- and RCA.CARRIER_SSO_ID = #{carrierSsoId}
- </if>
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_GROSS_WEIGHT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_GROSS_WEIGHT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_GROSS_WEIGHT_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>
- )
- <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>
- <if test="gatepostEntryName != null">
- and
- <foreach collection="gatepostEntryName" item="item" open="(" separator="or" close=")">
- "gatepostEntryName" like '%${item}%'
- </foreach>
- </if>
- <if test="gatepostOutName != null">
- and
- <foreach collection="gatepostOutName" item="item" open="(" separator="or" close=")">
- "gatepostOutName" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- <if test="orderField == null">
- order by "resultOutGateTime" desc, "resultEntryGateTime" desc
- </if>
- </select>
- <select id="getTotalResultList" resultType="java.util.LinkedHashMap">
- SELECT DISTINCT
- TTR.RESULT_TOTAL_ID "totalId"
- FROM
- TMSTRUCK_TOTAL_RESULT TTR
- LEFT JOIN OMSTRUCK_ORDER OO ON OO.ORDER_ID = TTR.ORDER_ID
- WHERE
- OO.ORDER_TYPE in (10,20)
- order by TTR.RESULT_TOTAL_ID desc
- </select>
- <select id="getInwardReportResult" resultType="java.util.LinkedHashMap">
- select * from (select oo.order_id "orderId",
- oo.ORDER_TYPE "orderType",
- rm.material_name "materialName",
- apo.purchase_order_no "purchaseNo",
- rc.capacity_number "capacityNo",
- rs.supplier_name "supplierName",
- oo.order_number "orderNumber",
- rce.consignee_company_name "consigneeName",
- ttr.result_total_id "totalResultId",
- ter1.result_entry_mode "entryModeFirst",
- ter1.result_entry_gate_time "entryGateTimeFirst",
- rg1.gatepost_name "entryGatepostNameFirst",
- twr1.result_tare_weight "tareWeightFirst",
- twr1.result_tare_weight_time "tareWeightTimeFirst",
- rtc1.truck_calculate_number "tareTruckCalculateFirst",
- tlr.result_load_end_time "loadTime",
- rw.warehouse_name "loadPoint",
- twr2.result_gross_weight "grossWeightFirst",
- twr2.result_gross_weight_time "grossWeigtTimeFirst",
- rtc2.truck_calculate_number "grossTruckCalculateFirst",
- twr2.result_net_weight "netWeightFirst",
- tlfr1.result_out_gate_time "outGatepostTimeFirst",
- tlfr1.result_out_mode "outModeFirst",
- rg2.gatepost_name "gatepostNameFirst",
- ter2.result_entry_mode "entryModeSecond",
- ter2.result_entry_gate_time "resultEntryGateTime",
- ter2.result_entry_gate_time "entryGateTimeSecond",
- rg3.gatepost_name "entryGatepostNameSecond",
- twr3.result_gross_weight "grossWeightSecond",
- twr3.result_gross_weight_time "grossWeigtTimeSecond",
- rtc3.truck_calculate_number "grossTruckCalculateSecond",
- tur.result_end_time "unloadTime",
- rw2.warehouse_name "unloadPoint",
- twr4.result_tare_weight "tareWeightSecond",
- twr4.result_tare_weight_time "tareWeightTimeSecond",
- twr4.result_net_weight "netWeightSecond",
- rtc4.truck_calculate_number "tareTruckCalculateSecond",
- tlfr2.result_out_gate_time "outGatepostTimeSecond",
- tlfr2.result_out_gate_time "resultOutGateTime",
- tlfr2.result_out_mode "outModeSecond",
- rg4.gatepost_name "gatepostNameSecond"
- from omstruck_order oo
- 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 rms_capacity rc
- on rc.capacity_id = oo.capacity_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 rms_supplier rs
- on rs.supplier_id = apo.supplier_unit_id
- left join rms_consignee rce
- on rce.consignee_id = apo.receive_unit_id
- left join tmstruck_total_result ttr
- on ttr.order_id = oo.order_id
- left join tmstruck_enfactory_result ter1
- on ter1.result_total_id = ttr.result_total_id
- left join rms_gatepost rg1
- on rg1.gatepost_id = ter1.gatepost_id
- left join tmstruck_weight_result twr1
- on twr1.result_total_id = ttr.result_total_id
- left join rms_truck_calculate rtc1
- on rtc1.truck_calculate_id = twr1.result_tare_place_id
- left 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
- left join tmstruck_weight_result twr2
- on twr2.result_total_id = ttr.result_total_id
- left join rms_truck_calculate rtc2
- on rtc2.truck_calculate_id = twr2.result_gross_place_id
- left join tmstruck_leave_factory_result tlfr1
- on tlfr1.result_total_id = ttr.result_total_id
- left join rms_gatepost rg2
- on tlfr1.gatepost_id = rg2.gatepost_id
- left join tmstruck_enfactory_result ter2
- on ter2.result_total_id = ttr.result_total_id
- left join rms_gatepost rg3
- on rg3.gatepost_id = ter2.gatepost_id
- left join tmstruck_weight_result twr3
- on twr3.result_total_id = ttr.result_total_id
- left join rms_truck_calculate rtc3
- on rtc3.truck_calculate_id = twr3.result_gross_place_id
- left join tmstruck_unload_result tur
- on tur.result_total_id = ttr.result_total_id
- left join rms_warehouse rw2
- on rw2.warehouse_id = tur.result_unload_place_id
- left join tmstruck_weight_result twr4
- on twr4.result_total_id = ttr.result_total_id
- left join rms_truck_calculate rtc4
- on rtc4.truck_calculate_id = twr4.result_tare_place_id
- left join tmstruck_leave_factory_result tlfr2
- on tlfr2.result_total_id = ttr.result_total_id
- left join rms_gatepost rg4
- on tlfr2.gatepost_id = rg4.gatepost_id
- left join RMS_TRANS_RANGE RTR
- on RTR.TRANS_RANGE_ID = AIR.LINE_ID
- where oo.order_type in (10,20)
- and ter1.segmen_sqe = 1
- and twr1.tare_segment_sqe = 2
- and tlr.segment_sqe = 3
- and twr2.gross_segment_sqe = 4
- and tlfr1.segment_sqe = 5
- and ter2.segmen_sqe = 6
- and twr3.gross_segment_sqe = 7
- and tur.segment_sqe = 8
- and twr4.tare_segment_sqe = 9
- and tlfr2.segment_sqe = 10
- and twr2.result_gross_weight_time is not null
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR4.RESULT_TARE_WEIGHT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR4.RESULT_TARE_WEIGHT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR4.RESULT_TARE_WEIGHT_TIME
- </if>
- )
- <where>
- <if test="consigneeName != null">
- and
- <foreach collection="consigneeName" item="item" open="(" separator="or" close=")">
- "consigneeName" like '%${item}%'
- </foreach>
- </if>
- <if test="supplierName != null">
- and
- <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
- "supplierName" 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="capacityNo != null">
- and
- <foreach collection="capacityNo" item="item" open="(" separator="or" close=")">
- "capacityNo" like '%${item}%'
- </foreach>
- </if>
- </where><include refid="orderBy"></include>
- <if test="orderField == null">
- order by "outGatepostTimeFirst" desc, "entryGateTimeFirst" desc
- </if>
- </select>
- <select id="getInwardReport" parameterType="map" resultType="java.util.Map">
- select * from (
- select
- OO.ORDER_NUMBER "orderNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- RS.SHIPPER_NAME "shipperName",
- RW1.WAREHOUSE_NAME "unloadName",
- RW2.WAREHOUSE_NAME "loadName",
- RM.MATERIAL_NAME "materialName",
- RTC2.TRUCK_CALCULATE_NUMBER "grossNumber",
- RTC1.TRUCK_CALCULATE_NUMBER "tareNumber",
- TWR.RESULT_NET_WEIGHT "resultNetWeight",
- TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
- TWR.RESULT_TARE_WEIGHT "resultTareWeight",
- TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
- TWR.RESULT_GROSS_WEIGHT "resultGrossWeight"
- from OMSTRUCK_ORDER OO
- left join TMSTRUCK_TOTAL_RESULT TTR on OO.ORDER_ID = TTR.ORDER_ID
- left join TMSTRUCK_WEIGHT_RESULT TWR on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
- left join RMS_CAPACITY RC on OO.CAPACITY_ID = RC.CAPACITY_ID
- left join RMS_TRUCK_CALCULATE RTC1 on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
- left join RMS_TRUCK_CALCULATE RTC2 on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
- left join AMSTRUCK_INWARD_PLAN AIP on AIP.PLAN_ID = OO.ORDER_PLAN_ID
- left join AMSTRUCK_REQUIREMENT_PLAN ARP on AIP.PLAN_ID = ARP.PLAN_ID
- left join AMSTRUCK_INWARD_REQUIREMENT AIR on AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
- left join RMS_SHIPPER RS on AIR.REQUIREMENT_SHIPPER_ID = RS.SHIPPER_ID
- left join AMSTRUCK_REQUIREMENT_MATERIAL ARM on AIR.REQUIREMENT_ID = ARM.REQUIREMENT_ID
- left join RMS_MATERIAL RM on ARM.MATERIAL_ID = RM.MATERIAL_ID
- left join RMS_WAREHOUSE RW1 on ARM.REQUIREMENT_UNLOAD_UNIT_ID = RW1.WAREHOUSE_ID
- left join RMS_WAREHOUSE RW2 on ARM.REQUIREMENT_PLATFORM_ID = RW2.WAREHOUSE_ID
- where OO.ORDER_TYPE = 11 and TWR.RESULT_NET_WEIGHT >= 0
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
- </if>
- )
- <where>
- <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="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="unloadName != null">
- <foreach collection="unloadName" item="item" open="(" separator="or" close=")">
- "unloadName" like '%${item}%'
- </foreach>
- </if>
- <if test="loadName != null">
- and
- <foreach collection="loadName" item="item" open="(" separator="or" close=")">
- "loadName" 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="grossNumber != null">
- and
- <foreach collection="grossNumber" item="item" open="(" separator="or" close=")">
- "grossNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="tareNumber != null">
- and
- <foreach collection="tareNumber" item="item" open="(" separator="or" close=")">
- "tareNumber" 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="resultTareWeightTime != null">
- and
- <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
- to_char("resultTareWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
- </foreach>
- </if>
- <if test="resultTareWeight != null">
- <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
- "resultTareWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="resultGrossWeightTime != null">
- and
- <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
- to_char("resultGrossWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
- </foreach>
- </if>
- <if test="resultGrossWeight != null">
- and
- <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
- "resultGrossWeight" like '%${item}%'
- </foreach>
- </if>
- </where>
- <if test="orderField != null and orderField != ''">
- order by "resultTareWeightTime"
- </if>
- </select>
- <select id="getLoading" parameterType="map" resultType="java.util.Map">
- SELECT * FROM(
- SELECT MATERIAL_NAME "materialName",
- COUNT(RC.CAPACITY_NUMBER) "capacityNumber",
- SUM(TWR.RESULT_NET_WEIGHT) "resultNetWeight",
- count(TWR.RESULT_NET_WEIGHT) "number",
- WAREHOUSE_NAME "warehouseName"
- FROM TMSTRUCK_LOAD_RESULT TLR
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
- ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- LEFT JOIN OMSTRUCK_ORDER OO
- ON OO.ORDER_ID = TTR.ORDER_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 RMS_CAPACITY RC
- ON RC.CAPACITY_ID = OO.CAPACITY_ID
- LEFT JOIN RMS_WAREHOUSE RW
- ON RW.WAREHOUSE_ID = TLR.LOADING_ID
- WHERE OO.ORDER_TYPE = 11
- AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = TLR.RESULT_LOAD_END_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TLR.RESULT_LOAD_END_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
- </if>
- GROUP BY MATERIAL_NAME, WAREHOUSE_NAME
- )
- <include refid="orderBy"></include>
- <where>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" 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="warehouseName != null">
- and
- <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
- "warehouseName" like '%${item}%'
- </foreach>
- </if>
- <if test="number != null">
- and
- <foreach collection="number" item="item" open="(" separator="or" close=")">
- "number" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="getUnLoading" parameterType="map" resultType="java.util.Map">
- SELECT * FROM (
- SELECT
- COUNT(RC.CAPACITY_NUMBER) "capacityNumber",
- SUM(TWR.RESULT_NET_WEIGHT) "resultNetWeight",
- count(TWR.RESULT_NET_WEIGHT) "number",
- MATERIAL_NAME "materialName",
- WAREHOUSE_NAME "warehouseName"
- FROM TMSTRUCK_UNLOAD_RESULT TUR
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
- ON TWR.RESULT_TOTAL_ID = TUR.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
- 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 RMS_WAREHOUSE RW
- ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
- WHERE TUR.RESULT_END_TIME IS NOT NULL
- AND OO.ORDER_TYPE = 11
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = TUR.RESULT_END_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TUR.RESULT_END_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TUR.RESULT_END_TIME
- </if>
- GROUP BY MATERIAL_NAME, WAREHOUSE_NAME
- )
- <include refid="orderBy"></include>
- <where>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" 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="warehouseName != null">
- and
- <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
- "warehouseName" 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="number != null">
- and
- <foreach collection="number" item="item" open="(" separator="or" close=")">
- "number" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="getLXReportResult" parameterType="map" resultType="java.util.LinkedHashMap">
- SELECT
- *
- FROM (
- SELECT
- OO.ORDER_ID "orderId",
- RM.MATERIAL_NAME "materialName",
- RC.CAPACITY_NUMBER "capacityNo",
- RS.SUPPLIER_NAME "supplierName",
- OO.ORDER_NUMBER "orderNumber",
- RCE.CONSIGNEE_COMPANY_NAME "consigneeName",
- TTR.RESULT_TOTAL_ID "totalResultId",
- TER1.RESULT_ENTRY_MODE "entryModeFirst",
- TER1.RESULT_ENTRY_GATE_TIME "entryGateTimeFirst",
- RG1.GATEPOST_NAME "entryGatepostNameFirst",
- TWR1.RESULT_TARE_WEIGHT "tareWeightFirst",
- TWR1.RESULT_TARE_WEIGHT_TIME "tareWeightTimeFirst",
- RTC1.TRUCK_CALCULATE_NUMBER "tareTruckCalculateFirst",
- TLR.RESULT_LOAD_END_TIME "loadTime",
- RW.WAREHOUSE_NAME "loadPoint",
- TWR2.RESULT_GROSS_WEIGHT "grossWeightFirst",
- TWR2.RESULT_GROSS_WEIGHT_TIME "grossWeigtTimeFirst",
- RTC2.TRUCK_CALCULATE_NUMBER "grossTruckCalculateFirst",
- TWR2.RESULT_NET_WEIGHT "netWeightFirst",
- TLFR1.RESULT_OUT_GATE_TIME "outGatepostTimeFirst",
- TLFR1.RESULT_OUT_MODE "outModeFirst",
- RG2.GATEPOST_NAME "gatepostNameFirst",
- TER2.RESULT_ENTRY_MODE "entryModeSecond",
- TER2.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
- TER2.RESULT_ENTRY_GATE_TIME "entryGateTimeSecond",
- RG3.GATEPOST_NAME "entryGatepostNameSecond",
- TWR3.RESULT_GROSS_WEIGHT "grossWeightSecond",
- TWR3.RESULT_GROSS_WEIGHT_TIME "grossWeigtTimeSecond",
- RTC3.TRUCK_CALCULATE_NUMBER "grossTruckCalculateSecond",
- TUR.RESULT_END_TIME "unloadTime",
- RW2.WAREHOUSE_NAME "unloadPoint",
- TWR4.RESULT_TARE_WEIGHT "tareWeightSecond",
- TWR4.RESULT_TARE_WEIGHT_TIME "tareWeightTimeSecond",
- TWR4.RESULT_NET_WEIGHT "netWeightSecond",
- RTC4.TRUCK_CALCULATE_NUMBER "tareTruckCalculateSecond",
- TLFR2.RESULT_OUT_GATE_TIME "outGatepostTimeSecond",
- TLFR2.RESULT_OUT_GATE_TIME "resultOutGateTime",
- TLFR2.RESULT_OUT_MODE "outModeSecond",
- RG4.GATEPOST_NAME "gatepostNameSecond"
- FROM OMSTRUCK_ORDER OO
- 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 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 RCE ON RCE.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID = OO.ORDER_ID
- LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER1 ON TER1.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- LEFT JOIN RMS_GATEPOST RG1 ON RG1.GATEPOST_ID = TER1.GATEPOST_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR1 ON TWR1.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- LEFT JOIN RMS_TRUCK_CALCULATE RTC1 ON RTC1.TRUCK_CALCULATE_ID = TWR1.RESULT_TARE_PLACE_ID
- LEFT 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
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR2 ON TWR2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- LEFT JOIN RMS_TRUCK_CALCULATE RTC2 ON RTC2.TRUCK_CALCULATE_ID = TWR2.RESULT_GROSS_PLACE_ID
- LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR1 ON TLFR1.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- LEFT JOIN RMS_GATEPOST RG2 ON TLFR1.GATEPOST_ID = RG2.GATEPOST_ID
- LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER2 ON TER2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- LEFT JOIN RMS_GATEPOST RG3 ON RG3.GATEPOST_ID = TER2.GATEPOST_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR3 ON TWR3.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- LEFT JOIN RMS_TRUCK_CALCULATE RTC3 ON RTC3.TRUCK_CALCULATE_ID = TWR3.RESULT_GROSS_PLACE_ID
- LEFT JOIN TMSTRUCK_UNLOAD_RESULT TUR ON TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- LEFT JOIN RMS_WAREHOUSE RW2 ON RW2.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR4 ON TWR4.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- LEFT JOIN RMS_TRUCK_CALCULATE RTC4 ON RTC4.TRUCK_CALCULATE_ID = TWR4.RESULT_TARE_PLACE_ID
- LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR2 ON TLFR2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- LEFT JOIN RMS_GATEPOST RG4 ON TLFR2.GATEPOST_ID = RG4.GATEPOST_ID
- WHERE OO.ORDER_TYPE = 14
- AND TER1.SEGMEN_SQE = 1
- AND TWR1.TARE_SEGMENT_SQE = 2
- AND TLR.SEGMENT_SQE = 3
- AND TWR2.GROSS_SEGMENT_SQE = 4
- AND TLFR1.SEGMENT_SQE = 5
- AND TER2.SEGMEN_SQE = 6
- AND TWR3.GROSS_SEGMENT_SQE = 7
- AND TUR.SEGMENT_SQE = 8
- AND TWR4.TARE_SEGMENT_SQE = 9
- AND TLFR2.SEGMENT_SQE = 10
- AND TWR2.RESULT_GROSS_WEIGHT_TIME IS NOT NULL
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR4.RESULT_TARE_WEIGHT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR4.RESULT_TARE_WEIGHT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR4.RESULT_TARE_WEIGHT_TIME
- </if>
- )
- <where>
- <if test="consigneeName != null">
- <foreach collection="consigneeName" item="item" open="(" separator="or" close=")">
- "consigneeName" like '%${item}%'
- </foreach>
- </if>
- <if test="supplierName != null">
- and
- <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
- "supplierName" 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="capacityNo != null">
- and
- <foreach collection="capacityNo" item="item" open="(" separator="or" close=")">
- "capacityNo" like '%${item}%'
- </foreach>
- </if>
- </where><include refid="orderBy"></include>
- <if test="orderField == null">
- order by "outGatepostTimeFirst" desc, "entryGateTimeFirst" desc
- </if>
- </select>
- <!-- 查询装机统计报表-->
- <select id="getLoaderResult" resultType="java.util.Map" parameterType="java.util.Map">
- select *
- from(select
- COUNT(RC.CAPACITY_NUMBER) "number",
- sum(TWR.RESULT_NET_WEIGHT) "netWeight",
- TLR.CAPACITY_REMARK "LoaderCapacityNumber"
- 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_LOAD_RESULT TLR
- ON TLR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
- ON TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- where TLR.CAPACITY_REMARK IS NOT NULL
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = TLR.RESULT_LOAD_END_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TLR.RESULT_LOAD_END_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
- </if>
- GROUP BY TLR.CAPACITY_REMARK
- )
- <where>
- <if test="number != null">
- and
- <foreach collection="number" item="item" open="(" separator="or" close=")">
- "number" like '%${item}%'
- </foreach>
- </if>
- <if test="netWeight != null">
- and
- <foreach collection="netWeight" item="item" open="(" separator="or" close=")">
- "netWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="LoaderCapacityNumber != null">
- and
- <foreach collection="LoaderCapacityNumber" item="item" open="(" separator="or" close=")">
- "LoaderCapacityNumber" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="getCapacityByDefend" resultType="java.util.Map" parameterType="java.util.Map">
- select distinct * from(
- select rc.CAPACITY_NUMBER "capacityNumber",
- oo.ORDER_NUMBER "orderNumber",
- ter.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
- rg1.GATEPOST_NAME "gatepostName1",
- tlfr.RESULT_OUT_GATE_TIME "resultOutGateTime",
- rg2.GATEPOST_NAME "gatepostName2",
- rm.material_name "materialName"
- from OMSTRUCK_ORDER oo
- 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 RMS_CAPACITY rc
- on rc.CAPACITY_ID = oo.CAPACITY_ID
- left join TMSTRUCK_TOTAL_RESULT ttr
- on ttr.ORDER_ID = oo.ORDER_ID
- left join TMSTRUCK_ENFACTORY_RESULT ter
- on ter.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
- left join RMS_GATEPOST rg1
- on rg1.GATEPOST_ID = ter.GATEPOST_ID
- left join TMSTRUCK_LEAVE_FACTORY_RESULT tlfr
- on tlfr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
- left join RMS_GATEPOST rg2
- on rg2.GATEPOST_ID = tlfr.GATEPOST_ID
- <where>
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = tlfr.RESULT_OUT_GATE_TIME
- </if>
- <if test="startDate != null" >
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') < = tlfr.RESULT_OUT_GATE_TIME
- </if>
- <if test="endDate != null" >
- and to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss') >= tlfr.RESULT_OUT_GATE_TIME
- </if>
- <if test="con != null">
- and (instr(rc.CAPACITY_NUMBER, #{con}) > 0 or instr(rg1.GATEPOST_NAME, #{con}) > 0 or instr(rg2.GATEPOST_NAME, #{con}) > 0 )
- </if>
- </where>
- order by ter.RESULT_ENTRY_GATE_TIME desc
- )
- <where>
- <if test=" capacityNumber!= null">
- and
- <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
- "capacityNumber" 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="resultGrossWeight != null">
- and
- <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
- "resultGrossWeight" 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="truckCalculateNumber1 != null">
- and
- <foreach collection="truckCalculateNumber1" item="item" open="(" separator="or" close=")">
- "truckCalculateNumber1" 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=" resultTareWeightTime != null">
- and
- <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
- "resultTareWeightTime" like '%${item}%'
- </foreach>
- </if>
- <if test="truckCalculateNumber2 != null">
- and
- <foreach collection="truckCalculateNumber2" item="item" open="(" separator="or" close=")">
- "truckCalculateNumber2" 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=" resultEntryGateTime!= null">
- and
- <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
- "resultEntryGateTime" like '%${item}%'
- </foreach>
- </if>
- <if test=" gatepostName1!= null">
- and
- <foreach collection="gatepostName1" item="item" open="(" separator="or" close=")">
- "gatepostName1" like '%${item}%'
- </foreach>
- </if>
- <if test=" resultOutGateTime!= null">
- and
- <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
- "resultOutGateTime" like '%${item}%'
- </foreach>
- </if>
- <if test=" gatepostName2 != null">
- and
- <foreach collection="gatepostName2" item="item" open="(" separator="or" close=")">
- "gatepostName2" 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=" warehouseName1 != null">
- and
- <foreach collection="warehouseName1" item="item" open="(" separator="or" close=")">
- "warehouseName1" 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=" warehouseName2 != null">
- and
- <foreach collection="warehouseName2" item="item" open="(" separator="or" close=")">
- "warehouseName2" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="getInwardReportForAssemble" resultType="java.util.Map" parameterType="java.util.Map">
- select * from (
- select
- OO.ORDER_NUMBER "orderNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- RS.SHIPPER_NAME "shipperName",
- RW1.WAREHOUSE_NAME "unloadName",
- RW2.WAREHOUSE_NAME "loadName",
- APO.PURCHASE_ORDER_NO "purchaseOrderNo",
- RM.MATERIAL_NAME "materialName",
- RTC2.TRUCK_CALCULATE_NUMBER "grossNumber",
- RTC1.TRUCK_CALCULATE_NUMBER "tareNumber",
- TWR.RESULT_NET_WEIGHT "resultNetWeight",
- TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
- TWR.RESULT_TARE_WEIGHT "resultTareWeight",
- TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
- TWR.RESULT_GROSS_WEIGHT "resultGrossWeight"
- from OMSTRUCK_ORDER OO
- left join TMSTRUCK_TOTAL_RESULT TTR on OO.ORDER_ID = TTR.ORDER_ID
- left join TMSTRUCK_WEIGHT_RESULT TWR on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
- left join RMS_CAPACITY RC on OO.CAPACITY_ID = RC.CAPACITY_ID
- left join RMS_TRUCK_CALCULATE RTC1 on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
- left join RMS_TRUCK_CALCULATE RTC2 on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
- left join AMSTRUCK_INWARD_PLAN AIP on AIP.PLAN_ID = OO.ORDER_PLAN_ID
- left join AMSTRUCK_REQUIREMENT_PLAN ARP on AIP.PLAN_ID = ARP.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 RMS_SHIPPER RS on AIR.REQUIREMENT_SHIPPER_ID = RS.SHIPPER_ID
- left join AMSTRUCK_REQUIREMENT_MATERIAL ARM on AIR.REQUIREMENT_ID = ARM.REQUIREMENT_ID
- left join RMS_MATERIAL RM on ARM.MATERIAL_ID = RM.MATERIAL_ID
- left join RMS_WAREHOUSE RW1 on ARM.REQUIREMENT_UNLOAD_UNIT_ID = RW1.WAREHOUSE_ID
- left join RMS_WAREHOUSE RW2 on ARM.REQUIREMENT_PLATFORM_ID = RW2.WAREHOUSE_ID
- where OO.ORDER_TYPE in (15,16) and TWR.RESULT_NET_WEIGHT >= 0
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
- </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=" shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="unloadName != null">
- and
- <foreach collection="unloadName" item="item" open="(" separator="or" close=")">
- "unloadName" like '%${item}%'
- </foreach>
- </if>
- <if test="loadName!= null">
- and
- <foreach collection="loadName" item="item" open="(" separator="or" close=")">
- "loadName" 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="grossNumber!= null">
- and
- <foreach collection="grossNumber" item="item" open="(" separator="or" close=")">
- "grossNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="tareNumber!= null">
- and
- <foreach collection="tareNumber" item="item" open="(" separator="or" close=")">
- "tareNumber" 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="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="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="purchaseOrderNo!= null">
- and
- <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
- "purchaseOrderNo" like '%${item}%'
- </foreach>
- </if>
- </select>
- <select id="getCapacityRemark" resultType="java.util.Map" parameterType="java.util.Map">
- select OO.ORDER_TYPE,
- OO.ORDER_ID "orderId"
- from OMSTRUCK_ORDER OO
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON OO.ORDER_ID=TTR.ORDER_ID
- LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
- ON TLR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- WHERE TLR.CAPACITY_REMARK IS NOT NULL
- </select>
- <select id="getLoaderForResultDetail" resultType="java.util.Map" parameterType="java.util.Map">
- SELECT *
- FROM (
- SELECT
- DISTINCT RM.MATERIAL_NAME "materialName",
- OO.ORDER_NUMBER "orderNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
- TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
- TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
- TLR.RESULT_LOAD_DURATION "resultLoadDuration",
- RW.WAREHOUSE_NAME "warehouseName",
- TWR.RESULT_NET_WEIGHT "resultNetWeight",
- TLR.CAPACITY_REMARK "capacityRemark",
- TLR.RESULT_ID "resultId"
- FROM TMSTRUCK_LOAD_RESULT TLR
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
- LEFT JOIN OMSTRUCK_ORDER OO
- ON OO.ORDER_ID = TTR.ORDER_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 RMS_CAPACITY RC
- ON RC.CAPACITY_ID = OO.CAPACITY_ID
- LEFT JOIN RMS_WAREHOUSE RW
- ON RW.WAREHOUSE_ID = TLR.LOADING_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
- ON TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
- WHERE TLR.CAPACITY_REMARK IS NOT NULL
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = TLR.RESULT_LOAD_END_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TLR.RESULT_LOAD_END_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
- </if>
- <if test="con != null">
- and (instr(tlr.CAPACITY_REMARK, #{con}) > 0)
- </if>
- ORDER BY TLR.RESULT_LOAD_END_TIME,OO.ORDER_NUMBER DESC
- )
- <if test=" orderNumber != null">
- and
- <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
- "orderNumber" 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=" capacityNumber != null">
- and
- <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
- "capacityNumber" like '%${item}%'
- </foreach>
- </if>
- <if test=" resultLoadStartTime != null">
- and
- <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
- "resultLoadStartTime" 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="capacityRemark != null">
- and
- <foreach collection="capacityRemark" item="item" open="(" separator="or" close=")">
- "capacityRemark" like '%${item}%'
- </foreach>
- </if>
- </select>
- <!--根据组织获取销售订单-->
- <select id="getSaleOrderList" resultType="java.util.Map" parameterType="java.util.Map">
- select OO.ORDER_NUMBER "orderNumber",
- RM.MATERIAL_NAME "materialName",
- RS.SHIPPER_NAME "sendName",
- RC.CONSIGNEE_COMPANY_NAME "reciveName",
- TWR.RESULT_NET_WEIGHT "resultNetWeight",
- TWR.RESULT_GROSS_WEIGHT_TIME "grossweightTime",
- TWR.RESULT_TARE_WEIGHT_TIME "tareWeightTime",
- TWR.RESULT_TARE_WEIGHT "tareWeight",
- TWR.RESULT_GROSS_WEIGHT "grossWeight",
- RC2.CAPACITY_NUMBER "capacityNumber"
- from OMSTRUCK_ORDER OO
- left join AMS_SALE_ORDER_MATERIAL ASOM
- ON ASOM.SALE_ORDER_MATERIAL_ID=OO.ORDER_PLAN_ID
- LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
- ON OOM.ORDER_ID=OO.ORDER_ID
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON TTR.ORDER_ID=OO.ORDER_ID
- LEFT JOIN RMS_CAPACITY RC2
- ON RC2.CAPACITY_ID=OO.CAPACITY_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
- ON TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- left join TMSTRUCK_LOAD_RESULT TLR
- ON TLR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID=OOM.MATERIAL_ID
- LEFT JOIN AMS_SALE_ORDER ASO
- ON ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
- left join RMS_SHIPPER RS
- ON ASO.SHIPPER_ID = RS.SHIPPER_ID
- LEFT JOIN RMS_CONSIGNEE RC
- ON RC.CONSIGNEE_ID=ASO.RECEIVE_ID
- where OO.OPTIONER_CODE = #{orgCode}
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = TLR.RESULT_LOAD_END_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TLR.RESULT_LOAD_END_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
- </if>
- ORDER BY OO.ORDER_NUMBER DESC
- </select>
- <select id="getInwardList" resultType="java.util.Map" parameterType="java.util.Map">
- select *
- from (select oo.order_id "orderId",
- rm.material_name "materialName",
- rc.capacity_number "capacityNumber",
- rs.supplier_name "sendName",
- oo.order_number "orderNumber",
- rce.consignee_company_name "reciveName",
- ttr.result_total_id "totalResultId",
- twr3.result_gross_weight "grossWeight",
- twr3.result_gross_weight_time "grossweightTime",
- twr4.result_tare_weight "tareWeight",
- twr4.result_tare_weight_time "tareWeightTime",
- twr4.result_net_weight "resultNetWeight"
- from omstruck_order oo
- 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 rms_capacity rc
- on rc.capacity_id = oo.capacity_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 rms_supplier rs
- on rs.supplier_id = apo.supplier_unit_id
- left join rms_consignee rce
- on rce.consignee_id = apo.receive_unit_id
- left join tmstruck_total_result ttr
- on ttr.order_id = oo.order_id
- left join tmstruck_weight_result twr1
- on twr1.result_total_id = ttr.result_total_id
- left join rms_truck_calculate rtc1
- on rtc1.truck_calculate_id = twr1.result_tare_place_id
- left 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
- left join tmstruck_weight_result twr2
- on twr2.result_total_id = ttr.result_total_id
- left join rms_truck_calculate rtc2
- on rtc2.truck_calculate_id = twr2.result_gross_place_id
- left join tmstruck_weight_result twr3
- on twr3.result_total_id = ttr.result_total_id
- left join rms_truck_calculate rtc3
- on rtc3.truck_calculate_id = twr3.result_gross_place_id
- left join tmstruck_unload_result tur
- on tur.result_total_id = ttr.result_total_id
- left join rms_warehouse rw2
- on rw2.warehouse_id = tur.result_unload_place_id
- left join tmstruck_weight_result twr4
- on twr4.result_total_id = ttr.result_total_id
- left join rms_truck_calculate rtc4
- on rtc4.truck_calculate_id = twr4.result_tare_place_id
- where oo.order_type in (10, 20)
- and tlr.segment_sqe = 3
- and twr2.gross_segment_sqe = 4
- and twr3.gross_segment_sqe = 7
- and tur.segment_sqe = 8
- and twr4.tare_segment_sqe = 9
- and twr2.result_gross_weight_time is not null
- and oo.OPTIONER_CODE = #{orgCode}
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = TLR.RESULT_LOAD_END_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TLR.RESULT_LOAD_END_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
- </if>
- )
- </select>
- <select id="getPurchaseOrderList" resultType="java.util.Map" parameterType="java.util.Map">
- select OO.ORDER_NUMBER "orderNumber",
- RM.MATERIAL_NAME "materialName",
- RC.CAPACITY_NUMBER "capacityNumber",
- RS.SHIPPER_NAME "sendName",
- RC2.CONSIGNEE_COMPANY_NAME "reciveName",
- TWR.RESULT_GROSS_WEIGHT "grossWeight",
- TWR.RESULT_TARE_WEIGHT "tareWeight",
- TWR.RESULT_GROSS_WEIGHT_TIME "grossweightTime",
- TWR.RESULT_TARE_WEIGHT_TIME "tareWeightTime",
- TWR.RESULT_NET_WEIGHT "resultNetWeight"
- from OMSTRUCK_ORDER OO
- LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
- ON OO.ORDER_ID=OOM.ORDER_ID
- LEFT JOIN RMS_CAPACITY RC
- ON OO.CAPACITY_ID=OO.CAPACITY_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID=OOM.MATERIAL_ID
- LEFT JOIN AMS_PURCHASE_ORDER APO
- ON OO.ORDER_PLAN_ID=APO.PURCHASE_ORDER_ID
- LEFT JOIN RMS_SHIPPER RS
- ON RS.SHIPPER_ID=APO.SUPPLIER_UNIT_ID
- LEFT JOIN RMS_CONSIGNEE RC2
- ON RC2.CONSIGNEE_COMPANY_NAME =APO.RECEIVE_UNIT_ID
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON TTR.ORDER_ID=OO.ORDER_ID
- left join TMSTRUCK_LOAD_RESULT TLR
- ON TTR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
- ON TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- WHERE OO.OPTIONER_CODE=#{orgCode}
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = TLR.RESULT_LOAD_END_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TLR.RESULT_LOAD_END_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
- </if>
- </select>
- </mapper>
|