StatisticalReportMapper.xml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  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. TLR.INSERT_UPDATE_REMARK "materialRemark",
  171. ASO.SALE_NUMBER "saleNumber",
  172. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  173. from OMSTRUCK_ORDER OO
  174. left join AMS_SALE_ORDER_MATERIAL ASOM
  175. on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  176. left join AMS_SALE_ORDER ASO
  177. on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  178. left join RMS_CONSIGNEE RCON
  179. on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  180. left join RMS_SUPPLIER RS
  181. on RS.SUPPLIER_ID = ASO.SHIPPER_ID
  182. join TMSTRUCK_TOTAL_RESULT TTR
  183. on TTR.ORDER_ID = OO.ORDER_ID
  184. join TMSTRUCK_LOAD_RESULT TLR
  185. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  186. left join RMS_WAREHOUSE RW
  187. on RW.WAREHOUSE_ID = TLR.LOADING_ID
  188. join TMSTRUCK_WEIGHT_RESULT TWR
  189. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  190. left join RMS_TRUCK_CALCULATE RTCMAO
  191. on TWR.RESULT_GROSS_PLACE_ID = RTCMAO.TRUCK_CALCULATE_ID
  192. left join RMS_TRUCK_CALCULATE RTCPI
  193. on TWR.RESULT_TARE_PLACE_ID = RTCPI.TRUCK_CALCULATE_ID
  194. join TMSTRUCK_ENFACTORY_RESULT TER
  195. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  196. left join RMS_GATEPOST RGEN
  197. on RGEN.GATEPOST_ID = TER.GATEPOST_ID
  198. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  199. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  200. left join RMS_GATEPOST RGOUT
  201. on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
  202. join RMS_CAPACITY RC
  203. on RC.CAPACITY_ID = OO.CAPACITY_ID
  204. join OMSTRUCK_ORDER_MATERIAL OOM
  205. on OOM.ORDER_ID = OO.ORDER_ID
  206. join RMS_MATERIAL RM
  207. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  208. <if test="carrierSsoId != null">
  209. join RMS_CARRIER RCA
  210. on RCA.CARRIER_ID = RC.CARRIER_ID
  211. </if>
  212. where OO.ORDER_TYPE in (1, 2)
  213. <if test="carrierSsoId != null">
  214. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  215. </if>
  216. <if test="oneDate != null">
  217. and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
  218. </if>
  219. <if test="startDate != null">
  220. and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
  221. and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
  222. </if>
  223. )
  224. <where>
  225. <if test="orderNumber != null">
  226. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  227. "orderNumber" like '%${item}%'
  228. </foreach>
  229. </if>
  230. <if test="capacityNumber != null">
  231. and
  232. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  233. "capacityNumber" like '%${item}%'
  234. </foreach>
  235. </if>
  236. <if test="receiveName != null">
  237. and
  238. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  239. "receiveName" like '%${item}%'
  240. </foreach>
  241. </if>
  242. <if test="materialRemark != null">
  243. and
  244. <foreach collection="materialRemark" item="item" open="(" separator="or" close=")">
  245. "materialRemark" like '%${item}%'
  246. </foreach>
  247. </if>
  248. <if test="sendName != null">
  249. and
  250. <foreach collection="sendName" item="item" open="(" separator="or" close=")">
  251. "sendName" like '%${item}%'
  252. </foreach>
  253. </if>
  254. <if test="resultEntryGateTime != null">
  255. and
  256. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  257. "resultEntryGateTime" like '%${item}%'
  258. </foreach>
  259. </if>
  260. <if test="resultTareWeightTime != null">
  261. and
  262. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  263. "resultTareWeightTime" like '%${item}%'
  264. </foreach>
  265. </if>
  266. <if test="resultTareWeight != null">
  267. and
  268. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  269. "resultTareWeight" like '%${item}%'
  270. </foreach>
  271. </if>
  272. <if test="resultLoadEndTime != null">
  273. and
  274. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  275. "resultLoadEndTime" like '%${item}%'
  276. </foreach>
  277. </if>
  278. <if test="warehouseName != null">
  279. and
  280. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  281. "warehouseName" like '%${item}%'
  282. </foreach>
  283. </if>
  284. <if test="resultGrossWeightTime != null">
  285. and
  286. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  287. "resultGrossWeightTime" like '%${item}%'
  288. </foreach>
  289. </if>
  290. <if test="resultGrossWeight != null">
  291. and
  292. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  293. "resultGrossWeight" like '%${item}%'
  294. </foreach>
  295. </if>
  296. <if test="materialName != null">
  297. and
  298. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  299. "materialName" like '%${item}%'
  300. </foreach>
  301. </if>
  302. <if test="resultNetWeight != null">
  303. and
  304. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  305. "resultNetWeight" like '%${item}%'
  306. </foreach>
  307. </if>
  308. <if test="resultOutGateTime != null">
  309. and
  310. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  311. "resultOutGateTime" like '%${item}%'
  312. </foreach>
  313. </if>
  314. </where>
  315. <include refid="orderBy"></include>
  316. <if test="orderField == null">
  317. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  318. </if>
  319. </select>
  320. <!-- 查询零星进厂物资统计报表-->
  321. <select id="getSporadicSuppliesReport1" resultType="java.util.Map">
  322. select
  323. *
  324. from (
  325. select OO.ORDER_NUMBER "orderNumber",
  326. RC.CAPACITY_NUMBER "capacityNumber",
  327. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  328. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  329. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  330. TUR.RESULT_END_TIME "resultEndTime",
  331. RW.WAREHOUSE_NAME "warehouseName",
  332. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  333. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  334. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  335. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  336. -- 查询进厂门岗
  337. RG2.GATEPOST_NAME "gatepostEntryName",
  338. -- 出厂门岗
  339. RG.GATEPOST_NAME "gatepostOutName",
  340. -- 计皮汽车衡
  341. RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
  342. -- 计毛汽车衡
  343. RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
  344. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  345. RS.SUPPLIER_NAME "sendName",
  346. RM.MATERIAL_NAME "materialName",
  347. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  348. from OMSTRUCK_ORDER OO
  349. join TMSTRUCK_TOTAL_RESULT TTR
  350. on TTR.ORDER_ID = OO.ORDER_ID
  351. join TMSTRUCK_UNLOAD_RESULT TUR
  352. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  353. left join RMS_WAREHOUSE RW
  354. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  355. join TMSTRUCK_WEIGHT_RESULT TWR
  356. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  357. left join RMS_TRUCK_CALCULATE RTC2
  358. on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  359. left join RMS_TRUCK_CALCULATE RTC1
  360. on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  361. join TMSTRUCK_ENFACTORY_RESULT TER
  362. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  363. left join RMS_GATEPOST RG2
  364. on RG2.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 RG
  368. on TLFR.GATEPOST_ID =RG.GATEPOST_ID
  369. left join RMS_CAPACITY RC
  370. on RC.CAPACITY_ID = OO.CAPACITY_ID
  371. left join AMSTRUCK_SPORADIC_ORDER ASO
  372. on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  373. left join RMS_SUPPLIER RS
  374. on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
  375. left join RMS_CONSIGNEE RCON
  376. on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
  377. join OMSTRUCK_ORDER_MATERIAL OOM
  378. on OOM.ORDER_ID = OO.ORDER_ID
  379. join RMS_MATERIAL RM
  380. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  381. <if test="carrierSsoId != null">
  382. join RMS_CARRIER RCA
  383. on RCA.CARRIER_ID = RC.CARRIER_ID
  384. </if>
  385. where OO.ORDER_TYPE in (12,15)
  386. <if test="carrierSsoId != null">
  387. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  388. </if>
  389. <if test="oneDate != null">
  390. and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
  391. </if>
  392. <if test="startDate != null">
  393. and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
  394. and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
  395. </if>
  396. <if test="con!=null">
  397. where "receiveName" like #{con} or "sendName" like #{con} or "materialName" like #{con}
  398. or "capacityNumber" like #{con}
  399. </if>
  400. <if test="userId!=null">
  401. and ASO.INSERT_USERNAME=#{userId}
  402. </if>
  403. <if test="userIds!=null">
  404. and ASO.UPDATE_USERNAME=#{userIds}
  405. </if>
  406. <if test="orderType!=null">
  407. and OO.ORDER_TYPE=#{orderType}
  408. </if>
  409. )
  410. <where>
  411. <if test="receiveName != null">
  412. and
  413. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  414. "receiveName" like '%${item}%'
  415. </foreach>
  416. </if>
  417. <if test="sendName != null">
  418. and
  419. <foreach collection="sendName" item="item" open="(" separator="or" close=")">
  420. "sendName" like '%${item}%'
  421. </foreach>
  422. </if>
  423. <if test="materialName != null">
  424. and
  425. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  426. "materialName" like '%${item}%'
  427. </foreach>
  428. </if>
  429. <if test="orderNumber != null">
  430. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  431. "orderNumber" like '%${item}%'
  432. </foreach>
  433. </if>
  434. <if test="capacityNumber != null">
  435. and
  436. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  437. "capacityNumber" like '%${item}%'
  438. </foreach>
  439. </if>
  440. <if test="resultEntryGateTime != null">
  441. and
  442. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  443. "resultEntryGateTime" like '%${item}%'
  444. </foreach>
  445. </if>
  446. <if test="resultTareWeightTime != null">
  447. and
  448. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  449. "resultTareWeightTime" like '%${item}%'
  450. </foreach>
  451. </if>
  452. <if test="resultTareWeight != null">
  453. and
  454. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  455. "resultTareWeight" like '%${item}%'
  456. </foreach>
  457. </if>
  458. <if test="resultEndTime != null">
  459. and
  460. <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
  461. "resultEndTime" like '%${item}%'
  462. </foreach>
  463. </if>
  464. <if test="warehouseName != null">
  465. and
  466. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  467. "warehouseName" like '%${item}%'
  468. </foreach>
  469. </if>
  470. <if test="resultGrossWeightTime != null">
  471. and
  472. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  473. "resultGrossWeightTime" like '%${item}%'
  474. </foreach>
  475. </if>
  476. <if test="resultGrossWeight != null">
  477. and
  478. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  479. "resultGrossWeight" like '%${item}%'
  480. </foreach>
  481. </if>
  482. <if test="resultNetWeight != null">
  483. and
  484. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  485. "resultNetWeight" like '%${item}%'
  486. </foreach>
  487. </if>
  488. <if test="resultOutGateTime != null">
  489. and
  490. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  491. "resultOutGateTime" like '%${item}%'
  492. </foreach>
  493. </if>
  494. </where>
  495. <include refid="orderBy"></include>
  496. <if test="orderField == null">
  497. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  498. </if>
  499. </select>
  500. <!-- 查询零星出厂物资统计报表-->
  501. <select id="getSporadicSuppliesReport2" resultType="java.util.Map">
  502. select
  503. *
  504. from (
  505. select OO.ORDER_NUMBER "orderNumber",
  506. RC.CAPACITY_NUMBER "capacityNumber",
  507. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  508. TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  509. TWR.RESULT_TARE_WEIGHT "resultTareWeight",
  510. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  511. RW.WAREHOUSE_NAME "warehouseName",
  512. TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  513. TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
  514. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  515. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  516. -- 查询进厂门岗
  517. RG2.GATEPOST_NAME "gatepostEntryName",
  518. -- 出厂门岗
  519. RG.GATEPOST_NAME "gatepostOutName",
  520. -- 计皮汽车衡
  521. RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
  522. -- 计毛汽车衡
  523. RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
  524. RCON.CONSIGNEE_COMPANY_NAME "receiveName",
  525. RS.SUPPLIER_NAME "sendName",
  526. RM.MATERIAL_NAME "materialName",
  527. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
  528. from OMSTRUCK_ORDER OO
  529. join TMSTRUCK_TOTAL_RESULT TTR
  530. on TTR.ORDER_ID = OO.ORDER_ID
  531. join TMSTRUCK_LOAD_RESULT TLR
  532. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  533. left join RMS_WAREHOUSE RW
  534. on RW.WAREHOUSE_ID = TLR.LOADING_ID
  535. join TMSTRUCK_WEIGHT_RESULT TWR
  536. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  537. left join RMS_TRUCK_CALCULATE RTC2
  538. on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  539. left join RMS_TRUCK_CALCULATE RTC1
  540. on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  541. join TMSTRUCK_ENFACTORY_RESULT TER
  542. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  543. left join RMS_GATEPOST RG2
  544. on RG2.GATEPOST_ID =TER.GATEPOST_ID
  545. join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  546. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  547. left join RMS_GATEPOST RG
  548. on TLFR.GATEPOST_ID =RG.GATEPOST_ID
  549. left join RMS_CAPACITY RC
  550. on RC.CAPACITY_ID = OO.CAPACITY_ID
  551. left join AMSTRUCK_SPORADIC_ORDER ASO
  552. on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  553. left join RMS_SUPPLIER RS
  554. on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
  555. left join RMS_CONSIGNEE RCON
  556. on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
  557. join OMSTRUCK_ORDER_MATERIAL OOM
  558. on OOM.ORDER_ID = OO.ORDER_ID
  559. join RMS_MATERIAL RM
  560. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  561. <if test="carrierSsoId != null">
  562. join RMS_CARRIER RCA
  563. on RCA.CARRIER_ID = RC.CARRIER_ID
  564. </if>
  565. where OO.ORDER_TYPE in (13,16)
  566. <if test="carrierSsoId != null">
  567. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  568. </if>
  569. <if test="oneDate != null">
  570. and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
  571. </if>
  572. <if test="startDate != null">
  573. and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
  574. and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
  575. </if>
  576. <if test="con!=null">
  577. where "receiveName" like #{con} or "sendName" like #{con} or "materialName" like #{con}
  578. or "capacityNumber" like #{con}
  579. </if>
  580. <if test="userId!=null">
  581. and ASO.INSERT_USERNAME=#{userId}
  582. </if>
  583. <if test="userIds!=null">
  584. and ASO.UPDATE_USERNAME=#{userIds}
  585. </if>
  586. <if test="orderType!=null">
  587. and OO.ORDER_TYPE=#{orderType}
  588. </if>
  589. )
  590. <where>
  591. <if test="receiveName != null">
  592. and
  593. <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
  594. "receiveName" like '%${item}%'
  595. </foreach>
  596. </if>
  597. <if test="sendName != null">
  598. and
  599. <foreach collection="sendName" item="item" open="(" separator="or" close=")">
  600. "sendName" like '%${item}%'
  601. </foreach>
  602. </if>
  603. <if test="materialName != null">
  604. and
  605. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  606. "materialName" like '%${item}%'
  607. </foreach>
  608. </if>
  609. <if test="orderNumber != null">
  610. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  611. "orderNumber" like '%${item}%'
  612. </foreach>
  613. </if>
  614. <if test="capacityNumber != null">
  615. and
  616. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  617. "capacityNumber" like '%${item}%'
  618. </foreach>
  619. </if>
  620. <if test="resultEntryGateTime != null">
  621. and
  622. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  623. "resultEntryGateTime" like '%${item}%'
  624. </foreach>
  625. </if>
  626. <if test="resultTareWeightTime != null">
  627. and
  628. <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
  629. "resultTareWeightTime" like '%${item}%'
  630. </foreach>
  631. </if>
  632. <if test="resultTareWeight != null">
  633. and
  634. <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
  635. "resultTareWeight" like '%${item}%'
  636. </foreach>
  637. </if>
  638. <if test="resultLoadEndTime != null">
  639. and
  640. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  641. "resultLoadEndTime" like '%${item}%'
  642. </foreach>
  643. </if>
  644. <if test="warehouseName != null">
  645. and
  646. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  647. "warehouseName" like '%${item}%'
  648. </foreach>
  649. </if>
  650. <if test="resultGrossWeightTime != null">
  651. and
  652. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
  653. "resultGrossWeightTime" like '%${item}%'
  654. </foreach>
  655. </if>
  656. <if test="resultGrossWeight != null">
  657. and
  658. <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
  659. "resultGrossWeight" like '%${item}%'
  660. </foreach>
  661. </if>
  662. <if test="resultNetWeight != null">
  663. and
  664. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  665. "resultNetWeight" like '%${item}%'
  666. </foreach>
  667. </if>
  668. <if test="resultOutGateTime != null">
  669. and
  670. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  671. "resultOutGateTime" like '%${item}%'
  672. </foreach>
  673. </if>
  674. </where>
  675. <include refid="orderBy"></include>
  676. <if test="orderField == null">
  677. order by "resultOutGateTime" desc, "resultEntryGateTime" desc
  678. </if>
  679. </select>
  680. </mapper>