StatisticalReportMapper.xml 27 KB

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