StatisticalReportMapper.xml 35 KB

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