StatisticalReportMapper.xml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  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="getAllPurchaseFLRLReport" parameterType="map" resultType="java.util.Map">
  14. select *
  15. from (select
  16. OO.ORDER_NUMBER "orderNumber",
  17. RC.CAPACITY_NUMBER "capacityNumber",
  18. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  19. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  20. TQR.RESULT_DEDUCTION "resultDeduction",
  21. TUR.RESULT_END_TIME "resultEndTime",
  22. RW.WAREHOUSE_NAME "warehouseName",
  23. TRR.INSERT_TIME "insertTime",
  24. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  25. OO.INSERT_TIME "insertTimee",
  26. RGEN.GATEPOST_NAME "enGatepostName",
  27. RGOUT.GATEPOST_NAME "outGatepostName",
  28. RTCMAO.TRUCK_CALCULATE_NUMBER "grossCalculateNum",
  29. RTCPI.TRUCK_CALCULATE_NUMBER "tareCalculateNum",
  30. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  31. RM.MATERIAL_NAME "materialName",
  32. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode",
  33. <if test="orderTypee == 17 or orderTypee == 18">
  34. RS.SUPPLIER_NAME "supplierName",
  35. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  36. </if>
  37. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime"
  38. from OMSTRUCK_ORDER OO
  39. left join TMSTRUCK_TOTAL_RESULT TTR
  40. on TTR.ORDER_ID = OO.ORDER_ID
  41. left join RMS_CAPACITY RC
  42. on RC.CAPACITY_ID = OO.CAPACITY_ID
  43. left join TMSTRUCK_ENFACTORY_RESULT TER
  44. on TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
  45. left join RMS_GATEPOST RGEN --进厂门岗
  46. on RGEN.GATEPOST_ID = TER.GATEPOST_ID
  47. left join OMSTRUCK_ORDER_MATERIAL OOM
  48. on OOM.ORDER_ID = OO.ORDER_ID
  49. left join RMS_MATERIAL RM
  50. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  51. left join TMSTRUCK_WEIGHT_RESULT TWR
  52. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  53. left join RMS_TRUCK_CALCULATE RTCMAO --毛重汽车衡
  54. on RTCMAO.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  55. left join RMS_TRUCK_CALCULATE RTCPI --皮重汽车衡
  56. on RTCPI.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  57. left join TMSTRUCK_UNLOAD_RESULT TUR
  58. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  59. left join RMS_WAREHOUSE RW
  60. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  61. left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  62. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  63. left join RMS_GATEPOST RGOUT --出厂门岗
  64. on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
  65. left join TMSTRUCK_RECEIPT_RESULT TRR
  66. on TRR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  67. left join TMSTRUCK_QUALITY_RESULT TQR
  68. on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
  69. <if test="orderTypee == 17 or orderTypee == 18">
  70. left join AMS_PURCHASE_ORDER APO
  71. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  72. left join RMS_SUPPLIER RS
  73. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  74. left join RMS_CONSIGNEE RCON
  75. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  76. </if>
  77. where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
  78. and OO.ORDER_TYPE = #{orderTypee}
  79. <if test="oneDate != null">
  80. and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
  81. </if>
  82. <if test="startDate != null">
  83. and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
  84. and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
  85. </if>
  86. )
  87. <where>
  88. <if test="orderNumber != null">
  89. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  90. "orderNumber" like '%${item}%'
  91. </foreach>
  92. </if>
  93. <if test="capacityNumber != null">
  94. and
  95. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  96. "capacityNumber" like '%${item}%'
  97. </foreach>
  98. </if>
  99. <if test="resultEntryGateTime != null">
  100. and
  101. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  102. "resultEntryGateTime" like '%${item}%'
  103. </foreach>
  104. </if>
  105. <if test="resultNetWeight != null">
  106. and
  107. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  108. "resultNetWeight" like '%${item}%'
  109. </foreach>
  110. </if>
  111. <if test="resultDeduction != null">
  112. and
  113. <foreach collection="resultDeduction" item="item" open="(" separator="or" close=")">
  114. "resultDeduction" like '%${item}%'
  115. </foreach>
  116. </if>
  117. <if test="resultEndTime != null">
  118. and
  119. <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
  120. "resultEndTime" like '%${item}%'
  121. </foreach>
  122. </if>
  123. <if test="warehouseName != null">
  124. and
  125. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  126. "warehouseName" like '%${item}%'
  127. </foreach>
  128. </if>
  129. <if test="insertTime != null">
  130. and
  131. <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
  132. "insertTime" like '%${item}%'
  133. </foreach>
  134. </if>
  135. <if test="resultOutGateTime != null">
  136. and
  137. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  138. "resultOutGateTime" like '%${item}%'
  139. </foreach>
  140. </if>
  141. </where>
  142. <include refid="orderBy"></include>
  143. <if test="orderField == null">
  144. order by "insertTimee" desc
  145. </if>
  146. </select>
  147. <!-- 查询销售统计报表 -->
  148. <select id="getAllSaleReport" parameterType="java.util.Map" resultType="java.util.Map">
  149. select
  150. *
  151. from (
  152. select OO.ORDER_NUMBER "orderNumber",
  153. RC.CAPACITY_NUMBER "capacityNumber",
  154. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  155. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  156. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  157. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  158. RW.WAREHOUSE_NAME "warehouseName",
  159. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  160. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  161. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  162. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  163. RTCMAO.TRUCK_CALCULATE_NUMBER "maoCalculate",
  164. RTCPI.TRUCK_CALCULATE_NUMBER "piCalculate",
  165. RGEN.GATEPOST_NAME "enGatepostName",
  166. RGOUT.GATEPOST_NAME "outGatepostName",
  167. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  168. RS.SUPPLIER_NAME "sendName",
  169. RM.MATERIAL_NAME "materialName",
  170. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  171. from OMSTRUCK_ORDER OO
  172. left join AMS_SALE_ORDER_MATERIAL ASOM
  173. on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  174. left join AMS_SALE_ORDER ASO
  175. on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  176. left join RMS_CONSIGNEE RCON
  177. on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  178. left join RMS_SUPPLIER RS
  179. on RS.SUPPLIER_ID = ASO.SHIPPER_ID
  180. join TMSTRUCK_TOTAL_RESULT TTR
  181. on TTR.ORDER_ID = OO.ORDER_ID
  182. join TMSTRUCK_LOAD_RESULT TLR
  183. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  184. left join RMS_WAREHOUSE RW
  185. on RW.WAREHOUSE_ID = TLR.LOADING_ID
  186. join TMSTRUCK_WEIGHT_RESULT TWR
  187. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  188. left join RMS_TRUCK_CALCULATE RTCMAO
  189. on TWR.RESULT_GROSS_PLACE_ID = RTCMAO.TRUCK_CALCULATE_ID
  190. left join RMS_TRUCK_CALCULATE RTCPI
  191. on TWR.RESULT_TARE_PLACE_ID = RTCPI.TRUCK_CALCULATE_ID
  192. join TMSTRUCK_ENFACTORY_RESULT TER
  193. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  194. left join RMS_GATEPOST RGEN
  195. on RGEN.GATEPOST_ID = TER.GATEPOST_ID
  196. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  197. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  198. left join RMS_GATEPOST RGOUT
  199. on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
  200. join RMS_CAPACITY RC
  201. on RC.CAPACITY_ID = OO.CAPACITY_ID
  202. join OMSTRUCK_ORDER_MATERIAL OOM
  203. on OOM.ORDER_ID = OO.ORDER_ID
  204. join RMS_MATERIAL RM
  205. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  206. <if test="carrierSsoId != null">
  207. join RMS_CARRIER RCA
  208. on RCA.CARRIER_ID = RC.CARRIER_ID
  209. </if>
  210. where OO.ORDER_TYPE in (1, 2)
  211. <if test="carrierSsoId != null">
  212. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  213. </if>
  214. <if test="oneDate != null">
  215. and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
  216. </if>
  217. <if test="startDate != null">
  218. and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
  219. and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
  220. </if>
  221. )
  222. <where>
  223. <if test="orderNumber != null">
  224. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  225. "orderNumber" like '%${item}%'
  226. </foreach>
  227. </if>
  228. <if test="capacityNumber != null">
  229. and
  230. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  231. "capacityNumber" like '%${item}%'
  232. </foreach>
  233. </if>
  234. <if test="resultEntryGateTime != null">
  235. and
  236. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  237. "resultEntryGateTime" like '%${item}%'
  238. </foreach>
  239. </if>
  240. <if test="resultTareWeightTime != null">
  241. and
  242. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  243. "resultTareWeightTime" like '%${item}%'
  244. </foreach>
  245. </if>
  246. <if test="resultTareWeight != null">
  247. and
  248. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  249. "resultTareWeight" like '%${item}%'
  250. </foreach>
  251. </if>
  252. <if test="resultLoadEndTime != null">
  253. and
  254. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  255. "resultLoadEndTime" like '%${item}%'
  256. </foreach>
  257. </if>
  258. <if test="warehouseName != null">
  259. and
  260. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  261. "warehouseName" like '%${item}%'
  262. </foreach>
  263. </if>
  264. <if test="resultGrossWeightTime != null">
  265. and
  266. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  267. "resultGrossWeightTime" like '%${item}%'
  268. </foreach>
  269. </if>
  270. <if test="resultGrossWeight != null">
  271. and
  272. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  273. "resultGrossWeight" like '%${item}%'
  274. </foreach>
  275. </if>
  276. <if test="resultNetWeight != null">
  277. and
  278. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  279. "resultNetWeight" like '%${item}%'
  280. </foreach>
  281. </if>
  282. <if test="resultOutGateTime != null">
  283. and
  284. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  285. "resultOutGateTime" like '%${item}%'
  286. </foreach>
  287. </if>
  288. </where>
  289. <include refid="orderBy"></include>
  290. <if test="orderField == null">
  291. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  292. </if>
  293. </select>
  294. <!-- 查询零星进厂物资统计报表-->
  295. <select id="getSporadicSuppliesReport1" resultType="java.util.Map">
  296. select
  297. *
  298. from (
  299. select OO.ORDER_NUMBER "orderNumber",
  300. RC.CAPACITY_NUMBER "capacityNumber",
  301. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  302. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  303. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  304. TUR.RESULT_END_TIME "resultEndTime",
  305. RW.WAREHOUSE_NAME "warehouseName",
  306. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  307. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  308. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  309. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  310. -- 查询进厂门岗
  311. RG2.GATEPOST_NAME "gatepostEntryName",
  312. -- 出厂门岗
  313. RG.GATEPOST_NAME "gatepostOutName",
  314. -- 计皮汽车衡
  315. RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
  316. -- 计毛汽车衡
  317. RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
  318. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  319. RS.SUPPLIER_NAME "sendName",
  320. RM.MATERIAL_NAME "materialName",
  321. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  322. from OMSTRUCK_ORDER OO
  323. join TMSTRUCK_TOTAL_RESULT TTR
  324. on TTR.ORDER_ID = OO.ORDER_ID
  325. join TMSTRUCK_UNLOAD_RESULT TUR
  326. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  327. left join RMS_WAREHOUSE RW
  328. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  329. join TMSTRUCK_WEIGHT_RESULT TWR
  330. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  331. left join RMS_TRUCK_CALCULATE RTC2
  332. on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  333. left join RMS_TRUCK_CALCULATE RTC1
  334. on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  335. join TMSTRUCK_ENFACTORY_RESULT TER
  336. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  337. left join RMS_GATEPOST RG2
  338. on RG2.GATEPOST_ID =TER.GATEPOST_ID
  339. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  340. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  341. left join RMS_GATEPOST RG
  342. on TLFR.GATEPOST_ID =RG.GATEPOST_ID
  343. left join RMS_CAPACITY RC
  344. on RC.CAPACITY_ID = OO.CAPACITY_ID
  345. left join AMSTRUCK_SPORADIC_ORDER ASO
  346. on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  347. left join RMS_SUPPLIER RS
  348. on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
  349. left join RMS_CONSIGNEE RCON
  350. on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
  351. join OMSTRUCK_ORDER_MATERIAL OOM
  352. on OOM.ORDER_ID = OO.ORDER_ID
  353. join RMS_MATERIAL RM
  354. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  355. <if test="carrierSsoId != null">
  356. join RMS_CARRIER RCA
  357. on RCA.CARRIER_ID = RC.CARRIER_ID
  358. </if>
  359. where OO.ORDER_TYPE in (12,15)
  360. <if test="carrierSsoId != null">
  361. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  362. </if>
  363. <if test="oneDate != null">
  364. and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
  365. </if>
  366. <if test="startDate != null">
  367. and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
  368. and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
  369. </if>
  370. <if test="con!=null">
  371. where "receiveName" like #{con} or "sendName" like #{con} or "materialName" like #{con}
  372. or "capacityNumber" like #{con}
  373. </if>
  374. <if test="userId!=null">
  375. and ASO.INSERT_USERNAME=#{userId}
  376. </if>
  377. <if test="userIds!=null">
  378. and ASO.UPDATE_USERNAME=#{userIds}
  379. </if>
  380. <if test="orderType!=null">
  381. and OO.ORDER_TYPE=#{orderType}
  382. </if>
  383. )
  384. <where>
  385. <if test="orderNumber != null">
  386. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  387. "orderNumber" like '%${item}%'
  388. </foreach>
  389. </if>
  390. <if test="capacityNumber != null">
  391. and
  392. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  393. "capacityNumber" like '%${item}%'
  394. </foreach>
  395. </if>
  396. <if test="resultEntryGateTime != null">
  397. and
  398. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  399. "resultEntryGateTime" like '%${item}%'
  400. </foreach>
  401. </if>
  402. <if test="resultTareWeightTime != null">
  403. and
  404. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  405. "resultTareWeightTime" like '%${item}%'
  406. </foreach>
  407. </if>
  408. <if test="resultTareWeight != null">
  409. and
  410. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  411. "resultTareWeight" like '%${item}%'
  412. </foreach>
  413. </if>
  414. <if test="resultEndTime != null">
  415. and
  416. <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
  417. "resultEndTime" like '%${item}%'
  418. </foreach>
  419. </if>
  420. <if test="warehouseName != null">
  421. and
  422. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  423. "warehouseName" like '%${item}%'
  424. </foreach>
  425. </if>
  426. <if test="resultGrossWeightTime != null">
  427. and
  428. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  429. "resultGrossWeightTime" like '%${item}%'
  430. </foreach>
  431. </if>
  432. <if test="resultGrossWeight != null">
  433. and
  434. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  435. "resultGrossWeight" like '%${item}%'
  436. </foreach>
  437. </if>
  438. <if test="resultNetWeight != null">
  439. and
  440. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  441. "resultNetWeight" like '%${item}%'
  442. </foreach>
  443. </if>
  444. <if test="resultOutGateTime != null">
  445. and
  446. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  447. "resultOutGateTime" like '%${item}%'
  448. </foreach>
  449. </if>
  450. </where>
  451. <include refid="orderBy"></include>
  452. <if test="orderField == null">
  453. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  454. </if>
  455. </select>
  456. <!-- 查询零星出厂物资统计报表-->
  457. <select id="getSporadicSuppliesReport2" resultType="java.util.Map">
  458. select
  459. *
  460. from (
  461. select OO.ORDER_NUMBER "orderNumber",
  462. RC.CAPACITY_NUMBER "capacityNumber",
  463. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  464. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  465. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  466. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  467. RW.WAREHOUSE_NAME "warehouseName",
  468. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  469. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  470. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  471. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  472. -- 查询进厂门岗
  473. RG2.GATEPOST_NAME "gatepostEntryName",
  474. -- 出厂门岗
  475. RG.GATEPOST_NAME "gatepostOutName",
  476. -- 计皮汽车衡
  477. RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
  478. -- 计毛汽车衡
  479. RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
  480. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  481. RS.SUPPLIER_NAME "sendName",
  482. RM.MATERIAL_NAME "materialName",
  483. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  484. from OMSTRUCK_ORDER OO
  485. join TMSTRUCK_TOTAL_RESULT TTR
  486. on TTR.ORDER_ID = OO.ORDER_ID
  487. join TMSTRUCK_LOAD_RESULT TLR
  488. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  489. left join RMS_WAREHOUSE RW
  490. on RW.WAREHOUSE_ID = TLR.LOADING_ID
  491. join TMSTRUCK_WEIGHT_RESULT TWR
  492. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  493. left join RMS_TRUCK_CALCULATE RTC2
  494. on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  495. left join RMS_TRUCK_CALCULATE RTC1
  496. on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  497. join TMSTRUCK_ENFACTORY_RESULT TER
  498. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  499. left join RMS_GATEPOST RG2
  500. on RG2.GATEPOST_ID =TER.GATEPOST_ID
  501. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  502. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  503. left join RMS_GATEPOST RG
  504. on TLFR.GATEPOST_ID =RG.GATEPOST_ID
  505. left join RMS_CAPACITY RC
  506. on RC.CAPACITY_ID = OO.CAPACITY_ID
  507. left join AMSTRUCK_SPORADIC_ORDER ASO
  508. on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  509. left join RMS_SUPPLIER RS
  510. on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
  511. left join RMS_CONSIGNEE RCON
  512. on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
  513. join OMSTRUCK_ORDER_MATERIAL OOM
  514. on OOM.ORDER_ID = OO.ORDER_ID
  515. join RMS_MATERIAL RM
  516. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  517. <if test="carrierSsoId != null">
  518. join RMS_CARRIER RCA
  519. on RCA.CARRIER_ID = RC.CARRIER_ID
  520. </if>
  521. where OO.ORDER_TYPE in (13,16)
  522. <if test="carrierSsoId != null">
  523. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  524. </if>
  525. <if test="oneDate != null">
  526. and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
  527. </if>
  528. <if test="startDate != null">
  529. and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
  530. and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
  531. </if>
  532. <if test="con!=null">
  533. where "receiveName" like #{con} or "sendName" like #{con} or "materialName" like #{con}
  534. or "capacityNumber" like #{con}
  535. </if>
  536. <if test="userId!=null">
  537. and ASO.INSERT_USERNAME=#{userId}
  538. </if>
  539. <if test="userIds!=null">
  540. and ASO.UPDATE_USERNAME=#{userIds}
  541. </if>
  542. <if test="orderType!=null">
  543. and OO.ORDER_TYPE=#{orderType}
  544. </if>
  545. )
  546. <where>
  547. <if test="orderNumber != null">
  548. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  549. "orderNumber" like '%${item}%'
  550. </foreach>
  551. </if>
  552. <if test="capacityNumber != null">
  553. and
  554. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  555. "capacityNumber" like '%${item}%'
  556. </foreach>
  557. </if>
  558. <if test="resultEntryGateTime != null">
  559. and
  560. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  561. "resultEntryGateTime" like '%${item}%'
  562. </foreach>
  563. </if>
  564. <if test="resultTareWeightTime != null">
  565. and
  566. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  567. "resultTareWeightTime" like '%${item}%'
  568. </foreach>
  569. </if>
  570. <if test="resultTareWeight != null">
  571. and
  572. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  573. "resultTareWeight" like '%${item}%'
  574. </foreach>
  575. </if>
  576. <if test="resultLoadEndTime != null">
  577. and
  578. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  579. "resultLoadEndTime" like '%${item}%'
  580. </foreach>
  581. </if>
  582. <if test="warehouseName != null">
  583. and
  584. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  585. "warehouseName" like '%${item}%'
  586. </foreach>
  587. </if>
  588. <if test="resultGrossWeightTime != null">
  589. and
  590. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  591. "resultGrossWeightTime" like '%${item}%'
  592. </foreach>
  593. </if>
  594. <if test="resultGrossWeight != null">
  595. and
  596. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  597. "resultGrossWeight" like '%${item}%'
  598. </foreach>
  599. </if>
  600. <if test="resultNetWeight != null">
  601. and
  602. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  603. "resultNetWeight" like '%${item}%'
  604. </foreach>
  605. </if>
  606. <if test="resultOutGateTime != null">
  607. and
  608. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  609. "resultOutGateTime" like '%${item}%'
  610. </foreach>
  611. </if>
  612. </where>
  613. <include refid="orderBy"></include>
  614. <if test="orderField == null">
  615. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  616. </if>
  617. </select>
  618. </mapper>