|
|
@@ -138,7 +138,6 @@
|
|
|
</if>
|
|
|
<if test="invQtyFlag != null and invQtyFlag = true">
|
|
|
and tpi.inv_qty != 0
|
|
|
-
|
|
|
</if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
@@ -305,6 +304,170 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
+ <select id="warningCountByCond" resultType="java.lang.Long">
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM dkic_b.t_psi_inventory tpi
|
|
|
+ <include refid="Join_Table"/>
|
|
|
+ <where>
|
|
|
+ (tmgs.warning_lower_limit <> 0 OR tmgs.warning_upper_limit <> 0)
|
|
|
+ AND (tpi.inv_qty > tmgs.warning_lower_limit OR tpi.inv_qty > tmgs.warning_upper_limit)
|
|
|
+ <if test="whId != null and whId != ''">
|
|
|
+ AND tpi.wh_id = #{whId}::UUID
|
|
|
+ </if>
|
|
|
+ <if test="whIds != null and whIds.size()>0">
|
|
|
+ AND tpi.wh_id =
|
|
|
+ any(#{whIds, typeHandler=UuidListTypeHandler})
|
|
|
+ </if>
|
|
|
+ <if test="skuId != null and skuId != ''">
|
|
|
+ AND tpi.sku_id = #{skuId}
|
|
|
+ </if>
|
|
|
+ <if test="nonStdCode != null and nonStdCode != ''">
|
|
|
+ AND tpi.non_std_code = #{nonStdCode}
|
|
|
+ </if>
|
|
|
+ <if test="invQty != null">
|
|
|
+ AND tpi.inv_qty = #{invQty}
|
|
|
+ </if>
|
|
|
+ <if test="outingQty != null">
|
|
|
+ AND tpi.outing_qty = #{outingQty}
|
|
|
+ </if>
|
|
|
+ <if test="usableQty != null">
|
|
|
+ AND tpi.usable_qty = #{usableQty}
|
|
|
+ </if>
|
|
|
+ <if test="costPrice != null">
|
|
|
+ AND tpi.cost_price = #{costPrice}
|
|
|
+ </if>
|
|
|
+ <if test="costAmt != null">
|
|
|
+ AND tpi.cost_amt = #{costAmt}
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ AND tpi.flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+ <if test="flgZero == true">
|
|
|
+ AND tpi.inv_qty != 0
|
|
|
+ </if>
|
|
|
+ <if test="cpId != null">
|
|
|
+ AND tpi.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ <if test="freezeQty != null">
|
|
|
+ AND tpi.freeze_qty = #{freezeQty}
|
|
|
+ </if>
|
|
|
+ <if test="categoryId != null and categoryId != ''">
|
|
|
+ AND tmgs.category_id = #{categoryId}::UUID
|
|
|
+ </if>
|
|
|
+ <if test="brandId != null and brandId != ''">
|
|
|
+ AND tmgs.brand_id = #{brandId}::UUID
|
|
|
+ </if>
|
|
|
+ <if test="searchText != null">
|
|
|
+ AND (tmgs.sku_model like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ OR tmgs.sku_name like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ OR tpi.non_std_code like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="invQtyFlag != null and invQtyFlag = true">
|
|
|
+ and tpi.inv_qty != 0
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="warningSelectByCond" resultType="com.dk.mdm.model.response.ivt.InventoryResponse">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List_Response"/>
|
|
|
+ ,tmgs.sku_code
|
|
|
+ ,tmgs.sku_model
|
|
|
+ ,tmgs.sku_name
|
|
|
+ ,tmgs.sku_spec
|
|
|
+ ,tmgs.price_purchase
|
|
|
+ ,tmgs.price_standard
|
|
|
+ ,tmgs.price_wholesale
|
|
|
+ ,tmgs.price_other
|
|
|
+ ,tmgs.price_limited
|
|
|
+ ,tmgs.sku_images
|
|
|
+ ,tmgs.unit_id
|
|
|
+ ,tmgs.sub_unit_id
|
|
|
+ ,tmgs.warning_upper_limit
|
|
|
+ ,tmgs.warning_lower_limit
|
|
|
+ ,tmgs.pack_box
|
|
|
+ ,tmu.unit_name AS "unitName"
|
|
|
+ ,subtmu.unit_name AS "subUnitName"
|
|
|
+ ,tmgs.flg_sub_unit
|
|
|
+ ,tmgb.brand_name
|
|
|
+ ,tmgb.short_name
|
|
|
+ ,tmw.wh_name
|
|
|
+ ,tmgc.cat_name as "catName"
|
|
|
+ ,tmgseries.series_name as "seriesName"
|
|
|
+ ,tmu.decimal_places as "decimalPlaces"
|
|
|
+ FROM dkic_b.t_psi_inventory tpi
|
|
|
+ <include refid="Join_Table"/>
|
|
|
+ <where>
|
|
|
+ (tmgs.warning_lower_limit <> 0 OR tmgs.warning_upper_limit <> 0)
|
|
|
+ AND (tpi.inv_qty > tmgs.warning_lower_limit OR tpi.inv_qty > tmgs.warning_upper_limit)
|
|
|
+ <if test="whId != null and whId != ''">
|
|
|
+ AND tpi.wh_id = #{whId}::UUID
|
|
|
+ </if>
|
|
|
+ <if test="whIds != null and whIds.size()>0">
|
|
|
+ AND tpi.wh_id =
|
|
|
+ any(#{whIds, typeHandler=UuidListTypeHandler})
|
|
|
+ </if>
|
|
|
+ <if test="skuId != null and skuId != ''">
|
|
|
+ AND tpi.sku_id = #{skuId}
|
|
|
+ </if>
|
|
|
+ <if test="nonStdCode != null and nonStdCode != ''">
|
|
|
+ AND tpi.non_std_code = #{nonStdCode}
|
|
|
+ </if>
|
|
|
+ <if test="invQty != null">
|
|
|
+ AND tpi.inv_qty = #{invQty}
|
|
|
+ </if>
|
|
|
+ <if test="outingQty != null">
|
|
|
+ AND tpi.outing_qty = #{outingQty}
|
|
|
+ </if>
|
|
|
+ <if test="usableQty != null">
|
|
|
+ AND tpi.usable_qty = #{usableQty}
|
|
|
+ </if>
|
|
|
+ <if test="costPrice != null">
|
|
|
+ AND tpi.cost_price = #{costPrice}
|
|
|
+ </if>
|
|
|
+ <if test="costAmt != null">
|
|
|
+ AND tpi.cost_amt = #{costAmt}
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ AND tpi.flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+ <if test="flgZero == true">
|
|
|
+ AND tpi.inv_qty != 0
|
|
|
+ </if>
|
|
|
+ <if test="cpId != null">
|
|
|
+ AND tpi.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ <if test="freezeQty != null">
|
|
|
+ AND tpi.freeze_qty = #{freezeQty}
|
|
|
+ </if>
|
|
|
+ <if test="categoryId != null and categoryId != ''">
|
|
|
+ AND tmgs.category_id = #{categoryId}::UUID
|
|
|
+ </if>
|
|
|
+ <if test="brandId != null and brandId != ''">
|
|
|
+ AND tmgs.brand_id = #{brandId}::UUID
|
|
|
+ </if>
|
|
|
+ <if test="searchText != null">
|
|
|
+ AND (tmgs.sku_model like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ OR tmgs.sku_name like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ OR tpi.non_std_code like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="invQtyFlag != null and invQtyFlag = true">
|
|
|
+ and tpi.inv_qty != 0
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <if test="desc != null and desc != ''">
|
|
|
+ order by tpi.usable_qty desc
|
|
|
+ </if>
|
|
|
+ <if test="desc == null or desc == ''">
|
|
|
+ order by tpi.usable_qty
|
|
|
+ </if>
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
+ limit #{end} offset #{start}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
|
|
|
<!--修改库存数量金额-->
|
|
|
<update id="updateAmountAndQuantity" parameterType="com.dk.mdm.model.vo.ivt.InventoryVO">
|