InventoryHeaderMapper.xml 4.63 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.inventory.inventoryHeader.mapper.InventoryHeaderMapper">
  <resultMap id="BaseResultMap" type="com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader">
    <!--@mbg.generated-->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
    <result column="locationCode" jdbcType="VARCHAR" property="locationCode" />
    <result column="containerCode" jdbcType="VARCHAR" property="containerCode" />
    <result column="containerStatus" jdbcType="VARCHAR" property="containerStatus" />
    <result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
    <result column="materialSkuQty" jdbcType="VARCHAR" property="materialSkuQty" />
    <result column="totalWeight" jdbcType="VARCHAR" property="totalWeight" />
    <result column="totalQty" jdbcType="INTEGER" property="totalQty" />
    <result column="totalLines" jdbcType="INTEGER" property="totalLines" />
    <result column="projectNos" jdbcType="VARCHAR" property="projectNos" />
    <result column="batchs" jdbcType="VARCHAR" property="batchs" />
    <result column="lots" jdbcType="VARCHAR" property="lots" />
    <result column="locking" jdbcType="INTEGER" property="locking" />
    <result column="lockRemark" jdbcType="VARCHAR" property="lockRemark" />
    <result column="enable" jdbcType="INTEGER" property="enable" />
    <result column="created" jdbcType="TIMESTAMP" property="created" />
    <result column="createdBy" jdbcType="VARCHAR" property="createdBy" />
    <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" />
    <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" />
    <result column="version" jdbcType="INTEGER" property="version" />
    <result column="userDef1" jdbcType="VARCHAR" property="userDef1" />
    <result column="userDef2" jdbcType="VARCHAR" property="userDef2" />
    <result column="userDef3" jdbcType="VARCHAR" property="userDef3" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, warehouseCode, locationCode, containerCode, containerStatus, companyCode, materialSkuQty, 
    totalWeight, totalQty, totalLines, projectNos, batchs, lots, locking, lockRemark,
    enable, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2,
    userDef3
  </sql>


  <select id="getUncompleteReceiptContainer" resultType="java.lang.Integer">
        SELECT count(id) from receipt_container_header WHERE toLocation = #{locationCode} and `status`&lt;20 and warehouseCode = #{warehouseCode}
    </select>

  <select id="getUncompleteShipmentContainer" resultType="java.lang.Integer">
        SELECT count(id) from shipment_container_header t join location b ON t.warehouseCode = b.warehouseCode and t.containerCode = b.containerCode
        WHERE b.`code` = #{locationCode}  AND t.`status`&lt;20 and t.warehouseCode = #{warehouseCode}
    </select>


  <select id="cycleCountInventoryHeader"  resultType="java.lang.Integer">
        SELECT DISTINCT h.id FROM inventory_header h
        INNER JOIN inventory_detail d ON h.id= d.inventoryHeaderId
        INNER JOIN location l ON d.locationCode = l.code
        AND l.status = 'empty'
    </select>

    <select id="getCbdSolidInventoryList"
            resultType="com.huaheng.pc.inventory.inventoryHeader.domain.CbgInventoryDto">
        SELECT location.zoneCode                    AS zoneCode,
               location.code                        AS locationCode,
               station.name                         AS locationName,
               location.`status`                    AS locationStatus,
               location.containerCode               AS containerCode,
               container.status                     AS containerStatus,
               container.vehicleCode                AS vehicleCode,
               inventory_header.orderCode           AS orderCode,
               inventory_header.shipmentReferCode   AS shipmentReferCode,
               inventory_header.lastUpdated         AS lastUpdated,
               inventory_header.lastUpdatedBy       AS lastUpdatedBy,
               IFNULL(inventory_header.totalQty, 0) AS totalQty
        FROM location
                 LEFT JOIN container ON container.code = location.containerCode
                 LEFT JOIN inventory_header ON location.containerCode = inventory_header.containerCode
                LEFT JOIN station ON station.code = location.code
        WHERE location.zoneCode = #{zoneCode}
        ORDER BY location.iLayer
    </select>
</mapper>