Commit d5dadeee by wutong

调拨单在途考虑到调拨计划单

parent 669f8b1b
......@@ -6,15 +6,15 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="bailun_sku" jdbcType="VARCHAR" property="bailunSku" />
<result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode" />
<result column="quantity_purchase" jdbcType="INTEGER" property="quantityPurchase" />
<result column="gmt_purchase_modified" jdbcType="TIMESTAMP" property="gmtPurchaseModified" />
<result column="quantity_transfer" jdbcType="INTEGER" property="quantityTransfer" />
<result column="gmt_transfer_modified" jdbcType="TIMESTAMP" property="gmtTransferModified" />
<result column="quantity_out_stock" jdbcType="INTEGER" property="quantityOutStock" />
<result column="gmt_out_stock_modified" jdbcType="TIMESTAMP" property="gmtOutStockModified" />
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="bailun_sku" jdbcType="VARCHAR" property="bailunSku"/>
<result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode"/>
<result column="quantity_purchase" jdbcType="INTEGER" property="quantityPurchase"/>
<result column="gmt_purchase_modified" jdbcType="TIMESTAMP" property="gmtPurchaseModified"/>
<result column="quantity_transfer" jdbcType="INTEGER" property="quantityTransfer"/>
<result column="gmt_transfer_modified" jdbcType="TIMESTAMP" property="gmtTransferModified"/>
<result column="quantity_out_stock" jdbcType="INTEGER" property="quantityOutStock"/>
<result column="gmt_out_stock_modified" jdbcType="TIMESTAMP" property="gmtOutStockModified"/>
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -38,7 +38,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -71,7 +72,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -90,7 +92,8 @@
id, bailun_sku, warehouse_code, quantity_purchase, gmt_purchase_modified, quantity_transfer,
gmt_transfer_modified, quantity_out_stock, gmt_out_stock_modified
</sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcMidTransitExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcMidTransitExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
......@@ -99,10 +102,10 @@
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from dc_mid_transit
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
......@@ -122,7 +125,7 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from dc_mid_transit
where id = #{id,jdbcType=INTEGER}
</select>
......@@ -141,7 +144,7 @@
-->
delete from dc_mid_transit
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.bailuntec.domain.entity.DcMidTransit">
......@@ -225,14 +228,15 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcMidTransitExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcMidTransitExample"
resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from dc_mid_transit
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
......@@ -271,7 +275,7 @@
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
......@@ -290,7 +294,7 @@
quantity_out_stock = #{record.quantityOutStock,jdbcType=INTEGER},
gmt_out_stock_modified = #{record.gmtOutStockModified,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.bailuntec.domain.entity.DcMidTransit">
......@@ -466,17 +470,18 @@
quantity_out_stock = #{quantityOutStock,jdbcType=INTEGER},
gmt_out_stock_modified = #{gmtOutStockModified,jdbcType=TIMESTAMP}
</insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcMidTransitExample" resultMap="BaseResultMap">
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcMidTransitExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from dc_mid_transit
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
......@@ -486,65 +491,63 @@
<insert id="calculateTransferTransit">
insert into dc_mid_transit(bailun_sku, warehouse_code, quantity_transfer,gmt_transfer_modified)
SELECT
tb5.bailun_sku bailun_sku,
insert into dc_mid_transit(bailun_sku, warehouse_code, quantity_transfer, gmt_transfer_modified)
select bailun_sku, warehouse_code, sum(count), CURRENT_TIMESTAMP
from (
SELECT tb5.bailun_sku bailun_sku,
tb5.warehouse_code warehouse_code,
( tb5.count - IFNULL( tb4.count, 0 ) ) AS count,
CURRENT_TIMESTAMP
FROM
(
SELECT
tb1.bailun_sku,
(tb5.count - IFNULL(tb4.count, 0)) AS count
FROM (
SELECT tb1.bailun_sku,
tb1.warehouse_code,
sum( tb1.count ) count
FROM
dc_base_transfer_bale tb1
sum(tb1.count) count
FROM dc_base_transfer_bale tb1
LEFT JOIN dc_base_transfer_complete tb2 ON tb1.deleted = tb2.deleted
AND tb1.bailun_sku = tb2.bailun_sku
AND tb1.warehouse_code = tb2.warehouse_code
AND tb1.transfer_order_id = tb2.transfer_order_id
WHERE
tb2.bailun_sku IS NULL
WHERE tb2.bailun_sku IS NULL
AND tb1.deleted = 0
GROUP BY
bailun_sku,
GROUP BY bailun_sku,
warehouse_code
) tb5
LEFT JOIN (
SELECT
bailun_sku,
SELECT bailun_sku,
warehouse_code,
sum( count ) count
FROM
(
SELECT
tb1.bailun_sku,
sum(count) count
FROM (
SELECT tb1.bailun_sku,
tb1.warehouse_code,
max( tb1.count ) count,
max(tb1.count) count,
tb1.transfer_order_id
FROM
dc_base_transfer_inbound tb1
FROM dc_base_transfer_inbound tb1
LEFT JOIN dc_base_transfer_complete tb2 ON tb2.deleted = 0
AND tb1.bailun_sku = tb2.bailun_sku
AND tb1.warehouse_code = tb2.warehouse_code
AND tb1.transfer_order_id = tb2.transfer_order_id
WHERE
tb2.bailun_sku IS NULL
WHERE tb2.bailun_sku IS NULL
AND tb1.deleted = 0
GROUP BY
bailun_sku,
GROUP BY bailun_sku,
warehouse_code,
transfer_order_id
) tb3
GROUP BY
bailun_sku,
GROUP BY bailun_sku,
warehouse_code
) tb4
ON tb5.bailun_sku = tb4.bailun_sku
AND tb5.warehouse_code = tb4.warehouse_code
WHERE ( tb5.count - IFNULL( tb4.count, 0 ) ) > 0
ON DUPLICATE KEY UPDATE quantity_transfer = VALUES(quantity_transfer),gmt_transfer_modified = VALUES(gmt_transfer_modified)
WHERE (tb5.count - IFNULL(tb4.count, 0)) > 0
union
select bailun_sku, warehouse_code, sum(count) AS count
from dc_base_transfer_plan
where status = 1
and deleted = 0
group by bailun_sku, warehouse_code
) t
group by bailun_sku, warehouse_code
ON DUPLICATE KEY UPDATE quantity_transfer = VALUES(quantity_transfer),
gmt_transfer_modified = VALUES(gmt_transfer_modified)
</insert>
<insert id="calculatePurchaseTransit">
......
......@@ -706,5 +706,7 @@ FROM
AND tb5.transfer_order_id = tb4.transfer_order_id
WHERE
( tb11.count - IFNULL( tb4.count, 0 ) ) > 0
union select bailun_sku,warehouse_code,transfer_plan_order_id,null,update_time,count from dc_base_transfer_plan where status = 1 and deleted=0 AND bailun_sku = #{bailunSku}
AND warehouse_code = #{warehouseCode}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment