Blame view

src/main/resources/mybatis/shipment/ShipmentCombinationMapper.xml 3.99 KB
pengcheng authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?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">
pengcheng authored
23
24
25
26
27
28
29
    SELECT i.id, i.warehouseCode, i.locationCode, i.containerCode,
    i.companyCode, i.materialCode,i.materialName,i.materialSpec,i.materialUnit,
    i.receiptCode,	i.receiptDetailId, i.batch, i.lot, i.projectNo,
    i.qty, i.taskQty, i.created,i.inventorySts,
    i.createdBy, i.lastUpdated, i.lastUpdatedBy, i.userDef1, i.userDef2, i.userDef3
    FROM inventory_detail i
    INNER JOIN location l ON i.locationCode = l.code
pengcheng authored
30
31
32
33
34
35
36
37
    AND i.companyCode=#{companyCode}
    AND i.warehouseCode=#{warehouseCode}
    AND i.qty > i.taskQty
    AND l.warehouseCode=#{warehouseCode}
    LEFT JOIN shipment_container_header s ON i.locationCode = s.locationCode
    AND s.status=0
    AND s.warehouseCode=#{warehouseCode}
    <where>
pengcheng authored
38
39
      <if test="project!= null and project!= ''">
        AND i.projectNo = #{project}
pengcheng authored
40
      </if>
pengcheng authored
41
42
      <if test="inventorySts != null and inventorySts != '' ">
        AND i.inventorySts = #{inventorySts}
pengcheng authored
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
      </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>
xumiao authored
59
60
    <select id="selectOfView"
            resultType="com.huaheng.pc.shipment.shippingCombination.domain.ShippingCombinationDetailModel">
xumiao authored
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
      SELECT
      d.id,
      d.shipmentCode,
      d.shipmentDetailId,
      d.materialCode,
      d.materialName,
      (
      SELECT
      spec
      FROM
      material
      <where> <if test = "warehouseCode != null and warehouseCode!=''" >
         warehouseCode = #{warehouseCode}
      </if> </where>
      and CODE = d.materialCode
      LIMIT 1
      ) AS materialSpec,
      h.containerCode,
      h.locationCode,
      d.qty
      FROM
      `shipment_container_detail` d
      INNER JOIN shipment_container_header h ON d.shippingContainerId = h.id
      AND d.shipmentCode = #{shipmentCode}
      <where> <if test = "materialCode != null and materialCode!=''" >
        AND d.materialCode = #{materialCode}
      </if> <if test = "containerCode != null and containerCode!=''" >
        AND h.containerCode = #{containerCode}
      </if> <if test = "warehouseCode != null and warehouseCode!=''" >
        AND h.warehouseCode = #{warehouseCode}
      </if> </where>
xumiao authored
93
    </select>
pengcheng authored
94
</mapper>