TmstruckReceiveResultMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  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.TmstruckReceiveResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckReceiveResult">
  5. <id column="RESULT_RECEIVE_ID" jdbcType="DECIMAL" property="resultReceiveId" />
  6. <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
  7. <result column="RESULT_RECEIVE_TIME" jdbcType="TIMESTAMP" property="resultReceiveTime" />
  8. <result column="RECEIVE_SINGER_ID" jdbcType="DECIMAL" property="receiveSingerId" />
  9. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  10. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  11. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  12. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  13. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  14. <result column="STATUS" jdbcType="DECIMAL" property="status" />
  15. </resultMap>
  16. <sql id="columns">
  17. RESULT_RECEIVE_ID, RESULT_TOTAL_ID, RESULT_RECEIVE_TIME, RECEIVE_SINGER_ID, INSERT_USERNAME,
  18. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, STATUS
  19. </sql>
  20. <sql id="columns_alias">
  21. t.RESULT_RECEIVE_ID, t.RESULT_TOTAL_ID, t.RESULT_RECEIVE_TIME, t.RECEIVE_SINGER_ID,
  22. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
  23. t.STATUS
  24. </sql>
  25. <sql id="select">
  26. SELECT <include refid="columns" /> FROM TMSTRUCK_RECEIVE_RESULT
  27. </sql>
  28. <sql id="select_alias">
  29. SELECT <include refid="columns_alias" /> FROM TMSTRUCK_RECEIVE_RESULT t
  30. </sql>
  31. <sql id="where">
  32. <where>
  33. <if test="resultReceiveId != null">
  34. and RESULT_RECEIVE_ID = #{resultReceiveId}
  35. </if>
  36. <if test="resultTotalId != null">
  37. and RESULT_TOTAL_ID = #{resultTotalId}
  38. </if>
  39. <if test="resultReceiveTime != null">
  40. and TO_CHAR(RESULT_RECEIVE_TIME,'yyyy-MM-dd') = #{resultReceiveTime}
  41. </if>
  42. <if test="receiveSingerId != null">
  43. and RECEIVE_SINGER_ID = #{receiveSingerId}
  44. </if>
  45. <if test="insertUsername != null and insertUsername != ''">
  46. and INSERT_USERNAME = #{insertUsername}
  47. </if>
  48. <if test="insertTime != null">
  49. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  50. </if>
  51. <if test="updateUsername != null and updateUsername != ''">
  52. and UPDATE_USERNAME = #{updateUsername}
  53. </if>
  54. <if test="updateTime != null">
  55. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  56. </if>
  57. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  58. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  59. </if>
  60. <if test="status != null">
  61. and STATUS = #{status}
  62. </if>
  63. </where>
  64. </sql>
  65. <sql id="whereLike">
  66. <where>
  67. <if test="resultReceiveId != null">
  68. and RESULT_RECEIVE_ID = #{resultReceiveId}
  69. </if>
  70. <if test="resultTotalId != null">
  71. and RESULT_TOTAL_ID = #{resultTotalId}
  72. </if>
  73. <if test="resultReceiveTime != null">
  74. and TO_CHAR(RESULT_RECEIVE_TIME,'yyyy-MM-dd') = #{resultReceiveTime}
  75. </if>
  76. <if test="receiveSingerId != null">
  77. and RECEIVE_SINGER_ID = #{receiveSingerId}
  78. </if>
  79. <if test="insertUsername != null and insertUsername != ''">
  80. and INSERT_USERNAME LIKE '%${insertUsername}%'
  81. </if>
  82. <if test="insertTime != null">
  83. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  84. </if>
  85. <if test="updateUsername != null and updateUsername != ''">
  86. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  87. </if>
  88. <if test="updateTime != null">
  89. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  90. </if>
  91. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  92. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  93. </if>
  94. <if test="status != null">
  95. and STATUS = #{status}
  96. </if>
  97. </where>
  98. </sql>
  99. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  100. delete from TMSTRUCK_RECEIVE_RESULT
  101. where RESULT_RECEIVE_ID = #{resultReceiveId,jdbcType=DECIMAL}
  102. </delete>
  103. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  104. delete from TMSTRUCK_RECEIVE_RESULT
  105. where 1!=1
  106. <if test="resultTotalId != null">
  107. or RESULT_TOTAL_ID = #{resultTotalId}
  108. </if>
  109. <if test="resultReceiveTime != null">
  110. or TO_CHAR(RESULT_RECEIVE_TIME,'yyyy-MM-dd') = '#{resultReceiveTime}'
  111. </if>
  112. <if test="receiveSingerId != null">
  113. or RECEIVE_SINGER_ID = #{receiveSingerId}
  114. </if>
  115. <if test="insertUsername != null and insertUsername != ''">
  116. or INSERT_USERNAME = #{insertUsername}
  117. </if>
  118. <if test="insertTime != null">
  119. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  120. </if>
  121. <if test="updateUsername != null and updateUsername != ''">
  122. or UPDATE_USERNAME = #{updateUsername}
  123. </if>
  124. <if test="updateTime != null">
  125. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  126. </if>
  127. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  128. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  129. </if>
  130. <if test="status != null">
  131. or STATUS = #{status}
  132. </if>
  133. </delete>
  134. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckReceiveResult">
  135. insert into TMSTRUCK_RECEIVE_RESULT (RESULT_RECEIVE_ID, RESULT_TOTAL_ID, RESULT_RECEIVE_TIME,
  136. RECEIVE_SINGER_ID, INSERT_USERNAME, INSERT_TIME,
  137. UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  138. STATUS)
  139. values (#{resultReceiveId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL}, #{resultReceiveTime,jdbcType=TIMESTAMP},
  140. #{receiveSingerId,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
  141. #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
  142. #{status,jdbcType=DECIMAL})
  143. </insert>
  144. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckReceiveResult">
  145. insert into TMSTRUCK_RECEIVE_RESULT
  146. <trim prefix="(" suffix=")" suffixOverrides=",">
  147. <if test="resultReceiveId != null">
  148. RESULT_RECEIVE_ID,
  149. </if>
  150. <if test="resultTotalId != null">
  151. RESULT_TOTAL_ID,
  152. </if>
  153. <if test="resultReceiveTime != null">
  154. RESULT_RECEIVE_TIME,
  155. </if>
  156. <if test="receiveSingerId != null">
  157. RECEIVE_SINGER_ID,
  158. </if>
  159. <if test="insertUsername != null">
  160. INSERT_USERNAME,
  161. </if>
  162. <if test="insertTime != null">
  163. INSERT_TIME,
  164. </if>
  165. <if test="updateUsername != null">
  166. UPDATE_USERNAME,
  167. </if>
  168. <if test="updateTime != null">
  169. UPDATE_TIME,
  170. </if>
  171. <if test="insertUpdateRemark != null">
  172. INSERT_UPDATE_REMARK,
  173. </if>
  174. <if test="status != null">
  175. STATUS,
  176. </if>
  177. </trim>
  178. <trim prefix="values (" suffix=")" suffixOverrides=",">
  179. <if test="resultReceiveId != null">
  180. #{resultReceiveId,jdbcType=DECIMAL},
  181. </if>
  182. <if test="resultTotalId != null">
  183. #{resultTotalId,jdbcType=DECIMAL},
  184. </if>
  185. <if test="resultReceiveTime != null">
  186. #{resultReceiveTime,jdbcType=TIMESTAMP},
  187. </if>
  188. <if test="receiveSingerId != null">
  189. #{receiveSingerId,jdbcType=DECIMAL},
  190. </if>
  191. <if test="insertUsername != null">
  192. #{insertUsername,jdbcType=VARCHAR},
  193. </if>
  194. <if test="insertTime != null">
  195. #{insertTime,jdbcType=TIMESTAMP},
  196. </if>
  197. <if test="updateUsername != null">
  198. #{updateUsername,jdbcType=VARCHAR},
  199. </if>
  200. <if test="updateTime != null">
  201. #{updateTime,jdbcType=TIMESTAMP},
  202. </if>
  203. <if test="insertUpdateRemark != null">
  204. #{insertUpdateRemark,jdbcType=VARCHAR},
  205. </if>
  206. <if test="status != null">
  207. #{status,jdbcType=DECIMAL},
  208. </if>
  209. </trim>
  210. </insert>
  211. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckReceiveResult">
  212. update TMSTRUCK_RECEIVE_RESULT
  213. set RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  214. RESULT_RECEIVE_TIME = #{resultReceiveTime,jdbcType=TIMESTAMP},
  215. RECEIVE_SINGER_ID = #{receiveSingerId,jdbcType=DECIMAL},
  216. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  217. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  218. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  219. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  220. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  221. STATUS = #{status,jdbcType=DECIMAL}
  222. where RESULT_RECEIVE_ID = #{resultReceiveId,jdbcType=DECIMAL}
  223. </update>
  224. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckReceiveResult">
  225. update TMSTRUCK_RECEIVE_RESULT
  226. <set>
  227. <if test="resultTotalId != null">
  228. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  229. </if>
  230. <if test="resultReceiveTime != null">
  231. RESULT_RECEIVE_TIME = #{resultReceiveTime,jdbcType=TIMESTAMP},
  232. </if>
  233. <if test="receiveSingerId != null">
  234. RECEIVE_SINGER_ID = #{receiveSingerId,jdbcType=DECIMAL},
  235. </if>
  236. <if test="insertUsername != null">
  237. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  238. </if>
  239. <if test="insertTime != null">
  240. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  241. </if>
  242. <if test="updateUsername != null">
  243. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  244. </if>
  245. <if test="updateTime != null">
  246. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  247. </if>
  248. <if test="insertUpdateRemark != null">
  249. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  250. </if>
  251. <if test="status != null">
  252. STATUS = #{status,jdbcType=DECIMAL},
  253. </if>
  254. </set>
  255. where RESULT_RECEIVE_ID = #{resultReceiveId,jdbcType=DECIMAL}
  256. </update>
  257. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  258. <include refid="select" />
  259. where RESULT_RECEIVE_ID = #{resultReceiveId,jdbcType=DECIMAL}
  260. </select>
  261. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  262. <include refid="select" />
  263. <include refid="where" />
  264. </select>
  265. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  266. <include refid="select" />
  267. <include refid="whereLike" />
  268. </select>
  269. <insert id="batchInsert" parameterType="java.util.List">
  270. insert into TMSTRUCK_RECEIVE_RESULT
  271. (RESULT_RECEIVE_ID,
  272. RESULT_TOTAL_ID, RESULT_RECEIVE_TIME,
  273. RECEIVE_SINGER_ID, INSERT_USERNAME,
  274. INSERT_TIME, UPDATE_USERNAME,
  275. UPDATE_TIME, INSERT_UPDATE_REMARK,
  276. STATUS)
  277. ( <foreach collection="list" item="item" separator="union all">
  278. select
  279. #{item.resultReceiveId,jdbcType=DECIMAL},
  280. #{item.resultTotalId,jdbcType=DECIMAL}, #{item.resultReceiveTime,jdbcType=TIMESTAMP},
  281. #{item.receiveSingerId,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR},
  282. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  283. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  284. #{item.status,jdbcType=DECIMAL} from dual
  285. </foreach> )
  286. </insert>
  287. <update id="batchUpdate" parameterType="java.util.List">
  288. update TMSTRUCK_RECEIVE_RESULT
  289. set
  290. RESULT_RECEIVE_ID=
  291. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_RECEIVE_ID" separator=" ">
  292. when #{item.resultReceiveId,jdbcType=DECIMAL} then #{item.resultReceiveId,jdbcType=DECIMAL}
  293. </foreach>
  294. ,RESULT_TOTAL_ID=
  295. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_RECEIVE_ID" separator=" ">
  296. when #{item.resultReceiveId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
  297. </foreach>
  298. ,RESULT_RECEIVE_TIME=
  299. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_RECEIVE_ID" separator=" ">
  300. when #{item.resultReceiveId,jdbcType=DECIMAL} then #{item.resultReceiveTime,jdbcType=TIMESTAMP}
  301. </foreach>
  302. ,RECEIVE_SINGER_ID=
  303. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_RECEIVE_ID" separator=" ">
  304. when #{item.resultReceiveId,jdbcType=DECIMAL} then #{item.receiveSingerId,jdbcType=DECIMAL}
  305. </foreach>
  306. ,INSERT_USERNAME=
  307. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_RECEIVE_ID" separator=" ">
  308. when #{item.resultReceiveId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  309. </foreach>
  310. ,INSERT_TIME=
  311. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_RECEIVE_ID" separator=" ">
  312. when #{item.resultReceiveId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  313. </foreach>
  314. ,UPDATE_USERNAME=
  315. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_RECEIVE_ID" separator=" ">
  316. when #{item.resultReceiveId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  317. </foreach>
  318. ,UPDATE_TIME=
  319. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_RECEIVE_ID" separator=" ">
  320. when #{item.resultReceiveId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  321. </foreach>
  322. ,INSERT_UPDATE_REMARK=
  323. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_RECEIVE_ID" separator=" ">
  324. when #{item.resultReceiveId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  325. </foreach>
  326. ,STATUS=
  327. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_RECEIVE_ID" separator=" ">
  328. when #{item.resultReceiveId,jdbcType=DECIMAL} then #{item.status,jdbcType=DECIMAL}
  329. </foreach>
  330. where RESULT_RECEIVE_ID in
  331. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  332. #{item.resultReceiveId,jdbcType=DECIMAL}
  333. </foreach>
  334. </update>
  335. <delete id="batchDelete" parameterType="java.util.List">
  336. delete from TMSTRUCK_RECEIVE_RESULT
  337. where RESULT_RECEIVE_ID in
  338. <foreach close=")" collection="list" item="id" open="(" separator=",">
  339. #{id}
  340. </foreach>
  341. </delete>
  342. <!-- 友情提示!!!-->
  343. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  344. <!-- 查询是否已收过货 -->
  345. <select id="getReceiveResult" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
  346. select TRR.RESULT_RECEIVE_ID
  347. from TMSTRUCK_RECEIVE_RESULT TRR
  348. where TRR.RESULT_TOTAL_ID = #{resultTotalId}
  349. </select>
  350. <!-- 查询所有签收实绩 -->
  351. <select id="getCGReceiveResult" parameterType="java.util.Map" resultType="java.util.Map">
  352. select
  353. *
  354. from (
  355. select
  356. OO.ORDER_ID "orderId",
  357. TRR.RESULT_RECEIVE_ID "resultId",
  358. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  359. RM.MATERIAL_NAME "materialName",
  360. OO.ORDER_NUMBER "orderNumber",
  361. RC.CAPACITY_NUMBER "capacityNumber",
  362. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  363. TUR.UNLOAD_STATUS "unloadStatus",
  364. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  365. RW.WAREHOUSE_NAME "warehouseName",
  366. TRR.INSERT_USERNAME "insertUsername",
  367. TRR.INSERT_TIME "insertTime"
  368. from TMSTRUCK_RECEIVE_RESULT TRR
  369. left join TMSTRUCK_TOTAL_RESULT TTR
  370. on TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
  371. left join OMSTRUCK_ORDER OO
  372. on OO.ORDER_ID = TTR.ORDER_ID
  373. left join AMS_PURCHASE_ORDER APO
  374. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  375. left join DIL_BATCH DB
  376. on DB.BATCH_ID = APO.BATCH_ID
  377. left join RMS_CAPACITY RC
  378. on RC.CAPACITY_ID = OO.CAPACITY_ID
  379. left join TMSTRUCK_WEIGHT_RESULT TWR
  380. on TWR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
  381. left join TMSTRUCK_UNLOAD_RESULT TUR
  382. on TUR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
  383. left join OMSTRUCK_ORDER_MATERIAL OOM
  384. on OOM.ORDER_ID = OO.ORDER_ID
  385. left join RMS_MATERIAL RM
  386. on OOM.MATERIAL_ID = RM.MATERIAL_ID
  387. left join RMS_WAREHOUSE RW
  388. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  389. where TRR.STATUS = 1 and OO.ORDER_TYPE = #{orderTypee}
  390. <if test="oneDate != null">
  391. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TRR.INSERT_TIME
  392. </if>
  393. <if test="startDate != null">
  394. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TRR.INSERT_TIME
  395. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TRR.INSERT_TIME
  396. </if>
  397. <if test="con!=null">
  398. and ((instr(RW.WAREHOUSE_NAME, #{con}) > 0) or (instr(OO.ORDER_NUMBER, #{con}) > 0)
  399. or (instr( RC.CAPACITY_NUMBER, #{con}) > 0) or (instr(RM.MATERIAL_NAME , #{con}) > 0))
  400. </if>
  401. )
  402. <where>
  403. <if test="purchaseOrderNo != null">
  404. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  405. "purchaseOrderNo" like '%${item}%'
  406. </foreach>
  407. </if>
  408. <if test="materialName != null">
  409. and
  410. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  411. "materialName" like '%${item}%'
  412. </foreach>
  413. </if>
  414. <if test="orderNumber != null">
  415. and
  416. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  417. "orderNumber" like '%${item}%'
  418. </foreach>
  419. </if>
  420. <if test="capacityNumber != null">
  421. and
  422. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  423. "capacityNumber" like '%${item}%'
  424. </foreach>
  425. </if>
  426. <if test="resultForeignShipName != null">
  427. and
  428. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  429. "resultForeignShipName" like '%${item}%'
  430. </foreach>
  431. </if>
  432. <if test="unloadStatus != null">
  433. and
  434. <foreach collection="unloadStatus" item="item" open="(" separator="or" close=")">
  435. "unloadStatus" like '%${item}%'
  436. </foreach>
  437. </if>
  438. <if test="resultNetWeight != null">
  439. and
  440. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  441. "resultNetWeight" like '%${item}%'
  442. </foreach>
  443. </if>
  444. <if test="warehouseName != null">
  445. and
  446. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  447. "warehouseName" like '%${item}%'
  448. </foreach>
  449. </if>
  450. <if test="insertUsername != null">
  451. and
  452. <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
  453. "insertUsername" like '%${item}%'
  454. </foreach>
  455. </if>
  456. </where>
  457. <include refid="orderBy"></include>
  458. </select>
  459. <!-- 通过签收时间排序 -->
  460. <sql id="orderBy">
  461. <if test="orderField != null and orderField != ''">
  462. order by "${orderField}"
  463. <if test="orderType != null and orderType != ''">
  464. ${orderType}
  465. </if>
  466. </if>
  467. <if test="orderField == null ">
  468. order by "insertTime" desc
  469. </if>
  470. </sql>
  471. <select id="getInwardReceive" parameterType="java.util.Map" resultType="java.util.Map">
  472. select *
  473. from (
  474. select TRR.RESULT_RECEIVE_ID "resultId",
  475. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  476. RM.MATERIAL_NAME "materialName",
  477. OO.ORDER_NUMBER "orderNumber",
  478. RC.CAPACITY_NUMBER "capacityNumber",
  479. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  480. TUR.UNLOAD_STATUS "unloadStatus",
  481. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  482. tqr.result_issampling "issampling",
  483. TRR.INSERT_USERNAME "insertUsername",
  484. TRR.INSERT_TIME "insertTime",
  485. RW.WAREHOUSE_NAME "warehouseName"
  486. from TMSTRUCK_RECEIVE_RESULT TRR
  487. left join TMSTRUCK_TOTAL_RESULT TTR
  488. on TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
  489. left join OMSTRUCK_ORDER OO
  490. on OO.ORDER_ID = TTR.ORDER_ID
  491. left join AMSTRUCK_INWARD_PLAN AIP
  492. on AIP.PLAN_ID = OO.ORDER_PLAN_ID
  493. left join AMSTRUCK_REQUIREMENT_PLAN ARP
  494. on ARP.PLAN_ID = AIP.PLAN_ID
  495. left join AMSTRUCK_INWARD_REQUIREMENT AIR
  496. on AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
  497. left join AMS_PURCHASE_ORDER APO
  498. on APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
  499. left join DIL_BATCH DB
  500. on DB.BATCH_ID = APO.BATCH_ID
  501. left join RMS_CAPACITY RC
  502. on RC.CAPACITY_ID = OO.CAPACITY_ID
  503. left join TMSTRUCK_WEIGHT_RESULT TWR
  504. on TWR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
  505. left join TMSTRUCK_UNLOAD_RESULT TUR
  506. on TUR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
  507. left join OMSTRUCK_ORDER_MATERIAL OOM
  508. on OOM.ORDER_ID = OO.ORDER_ID
  509. left join RMS_MATERIAL RM
  510. on OOM.MATERIAL_ID = RM.MATERIAL_ID
  511. left join tmstruck_quality_result tqr
  512. on tqr.total_result_id = ttr.result_total_id
  513. left join RMS_WAREHOUSE RW
  514. on TUR.RESULT_UNLOAD_PLACE_ID = RW.WAREHOUSE_ID
  515. where TRR.STATUS = 1
  516. and OO.ORDER_TYPE = #{orderTypee}
  517. )
  518. <where>
  519. <if test="materialName != null">
  520. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  521. "materialName" like '%${item}%'
  522. </foreach>
  523. </if>
  524. <if test="purchaseOrderNo != null">
  525. and
  526. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  527. "purchaseOrderNo" like '%${item}%'
  528. </foreach>
  529. </if>
  530. <if test="orderNumber != null">
  531. and
  532. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  533. "orderNumber" like '%${item}%'
  534. </foreach>
  535. </if>
  536. <if test="capacityNumber != null">
  537. and
  538. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  539. "capacityNumber" like '%${item}%'
  540. </foreach>
  541. </if>
  542. <if test="resultForeignShipName != null">
  543. and
  544. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  545. "resultForeignShipName" like '%${item}%'
  546. </foreach>
  547. </if>
  548. <if test="unloadStatus != null">
  549. and
  550. <foreach collection="unloadStatus" item="item" open="(" separator="or" close=")">
  551. "unloadStatus" like '%${item}%'
  552. </foreach>
  553. </if>
  554. <if test="resultNetWeight != null">
  555. and
  556. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  557. "resultNetWeight" like '%${item}%'
  558. </foreach>
  559. </if>
  560. <if test="issampling != null">
  561. and
  562. <foreach collection="issampling" item="item" open="(" separator="or" close=")">
  563. "issampling" like '%${item}%'
  564. </foreach>
  565. </if>
  566. <if test="insertUsername != null">
  567. and
  568. <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
  569. "insertUsername" like '%${item}%'
  570. </foreach>
  571. </if>
  572. <if test="insertTime != null">
  573. and
  574. <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
  575. "insertTime" like '%${item}%'
  576. </foreach>
  577. </if>
  578. </where>
  579. <include refid="orderBy"></include>
  580. </select>
  581. </mapper>