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.

160 lines
7.7 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 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 a.site,a.bu_no,a.order_no,a.order_status,b.part_no,b.part_desc,b.po_orderNo,b.po_itemNo,c.SupplierName,c.supplierID as supplierId,
  6. b.inspector_date,b.submit_date,a.order_qty,roll_qty,roll_count,inspection_result,disposal_measures,
  7. B.batch_qualified_qty,b.inspector_no
  8. from inbound_notification_head a
  9. inner join qc_iqc_record b on a.site = b.site and a.bu_no = b.bu_no and a.order_no = b.inspection_no AND A.order_type ='采购入库'
  10. left join Supplier c on a.site = c.Site and a.Supplier_ID = c.supplierID
  11. <where>
  12. <if test="query.site != null and query.site != ''">
  13. and A.site=#{query.site,jdbcType=VARCHAR}
  14. </if>
  15. <if test="query.buNo != null and query.buNo != ''">
  16. and A.bu_no=#{query.buNo,jdbcType=CHAR}
  17. </if>
  18. <if test="query.orderNo != null and query.orderNo != ''">
  19. and A.order_no like '%'+ #{query.orderNo,jdbcType=CHAR} +'%'
  20. </if>
  21. <if test="query.partNo != null and query.partNo != ''">
  22. and b.part_no like '%'+ #{query.partNo,jdbcType=CHAR} +'%'
  23. </if>
  24. <if test="query.partDesc != null and query.partDesc != ''">
  25. and b.part_desc like '%'+ #{query.partDesc,jdbcType=CHAR} +'%'
  26. </if>
  27. <if test="query.startDate != null">
  28. and b.inspector_date > #{query.startDate}
  29. </if>
  30. <if test="query.endDate != null">
  31. and #{query.endDate} > b.inspector_date
  32. </if>
  33. <if test="query.supplierName != null and query.supplierName != ''">
  34. and c.SupplierName like '%'+ #{query.supplierName} +'%'
  35. </if>
  36. <if test="query.poOrderNo != null and query.poOrderNo != ''">
  37. and b.po_orderNo like '%'+ #{query.poOrderNo} +'%'
  38. </if>
  39. <if test="query.poItemNo != null and query.poItemNo != ''">
  40. and b.po_itemNo = #{query.supplierName}
  41. </if>
  42. </where>
  43. </select>
  44. <select id="getPoOrderRollNoOutData" resultType="PoOrderRollNoOutData">
  45. 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,
  46. 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,
  47. a.citem_class,a.sendto_address,a.hardtag_in_flag,a.batch_no,a.production_date,a.validity_period,a.chip_disk_no,
  48. a.expiration_warning_date,a.expiration_date
  49. from po_order_roll_no a
  50. <where>
  51. and A.site=#{site}
  52. and A.bu_no=#{buNo}
  53. and A.inspection_no=#{inspectionNo,jdbcType=VARCHAR}
  54. </where>
  55. </select>
  56. <select id="getInboundQcResultOtherData" resultType="PoOrderRollNoOutData">
  57. select top 1 b.expiration_day,b.expiration_flag,b.exceed_in_ratio,b.expiration_warning_day,
  58. 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
  59. from qc_iqc_record a
  60. left join part b on a.site=b.site and a.bu_no=b.bu_No and a.part_no=b.PartNo
  61. and a.inspection_no=#{orderNo} and a.site=#{site} and a.bu_no=#{buNo}
  62. </select>
  63. <insert id="savePoOrderRollNo">
  64. insert into po_order_roll_no
  65. (site,bu_no,inspection_no,order_no,item_no,roll_no,roll_qty,part_no,part_desc,supplier_id,supplier_name,order_qty,
  66. created_by,created_date,delflag,version,print_flag,
  67. hardtag_in_flag,batch_no,production_date,expiration_warning_date,expiration_date
  68. ) values
  69. (#{site},#{buNo},#{inspectionNo},#{orderNo},#{itemNo},#{rollNo},#{rollQty},#{partNo},#{partDesc},#{supplierId},#{supplierName},#{orderQty},
  70. #{createdBy},GetDate(),#{delflag},#{version},#{printFlag},
  71. #{hardtagInFlag},#{batchNo},#{productionDate},#{expirationWarningDate},#{expirationDate})
  72. </insert>
  73. <delete id="deletePoPartLabelData">
  74. delete from po_order_roll_no where site=#{site} and bu_no=#{buNo} and roll_no=#{rollNo} and inspection_no=#{inspectionNo}
  75. </delete>
  76. <update id="updatePrintFlag">
  77. update po_order_roll_no set print_flag=isnull(print_flag,0)+1
  78. WHERE
  79. site = #{site} <!-- 先过滤 site -->
  80. and bu_no=#{buNo}
  81. AND roll_no IN
  82. <foreach item="item" collection="rollList" open="(" separator="," close=")">
  83. #{item.rollNo}
  84. </foreach>
  85. </update>
  86. <select id="getPoPartLabelData" resultType="PoOrderRollNoOutData">
  87. select site,bu_no,inspection_no,order_no,item_no,roll_no,roll_qty,part_no,part_desc,supplier_id,supplier_name,order_qty,
  88. created_by,created_date,delflag,version,print_flag,
  89. hardtag_in_flag,batch_no,production_date,expiration_warning_date,expiration_date
  90. from po_order_roll_no
  91. WHERE
  92. site = #{site} <!-- 先过滤 site -->
  93. and bu_no=#{buNo}
  94. AND roll_no IN
  95. <foreach item="item" collection="rollList" open="(" separator="," close=")">
  96. #{item.rollNo}
  97. </foreach>
  98. order by created_date
  99. </select>
  100. <select id="getKuCunLabelData" resultType="InventoryStockOutData">
  101. select a.site,a.bu_no,a.warehouse_id,location_id,roll_no,parent_roll_no,part_no,b.PartDescription,B.part_desc_en,a.status,a.qty_on_hand,label_type,a.orderref1,a.orderref2,a.orderref3,a.manufacture_date,a.expired_date,a.batch_no
  102. from inventory_stock a
  103. left join part b on a.site = b.site and a.bu_no = b.bu_no and a.part_no = b.PartNo
  104. <where>
  105. and a.status != '出库'
  106. <if test="query.site != null and query.site != ''">
  107. and A.site=#{query.site,jdbcType=VARCHAR}
  108. </if>
  109. <if test="query.buNo != null and query.buNo != ''">
  110. and A.bu_no=#{query.buNo}
  111. </if>
  112. <if test="query.warehouseId != null and query.warehouseId != ''">
  113. and A.warehouse_id like '%'+ #{query.warehouseId}+'%'
  114. </if>
  115. <if test="query.locationId != null and query.locationId != ''">
  116. and A.location_id like '%'+ #{query.locationId}+'%'
  117. </if>
  118. <if test="query.rollNo != null and query.rollNo != ''">
  119. and A.roll_no like '%'+ #{query.rollNo}+'%'
  120. </if>
  121. <if test="query.parentRollNo != null and query.parentRollNo != ''">
  122. and A.parent_roll_no like '%'+ #{query.parentRollNo}+'%'
  123. </if>
  124. <if test="query.partNo != null and query.partNo != ''">
  125. and A.part_no like '%'+ #{query.partNo}+'%'
  126. </if>
  127. <if test="query.partDescription != null and query.partDescription != ''">
  128. and b.part_desc_en like '%'+ #{query.partDescEn}+'%'
  129. </if>
  130. <if test="query.status != null and query.status != ''">
  131. and a.status = #{query.status}
  132. </if>
  133. <if test="query.labelType != null and query.labelType != ''">
  134. and a.label_type = #{query.labelType}
  135. </if>
  136. <if test="query.batchNo != null and query.batchNo != ''">
  137. and a.batch_no like '%'+ #{query.batchNo}+'%'
  138. </if>
  139. </where>
  140. </select>
  141. </mapper>