WmspOutboundResultMapper.xml 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149
  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.WmspOutboundResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.WmspOutboundResult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="RESULT_NUMBER" jdbcType="VARCHAR" property="resultNumber" />
  7. <result column="BILL_LADING_ID" jdbcType="DECIMAL" property="billLadingId" />
  8. <result column="RESULT_OUTBOUND_TYPE" jdbcType="VARCHAR" property="resultOutboundType" />
  9. <result column="RESULT_STATUS" jdbcType="DECIMAL" property="resultStatus" />
  10. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  11. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  12. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  13. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  14. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  15. <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
  16. <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
  17. </resultMap>
  18. <sql id="columns">
  19. RESULT_ID, RESULT_NUMBER, BILL_LADING_ID, RESULT_OUTBOUND_TYPE, RESULT_STATUS, INSERT_USERNAME,
  20. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, MATERIAL_ID, DELETED
  21. </sql>
  22. <sql id="columns_alias">
  23. t.RESULT_ID, t.RESULT_NUMBER, t.BILL_LADING_ID, t.RESULT_OUTBOUND_TYPE, t.RESULT_STATUS,
  24. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
  25. t.MATERIAL_ID, t.DELETED
  26. </sql>
  27. <sql id="select">
  28. SELECT <include refid="columns"/> FROM WMSP_OUTBOUND_RESULT
  29. </sql>
  30. <sql id="select_alias">
  31. SELECT <include refid="columns_alias"/> FROM WMSP_OUTBOUND_RESULT t
  32. </sql>
  33. <sql id="where">
  34. <where>
  35. <if test="resultId != null">
  36. and RESULT_ID = #{resultId}
  37. </if>
  38. <if test="resultNumber != null and resultNumber != ''">
  39. and RESULT_NUMBER = #{resultNumber}
  40. </if>
  41. <if test="billLadingId != null">
  42. and BILL_LADING_ID = #{billLadingId}
  43. </if>
  44. <if test="resultOutboundType != null and resultOutboundType != ''">
  45. and RESULT_OUTBOUND_TYPE = #{resultOutboundType}
  46. </if>
  47. <if test="resultStatus != null">
  48. and RESULT_STATUS = #{resultStatus}
  49. </if>
  50. <if test="insertUsername != null and insertUsername != ''">
  51. and INSERT_USERNAME = #{insertUsername}
  52. </if>
  53. <if test="insertTime != null">
  54. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  55. </if>
  56. <if test="updateUsername != null and updateUsername != ''">
  57. and UPDATE_USERNAME = #{updateUsername}
  58. </if>
  59. <if test="updateTime != null">
  60. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  61. </if>
  62. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  63. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  64. </if>
  65. <if test="materialId != null">
  66. and MATERIAL_ID = #{materialId}
  67. </if>
  68. <if test="deleted != null">
  69. and DELETED = #{deleted}
  70. </if>
  71. </where>
  72. </sql>
  73. <sql id="whereLike">
  74. <where>
  75. <if test="resultId != null">
  76. and RESULT_ID = #{resultId}
  77. </if>
  78. <if test="resultNumber != null and resultNumber != ''">
  79. and RESULT_NUMBER LIKE '%${resultNumber}%'
  80. </if>
  81. <if test="billLadingId != null">
  82. and BILL_LADING_ID = #{billLadingId}
  83. </if>
  84. <if test="resultOutboundType != null and resultOutboundType != ''">
  85. and RESULT_OUTBOUND_TYPE LIKE '%${resultOutboundType}%'
  86. </if>
  87. <if test="resultStatus != null">
  88. and RESULT_STATUS = #{resultStatus}
  89. </if>
  90. <if test="insertUsername != null and insertUsername != ''">
  91. and INSERT_USERNAME LIKE '%${insertUsername}%'
  92. </if>
  93. <if test="insertTime != null">
  94. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  95. </if>
  96. <if test="updateUsername != null and updateUsername != ''">
  97. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  98. </if>
  99. <if test="updateTime != null">
  100. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  101. </if>
  102. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  103. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  104. </if>
  105. <if test="materialId != null">
  106. and MATERIAL_ID = #{materialId}
  107. </if>
  108. <if test="deleted != null">
  109. and DELETED = #{deleted}
  110. </if>
  111. </where>
  112. </sql>
  113. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  114. delete from WMSP_OUTBOUND_RESULT
  115. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  116. </delete>
  117. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  118. delete from WMSP_OUTBOUND_RESULT
  119. where 1!=1
  120. <if test="resultNumber != null and resultNumber != ''">
  121. or RESULT_NUMBER = #{resultNumber}
  122. </if>
  123. <if test="billLadingId != null">
  124. or BILL_LADING_ID = #{billLadingId}
  125. </if>
  126. <if test="resultOutboundType != null and resultOutboundType != ''">
  127. or RESULT_OUTBOUND_TYPE = #{resultOutboundType}
  128. </if>
  129. <if test="resultStatus != null">
  130. or RESULT_STATUS = #{resultStatus}
  131. </if>
  132. <if test="insertUsername != null and insertUsername != ''">
  133. or INSERT_USERNAME = #{insertUsername}
  134. </if>
  135. <if test="insertTime != null">
  136. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  137. </if>
  138. <if test="updateUsername != null and updateUsername != ''">
  139. or UPDATE_USERNAME = #{updateUsername}
  140. </if>
  141. <if test="updateTime != null">
  142. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  143. </if>
  144. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  145. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  146. </if>
  147. <if test="materialId != null">
  148. or MATERIAL_ID = #{materialId}
  149. </if>
  150. <if test="deleted != null">
  151. or DELETED = #{deleted}
  152. </if>
  153. </delete>
  154. <insert id="insert" parameterType="com.steerinfo.dil.model.WmspOutboundResult">
  155. insert into WMSP_OUTBOUND_RESULT (RESULT_ID, RESULT_NUMBER, BILL_LADING_ID,
  156. RESULT_OUTBOUND_TYPE, RESULT_STATUS, INSERT_USERNAME,
  157. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  158. INSERT_UPDATE_REMARK, MATERIAL_ID, DELETED
  159. )
  160. values (#{resultId,jdbcType=DECIMAL}, #{resultNumber,jdbcType=VARCHAR}, #{billLadingId,jdbcType=DECIMAL},
  161. #{resultOutboundType,jdbcType=VARCHAR}, #{resultStatus,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR},
  162. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  163. #{insertUpdateRemark,jdbcType=VARCHAR}, #{materialId,jdbcType=DECIMAL}, #{deleted,jdbcType=DECIMAL}
  164. )
  165. </insert>
  166. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.WmspOutboundResult">
  167. insert into WMSP_OUTBOUND_RESULT
  168. <trim prefix="(" suffix=")" suffixOverrides=",">
  169. <if test="resultId != null">
  170. RESULT_ID,
  171. </if>
  172. <if test="resultNumber != null">
  173. RESULT_NUMBER,
  174. </if>
  175. <if test="billLadingId != null">
  176. BILL_LADING_ID,
  177. </if>
  178. <if test="resultOutboundType != null">
  179. RESULT_OUTBOUND_TYPE,
  180. </if>
  181. <if test="resultStatus != null">
  182. RESULT_STATUS,
  183. </if>
  184. <if test="insertUsername != null">
  185. INSERT_USERNAME,
  186. </if>
  187. <if test="insertTime != null">
  188. INSERT_TIME,
  189. </if>
  190. <if test="updateUsername != null">
  191. UPDATE_USERNAME,
  192. </if>
  193. <if test="updateTime != null">
  194. UPDATE_TIME,
  195. </if>
  196. <if test="insertUpdateRemark != null">
  197. INSERT_UPDATE_REMARK,
  198. </if>
  199. <if test="materialId != null">
  200. MATERIAL_ID,
  201. </if>
  202. <if test="deleted != null">
  203. DELETED,
  204. </if>
  205. </trim>
  206. <trim prefix="values (" suffix=")" suffixOverrides=",">
  207. <if test="resultId != null">
  208. #{resultId,jdbcType=DECIMAL},
  209. </if>
  210. <if test="resultNumber != null">
  211. #{resultNumber,jdbcType=VARCHAR},
  212. </if>
  213. <if test="billLadingId != null">
  214. #{billLadingId,jdbcType=DECIMAL},
  215. </if>
  216. <if test="resultOutboundType != null">
  217. #{resultOutboundType,jdbcType=VARCHAR},
  218. </if>
  219. <if test="resultStatus != null">
  220. #{resultStatus,jdbcType=DECIMAL},
  221. </if>
  222. <if test="insertUsername != null">
  223. #{insertUsername,jdbcType=VARCHAR},
  224. </if>
  225. <if test="insertTime != null">
  226. #{insertTime,jdbcType=TIMESTAMP},
  227. </if>
  228. <if test="updateUsername != null">
  229. #{updateUsername,jdbcType=VARCHAR},
  230. </if>
  231. <if test="updateTime != null">
  232. #{updateTime,jdbcType=TIMESTAMP},
  233. </if>
  234. <if test="insertUpdateRemark != null">
  235. #{insertUpdateRemark,jdbcType=VARCHAR},
  236. </if>
  237. <if test="materialId != null">
  238. #{materialId,jdbcType=DECIMAL},
  239. </if>
  240. <if test="deleted != null">
  241. #{deleted,jdbcType=DECIMAL},
  242. </if>
  243. </trim>
  244. </insert>
  245. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.WmspOutboundResult">
  246. update WMSP_OUTBOUND_RESULT
  247. set RESULT_NUMBER = #{resultNumber,jdbcType=VARCHAR},
  248. BILL_LADING_ID = #{billLadingId,jdbcType=DECIMAL},
  249. RESULT_OUTBOUND_TYPE = #{resultOutboundType,jdbcType=VARCHAR},
  250. RESULT_STATUS = #{resultStatus,jdbcType=DECIMAL},
  251. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  252. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  253. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  254. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  255. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  256. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  257. DELETED = #{deleted,jdbcType=DECIMAL}
  258. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  259. </update>
  260. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.WmspOutboundResult">
  261. update WMSP_OUTBOUND_RESULT
  262. <set>
  263. <if test="resultNumber != null">
  264. RESULT_NUMBER = #{resultNumber,jdbcType=VARCHAR},
  265. </if>
  266. <if test="billLadingId != null">
  267. BILL_LADING_ID = #{billLadingId,jdbcType=DECIMAL},
  268. </if>
  269. <if test="resultOutboundType != null">
  270. RESULT_OUTBOUND_TYPE = #{resultOutboundType,jdbcType=VARCHAR},
  271. </if>
  272. <if test="resultStatus != null">
  273. RESULT_STATUS = #{resultStatus,jdbcType=DECIMAL},
  274. </if>
  275. <if test="insertUsername != null">
  276. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  277. </if>
  278. <if test="insertTime != null">
  279. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  280. </if>
  281. <if test="updateUsername != null">
  282. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  283. </if>
  284. <if test="updateTime != null">
  285. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  286. </if>
  287. <if test="insertUpdateRemark != null">
  288. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  289. </if>
  290. <if test="materialId != null">
  291. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  292. </if>
  293. <if test="deleted != null">
  294. DELETED = #{deleted,jdbcType=DECIMAL},
  295. </if>
  296. </set>
  297. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  298. </update>
  299. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  300. <include refid="select"/>
  301. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  302. </select>
  303. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  304. <include refid="select"/>
  305. <include refid="where"/>
  306. </select>
  307. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  308. <include refid="select"/>
  309. <include refid="whereLike"/>
  310. </select>
  311. <insert id="batchInsert" parameterType="java.util.List">
  312. insert into WMSP_OUTBOUND_RESULT
  313. (RESULT_ID,
  314. RESULT_NUMBER, BILL_LADING_ID, RESULT_OUTBOUND_TYPE,
  315. RESULT_STATUS, INSERT_USERNAME,
  316. INSERT_TIME, UPDATE_USERNAME,
  317. UPDATE_TIME, INSERT_UPDATE_REMARK,
  318. MATERIAL_ID, DELETED)
  319. ( <foreach collection="list" item="item" separator="union all">
  320. select
  321. #{item.resultId,jdbcType=DECIMAL},
  322. #{item.resultNumber,jdbcType=VARCHAR}, #{item.billLadingId,jdbcType=DECIMAL}, #{item.resultOutboundType,jdbcType=VARCHAR},
  323. #{item.resultStatus,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR},
  324. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  325. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  326. #{item.materialId,jdbcType=DECIMAL}, #{item.deleted,jdbcType=DECIMAL} from dual
  327. </foreach> )
  328. </insert>
  329. <update id="batchUpdate" parameterType="java.util.List">
  330. update WMSP_OUTBOUND_RESULT
  331. set
  332. RESULT_ID=
  333. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  334. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  335. </foreach>
  336. ,RESULT_NUMBER=
  337. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  338. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultNumber,jdbcType=VARCHAR}
  339. </foreach>
  340. ,BILL_LADING_ID=
  341. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  342. when #{item.resultId,jdbcType=DECIMAL} then #{item.billLadingId,jdbcType=DECIMAL}
  343. </foreach>
  344. ,RESULT_OUTBOUND_TYPE=
  345. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  346. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultOutboundType,jdbcType=VARCHAR}
  347. </foreach>
  348. ,RESULT_STATUS=
  349. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  350. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultStatus,jdbcType=DECIMAL}
  351. </foreach>
  352. ,INSERT_USERNAME=
  353. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  354. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  355. </foreach>
  356. ,INSERT_TIME=
  357. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  358. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  359. </foreach>
  360. ,UPDATE_USERNAME=
  361. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  362. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  363. </foreach>
  364. ,UPDATE_TIME=
  365. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  366. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  367. </foreach>
  368. ,INSERT_UPDATE_REMARK=
  369. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  370. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  371. </foreach>
  372. ,MATERIAL_ID=
  373. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  374. when #{item.resultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
  375. </foreach>
  376. ,DELETED=
  377. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  378. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  379. </foreach>
  380. where RESULT_ID in
  381. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  382. #{item.resultId,jdbcType=DECIMAL}
  383. </foreach>
  384. </update>
  385. <delete id="batchDelete" parameterType="java.util.List">
  386. delete from WMSP_OUTBOUND_RESULT
  387. where RESULT_ID in
  388. <foreach collection="list" item="id" open="(" close=")" separator=",">
  389. #{id}
  390. </foreach>
  391. </delete>
  392. <!-- 友情提示!!!-->
  393. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  394. <select id="selectResultNumber" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  395. SELECT
  396. ckd.RESULT_NUMBER "resultNumber",
  397. ysdd.ORDER_NUMBER "orderNumber1",
  398. ylxx.CAPACITY_NUMBER "capacityNumber",
  399. (
  400. CASE
  401. WHEN ysdd.ORDER_TYPE = 1 THEN
  402. (
  403. SELECT
  404. kh.CONSIGNEE_COMPANY_NAME
  405. FROM
  406. AMS_SALE_ORDER xsdd
  407. LEFT JOIN RMS_CONSIGNEE kh ON xsdd.RECEIVE_ID = kh.CONSIGNEE_ID
  408. WHERE
  409. ysdd.ORDER_PLAN_ID = xsdd.SALE_ORDER_ID
  410. )
  411. WHEN ysdd.ORDER_TYPE = 2 THEN
  412. (
  413. SELECT
  414. kh.CONSIGNEE_COMPANY_NAME
  415. FROM
  416. AMS_RAIL_OFFSET_DAYPLAN fyjh
  417. LEFT JOIN RMS_CONSIGNEE kh ON fyjh.RECEIVING_UNIT_ID = kh.CONSIGNEE_ID
  418. WHERE
  419. ysdd.ORDER_PLAN_ID = fyjh.DAYPLAN_ID
  420. )
  421. END
  422. ) consigneeCompanyName,
  423. ck.WAREHOUSE_NAME "warehouseName",
  424. dw.STACKING_NO "stackingNo",
  425. wg.GRID_GRADATION_NUMBER "gridGradationNumber",
  426. wz.MATERIAL_CODE "materialCode",
  427. wz.MATERIAL_NAME "materialName",
  428. wz.MATERIAL_SPECIFICATION || '(' || wz.MATERIAL_MODEL || ')' "specification",
  429. gcwz.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
  430. gcwz.MATERIAL_SINGLE_BUNDLE_WEIGHT "materialSingleBundleWeight",
  431. gcwz.MATERIAL_FURNACE_NUMBER "materialFurnaceNumber",
  432. jldw.UNIT_OF_MEASURE_NAME "unitOfMeasureName",
  433. ckd.INSERT_USERNAME "insertUsername",
  434. ckd.INSERT_TIME "insertTime",
  435. ckd.RESULT_OUTBOUND_TYPE "resultOutboundType",
  436. CASE
  437. WHEN gcwz.MATERIAL_QUALIFIED = 0 THEN
  438. '不合格且判废'
  439. WHEN gcwz.MATERIAL_QUALIFIED = 1 THEN
  440. '不合格且降级'
  441. WHEN gcwz.MATERIAL_QUALIFIED = 2 THEN
  442. '不合格且不降级且卖本地经销商'
  443. WHEN gcwz.MATERIAL_QUALIFIED = 3 THEN
  444. '合格'
  445. END MATERIAL_QUALIFIED,
  446. ckd.INSERT_UPDATE_REMARK "insertUpdateRemark"
  447. FROM WMSP_OUTBOUND_RESULT ckd
  448. LEFT JOIN OMSTRUCK_ORDER ysdd ON ckd.BILL_LADING_ID = ysdd.ORDER_ID
  449. LEFT JOIN RMS_CAPACITY ylxx ON ysdd.CAPACITY_ID = ylxx.CAPACITY_ID
  450. LEFT JOIN OMSTRUCK_ORDER_MATERIAL yswz ON ysdd.ORDER_ID = yswz.ORDER_ID
  451. LEFT JOIN WMSP_GRID_MATERIAL wzwg ON yswz.MATERIAL_ID = wzwg.MATERIAL_ID
  452. LEFT JOIN RMS_PWAREHOUSE_GRID wg ON wzwg.GRID_ID = wg.GRID_ID
  453. LEFT JOIN RMS_WAREHOUSE ck ON wg.WAREHOUSE_ID = ck.WAREHOUSE_ID
  454. LEFT JOIN RMS_STACKING dw ON wg.STACKING_ID = dw.STACKING_ID
  455. LEFT JOIN RMS_MATERIAL_STEEL gcwz ON wzwg.MATERIAL_ID = gcwz.MATERIAL_STEEL_ID
  456. LEFT JOIN RMS_MATERIAL wz ON gcwz.MATERIAL_ID = wz.MATERIAL_ID
  457. LEFT JOIN RMS_UNIT_OF_MEASURE jldw ON wz.UNIT_OF_MEASURE_ID = jldw.UNIT_OF_MEASURE_ID
  458. <where>
  459. <if test="resultNumber != null">
  460. and
  461. <foreach collection="resultNumber" item="item" open="(" separator="or" close=")">
  462. "resultNumber" like '%${item}%'
  463. </foreach>
  464. </if>
  465. <if test="orderNumber1 != null">
  466. and
  467. <foreach collection="orderNumber1" item="item" open="(" separator="or" close=")">
  468. "orderNumber1" like '%${item}%'
  469. </foreach>
  470. </if>
  471. <if test="capacityNumber != null">
  472. and
  473. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  474. "capacityNumber" like '%${item}%'
  475. </foreach>
  476. </if>
  477. <if test="consigneeCompanyName != null">
  478. and
  479. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  480. "consigneeCompanyName" like '%${item}%'
  481. </foreach>
  482. </if>
  483. <if test="warehouseName != null">
  484. and
  485. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  486. "warehouseName" like '%${item}%'
  487. </foreach>
  488. </if>
  489. <if test="stackingNo != null">
  490. and
  491. <foreach collection="stackingNo" item="item" open="(" separator="or" close=")">
  492. "stackingNo" like '%${item}%'
  493. </foreach>
  494. </if>
  495. <if test="gridGradationNumber != null">
  496. and
  497. <foreach collection="gridGradationNumber" item="item" open="(" separator="or" close=")">
  498. "gridGradationNumber" like '%${item}%'
  499. </foreach>
  500. </if>
  501. <if test="materialCode != null">
  502. and
  503. <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
  504. "materialCode" like '%${item}%'
  505. </foreach>
  506. </if>
  507. <if test="materialName != null">
  508. and
  509. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  510. "materialName" like '%${item}%'
  511. </foreach>
  512. </if>
  513. <if test="specification != null">
  514. and
  515. <foreach collection="specification" item="item" open="(" separator="or" close=")">
  516. "specification" like '%${item}%'
  517. </foreach>
  518. </if>
  519. <if test="materialTheoreticalWeight != null">
  520. and
  521. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  522. "materialTheoreticalWeight" like '%${item}%'
  523. </foreach>
  524. </if>
  525. <if test="materialSingleBundleWeight != null">
  526. and
  527. <foreach collection="materialSingleBundleWeight" item="item" open="(" separator="or" close=")">
  528. "materialSingleBundleWeight" like '%${item}%'
  529. </foreach>
  530. </if>
  531. <if test="materialFurnaceNumber != null">
  532. and
  533. <foreach collection="materialFurnaceNumber" item="item" open="(" separator="or" close=")">
  534. "materialFurnaceNumber" like '%${item}%'
  535. </foreach>
  536. </if>
  537. <if test="unitOfMeasureName != null">
  538. and
  539. <foreach collection="unitOfMeasureName" item="item" open="(" separator="or" close=")">
  540. "unitOfMeasureName" like '%${item}%'
  541. </foreach>
  542. </if>
  543. <if test="insertUsername != null">
  544. and
  545. <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
  546. "insertUsername" like '%${item}%'
  547. </foreach>
  548. </if>
  549. <if test="insertTime != null">
  550. and
  551. <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
  552. "insertTime" like '%${item}%'
  553. </foreach>
  554. </if>
  555. <if test="resultOutboundType != null">
  556. and
  557. <foreach collection="resultOutboundType" item="item" open="(" separator="or" close=")">
  558. "resultOutboundType" like '%${item}%'
  559. </foreach>
  560. </if>
  561. </where>
  562. ORDER BY ckd.RESULT_STATUS
  563. </select>
  564. <select id="selectOutResult" resultType="java.util.Map">
  565. SELECT
  566. DISTINCT
  567. ckd.RESULT_NUMBER "resultNumber",
  568. ysdd.ORDER_NUMBER "orderNumber1",
  569. ylxx.CAPACITY_NUMBER "capacityNumber",
  570. (
  571. CASE
  572. WHEN ysdd.ORDER_TYPE = 1 THEN
  573. (
  574. SELECT
  575. kh.CONSIGNEE_COMPANY_NAME
  576. FROM
  577. AMS_SALE_ORDER xsdd
  578. LEFT JOIN RMS_CONSIGNEE kh ON xsdd.RECEIVE_ID = kh.CONSIGNEE_ID
  579. WHERE
  580. ysdd.ORDER_PLAN_ID = xsdd.SALE_ORDER_ID
  581. )
  582. WHEN ysdd.ORDER_TYPE = 2 THEN
  583. (
  584. SELECT
  585. kh.CONSIGNEE_COMPANY_NAME
  586. FROM
  587. AMS_RAIL_OFFSET_DAYPLAN fyjh
  588. LEFT JOIN RMS_CONSIGNEE kh ON fyjh.RECEIVING_UNIT_ID = kh.CONSIGNEE_ID
  589. WHERE
  590. ysdd.ORDER_PLAN_ID = fyjh.DAYPLAN_ID
  591. )
  592. END
  593. ) consigneeCompanyName,
  594. ck.WAREHOUSE_NAME "warehouseName",
  595. dw.STACKING_NO "stackingNo",
  596. wg.GRID_GRADATION_NUMBER "gridGradationNumber",
  597. wz.MATERIAL_CODE "materialCode",
  598. wz.MATERIAL_NAME "materialName",
  599. wz.MATERIAL_SPECIFICATION || '(' || wz.MATERIAL_MODEL || ')' "specification",
  600. gcwz.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
  601. gcwz.MATERIAL_SINGLE_BUNDLE_WEIGHT "materialSingleBundleWeight",
  602. gcwz.MATERIAL_FURNACE_NUMBER "materialFurnaceNumber",
  603. jldw.UNIT_OF_MEASURE_NAME "unitOfMeasureName",
  604. ckd.INSERT_USERNAME "insertUsername",
  605. ckd.INSERT_TIME "insertTime",
  606. ckd.RESULT_OUTBOUND_TYPE "resultOutboundType",
  607. CASE
  608. WHEN gcwz.MATERIAL_QUALIFIED = 0 THEN
  609. '不合格且判废'
  610. WHEN gcwz.MATERIAL_QUALIFIED = 1 THEN
  611. '不合格且降级'
  612. WHEN gcwz.MATERIAL_QUALIFIED = 2 THEN
  613. '不合格且不降级且卖本地经销商'
  614. WHEN gcwz.MATERIAL_QUALIFIED = 3 THEN
  615. '合格'
  616. END MATERIAL_QUALIFIED,
  617. ckd.INSERT_UPDATE_REMARK "insertUpdateRemark"
  618. FROM WMSP_OUTBOUND_RESULT ckd
  619. LEFT JOIN OMSTRUCK_ORDER ysdd
  620. ON ckd.BILL_LADING_ID = ysdd.ORDER_ID
  621. LEFT JOIN RMS_CAPACITY ylxx
  622. ON ysdd.CAPACITY_ID = ylxx.CAPACITY_ID
  623. LEFT JOIN OMSTRUCK_ORDER_MATERIAL yswz
  624. ON ysdd.ORDER_ID = yswz.ORDER_ID
  625. LEFT JOIN WMSP_OUTBOUND_SCAN_RESULT wosr
  626. ON wosr.OUTBOUND_RESULT_ID = ckd.RESULT_ID
  627. LEFT JOIN WMSP_INBOUND_SCAN_RESULT sisr
  628. ON wosr.INBOUND_RESULT_ID = sisr.INBOUND_RESULT_ID
  629. LEFT JOIN WMSP_GRID_MATERIAL wzwg
  630. ON sisr.MATERIAL_ID = wzwg.MATERIAL_ID
  631. LEFT JOIN RMS_PWAREHOUSE_GRID wg
  632. ON wzwg.GRID_ID = wg.GRID_ID
  633. LEFT JOIN RMS_WAREHOUSE ck
  634. ON wg.WAREHOUSE_ID = ck.WAREHOUSE_ID
  635. LEFT JOIN RMS_STACKING dw
  636. ON wg.STACKING_ID = dw.STACKING_ID
  637. LEFT JOIN RMS_MATERIAL_STEEL gcwz
  638. ON wzwg.MATERIAL_ID = gcwz.MATERIAL_STEEL_ID
  639. LEFT JOIN RMS_MATERIAL wz
  640. ON gcwz.MATERIAL_ID = wz.MATERIAL_ID
  641. LEFT JOIN RMS_UNIT_OF_MEASURE jldw
  642. ON wz.UNIT_OF_MEASURE_ID = jldw.UNIT_OF_MEASURE_ID
  643. WHERE wg.WAREHOUSE_ID = #{warehouseId}
  644. <if test="startTime != null and endTime !=null">
  645. and ckd.insert_time between to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
  646. </if>
  647. <if test="oneDate != null">
  648. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ckd.insert_time
  649. </if>
  650. <where>
  651. <if test="resultNumber != null">
  652. and
  653. <foreach collection="resultNumber" item="item" open="(" separator="or" close=")">
  654. "resultNumber" like '%${item}%'
  655. </foreach>
  656. </if>
  657. <if test="orderNumber1 != null">
  658. and
  659. <foreach collection="orderNumber1" item="item" open="(" separator="or" close=")">
  660. "orderNumber1" like '%${item}%'
  661. </foreach>
  662. </if>
  663. <if test="capacityNumber != null">
  664. and
  665. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  666. "capacityNumber" like '%${item}%'
  667. </foreach>
  668. </if>
  669. <if test="consigneeCompanyName != null">
  670. and
  671. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  672. "consigneeCompanyName" like '%${item}%'
  673. </foreach>
  674. </if>
  675. <if test="warehouseName != null">
  676. and
  677. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  678. "warehouseName" like '%${item}%'
  679. </foreach>
  680. </if>
  681. <if test="stackingNo != null">
  682. and
  683. <foreach collection="stackingNo" item="item" open="(" separator="or" close=")">
  684. "stackingNo" like '%${item}%'
  685. </foreach>
  686. </if>
  687. <if test="gridGradationNumber != null">
  688. and
  689. <foreach collection="gridGradationNumber" item="item" open="(" separator="or" close=")">
  690. "gridGradationNumber" like '%${item}%'
  691. </foreach>
  692. </if>
  693. <if test="materialCode != null">
  694. and
  695. <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
  696. "materialCode" like '%${item}%'
  697. </foreach>
  698. </if>
  699. <if test="materialName != null">
  700. and
  701. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  702. "materialName" like '%${item}%'
  703. </foreach>
  704. </if>
  705. <if test="specification != null">
  706. and
  707. <foreach collection="specification" item="item" open="(" separator="or" close=")">
  708. "specification" like '%${item}%'
  709. </foreach>
  710. </if>
  711. <if test="materialTheoreticalWeight != null">
  712. and
  713. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  714. "materialTheoreticalWeight" like '%${item}%'
  715. </foreach>
  716. </if>
  717. <if test="materialSingleBundleWeight != null">
  718. and
  719. <foreach collection="materialSingleBundleWeight" item="item" open="(" separator="or" close=")">
  720. "materialSingleBundleWeight" like '%${item}%'
  721. </foreach>
  722. </if>
  723. <if test="materialFurnaceNumber != null">
  724. and
  725. <foreach collection="materialFurnaceNumber" item="item" open="(" separator="or" close=")">
  726. "materialFurnaceNumber" like '%${item}%'
  727. </foreach>
  728. </if>
  729. <if test="unitOfMeasureName != null">
  730. and
  731. <foreach collection="unitOfMeasureName" item="item" open="(" separator="or" close=")">
  732. "unitOfMeasureName" like '%${item}%'
  733. </foreach>
  734. </if>
  735. <if test="insertUsername != null">
  736. and
  737. <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
  738. "insertUsername" like '%${item}%'
  739. </foreach>
  740. </if>
  741. <if test="insertTime != null">
  742. and
  743. <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
  744. "insertTime" like '%${item}%'
  745. </foreach>
  746. </if>
  747. <if test="resultOutboundType != null">
  748. and
  749. <foreach collection="resultOutboundType" item="item" open="(" separator="or" close=")">
  750. "resultOutboundType" like '%${item}%'
  751. </foreach>
  752. </if>
  753. </where>
  754. </select>
  755. <!-- 根据运输订单号获取运输订单id-->
  756. <select id="getOrder" parameterType="String" resultType="java.util.Map">
  757. SELECT
  758. ORDER_ID "orderId",
  759. ORDER_TYPE "orderType"
  760. FROM
  761. OMSTRUCK_ORDER
  762. WHERE
  763. ORDER_NUMBER = #{orderNumber}
  764. </select>
  765. <!-- 根据运输订单主键id查询出库单详情-->
  766. <select id="getwmspOutboundResultdetails" parameterType="int" resultType="java.util.LinkedHashMap">
  767. SELECT
  768. ckd.RESULT_ID "RESULT_ID",
  769. qydd.ORDER_NUMBER "ORDER_NUMBER",
  770. ckd.RESULT_NUMBER "RESULT_NUMBER",
  771. ckd.RESULT_OUTBOUND_TYPE "OUTBOUND_TYPE",
  772. yl.CAPACITY_NUMBER "CAPACITY_NUMBER",
  773. ck.WAREHOUSE_NAME "WAREHOUSE_NAME",
  774. yswz.ORDER_MATERIAL_WEIGHT "MATERIAL_WEIGHT",
  775. yswz.ORDER_MATERIAL_NUMBER "MATERIAL_NUMBER",
  776. (
  777. CASE
  778. WHEN qydd.ORDER_TYPE = 1 THEN
  779. (
  780. SELECT
  781. kh.CONSIGNEE_COMPANY_NAME
  782. FROM
  783. AMS_SALE_ORDER xsdd
  784. LEFT JOIN RMS_CONSIGNEE kh ON xsdd.RECEIVE_ID = kh.CONSIGNEE_ID
  785. WHERE
  786. qydd.ORDER_PLAN_ID = xsdd.SALE_ORDER_ID
  787. )
  788. WHEN qydd.ORDER_TYPE = 2 THEN
  789. (
  790. SELECT
  791. kh.CONSIGNEE_COMPANY_NAME
  792. FROM
  793. AMS_RAIL_OFFSET_DAYPLAN fyjh
  794. LEFT JOIN RMS_CONSIGNEE kh ON fyjh.RECEIVING_UNIT_ID = kh.CONSIGNEE_ID
  795. WHERE
  796. qydd.ORDER_PLAN_ID = fyjh.DAYPLAN_ID
  797. )
  798. END
  799. ) CONSIGNEE_COMPANY_NAME,
  800. wz.MATERIAL_NAME "MATERIAL_NAME",
  801. wz.MATERIAL_SPECIFICATION || '(' || wz.MATERIAL_MODEL || ')' "SPECIFICATION",
  802. gcwz.MATERIAL_THEORETICAL_WEIGHT "THEORETICAL_WEIGHT",
  803. wz.MATERIAL_CODE "MATERIAL_CODE"
  804. FROM
  805. OMSTRUCK_ORDER qydd
  806. LEFT JOIN WMSP_OUTBOUND_RESULT ckd ON qydd.ORDER_ID = ckd.BILL_LADING_ID
  807. LEFT JOIN RMS_CAPACITY yl ON qydd.CAPACITY_ID = yl.CAPACITY_ID
  808. LEFT JOIN RMS_LINE yslx ON qydd.LINE_ID = yslx.LINE_ID
  809. LEFT JOIN RMS_LINE_SEGEMNT yslxz ON yslx.LINE_ID = yslxz.LINE_ID
  810. AND qydd.ORDER_LINE_SEQUENCE = yslxz.SEGMENT_SQE
  811. LEFT JOIN RMS_WAREHOUSE ck ON yslxz.SEGMENT_END_NODE_ID = ck.WAREHOUSE_ID
  812. LEFT JOIN OMSTRUCK_ORDER_MATERIAL yswz ON qydd.ORDER_ID = yswz.ORDER_ID
  813. LEFT JOIN RMS_MATERIAL_STEEL gcwz ON yswz.MATERIAL_ID = gcwz.MATERIAL_STEEL_ID
  814. LEFT JOIN RMS_MATERIAL wz ON gcwz.MATERIAL_ID = wz.MATERIAL_ID
  815. WHERE
  816. qydd.ORDER_ID = #{orderId}
  817. AND ckd.RESULT_STATUS = 0
  818. </select>
  819. <!-- 根据运输订单主键id查询出库单数量-->
  820. <select id="getcountOrderNumber" parameterType="int" resultType="int">
  821. SELECT count(*)
  822. FROM WMSP_OUTBOUND_RESULT ckd
  823. WHERE ckd.BILL_LADING_ID = #{orderId}
  824. </select>
  825. <!-- 根据出库单id查询物资编码-->
  826. <select id="getmaterialCode" parameterType="int" resultType="String">
  827. SELECT wz.MATERIAL_CODE "MATERIAL_CODE"
  828. FROM WMSP_OUTBOUND_RESULT ckd
  829. LEFT JOIN OMSTRUCK_ORDER qydd
  830. ON ckd.BILL_LADING_ID = qydd.ORDER_ID
  831. LEFT JOIN OMSTRUCK_ORDER_MATERIAL qywz
  832. ON qydd.ORDER_ID = qywz.ORDER_ID
  833. LEFT JOIN RMS_MATERIAL wz
  834. ON qywz.MATERIAL_ID = wz.MATERIAL_ID
  835. WHERE ckd.RESULT_ID = #{resultId}
  836. </select>
  837. <select id="selectOutbountResultByOrderNumber" parameterType="java.lang.String" resultType="java.util.LinkedHashMap">
  838. select RM.MATERIAL_CODE "code",
  839. RM.MATERIAL_NAME "name",
  840. RM.MATERIAL_SPECIFICATION || '(' || RM.MATERIAL_MODEL || ')' "specification",
  841. WIMR.RESULT_NO "No",
  842. RS.STACKING_NO "stackingNo",
  843. RW.WAREHOUSE_NAME "warehouseName",
  844. RC.CAPACITY_NUMBER "capacityNumber",
  845. RPG.GRID_GRADATION_NUMBER "gradationNumber",
  846. OOM.ORDER_MATERIAL_NUMBER "materialNumber"
  847. from OMSTRUCK_ORDER OO
  848. left join OMSTRUCK_ORDER_MATERIAL OOM
  849. on OO.ORDER_ID=OOM.ORDER_ID
  850. left join RMS_MATERIAL_STEEL RMS
  851. on RMS.MATERIAL_STEEL_ID=OOM.MATERIAL_ID
  852. left join WMSP_GRID_MATERIAL WGM
  853. on WGM.MATERIAL_ID=RMS.MATERIAL_STEEL_ID
  854. left join RMS_MATERIAL RM
  855. on RM.MATERIAL_ID=RMS.MATERIAL_STEEL_ID
  856. left join RMS_PWAREHOUSE_GRID RPG
  857. on RPG.GRID_ID=WGM.GRID_ID
  858. left join RMS_CAPACITY RC
  859. on OO.CAPACITY_ID=RC.CAPACITY_ID
  860. left join RMS_WAREHOUSE RW
  861. on RW.WAREHOUSE_ID=RPG.WAREHOUSE_ID
  862. left join RMS_STACKING RS
  863. on RS.STACKING_ID=RPG.STACKING_ID
  864. left join WMSP_IVBOUND_MAKE_MATERIAL WIMM
  865. on WIMM.MATERIAL_STEEL_ID=RMS.MATERIAL_STEEL_ID
  866. left join WMSP_IVBOUND_MAKE_RESULT WIMR
  867. on WIMR.RESULT_ID=WIMM.RESULT_ID
  868. where OO.ORDER_NUMBER=#{orderNumber}
  869. </select>
  870. <!--通过装卸工工号查询装卸工名称-->
  871. <select id="getPersonnelNameByJobnumber" parameterType="String" resultType="String">
  872. select PERSONNEL_NAME "personnelName" from RMS_PERSONNEL where PERSONNEL_JOB_NUMBER=#{personnelJobNumber}
  873. </select>
  874. <!-- 根据运输订单id查询还没装货的物资id-->
  875. <select id="getMaterial" parameterType="Integer" resultType="java.util.Map">
  876. SELECT
  877. oom.MATERIAL_ID "materialId",
  878. oom.ORDER_MATERIAL_NUMBER "materialNumber",
  879. oom.ORDER_MATERIAL_WEIGHT "materialWeight",
  880. RM.MATERIAL_CODE "materialCode",
  881. RM.MATERIAL_NAME "materialName",
  882. RM.MATERIAL_SPECIFICATION "materialSpecification",
  883. RM.MATERIAL_MODEL "materialModel",
  884. RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight"
  885. FROM
  886. OMSTRUCK_ORDER OO
  887. LEFT JOIN Omstruck_Order_Material oom ON OO.ORDER_ID = oom.ORDER_ID
  888. LEFT JOIN RMS_MATERIAL RM ON oom.material_id = RM.MATERIAL_ID
  889. WHERE
  890. OO.ORDER_ID = #{orderId}
  891. -- AND TLR.RESULT_LOAD_END_TIME IS NULL
  892. -- ORDER BY
  893. -- LOADING_SEQUENCE ASC
  894. </select>
  895. <select id="ExistWmspOutboundResult" parameterType="java.util.Map" resultType="int">
  896. select count(*)
  897. from WMSP_OUTBOUND_RESULT w_outbound
  898. where w_outbound.DELETED=0 and w_outbound.BILL_LADING_ID=#{orderId}
  899. </select>
  900. <select id="getOutBoundDetailedInfo" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
  901. select distinct w_outbound.RESULT_ID "resultId",
  902. w_outbound.RESULT_NUMBER "resultNumber",
  903. w_outbound.RESULT_OUTBOUND_TYPE "resultOutboundType",
  904. r_capacity.CAPACITY_NUMBER "capacityNumber",
  905. o_order.ORDER_NUMBER "orderNumber"
  906. -- r_unit.UNIT_OF_MEASURE_NAME "unitOfMeasureName",
  907. -- t_load.RESULT_LOAD_END_TIME "resultLoadEndTime",
  908. -- order_material.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  909. -- w_outbound.INSERT_UPDATE_REMARK "insertUpdateRemark"
  910. from WMSP_OUTBOUND_RESULT w_outbound
  911. left join OMSTRUCK_ORDER o_order
  912. on w_outbound.BILL_LADING_ID=o_order.ORDER_ID
  913. left join OMSTRUCK_ORDER_MATERIAL order_material
  914. on order_material.ORDER_ID=o_order.ORDER_ID
  915. left join RMS_CAPACITY r_capacity
  916. on o_order.CAPACITY_ID=r_capacity.CAPACITY_ID
  917. left join RMS_MATERIAL r_material
  918. on w_outbound.MATERIAL_ID=r_material.MATERIAL_ID
  919. left join RMS_UNIT_OF_MEASURE r_unit
  920. on r_material.UNIT_OF_MEASURE_ID=r_unit.UNIT_OF_MEASURE_ID
  921. left join TMSTRUCK_TOTAL_RESULT t_total
  922. on t_total.ORDER_ID=o_order.ORDER_ID
  923. left join TMSTRUCK_LOAD_RESULT t_load
  924. on t_total.RESULT_TOTAL_ID=t_load.RESULT_TOTAL_ID
  925. where o_order.ORDER_ID=#{orderId}
  926. </select>
  927. <!-- 根据出库单号查询出库单ID-->
  928. <select id="getOutBoundId" parameterType="String" resultType="java.math.BigDecimal">
  929. select RESULT_ID "resultId" from WMSP_OUTBOUND_RESULT where RESULT_NUMBER = #{resultNumber}
  930. </select>
  931. <!-- 通过装卸工工号查询装卸工Id-->
  932. <select id="getPersonnelIdByJobnumber" parameterType="String" resultType="java.math.BigDecimal">
  933. select PERSONNEL_ID "personnelId" from RMS_PERSONNEL where PERSONNEL_JOB_NUMBER = #{personnelJobNumber}
  934. </select>
  935. <!-- 根据扫描结果查询扫描实绩是否存在-->
  936. <select id="ExistScanResult" parameterType="String" resultType="int">
  937. select count(*)
  938. from WMSP_OUTBOUND_SCAN_RESULT wosr
  939. join WMSP_OUTBOUND_RESULT wor
  940. on wor.RESULT_ID = wosr.OUTBOUND_RESULT_ID
  941. join WMSP_INBOUND_SCAN_RESULT wisr
  942. on wosr.RESULT_MATERIAL = wisr.RESULT_MATERIAL
  943. join WMSP_INBOUND_RESULT wir
  944. on wisr.INBOUND_RESULT_ID = wir.INBOUND_ID
  945. where (wir.RESULT_DELETED = 0 or wor.RESULT_STATUS = 1)
  946. and wosr.RESULT_MATERIAL = #{resultMaterial}
  947. </select>
  948. <!-- 通过物资物资唯一编码查询钢材物资表的物资Id-->
  949. <select id="getSteelMaterialIdByMaterialOnlyCode" parameterType="String" resultType="java.math.BigDecimal">
  950. select material_steel.MATERIAL_ID "SteelMaterialId" from RMS_MATERIAL_STEEL material_steel
  951. where material_steel.MATERIAL_ONLY_CODE = #{MaterialOnlyCode}
  952. </select>
  953. <!-- 通过出库实绩Id查询物资Id-->
  954. <select id="getOutboundMaterialByResultId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
  955. select w_outbound.MATERIAL_ID "OutboundMaterialId" from WMSP_OUTBOUND_RESULT w_outbound
  956. where w_outbound.RESULT_ID = #{resultId}
  957. </select>
  958. <!-- 获取月台Id-->
  959. <select id="getPlatformIdByResultId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
  960. select t_load.LOADING_ID "platformId"
  961. from WMSP_OUTBOUND_RESULT w_outbound
  962. left join OMSTRUCK_ORDER o_order
  963. on w_outbound.BILL_LADING_ID=o_order.ORDER_ID
  964. left join TMSTRUCK_TOTAL_RESULT t_total
  965. on t_total.ORDER_ID=o_order.ORDER_ID
  966. left join TMSTRUCK_LOAD_RESULT t_load
  967. on t_total.RESULT_TOTAL_ID=t_load.RESULT_TOTAL_ID
  968. where w_outbound.RESULT_ID = #{resultId}
  969. </select>
  970. <!-- 通过月台Id获取仓库名称-->
  971. <select id="getWarehouseNameByPlatformId" parameterType="java.math.BigDecimal" resultType="String">
  972. SELECT
  973. RW.WAREHOUSE_NAME "warehouseName"
  974. from RMS_WAREHOUSE RW
  975. where RW.WAREHOUSE_ID = (SELECT
  976. WAREHOUSE_ID
  977. FROM "RMS_PWAREHOUSE_GRID" rpg
  978. where rpg.PLATFORM_ID = #{platformId} and rownum = 1
  979. )
  980. </select>
  981. <!-- 获取出库单统一信息-->
  982. <select id="theSameOutboundInfo" parameterType="java.math.BigDecimal" resultType="java.util.Map">
  983. select w_outbound.RESULT_NUMBER "resultNumber",
  984. o_order.ORDER_NUMBER "orderNumber",
  985. w_outbound.RESULT_OUTBOUND_TYPE "resultOutboundType",
  986. r_capacity.CAPACITY_NUMBER "capacityNumber"
  987. from WMSP_OUTBOUND_RESULT w_outbound
  988. left join OMSTRUCK_ORDER o_order
  989. on w_outbound.BILL_LADING_ID=o_order.ORDER_ID
  990. left join RMS_CAPACITY r_capacity
  991. on o_order.CAPACITY_ID=r_capacity.CAPACITY_ID
  992. where w_outbound.RESULT_ID = #{resultId}
  993. </select>
  994. <!-- 返回已扫描并并稽核成功的物资信息-->
  995. <select id="scanAuditSuccessInfo" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
  996. select outbound_scan.RESULT_MATERIAL "resultMaterial",
  997. r_pl.PERSONNEL_NAME "personnelName",
  998. outbound_scan.RESULT_LOAD_TIME "resultLoadTime",
  999. outbound_scan.INSERT_UPDATE_REMARK "insertUpdateRemark",
  1000. outbound_scan.RESULT_CHECK "check"
  1001. from WMSP_OUTBOUND_SCAN_RESULT outbound_scan
  1002. left join WMSP_OUTBOUND_RESULT w_outbound
  1003. on w_outbound.RESULT_ID=outbound_scan.OUTBOUND_RESULT_ID
  1004. left join RMS_PERSONNEL r_pl
  1005. on r_pl.PERSONNEL_ID=outbound_scan.LOAD_ID
  1006. where outbound_scan.OUTBOUND_RESULT_ID = #{resultId}
  1007. ---and outbound_scan.RESULT_CHECK = 0
  1008. </select>
  1009. <!-- 通过唯一编码获取物资名称、计量单位、垛位-->
  1010. <select id="getOtherInfoByMaterialOnlyCode" parameterType="String" resultType="java.util.Map">
  1011. select distinct r_material.MATERIAL_NAME "materialName",
  1012. r_unit.UNIT_OF_MEASURE_NAME "unitOfMeasureName",
  1013. r_stacking.STACKING_NO "stackingNo"
  1014. from RMS_MATERIAL_STEEL material_steel
  1015. left join RMS_MATERIAL r_material
  1016. on material_steel.MATERIAL_ID=r_material.MATERIAL_ID
  1017. left join RMS_UNIT_OF_MEASURE r_unit
  1018. on r_material.UNIT_OF_MEASURE_ID=r_unit.UNIT_OF_MEASURE_ID
  1019. left join Wmsp_Inbound_Result wir
  1020. on wir.MATERIAL_ID= material_steel.MATERIAL_STEEL_ID
  1021. left join RMS_PWAREHOUSE_GRID r_grid
  1022. on wir.GRID_ID=r_grid.GRID_ID
  1023. left join RMS_STACKING r_stacking
  1024. on r_stacking.STACKING_ID=r_grid.STACKING_ID
  1025. where material_steel.MATERIAL_ONLY_CODE=#{MaterialOnlyCode1} and rownum=1
  1026. </select>
  1027. <select id="getScanMaterialNumber" parameterType="DECIMAL" resultType="java.util.Map" >
  1028. SELECT
  1029. WOSR.OUTBOUND_MATERIAL_NUMBER AS "outboundMaterialNumber"
  1030. FROM WMSP_OUTBOUND_SCAN_RESULT WOSR
  1031. WHERE WOSR.OUTBOUND_RESULT_ID = #{resultId}
  1032. AND WOSR.RESULT_CHECK = 0
  1033. </select>
  1034. <select id="getOunboundOrderNumber" parameterType="DECIMAL" resultType="java.util.Map">
  1035. SELECT
  1036. OOM.ORDER_MATERIAL_NUMBER AS "orderMaterialNumber"
  1037. FROM WMSP_OUTBOUND_RESULT WOR
  1038. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1039. ON WOR.BILL_LADING_ID = OOM.ORDER_ID
  1040. AND WOR.MATERIAL_ID = OOM.MATERIAL_ID
  1041. WHERE WOR.RESULT_ID = #{resultId}
  1042. </select>
  1043. <select id="getOutboundStatus" resultType="java.lang.Integer">
  1044. SELECT COUNT(*)
  1045. FROM WMSP_OUTBOUND_RESULT wor
  1046. WHERE wor.RESULT_STATUS = 1 AND wor.BILL_LADING_ID =#{orderId}
  1047. </select>
  1048. <update id="updateGrid" parameterType="DECIMAL" >
  1049. UPDATE WMSP_GRID_MATERIAL WGM
  1050. SET WGM.DELETED = 1
  1051. WHERE WGM.MATERIAL_ID = #{materialId}
  1052. AND WGM.DELETED = 0
  1053. </update>
  1054. <update id="updateStatus">
  1055. UPDATE WMSP_OUTBOUND_RESULT
  1056. SET RESULT_STATUS = 1
  1057. WHERE RESULT_ID = #{resultId}
  1058. </update>
  1059. <select id="getWmsOutboundResultStatistics" resultType="java.util.Map">
  1060. select * from(
  1061. SELECT count(material_furnace_number) "coun",
  1062. sum (rms.MATERIAL_THEORETICAL_WEIGHT) "theoreticalWeight",
  1063. material_furnace_number "furnaceNumber",
  1064. rm.MATERIAL_NAME || rm.MATERIAL_SPECIFICATION || '(' ||
  1065. rm.MATERIAL_MODEL || ')' "materialName"
  1066. FROM WMSP_GRID_MATERIAL wgm
  1067. left join rms_material_steel rms
  1068. on rms.material_steel_id=wgm.MATERIAL_ID
  1069. left join RMS_MATERIAL rm
  1070. on rm.MATERIAL_ID = rms.MATERIAL_ID
  1071. left join RMS_PWAREHOUSE_GRID rpg
  1072. on rpg.GRID_ID = wgm.GRID_ID
  1073. WHERE wgm.DELETED = 1 and wgm.UPDATE_TIME is not null
  1074. and rpg.WAREHOUSE_ID = #{warehouseId}
  1075. <if test="oneDate != null and (con ==null || con == '') ">
  1076. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = wgm.update_time
  1077. </if>
  1078. <if test="startDate != null">
  1079. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= wgm.update_time
  1080. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= wgm.update_time
  1081. </if>
  1082. <if test="con!=null">
  1083. and material_furnace_number like #{con}
  1084. </if>
  1085. group by material_furnace_number,rm.MATERIAL_NAME || rm.MATERIAL_SPECIFICATION || '(' ||
  1086. rm.MATERIAL_MODEL || ')'
  1087. )
  1088. <where>
  1089. <if test="coun != null">
  1090. and
  1091. <foreach collection="coun" item="item" open="(" separator="or" close=")">
  1092. "coun" like '%${item}%'
  1093. </foreach>
  1094. </if>
  1095. <if test="theoreticalWeight != null">
  1096. and
  1097. <foreach collection="theoreticalWeight" item="item" open="(" separator="or" close=")">
  1098. "theoreticalWeight" like '%${item}%'
  1099. </foreach>
  1100. </if>
  1101. <if test="furnaceNumber != null">
  1102. and
  1103. <foreach collection="furnaceNumber" item="item" open="(" separator="or" close=")">
  1104. "furnaceNumber" like '%${item}%'
  1105. </foreach>
  1106. </if>
  1107. <if test="materialName != null">
  1108. and
  1109. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1110. "materialName" like '%${item}%'
  1111. </foreach>
  1112. </if>
  1113. </where>
  1114. <include refid="orderBy"></include>
  1115. </select>
  1116. <sql id="orderBy">
  1117. <if test="orderField != null and orderField != ''">
  1118. order by "${orderField}"
  1119. <if test="orderType != null and orderType != ''">
  1120. ${orderType}
  1121. </if>
  1122. </if>
  1123. </sql>
  1124. </mapper>