Commit d5dadeee by wutong

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

parent 669f8b1b
...@@ -6,15 +6,15 @@ ...@@ -6,15 +6,15 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id"/>
<result column="bailun_sku" jdbcType="VARCHAR" property="bailunSku" /> <result column="bailun_sku" jdbcType="VARCHAR" property="bailunSku"/>
<result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode" /> <result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode"/>
<result column="quantity_purchase" jdbcType="INTEGER" property="quantityPurchase" /> <result column="quantity_purchase" jdbcType="INTEGER" property="quantityPurchase"/>
<result column="gmt_purchase_modified" jdbcType="TIMESTAMP" property="gmtPurchaseModified" /> <result column="gmt_purchase_modified" jdbcType="TIMESTAMP" property="gmtPurchaseModified"/>
<result column="quantity_transfer" jdbcType="INTEGER" property="quantityTransfer" /> <result column="quantity_transfer" jdbcType="INTEGER" property="quantityTransfer"/>
<result column="gmt_transfer_modified" jdbcType="TIMESTAMP" property="gmtTransferModified" /> <result column="gmt_transfer_modified" jdbcType="TIMESTAMP" property="gmtTransferModified"/>
<result column="quantity_out_stock" jdbcType="INTEGER" property="quantityOutStock" /> <result column="quantity_out_stock" jdbcType="INTEGER" property="quantityOutStock"/>
<result column="gmt_out_stock_modified" jdbcType="TIMESTAMP" property="gmtOutStockModified" /> <result column="gmt_out_stock_modified" jdbcType="TIMESTAMP" property="gmtOutStockModified"/>
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
...@@ -71,7 +72,8 @@ ...@@ -71,7 +72,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
...@@ -90,7 +92,8 @@ ...@@ -90,7 +92,8 @@
id, bailun_sku, warehouse_code, quantity_purchase, gmt_purchase_modified, quantity_transfer, id, bailun_sku, warehouse_code, quantity_purchase, gmt_purchase_modified, quantity_transfer,
gmt_transfer_modified, quantity_out_stock, gmt_out_stock_modified gmt_transfer_modified, quantity_out_stock, gmt_out_stock_modified
</sql> </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 WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
...@@ -99,10 +102,10 @@ ...@@ -99,10 +102,10 @@
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from dc_mid_transit from dc_mid_transit
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause"/>
</if> </if>
<if test="orderByClause != null"> <if test="orderByClause != null">
order by ${orderByClause} order by ${orderByClause}
...@@ -122,7 +125,7 @@ ...@@ -122,7 +125,7 @@
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from dc_mid_transit from dc_mid_transit
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
...@@ -141,7 +144,7 @@ ...@@ -141,7 +144,7 @@
--> -->
delete from dc_mid_transit delete from dc_mid_transit
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause"/>
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.bailuntec.domain.entity.DcMidTransit"> <insert id="insert" parameterType="com.bailuntec.domain.entity.DcMidTransit">
...@@ -225,14 +228,15 @@ ...@@ -225,14 +228,15 @@
</if> </if>
</trim> </trim>
</insert> </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 WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
select count(*) from dc_mid_transit select count(*) from dc_mid_transit
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause"/>
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
...@@ -271,7 +275,7 @@ ...@@ -271,7 +275,7 @@
</if> </if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
...@@ -290,7 +294,7 @@ ...@@ -290,7 +294,7 @@
quantity_out_stock = #{record.quantityOutStock,jdbcType=INTEGER}, quantity_out_stock = #{record.quantityOutStock,jdbcType=INTEGER},
gmt_out_stock_modified = #{record.gmtOutStockModified,jdbcType=TIMESTAMP} gmt_out_stock_modified = #{record.gmtOutStockModified,jdbcType=TIMESTAMP}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="com.bailuntec.domain.entity.DcMidTransit"> <update id="updateByPrimaryKeySelective" parameterType="com.bailuntec.domain.entity.DcMidTransit">
...@@ -466,17 +470,18 @@ ...@@ -466,17 +470,18 @@
quantity_out_stock = #{quantityOutStock,jdbcType=INTEGER}, quantity_out_stock = #{quantityOutStock,jdbcType=INTEGER},
gmt_out_stock_modified = #{gmtOutStockModified,jdbcType=TIMESTAMP} gmt_out_stock_modified = #{gmtOutStockModified,jdbcType=TIMESTAMP}
</insert> </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 WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin @project https://github.com/itfsw/mybatis-generator-plugin
--> -->
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from dc_mid_transit from dc_mid_transit
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause"/>
</if> </if>
<if test="orderByClause != null"> <if test="orderByClause != null">
order by ${orderByClause} order by ${orderByClause}
...@@ -486,65 +491,63 @@ ...@@ -486,65 +491,63 @@
<insert id="calculateTransferTransit"> <insert id="calculateTransferTransit">
insert into dc_mid_transit(bailun_sku, warehouse_code, quantity_transfer,gmt_transfer_modified) insert into dc_mid_transit(bailun_sku, warehouse_code, quantity_transfer, gmt_transfer_modified)
SELECT select bailun_sku, warehouse_code, sum(count), CURRENT_TIMESTAMP
tb5.bailun_sku bailun_sku, from (
SELECT tb5.bailun_sku bailun_sku,
tb5.warehouse_code warehouse_code, tb5.warehouse_code warehouse_code,
( tb5.count - IFNULL( tb4.count, 0 ) ) AS count, (tb5.count - IFNULL(tb4.count, 0)) AS count
CURRENT_TIMESTAMP FROM (
FROM SELECT tb1.bailun_sku,
(
SELECT
tb1.bailun_sku,
tb1.warehouse_code, tb1.warehouse_code,
sum( tb1.count ) count sum(tb1.count) count
FROM FROM dc_base_transfer_bale tb1
dc_base_transfer_bale tb1
LEFT JOIN dc_base_transfer_complete tb2 ON tb1.deleted = tb2.deleted LEFT JOIN dc_base_transfer_complete tb2 ON tb1.deleted = tb2.deleted
AND tb1.bailun_sku = tb2.bailun_sku AND tb1.bailun_sku = tb2.bailun_sku
AND tb1.warehouse_code = tb2.warehouse_code AND tb1.warehouse_code = tb2.warehouse_code
AND tb1.transfer_order_id = tb2.transfer_order_id AND tb1.transfer_order_id = tb2.transfer_order_id
WHERE WHERE tb2.bailun_sku IS NULL
tb2.bailun_sku IS NULL
AND tb1.deleted = 0 AND tb1.deleted = 0
GROUP BY GROUP BY bailun_sku,
bailun_sku,
warehouse_code warehouse_code
) tb5 ) tb5
LEFT JOIN ( LEFT JOIN (
SELECT SELECT bailun_sku,
bailun_sku,
warehouse_code, warehouse_code,
sum( count ) count sum(count) count
FROM FROM (
( SELECT tb1.bailun_sku,
SELECT
tb1.bailun_sku,
tb1.warehouse_code, tb1.warehouse_code,
max( tb1.count ) count, max(tb1.count) count,
tb1.transfer_order_id tb1.transfer_order_id
FROM FROM dc_base_transfer_inbound tb1
dc_base_transfer_inbound tb1
LEFT JOIN dc_base_transfer_complete tb2 ON tb2.deleted = 0 LEFT JOIN dc_base_transfer_complete tb2 ON tb2.deleted = 0
AND tb1.bailun_sku = tb2.bailun_sku AND tb1.bailun_sku = tb2.bailun_sku
AND tb1.warehouse_code = tb2.warehouse_code AND tb1.warehouse_code = tb2.warehouse_code
AND tb1.transfer_order_id = tb2.transfer_order_id AND tb1.transfer_order_id = tb2.transfer_order_id
WHERE WHERE tb2.bailun_sku IS NULL
tb2.bailun_sku IS NULL
AND tb1.deleted = 0 AND tb1.deleted = 0
GROUP BY GROUP BY bailun_sku,
bailun_sku,
warehouse_code, warehouse_code,
transfer_order_id transfer_order_id
) tb3 ) tb3
GROUP BY GROUP BY bailun_sku,
bailun_sku,
warehouse_code warehouse_code
) tb4 ) tb4
ON tb5.bailun_sku = tb4.bailun_sku ON tb5.bailun_sku = tb4.bailun_sku
AND tb5.warehouse_code = tb4.warehouse_code AND tb5.warehouse_code = tb4.warehouse_code
WHERE ( tb5.count - IFNULL( tb4.count, 0 ) ) > 0 WHERE (tb5.count - IFNULL(tb4.count, 0)) > 0
ON DUPLICATE KEY UPDATE quantity_transfer = VALUES(quantity_transfer),gmt_transfer_modified = VALUES(gmt_transfer_modified) 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>
<insert id="calculatePurchaseTransit"> <insert id="calculatePurchaseTransit">
......
...@@ -706,5 +706,7 @@ FROM ...@@ -706,5 +706,7 @@ FROM
AND tb5.transfer_order_id = tb4.transfer_order_id AND tb5.transfer_order_id = tb4.transfer_order_id
WHERE WHERE
( tb11.count - IFNULL( tb4.count, 0 ) ) > 0 ( 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> </select>
</mapper> </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