自动化立体仓库 - WMS系统
1
zhang
2025-10-20 00860b3f449e5b3289f2809c199dd56ec75d46e3
src/main/resources/mapper/OrderDetlMapper.xml
@@ -124,15 +124,45 @@
        and mdt.pakout = 1
        <include refid="pakOutPageCondition"></include>
    </select>
    <select id="checkAllDetlFinish" resultType="java.lang.Integer">
        SELECT count(*) From man_order_detl WHERE qty &lt; anfme and order_no = #{orderNo}
    </select>
    <select id="sameOrderComb" resultType="java.lang.Integer">
        SELECT SUM(anfme) FROM cust_wait_pakin WHERE  1=1
        <if test="orderNo!=null and orderNo!='' ">
            and order_no like '%' + #{orderNo} + '%'
        </if>
        and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch!=''  ">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </select>
    <select id="selectCountToAsrByMatnr" resultType="java.lang.Long">
        SELECT ISNULL(SUM(anfme), 0) FROM asr_loc_detl WHERE matnr = #{matnr}
        <if test="batch!=null and batch!='' ">
            and batch = #{batch}
        </if>
    </select>
    <select id="selectCountToManByMatnr" resultType="java.lang.Long">
        SELECT ISNULL(SUM(anfme), 0) FROM man_loc_detl WHERE matnr = #{matnr}
        <if test="batch!=null and batch!='' ">
            and batch = #{batch}
        </if>
    </select>
    <update id="increase">
        update man_order_detl
        set qty = qty + #{qty}
        set work_qty = work_qty + #{qty}
        where 1=1
        and order_id = #{orderId}
        and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch != ''">
            <when test="batch != null and batch!=''  ">
                and batch = #{batch}
            </when>
            <otherwise>
@@ -143,16 +173,16 @@
    <update id="decrease">
        update man_order_detl
        set qty = qty - #{qty}
        set work_qty = work_qty - #{qty}
        where 1=1
        and order_no = #{orderNo}
        and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch != ''">
            <when test="batch != null ">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
                and (batch IS NULL )
            </otherwise>
        </choose>
    </update>
@@ -168,6 +198,22 @@
        INSERT INTO man_order_detl_log SELECT * FROM man_order_detl WHERE id = #{id}
    </insert>
    <update id="increaseQtyByOrderNo">
        update man_order_detl
        set qty = qty + #{qty}
        where 1=1
        and order_no = #{orderNo}
        and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </update>
    <update id="increaseWorkQty">
        update man_order_detl
        set work_qty = work_qty + #{workQty}
@@ -184,4 +230,36 @@
        </choose>
    </update>
    <update id="increaseAnfme">
        update man_order_detl
        set anfme = anfme + #{qty}
        where 1=1
        and order_id = #{orderId}
        and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </update>
    <update id="increaseWorkQtyByOrderNo">
        update man_order_detl
        set work_qty = work_qty + #{qty}
        where 1=1
        and order_no = #{orderNo}
        and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </update>
</mapper>