StatisticalReportMapper.xml 33 KB

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