StatisticalReportMapper.xml 94 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.steerinfo.dil.mapper.StatisticalReportMapper">
  4. <sql id="orderBy">
  5. <if test="orderField != null and orderField != ''">
  6. order by "${orderField}"
  7. <if test="orderType != null and orderType != ''">
  8. ${orderType}
  9. </if>
  10. </if>
  11. </sql>
  12. <!--查询采购统计报表-->
  13. <select id="getFuPurchaseFLRLReport" parameterType="map" resultType="java.util.Map">
  14. select *
  15. from (select
  16. OO.ORDER_NUMBER "orderNumber",
  17. RC.CAPACITY_NUMBER "capacityNumber",
  18. (select
  19. listagg(to_char(TER.RESULT_ENTRY_GATE_TIME,'yyyy-mm-dd hh24:mi:ss'), '/') within group (order by TER.RESULT_ID)
  20. from TMSTRUCK_ENFACTORY_RESULT TER
  21. where TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  22. ) "resultEntryGateTime",
  23. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  24. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  25. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  26. TQR.RESULT_DEDUCTION "resultDeduction",
  27. TUR.RESULT_END_TIME "resultEndTime",
  28. RW.WAREHOUSE_NAME "warehouseName",
  29. TRR.INSERT_TIME "insertTime",
  30. (select
  31. listagg(to_char(TLFR.RESULT_OUT_GATE_TIME,'yyyy-mm-dd hh24:mi:ss'), '/')
  32. within group (order by TLFR.RESULT_ID)
  33. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  34. where TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  35. ) "resultOutGateTime",
  36. OO.INSERT_TIME "insertTimee",
  37. (
  38. select listagg(RG.GATEPOST_NAME, '/') within group ( order by TER2.RESULT_ID)
  39. from TMSTRUCK_ENFACTORY_RESULT TER2
  40. left join RMS_GATEPOST RG on TER2.GATEPOST_ID = RG.GATEPOST_ID
  41. where TER2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  42. ) "enGatepostName",
  43. (
  44. select listagg(RG.GATEPOST_NAME, '/') within group ( order by TLFR2.RESULT_ID)
  45. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR2
  46. left join RMS_GATEPOST RG on TLFR2.GATEPOST_ID = RG.GATEPOST_ID
  47. where TLFR2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  48. )"outGatepostName",
  49. RTCMAO.TRUCK_CALCULATE_NUMBER "grossCalculateNum",
  50. RTCPI.TRUCK_CALCULATE_NUMBER "tareCalculateNum",
  51. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  52. RM.MATERIAL_NAME "materialName",
  53. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode",
  54. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  55. RS.SUPPLIER_NAME "supplierName",
  56. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  57. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime"
  58. from OMSTRUCK_ORDER OO
  59. left join TMSTRUCK_TOTAL_RESULT TTR
  60. on TTR.ORDER_ID = OO.ORDER_ID
  61. left join RMS_CAPACITY RC
  62. on RC.CAPACITY_ID = OO.CAPACITY_ID
  63. left join OMSTRUCK_ORDER_MATERIAL OOM
  64. on OOM.ORDER_ID = OO.ORDER_ID
  65. left join RMS_MATERIAL RM
  66. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  67. left join TMSTRUCK_WEIGHT_RESULT TWR
  68. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  69. left join RMS_TRUCK_CALCULATE RTCMAO --毛重汽车衡
  70. on RTCMAO.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  71. left join RMS_TRUCK_CALCULATE RTCPI --皮重汽车衡
  72. on RTCPI.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  73. left join TMSTRUCK_UNLOAD_RESULT TUR
  74. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  75. left join RMS_WAREHOUSE RW
  76. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  77. left join TMSTRUCK_RECEIPT_RESULT TRR
  78. on TRR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  79. left join TMSTRUCK_QUALITY_RESULT TQR
  80. on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
  81. left join AMS_PURCHASE_ORDER APO
  82. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  83. left join RMS_SUPPLIER RS
  84. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  85. left join RMS_CONSIGNEE RCON
  86. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  87. where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
  88. and OO.ORDER_TYPE = #{orderTypee}
  89. <if test="oneDate != null">
  90. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  91. </if>
  92. <if test="startDate != null">
  93. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  94. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
  95. </if>
  96. )
  97. <where>
  98. <if test="capacityNumber != null">
  99. and
  100. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  101. "capacityNumber" like '%${item}%'
  102. </foreach>
  103. </if>
  104. <if test="warehouseName != null">
  105. and
  106. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  107. "warehouseName" like '%${item}%'
  108. </foreach>
  109. </if>
  110. <if test="resultGrossWeight != null">
  111. and
  112. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  113. "resultGrossWeight" like '%${item}%'
  114. </foreach>
  115. </if>
  116. <if test="resultTareWeight != null">
  117. and
  118. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  119. "resultTareWeight" like '%${item}%'
  120. </foreach>
  121. </if>
  122. <if test="enGatepostName != null">
  123. and
  124. <foreach collection="enGatepostName" item="item" open="(" separator="or" close=")">
  125. "enGatepostName" like '%${item}%'
  126. </foreach>
  127. </if>
  128. <if test="outGatepostName != null">
  129. and
  130. <foreach collection="outGatepostName" item="item" open="(" separator="or" close=")">
  131. "outGatepostName" like '%${item}%'
  132. </foreach>
  133. </if>
  134. <if test="materialName != null">
  135. and
  136. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  137. "materialName" like '%${item}%'
  138. </foreach>
  139. </if>
  140. <if test="purchaseOrderNo != null">
  141. and
  142. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  143. "purchaseOrderNo" like '%${item}%'
  144. </foreach>
  145. </if>
  146. <if test="supplierName != null">
  147. and
  148. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  149. "supplierName" like '%${item}%'
  150. </foreach>
  151. </if>
  152. <if test="receiveName != null">
  153. and
  154. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  155. "receiveName" like '%${item}%'
  156. </foreach>
  157. </if>
  158. </where>
  159. <include refid="orderBy">
  160. </include>
  161. <if test="orderField == null">
  162. order by "insertTimee" desc
  163. </if>
  164. </select>
  165. <!--查询采购辅料统计报表-->
  166. <select id="getAllPurchaseFLRLReport" parameterType="map" resultType="java.util.Map">
  167. select *
  168. from (
  169. select
  170. OO.ORDER_NUMBER "orderNumber",
  171. RC.CAPACITY_NUMBER "capacityNumber",
  172. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  173. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  174. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  175. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  176. TQR.RESULT_DEDUCTION "resultDeduction",
  177. TUR.RESULT_END_TIME "resultEndTime",
  178. RW.WAREHOUSE_NAME "warehouseName",
  179. TRR.INSERT_TIME "insertTime",
  180. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  181. OO.INSERT_TIME "insertTimee",
  182. RGEN.GATEPOST_NAME "enGatepostName",
  183. RGOUT.GATEPOST_NAME "outGatepostName",
  184. RTCMAO.TRUCK_CALCULATE_NUMBER "grossCalculateNum",
  185. RTCPI.TRUCK_CALCULATE_NUMBER "tareCalculateNum",
  186. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  187. RM.MATERIAL_NAME "materialName",
  188. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode",
  189. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  190. RS.SUPPLIER_NAME "supplierName",
  191. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  192. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  193. RL.LINE_NAME "lineName"
  194. from OMSTRUCK_ORDER OO
  195. left join TMSTRUCK_TOTAL_RESULT TTR
  196. on TTR.ORDER_ID = OO.ORDER_ID
  197. left join RMS_CAPACITY RC
  198. on RC.CAPACITY_ID = OO.CAPACITY_ID
  199. left join RMS_LINE RL on OO.LINE_ID = RL.LINE_ID
  200. left join TMSTRUCK_ENFACTORY_RESULT TER
  201. on TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
  202. left join RMS_GATEPOST RGEN --进厂门岗
  203. on RGEN.GATEPOST_ID = TER.GATEPOST_ID
  204. left join OMSTRUCK_ORDER_MATERIAL OOM
  205. on OOM.ORDER_ID = OO.ORDER_ID
  206. left join RMS_MATERIAL RM
  207. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  208. left join TMSTRUCK_WEIGHT_RESULT TWR
  209. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  210. left join RMS_TRUCK_CALCULATE RTCMAO --毛重汽车衡
  211. on RTCMAO.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  212. left join RMS_TRUCK_CALCULATE RTCPI --皮重汽车衡
  213. on RTCPI.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  214. left join TMSTRUCK_UNLOAD_RESULT TUR
  215. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  216. left join RMS_WAREHOUSE RW
  217. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  218. left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  219. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  220. left join RMS_GATEPOST RGOUT --出厂门岗
  221. on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
  222. left join TMSTRUCK_RECEIPT_RESULT TRR
  223. on TRR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  224. left join TMSTRUCK_QUALITY_RESULT TQR
  225. on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
  226. left join AMS_PURCHASE_ORDER APO
  227. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  228. left join RMS_SUPPLIER RS
  229. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  230. left join RMS_CONSIGNEE RCON
  231. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  232. where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
  233. and OO.ORDER_TYPE = #{orderTypee}
  234. <if test="oneDate != null">
  235. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  236. </if>
  237. <if test="startDate != null">
  238. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  239. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
  240. </if>
  241. )
  242. <where>
  243. <if test="capacityNumber != null">
  244. and
  245. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  246. "capacityNumber" like '%${item}%'
  247. </foreach>
  248. </if>
  249. <if test="warehouseName != null">
  250. and
  251. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  252. "warehouseName" like '%${item}%'
  253. </foreach>
  254. </if>
  255. <if test="resultGrossWeight != null">
  256. and
  257. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  258. "resultGrossWeight" like '%${item}%'
  259. </foreach>
  260. </if>
  261. <if test="resultTareWeight != null">
  262. and
  263. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  264. "resultTareWeight" like '%${item}%'
  265. </foreach>
  266. </if>
  267. <if test="enGatepostName != null">
  268. and
  269. <foreach collection="enGatepostName" item="item" open="(" separator="or" close=")">
  270. "enGatepostName" like '%${item}%'
  271. </foreach>
  272. </if>
  273. <if test="outGatepostName != null">
  274. and
  275. <foreach collection="outGatepostName" item="item" open="(" separator="or" close=")">
  276. "outGatepostName" like '%${item}%'
  277. </foreach>
  278. </if>
  279. <if test="materialName != null">
  280. and
  281. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  282. "materialName" like '%${item}%'
  283. </foreach>
  284. </if>
  285. <if test="purchaseOrderNo != null">
  286. and
  287. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  288. "purchaseOrderNo" like '%${item}%'
  289. </foreach>
  290. </if>
  291. <if test="supplierName != null">
  292. and
  293. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  294. "supplierName" like '%${item}%'
  295. </foreach>
  296. </if>
  297. <if test="receiveName != null">
  298. and
  299. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  300. "receiveName" like '%${item}%'
  301. </foreach>
  302. </if>
  303. </where>
  304. <include refid="orderBy"></include>
  305. <if test="orderField == null">
  306. order by "insertTimee" desc
  307. </if>
  308. </select>
  309. <!-- 查询销售统计报表 -->
  310. <!-- 查询销售统计报表 -->
  311. <select id="getAllSaleReport" parameterType="java.util.Map" resultType="java.util.Map">
  312. select * from (
  313. select
  314. *
  315. from (
  316. select DISTINCT OO.ORDER_NUMBER "orderNumber",
  317. RC.CAPACITY_NUMBER "capacityNumber",
  318. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  319. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  320. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  321. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  322. RW.WAREHOUSE_NAME "warehouseName",
  323. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  324. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  325. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  326. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  327. RTCMAO.TRUCK_CALCULATE_NUMBER "maoCalculate",
  328. RTCPI.TRUCK_CALCULATE_NUMBER "piCalculate",
  329. RGEN.GATEPOST_NAME "enGatepostName",
  330. RGOUT.GATEPOST_NAME "outGatepostName",
  331. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  332. RS.SUPPLIER_NAME "sendName",
  333. RM.MATERIAL_NAME "materialName",
  334. TLR.INSERT_UPDATE_REMARK "materialRemark",
  335. ASO.SALE_NUMBER "saleNumber",
  336. TLR.CASE_NUMBER "caseNumber",
  337. RC2.CARRIER_NAME "carrierName",
  338. TAR.RESULT_ARRIVAL_ADDRESS "arrivalAddress",
  339. TRR.RESULT_ARRIVAL_ADDRESS "receiptAddress",
  340. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  341. from TMSTRUCK_WEIGHT_RESULT TWR
  342. left join TMSTRUCK_TOTAL_RESULT TTR
  343. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  344. left join OMSTRUCK_ORDER OO
  345. on TTR.ORDER_ID = OO.ORDER_ID
  346. left join AMS_SALE_ORDER_MATERIAL ASOM
  347. on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  348. left join AMS_DISPATCH_SALE_ORDER ADSO
  349. on ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  350. left join RMS_CARRIER RC2
  351. on RC2.CARRIER_ID = ADSO.CARRIER_ID
  352. left join AMS_SALE_ORDER ASO
  353. on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  354. left join RMS_CONSIGNEE RCON
  355. on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  356. left join RMS_SUPPLIER RS
  357. on RS.SUPPLIER_ID = ASO.SHIPPER_ID
  358. join TMSTRUCK_LOAD_RESULT TLR
  359. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  360. and TLR.MATERIAL_ID = TWR.MATERIAL_ID
  361. left join RMS_WAREHOUSE RW
  362. on RW.WAREHOUSE_ID = TLR.LOADING_ID
  363. left join RMS_TRUCK_CALCULATE RTCMAO
  364. on TWR.RESULT_GROSS_PLACE_ID = RTCMAO.TRUCK_CALCULATE_ID
  365. left join RMS_TRUCK_CALCULATE RTCPI
  366. on TWR.RESULT_TARE_PLACE_ID = RTCPI.TRUCK_CALCULATE_ID
  367. join TMSTRUCK_ENFACTORY_RESULT TER
  368. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  369. left join RMS_GATEPOST RGEN
  370. on RGEN.GATEPOST_ID = TER.GATEPOST_ID
  371. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  372. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  373. left join RMS_GATEPOST RGOUT
  374. on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
  375. join RMS_CAPACITY RC
  376. on RC.CAPACITY_ID = OO.CAPACITY_ID
  377. join RMS_MATERIAL RM
  378. on RM.MATERIAL_ID = TWR.MATERIAL_ID
  379. left join TMSTRUCK_ARRIVAL_RESULT TAR
  380. on TAR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  381. left join TMStRUCK_RECEIPT_RESULT TRR
  382. on TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
  383. WHERE OO.ORDER_TYPE = #{orderType}
  384. AND ASO.SHIPPER_ID = #{shipperId}
  385. <if test="carrierSsoId != null">
  386. and RC2.CARRIER_SSO_ID = #{carrierSsoId}
  387. </if>
  388. <if test="receivName != null">
  389. and RCON.CONSIGNEE_COMPANY_NAME like #{receivName}
  390. </if>
  391. <if test="oneDate != null">
  392. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_GROSS_WEIGHT_TIME
  393. </if>
  394. <if test="startDate != null">
  395. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_GROSS_WEIGHT_TIME
  396. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_GROSS_WEIGHT_TIME
  397. </if>
  398. ) RRR
  399. <where>
  400. <if test="remark != null" >
  401. and RRR."materialName" LIKE #{remark} or RRR."materialRemark" LIKE #{remark}
  402. </if>
  403. </where>
  404. )
  405. <where>
  406. <if test="orderNumber != null">
  407. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  408. "orderNumber" like '%${item}%'
  409. </foreach>
  410. </if>
  411. <if test="carrierName != null">
  412. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  413. "carrierName" like '%${item}%'
  414. </foreach>
  415. </if>
  416. <if test="enGatepostName != null">
  417. <foreach collection="enGatepostName" item="item" open="(" separator="or" close=")">
  418. "enGatepostName" like '%${item}%'
  419. </foreach>
  420. </if>
  421. <if test="outGatepostName != null">
  422. <foreach collection="outGatepostName" item="item" open="(" separator="or" close=")">
  423. "outGatepostName" like '%${item}%'
  424. </foreach>
  425. </if>
  426. <if test="caseNumber != null">
  427. <foreach collection="caseNumber" item="item" open="(" separator="or" close=")">
  428. "caseNumber" like '%${item}%'
  429. </foreach>
  430. </if>
  431. <if test="capacityNumber != null">
  432. and
  433. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  434. "capacityNumber" like '%${item}%'
  435. </foreach>
  436. </if>
  437. <if test="receiveName != null">
  438. and
  439. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  440. "receiveName" like '%${item}%'
  441. </foreach>
  442. </if>
  443. <if test="materialRemark != null">
  444. and
  445. <foreach collection="materialRemark" item="item" open="(" separator="or" close=")">
  446. "materialRemark" = #{item}
  447. </foreach>
  448. </if>
  449. <if test="sendName != null">
  450. and
  451. <foreach collection="sendName" item="item" open="(" separator="or" close=")">
  452. "sendName" like '%${item}%'
  453. </foreach>
  454. </if>
  455. <if test="resultEntryGateTime != null">
  456. and
  457. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  458. "resultEntryGateTime" like '%${item}%'
  459. </foreach>
  460. </if>
  461. <if test="resultTareWeightTime != null">
  462. and
  463. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  464. "resultTareWeightTime" like '%${item}%'
  465. </foreach>
  466. </if>
  467. <if test="resultTareWeight != null">
  468. and
  469. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  470. "resultTareWeight" like '%${item}%'
  471. </foreach>
  472. </if>
  473. <if test="resultLoadEndTime != null">
  474. and
  475. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  476. "resultLoadEndTime" like '%${item}%'
  477. </foreach>
  478. </if>
  479. <if test="warehouseName != null">
  480. and
  481. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  482. "warehouseName" like '%${item}%'
  483. </foreach>
  484. </if>
  485. <if test="resultGrossWeightTime != null">
  486. and
  487. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  488. "resultGrossWeightTime" like '%${item}%'
  489. </foreach>
  490. </if>
  491. <if test="resultGrossWeight != null">
  492. and
  493. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  494. "resultGrossWeight" like '%${item}%'
  495. </foreach>
  496. </if>
  497. <if test="materialName != null">
  498. and
  499. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  500. "materialName" like '%${item}%'
  501. </foreach>
  502. </if>
  503. <if test="resultNetWeight != null">
  504. and
  505. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  506. "resultNetWeight" like '%${item}%'
  507. </foreach>
  508. </if>
  509. <if test="resultOutGateTime != null">
  510. and
  511. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  512. "resultOutGateTime" like '%${item}%'
  513. </foreach>
  514. </if>
  515. </where>
  516. <include refid="orderBy"></include>
  517. <if test="orderField == null">
  518. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  519. </if>
  520. </select>
  521. <!-- 查询零星进厂物资统计报表-->
  522. <select id="getSporadicSuppliesReport1" resultType="java.util.Map">
  523. select
  524. *
  525. from (
  526. select OO.ORDER_NUMBER "orderNumber",
  527. RC.CAPACITY_NUMBER "capacityNumber",
  528. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  529. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  530. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  531. TUR.RESULT_END_TIME "resultEndTime",
  532. RW.WAREHOUSE_NAME "warehouseName",
  533. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  534. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  535. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  536. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  537. -- 查询进厂门岗
  538. RG2.GATEPOST_NAME "gatepostEntryName",
  539. -- 出厂门岗
  540. RG.GATEPOST_NAME "gatepostOutName",
  541. -- 计皮汽车衡
  542. RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
  543. -- 计毛汽车衡
  544. RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
  545. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  546. RS.SUPPLIER_NAME "sendName",
  547. RM.MATERIAL_NAME "materialName",
  548. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  549. from OMSTRUCK_ORDER OO
  550. join TMSTRUCK_TOTAL_RESULT TTR
  551. on TTR.ORDER_ID = OO.ORDER_ID
  552. join TMSTRUCK_UNLOAD_RESULT TUR
  553. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  554. left join RMS_WAREHOUSE RW
  555. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  556. join TMSTRUCK_WEIGHT_RESULT TWR
  557. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  558. left join RMS_TRUCK_CALCULATE RTC2
  559. on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  560. left join RMS_TRUCK_CALCULATE RTC1
  561. on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  562. join TMSTRUCK_ENFACTORY_RESULT TER
  563. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  564. left join RMS_GATEPOST RG2
  565. on RG2.GATEPOST_ID =TER.GATEPOST_ID
  566. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  567. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  568. left join RMS_GATEPOST RG
  569. on TLFR.GATEPOST_ID =RG.GATEPOST_ID
  570. left join RMS_CAPACITY RC
  571. on RC.CAPACITY_ID = OO.CAPACITY_ID
  572. left join AMSTRUCK_SPORADIC_ORDER ASO
  573. on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  574. left join RMS_SUPPLIER RS
  575. on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
  576. left join RMS_CONSIGNEE RCON
  577. on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
  578. join OMSTRUCK_ORDER_MATERIAL OOM
  579. on OOM.ORDER_ID = OO.ORDER_ID
  580. join RMS_MATERIAL RM
  581. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  582. <if test="carrierSsoId != null">
  583. join RMS_CARRIER RCA
  584. on RCA.CARRIER_ID = RC.CARRIER_ID
  585. </if>
  586. where OO.ORDER_TYPE = 12
  587. <if test="carrierSsoId != null">
  588. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  589. </if>
  590. <if test="oneDate != null">
  591. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  592. </if>
  593. <if test="startDate != null">
  594. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  595. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
  596. </if>
  597. <if test="con!=null">
  598. where "receiveName" like #{con} or "sendName" like #{con} or "materialName" like #{con}
  599. or "capacityNumber" like #{con}
  600. </if>
  601. <if test="userId!=null">
  602. and ASO.INSERT_USERNAME=#{userId}
  603. </if>
  604. <if test="userIds!=null">
  605. and ASO.UPDATE_USERNAME=#{userIds}
  606. </if>
  607. )
  608. <where>
  609. <if test="receiveName != null">
  610. and
  611. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  612. "receiveName" like '%${item}%'
  613. </foreach>
  614. </if>
  615. <if test="sendName != null">
  616. and
  617. <foreach collection="sendName" item="item" open="(" separator="or" close=")">
  618. "sendName" like '%${item}%'
  619. </foreach>
  620. </if>
  621. <if test="materialName != null">
  622. and
  623. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  624. "materialName" like '%${item}%'
  625. </foreach>
  626. </if>
  627. <if test="orderNumber != null">
  628. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  629. "orderNumber" like '%${item}%'
  630. </foreach>
  631. </if>
  632. <if test="capacityNumber != null">
  633. and
  634. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  635. "capacityNumber" like '%${item}%'
  636. </foreach>
  637. </if>
  638. <if test="resultEntryGateTime != null">
  639. and
  640. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  641. "resultEntryGateTime" like '%${item}%'
  642. </foreach>
  643. </if>
  644. <if test="resultTareWeightTime != null">
  645. and
  646. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  647. to_char("resultTareWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  648. </foreach>
  649. </if>
  650. <if test="resultTareWeight != null">
  651. and
  652. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  653. "resultTareWeight" like '%${item}%'
  654. </foreach>
  655. </if>
  656. <if test="resultEndTime != null">
  657. and
  658. <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
  659. to_char("resultEndTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  660. </foreach>
  661. </if>
  662. <if test="warehouseName != null">
  663. and
  664. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  665. "warehouseName" like '%${item}%'
  666. </foreach>
  667. </if>
  668. <if test="resultGrossWeightTime != null">
  669. and
  670. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  671. to_char("resultGrossWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  672. </foreach>
  673. </if>
  674. <if test="resultGrossWeight != null">
  675. and
  676. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  677. "resultGrossWeight" like '%${item}%'
  678. </foreach>
  679. </if>
  680. <if test="resultNetWeight != null">
  681. and
  682. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  683. "resultNetWeight" like '%${item}%'
  684. </foreach>
  685. </if>
  686. <if test="resultOutGateTime != null">
  687. and
  688. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  689. "resultOutGateTime" like '%${item}%'
  690. </foreach>
  691. </if>
  692. <if test="gatepostEntryName != null">
  693. and
  694. <foreach collection="gatepostEntryName" item="item" open="(" separator="or" close=")">
  695. "gatepostEntryName" like '%${item}%'
  696. </foreach>
  697. </if>
  698. <if test="gatepostOutName != null">
  699. and
  700. <foreach collection="gatepostOutName" item="item" open="(" separator="or" close=")">
  701. "gatepostOutName" like '%${item}%'
  702. </foreach>
  703. </if>
  704. </where>
  705. <include refid="orderBy"></include>
  706. <if test="orderField == null">
  707. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  708. </if>
  709. </select>
  710. <!-- 查询零星出厂物资统计报表-->
  711. <select id="getSporadicSuppliesReport2" resultType="java.util.Map">
  712. select
  713. *
  714. from (
  715. select OO.ORDER_NUMBER "orderNumber",
  716. RC.CAPACITY_NUMBER "capacityNumber",
  717. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  718. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  719. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  720. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  721. RW.WAREHOUSE_NAME "warehouseName",
  722. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  723. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  724. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  725. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  726. -- 查询进厂门岗
  727. RG2.GATEPOST_NAME "gatepostEntryName",
  728. -- 出厂门岗
  729. RG.GATEPOST_NAME "gatepostOutName",
  730. -- 计皮汽车衡
  731. RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
  732. -- 计毛汽车衡
  733. RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
  734. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  735. RS.SUPPLIER_NAME "sendName",
  736. RM.MATERIAL_NAME "materialName",
  737. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  738. from OMSTRUCK_ORDER OO
  739. join TMSTRUCK_TOTAL_RESULT TTR
  740. on TTR.ORDER_ID = OO.ORDER_ID
  741. join TMSTRUCK_LOAD_RESULT TLR
  742. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  743. left join RMS_WAREHOUSE RW
  744. on RW.WAREHOUSE_ID = TLR.LOADING_ID
  745. join TMSTRUCK_WEIGHT_RESULT TWR
  746. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  747. left join RMS_TRUCK_CALCULATE RTC2
  748. on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  749. left join RMS_TRUCK_CALCULATE RTC1
  750. on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  751. join TMSTRUCK_ENFACTORY_RESULT TER
  752. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  753. left join RMS_GATEPOST RG2
  754. on RG2.GATEPOST_ID =TER.GATEPOST_ID
  755. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  756. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  757. left join RMS_GATEPOST RG
  758. on TLFR.GATEPOST_ID =RG.GATEPOST_ID
  759. left join RMS_CAPACITY RC
  760. on RC.CAPACITY_ID = OO.CAPACITY_ID
  761. left join AMSTRUCK_SPORADIC_ORDER ASO
  762. on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  763. left join RMS_SUPPLIER RS
  764. on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
  765. left join RMS_CONSIGNEE RCON
  766. on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
  767. join OMSTRUCK_ORDER_MATERIAL OOM
  768. on OOM.ORDER_ID = OO.ORDER_ID
  769. join RMS_MATERIAL RM
  770. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  771. <if test="carrierSsoId != null">
  772. join RMS_CARRIER RCA
  773. on RCA.CARRIER_ID = RC.CARRIER_ID
  774. </if>
  775. where OO.ORDER_TYPE = 13
  776. <if test="carrierSsoId != null">
  777. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  778. </if>
  779. <if test="oneDate != null">
  780. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_GROSS_WEIGHT_TIME
  781. </if>
  782. <if test="startDate != null">
  783. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_GROSS_WEIGHT_TIME
  784. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_GROSS_WEIGHT_TIME
  785. </if>
  786. <if test="con!=null">
  787. where "receiveName" like #{con} or "sendName" like #{con} or "materialName" like #{con}
  788. or "capacityNumber" like #{con}
  789. </if>
  790. <if test="userId!=null">
  791. and ASO.INSERT_USERNAME=#{userId}
  792. </if>
  793. <if test="userIds!=null">
  794. and ASO.UPDATE_USERNAME=#{userIds}
  795. </if>
  796. )
  797. <where>
  798. <if test="receiveName != null">
  799. and
  800. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  801. "receiveName" like '%${item}%'
  802. </foreach>
  803. </if>
  804. <if test="sendName != null">
  805. and
  806. <foreach collection="sendName" item="item" open="(" separator="or" close=")">
  807. "sendName" like '%${item}%'
  808. </foreach>
  809. </if>
  810. <if test="materialName != null">
  811. and
  812. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  813. "materialName" like '%${item}%'
  814. </foreach>
  815. </if>
  816. <if test="orderNumber != null">
  817. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  818. "orderNumber" like '%${item}%'
  819. </foreach>
  820. </if>
  821. <if test="capacityNumber != null">
  822. and
  823. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  824. "capacityNumber" like '%${item}%'
  825. </foreach>
  826. </if>
  827. <if test="resultEntryGateTime != null">
  828. and
  829. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  830. "resultEntryGateTime" like '%${item}%'
  831. </foreach>
  832. </if>
  833. <if test="resultTareWeightTime != null">
  834. and
  835. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  836. "resultTareWeightTime" like '%${item}%'
  837. </foreach>
  838. </if>
  839. <if test="resultTareWeight != null">
  840. and
  841. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  842. "resultTareWeight" like '%${item}%'
  843. </foreach>
  844. </if>
  845. <if test="resultLoadEndTime != null">
  846. and
  847. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  848. "resultLoadEndTime" like '%${item}%'
  849. </foreach>
  850. </if>
  851. <if test="warehouseName != null">
  852. and
  853. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  854. "warehouseName" like '%${item}%'
  855. </foreach>
  856. </if>
  857. <if test="resultGrossWeightTime != null">
  858. and
  859. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  860. "resultGrossWeightTime" like '%${item}%'
  861. </foreach>
  862. </if>
  863. <if test="resultGrossWeight != null">
  864. and
  865. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  866. "resultGrossWeight" like '%${item}%'
  867. </foreach>
  868. </if>
  869. <if test="resultNetWeight != null">
  870. and
  871. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  872. "resultNetWeight" like '%${item}%'
  873. </foreach>
  874. </if>
  875. <if test="resultOutGateTime != null">
  876. and
  877. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  878. "resultOutGateTime" like '%${item}%'
  879. </foreach>
  880. </if>
  881. <if test="gatepostEntryName != null">
  882. and
  883. <foreach collection="gatepostEntryName" item="item" open="(" separator="or" close=")">
  884. "gatepostEntryName" like '%${item}%'
  885. </foreach>
  886. </if>
  887. <if test="gatepostOutName != null">
  888. and
  889. <foreach collection="gatepostOutName" item="item" open="(" separator="or" close=")">
  890. "gatepostOutName" like '%${item}%'
  891. </foreach>
  892. </if>
  893. </where>
  894. <include refid="orderBy"></include>
  895. <if test="orderField == null">
  896. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  897. </if>
  898. </select>
  899. <select id="getTotalResultList" resultType="java.util.LinkedHashMap">
  900. SELECT DISTINCT
  901. TTR.RESULT_TOTAL_ID "totalId"
  902. FROM
  903. TMSTRUCK_TOTAL_RESULT TTR
  904. LEFT JOIN OMSTRUCK_ORDER OO ON OO.ORDER_ID = TTR.ORDER_ID
  905. WHERE
  906. OO.ORDER_TYPE in (10,20)
  907. order by TTR.RESULT_TOTAL_ID desc
  908. </select>
  909. <select id="getInwardReportResult" resultType="java.util.LinkedHashMap">
  910. select * from (select oo.order_id "orderId",
  911. oo.ORDER_TYPE "orderType",
  912. rm.material_name "materialName",
  913. apo.purchase_order_no "purchaseNo",
  914. rc.capacity_number "capacityNo",
  915. rs.supplier_name "supplierName",
  916. oo.order_number "orderNumber",
  917. rce.consignee_company_name "consigneeName",
  918. ttr.result_total_id "totalResultId",
  919. ter1.result_entry_mode "entryModeFirst",
  920. ter1.result_entry_gate_time "entryGateTimeFirst",
  921. rg1.gatepost_name "entryGatepostNameFirst",
  922. twr1.result_tare_weight "tareWeightFirst",
  923. twr1.result_tare_weight_time "tareWeightTimeFirst",
  924. rtc1.truck_calculate_number "tareTruckCalculateFirst",
  925. tlr.result_load_end_time "loadTime",
  926. rw.warehouse_name "loadPoint",
  927. twr2.result_gross_weight "grossWeightFirst",
  928. twr2.result_gross_weight_time "grossWeigtTimeFirst",
  929. rtc2.truck_calculate_number "grossTruckCalculateFirst",
  930. twr2.result_net_weight "netWeightFirst",
  931. tlfr1.result_out_gate_time "outGatepostTimeFirst",
  932. tlfr1.result_out_mode "outModeFirst",
  933. rg2.gatepost_name "gatepostNameFirst",
  934. ter2.result_entry_mode "entryModeSecond",
  935. ter2.result_entry_gate_time "resultEntryGateTime",
  936. ter2.result_entry_gate_time "entryGateTimeSecond",
  937. rg3.gatepost_name "entryGatepostNameSecond",
  938. twr3.result_gross_weight "grossWeightSecond",
  939. twr3.result_gross_weight_time "grossWeigtTimeSecond",
  940. rtc3.truck_calculate_number "grossTruckCalculateSecond",
  941. tur.result_end_time "unloadTime",
  942. rw2.warehouse_name "unloadPoint",
  943. twr4.result_tare_weight "tareWeightSecond",
  944. twr4.result_tare_weight_time "tareWeightTimeSecond",
  945. twr4.result_net_weight "netWeightSecond",
  946. rtc4.truck_calculate_number "tareTruckCalculateSecond",
  947. tlfr2.result_out_gate_time "outGatepostTimeSecond",
  948. tlfr2.result_out_gate_time "resultOutGateTime",
  949. tlfr2.result_out_mode "outModeSecond",
  950. rg4.gatepost_name "gatepostNameSecond"
  951. from omstruck_order oo
  952. left join omstruck_order_material oom
  953. on oom.order_id = oo.order_id
  954. left join rms_material rm
  955. on rm.material_id = oom.material_id
  956. left join rms_capacity rc
  957. on rc.capacity_id = oo.capacity_id
  958. left join amstruck_inward_plan aip
  959. on aip.plan_id = oo.order_plan_id
  960. left join amstruck_requirement_plan arp
  961. on arp.plan_id = aip.plan_id
  962. left join amstruck_inward_requirement air
  963. on air.requirement_id = arp.requirement_id
  964. left join ams_purchase_order apo
  965. on apo.purchase_order_id = air.purchase_order_id
  966. left join rms_supplier rs
  967. on rs.supplier_id = apo.supplier_unit_id
  968. left join rms_consignee rce
  969. on rce.consignee_id = apo.receive_unit_id
  970. left join tmstruck_total_result ttr
  971. on ttr.order_id = oo.order_id
  972. left join tmstruck_enfactory_result ter1
  973. on ter1.result_total_id = ttr.result_total_id
  974. left join rms_gatepost rg1
  975. on rg1.gatepost_id = ter1.gatepost_id
  976. left join tmstruck_weight_result twr1
  977. on twr1.result_total_id = ttr.result_total_id
  978. left join rms_truck_calculate rtc1
  979. on rtc1.truck_calculate_id = twr1.result_tare_place_id
  980. left join tmstruck_load_result tlr
  981. on tlr.result_total_id = ttr.result_total_id
  982. left join rms_warehouse rw
  983. on rw.warehouse_id = tlr.loading_id
  984. left join tmstruck_weight_result twr2
  985. on twr2.result_total_id = ttr.result_total_id
  986. left join rms_truck_calculate rtc2
  987. on rtc2.truck_calculate_id = twr2.result_gross_place_id
  988. left join tmstruck_leave_factory_result tlfr1
  989. on tlfr1.result_total_id = ttr.result_total_id
  990. left join rms_gatepost rg2
  991. on tlfr1.gatepost_id = rg2.gatepost_id
  992. left join tmstruck_enfactory_result ter2
  993. on ter2.result_total_id = ttr.result_total_id
  994. left join rms_gatepost rg3
  995. on rg3.gatepost_id = ter2.gatepost_id
  996. left join tmstruck_weight_result twr3
  997. on twr3.result_total_id = ttr.result_total_id
  998. left join rms_truck_calculate rtc3
  999. on rtc3.truck_calculate_id = twr3.result_gross_place_id
  1000. left join tmstruck_unload_result tur
  1001. on tur.result_total_id = ttr.result_total_id
  1002. left join rms_warehouse rw2
  1003. on rw2.warehouse_id = tur.result_unload_place_id
  1004. left join tmstruck_weight_result twr4
  1005. on twr4.result_total_id = ttr.result_total_id
  1006. left join rms_truck_calculate rtc4
  1007. on rtc4.truck_calculate_id = twr4.result_tare_place_id
  1008. left join tmstruck_leave_factory_result tlfr2
  1009. on tlfr2.result_total_id = ttr.result_total_id
  1010. left join rms_gatepost rg4
  1011. on tlfr2.gatepost_id = rg4.gatepost_id
  1012. left join RMS_TRANS_RANGE RTR
  1013. on RTR.TRANS_RANGE_ID = AIR.LINE_ID
  1014. where oo.order_type in (10,20)
  1015. and ter1.segmen_sqe = 1
  1016. and twr1.tare_segment_sqe = 2
  1017. and tlr.segment_sqe = 3
  1018. and twr2.gross_segment_sqe = 4
  1019. and tlfr1.segment_sqe = 5
  1020. and ter2.segmen_sqe = 6
  1021. and twr3.gross_segment_sqe = 7
  1022. and tur.segment_sqe = 8
  1023. and twr4.tare_segment_sqe = 9
  1024. and tlfr2.segment_sqe = 10
  1025. and twr2.result_gross_weight_time is not null
  1026. <if test="oneDate != null">
  1027. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR4.RESULT_TARE_WEIGHT_TIME
  1028. </if>
  1029. <if test="startDate != null">
  1030. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR4.RESULT_TARE_WEIGHT_TIME
  1031. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR4.RESULT_TARE_WEIGHT_TIME
  1032. </if>
  1033. )
  1034. <where>
  1035. <if test="consigneeName != null">
  1036. and
  1037. <foreach collection="consigneeName" item="item" open="(" separator="or" close=")">
  1038. "consigneeName" like '%${item}%'
  1039. </foreach>
  1040. </if>
  1041. <if test="supplierName != null">
  1042. and
  1043. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  1044. "supplierName" like '%${item}%'
  1045. </foreach>
  1046. </if>
  1047. <if test="materialName != null">
  1048. and
  1049. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1050. "materialName" like '%${item}%'
  1051. </foreach>
  1052. </if>
  1053. <if test="orderNumber != null">
  1054. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1055. "orderNumber" like '%${item}%'
  1056. </foreach>
  1057. </if>
  1058. <if test="capacityNo != null">
  1059. and
  1060. <foreach collection="capacityNo" item="item" open="(" separator="or" close=")">
  1061. "capacityNo" like '%${item}%'
  1062. </foreach>
  1063. </if>
  1064. </where><include refid="orderBy"></include>
  1065. <if test="orderField == null">
  1066. order by "outGatepostTimeFirst" desc, "entryGateTimeFirst" desc
  1067. </if>
  1068. </select>
  1069. <select id="getInwardReport" parameterType="map" resultType="java.util.Map">
  1070. select * from (
  1071. select
  1072. OO.ORDER_NUMBER "orderNumber",
  1073. RC.CAPACITY_NUMBER "capacityNumber",
  1074. RS.SHIPPER_NAME "shipperName",
  1075. RW1.WAREHOUSE_NAME "unloadName",
  1076. RW2.WAREHOUSE_NAME "loadName",
  1077. RM.MATERIAL_NAME "materialName",
  1078. RTC2.TRUCK_CALCULATE_NUMBER "grossNumber",
  1079. RTC1.TRUCK_CALCULATE_NUMBER "tareNumber",
  1080. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  1081. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  1082. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  1083. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  1084. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight"
  1085. from OMSTRUCK_ORDER OO
  1086. left join TMSTRUCK_TOTAL_RESULT TTR on OO.ORDER_ID = TTR.ORDER_ID
  1087. left join TMSTRUCK_WEIGHT_RESULT TWR on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
  1088. left join RMS_CAPACITY RC on OO.CAPACITY_ID = RC.CAPACITY_ID
  1089. left join RMS_TRUCK_CALCULATE RTC1 on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  1090. left join RMS_TRUCK_CALCULATE RTC2 on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  1091. left join AMSTRUCK_INWARD_PLAN AIP on AIP.PLAN_ID = OO.ORDER_PLAN_ID
  1092. left join AMSTRUCK_REQUIREMENT_PLAN ARP on AIP.PLAN_ID = ARP.PLAN_ID
  1093. left join AMSTRUCK_INWARD_REQUIREMENT AIR on AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
  1094. left join RMS_SHIPPER RS on AIR.REQUIREMENT_SHIPPER_ID = RS.SHIPPER_ID
  1095. left join AMSTRUCK_REQUIREMENT_MATERIAL ARM on AIR.REQUIREMENT_ID = ARM.REQUIREMENT_ID
  1096. left join RMS_MATERIAL RM on ARM.MATERIAL_ID = RM.MATERIAL_ID
  1097. left join RMS_WAREHOUSE RW1 on ARM.REQUIREMENT_UNLOAD_UNIT_ID = RW1.WAREHOUSE_ID
  1098. left join RMS_WAREHOUSE RW2 on ARM.REQUIREMENT_PLATFORM_ID = RW2.WAREHOUSE_ID
  1099. where OO.ORDER_TYPE = 11 and TWR.RESULT_NET_WEIGHT >= 0
  1100. <if test="oneDate != null">
  1101. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  1102. </if>
  1103. <if test="startDate != null">
  1104. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  1105. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
  1106. </if>
  1107. )
  1108. <where>
  1109. <if test="orderNumber != null">
  1110. and
  1111. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1112. "orderNumber" like '%${item}%'
  1113. </foreach>
  1114. </if>
  1115. <if test="capacityNumber != null">
  1116. and
  1117. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1118. "capacityNumber" like '%${item}%'
  1119. </foreach>
  1120. </if>
  1121. <if test="shipperName != null">
  1122. and
  1123. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1124. "shipperName" like '%${item}%'
  1125. </foreach>
  1126. </if>
  1127. <if test="unloadName != null">
  1128. <foreach collection="unloadName" item="item" open="(" separator="or" close=")">
  1129. "unloadName" like '%${item}%'
  1130. </foreach>
  1131. </if>
  1132. <if test="loadName != null">
  1133. and
  1134. <foreach collection="loadName" item="item" open="(" separator="or" close=")">
  1135. "loadName" like '%${item}%'
  1136. </foreach>
  1137. </if>
  1138. <if test="materialName != null">
  1139. and
  1140. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1141. "materialName" like '%${item}%'
  1142. </foreach>
  1143. </if>
  1144. <if test="grossNumber != null">
  1145. and
  1146. <foreach collection="grossNumber" item="item" open="(" separator="or" close=")">
  1147. "grossNumber" like '%${item}%'
  1148. </foreach>
  1149. </if>
  1150. <if test="tareNumber != null">
  1151. and
  1152. <foreach collection="tareNumber" item="item" open="(" separator="or" close=")">
  1153. "tareNumber" like '%${item}%'
  1154. </foreach>
  1155. </if>
  1156. <if test="resultNetWeight != null">
  1157. and
  1158. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  1159. "resultNetWeight" like '%${item}%'
  1160. </foreach>
  1161. </if>
  1162. <if test="resultTareWeightTime != null">
  1163. and
  1164. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  1165. to_char("resultTareWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  1166. </foreach>
  1167. </if>
  1168. <if test="resultTareWeight != null">
  1169. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  1170. "resultTareWeight" like '%${item}%'
  1171. </foreach>
  1172. </if>
  1173. <if test="resultGrossWeightTime != null">
  1174. and
  1175. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  1176. to_char("resultGrossWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  1177. </foreach>
  1178. </if>
  1179. <if test="resultGrossWeight != null">
  1180. and
  1181. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  1182. "resultGrossWeight" like '%${item}%'
  1183. </foreach>
  1184. </if>
  1185. </where>
  1186. <if test="orderField != null and orderField != ''">
  1187. order by "resultTareWeightTime"
  1188. </if>
  1189. </select>
  1190. <select id="getLoading" parameterType="map" resultType="java.util.Map">
  1191. SELECT * FROM(
  1192. SELECT MATERIAL_NAME "materialName",
  1193. COUNT(RC.CAPACITY_NUMBER) "capacityNumber",
  1194. SUM(TWR.RESULT_NET_WEIGHT) "resultNetWeight",
  1195. count(TWR.RESULT_NET_WEIGHT) "number",
  1196. WAREHOUSE_NAME "warehouseName"
  1197. FROM TMSTRUCK_LOAD_RESULT TLR
  1198. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1199. ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
  1200. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1201. ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1202. LEFT JOIN OMSTRUCK_ORDER OO
  1203. ON OO.ORDER_ID = TTR.ORDER_ID
  1204. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1205. ON OOM.ORDER_ID = OO.ORDER_ID
  1206. LEFT JOIN RMS_MATERIAL RM
  1207. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1208. LEFT JOIN RMS_CAPACITY RC
  1209. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1210. LEFT JOIN RMS_WAREHOUSE RW
  1211. ON RW.WAREHOUSE_ID = TLR.LOADING_ID
  1212. WHERE OO.ORDER_TYPE = 11
  1213. AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
  1214. <if test="oneDate != null">
  1215. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TLR.RESULT_LOAD_END_TIME
  1216. </if>
  1217. <if test="startDate != null">
  1218. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
  1219. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
  1220. </if>
  1221. GROUP BY MATERIAL_NAME, WAREHOUSE_NAME
  1222. )
  1223. <include refid="orderBy"></include>
  1224. <where>
  1225. <if test="materialName != null">
  1226. and
  1227. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1228. "materialName" like '%${item}%'
  1229. </foreach>
  1230. </if>
  1231. <if test="capacityNumber != null">
  1232. and
  1233. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1234. "capacityNumber" like '%${item}%'
  1235. </foreach>
  1236. </if>
  1237. <if test="warehouseName != null">
  1238. and
  1239. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1240. "warehouseName" like '%${item}%'
  1241. </foreach>
  1242. </if>
  1243. <if test="number != null">
  1244. and
  1245. <foreach collection="number" item="item" open="(" separator="or" close=")">
  1246. "number" like '%${item}%'
  1247. </foreach>
  1248. </if>
  1249. </where>
  1250. </select>
  1251. <select id="getUnLoading" parameterType="map" resultType="java.util.Map">
  1252. SELECT * FROM (
  1253. SELECT
  1254. COUNT(RC.CAPACITY_NUMBER) "capacityNumber",
  1255. SUM(TWR.RESULT_NET_WEIGHT) "resultNetWeight",
  1256. count(TWR.RESULT_NET_WEIGHT) "number",
  1257. MATERIAL_NAME "materialName",
  1258. WAREHOUSE_NAME "warehouseName"
  1259. FROM TMSTRUCK_UNLOAD_RESULT TUR
  1260. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1261. ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  1262. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1263. ON TWR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  1264. LEFT JOIN OMSTRUCK_ORDER OO
  1265. ON OO.ORDER_ID = TTR.ORDER_ID
  1266. LEFT JOIN RMS_CAPACITY RC
  1267. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1268. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1269. ON OOM.ORDER_ID = OO.ORDER_ID
  1270. LEFT JOIN RMS_MATERIAL RM
  1271. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1272. LEFT JOIN RMS_WAREHOUSE RW
  1273. ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  1274. WHERE TUR.RESULT_END_TIME IS NOT NULL
  1275. AND OO.ORDER_TYPE = 11
  1276. <if test="oneDate != null">
  1277. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TUR.RESULT_END_TIME
  1278. </if>
  1279. <if test="startDate != null">
  1280. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TUR.RESULT_END_TIME
  1281. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TUR.RESULT_END_TIME
  1282. </if>
  1283. GROUP BY MATERIAL_NAME, WAREHOUSE_NAME
  1284. )
  1285. <include refid="orderBy"></include>
  1286. <where>
  1287. <if test="materialName != null">
  1288. and
  1289. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1290. "materialName" like '%${item}%'
  1291. </foreach>
  1292. </if>
  1293. <if test="capacityNumber != null">
  1294. and
  1295. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1296. "capacityNumber" like '%${item}%'
  1297. </foreach>
  1298. </if>
  1299. <if test="warehouseName != null">
  1300. and
  1301. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1302. "warehouseName" like '%${item}%'
  1303. </foreach>
  1304. </if>
  1305. <if test="resultNetWeight != null">
  1306. and
  1307. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  1308. "resultNetWeight" like '%${item}%'
  1309. </foreach>
  1310. </if>
  1311. <if test="number != null">
  1312. and
  1313. <foreach collection="number" item="item" open="(" separator="or" close=")">
  1314. "number" like '%${item}%'
  1315. </foreach>
  1316. </if>
  1317. </where>
  1318. </select>
  1319. <select id="getLXReportResult" parameterType="map" resultType="java.util.LinkedHashMap">
  1320. SELECT
  1321. *
  1322. FROM (
  1323. SELECT
  1324. OO.ORDER_ID "orderId",
  1325. RM.MATERIAL_NAME "materialName",
  1326. RC.CAPACITY_NUMBER "capacityNo",
  1327. RS.SUPPLIER_NAME "supplierName",
  1328. OO.ORDER_NUMBER "orderNumber",
  1329. RCE.CONSIGNEE_COMPANY_NAME "consigneeName",
  1330. TTR.RESULT_TOTAL_ID "totalResultId",
  1331. TER1.RESULT_ENTRY_MODE "entryModeFirst",
  1332. TER1.RESULT_ENTRY_GATE_TIME "entryGateTimeFirst",
  1333. RG1.GATEPOST_NAME "entryGatepostNameFirst",
  1334. TWR1.RESULT_TARE_WEIGHT "tareWeightFirst",
  1335. TWR1.RESULT_TARE_WEIGHT_TIME "tareWeightTimeFirst",
  1336. RTC1.TRUCK_CALCULATE_NUMBER "tareTruckCalculateFirst",
  1337. TLR.RESULT_LOAD_END_TIME "loadTime",
  1338. RW.WAREHOUSE_NAME "loadPoint",
  1339. TWR2.RESULT_GROSS_WEIGHT "grossWeightFirst",
  1340. TWR2.RESULT_GROSS_WEIGHT_TIME "grossWeigtTimeFirst",
  1341. RTC2.TRUCK_CALCULATE_NUMBER "grossTruckCalculateFirst",
  1342. TWR2.RESULT_NET_WEIGHT "netWeightFirst",
  1343. TLFR1.RESULT_OUT_GATE_TIME "outGatepostTimeFirst",
  1344. TLFR1.RESULT_OUT_MODE "outModeFirst",
  1345. RG2.GATEPOST_NAME "gatepostNameFirst",
  1346. TER2.RESULT_ENTRY_MODE "entryModeSecond",
  1347. TER2.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1348. TER2.RESULT_ENTRY_GATE_TIME "entryGateTimeSecond",
  1349. RG3.GATEPOST_NAME "entryGatepostNameSecond",
  1350. TWR3.RESULT_GROSS_WEIGHT "grossWeightSecond",
  1351. TWR3.RESULT_GROSS_WEIGHT_TIME "grossWeigtTimeSecond",
  1352. RTC3.TRUCK_CALCULATE_NUMBER "grossTruckCalculateSecond",
  1353. TUR.RESULT_END_TIME "unloadTime",
  1354. RW2.WAREHOUSE_NAME "unloadPoint",
  1355. TWR4.RESULT_TARE_WEIGHT "tareWeightSecond",
  1356. TWR4.RESULT_TARE_WEIGHT_TIME "tareWeightTimeSecond",
  1357. TWR4.RESULT_NET_WEIGHT "netWeightSecond",
  1358. RTC4.TRUCK_CALCULATE_NUMBER "tareTruckCalculateSecond",
  1359. TLFR2.RESULT_OUT_GATE_TIME "outGatepostTimeSecond",
  1360. TLFR2.RESULT_OUT_GATE_TIME "resultOutGateTime",
  1361. TLFR2.RESULT_OUT_MODE "outModeSecond",
  1362. RG4.GATEPOST_NAME "gatepostNameSecond"
  1363. FROM OMSTRUCK_ORDER OO
  1364. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OOM.ORDER_ID = OO.ORDER_ID
  1365. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1366. LEFT JOIN RMS_CAPACITY RC ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1367. LEFT JOIN AMSTRUCK_SPORADIC_ORDER ASO ON ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  1368. LEFT JOIN RMS_SUPPLIER RS ON RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
  1369. LEFT JOIN RMS_CONSIGNEE RCE ON RCE.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
  1370. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID = OO.ORDER_ID
  1371. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER1 ON TER1.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1372. LEFT JOIN RMS_GATEPOST RG1 ON RG1.GATEPOST_ID = TER1.GATEPOST_ID
  1373. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR1 ON TWR1.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1374. LEFT JOIN RMS_TRUCK_CALCULATE RTC1 ON RTC1.TRUCK_CALCULATE_ID = TWR1.RESULT_TARE_PLACE_ID
  1375. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1376. LEFT JOIN RMS_WAREHOUSE RW ON RW.WAREHOUSE_ID = TLR.LOADING_ID
  1377. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR2 ON TWR2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1378. LEFT JOIN RMS_TRUCK_CALCULATE RTC2 ON RTC2.TRUCK_CALCULATE_ID = TWR2.RESULT_GROSS_PLACE_ID
  1379. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR1 ON TLFR1.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1380. LEFT JOIN RMS_GATEPOST RG2 ON TLFR1.GATEPOST_ID = RG2.GATEPOST_ID
  1381. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER2 ON TER2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1382. LEFT JOIN RMS_GATEPOST RG3 ON RG3.GATEPOST_ID = TER2.GATEPOST_ID
  1383. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR3 ON TWR3.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1384. LEFT JOIN RMS_TRUCK_CALCULATE RTC3 ON RTC3.TRUCK_CALCULATE_ID = TWR3.RESULT_GROSS_PLACE_ID
  1385. LEFT JOIN TMSTRUCK_UNLOAD_RESULT TUR ON TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1386. LEFT JOIN RMS_WAREHOUSE RW2 ON RW2.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  1387. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR4 ON TWR4.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1388. LEFT JOIN RMS_TRUCK_CALCULATE RTC4 ON RTC4.TRUCK_CALCULATE_ID = TWR4.RESULT_TARE_PLACE_ID
  1389. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR2 ON TLFR2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1390. LEFT JOIN RMS_GATEPOST RG4 ON TLFR2.GATEPOST_ID = RG4.GATEPOST_ID
  1391. WHERE OO.ORDER_TYPE = 14
  1392. AND TER1.SEGMEN_SQE = 1
  1393. AND TWR1.TARE_SEGMENT_SQE = 2
  1394. AND TLR.SEGMENT_SQE = 3
  1395. AND TWR2.GROSS_SEGMENT_SQE = 4
  1396. AND TLFR1.SEGMENT_SQE = 5
  1397. AND TER2.SEGMEN_SQE = 6
  1398. AND TWR3.GROSS_SEGMENT_SQE = 7
  1399. AND TUR.SEGMENT_SQE = 8
  1400. AND TWR4.TARE_SEGMENT_SQE = 9
  1401. AND TLFR2.SEGMENT_SQE = 10
  1402. AND TWR2.RESULT_GROSS_WEIGHT_TIME IS NOT NULL
  1403. <if test="oneDate != null">
  1404. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR4.RESULT_TARE_WEIGHT_TIME
  1405. </if>
  1406. <if test="startDate != null">
  1407. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR4.RESULT_TARE_WEIGHT_TIME
  1408. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR4.RESULT_TARE_WEIGHT_TIME
  1409. </if>
  1410. )
  1411. <where>
  1412. <if test="consigneeName != null">
  1413. <foreach collection="consigneeName" item="item" open="(" separator="or" close=")">
  1414. "consigneeName" like '%${item}%'
  1415. </foreach>
  1416. </if>
  1417. <if test="supplierName != null">
  1418. and
  1419. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  1420. "supplierName" like '%${item}%'
  1421. </foreach>
  1422. </if>
  1423. <if test="materialName != null">
  1424. and
  1425. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1426. "materialName" like '%${item}%'
  1427. </foreach>
  1428. </if>
  1429. <if test="orderNumber != null">
  1430. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1431. "orderNumber" like '%${item}%'
  1432. </foreach>
  1433. </if>
  1434. <if test="capacityNo != null">
  1435. and
  1436. <foreach collection="capacityNo" item="item" open="(" separator="or" close=")">
  1437. "capacityNo" like '%${item}%'
  1438. </foreach>
  1439. </if>
  1440. </where><include refid="orderBy"></include>
  1441. <if test="orderField == null">
  1442. order by "outGatepostTimeFirst" desc, "entryGateTimeFirst" desc
  1443. </if>
  1444. </select>
  1445. <!-- 查询装机统计报表-->
  1446. <select id="getLoaderResult" resultType="java.util.Map" parameterType="java.util.Map">
  1447. select *
  1448. from(select
  1449. COUNT(RC.CAPACITY_NUMBER) "number",
  1450. sum(TWR.RESULT_NET_WEIGHT) "netWeight",
  1451. TLR.CAPACITY_REMARK "LoaderCapacityNumber"
  1452. from OMSTRUCK_ORDER OO
  1453. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1454. ON TTR.ORDER_ID=OO.ORDER_ID
  1455. LEFT JOIN RMS_CAPACITY RC
  1456. ON RC.CAPACITY_ID=OO.CAPACITY_ID
  1457. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
  1458. ON TLR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1459. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1460. ON TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1461. where TLR.CAPACITY_REMARK IS NOT NULL
  1462. <if test="oneDate != null">
  1463. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TLR.RESULT_LOAD_END_TIME
  1464. </if>
  1465. <if test="startDate != null">
  1466. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
  1467. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
  1468. </if>
  1469. GROUP BY TLR.CAPACITY_REMARK
  1470. )
  1471. <where>
  1472. <if test="number != null">
  1473. and
  1474. <foreach collection="number" item="item" open="(" separator="or" close=")">
  1475. "number" like '%${item}%'
  1476. </foreach>
  1477. </if>
  1478. <if test="netWeight != null">
  1479. and
  1480. <foreach collection="netWeight" item="item" open="(" separator="or" close=")">
  1481. "netWeight" like '%${item}%'
  1482. </foreach>
  1483. </if>
  1484. <if test="LoaderCapacityNumber != null">
  1485. and
  1486. <foreach collection="LoaderCapacityNumber" item="item" open="(" separator="or" close=")">
  1487. "LoaderCapacityNumber" like '%${item}%'
  1488. </foreach>
  1489. </if>
  1490. </where>
  1491. </select>
  1492. <select id="getCapacityByDefend" resultType="java.util.Map" parameterType="java.util.Map">
  1493. select distinct * from(
  1494. select rc.CAPACITY_NUMBER "capacityNumber",
  1495. oo.ORDER_NUMBER "orderNumber",
  1496. ter.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1497. rg1.GATEPOST_NAME "gatepostName1",
  1498. tlfr.RESULT_OUT_GATE_TIME "resultOutGateTime",
  1499. rg2.GATEPOST_NAME "gatepostName2",
  1500. rm.material_name "materialName"
  1501. from OMSTRUCK_ORDER oo
  1502. left join OMSTRUCK_ORDER_MATERIAL oom
  1503. on oom.ORDER_ID = oo.ORDER_ID
  1504. left join RMS_MATERIAL rm
  1505. on rm.MATERIAL_ID = oom.MATERIAL_ID
  1506. left join RMS_CAPACITY rc
  1507. on rc.CAPACITY_ID = oo.CAPACITY_ID
  1508. left join TMSTRUCK_TOTAL_RESULT ttr
  1509. on ttr.ORDER_ID = oo.ORDER_ID
  1510. left join TMSTRUCK_ENFACTORY_RESULT ter
  1511. on ter.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  1512. left join RMS_GATEPOST rg1
  1513. on rg1.GATEPOST_ID = ter.GATEPOST_ID
  1514. left join TMSTRUCK_LEAVE_FACTORY_RESULT tlfr
  1515. on tlfr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  1516. left join RMS_GATEPOST rg2
  1517. on rg2.GATEPOST_ID = tlfr.GATEPOST_ID
  1518. <where>
  1519. <if test="oneDate != null">
  1520. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = tlfr.RESULT_OUT_GATE_TIME
  1521. </if>
  1522. <if test="startDate != null" >
  1523. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = tlfr.RESULT_OUT_GATE_TIME
  1524. </if>
  1525. <if test="endDate != null" >
  1526. and to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss') >= tlfr.RESULT_OUT_GATE_TIME
  1527. </if>
  1528. <if test="con != null">
  1529. and (instr(rc.CAPACITY_NUMBER, #{con}) > 0 or instr(rg1.GATEPOST_NAME, #{con}) > 0 or instr(rg2.GATEPOST_NAME, #{con}) > 0 )
  1530. </if>
  1531. </where>
  1532. order by ter.RESULT_ENTRY_GATE_TIME desc
  1533. )
  1534. <where>
  1535. <if test=" capacityNumber!= null">
  1536. and
  1537. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1538. "capacityNumber" like '%${item}%'
  1539. </foreach>
  1540. </if>
  1541. <if test="orderNumber != null">
  1542. and
  1543. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1544. "orderNumber" like '%${item}%'
  1545. </foreach>
  1546. </if>
  1547. <if test="resultGrossWeight != null">
  1548. and
  1549. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  1550. "resultGrossWeight" like '%${item}%'
  1551. </foreach>
  1552. </if>
  1553. <if test=" resultGrossWeightTime!= null">
  1554. and
  1555. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  1556. "resultGrossWeightTime" like '%${item}%'
  1557. </foreach>
  1558. </if>
  1559. <if test="truckCalculateNumber1 != null">
  1560. and
  1561. <foreach collection="truckCalculateNumber1" item="item" open="(" separator="or" close=")">
  1562. "truckCalculateNumber1" like '%${item}%'
  1563. </foreach>
  1564. </if>
  1565. <if test="resultTareWeight != null">
  1566. and
  1567. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  1568. "resultTareWeight" like '%${item}%'
  1569. </foreach>
  1570. </if>
  1571. <if test=" resultTareWeightTime != null">
  1572. and
  1573. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  1574. "resultTareWeightTime" like '%${item}%'
  1575. </foreach>
  1576. </if>
  1577. <if test="truckCalculateNumber2 != null">
  1578. and
  1579. <foreach collection="truckCalculateNumber2" item="item" open="(" separator="or" close=")">
  1580. "truckCalculateNumber2" like '%${item}%'
  1581. </foreach>
  1582. </if>
  1583. <if test=" resultNetWeight!= null">
  1584. and
  1585. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  1586. "resultNetWeight" like '%${item}%'
  1587. </foreach>
  1588. </if>
  1589. <if test=" resultEntryGateTime!= null">
  1590. and
  1591. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  1592. "resultEntryGateTime" like '%${item}%'
  1593. </foreach>
  1594. </if>
  1595. <if test=" gatepostName1!= null">
  1596. and
  1597. <foreach collection="gatepostName1" item="item" open="(" separator="or" close=")">
  1598. "gatepostName1" like '%${item}%'
  1599. </foreach>
  1600. </if>
  1601. <if test=" resultOutGateTime!= null">
  1602. and
  1603. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  1604. "resultOutGateTime" like '%${item}%'
  1605. </foreach>
  1606. </if>
  1607. <if test=" gatepostName2 != null">
  1608. and
  1609. <foreach collection="gatepostName2" item="item" open="(" separator="or" close=")">
  1610. "gatepostName2" like '%${item}%'
  1611. </foreach>
  1612. </if>
  1613. <if test=" resultLoadEndTime != null">
  1614. and
  1615. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  1616. "resultLoadEndTime" like '%${item}%'
  1617. </foreach>
  1618. </if>
  1619. <if test=" warehouseName1 != null">
  1620. and
  1621. <foreach collection="warehouseName1" item="item" open="(" separator="or" close=")">
  1622. "warehouseName1" like '%${item}%'
  1623. </foreach>
  1624. </if>
  1625. <if test=" resultEndTime != null">
  1626. and
  1627. <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
  1628. "resultEndTime" like '%${item}%'
  1629. </foreach>
  1630. </if>
  1631. <if test=" warehouseName2 != null">
  1632. and
  1633. <foreach collection="warehouseName2" item="item" open="(" separator="or" close=")">
  1634. "warehouseName2" like '%${item}%'
  1635. </foreach>
  1636. </if>
  1637. </where>
  1638. </select>
  1639. <select id="getInwardReportForAssemble" resultType="java.util.Map" parameterType="java.util.Map">
  1640. select * from (
  1641. select
  1642. OO.ORDER_NUMBER "orderNumber",
  1643. RC.CAPACITY_NUMBER "capacityNumber",
  1644. RS.SHIPPER_NAME "shipperName",
  1645. RW1.WAREHOUSE_NAME "unloadName",
  1646. RW2.WAREHOUSE_NAME "loadName",
  1647. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  1648. RM.MATERIAL_NAME "materialName",
  1649. RTC2.TRUCK_CALCULATE_NUMBER "grossNumber",
  1650. RTC1.TRUCK_CALCULATE_NUMBER "tareNumber",
  1651. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  1652. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  1653. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  1654. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  1655. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight"
  1656. from OMSTRUCK_ORDER OO
  1657. left join TMSTRUCK_TOTAL_RESULT TTR on OO.ORDER_ID = TTR.ORDER_ID
  1658. left join TMSTRUCK_WEIGHT_RESULT TWR on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
  1659. left join RMS_CAPACITY RC on OO.CAPACITY_ID = RC.CAPACITY_ID
  1660. left join RMS_TRUCK_CALCULATE RTC1 on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  1661. left join RMS_TRUCK_CALCULATE RTC2 on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  1662. left join AMSTRUCK_INWARD_PLAN AIP on AIP.PLAN_ID = OO.ORDER_PLAN_ID
  1663. left join AMSTRUCK_REQUIREMENT_PLAN ARP on AIP.PLAN_ID = ARP.PLAN_ID
  1664. left join AMSTRUCK_INWARD_REQUIREMENT AIR on AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
  1665. left join AMS_PURCHASE_ORDER APO ON APO.PURCHASE_ORDER_ID=AIR.PURCHASE_ORDER_ID
  1666. left join RMS_SHIPPER RS on AIR.REQUIREMENT_SHIPPER_ID = RS.SHIPPER_ID
  1667. left join AMSTRUCK_REQUIREMENT_MATERIAL ARM on AIR.REQUIREMENT_ID = ARM.REQUIREMENT_ID
  1668. left join RMS_MATERIAL RM on ARM.MATERIAL_ID = RM.MATERIAL_ID
  1669. left join RMS_WAREHOUSE RW1 on ARM.REQUIREMENT_UNLOAD_UNIT_ID = RW1.WAREHOUSE_ID
  1670. left join RMS_WAREHOUSE RW2 on ARM.REQUIREMENT_PLATFORM_ID = RW2.WAREHOUSE_ID
  1671. where OO.ORDER_TYPE in (15,16) and TWR.RESULT_NET_WEIGHT >= 0
  1672. <if test="oneDate != null">
  1673. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  1674. </if>
  1675. <if test="startDate != null">
  1676. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  1677. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
  1678. </if>
  1679. )
  1680. <if test=" orderNumber != null">
  1681. and
  1682. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1683. "orderNumber" like '%${item}%'
  1684. </foreach>
  1685. </if>
  1686. <if test=" capacityNumber != null">
  1687. and
  1688. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1689. "capacityNumber" like '%${item}%'
  1690. </foreach>
  1691. </if>
  1692. <if test=" shipperName != null">
  1693. and
  1694. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1695. "shipperName" like '%${item}%'
  1696. </foreach>
  1697. </if>
  1698. <if test="unloadName != null">
  1699. and
  1700. <foreach collection="unloadName" item="item" open="(" separator="or" close=")">
  1701. "unloadName" like '%${item}%'
  1702. </foreach>
  1703. </if>
  1704. <if test="loadName!= null">
  1705. and
  1706. <foreach collection="loadName" item="item" open="(" separator="or" close=")">
  1707. "loadName" like '%${item}%'
  1708. </foreach>
  1709. </if>
  1710. <if test="materialName!= null">
  1711. and
  1712. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1713. "materialName" like '%${item}%'
  1714. </foreach>
  1715. </if>
  1716. <if test="grossNumber!= null">
  1717. and
  1718. <foreach collection="grossNumber" item="item" open="(" separator="or" close=")">
  1719. "grossNumber" like '%${item}%'
  1720. </foreach>
  1721. </if>
  1722. <if test="tareNumber!= null">
  1723. and
  1724. <foreach collection="tareNumber" item="item" open="(" separator="or" close=")">
  1725. "tareNumber" like '%${item}%'
  1726. </foreach>
  1727. </if>
  1728. <if test="resultNetWeight!= null">
  1729. and
  1730. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  1731. "resultNetWeight" like '%${item}%'
  1732. </foreach>
  1733. </if>
  1734. <if test="resultTareWeightTime!= null">
  1735. and
  1736. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  1737. "resultTareWeightTime" like '%${item}%'
  1738. </foreach>
  1739. </if>
  1740. <if test="resultTareWeight!= null">
  1741. and
  1742. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  1743. "resultTareWeight" like '%${item}%'
  1744. </foreach>
  1745. </if>
  1746. <if test="resultGrossWeightTime!= null">
  1747. and
  1748. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  1749. "resultGrossWeightTime" like '%${item}%'
  1750. </foreach>
  1751. </if>
  1752. <if test="resultGrossWeight!= null">
  1753. and
  1754. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  1755. "resultGrossWeight" like '%${item}%'
  1756. </foreach>
  1757. </if>
  1758. <if test="purchaseOrderNo!= null">
  1759. and
  1760. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  1761. "purchaseOrderNo" like '%${item}%'
  1762. </foreach>
  1763. </if>
  1764. </select>
  1765. <select id="getCapacityRemark" resultType="java.util.Map" parameterType="java.util.Map">
  1766. select OO.ORDER_TYPE,
  1767. OO.ORDER_ID "orderId"
  1768. from OMSTRUCK_ORDER OO
  1769. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1770. ON OO.ORDER_ID=TTR.ORDER_ID
  1771. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
  1772. ON TLR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1773. WHERE TLR.CAPACITY_REMARK IS NOT NULL
  1774. </select>
  1775. <select id="getLoaderForResultDetail" resultType="java.util.Map" parameterType="java.util.Map">
  1776. SELECT *
  1777. FROM (
  1778. SELECT
  1779. DISTINCT RM.MATERIAL_NAME "materialName",
  1780. OO.ORDER_NUMBER "orderNumber",
  1781. RC.CAPACITY_NUMBER "capacityNumber",
  1782. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  1783. TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
  1784. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  1785. TLR.RESULT_LOAD_DURATION "resultLoadDuration",
  1786. RW.WAREHOUSE_NAME "warehouseName",
  1787. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  1788. TLR.CAPACITY_REMARK "capacityRemark",
  1789. TLR.RESULT_ID "resultId"
  1790. FROM TMSTRUCK_LOAD_RESULT TLR
  1791. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1792. ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
  1793. LEFT JOIN OMSTRUCK_ORDER OO
  1794. ON OO.ORDER_ID = TTR.ORDER_ID
  1795. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1796. ON OOM.ORDER_ID = OO.ORDER_ID
  1797. LEFT JOIN RMS_MATERIAL RM
  1798. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1799. LEFT JOIN RMS_CAPACITY RC
  1800. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1801. LEFT JOIN RMS_WAREHOUSE RW
  1802. ON RW.WAREHOUSE_ID = TLR.LOADING_ID
  1803. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1804. ON TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
  1805. WHERE TLR.CAPACITY_REMARK IS NOT NULL
  1806. <if test="oneDate != null">
  1807. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TLR.RESULT_LOAD_END_TIME
  1808. </if>
  1809. <if test="startDate != null">
  1810. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
  1811. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
  1812. </if>
  1813. <if test="con != null">
  1814. and (instr(tlr.CAPACITY_REMARK, #{con}) > 0)
  1815. </if>
  1816. ORDER BY TLR.RESULT_LOAD_END_TIME,OO.ORDER_NUMBER DESC
  1817. )
  1818. <if test=" orderNumber != null">
  1819. and
  1820. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1821. "orderNumber" like '%${item}%'
  1822. </foreach>
  1823. </if>
  1824. <if test=" materialName != null">
  1825. and
  1826. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1827. "materialName" like '%${item}%'
  1828. </foreach>
  1829. </if>
  1830. <if test=" capacityNumber != null">
  1831. and
  1832. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1833. "capacityNumber" like '%${item}%'
  1834. </foreach>
  1835. </if>
  1836. <if test=" resultLoadStartTime != null">
  1837. and
  1838. <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
  1839. "resultLoadStartTime" like '%${item}%'
  1840. </foreach>
  1841. </if>
  1842. <if test=" warehouseName != null">
  1843. and
  1844. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1845. "warehouseName" like '%${item}%'
  1846. </foreach>
  1847. </if>
  1848. <if test="capacityRemark != null">
  1849. and
  1850. <foreach collection="capacityRemark" item="item" open="(" separator="or" close=")">
  1851. "capacityRemark" like '%${item}%'
  1852. </foreach>
  1853. </if>
  1854. </select>
  1855. <!--根据组织获取销售订单-->
  1856. <select id="getSaleOrderList" resultType="java.util.Map" parameterType="java.util.Map">
  1857. select OO.ORDER_NUMBER "orderNumber",
  1858. RM.MATERIAL_NAME "materialName",
  1859. RS.SHIPPER_NAME "sendName",
  1860. RC.CONSIGNEE_COMPANY_NAME "reciveName",
  1861. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  1862. TWR.RESULT_GROSS_WEIGHT_TIME "grossweightTime",
  1863. TWR.RESULT_TARE_WEIGHT_TIME "tareWeightTime",
  1864. TWR.RESULT_TARE_WEIGHT "tareWeight",
  1865. TWR.RESULT_GROSS_WEIGHT "grossWeight",
  1866. RC2.CAPACITY_NUMBER "capacityNumber"
  1867. from OMSTRUCK_ORDER OO
  1868. left join AMS_SALE_ORDER_MATERIAL ASOM
  1869. ON ASOM.SALE_ORDER_MATERIAL_ID=OO.ORDER_PLAN_ID
  1870. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1871. ON OOM.ORDER_ID=OO.ORDER_ID
  1872. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1873. ON TTR.ORDER_ID=OO.ORDER_ID
  1874. LEFT JOIN RMS_CAPACITY RC2
  1875. ON RC2.CAPACITY_ID=OO.CAPACITY_ID
  1876. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1877. ON TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1878. left join TMSTRUCK_LOAD_RESULT TLR
  1879. ON TLR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1880. LEFT JOIN RMS_MATERIAL RM
  1881. ON RM.MATERIAL_ID=OOM.MATERIAL_ID
  1882. LEFT JOIN AMS_SALE_ORDER ASO
  1883. ON ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  1884. left join RMS_SHIPPER RS
  1885. ON ASO.SHIPPER_ID = RS.SHIPPER_ID
  1886. LEFT JOIN RMS_CONSIGNEE RC
  1887. ON RC.CONSIGNEE_ID=ASO.RECEIVE_ID
  1888. where OO.OPTIONER_CODE = #{orgCode}
  1889. <if test="oneDate != null">
  1890. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TLR.RESULT_LOAD_END_TIME
  1891. </if>
  1892. <if test="startDate != null">
  1893. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
  1894. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
  1895. </if>
  1896. ORDER BY OO.ORDER_NUMBER DESC
  1897. </select>
  1898. <select id="getInwardList" resultType="java.util.Map" parameterType="java.util.Map">
  1899. select *
  1900. from (select oo.order_id "orderId",
  1901. rm.material_name "materialName",
  1902. rc.capacity_number "capacityNumber",
  1903. rs.supplier_name "sendName",
  1904. oo.order_number "orderNumber",
  1905. rce.consignee_company_name "reciveName",
  1906. ttr.result_total_id "totalResultId",
  1907. twr3.result_gross_weight "grossWeight",
  1908. twr3.result_gross_weight_time "grossweightTime",
  1909. twr4.result_tare_weight "tareWeight",
  1910. twr4.result_tare_weight_time "tareWeightTime",
  1911. twr4.result_net_weight "resultNetWeight"
  1912. from omstruck_order oo
  1913. left join omstruck_order_material oom
  1914. on oom.order_id = oo.order_id
  1915. left join rms_material rm
  1916. on rm.material_id = oom.material_id
  1917. left join rms_capacity rc
  1918. on rc.capacity_id = oo.capacity_id
  1919. left join amstruck_inward_plan aip
  1920. on aip.plan_id = oo.order_plan_id
  1921. left join amstruck_requirement_plan arp
  1922. on arp.plan_id = aip.plan_id
  1923. left join amstruck_inward_requirement air
  1924. on air.requirement_id = arp.requirement_id
  1925. left join ams_purchase_order apo
  1926. on apo.purchase_order_id = air.purchase_order_id
  1927. left join rms_supplier rs
  1928. on rs.supplier_id = apo.supplier_unit_id
  1929. left join rms_consignee rce
  1930. on rce.consignee_id = apo.receive_unit_id
  1931. left join tmstruck_total_result ttr
  1932. on ttr.order_id = oo.order_id
  1933. left join tmstruck_weight_result twr1
  1934. on twr1.result_total_id = ttr.result_total_id
  1935. left join rms_truck_calculate rtc1
  1936. on rtc1.truck_calculate_id = twr1.result_tare_place_id
  1937. left join tmstruck_load_result tlr
  1938. on tlr.result_total_id = ttr.result_total_id
  1939. left join rms_warehouse rw
  1940. on rw.warehouse_id = tlr.loading_id
  1941. left join tmstruck_weight_result twr2
  1942. on twr2.result_total_id = ttr.result_total_id
  1943. left join rms_truck_calculate rtc2
  1944. on rtc2.truck_calculate_id = twr2.result_gross_place_id
  1945. left join tmstruck_weight_result twr3
  1946. on twr3.result_total_id = ttr.result_total_id
  1947. left join rms_truck_calculate rtc3
  1948. on rtc3.truck_calculate_id = twr3.result_gross_place_id
  1949. left join tmstruck_unload_result tur
  1950. on tur.result_total_id = ttr.result_total_id
  1951. left join rms_warehouse rw2
  1952. on rw2.warehouse_id = tur.result_unload_place_id
  1953. left join tmstruck_weight_result twr4
  1954. on twr4.result_total_id = ttr.result_total_id
  1955. left join rms_truck_calculate rtc4
  1956. on rtc4.truck_calculate_id = twr4.result_tare_place_id
  1957. where oo.order_type in (10, 20)
  1958. and tlr.segment_sqe = 3
  1959. and twr2.gross_segment_sqe = 4
  1960. and twr3.gross_segment_sqe = 7
  1961. and tur.segment_sqe = 8
  1962. and twr4.tare_segment_sqe = 9
  1963. and twr2.result_gross_weight_time is not null
  1964. and oo.OPTIONER_CODE = #{orgCode}
  1965. <if test="oneDate != null">
  1966. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TLR.RESULT_LOAD_END_TIME
  1967. </if>
  1968. <if test="startDate != null">
  1969. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
  1970. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
  1971. </if>
  1972. )
  1973. </select>
  1974. <select id="getPurchaseOrderList" resultType="java.util.Map" parameterType="java.util.Map">
  1975. select OO.ORDER_NUMBER "orderNumber",
  1976. RM.MATERIAL_NAME "materialName",
  1977. RC.CAPACITY_NUMBER "capacityNumber",
  1978. RS.SHIPPER_NAME "sendName",
  1979. RC2.CONSIGNEE_COMPANY_NAME "reciveName",
  1980. TWR.RESULT_GROSS_WEIGHT "grossWeight",
  1981. TWR.RESULT_TARE_WEIGHT "tareWeight",
  1982. TWR.RESULT_GROSS_WEIGHT_TIME "grossweightTime",
  1983. TWR.RESULT_TARE_WEIGHT_TIME "tareWeightTime",
  1984. TWR.RESULT_NET_WEIGHT "resultNetWeight"
  1985. from OMSTRUCK_ORDER OO
  1986. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1987. ON OO.ORDER_ID=OOM.ORDER_ID
  1988. LEFT JOIN RMS_CAPACITY RC
  1989. ON OO.CAPACITY_ID=OO.CAPACITY_ID
  1990. LEFT JOIN RMS_MATERIAL RM
  1991. ON RM.MATERIAL_ID=OOM.MATERIAL_ID
  1992. LEFT JOIN AMS_PURCHASE_ORDER APO
  1993. ON OO.ORDER_PLAN_ID=APO.PURCHASE_ORDER_ID
  1994. LEFT JOIN RMS_SHIPPER RS
  1995. ON RS.SHIPPER_ID=APO.SUPPLIER_UNIT_ID
  1996. LEFT JOIN RMS_CONSIGNEE RC2
  1997. ON RC2.CONSIGNEE_COMPANY_NAME =APO.RECEIVE_UNIT_ID
  1998. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1999. ON TTR.ORDER_ID=OO.ORDER_ID
  2000. left join TMSTRUCK_LOAD_RESULT TLR
  2001. ON TTR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  2002. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  2003. ON TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  2004. WHERE OO.OPTIONER_CODE=#{orgCode}
  2005. <if test="oneDate != null">
  2006. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TLR.RESULT_LOAD_END_TIME
  2007. </if>
  2008. <if test="startDate != null">
  2009. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
  2010. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
  2011. </if>
  2012. </select>
  2013. </mapper>