StatisticalReportMapper.xml 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636
  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"></include>
  160. <if test="orderField == null">
  161. order by "insertTimee" desc
  162. </if>
  163. </select>
  164. <!--查询采购辅料统计报表-->
  165. <select id="getAllPurchaseFLRLReport" parameterType="map" resultType="java.util.Map">
  166. select *
  167. from (
  168. select
  169. OO.ORDER_NUMBER "orderNumber",
  170. RC.CAPACITY_NUMBER "capacityNumber",
  171. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  172. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  173. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  174. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  175. TQR.RESULT_DEDUCTION "resultDeduction",
  176. TUR.RESULT_END_TIME "resultEndTime",
  177. RW.WAREHOUSE_NAME "warehouseName",
  178. TRR.INSERT_TIME "insertTime",
  179. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  180. OO.INSERT_TIME "insertTimee",
  181. RGEN.GATEPOST_NAME "enGatepostName",
  182. RGOUT.GATEPOST_NAME "outGatepostName",
  183. RTCMAO.TRUCK_CALCULATE_NUMBER "grossCalculateNum",
  184. RTCPI.TRUCK_CALCULATE_NUMBER "tareCalculateNum",
  185. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  186. RM.MATERIAL_NAME "materialName",
  187. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode",
  188. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  189. RS.SUPPLIER_NAME "supplierName",
  190. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  191. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime"
  192. from OMSTRUCK_ORDER OO
  193. left join TMSTRUCK_TOTAL_RESULT TTR
  194. on TTR.ORDER_ID = OO.ORDER_ID
  195. left join RMS_CAPACITY RC
  196. on RC.CAPACITY_ID = OO.CAPACITY_ID
  197. left join TMSTRUCK_ENFACTORY_RESULT TER
  198. on TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
  199. left join RMS_GATEPOST RGEN --进厂门岗
  200. on RGEN.GATEPOST_ID = TER.GATEPOST_ID
  201. left join OMSTRUCK_ORDER_MATERIAL OOM
  202. on OOM.ORDER_ID = OO.ORDER_ID
  203. left join RMS_MATERIAL RM
  204. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  205. left join TMSTRUCK_WEIGHT_RESULT TWR
  206. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  207. left join RMS_TRUCK_CALCULATE RTCMAO --毛重汽车衡
  208. on RTCMAO.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  209. left join RMS_TRUCK_CALCULATE RTCPI --皮重汽车衡
  210. on RTCPI.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  211. left join TMSTRUCK_UNLOAD_RESULT TUR
  212. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  213. left join RMS_WAREHOUSE RW
  214. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  215. left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  216. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  217. left join RMS_GATEPOST RGOUT --出厂门岗
  218. on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
  219. left join TMSTRUCK_RECEIPT_RESULT TRR
  220. on TRR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  221. left join TMSTRUCK_QUALITY_RESULT TQR
  222. on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
  223. left join AMS_PURCHASE_ORDER APO
  224. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  225. left join RMS_SUPPLIER RS
  226. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  227. left join RMS_CONSIGNEE RCON
  228. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  229. where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
  230. and OO.ORDER_TYPE = #{orderTypee}
  231. <if test="oneDate != null">
  232. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  233. </if>
  234. <if test="startDate != null">
  235. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  236. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
  237. </if>
  238. )
  239. <where>
  240. <if test="capacityNumber != null">
  241. and
  242. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  243. "capacityNumber" like '%${item}%'
  244. </foreach>
  245. </if>
  246. <if test="warehouseName != null">
  247. and
  248. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  249. "warehouseName" like '%${item}%'
  250. </foreach>
  251. </if>
  252. <if test="resultGrossWeight != null">
  253. and
  254. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  255. "resultGrossWeight" like '%${item}%'
  256. </foreach>
  257. </if>
  258. <if test="resultTareWeight != null">
  259. and
  260. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  261. "resultTareWeight" like '%${item}%'
  262. </foreach>
  263. </if>
  264. <if test="enGatepostName != null">
  265. and
  266. <foreach collection="enGatepostName" item="item" open="(" separator="or" close=")">
  267. "enGatepostName" like '%${item}%'
  268. </foreach>
  269. </if>
  270. <if test="outGatepostName != null">
  271. and
  272. <foreach collection="outGatepostName" item="item" open="(" separator="or" close=")">
  273. "outGatepostName" like '%${item}%'
  274. </foreach>
  275. </if>
  276. <if test="materialName != null">
  277. and
  278. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  279. "materialName" like '%${item}%'
  280. </foreach>
  281. </if>
  282. <if test="purchaseOrderNo != null">
  283. and
  284. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  285. "purchaseOrderNo" like '%${item}%'
  286. </foreach>
  287. </if>
  288. <if test="supplierName != null">
  289. and
  290. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  291. "supplierName" like '%${item}%'
  292. </foreach>
  293. </if>
  294. <if test="receiveName != null">
  295. and
  296. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  297. "receiveName" like '%${item}%'
  298. </foreach>
  299. </if>
  300. </where>
  301. <include refid="orderBy"></include>
  302. <if test="orderField == null">
  303. order by "insertTimee" desc
  304. </if>
  305. </select>
  306. <!-- 查询销售统计报表 -->
  307. <!-- 查询销售统计报表 -->
  308. <select id="getAllSaleReport" parameterType="java.util.Map" resultType="java.util.Map">
  309. select
  310. *
  311. from (
  312. select DISTINCT OO.ORDER_NUMBER "orderNumber",
  313. RC.CAPACITY_NUMBER "capacityNumber",
  314. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  315. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  316. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  317. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  318. RW.WAREHOUSE_NAME "warehouseName",
  319. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  320. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  321. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  322. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  323. RTCMAO.TRUCK_CALCULATE_NUMBER "maoCalculate",
  324. RTCPI.TRUCK_CALCULATE_NUMBER "piCalculate",
  325. RGEN.GATEPOST_NAME "enGatepostName",
  326. RGOUT.GATEPOST_NAME "outGatepostName",
  327. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  328. RS.SUPPLIER_NAME "sendName",
  329. RM.MATERIAL_NAME "materialName",
  330. TLR.INSERT_UPDATE_REMARK "materialRemark",
  331. ASO.SALE_NUMBER "saleNumber",
  332. TLR.CASE_NUMBER "caseNumber",
  333. RC2.CARRIER_NAME "carrierName",
  334. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  335. from TMSTRUCK_WEIGHT_RESULT TWR
  336. left join TMSTRUCK_TOTAL_RESULT TTR
  337. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  338. left join OMSTRUCK_ORDER OO
  339. on TTR.ORDER_ID = OO.ORDER_ID
  340. left join AMS_SALE_ORDER_MATERIAL ASOM
  341. on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  342. left join AMS_DISPATCH_SALE_ORDER ADSO
  343. on ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  344. left join RMS_CARRIER RC2
  345. on RC2.CARRIER_ID = ADSO.CARRIER_ID
  346. left join AMS_SALE_ORDER ASO
  347. on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  348. left join RMS_CONSIGNEE RCON
  349. on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  350. left join RMS_SUPPLIER RS
  351. on RS.SUPPLIER_ID = ASO.SHIPPER_ID
  352. join TMSTRUCK_LOAD_RESULT TLR
  353. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  354. and TLR.MATERIAL_ID = TWR.MATERIAL_ID
  355. left join RMS_WAREHOUSE RW
  356. on RW.WAREHOUSE_ID = TLR.LOADING_ID
  357. left join RMS_TRUCK_CALCULATE RTCMAO
  358. on TWR.RESULT_GROSS_PLACE_ID = RTCMAO.TRUCK_CALCULATE_ID
  359. left join RMS_TRUCK_CALCULATE RTCPI
  360. on TWR.RESULT_TARE_PLACE_ID = RTCPI.TRUCK_CALCULATE_ID
  361. join TMSTRUCK_ENFACTORY_RESULT TER
  362. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  363. left join RMS_GATEPOST RGEN
  364. on RGEN.GATEPOST_ID = TER.GATEPOST_ID
  365. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  366. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  367. left join RMS_GATEPOST RGOUT
  368. on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
  369. join RMS_CAPACITY RC
  370. on RC.CAPACITY_ID = OO.CAPACITY_ID
  371. join RMS_MATERIAL RM
  372. on RM.MATERIAL_ID = TWR.MATERIAL_ID
  373. WHERE OO.ORDER_TYPE = #{orderType}
  374. AND ASO.SHIPPER_ID = #{shipperId}
  375. <if test="carrierSsoId != null">
  376. and RC2.CARRIER_SSO_ID = #{carrierSsoId}
  377. </if>
  378. <if test="oneDate != null">
  379. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_GROSS_WEIGHT_TIME
  380. </if>
  381. <if test="startDate != null">
  382. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_GROSS_WEIGHT_TIME
  383. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_GROSS_WEIGHT_TIME
  384. </if>
  385. )
  386. <where>
  387. <if test="orderNumber != null">
  388. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  389. "orderNumber" like '%${item}%'
  390. </foreach>
  391. </if>
  392. <if test="carrierName != null">
  393. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  394. "carrierName" like '%${item}%'
  395. </foreach>
  396. </if>
  397. <if test="enGatepostName != null">
  398. <foreach collection="enGatepostName" item="item" open="(" separator="or" close=")">
  399. "enGatepostName" like '%${item}%'
  400. </foreach>
  401. </if>
  402. <if test="outGatepostName != null">
  403. <foreach collection="outGatepostName" item="item" open="(" separator="or" close=")">
  404. "outGatepostName" like '%${item}%'
  405. </foreach>
  406. </if>
  407. <if test="caseNumber != null">
  408. <foreach collection="caseNumber" item="item" open="(" separator="or" close=")">
  409. "caseNumber" like '%${item}%'
  410. </foreach>
  411. </if>
  412. <if test="capacityNumber != null">
  413. and
  414. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  415. "capacityNumber" like '%${item}%'
  416. </foreach>
  417. </if>
  418. <if test="receiveName != null">
  419. and
  420. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  421. "receiveName" like '%${item}%'
  422. </foreach>
  423. </if>
  424. <if test="materialRemark != null">
  425. and
  426. <foreach collection="materialRemark" item="item" open="(" separator="or" close=")">
  427. "materialRemark" = #{item}
  428. </foreach>
  429. </if>
  430. <if test="sendName != null">
  431. and
  432. <foreach collection="sendName" item="item" open="(" separator="or" close=")">
  433. "sendName" like '%${item}%'
  434. </foreach>
  435. </if>
  436. <if test="resultEntryGateTime != null">
  437. and
  438. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  439. "resultEntryGateTime" like '%${item}%'
  440. </foreach>
  441. </if>
  442. <if test="resultTareWeightTime != null">
  443. and
  444. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  445. "resultTareWeightTime" like '%${item}%'
  446. </foreach>
  447. </if>
  448. <if test="resultTareWeight != null">
  449. and
  450. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  451. "resultTareWeight" like '%${item}%'
  452. </foreach>
  453. </if>
  454. <if test="resultLoadEndTime != null">
  455. and
  456. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  457. "resultLoadEndTime" like '%${item}%'
  458. </foreach>
  459. </if>
  460. <if test="warehouseName != null">
  461. and
  462. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  463. "warehouseName" like '%${item}%'
  464. </foreach>
  465. </if>
  466. <if test="resultGrossWeightTime != null">
  467. and
  468. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  469. "resultGrossWeightTime" like '%${item}%'
  470. </foreach>
  471. </if>
  472. <if test="resultGrossWeight != null">
  473. and
  474. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  475. "resultGrossWeight" like '%${item}%'
  476. </foreach>
  477. </if>
  478. <if test="materialName != null">
  479. and
  480. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  481. "materialName" like '%${item}%'
  482. </foreach>
  483. </if>
  484. <if test="resultNetWeight != null">
  485. and
  486. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  487. "resultNetWeight" like '%${item}%'
  488. </foreach>
  489. </if>
  490. <if test="resultOutGateTime != null">
  491. and
  492. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  493. "resultOutGateTime" like '%${item}%'
  494. </foreach>
  495. </if>
  496. </where>
  497. <include refid="orderBy"></include>
  498. <if test="orderField == null">
  499. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  500. </if>
  501. </select>
  502. <!-- 查询零星进厂物资统计报表-->
  503. <select id="getSporadicSuppliesReport1" resultType="java.util.Map">
  504. select
  505. *
  506. from (
  507. select OO.ORDER_NUMBER "orderNumber",
  508. RC.CAPACITY_NUMBER "capacityNumber",
  509. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  510. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  511. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  512. TUR.RESULT_END_TIME "resultEndTime",
  513. RW.WAREHOUSE_NAME "warehouseName",
  514. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  515. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  516. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  517. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  518. -- 查询进厂门岗
  519. RG2.GATEPOST_NAME "gatepostEntryName",
  520. -- 出厂门岗
  521. RG.GATEPOST_NAME "gatepostOutName",
  522. -- 计皮汽车衡
  523. RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
  524. -- 计毛汽车衡
  525. RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
  526. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  527. RS.SUPPLIER_NAME "sendName",
  528. RM.MATERIAL_NAME "materialName",
  529. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  530. from OMSTRUCK_ORDER OO
  531. join TMSTRUCK_TOTAL_RESULT TTR
  532. on TTR.ORDER_ID = OO.ORDER_ID
  533. join TMSTRUCK_UNLOAD_RESULT TUR
  534. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  535. left join RMS_WAREHOUSE RW
  536. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  537. join TMSTRUCK_WEIGHT_RESULT TWR
  538. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  539. left join RMS_TRUCK_CALCULATE RTC2
  540. on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  541. left join RMS_TRUCK_CALCULATE RTC1
  542. on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  543. join TMSTRUCK_ENFACTORY_RESULT TER
  544. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  545. left join RMS_GATEPOST RG2
  546. on RG2.GATEPOST_ID =TER.GATEPOST_ID
  547. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  548. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  549. left join RMS_GATEPOST RG
  550. on TLFR.GATEPOST_ID =RG.GATEPOST_ID
  551. left join RMS_CAPACITY RC
  552. on RC.CAPACITY_ID = OO.CAPACITY_ID
  553. left join AMSTRUCK_SPORADIC_ORDER ASO
  554. on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  555. left join RMS_SUPPLIER RS
  556. on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
  557. left join RMS_CONSIGNEE RCON
  558. on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
  559. join OMSTRUCK_ORDER_MATERIAL OOM
  560. on OOM.ORDER_ID = OO.ORDER_ID
  561. join RMS_MATERIAL RM
  562. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  563. <if test="carrierSsoId != null">
  564. join RMS_CARRIER RCA
  565. on RCA.CARRIER_ID = RC.CARRIER_ID
  566. </if>
  567. where OO.ORDER_TYPE = 12
  568. <if test="carrierSsoId != null">
  569. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  570. </if>
  571. <if test="oneDate != null">
  572. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  573. </if>
  574. <if test="startDate != null">
  575. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  576. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
  577. </if>
  578. <if test="con!=null">
  579. where "receiveName" like #{con} or "sendName" like #{con} or "materialName" like #{con}
  580. or "capacityNumber" like #{con}
  581. </if>
  582. <if test="userId!=null">
  583. and ASO.INSERT_USERNAME=#{userId}
  584. </if>
  585. <if test="userIds!=null">
  586. and ASO.UPDATE_USERNAME=#{userIds}
  587. </if>
  588. )
  589. <where>
  590. <if test="receiveName != null">
  591. and
  592. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  593. "receiveName" like '%${item}%'
  594. </foreach>
  595. </if>
  596. <if test="sendName != null">
  597. and
  598. <foreach collection="sendName" item="item" open="(" separator="or" close=")">
  599. "sendName" like '%${item}%'
  600. </foreach>
  601. </if>
  602. <if test="materialName != null">
  603. and
  604. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  605. "materialName" like '%${item}%'
  606. </foreach>
  607. </if>
  608. <if test="orderNumber != null">
  609. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  610. "orderNumber" like '%${item}%'
  611. </foreach>
  612. </if>
  613. <if test="capacityNumber != null">
  614. and
  615. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  616. "capacityNumber" like '%${item}%'
  617. </foreach>
  618. </if>
  619. <if test="resultEntryGateTime != null">
  620. and
  621. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  622. "resultEntryGateTime" like '%${item}%'
  623. </foreach>
  624. </if>
  625. <if test="resultTareWeightTime != null">
  626. and
  627. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  628. to_char("resultTareWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  629. </foreach>
  630. </if>
  631. <if test="resultTareWeight != null">
  632. and
  633. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  634. "resultTareWeight" like '%${item}%'
  635. </foreach>
  636. </if>
  637. <if test="resultEndTime != null">
  638. and
  639. <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
  640. to_char("resultEndTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  641. </foreach>
  642. </if>
  643. <if test="warehouseName != null">
  644. and
  645. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  646. "warehouseName" like '%${item}%'
  647. </foreach>
  648. </if>
  649. <if test="resultGrossWeightTime != null">
  650. and
  651. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  652. to_char("resultGrossWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  653. </foreach>
  654. </if>
  655. <if test="resultGrossWeight != null">
  656. and
  657. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  658. "resultGrossWeight" like '%${item}%'
  659. </foreach>
  660. </if>
  661. <if test="resultNetWeight != null">
  662. and
  663. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  664. "resultNetWeight" like '%${item}%'
  665. </foreach>
  666. </if>
  667. <if test="resultOutGateTime != null">
  668. and
  669. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  670. "resultOutGateTime" like '%${item}%'
  671. </foreach>
  672. </if>
  673. <if test="gatepostEntryName != null">
  674. and
  675. <foreach collection="gatepostEntryName" item="item" open="(" separator="or" close=")">
  676. "gatepostEntryName" like '%${item}%'
  677. </foreach>
  678. </if>
  679. <if test="gatepostOutName != null">
  680. and
  681. <foreach collection="gatepostOutName" item="item" open="(" separator="or" close=")">
  682. "gatepostOutName" like '%${item}%'
  683. </foreach>
  684. </if>
  685. </where>
  686. <include refid="orderBy"></include>
  687. <if test="orderField == null">
  688. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  689. </if>
  690. </select>
  691. <!-- 查询零星出厂物资统计报表-->
  692. <select id="getSporadicSuppliesReport2" resultType="java.util.Map">
  693. select
  694. *
  695. from (
  696. select OO.ORDER_NUMBER "orderNumber",
  697. RC.CAPACITY_NUMBER "capacityNumber",
  698. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  699. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  700. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  701. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  702. RW.WAREHOUSE_NAME "warehouseName",
  703. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  704. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  705. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  706. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  707. -- 查询进厂门岗
  708. RG2.GATEPOST_NAME "gatepostEntryName",
  709. -- 出厂门岗
  710. RG.GATEPOST_NAME "gatepostOutName",
  711. -- 计皮汽车衡
  712. RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
  713. -- 计毛汽车衡
  714. RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
  715. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  716. RS.SUPPLIER_NAME "sendName",
  717. RM.MATERIAL_NAME "materialName",
  718. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  719. from OMSTRUCK_ORDER OO
  720. join TMSTRUCK_TOTAL_RESULT TTR
  721. on TTR.ORDER_ID = OO.ORDER_ID
  722. join TMSTRUCK_LOAD_RESULT TLR
  723. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  724. left join RMS_WAREHOUSE RW
  725. on RW.WAREHOUSE_ID = TLR.LOADING_ID
  726. join TMSTRUCK_WEIGHT_RESULT TWR
  727. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  728. left join RMS_TRUCK_CALCULATE RTC2
  729. on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  730. left join RMS_TRUCK_CALCULATE RTC1
  731. on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  732. join TMSTRUCK_ENFACTORY_RESULT TER
  733. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  734. left join RMS_GATEPOST RG2
  735. on RG2.GATEPOST_ID =TER.GATEPOST_ID
  736. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  737. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  738. left join RMS_GATEPOST RG
  739. on TLFR.GATEPOST_ID =RG.GATEPOST_ID
  740. left join RMS_CAPACITY RC
  741. on RC.CAPACITY_ID = OO.CAPACITY_ID
  742. left join AMSTRUCK_SPORADIC_ORDER ASO
  743. on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  744. left join RMS_SUPPLIER RS
  745. on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
  746. left join RMS_CONSIGNEE RCON
  747. on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
  748. join OMSTRUCK_ORDER_MATERIAL OOM
  749. on OOM.ORDER_ID = OO.ORDER_ID
  750. join RMS_MATERIAL RM
  751. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  752. <if test="carrierSsoId != null">
  753. join RMS_CARRIER RCA
  754. on RCA.CARRIER_ID = RC.CARRIER_ID
  755. </if>
  756. where OO.ORDER_TYPE = 13
  757. <if test="carrierSsoId != null">
  758. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  759. </if>
  760. <if test="oneDate != null">
  761. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_GROSS_WEIGHT_TIME
  762. </if>
  763. <if test="startDate != null">
  764. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_GROSS_WEIGHT_TIME
  765. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_GROSS_WEIGHT_TIME
  766. </if>
  767. <if test="con!=null">
  768. where "receiveName" like #{con} or "sendName" like #{con} or "materialName" like #{con}
  769. or "capacityNumber" like #{con}
  770. </if>
  771. <if test="userId!=null">
  772. and ASO.INSERT_USERNAME=#{userId}
  773. </if>
  774. <if test="userIds!=null">
  775. and ASO.UPDATE_USERNAME=#{userIds}
  776. </if>
  777. )
  778. <where>
  779. <if test="receiveName != null">
  780. and
  781. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  782. "receiveName" like '%${item}%'
  783. </foreach>
  784. </if>
  785. <if test="sendName != null">
  786. and
  787. <foreach collection="sendName" item="item" open="(" separator="or" close=")">
  788. "sendName" like '%${item}%'
  789. </foreach>
  790. </if>
  791. <if test="materialName != null">
  792. and
  793. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  794. "materialName" like '%${item}%'
  795. </foreach>
  796. </if>
  797. <if test="orderNumber != null">
  798. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  799. "orderNumber" like '%${item}%'
  800. </foreach>
  801. </if>
  802. <if test="capacityNumber != null">
  803. and
  804. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  805. "capacityNumber" like '%${item}%'
  806. </foreach>
  807. </if>
  808. <if test="resultEntryGateTime != null">
  809. and
  810. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  811. "resultEntryGateTime" like '%${item}%'
  812. </foreach>
  813. </if>
  814. <if test="resultTareWeightTime != null">
  815. and
  816. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  817. "resultTareWeightTime" like '%${item}%'
  818. </foreach>
  819. </if>
  820. <if test="resultTareWeight != null">
  821. and
  822. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  823. "resultTareWeight" like '%${item}%'
  824. </foreach>
  825. </if>
  826. <if test="resultLoadEndTime != null">
  827. and
  828. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  829. "resultLoadEndTime" like '%${item}%'
  830. </foreach>
  831. </if>
  832. <if test="warehouseName != null">
  833. and
  834. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  835. "warehouseName" like '%${item}%'
  836. </foreach>
  837. </if>
  838. <if test="resultGrossWeightTime != null">
  839. and
  840. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  841. "resultGrossWeightTime" like '%${item}%'
  842. </foreach>
  843. </if>
  844. <if test="resultGrossWeight != null">
  845. and
  846. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  847. "resultGrossWeight" like '%${item}%'
  848. </foreach>
  849. </if>
  850. <if test="resultNetWeight != null">
  851. and
  852. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  853. "resultNetWeight" like '%${item}%'
  854. </foreach>
  855. </if>
  856. <if test="resultOutGateTime != null">
  857. and
  858. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  859. "resultOutGateTime" like '%${item}%'
  860. </foreach>
  861. </if>
  862. <if test="gatepostEntryName != null">
  863. and
  864. <foreach collection="gatepostEntryName" item="item" open="(" separator="or" close=")">
  865. "gatepostEntryName" like '%${item}%'
  866. </foreach>
  867. </if>
  868. <if test="gatepostOutName != null">
  869. and
  870. <foreach collection="gatepostOutName" item="item" open="(" separator="or" close=")">
  871. "gatepostOutName" like '%${item}%'
  872. </foreach>
  873. </if>
  874. </where>
  875. <include refid="orderBy"></include>
  876. <if test="orderField == null">
  877. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  878. </if>
  879. </select>
  880. <select id="getTotalResultList" resultType="java.util.LinkedHashMap">
  881. SELECT DISTINCT
  882. TTR.RESULT_TOTAL_ID "totalId"
  883. FROM
  884. TMSTRUCK_TOTAL_RESULT TTR
  885. LEFT JOIN OMSTRUCK_ORDER OO ON OO.ORDER_ID = TTR.ORDER_ID
  886. WHERE
  887. OO.ORDER_TYPE in (10,20)
  888. order by TTR.RESULT_TOTAL_ID desc
  889. </select>
  890. <select id="getInwardReportResult" resultType="java.util.LinkedHashMap">
  891. select * from (select oo.order_id "orderId",
  892. rm.material_name "materialName",
  893. apo.purchase_order_no "purchaseNo",
  894. rc.capacity_number "capacityNo",
  895. rs.supplier_name "supplierName",
  896. oo.order_number "orderNumber",
  897. rce.consignee_company_name "consigneeName",
  898. ttr.result_total_id "totalResultId",
  899. ter1.result_entry_mode "entryModeFirst",
  900. ter1.result_entry_gate_time "entryGateTimeFirst",
  901. rg1.gatepost_name "entryGatepostNameFirst",
  902. twr1.result_tare_weight "tareWeightFirst",
  903. twr1.result_tare_weight_time "tareWeightTimeFirst",
  904. rtc1.truck_calculate_number "tareTruckCalculateFirst",
  905. tlr.result_load_end_time "loadTime",
  906. rw.warehouse_name "loadPoint",
  907. twr2.result_gross_weight "grossWeightFirst",
  908. twr2.result_gross_weight_time "grossWeigtTimeFirst",
  909. rtc2.truck_calculate_number "grossTruckCalculateFirst",
  910. twr2.result_net_weight "netWeightFirst",
  911. tlfr1.result_out_gate_time "outGatepostTimeFirst",
  912. tlfr1.result_out_mode "outModeFirst",
  913. rg2.gatepost_name "gatepostNameFirst",
  914. ter2.result_entry_mode "entryModeSecond",
  915. ter2.result_entry_gate_time "resultEntryGateTime",
  916. ter2.result_entry_gate_time "entryGateTimeSecond",
  917. rg3.gatepost_name "entryGatepostNameSecond",
  918. twr3.result_gross_weight "grossWeightSecond",
  919. twr3.result_gross_weight_time "grossWeigtTimeSecond",
  920. rtc3.truck_calculate_number "grossTruckCalculateSecond",
  921. tur.result_end_time "unloadTime",
  922. rw2.warehouse_name "unloadPoint",
  923. twr4.result_tare_weight "tareWeightSecond",
  924. twr4.result_tare_weight_time "tareWeightTimeSecond",
  925. twr4.result_net_weight "netWeightSecond",
  926. rtc4.truck_calculate_number "tareTruckCalculateSecond",
  927. tlfr2.result_out_gate_time "outGatepostTimeSecond",
  928. tlfr2.result_out_gate_time "resultOutGateTime",
  929. tlfr2.result_out_mode "outModeSecond",
  930. rg4.gatepost_name "gatepostNameSecond"
  931. from omstruck_order oo
  932. left join omstruck_order_material oom
  933. on oom.order_id = oo.order_id
  934. left join rms_material rm
  935. on rm.material_id = oom.material_id
  936. left join rms_capacity rc
  937. on rc.capacity_id = oo.capacity_id
  938. left join amstruck_inward_plan aip
  939. on aip.plan_id = oo.order_plan_id
  940. left join amstruck_requirement_plan arp
  941. on arp.plan_id = aip.plan_id
  942. left join amstruck_inward_requirement air
  943. on air.requirement_id = arp.requirement_id
  944. left join ams_purchase_order apo
  945. on apo.purchase_order_id = air.purchase_order_id
  946. left join rms_supplier rs
  947. on rs.supplier_id = apo.supplier_unit_id
  948. left join rms_consignee rce
  949. on rce.consignee_id = apo.receive_unit_id
  950. left join tmstruck_total_result ttr
  951. on ttr.order_id = oo.order_id
  952. left join tmstruck_enfactory_result ter1
  953. on ter1.result_total_id = ttr.result_total_id
  954. left join rms_gatepost rg1
  955. on rg1.gatepost_id = ter1.gatepost_id
  956. left join tmstruck_weight_result twr1
  957. on twr1.result_total_id = ttr.result_total_id
  958. left join rms_truck_calculate rtc1
  959. on rtc1.truck_calculate_id = twr1.result_tare_place_id
  960. left join tmstruck_load_result tlr
  961. on tlr.result_total_id = ttr.result_total_id
  962. left join rms_warehouse rw
  963. on rw.warehouse_id = tlr.loading_id
  964. left join tmstruck_weight_result twr2
  965. on twr2.result_total_id = ttr.result_total_id
  966. left join rms_truck_calculate rtc2
  967. on rtc2.truck_calculate_id = twr2.result_gross_place_id
  968. left join tmstruck_leave_factory_result tlfr1
  969. on tlfr1.result_total_id = ttr.result_total_id
  970. left join rms_gatepost rg2
  971. on tlfr1.gatepost_id = rg2.gatepost_id
  972. left join tmstruck_enfactory_result ter2
  973. on ter2.result_total_id = ttr.result_total_id
  974. left join rms_gatepost rg3
  975. on rg3.gatepost_id = ter2.gatepost_id
  976. left join tmstruck_weight_result twr3
  977. on twr3.result_total_id = ttr.result_total_id
  978. left join rms_truck_calculate rtc3
  979. on rtc3.truck_calculate_id = twr3.result_gross_place_id
  980. left join tmstruck_unload_result tur
  981. on tur.result_total_id = ttr.result_total_id
  982. left join rms_warehouse rw2
  983. on rw2.warehouse_id = tur.result_unload_place_id
  984. left join tmstruck_weight_result twr4
  985. on twr4.result_total_id = ttr.result_total_id
  986. left join rms_truck_calculate rtc4
  987. on rtc4.truck_calculate_id = twr4.result_tare_place_id
  988. left join tmstruck_leave_factory_result tlfr2
  989. on tlfr2.result_total_id = ttr.result_total_id
  990. left join rms_gatepost rg4
  991. on tlfr2.gatepost_id = rg4.gatepost_id
  992. where oo.order_type in (10,20)
  993. and ter1.segmen_sqe = 1
  994. and twr1.tare_segment_sqe = 2
  995. and tlr.segment_sqe = 3
  996. and twr2.gross_segment_sqe = 4
  997. and tlfr1.segment_sqe = 5
  998. and ter2.segmen_sqe = 6
  999. and twr3.gross_segment_sqe = 7
  1000. and tur.segment_sqe = 8
  1001. and twr4.tare_segment_sqe = 9
  1002. and tlfr2.segment_sqe = 10
  1003. and twr2.result_gross_weight_time is not null
  1004. <if test="oneDate != null">
  1005. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR4.RESULT_TARE_WEIGHT_TIME
  1006. </if>
  1007. <if test="startDate != null">
  1008. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR4.RESULT_TARE_WEIGHT_TIME
  1009. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR4.RESULT_TARE_WEIGHT_TIME
  1010. </if>
  1011. )
  1012. <where>
  1013. <if test="consigneeName != null">
  1014. and
  1015. <foreach collection="consigneeName" item="item" open="(" separator="or" close=")">
  1016. "consigneeName" like '%${item}%'
  1017. </foreach>
  1018. </if>
  1019. <if test="supplierName != null">
  1020. and
  1021. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  1022. "supplierName" like '%${item}%'
  1023. </foreach>
  1024. </if>
  1025. <if test="materialName != null">
  1026. and
  1027. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1028. "materialName" like '%${item}%'
  1029. </foreach>
  1030. </if>
  1031. <if test="orderNumber != null">
  1032. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1033. "orderNumber" like '%${item}%'
  1034. </foreach>
  1035. </if>
  1036. <if test="capacityNo != null">
  1037. and
  1038. <foreach collection="capacityNo" item="item" open="(" separator="or" close=")">
  1039. "capacityNo" like '%${item}%'
  1040. </foreach>
  1041. </if>
  1042. </where><include refid="orderBy"></include>
  1043. <if test="orderField == null">
  1044. order by "outGatepostTimeFirst" desc, "entryGateTimeFirst" desc
  1045. </if>
  1046. </select>
  1047. <select id="getInwardReport" parameterType="map" resultType="java.util.Map">
  1048. select * from (
  1049. select
  1050. OO.ORDER_NUMBER "orderNumber",
  1051. RC.CAPACITY_NUMBER "capacityNumber",
  1052. RS.SHIPPER_NAME "shipperName",
  1053. RW1.WAREHOUSE_NAME "unloadName",
  1054. RW2.WAREHOUSE_NAME "loadName",
  1055. RM.MATERIAL_NAME "materialName",
  1056. RTC2.TRUCK_CALCULATE_NUMBER "grossNumber",
  1057. RTC1.TRUCK_CALCULATE_NUMBER "tareNumber",
  1058. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  1059. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  1060. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  1061. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  1062. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight"
  1063. from OMSTRUCK_ORDER OO
  1064. left join TMSTRUCK_TOTAL_RESULT TTR on OO.ORDER_ID = TTR.ORDER_ID
  1065. left join TMSTRUCK_WEIGHT_RESULT TWR on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
  1066. left join RMS_CAPACITY RC on OO.CAPACITY_ID = RC.CAPACITY_ID
  1067. left join RMS_TRUCK_CALCULATE RTC1 on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  1068. left join RMS_TRUCK_CALCULATE RTC2 on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  1069. left join AMSTRUCK_INWARD_PLAN AIP on AIP.PLAN_ID = OO.ORDER_PLAN_ID
  1070. left join AMSTRUCK_REQUIREMENT_PLAN ARP on AIP.PLAN_ID = ARP.PLAN_ID
  1071. left join AMSTRUCK_INWARD_REQUIREMENT AIR on AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
  1072. left join RMS_SHIPPER RS on AIR.REQUIREMENT_SHIPPER_ID = RS.SHIPPER_ID
  1073. left join AMSTRUCK_REQUIREMENT_MATERIAL ARM on AIR.REQUIREMENT_ID = ARM.REQUIREMENT_ID
  1074. left join RMS_MATERIAL RM on ARM.MATERIAL_ID = RM.MATERIAL_ID
  1075. left join RMS_WAREHOUSE RW1 on ARM.REQUIREMENT_UNLOAD_UNIT_ID = RW1.WAREHOUSE_ID
  1076. left join RMS_WAREHOUSE RW2 on ARM.REQUIREMENT_PLATFORM_ID = RW2.WAREHOUSE_ID
  1077. where OO.ORDER_TYPE = 11 and TWR.RESULT_NET_WEIGHT >= 0
  1078. <if test="oneDate != null">
  1079. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  1080. </if>
  1081. <if test="startDate != null">
  1082. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
  1083. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
  1084. </if>
  1085. )
  1086. <where>
  1087. <if test="orderNumber != null">
  1088. and
  1089. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1090. "orderNumber" like '%${item}%'
  1091. </foreach>
  1092. </if>
  1093. <if test="capacityNumber != null">
  1094. and
  1095. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1096. "capacityNumber" like '%${item}%'
  1097. </foreach>
  1098. </if>
  1099. <if test="shipperName != null">
  1100. and
  1101. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1102. "shipperName" like '%${item}%'
  1103. </foreach>
  1104. </if>
  1105. <if test="unloadName != null">
  1106. <foreach collection="unloadName" item="item" open="(" separator="or" close=")">
  1107. "unloadName" like '%${item}%'
  1108. </foreach>
  1109. </if>
  1110. <if test="loadName != null">
  1111. and
  1112. <foreach collection="loadName" item="item" open="(" separator="or" close=")">
  1113. "loadName" like '%${item}%'
  1114. </foreach>
  1115. </if>
  1116. <if test="materialName != null">
  1117. and
  1118. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1119. "materialName" like '%${item}%'
  1120. </foreach>
  1121. </if>
  1122. <if test="grossNumber != null">
  1123. and
  1124. <foreach collection="grossNumber" item="item" open="(" separator="or" close=")">
  1125. "grossNumber" like '%${item}%'
  1126. </foreach>
  1127. </if>
  1128. <if test="tareNumber != null">
  1129. and
  1130. <foreach collection="tareNumber" item="item" open="(" separator="or" close=")">
  1131. "tareNumber" like '%${item}%'
  1132. </foreach>
  1133. </if>
  1134. <if test="resultNetWeight != null">
  1135. and
  1136. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  1137. "resultNetWeight" like '%${item}%'
  1138. </foreach>
  1139. </if>
  1140. <if test="resultTareWeightTime != null">
  1141. and
  1142. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  1143. to_char("resultTareWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  1144. </foreach>
  1145. </if>
  1146. <if test="resultTareWeight != null">
  1147. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  1148. "resultTareWeight" like '%${item}%'
  1149. </foreach>
  1150. </if>
  1151. <if test="resultGrossWeightTime != null">
  1152. and
  1153. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  1154. to_char("resultGrossWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  1155. </foreach>
  1156. </if>
  1157. <if test="resultGrossWeight != null">
  1158. and
  1159. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  1160. "resultGrossWeight" like '%${item}%'
  1161. </foreach>
  1162. </if>
  1163. </where>
  1164. <include refid="orderBy"></include>
  1165. </select>
  1166. <select id="getLoading" parameterType="map" resultType="java.util.Map">
  1167. SELECT * FROM(
  1168. SELECT MATERIAL_NAME "materialName",
  1169. COUNT(RC.CAPACITY_NUMBER) "capacityNumber",
  1170. SUM(TWR.RESULT_NET_WEIGHT) "resultNetWeight",
  1171. count(TWR.RESULT_NET_WEIGHT) "number",
  1172. WAREHOUSE_NAME "warehouseName"
  1173. FROM TMSTRUCK_LOAD_RESULT TLR
  1174. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1175. ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
  1176. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1177. ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1178. LEFT JOIN OMSTRUCK_ORDER OO
  1179. ON OO.ORDER_ID = TTR.ORDER_ID
  1180. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1181. ON OOM.ORDER_ID = OO.ORDER_ID
  1182. LEFT JOIN RMS_MATERIAL RM
  1183. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1184. LEFT JOIN RMS_CAPACITY RC
  1185. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1186. LEFT JOIN RMS_WAREHOUSE RW
  1187. ON RW.WAREHOUSE_ID = TLR.LOADING_ID
  1188. WHERE OO.ORDER_TYPE = 11
  1189. AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
  1190. <if test="oneDate != null">
  1191. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TLR.RESULT_LOAD_END_TIME
  1192. </if>
  1193. <if test="startDate != null">
  1194. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
  1195. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
  1196. </if>
  1197. GROUP BY MATERIAL_NAME, WAREHOUSE_NAME
  1198. )
  1199. <include refid="orderBy"></include>
  1200. <where>
  1201. <if test="materialName != null">
  1202. and
  1203. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1204. "materialName" like '%${item}%'
  1205. </foreach>
  1206. </if>
  1207. <if test="capacityNumber != null">
  1208. and
  1209. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1210. "capacityNumber" like '%${item}%'
  1211. </foreach>
  1212. </if>
  1213. <if test="warehouseName != null">
  1214. and
  1215. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1216. "warehouseName" like '%${item}%'
  1217. </foreach>
  1218. </if>
  1219. <if test="number != null">
  1220. and
  1221. <foreach collection="number" item="item" open="(" separator="or" close=")">
  1222. "number" like '%${item}%'
  1223. </foreach>
  1224. </if>
  1225. </where>
  1226. </select>
  1227. <select id="getUnLoading" parameterType="map" resultType="java.util.Map">
  1228. SELECT * FROM (
  1229. SELECT
  1230. COUNT(RC.CAPACITY_NUMBER) "capacityNumber",
  1231. SUM(TWR.RESULT_NET_WEIGHT) "resultNetWeight",
  1232. count(TWR.RESULT_NET_WEIGHT) "number",
  1233. MATERIAL_NAME "materialName",
  1234. WAREHOUSE_NAME "warehouseName"
  1235. FROM TMSTRUCK_UNLOAD_RESULT TUR
  1236. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1237. ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  1238. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1239. ON TWR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  1240. LEFT JOIN OMSTRUCK_ORDER OO
  1241. ON OO.ORDER_ID = TTR.ORDER_ID
  1242. LEFT JOIN RMS_CAPACITY RC
  1243. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1244. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1245. ON OOM.ORDER_ID = OO.ORDER_ID
  1246. LEFT JOIN RMS_MATERIAL RM
  1247. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1248. LEFT JOIN RMS_WAREHOUSE RW
  1249. ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  1250. WHERE TUR.RESULT_END_TIME IS NOT NULL
  1251. AND OO.ORDER_TYPE = 11
  1252. <if test="oneDate != null">
  1253. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TUR.RESULT_END_TIME
  1254. </if>
  1255. <if test="startDate != null">
  1256. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TUR.RESULT_END_TIME
  1257. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TUR.RESULT_END_TIME
  1258. </if>
  1259. GROUP BY MATERIAL_NAME, WAREHOUSE_NAME
  1260. )
  1261. <include refid="orderBy"></include>
  1262. <where>
  1263. <if test="materialName != null">
  1264. and
  1265. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1266. "materialName" like '%${item}%'
  1267. </foreach>
  1268. </if>
  1269. <if test="capacityNumber != null">
  1270. and
  1271. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1272. "capacityNumber" like '%${item}%'
  1273. </foreach>
  1274. </if>
  1275. <if test="warehouseName != null">
  1276. and
  1277. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1278. "warehouseName" like '%${item}%'
  1279. </foreach>
  1280. </if>
  1281. <if test="resultNetWeight != null">
  1282. and
  1283. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  1284. "resultNetWeight" like '%${item}%'
  1285. </foreach>
  1286. </if>
  1287. <if test="number != null">
  1288. and
  1289. <foreach collection="number" item="item" open="(" separator="or" close=")">
  1290. "number" like '%${item}%'
  1291. </foreach>
  1292. </if>
  1293. </where>
  1294. </select>
  1295. <select id="getLXReportResult" parameterType="map" resultType="java.util.LinkedHashMap">
  1296. SELECT
  1297. *
  1298. FROM (
  1299. SELECT
  1300. OO.ORDER_ID "orderId",
  1301. RM.MATERIAL_NAME "materialName",
  1302. RC.CAPACITY_NUMBER "capacityNo",
  1303. RS.SUPPLIER_NAME "supplierName",
  1304. OO.ORDER_NUMBER "orderNumber",
  1305. RCE.CONSIGNEE_COMPANY_NAME "consigneeName",
  1306. TTR.RESULT_TOTAL_ID "totalResultId",
  1307. TER1.RESULT_ENTRY_MODE "entryModeFirst",
  1308. TER1.RESULT_ENTRY_GATE_TIME "entryGateTimeFirst",
  1309. RG1.GATEPOST_NAME "entryGatepostNameFirst",
  1310. TWR1.RESULT_TARE_WEIGHT "tareWeightFirst",
  1311. TWR1.RESULT_TARE_WEIGHT_TIME "tareWeightTimeFirst",
  1312. RTC1.TRUCK_CALCULATE_NUMBER "tareTruckCalculateFirst",
  1313. TLR.RESULT_LOAD_END_TIME "loadTime",
  1314. RW.WAREHOUSE_NAME "loadPoint",
  1315. TWR2.RESULT_GROSS_WEIGHT "grossWeightFirst",
  1316. TWR2.RESULT_GROSS_WEIGHT_TIME "grossWeigtTimeFirst",
  1317. RTC2.TRUCK_CALCULATE_NUMBER "grossTruckCalculateFirst",
  1318. TWR2.RESULT_NET_WEIGHT "netWeightFirst",
  1319. TLFR1.RESULT_OUT_GATE_TIME "outGatepostTimeFirst",
  1320. TLFR1.RESULT_OUT_MODE "outModeFirst",
  1321. RG2.GATEPOST_NAME "gatepostNameFirst",
  1322. TER2.RESULT_ENTRY_MODE "entryModeSecond",
  1323. TER2.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1324. TER2.RESULT_ENTRY_GATE_TIME "entryGateTimeSecond",
  1325. RG3.GATEPOST_NAME "entryGatepostNameSecond",
  1326. TWR3.RESULT_GROSS_WEIGHT "grossWeightSecond",
  1327. TWR3.RESULT_GROSS_WEIGHT_TIME "grossWeigtTimeSecond",
  1328. RTC3.TRUCK_CALCULATE_NUMBER "grossTruckCalculateSecond",
  1329. TUR.RESULT_END_TIME "unloadTime",
  1330. RW2.WAREHOUSE_NAME "unloadPoint",
  1331. TWR4.RESULT_TARE_WEIGHT "tareWeightSecond",
  1332. TWR4.RESULT_TARE_WEIGHT_TIME "tareWeightTimeSecond",
  1333. TWR4.RESULT_NET_WEIGHT "netWeightSecond",
  1334. RTC4.TRUCK_CALCULATE_NUMBER "tareTruckCalculateSecond",
  1335. TLFR2.RESULT_OUT_GATE_TIME "outGatepostTimeSecond",
  1336. TLFR2.RESULT_OUT_GATE_TIME "resultOutGateTime",
  1337. TLFR2.RESULT_OUT_MODE "outModeSecond",
  1338. RG4.GATEPOST_NAME "gatepostNameSecond"
  1339. FROM OMSTRUCK_ORDER OO
  1340. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OOM.ORDER_ID = OO.ORDER_ID
  1341. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1342. LEFT JOIN RMS_CAPACITY RC ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1343. LEFT JOIN AMSTRUCK_SPORADIC_ORDER ASO ON ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  1344. LEFT JOIN RMS_SUPPLIER RS ON RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
  1345. LEFT JOIN RMS_CONSIGNEE RCE ON RCE.CONSIGNEE_ID = ASO.SPORADIC_ORDER_ID
  1346. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID = OO.ORDER_ID
  1347. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER1 ON TER1.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1348. LEFT JOIN RMS_GATEPOST RG1 ON RG1.GATEPOST_ID = TER1.GATEPOST_ID
  1349. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR1 ON TWR1.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1350. LEFT JOIN RMS_TRUCK_CALCULATE RTC1 ON RTC1.TRUCK_CALCULATE_ID = TWR1.RESULT_TARE_PLACE_ID
  1351. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1352. LEFT JOIN RMS_WAREHOUSE RW ON RW.WAREHOUSE_ID = TLR.LOADING_ID
  1353. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR2 ON TWR2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1354. LEFT JOIN RMS_TRUCK_CALCULATE RTC2 ON RTC2.TRUCK_CALCULATE_ID = TWR2.RESULT_GROSS_PLACE_ID
  1355. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR1 ON TLFR1.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1356. LEFT JOIN RMS_GATEPOST RG2 ON TLFR1.GATEPOST_ID = RG2.GATEPOST_ID
  1357. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER2 ON TER2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1358. LEFT JOIN RMS_GATEPOST RG3 ON RG3.GATEPOST_ID = TER2.GATEPOST_ID
  1359. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR3 ON TWR3.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1360. LEFT JOIN RMS_TRUCK_CALCULATE RTC3 ON RTC3.TRUCK_CALCULATE_ID = TWR3.RESULT_GROSS_PLACE_ID
  1361. LEFT JOIN TMSTRUCK_UNLOAD_RESULT TUR ON TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1362. LEFT JOIN RMS_WAREHOUSE RW2 ON RW2.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  1363. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR4 ON TWR4.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1364. LEFT JOIN RMS_TRUCK_CALCULATE RTC4 ON RTC4.TRUCK_CALCULATE_ID = TWR4.RESULT_TARE_PLACE_ID
  1365. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR2 ON TLFR2.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1366. LEFT JOIN RMS_GATEPOST RG4 ON TLFR2.GATEPOST_ID = RG4.GATEPOST_ID
  1367. WHERE OO.ORDER_TYPE = 14
  1368. AND TER1.SEGMEN_SQE = 1
  1369. AND TWR1.TARE_SEGMENT_SQE = 2
  1370. AND TLR.SEGMENT_SQE = 3
  1371. AND TWR2.GROSS_SEGMENT_SQE = 4
  1372. AND TLFR1.SEGMENT_SQE = 5
  1373. AND TER2.SEGMEN_SQE = 6
  1374. AND TWR3.GROSS_SEGMENT_SQE = 7
  1375. AND TUR.SEGMENT_SQE = 8
  1376. AND TWR4.TARE_SEGMENT_SQE = 9
  1377. AND TLFR2.SEGMENT_SQE = 10
  1378. AND TWR2.RESULT_GROSS_WEIGHT_TIME IS NOT NULL
  1379. <if test="oneDate != null">
  1380. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR4.RESULT_TARE_WEIGHT_TIME
  1381. </if>
  1382. <if test="startDate != null">
  1383. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR4.RESULT_TARE_WEIGHT_TIME
  1384. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR4.RESULT_TARE_WEIGHT_TIME
  1385. </if>
  1386. )
  1387. <where>
  1388. <if test="consigneeName != null">
  1389. <foreach collection="consigneeName" item="item" open="(" separator="or" close=")">
  1390. "consigneeName" like '%${item}%'
  1391. </foreach>
  1392. </if>
  1393. <if test="supplierName != null">
  1394. and
  1395. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  1396. "supplierName" like '%${item}%'
  1397. </foreach>
  1398. </if>
  1399. <if test="materialName != null">
  1400. and
  1401. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1402. "materialName" like '%${item}%'
  1403. </foreach>
  1404. </if>
  1405. <if test="orderNumber != null">
  1406. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1407. "orderNumber" like '%${item}%'
  1408. </foreach>
  1409. </if>
  1410. <if test="capacityNo != null">
  1411. and
  1412. <foreach collection="capacityNo" item="item" open="(" separator="or" close=")">
  1413. "capacityNo" like '%${item}%'
  1414. </foreach>
  1415. </if>
  1416. </where><include refid="orderBy"></include>
  1417. <if test="orderField == null">
  1418. order by "outGatepostTimeFirst" desc, "entryGateTimeFirst" desc
  1419. </if>
  1420. </select>
  1421. <!-- 查询装机统计报表-->
  1422. <select id="getLoaderResult" resultType="java.util.Map" parameterType="java.util.Map">
  1423. select *
  1424. from(select
  1425. COUNT(RC.CAPACITY_NUMBER) "number",
  1426. sum(TWR.RESULT_NET_WEIGHT) "netWeight",
  1427. TLR.CAPACITY_REMARK "LoaderCapacityNumber"
  1428. from OMSTRUCK_ORDER OO
  1429. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1430. ON TTR.ORDER_ID=OO.ORDER_ID
  1431. LEFT JOIN RMS_CAPACITY RC
  1432. ON RC.CAPACITY_ID=OO.CAPACITY_ID
  1433. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
  1434. ON TLR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1435. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1436. ON TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1437. where TLR.CAPACITY_REMARK IS NOT NULL
  1438. <if test="oneDate != null">
  1439. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TLR.RESULT_LOAD_END_TIME
  1440. </if>
  1441. <if test="startDate != null">
  1442. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
  1443. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
  1444. </if>
  1445. GROUP BY TLR.CAPACITY_REMARK
  1446. )
  1447. <where>
  1448. <if test="number != null">
  1449. and
  1450. <foreach collection="number" item="item" open="(" separator="or" close=")">
  1451. "number" like '%${item}%'
  1452. </foreach>
  1453. </if>
  1454. <if test="netWeight != null">
  1455. and
  1456. <foreach collection="netWeight" item="item" open="(" separator="or" close=")">
  1457. "netWeight" like '%${item}%'
  1458. </foreach>
  1459. </if>
  1460. <if test="LoaderCapacityNumber != null">
  1461. and
  1462. <foreach collection="LoaderCapacityNumber" item="item" open="(" separator="or" close=")">
  1463. "LoaderCapacityNumber" like '%${item}%'
  1464. </foreach>
  1465. </if>
  1466. </where>
  1467. </select>
  1468. <select id="getCapacityByDefend" resultType="java.util.Map" parameterType="java.util.Map">
  1469. select distinct * from(
  1470. select rc.CAPACITY_NUMBER "capacityNumber",
  1471. oo.ORDER_NUMBER "orderNumber",
  1472. ter.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1473. rg1.GATEPOST_NAME "gatepostName1",
  1474. tlfr.RESULT_OUT_GATE_TIME "resultOutGateTime",
  1475. rg2.GATEPOST_NAME "gatepostName2",
  1476. rm.material_name "materialName"
  1477. from OMSTRUCK_ORDER oo
  1478. left join OMSTRUCK_ORDER_MATERIAL oom
  1479. on oom.ORDER_ID = oo.ORDER_ID
  1480. left join RMS_MATERIAL rm
  1481. on rm.MATERIAL_ID = oom.MATERIAL_ID
  1482. left join RMS_CAPACITY rc
  1483. on rc.CAPACITY_ID = oo.CAPACITY_ID
  1484. left join TMSTRUCK_TOTAL_RESULT ttr
  1485. on ttr.ORDER_ID = oo.ORDER_ID
  1486. left join TMSTRUCK_ENFACTORY_RESULT ter
  1487. on ter.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  1488. left join RMS_GATEPOST rg1
  1489. on rg1.GATEPOST_ID = ter.GATEPOST_ID
  1490. left join TMSTRUCK_LEAVE_FACTORY_RESULT tlfr
  1491. on tlfr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  1492. left join RMS_GATEPOST rg2
  1493. on rg2.GATEPOST_ID = tlfr.GATEPOST_ID
  1494. <where>
  1495. <if test="oneDate != null">
  1496. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = tlfr.RESULT_OUT_GATE_TIME
  1497. </if>
  1498. <if test="startDate != null" >
  1499. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = tlfr.RESULT_OUT_GATE_TIME
  1500. </if>
  1501. <if test="endDate != null" >
  1502. and to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss') >= tlfr.RESULT_OUT_GATE_TIME
  1503. </if>
  1504. <if test="con != null">
  1505. and (instr(rc.CAPACITY_NUMBER, #{con}) > 0 or instr(rg1.GATEPOST_NAME, #{con}) > 0 or instr(rg2.GATEPOST_NAME, #{con}) > 0 )
  1506. </if>
  1507. </where>
  1508. order by ter.RESULT_ENTRY_GATE_TIME desc
  1509. )
  1510. <where>
  1511. <if test=" capacityNumber!= null">
  1512. and
  1513. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1514. "capacityNumber" like '%${item}%'
  1515. </foreach>
  1516. </if>
  1517. <if test="orderNumber != null">
  1518. and
  1519. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1520. "orderNumber" like '%${item}%'
  1521. </foreach>
  1522. </if>
  1523. <if test="resultGrossWeight != null">
  1524. and
  1525. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  1526. "resultGrossWeight" like '%${item}%'
  1527. </foreach>
  1528. </if>
  1529. <if test=" resultGrossWeightTime!= null">
  1530. and
  1531. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  1532. "resultGrossWeightTime" like '%${item}%'
  1533. </foreach>
  1534. </if>
  1535. <if test="truckCalculateNumber1 != null">
  1536. and
  1537. <foreach collection="truckCalculateNumber1" item="item" open="(" separator="or" close=")">
  1538. "truckCalculateNumber1" like '%${item}%'
  1539. </foreach>
  1540. </if>
  1541. <if test="resultTareWeight != null">
  1542. and
  1543. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  1544. "resultTareWeight" like '%${item}%'
  1545. </foreach>
  1546. </if>
  1547. <if test=" resultTareWeightTime != null">
  1548. and
  1549. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  1550. "resultTareWeightTime" like '%${item}%'
  1551. </foreach>
  1552. </if>
  1553. <if test="truckCalculateNumber2 != null">
  1554. and
  1555. <foreach collection="truckCalculateNumber2" item="item" open="(" separator="or" close=")">
  1556. "truckCalculateNumber2" like '%${item}%'
  1557. </foreach>
  1558. </if>
  1559. <if test=" resultNetWeight!= null">
  1560. and
  1561. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  1562. "resultNetWeight" like '%${item}%'
  1563. </foreach>
  1564. </if>
  1565. <if test=" resultEntryGateTime!= null">
  1566. and
  1567. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  1568. "resultEntryGateTime" like '%${item}%'
  1569. </foreach>
  1570. </if>
  1571. <if test=" gatepostName1!= null">
  1572. and
  1573. <foreach collection="gatepostName1" item="item" open="(" separator="or" close=")">
  1574. "gatepostName1" like '%${item}%'
  1575. </foreach>
  1576. </if>
  1577. <if test=" resultOutGateTime!= null">
  1578. and
  1579. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  1580. "resultOutGateTime" like '%${item}%'
  1581. </foreach>
  1582. </if>
  1583. <if test=" gatepostName2 != null">
  1584. and
  1585. <foreach collection="gatepostName2" item="item" open="(" separator="or" close=")">
  1586. "gatepostName2" like '%${item}%'
  1587. </foreach>
  1588. </if>
  1589. <if test=" resultLoadEndTime != null">
  1590. and
  1591. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  1592. "resultLoadEndTime" like '%${item}%'
  1593. </foreach>
  1594. </if>
  1595. <if test=" warehouseName1 != null">
  1596. and
  1597. <foreach collection="warehouseName1" item="item" open="(" separator="or" close=")">
  1598. "warehouseName1" like '%${item}%'
  1599. </foreach>
  1600. </if>
  1601. <if test=" resultEndTime != null">
  1602. and
  1603. <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
  1604. "resultEndTime" like '%${item}%'
  1605. </foreach>
  1606. </if>
  1607. <if test=" warehouseName2 != null">
  1608. and
  1609. <foreach collection="warehouseName2" item="item" open="(" separator="or" close=")">
  1610. "warehouseName2" like '%${item}%'
  1611. </foreach>
  1612. </if>
  1613. </where>
  1614. </select>
  1615. </mapper>