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.

95 lines
5.1 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.xjfast.mapper.InventorystockMapper">
  4. <resultMap id="BaseResultMap" type="com.xjfast.entity.Inventorystock">
  5. <id column="Site" jdbcType="VARCHAR" property="site"/>
  6. <id column="WarehouseID" jdbcType="VARCHAR" property="warehouseid"/>
  7. <id column="PartNo" jdbcType="VARCHAR" property="partno"/>
  8. <id column="BatchNo" jdbcType="VARCHAR" property="batchno"/>
  9. <id column="LocationID" jdbcType="VARCHAR" property="locationid"/>
  10. <result column="FirstInDate" jdbcType="TIMESTAMP" property="firstindate"/>
  11. <result column="LatestOutDate" jdbcType="TIMESTAMP" property="latestoutdate"/>
  12. <result column="LatestInDate" jdbcType="TIMESTAMP" property="latestindate"/>
  13. <result column="ActiveDate" jdbcType="TIMESTAMP" property="activedate"/>
  14. <result column="InQty" jdbcType="FLOAT" property="inqty"/>
  15. <result column="OutQty" jdbcType="FLOAT" property="outqty"/>
  16. <result column="QtyOnHand" jdbcType="FLOAT" property="qtyonhand"/>
  17. <result column="QtyReserved" jdbcType="FLOAT" property="qtyreserved"/>
  18. <result column="InStandardValue" jdbcType="FLOAT" property="instandardvalue"/>
  19. <result column="InActualValue" jdbcType="FLOAT" property="inactualvalue"/>
  20. <result column="OutStandardValue" jdbcType="FLOAT" property="outstandardvalue"/>
  21. <result column="OutActualValue" jdbcType="FLOAT" property="outactualvalue"/>
  22. <result column="PartnerID" jdbcType="VARCHAR" property="partnerid"/>
  23. <result column="PartnerType" jdbcType="CHAR" property="partnertype"/>
  24. <result column="LatestCountDate" jdbcType="TIMESTAMP" property="latestcountdate"/>
  25. <result column="Freezeflag" jdbcType="CHAR" property="freezeflag"/>
  26. <result column="QtyTmp" jdbcType="FLOAT" property="qtytmp"/>
  27. <result column="ManufactureDate" jdbcType="TIMESTAMP" property="manufacturedate"/>
  28. <result column="ExpiredDate" jdbcType="TIMESTAMP" property="expireddate"/>
  29. <result column="QtytoIssue" jdbcType="FLOAT" property="qtytoissue"/>
  30. <result column="DemandPartnerType" jdbcType="CHAR" property="demandpartnertype"/>
  31. <result column="DemandPartnerID" jdbcType="VARCHAR" property="demandpartnerid"/>
  32. <result column="DemandPartnerName" jdbcType="VARCHAR" property="demandpartnername"/>
  33. </resultMap>
  34. <sql id="Base_Column_List">
  35. Site
  36. , WarehouseID, PartNo, BatchNo, LocationID, FirstInDate, LatestOutDate, LatestInDate,
  37. ActiveDate, InQty, OutQty, QtyOnHand, QtyReserved, InStandardValue, InActualValue,
  38. OutStandardValue, OutActualValue, PartnerID, PartnerType, LatestCountDate, Freezeflag,
  39. QtyTmp, ManufactureDate, ExpiredDate, QtytoIssue, DemandPartnerType, DemandPartnerID,
  40. DemandPartnerName
  41. </sql>
  42. <select id="searchInventoryList" resultType="com.xjfast.entity.vo.InventoryStockVo"
  43. parameterType="com.xjfast.entity.query.InventoryStockQuery">
  44. SELECT
  45. i.WarehouseID,i.PartNo,i.QtyOnHand,
  46. p.PartDescription,
  47. w.WareHouseName,
  48. i.site,
  49. w.WareHouseType,
  50. w.WareHouseType_DB
  51. FROM
  52. WareHouse w
  53. LEFT JOIN InventoryStock i ON ( w.WareHouseID = i.WareHouseID )
  54. LEFT JOIN Part p ON ( p.PartNo = i.PartNo )
  55. <where>
  56. <if test="warehousetypeDb != null and warehousetypeDb != ''">
  57. and w.WareHouseType_DB=#{warehousetypeDb}
  58. </if>
  59. <if test="site != null and site != ''">
  60. i.site = #{site} and w.site=#{site} and p.site=#{site}
  61. </if>
  62. <if test="wareHouseName != null and wareHouseName != ''">
  63. and w.WareHouseName like '%'+#{wareHouseName}+'%'
  64. </if>
  65. <if test="warehouseid != null and warehouseid != ''">
  66. and i.warehouseid like '%'+#{warehouseid}+'%'
  67. </if>
  68. <if test="partNo != null and partNo != ''">
  69. and i.PartNo like '%'+#{partNo}+'%'
  70. </if>
  71. <if test="partDescription != null and partDescription != ''">
  72. and p.PartDescription like '%'+#{partDescription}+'%'
  73. </if>
  74. </where>
  75. </select>
  76. <select id="searchInventory" resultType="com.xjfast.entity.vo.InventoryStockVo"
  77. parameterType="com.xjfast.entity.query.InventoryStockQuery">
  78. SELECT i.WarehouseID,
  79. i.PartNo,
  80. i.QtyOnHand,
  81. p.PartDescription,
  82. w.WareHouseName,
  83. ppi.average_consume_qty,
  84. ppi.cover_days,
  85. i.site
  86. FROM InventoryStock i
  87. LEFT JOIN Part p on (p.PartNo = i.PartNo)
  88. LEFT JOIN WareHouse w on (w.WareHouseID = i.WareHouseID and w.WareHouseType_DB = #{warehousetypeDb})
  89. LEFT JOIN part_plan_info ppi on (ppi.part_no = i.PartNo and ppi.ware_house_id = i.WarehouseID)
  90. where i.site = #{site}
  91. and i.PartNo = #{partNo}
  92. and i.WarehouseID = #{wareHouseId}
  93. </select>
  94. </mapper>