TmstruckMeasureCommissionMapper.xml 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
  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.TmstruckMeasureCommissionMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckMeasureCommission">
  5. <id column="COMMSSION_ID" jdbcType="DECIMAL" property="commssionId" />
  6. <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
  7. <result column="COMMSSION_TYPE" jdbcType="DECIMAL" property="commssionType" />
  8. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  9. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  10. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  11. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  12. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  13. <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
  14. <result column="CALCULATE_ID" jdbcType="DECIMAL" property="calculateId" />
  15. </resultMap>
  16. <sql id="columns">
  17. COMMSSION_ID, RESULT_TOTAL_ID, COMMSSION_TYPE, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  18. UPDATE_TIME, INSERT_UPDATE_REMARK, MATERIAL_ID, CALCULATE_ID
  19. </sql>
  20. <sql id="columns_alias">
  21. t.COMMSSION_ID, t.RESULT_TOTAL_ID, t.COMMSSION_TYPE, t.INSERT_USERNAME, t.INSERT_TIME,
  22. t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.MATERIAL_ID, t.CALCULATE_ID
  23. </sql>
  24. <sql id="select">
  25. SELECT <include refid="columns"/> FROM TMSTRUCK_MEASURE_COMMISSION
  26. </sql>
  27. <sql id="select_alias">
  28. SELECT <include refid="columns_alias"/> FROM TMSTRUCK_MEASURE_COMMISSION t
  29. </sql>
  30. <sql id="where">
  31. <where>
  32. <if test="commssionId != null">
  33. and COMMSSION_ID = #{commssionId}
  34. </if>
  35. <if test="resultTotalId != null">
  36. and RESULT_TOTAL_ID = #{resultTotalId}
  37. </if>
  38. <if test="commssionType != null">
  39. and COMMSSION_TYPE = #{commssionType}
  40. </if>
  41. <if test="insertUsername != null and insertUsername != ''">
  42. and INSERT_USERNAME = #{insertUsername}
  43. </if>
  44. <if test="insertTime != null">
  45. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  46. </if>
  47. <if test="updateUsername != null and updateUsername != ''">
  48. and UPDATE_USERNAME = #{updateUsername}
  49. </if>
  50. <if test="updateTime != null">
  51. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  52. </if>
  53. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  54. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  55. </if>
  56. <if test="materialId != null">
  57. and MATERIAL_ID = #{materialId}
  58. </if>
  59. <if test="calculateId != null">
  60. and CALCULATE_ID = #{calculateId}
  61. </if>
  62. </where>
  63. </sql>
  64. <sql id="whereLike">
  65. <where>
  66. <if test="commssionId != null">
  67. and COMMSSION_ID = #{commssionId}
  68. </if>
  69. <if test="resultTotalId != null">
  70. and RESULT_TOTAL_ID = #{resultTotalId}
  71. </if>
  72. <if test="commssionType != null">
  73. and COMMSSION_TYPE = #{commssionType}
  74. </if>
  75. <if test="insertUsername != null and insertUsername != ''">
  76. and INSERT_USERNAME LIKE '%${insertUsername}%'
  77. </if>
  78. <if test="insertTime != null">
  79. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  80. </if>
  81. <if test="updateUsername != null and updateUsername != ''">
  82. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  83. </if>
  84. <if test="updateTime != null">
  85. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  86. </if>
  87. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  88. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  89. </if>
  90. <if test="materialId != null">
  91. and MATERIAL_ID = #{materialId}
  92. </if>
  93. <if test="calculateId != null">
  94. and CALCULATE_ID = #{calculateId}
  95. </if>
  96. </where>
  97. </sql>
  98. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  99. delete from TMSTRUCK_MEASURE_COMMISSION
  100. where COMMSSION_ID = #{commssionId,jdbcType=DECIMAL}
  101. </delete>
  102. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  103. delete from TMSTRUCK_MEASURE_COMMISSION
  104. where 1!=1
  105. <if test="resultTotalId != null">
  106. or RESULT_TOTAL_ID = #{resultTotalId}
  107. </if>
  108. <if test="commssionType != null">
  109. or COMMSSION_TYPE = #{commssionType}
  110. </if>
  111. <if test="insertUsername != null and insertUsername != ''">
  112. or INSERT_USERNAME = #{insertUsername}
  113. </if>
  114. <if test="insertTime != null">
  115. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  116. </if>
  117. <if test="updateUsername != null and updateUsername != ''">
  118. or UPDATE_USERNAME = #{updateUsername}
  119. </if>
  120. <if test="updateTime != null">
  121. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  122. </if>
  123. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  124. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  125. </if>
  126. <if test="materialId != null">
  127. or MATERIAL_ID = #{materialId}
  128. </if>
  129. <if test="calculateId != null">
  130. or CALCULATE_ID = #{calculateId}
  131. </if>
  132. </delete>
  133. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckMeasureCommission">
  134. insert into TMSTRUCK_MEASURE_COMMISSION (COMMSSION_ID, RESULT_TOTAL_ID, COMMSSION_TYPE,
  135. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  136. UPDATE_TIME, INSERT_UPDATE_REMARK, MATERIAL_ID,
  137. CALCULATE_ID)
  138. values (#{commssionId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL}, #{commssionType,jdbcType=DECIMAL},
  139. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  140. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{materialId,jdbcType=DECIMAL},
  141. #{calculateId,jdbcType=DECIMAL})
  142. </insert>
  143. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckMeasureCommission">
  144. insert into TMSTRUCK_MEASURE_COMMISSION
  145. <trim prefix="(" suffix=")" suffixOverrides=",">
  146. <if test="commssionId != null">
  147. COMMSSION_ID,
  148. </if>
  149. <if test="resultTotalId != null">
  150. RESULT_TOTAL_ID,
  151. </if>
  152. <if test="commssionType != null">
  153. COMMSSION_TYPE,
  154. </if>
  155. <if test="insertUsername != null">
  156. INSERT_USERNAME,
  157. </if>
  158. <if test="insertTime != null">
  159. INSERT_TIME,
  160. </if>
  161. <if test="updateUsername != null">
  162. UPDATE_USERNAME,
  163. </if>
  164. <if test="updateTime != null">
  165. UPDATE_TIME,
  166. </if>
  167. <if test="insertUpdateRemark != null">
  168. INSERT_UPDATE_REMARK,
  169. </if>
  170. <if test="materialId != null">
  171. MATERIAL_ID,
  172. </if>
  173. <if test="calculateId != null">
  174. CALCULATE_ID,
  175. </if>
  176. </trim>
  177. <trim prefix="values (" suffix=")" suffixOverrides=",">
  178. <if test="commssionId != null">
  179. #{commssionId,jdbcType=DECIMAL},
  180. </if>
  181. <if test="resultTotalId != null">
  182. #{resultTotalId,jdbcType=DECIMAL},
  183. </if>
  184. <if test="commssionType != null">
  185. #{commssionType,jdbcType=DECIMAL},
  186. </if>
  187. <if test="insertUsername != null">
  188. #{insertUsername,jdbcType=VARCHAR},
  189. </if>
  190. <if test="insertTime != null">
  191. #{insertTime,jdbcType=TIMESTAMP},
  192. </if>
  193. <if test="updateUsername != null">
  194. #{updateUsername,jdbcType=VARCHAR},
  195. </if>
  196. <if test="updateTime != null">
  197. #{updateTime,jdbcType=TIMESTAMP},
  198. </if>
  199. <if test="insertUpdateRemark != null">
  200. #{insertUpdateRemark,jdbcType=VARCHAR},
  201. </if>
  202. <if test="materialId != null">
  203. #{materialId,jdbcType=DECIMAL},
  204. </if>
  205. <if test="calculateId != null">
  206. #{calculateId,jdbcType=DECIMAL},
  207. </if>
  208. </trim>
  209. </insert>
  210. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckMeasureCommission">
  211. update TMSTRUCK_MEASURE_COMMISSION
  212. set RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  213. COMMSSION_TYPE = #{commssionType,jdbcType=DECIMAL},
  214. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  215. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  216. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  217. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  218. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  219. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  220. CALCULATE_ID = #{calculateId,jdbcType=DECIMAL}
  221. where COMMSSION_ID = #{commssionId,jdbcType=DECIMAL}
  222. </update>
  223. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckMeasureCommission">
  224. update TMSTRUCK_MEASURE_COMMISSION
  225. <set>
  226. <if test="resultTotalId != null">
  227. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  228. </if>
  229. <if test="commssionType != null">
  230. COMMSSION_TYPE = #{commssionType,jdbcType=DECIMAL},
  231. </if>
  232. <if test="insertUsername != null">
  233. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  234. </if>
  235. <if test="insertTime != null">
  236. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  237. </if>
  238. <if test="updateUsername != null">
  239. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  240. </if>
  241. <if test="updateTime != null">
  242. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  243. </if>
  244. <if test="insertUpdateRemark != null">
  245. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  246. </if>
  247. <if test="materialId != null">
  248. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  249. </if>
  250. <if test="calculateId != null">
  251. CALCULATE_ID = #{calculateId,jdbcType=DECIMAL},
  252. </if>
  253. </set>
  254. where COMMSSION_ID = #{commssionId,jdbcType=DECIMAL}
  255. </update>
  256. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  257. <include refid="select"/>
  258. where COMMSSION_ID = #{commssionId,jdbcType=DECIMAL}
  259. </select>
  260. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  261. <include refid="select"/>
  262. <include refid="where"/>
  263. </select>
  264. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  265. <include refid="select"/>
  266. <include refid="whereLike"/>
  267. </select>
  268. <insert id="batchInsert" parameterType="java.util.List">
  269. insert into TMSTRUCK_MEASURE_COMMISSION
  270. (COMMSSION_ID,
  271. RESULT_TOTAL_ID, COMMSSION_TYPE,
  272. INSERT_USERNAME, INSERT_TIME,
  273. UPDATE_USERNAME, UPDATE_TIME,
  274. INSERT_UPDATE_REMARK, MATERIAL_ID,
  275. CALCULATE_ID)
  276. ( <foreach collection="list" item="item" separator="union all">
  277. select
  278. #{item.commssionId,jdbcType=DECIMAL},
  279. #{item.resultTotalId,jdbcType=DECIMAL}, #{item.commssionType,jdbcType=DECIMAL},
  280. #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
  281. #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
  282. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.materialId,jdbcType=DECIMAL},
  283. #{item.calculateId,jdbcType=DECIMAL} from dual
  284. </foreach> )
  285. </insert>
  286. <update id="batchUpdate" parameterType="java.util.List">
  287. update TMSTRUCK_MEASURE_COMMISSION
  288. set
  289. COMMSSION_ID=
  290. <foreach collection="list" item="item" index="index" separator=" " open="case COMMSSION_ID" close="end">
  291. when #{item.commssionId,jdbcType=DECIMAL} then #{item.commssionId,jdbcType=DECIMAL}
  292. </foreach>
  293. ,RESULT_TOTAL_ID=
  294. <foreach collection="list" item="item" index="index" separator=" " open="case COMMSSION_ID" close="end">
  295. when #{item.commssionId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
  296. </foreach>
  297. ,COMMSSION_TYPE=
  298. <foreach collection="list" item="item" index="index" separator=" " open="case COMMSSION_ID" close="end">
  299. when #{item.commssionId,jdbcType=DECIMAL} then #{item.commssionType,jdbcType=DECIMAL}
  300. </foreach>
  301. ,INSERT_USERNAME=
  302. <foreach collection="list" item="item" index="index" separator=" " open="case COMMSSION_ID" close="end">
  303. when #{item.commssionId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  304. </foreach>
  305. ,INSERT_TIME=
  306. <foreach collection="list" item="item" index="index" separator=" " open="case COMMSSION_ID" close="end">
  307. when #{item.commssionId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  308. </foreach>
  309. ,UPDATE_USERNAME=
  310. <foreach collection="list" item="item" index="index" separator=" " open="case COMMSSION_ID" close="end">
  311. when #{item.commssionId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  312. </foreach>
  313. ,UPDATE_TIME=
  314. <foreach collection="list" item="item" index="index" separator=" " open="case COMMSSION_ID" close="end">
  315. when #{item.commssionId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  316. </foreach>
  317. ,INSERT_UPDATE_REMARK=
  318. <foreach collection="list" item="item" index="index" separator=" " open="case COMMSSION_ID" close="end">
  319. when #{item.commssionId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  320. </foreach>
  321. ,MATERIAL_ID=
  322. <foreach collection="list" item="item" index="index" separator=" " open="case COMMSSION_ID" close="end">
  323. when #{item.commssionId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
  324. </foreach>
  325. ,CALCULATE_ID=
  326. <foreach collection="list" item="item" index="index" separator=" " open="case COMMSSION_ID" close="end">
  327. when #{item.commssionId,jdbcType=DECIMAL} then #{item.calculateId,jdbcType=DECIMAL}
  328. </foreach>
  329. where COMMSSION_ID in
  330. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  331. #{item.commssionId,jdbcType=DECIMAL}
  332. </foreach>
  333. </update>
  334. <delete id="batchDelete" parameterType="java.util.List">
  335. delete from TMSTRUCK_MEASURE_COMMISSION
  336. where COMMSSION_ID in
  337. <foreach collection="list" item="id" open="(" close=")" separator=",">
  338. #{id}
  339. </foreach>
  340. </delete>
  341. <!-- 友情提示!!!-->
  342. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  343. <!-- 排序 -->
  344. <sql id="orderBy">
  345. <if test="orderField != null and orderField != ''">
  346. order by "${orderField}"
  347. <if test="orderType != null and orderType != ''">
  348. ${orderType}
  349. </if>
  350. </if>
  351. </sql>
  352. <!-- 通过总实绩ID 和 计量类型 查询计量委托实绩 -->
  353. <select id="getMeasureCommission" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  354. select
  355. TMC.COMMSSION_ID "commssionId",
  356. <if test="orderTypee = 3">
  357. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  358. RS3.SUPPLIER_NAME "supplierName",
  359. </if>
  360. <if test="orderTypee = 1">
  361. ASO.SALE_NUMBER "saleNumber",
  362. RS1.SHIPPER_NAME "shipperName",
  363. </if>
  364. RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  365. RM.MATERIAL_NAME "materialName",
  366. OO.ORDER_NUMBER "orderNumber",
  367. RC.CAPACITY_NUMBER "capacityNumber",
  368. RTC.TRUCK_CALCULATE_NUMBER "truckCalculateNumber",
  369. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  370. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  371. TMC.COMMSSION_TYPE "commssionType",
  372. TMC.INSERT_TIME "insertTime"
  373. from TMSTRUCK_MEASURE_COMMISSION TMC
  374. left join TMSTRUCK_TOTAL_RESULT TTR
  375. on TMC.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  376. left join OMSTRUCK_ORDER OO
  377. on OO.ORDER_ID = TTR.ORDER_ID
  378. <if test="orderTypee = 3">
  379. left join AMS_PURCHASE_ORDER APO
  380. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  381. left join RMS_SUPPLIER RS3 -- 发货单位
  382. on RS3.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  383. left join RMS_CONSIGNEE RCON -- 收货单位
  384. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  385. </if>
  386. <if test="orderTypee = 1">
  387. left join AMS_SALE_ORDER ASO
  388. on ASO.SALE_ORDER_ID = OO.ORDER_PLAN_ID
  389. left join RMS_SHIPPER RS1 -- 发货单位
  390. on RS1.SHIPPER_ID = ASO.SHIPPER_ID
  391. left join RMS_CONSIGNEE RCON -- 收货单位
  392. on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  393. </if>
  394. <if test="type == 0">--计皮
  395. left join TMSTRUCK_WEIGHT_RESULT TWR
  396. on TWR.RESULT_TOTAL_ID = TMC.RESULT_TOTAL_ID
  397. left join RMS_TRUCK_CALCULATE RTC
  398. on RTC.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  399. </if>
  400. <if test="type == 1">--计毛
  401. left join TMSTRUCK_WEIGHT_RESULT TWR
  402. on TWR.RESULT_TOTAL_ID = TMC.RESULT_TOTAL_ID
  403. left join RMS_TRUCK_CALCULATE RTC
  404. on RTC.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  405. </if>
  406. left join RMS_CAPACITY RC
  407. on RC.CAPACITY_ID = OO.CAPACITY_ID
  408. left join OMSTRUCK_ORDER_MATERIAL OOM
  409. on OOM.ORDER_ID = OO.ORDER_ID
  410. left join RMS_MATERIAL RM
  411. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  412. where TMC.COMMSSION_TYPE = #{type} and TTR.RESULT_TOTAL_ID = #{resultTotalId}
  413. <where>
  414. <if test="purchaseOrderNo != null">
  415. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  416. "purchaseOrderNo" like '%${item}%'
  417. </foreach>
  418. </if>
  419. <if test="shipperName != null">
  420. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  421. "shipperName" like '%${item}%'
  422. </foreach>
  423. </if>
  424. <if test="saleNumber != null">
  425. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  426. "saleNumber" like '%${item}%'
  427. </foreach>
  428. </if>
  429. <if test="materialName != null">
  430. and
  431. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  432. "materialName" like '%${item}%'
  433. </foreach>
  434. </if>
  435. <if test="orderNumber != null">
  436. and
  437. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  438. "orderNumber" like '%${item}%'
  439. </foreach>
  440. </if>
  441. <if test="capacityNumber != null">
  442. and
  443. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  444. "capacityNumber" like '%${item}%'
  445. </foreach>
  446. </if>
  447. <if test="orderMaterialNumber != null">
  448. and
  449. <foreach collection="orderMaterialNumber" item="item" open="(" separator="or" close=")">
  450. "orderMaterialNumber" like '%${item}%'
  451. </foreach>
  452. </if>
  453. <if test="commssionType != null">
  454. and
  455. <foreach collection="commssionType" item="item" open="(" separator="or" close=")">
  456. "commssionType" like '%${item}%'
  457. </foreach>
  458. </if>
  459. <if test="supplierName != null">
  460. and
  461. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  462. "supplierName" like '%${item}%'
  463. </foreach>
  464. </if>
  465. <if test="orderMaterialWeight != null">
  466. and
  467. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  468. "orderMaterialWeight" like '%${item}%'
  469. </foreach>
  470. </if>
  471. </where>
  472. <include refid="orderBy"></include>
  473. <if test="orderField == null ">
  474. order by "insertTime" desc
  475. </if>
  476. </select>
  477. <!-- 查询采购计量委托 -->
  478. <select id="getCGMeasureCommission" parameterType="java.util.Map" resultType="java.util.Map">
  479. select APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  480. RC.CAPACITY_NUMBER "capacityNumber",
  481. OO.ORDER_NUMBER "orderNumber",
  482. RTC.TRUCK_CALCULATE_NUMBER "truckCalculateNumber",
  483. RS.SUPPLIER_ID "supplierId",
  484. RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  485. RM.MATERIAL_NAME "materialName",
  486. RW.WAREHOUSE_NAME "warehouseName",
  487. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName"
  488. from TMSTRUCK_MEASURE_COMMISSION TMC
  489. left join TMSTRUCK_TOTAL_RESULT TTR
  490. on TTR.RESULT_TOTAL_ID = TMC.RESULT_TOTAL_ID
  491. left join OMSTRUCK_ORDER OO
  492. on OO.ORDER_ID = TTR.ORDER_ID
  493. left join AMS_PURCHASE_ORDER APO
  494. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  495. left join DIL_BATCH DB
  496. on APO.BATCH_ID = DB.BATCH_ID
  497. left join RMS_CAPACITY RC
  498. on RC.CAPACITY_ID = OO.CAPACITY_ID
  499. left join OMSTRUCK_ORDER_MATERIAL OOM
  500. on OOM.ORDER_ID = OO.ORDER_ID
  501. left join RMS_MATERIAL RM
  502. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  503. left join TMSTRUCK_WEIGHT_RESULT TWR
  504. on TWR.RESULT_TOTAL_ID = TMC.RESULT_TOTAL_ID
  505. <if test="type == 0">--计皮
  506. left join RMS_TRUCK_CALCULATE RTC
  507. on RTC.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  508. </if>
  509. <if test="type == 1">--计毛
  510. left join RMS_TRUCK_CALCULATE RTC
  511. on RTC.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  512. </if>
  513. left join TMSTRUCK_UNLOAD_RESULT TUR
  514. on TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  515. left join RMS_WAREHOUSE RW
  516. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  517. left join RMS_SUPPLIER RS -- 发货单位
  518. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  519. left join RMS_CONSIGNEE RCON -- 收货单位
  520. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  521. where TMC.COMMSSION_TYPE = #{type} and TMC.RESULT_TOTAL_ID = #{resultTotalId}
  522. </select>
  523. <!-- 查询销售计量委托 -->
  524. <select id="getXSMeasureCommission" parameterType="java.util.Map" resultType="java.util.Map">
  525. select
  526. ASO.SALE_NUMBER "saleNumber",
  527. RS.SHIPPER_NAME "shipperName",
  528. RC.CAPACITY_NUMBER "capacityNumber",
  529. OO.ORDER_NUMBER "orderNumber",
  530. RTC.TRUCK_CALCULATE_NUMBER "truckCalculateNumber",
  531. RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  532. RM.MATERIAL_NAME "materialName",
  533. RW.WAREHOUSE_NAME "warehouseName",
  534. from TMSTRUCK_MEASURE_COMMISSION TMC
  535. left join TMSTRUCK_TOTAL_RESULT TTR
  536. on TTR.RESULT_TOTAL_ID = TMC.RESULT_TOTAL_ID
  537. left join OMSTRUCK_ORDER OO
  538. on OO.ORDER_ID = TTR.ORDER_ID
  539. left join AMS_SALE_ORDER ASO
  540. on ASO.SALE_ORDER_ID = OO.ORDER_PLAN_ID
  541. left join RMS_CAPACITY RC
  542. on RC.CAPACITY_ID = OO.CAPACITY_ID
  543. left join OMSTRUCK_ORDER_MATERIAL OOM
  544. on OOM.ORDER_ID = OO.ORDER_ID
  545. left join RMS_MATERIAL RM
  546. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  547. left join TMSTRUCK_WEIGHT_RESULT TWR
  548. on TWR.RESULT_TOTAL_ID = TMC.RESULT_TOTAL_ID
  549. <if test="type == 0">--计皮
  550. left join RMS_TRUCK_CALCULATE RTC
  551. on RTC.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
  552. </if>
  553. <if test="type == 1">--计毛
  554. left join RMS_TRUCK_CALCULATE RTC
  555. on RTC.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  556. </if>
  557. left join TMSTRUCK_UNLOAD_RESULT TUR
  558. on TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  559. left join RMS_WAREHOUSE RW
  560. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  561. left join RMS_SHIPPER RS -- 发货单位
  562. on RS.SHIPPER_ID = ASO.SHIPPER_ID
  563. left join RMS_CONSIGNEE RCON -- 收货单位
  564. on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  565. where TMC.COMMSSION_TYPE = #{type} and TMC.RESULT_TOTAL_ID = #{resultTotalId}
  566. </select>
  567. <!--计量委托查询所需数据-->
  568. <!--销售查询计毛 -->
  569. <select id="selectMakesureGrossForSaleByOrderNumber" parameterType="java.lang.String" resultType="java.util.Map">
  570. SELECT
  571. OO.ORDER_NUMBER "orderNumber",
  572. RC.CAPACITY_NUMBER "capacityNumber",
  573. ASO.SALE_NUMBER "saleNumber",
  574. RTC.TRUCK_CALCULATE_NUMBER "calcuateNumber",
  575. RM.MATERIAL_NAME "materialName",
  576. RMS.MATERIAL_THEORETICAL_WEIGHT "materialTheoretialWeight",
  577. RS.SHIPPER_NAME "shipperName",
  578. RRA.ADDRESS_DELIVERY_ADDRESS "addressDelivery"
  579. FROM
  580. OMSTRUCK_ORDER OO
  581. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID = OO.ORDER_ID
  582. LEFT JOIN AMS_SALE_ORDER ASO ON OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
  583. LEFT JOIN RMS_CAPACITY RC
  584. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  585. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  586. LEFT JOIN RMS_TRUCK_CALCULATE RTC ON TWR.RESULT_GROSS_PLACE_ID = RTC.TRUCK_CALCULATE_ID
  587. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OO.ORDER_ID = OOM.ORDER_ID
  588. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  589. LEFT JOIN RMS_MATERIAL_STEEL RMS ON OOM.MATERIAL_ID = RMS.MATERIAL_ID
  590. LEFT JOIN RMS_SHIPPER RS ON RS.SHIPPER_ID = ASO.SHIPPER_ID
  591. LEFT JOIN RMS_RECEIVE_ADDRESS RRA ON RRA.ADDRESS_ID = ASO.RECEIVE_ID
  592. WHERE
  593. OO.ORDER_NUMBER = #{orderNumber}
  594. </select>
  595. <!--销售物流查询计皮作业 -->
  596. <select id="selectMakesureTareForSaleByOrderNumber" resultType="java.util.Map" parameterType="java.lang.String">
  597. SELECT
  598. OO.ORDER_NUMBER "orderNumber",
  599. RC.CAPACITY_NUMBER "capacityNumber",
  600. ASO.SALE_NUMBER "saleNumber",
  601. RTC.TRUCK_CALCULATE_NUMBER "calcuateNumber",
  602. RM.MATERIAL_NAME "materialName",
  603. RMS.MATERIAL_THEORETICAL_WEIGHT "materialTheoretialWeight",
  604. RS.SHIPPER_NAME "shipperName",
  605. RRA.ADDRESS_DELIVERY_ADDRESS "addressDelivery"
  606. FROM
  607. OMSTRUCK_ORDER OO
  608. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID = OO.ORDER_ID
  609. LEFT JOIN AMS_SALE_ORDER ASO ON OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
  610. LEFT JOIN RMS_CAPACITY RC
  611. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  612. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  613. LEFT JOIN RMS_TRUCK_CALCULATE RTC ON TWR.RESULT_TARE_PLACE_ID = RTC.TRUCK_CALCULATE_ID
  614. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OO.ORDER_ID = OOM.ORDER_ID
  615. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  616. LEFT JOIN RMS_MATERIAL_STEEL RMS ON OOM.MATERIAL_ID = RMS.MATERIAL_ID
  617. LEFT JOIN RMS_SHIPPER RS ON RS.SHIPPER_ID = ASO.SHIPPER_ID
  618. LEFT JOIN RMS_RECEIVE_ADDRESS RRA ON RRA.ADDRESS_ID = ASO.RECEIVE_ID
  619. WHERE
  620. OO.ORDER_NUMBER = #{orderNumber}
  621. </select>
  622. <!--内转物流查询计皮作业 -->
  623. <select id="selectMakesureTareForConvertedByOrderNumber" resultType="java.util.Map" parameterType="java.lang.String">
  624. SELECT OO.ORDER_NUMBER "orderNumber",
  625. ARP.REQUIREMENT_NUMBER "requirementNumber",
  626. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  627. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  628. RMS.MATERIAL_THEORETICAL_WEIGHT "theoreticalWeight",
  629. RL.LINE_START_NODE_DESC "startNode",
  630. RL.LINE_END_NODE_DESC "endNode",
  631. RC.CAPACITY_NUMBER "capacityNumber",
  632. RTC.TRUCK_CALCULATE_NUMBER "calculateNumber"
  633. FROM OMSTRUCK_ORDER OO
  634. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OO.ORDER_ID = OOM.ORDER_ID
  635. LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT ARP ON ARP.REQUIREMENT_ID=OO.ORDER_PLAN_ID
  636. LEFT JOIN RMS_CAPACITY RC
  637. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  638. LEFT JOIN RMS_MATERIAL_STEEL RMS ON OOM.MATERIAL_ID = RMS.MATERIAL_ID
  639. LEFT JOIN RMS_LINE RL ON ARP.LINE_ID = RL.LINE_ID
  640. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID = OO.ORDER_ID
  641. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  642. LEFT JOIN RMS_TRUCK_CALCULATE RTC
  643. ON RTC.TRUCK_CALCULATE_ID=TWR.RESULT_TARE_PLACE_ID
  644. WHERE OO.ORDER_NUMBER = #{orderNumber}
  645. </select>
  646. <!-- 内转物流查询计毛作业 -->
  647. <select id="selectMakesureGrossForConvertedByOrderNumber" resultType="java.util.Map" parameterType="java.lang.String">
  648. SELECT OO.ORDER_NUMBER "orderNumber",
  649. ARP.REQUIREMENT_NUMBER "requirementNumber",
  650. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  651. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  652. RMS.MATERIAL_THEORETICAL_WEIGHT "theoreticalWeight",
  653. RL.LINE_START_NODE_DESC "startNode",
  654. RL.LINE_END_NODE_DESC "endNode",
  655. RC.CAPACITY_NUMBER "capacityNumber",
  656. RTC.TRUCK_CALCULATE_NUMBER "calculateNumber"
  657. FROM OMSTRUCK_ORDER OO
  658. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OO.ORDER_ID = OOM.ORDER_ID
  659. LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT ARP ON ARP.REQUIREMENT_ID=OO.ORDER_PLAN_ID
  660. LEFT JOIN RMS_CAPACITY RC
  661. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  662. LEFT JOIN RMS_MATERIAL_STEEL RMS ON OOM.MATERIAL_ID = RMS.MATERIAL_ID
  663. LEFT JOIN RMS_LINE RL ON ARP.LINE_ID = RL.LINE_ID
  664. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID = OO.ORDER_ID
  665. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  666. LEFT JOIN RMS_TRUCK_CALCULATE RTC ON RTC.TRUCK_CALCULATE_ID=TWR.RESULT_GROSS_PLACE_ID
  667. WHERE OO.ORDER_NUMBER = #{orderNumber}
  668. </select>
  669. <!-- 采购查询计毛 -->
  670. <select id="selectMakesureGrossForPurchase" parameterType="java.lang.String" resultType="java.util.Map">
  671. SELECT OO.ORDER_NUMBER "orderNumber",
  672. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  673. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  674. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  675. RTC.TRUCK_CALCULATE_NUMBER "calculateNumber",
  676. RS.SHIPPER_NAME "shipperName",
  677. RRA.ADDRESS_DELIVERY_ADDRESS "deliveryAdress",
  678. RMS.MATERIAL_THEORETICAL_WEIGHT "theoreticalWeight",
  679. RC.CAPACITY_NUMBER "capacityNumber"
  680. FROM OMSTRUCK_ORDER OO
  681. LEFT JOIN AMS_PURCHASE_ORDER APO
  682. ON OO.ORDER_PLAN_ID=APO.PURCHASE_ORDER_ID
  683. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  684. ON OO.ORDER_ID=OOM.ORDER_ID
  685. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  686. ON OO.ORDER_ID = TTR.ORDER_ID
  687. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  688. ON TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  689. LEFT JOIN RMS_TRUCK_CALCULATE RTC
  690. ON RTC.TRUCK_CALCULATE_ID=TWR.RESULT_GROSS_PLACE_ID
  691. LEFT JOIN RMS_SHIPPER RS
  692. ON RS.SHIPPER_ID=APO.SUPPLIER_UNIT_ID
  693. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  694. ON RRA.ADDRESS_ID=APO.RECEIVE_UNIT_ID
  695. LEFT JOIN RMS_MATERIAL_STEEL RMS
  696. ON RMS.MATERIAL_ID=OOM.MATERIAL_ID
  697. LEFT JOIN RMS_CAPACITY RC
  698. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  699. WHERE OO.ORDER_NUMBER = #{orderNumber}
  700. </select>
  701. <!-- 采购查询计皮 -->
  702. <select id="selectMakesureTareForPurchase" parameterType="java.lang.String" resultType="java.util.Map">
  703. SELECT OO.ORDER_NUMBER "orderNumber",
  704. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  705. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  706. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  707. RTC.TRUCK_CALCULATE_NUMBER "calculateNumber",
  708. RS.SHIPPER_NAME "shipperName",
  709. RRA.ADDRESS_DELIVERY_ADDRESS "deliveryAdress",
  710. RMS.MATERIAL_THEORETICAL_WEIGHT "theoreticalWeight",
  711. RC.CAPACITY_NUMBER "capacityNumber"
  712. FROM OMSTRUCK_ORDER OO
  713. LEFT JOIN AMS_PURCHASE_ORDER APO
  714. ON OO.ORDER_PLAN_ID=APO.PURCHASE_ORDER_ID
  715. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  716. ON OO.ORDER_ID=OOM.ORDER_ID
  717. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  718. ON OO.ORDER_ID = TTR.ORDER_ID
  719. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  720. ON TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  721. LEFT JOIN RMS_TRUCK_CALCULATE RTC
  722. ON RTC.TRUCK_CALCULATE_ID=TWR.RESULT_TARE_PLACE_ID
  723. LEFT JOIN RMS_SHIPPER RS
  724. ON RS.SHIPPER_ID = APO.SUPPLIER_UNIT_ID
  725. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  726. ON RRA.ADDRESS_ID = APO.RECEIVE_UNIT_ID
  727. LEFT JOIN RMS_MATERIAL_STEEL RMS
  728. ON RMS.MATERIAL_ID = OOM.MATERIAL_ID
  729. LEFT JOIN RMS_CAPACITY RC
  730. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  731. WHERE OO.ORDER_NUMBER = #{orderNumber}
  732. </select>
  733. <!-- 采购辅料计量委托 -->
  734. <select id="purchaseFLMeasure" parameterType="map" resultType="java.util.Map">
  735. select
  736. APO.PURCHASE_ORDER_NO "purchaseOrder",
  737. OO.ORDER_NUMBER "transportNum",
  738. RC.CAPACITY_NUMBER "carNum",
  739. RTC.TRUCK_CALCULATE_NUMBER "steelyardNum",
  740. RS.SUPPLIER_NAME "sendUnit",
  741. RSH.SHIPPER_NAME "ReceivUnit",
  742. RM.MATERIAL_NAME "materiaName",
  743. RM.MATERIAL_ID "materialId",
  744. CONCAT(RM.MATERIAL_SPECIFICATION, RM.MATERIAL_MODEL) "goodsType",
  745. RW.WAREHOUSE_NAME "unloadPlace",
  746. TWR.INSERT_UPDATE_REMARK "demo",
  747. DB.RESULT_FOREIGN_SHIP_NAME "shipNum"
  748. from OMSTRUCK_ORDER OO
  749. left join TMSTRUCK_TOTAL_RESULT TTR
  750. on TTR.ORDER_ID = OO.ORDER_ID
  751. left join AMS_PURCHASE_ORDER APO
  752. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  753. left join DIL_BATCH DB
  754. on DB.BATCH_ID = APO.BATCH_ID
  755. left join RMS_SUPPLIER RS
  756. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  757. left join RMS_SHIPPER RSH
  758. on RSH.SHIPPER_ID = APO.RECEIVE_UNIT_ID
  759. left join OMSTRUCK_ORDER_MATERIAL OOM
  760. on OO.ORDER_ID = OOM.ORDER_ID
  761. left join RMS_MATERIAL RM
  762. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  763. left join RMS_CAPACITY RC
  764. on RC.CAPACITY_ID = OO.CAPACITY_ID
  765. left join TMSTRUCK_WEIGHT_RESULT TWR
  766. on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
  767. left join RMS_TRUCK_CALCULATE RTC
  768. on RTC.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  769. left join TMSTRUCK_UNLOAD_RESULT TUR
  770. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  771. left join RMS_WAREHOUSE RW
  772. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  773. where OO.ORDER_ID = #{orderId}
  774. </select>
  775. <!-- 采购辅料查询计量委托(达兴) -->
  776. <select id="purchaseFLDXMeasure" parameterType="map" resultType="java.util.Map">
  777. select APO.PURCHASE_ORDER_NO "purchaseOrder",
  778. OO.ORDER_NUMBER "orderId",
  779. RC.CAPACITY_NUMBER "carNumber",
  780. RTC.TRUCK_CALCULATE_NUMBER "regionName",
  781. RS.SUPPLIER_NAME "provider",
  782. RS.SUPPLIER_DUTY_PARAGRAPH "providerNo",
  783. RSH.SHIPPER_NAME "receiver",
  784. (case
  785. when RSH.SHIPPER_PARTITION_CODE is null
  786. then ' '
  787. else RSH.SHIPPER_PARTITION_CODE
  788. end
  789. ) "receiverNo",
  790. RM.MATERIAL_ID || '' "item",
  791. RM.MATERIAL_CODE "goodsNo",
  792. CONCAT(RM.MATERIAL_NAME, CONCAT(RM.MATERIAL_SPECIFICATION, RM.MATERIAL_MODEL)) "goodsName",
  793. (case
  794. when OOM.ORDER_MATERIAL_WEIGHT is null
  795. then 0
  796. else OOM.ORDER_MATERIAL_WEIGHT
  797. end
  798. ) || '' "planQuantity"
  799. from OMSTRUCK_ORDER OO
  800. left join TMSTRUCK_TOTAL_RESULT TTR
  801. on TTR.ORDER_ID = OO.ORDER_ID
  802. left join AMS_PURCHASE_ORDER APO
  803. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  804. left join RMS_SUPPLIER RS
  805. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  806. left join RMS_SHIPPER RSH
  807. on RSH.SHIPPER_ID = APO.RECEIVE_UNIT_ID
  808. left join OMSTRUCK_ORDER_MATERIAL OOM
  809. on OO.ORDER_ID = OOM.ORDER_ID
  810. left join RMS_MATERIAL RM
  811. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  812. left join RMS_CAPACITY RC
  813. on RC.CAPACITY_ID = OO.CAPACITY_ID
  814. left join TMSTRUCK_WEIGHT_RESULT TWR
  815. on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
  816. left join RMS_TRUCK_CALCULATE RTC
  817. on RTC.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
  818. left join TMSTRUCK_UNLOAD_RESULT TUR
  819. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  820. where OO.ORDER_ID = #{orderId}
  821. </select>
  822. <!-- 通过订单ID查询发货单位ID -->
  823. <select id="getSupplierIdByOrderId" parameterType="java.math.BigDecimal" resultType="java.lang.Integer">
  824. select APO.RECEIVE_UNIT_ID
  825. from OMSTRUCK_ORDER OO
  826. left join AMS_PURCHASE_ORDER APO
  827. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  828. where OO.ORDER_ID = #{orderId}
  829. </select>
  830. <!-- 内转采购计量委托 -->
  831. </mapper>