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.

103 lines
3.0 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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.xujie.modules.quality.mapper.SrmQualityIssuePoMapper">
  4. <select id="getAvailablePoList" resultType="com.xujie.modules.quality.data.QualityIssuePoSelectDto">
  5. SELECT
  6. p.site,
  7. p.order_ref1 as poNo,
  8. p.item_no as itemNo,
  9. p.part_no as partNo,
  10. pt.sku as sku,
  11. h.order_date as poDate,
  12. p.qty,
  13. p.shipped_qty as shippedQty
  14. FROM PODetail p
  15. LEFT JOIN POHeader h
  16. ON p.site = h.site
  17. AND p.order_no = h.order_no
  18. LEFT JOIN part pt
  19. ON p.part_no = pt.part_no
  20. WHERE p.site = #{site}
  21. AND ISNULL(p.shipped_qty, 0) > 0
  22. <if test="supplierNo != null and supplierNo != ''">
  23. AND h.supplier_no = #{supplierNo}
  24. </if>
  25. <if test="poNo != null and poNo != ''">
  26. AND p.order_ref1 LIKE '%' + #{poNo} + '%'
  27. </if>
  28. <if test="partNo != null and partNo != ''">
  29. AND p.part_no LIKE '%' + #{partNo} + '%'
  30. </if>
  31. <if test="beginDate != null">
  32. AND h.order_date &gt;= #{beginDate}
  33. </if>
  34. <if test="endDate != null">
  35. AND h.order_date &lt;= #{endDate}
  36. </if>
  37. ORDER BY h.order_date DESC
  38. </select>
  39. <!-- 其他方法保持不变 -->
  40. <delete id="deleteByIssueNo">
  41. DELETE FROM srm_quality_issue_po
  42. WHERE site = #{site}
  43. AND issue_no = #{issueNo}
  44. </delete>
  45. <insert id="batchInsert">
  46. INSERT INTO srm_quality_issue_po
  47. (
  48. site,
  49. issue_no,
  50. po_no,
  51. item_no,
  52. part_no,
  53. po_qty,
  54. shipped_qty,
  55. create_by,
  56. create_date
  57. )
  58. VALUES
  59. <foreach collection="list" item="item" separator=",">
  60. (
  61. #{item.site},
  62. #{item.issueNo},
  63. #{item.poNo},
  64. #{item.itemNo},
  65. #{item.partNo},
  66. #{item.poQty},
  67. #{item.shippedQty},
  68. #{item.createBy},
  69. GETDATE()
  70. )
  71. </foreach>
  72. </insert>
  73. <select id="getIssuePoList" resultType="com.xujie.modules.quality.entity.SrmQualityIssuePo">
  74. SELECT
  75. qip.site,
  76. qip.issue_no,
  77. qip.po_no,
  78. qip.item_no,
  79. qip.part_no,
  80. pt.sku,
  81. qip.po_qty,
  82. qip.shipped_qty,
  83. qip.create_by,
  84. qip.create_date
  85. FROM srm_quality_issue_po qip
  86. LEFT JOIN part pt
  87. ON qip.part_no = pt.part_no
  88. WHERE qip.site = #{site}
  89. AND qip.issue_no = #{issueNo}
  90. </select>
  91. <delete id="deleteByPoNo">
  92. DELETE FROM srm_quality_issue_po
  93. WHERE site = #{site}
  94. AND issue_no = #{issueNo}
  95. AND po_no = #{poNo}
  96. AND item_no = #{itemNo}
  97. </delete>
  98. </mapper>