ShipmentCombinationMapper.xml 3.2 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.huaheng.pc.shipment.shippingCombination.mapper.ShippingCombinationMapper">
  <resultMap id="BaseResultMap" type="com.huaheng.pc.shipment.shippingCombination.domain.ShippingSearch">
    <!--@mbg.generated-->
    <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
    <result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="materialCode" jdbcType="VARCHAR" property="materialCode" />
    <result column="locationCode" jdbcType="VARCHAR" property="locationCode" />
    <result column="containerCode" jdbcType="VARCHAR" property="containerCode" />
    <result column="inventorySts" jdbcType="VARCHAR" property="inventorySts" />
    <result column="project" jdbcType="VARCHAR" property="project" />
    <result column="code" jdbcType="VARCHAR" property="code" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
     warehouseCode, companyCode, code, materialCode, locationCode, `containerCode`, inventorySts,
    project
  </sql>

  <select id="getInventorys" resultType="com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail">
    SELECT i.id, i.warehouseId, i.warehouseCode, i.locationId, i.locationCode, i.containerCode,
    i.sourceCode, i.sourceLine, i.companyId, i.companyCode, i.materialId, i.materialCode,
    i.receiptId, i.receiptCode,	i.receiptDetailId, i.batch, i.lot, i.project, i.manufactureDate,
    i.expirationDate, i.status, i.qty, i.taskQty, i.costPrice, i.listPrice, i.netPrice, i.created,
    i.createdBy, i.lastUpdated, i.lastUpdatedBy, i.userDef1, i.userDef2, i.userDef3, i.deleted,
    m.name materialName, m.userDef1 materialOldCode ,i.zoneCode
    FROM inventory i
    INNER JOIN material m ON i.materialCode = m.code
    AND i.companyCode=#{companyCode}
    AND i.warehouseCode=#{warehouseCode}
    AND m.warehouseCode=#{warehouseCode}
    AND i.qty > i.taskQty
    AND i.materialCode=#{materialCode}

    INNER JOIN location l ON i.locationCode = l.code
    AND l.warehouseCode=#{warehouseCode}
    LEFT JOIN shipment_container_header s ON i.locationCode = s.locationCode
    AND s.status=0
    AND s.warehouseCode=#{warehouseCode}
    <where>
      <if test="project != null and project != ''">
        AND i.project = #{project}
      </if>
      <if test="inventoryStatus != null and inventoryStatus != '' ">
        AND i.status = #{inventoryStatus}
      </if>
      <if test="locationCode != null and locationCode != '' ">
        AND i.locationCode = #{locationCode}
      </if>
      <if test="containerCode != null and containerCode != '' ">
        AND i.containerCode = #{containerCode}
      </if>
      <if test="params != null and params.createdBegin != null and params.createdBegin != ''">
        AND i.created &gt;= #{params.createdBegin}
      </if>
      <if test="params != null and params.createdEnd != null and params.createdEnd != ''">
        AND i.created &lt;= #{params.createdEnd}
      </if>
      AND  l.status='empty' OR (l.status='lock' AND s.id  IS NOT NULL)
    </where>
  </select>
</mapper>