荣鑫后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

265 lines
9.0 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  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.gaotao.modules.finishedProduct.dao.SoReceiveBoxesDao">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxesEntity" id="soReceiveBoxesMap">
  6. <result property="id" column="id"/>
  7. <result property="site" column="site"/>
  8. <result property="boxNo" column="box_no"/>
  9. <result property="orderNo" column="order_no"/>
  10. <result property="batchCode" column="batch_code"/>
  11. <result property="itemCode" column="item_code"/>
  12. <result property="status" column="status"/>
  13. <result property="status2" column="status2"/>
  14. <result property="rollsQty" column="rolls_qty"/>
  15. <result property="boxType" column="box_type"/>
  16. <result property="cInStockFlag" column="c_in_stock_flag"/>
  17. <result property="cType" column="c_type"/>
  18. <result property="createdDate" column="created_date"/>
  19. <result property="createdBy" column="created_by"/>
  20. <result property="updateDate" column="update_date"/>
  21. <result property="updateBy" column="update_by"/>
  22. <result property="delflag" column="delflag"/>
  23. <result property="version" column="version"/>
  24. </resultMap>
  25. <update id="sealing">
  26. update so_receive_boxes
  27. set status='已封箱'
  28. where order_no = #{orderNo}
  29. and item_code = #{partNo}
  30. and status = '未封箱'
  31. </update>
  32. <select id="boxingNumberByOrderNoAndPartNo" resultType="java.lang.Double">
  33. SELECT ISNULL(sum(roll_qty), 0)
  34. FROM so_receive_box_rolls r
  35. LEFT JOIN so_receive_boxes b on b.box_no = r.box_no
  36. WHERE b.order_no = #{orderNo}
  37. and b.item_code = #{partNo}
  38. </select>
  39. <select id="getBoxingRoll" resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxRollsEntity">
  40. SELECT id,
  41. site,
  42. box_no,
  43. final_roll_no,
  44. roll_qty,
  45. created_date,
  46. created_by,
  47. update_date,
  48. update_by,
  49. delflag,
  50. version,
  51. erp_flag,
  52. remark
  53. FROM so_receive_box_rolls
  54. WHERE final_roll_no = #{rollNo}
  55. </select>
  56. <select id="getBoxing" resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxesEntity">
  57. SELECT id,
  58. site,
  59. box_no,
  60. order_no,
  61. batch_code,
  62. item_code,
  63. status,
  64. status2,
  65. rolls_qty,
  66. box_type,
  67. c_in_stock_flag,
  68. c_type,
  69. created_date,
  70. created_by,
  71. update_date,
  72. update_by,
  73. delflag,
  74. version
  75. FROM so_receive_boxes
  76. WHERE order_no = #{orderNo}
  77. and item_code = #{partNo}
  78. and status = '未封箱'
  79. </select>
  80. <select id="getBoxRollList" resultType="com.gaotao.modules.finishedProduct.entity.CRollinfoEntity">
  81. SELECT cr.*
  82. FROM so_receive_box_rolls br
  83. LEFT JOIN so_receive_boxes bx on br.box_no = bx.box_no
  84. LEFT JOIN C_RollInfo cr ON br.final_roll_no = cr.RollNo
  85. WHERE bx.order_no = #{orderNo}
  86. </select>
  87. <select id="sealingNumber" resultType="com.gaotao.modules.finishedProduct.vo.BoxVo">
  88. SELECT sum(r.roll_qty) number ,b.box_no
  89. FROM so_receive_boxes b
  90. LEFT JOIN so_receive_box_rolls r on r.box_no = b.box_no
  91. where order_no = #{orderNo}
  92. and item_code = #{partNo}
  93. and status = '未封箱'
  94. group by b.box_no
  95. </select>
  96. <select id="getSoBoxingList" resultType="com.gaotao.modules.finishedProduct.vo.SoReceiveBoxesEntityVo">
  97. select id,
  98. site,
  99. box_no,
  100. order_no,
  101. batch_code,
  102. item_code,
  103. status,
  104. status2,
  105. dbo.GET_BOXING_ROLLSQTY(box_no) as rolls_qty,
  106. box_type,
  107. c_in_stock_flag,
  108. c_type,
  109. created_date,
  110. created_by,
  111. update_date,
  112. update_by,
  113. delflag,
  114. version
  115. from so_receive_boxes
  116. <where>
  117. <if test="boxNo != null and boxNo!= ''">
  118. and box_no like #{boxNo}
  119. </if>
  120. <if test="site != null and site!= ''">
  121. and site like #{site}
  122. </if>
  123. <if test="orderNo != null and orderNo!= ''">
  124. and order_no like #{orderNo}
  125. </if>
  126. <if test="boxNo != null and boxNo!= ''">
  127. and box_no like #{boxNo}
  128. </if>
  129. <if test="itemCode != null and itemCode!= ''">
  130. and item_code like #{itemCode}
  131. </if>
  132. <if test="status != null and status!= ''">
  133. and status like #{status}
  134. </if>
  135. <if test="startDate != null ">
  136. and created_date <![CDATA[>=]]> #{createdDate}
  137. </if>
  138. <if test="endDate != null ">
  139. and created_date <![CDATA[<=]]> #{endDate}
  140. </if>
  141. <if test="createdBy != null and createdBy!= ''">
  142. and created_by = #{createdBy}
  143. </if>
  144. </where>
  145. </select>
  146. <select id="searchBoxRolls" resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxRollsEntity">
  147. SELECT
  148. r.id,
  149. r.site,
  150. r.box_no,
  151. r.final_roll_no,
  152. r.roll_qty,
  153. r.created_date,
  154. r.created_by,
  155. r.update_date,
  156. r.update_by,
  157. r.delflag,
  158. r.version,
  159. r.erp_flag,
  160. r.remark,
  161. b.item_code,
  162. b.order_no
  163. FROM so_receive_box_rolls r
  164. left join so_receive_boxes b on r.box_no = b.box_no
  165. where b.box_no = #{boxNo}
  166. <where>
  167. <if test="finalRollNo != null and finalRollNo != ''">
  168. and r.final_roll_no = #{finalRollNo}
  169. </if>
  170. </where>
  171. </select>
  172. <select id="getBoxNoByRollNo"
  173. resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxRollsEntity">
  174. select box_no
  175. from so_receive_box_rolls
  176. where final_roll_no = #{finalRollNo}
  177. </select>
  178. <select id="getBoxByRollNo" resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxesEntity">
  179. SELECT sob.id,
  180. sob.site,
  181. sob.box_no,
  182. sob.order_no,
  183. sob.batch_code,
  184. sob.item_code,
  185. sob.status,
  186. sob.status2,
  187. sob.rolls_qty,
  188. sob.box_type,
  189. sob.c_in_stock_flag,
  190. sob.c_type,
  191. sob.created_date,
  192. sob.created_by,
  193. sob.update_date,
  194. sob.update_by,
  195. sob.delflag,
  196. sob.version
  197. FROM so_receive_boxes sob
  198. LEFT JOIN so_receive_box_rolls sbr ON sob.box_no = sbr.box_no
  199. WHERE final_roll_no = #{finalRollNo}
  200. </select>
  201. <select id="getBoxByOrderAndItemCode"
  202. resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxesEntity">
  203. SELECT site,
  204. box_no,
  205. order_no,
  206. batch_code,
  207. item_code,
  208. status,
  209. status2,
  210. rolls_qty,
  211. box_type,
  212. c_in_stock_flag,
  213. c_type,
  214. created_date,
  215. created_by,
  216. update_date,
  217. update_by,
  218. delflag,
  219. version
  220. FROM so_receive_boxes
  221. WHERE order_no = #{ orderNo }
  222. and item_code = #{itemCode}
  223. AND Status = '未封箱'
  224. </select>
  225. <select id="getLotNo" resultType="java.lang.String">
  226. SELECT
  227. top 1 cr.OrderRef1
  228. FROM
  229. so_receive_box_rolls sr
  230. LEFT JOIN C_RollInfo cr on cr.RollNo = sr.final_roll_no
  231. where sr.box_no = #{boxNo} and cr.OrderRef1 is not null
  232. </select>
  233. <select id="getOrderPartQtyList" resultType="com.gaotao.modules.finishedProduct.vo.OrderPartQtyVo">
  234. select order_no,item_code as part_no,sum(r.roll_qty) as part_qty from
  235. so_receive_boxes b
  236. LEFT JOIN so_receive_box_rolls r on r.box_no = b.box_no
  237. where b.order_no = #{orderNo}
  238. group by order_no,item_code
  239. </select>
  240. <select id="getRollOrderNo" resultType="com.gaotao.modules.finishedProduct.entity.CRollinfoEntity">
  241. SELECT top 1 cr.OrderRef1
  242. FROM so_receive_box_rolls sbr
  243. LEFT JOIN so_receive_boxes sb on sb.box_no = sbr.box_no
  244. LEFT JOIN C_RollInfo cr on cr.RollNo = sbr.final_roll_no
  245. WHERE item_code = #{partno} and sb.order_no = #{orderNo}
  246. and sb.status = '未封箱'
  247. </select>
  248. </mapper>