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.

202 lines
9.1 KiB

12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months 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.wms.dao.WmsPrintDao">
  4. <select id="getInboundQcResultData" resultType="InboundQcResultData">
  5. select
  6. a.site,a.bu_no,d.inspection_no as order_no,a.order_status,d.part_no,d.part_desc,D.related_order_no AS po_orderNo,D.related_order_line_no AS po_itemNo,c.SupplierName,c.supplierID as supplierId,
  7. b.inspector_date,b.submit_date,a.order_qty,roll_qty,roll_count,inspection_result,disposal_measures,
  8. B.batch_qualified_qty,b.inspector_no
  9. from inbound_notification_head a
  10. inner join inbound_notification_detail D on a.site = D.site and a.bu_no = D.bu_no and a.order_no = D.order_no AND A.order_type ='采购入库'
  11. left join qc_iqc_record b on D.site = b.site and D.bu_no = b.bu_no and D.inspection_no = b.inspection_no
  12. inner join Supplier c on a.site = c.Site and a.Supplier_ID = c.supplierID
  13. <where>
  14. <if test="query.site != null and query.site != ''">
  15. and A.site=#{query.site,jdbcType=VARCHAR}
  16. </if>
  17. <if test="query.buNo != null and query.buNo != ''">
  18. and A.bu_no=#{query.buNo,jdbcType=CHAR}
  19. </if>
  20. <if test="query.orderNo != null and query.orderNo != ''">
  21. and A.order_no like '%'+ #{query.orderNo,jdbcType=CHAR} +'%'
  22. </if>
  23. <if test="query.partNo != null and query.partNo != ''">
  24. and b.part_no like '%'+ #{query.partNo,jdbcType=CHAR} +'%'
  25. </if>
  26. <if test="query.partDesc != null and query.partDesc != ''">
  27. and b.part_desc like '%'+ #{query.partDesc,jdbcType=CHAR} +'%'
  28. </if>
  29. <if test="query.startDate != null">
  30. and b.inspector_date > #{query.startDate}
  31. </if>
  32. <if test="query.endDate != null">
  33. and #{query.endDate} > b.inspector_date
  34. </if>
  35. <if test="query.supplierName != null and query.supplierName != ''">
  36. and c.SupplierName like '%'+ #{query.supplierName} +'%'
  37. </if>
  38. <if test="query.poOrderNo != null and query.poOrderNo != ''">
  39. and b.po_orderNo like '%'+ #{query.poOrderNo} +'%'
  40. </if>
  41. <if test="query.poItemNo != null and query.poItemNo != ''">
  42. and b.po_itemNo = #{query.supplierName}
  43. </if>
  44. </where>
  45. </select>
  46. <select id="getPoOrderRollNoOutData" resultType="PoOrderRollNoOutData">
  47. select ROW_NUMBER() OVER (ORDER BY a.created_date) orderId,a.site,a.bu_no,a.inspection_no,a.order_no,a.item_no,a.roll_no,a.roll_qty,a.part_no,a.part_desc,a.supplier_id,a.supplier_name,
  48. a.order_qty,a.created_by,a.created_date,a.update_by,a.updated_date,a.delflag,a.version,a.print_flag,a.citem_code,
  49. a.citem_class,a.sendto_address,a.hardtag_in_flag,a.batch_no,a.production_date,a.validity_period,a.chip_disk_no,
  50. a.expiration_warning_date,a.expiration_date
  51. from po_order_roll_no a
  52. <where>
  53. and A.site=#{site}
  54. and A.bu_no=#{buNo}
  55. and A.inspection_no=#{inspectionNo,jdbcType=VARCHAR}
  56. </where>
  57. </select>
  58. <select id="getInboundQcResultOtherData" resultType="PoOrderRollNoOutData">
  59. select
  60. top 1 b.expiration_day, b.expiration_flag, b.exceed_in_ratio, b.expiration_warning_day,
  61. isnull(a.batch_qualified_qty,0)-isnull((select sum(roll_qty) from po_order_roll_no where site=#{site} and bu_no=#{buNo} and inspection_no=#{orderNo} ),0) as remainingIssuableQty
  62. from qc_iqc_record a
  63. left join part b on a.site=b.site and a.bu_no=b.bu_No and a.part_no=b.PartNo
  64. and a.inspection_no=#{orderNo} and a.site=#{site} and a.bu_no=#{buNo}
  65. </select>
  66. <insert id="savePoOrderRollNo">
  67. insert into po_order_roll_no
  68. (site,bu_no,inspection_no,order_no,item_no,roll_no,roll_qty,part_no,part_desc,supplier_id,supplier_name,order_qty,
  69. created_by,created_date,delflag,version,print_flag,
  70. hardtag_in_flag,batch_no,production_date,expiration_warning_date,expiration_date
  71. ) values
  72. (#{site},#{buNo},#{inspectionNo},#{orderNo},#{itemNo},#{rollNo},#{rollQty},#{partNo},#{partDesc},#{supplierId},#{supplierName},#{orderQty},
  73. #{createdBy},GetDate(),#{delflag},#{version},#{printFlag},
  74. #{hardtagInFlag},#{batchNo},#{productionDate},#{expirationWarningDate},#{expirationDate})
  75. </insert>
  76. <delete id="deletePoPartLabelData">
  77. delete from po_order_roll_no where site=#{site} and bu_no=#{buNo} and roll_no=#{rollNo} and inspection_no=#{inspectionNo}
  78. </delete>
  79. <update id="updatePrintFlag">
  80. update po_order_roll_no set print_flag=isnull(print_flag,0)+1
  81. WHERE
  82. site = #{site} <!-- 先过滤 site -->
  83. and bu_no=#{buNo}
  84. AND roll_no IN
  85. <foreach item="item" collection="rollList" open="(" separator="," close=")">
  86. #{item.rollNo}
  87. </foreach>
  88. </update>
  89. <select id="getPoPartLabelData" resultType="PoOrderRollNoOutData">
  90. select site,bu_no,inspection_no,order_no,item_no,roll_no,roll_qty,part_no,part_desc,supplier_id,supplier_name,order_qty,
  91. created_by,created_date,delflag,version,print_flag,
  92. hardtag_in_flag,batch_no,production_date,expiration_warning_date,expiration_date
  93. from po_order_roll_no
  94. WHERE
  95. site = #{site} <!-- 先过滤 site -->
  96. and bu_no=#{buNo}
  97. AND roll_no IN
  98. <foreach item="item" collection="rollList" open="(" separator="," close=")">
  99. #{item.rollNo}
  100. </foreach>
  101. order by created_date
  102. </select>
  103. <select id="getKuCunLabelData" resultType="InventoryStockOutData">
  104. select
  105. a.site,
  106. a.bu_no,--事业部
  107. a.roll_no,--标签条码
  108. a.qty_on_hand,--标签数量
  109. a.status,--状态
  110. a.part_no,--物料编码
  111. b.PartDescription,--物料名称
  112. b.Spec,--规格型号
  113. b.UMID,
  114. UM.UMName,--单位名称
  115. a.label_type,--标签类型
  116. a.parent_roll_no, --上级标签号
  117. a.parent_roll_type,--上级标签类型
  118. a.warehouse_id,
  119. W.WareHouseName,--仓库名称
  120. a.location_id,
  121. L.LocationName,--货位名称
  122. a.first_in_date,--入库日期
  123. a.manufacture_date,--生产日期
  124. a.expired_date, --有效期
  125. a.orderref0,--来源单据类型
  126. a.orderref1,--来源单据号
  127. a.orderref2,--来源单据行号
  128. a.batch_no, --合约号码
  129. a.wdr, --批次号
  130. a.remark --备注说明
  131. from inventory_stock a
  132. LEFT JOIN PART b ON a.site = b.Site AND a.part_no = b.PartNo
  133. LEFT JOIN UM ON b.Site = UM.Site AND b.UMID = UM.UMID
  134. LEFT JOIN WareHouse W ON a.site = W.Site AND a.warehouse_id = W.WareHouseID
  135. LEFT JOIN Location L ON a.site = L.Site AND a.location_id = L.LocationName
  136. <where>
  137. and a.status != '出库'
  138. <if test="query.site != null and query.site != ''">
  139. and A.site=#{query.site,jdbcType=VARCHAR}
  140. </if>
  141. <if test="query.buNo != null and query.buNo != ''">
  142. and A.bu_no=#{query.buNo}
  143. </if>
  144. <if test="query.warehouseId != null and query.warehouseId != ''">
  145. and A.warehouse_id like '%'+ #{query.warehouseId}+'%'
  146. </if>
  147. <if test="query.locationId != null and query.locationId != ''">
  148. and A.location_id like '%'+ #{query.locationId}+'%'
  149. </if>
  150. <if test="query.rollNo != null and query.rollNo != ''">
  151. and A.roll_no like '%'+ #{query.rollNo}+'%'
  152. </if>
  153. <if test="query.parentRollNo != null and query.parentRollNo != ''">
  154. and A.parent_roll_no like '%'+ #{query.parentRollNo}+'%'
  155. </if>
  156. <if test="query.partNo != null and query.partNo != ''">
  157. and A.part_no like '%'+ #{query.partNo}+'%'
  158. </if>
  159. <if test="query.partDescription != null and query.partDescription != ''">
  160. and b.part_desc_en like '%'+ #{query.partDescEn}+'%'
  161. </if>
  162. <if test="query.status != null and query.status != ''">
  163. and a.status = #{query.status}
  164. </if>
  165. <if test="query.labelType != null and query.labelType != ''">
  166. and a.label_type = #{query.labelType}
  167. </if>
  168. <if test="query.batchNo != null and query.batchNo != ''">
  169. and a.batch_no like '%'+ #{query.batchNo}+'%'
  170. </if>
  171. </where>
  172. </select>
  173. <!-- 更新库存标签属性 -->
  174. <update id="updateInventoryStockAttribute">
  175. UPDATE inventory_stock
  176. SET
  177. batch_no = #{batchNo,jdbcType=VARCHAR},
  178. remark = #{remark,jdbcType=VARCHAR}
  179. WHERE site = #{site,jdbcType=VARCHAR}
  180. AND bu_no = #{buNo,jdbcType=VARCHAR}
  181. AND roll_no = #{rollNo,jdbcType=VARCHAR}
  182. </update>
  183. </mapper>