StatisticalReportMapper.xml 27 KB

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