InventoryHeaderMapper.xml
5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?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="stack" jdbcType="VARCHAR" property="stack" />
    <result column="position" jdbcType="VARCHAR" property="position" />
    <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" />
    <result column="materialCode" jdbcType="VARCHAR" property="materialCode" />
    <result column="materialName" jdbcType="VARCHAR" property="materialName" />
    <result column="materialSpec" jdbcType="VARCHAR" property="materialSpec" />
    <result column="materialUnit" jdbcType="VARCHAR" property="materialUnit" />
    <result column="level" jdbcType="VARCHAR" property="level" />
    <result column="color" jdbcType="VARCHAR" property="color" />
    <result column="batch" jdbcType="VARCHAR" property="batch" />
    <result column="boxQty" jdbcType="DECIMAL" property="boxQty" />
    <result column="area" jdbcType="DECIMAL" property="area" />
    <result column="proPackaging" jdbcType="VARCHAR" property="proPackaging" />
    <result column="productSchedule" jdbcType="VARCHAR" property="productSchedule" />
    <result column="productSize" jdbcType="VARCHAR" property="productSize" />
    <result column="stockId" jdbcType="VARCHAR" property="stockId" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, warehouseCode, locationCode, containerCode, containerStatus, companyCode, materialSkuQty, `position`,stack,
    materialCode,materialName,materialSpec,materialUnit,`level`,color,batch,boxQty,area,proPackaging,productSchedule,stockId
    totalWeight, totalQty, totalLines, projectNos, batchs, lots, locking, lockRemark,
    enable, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2,
    userDef3,productSize
  </sql>
  <select id="getUncompleteReceiptContainer" resultType="java.lang.Integer">
        SELECT count(id) from receipt_container_header WHERE toLocation = #{locationCode} and `status`<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`<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="getInOutHeadData" resultType="com.huaheng.api.tv.domain.ProjectBean">
    SELECT
      a.*
    FROM
      (
        SELECT
          l.name,
          k.cl nums
        FROM
          ( SELECT count(*) cl, materialCode FROM shipment_detail GROUP BY materialCode ) k,
          material l
        WHERE
          k.materialCode = l.CODE
        ORDER BY
          k.cl DESC
          LIMIT 3
      ) a UNION
    SELECT
      b.*
    FROM
      (
        SELECT
          m.name,
          f.cl nums
        FROM
          ( SELECT count(*) cl, materialCode FROM receipt_detail GROUP BY materialCode ) f,
          material m
        WHERE
          f.materialCode = m.CODE
        ORDER BY
          f.cl DESC
          LIMIT 3
      ) b
  </select>
  <select id="getInventoryAge" resultType="com.huaheng.api.tv.domain.WarehouseLowBean">
    SELECT
      l.NAME name,
      y.locationCode locationCode,
      y.totalQty totalQty,
      y.created  InventoryDate
    FROM
      inventory_header y
        left join
      material l
      on
        y.materialCode = l.code
      LIMIT 100
  </select>
</mapper>