StatisticalReportMapper.xml 74 KB

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