|
|
@@ -2,5 +2,65 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.dk.mdm.mapper.report.ReportMapper">
|
|
|
|
|
|
+ <!--库存查询-->
|
|
|
+ <select id="getIvtDetailReport" resultType="java.util.Map">
|
|
|
+ select tpi.inv_id as "invId",
|
|
|
+ tpi.sku_id as "skuId",
|
|
|
+ tmgs.sku_code as "skuCode",
|
|
|
+ tmgs.sku_name as "skuName",
|
|
|
+ tmgs.sku_model as "skuModel",
|
|
|
+ tmgs.brand_id as "brandId",
|
|
|
+ tmgb.brand_name as "brandName",
|
|
|
+ tmgs.category_id as "categoryId",
|
|
|
+ tmgc.cat_name as "categoryName",
|
|
|
+ tmgs.unit_id as "unitId",
|
|
|
+ tmgu.unit_name as "unitName",
|
|
|
+ tmgs.sub_unit_id as "subUnitId",
|
|
|
+ tmgs.conversion_factor as "conversionFactor",
|
|
|
+ tmgs.series_id as "seriesId",
|
|
|
+ tmgseries.series_name as "seriesName",
|
|
|
+ tmgs.sku_spec as "skuSpec",
|
|
|
+ tmgs.price_purchase as "pricePurchase",
|
|
|
+ tmgs.price_standard as "priceStandard",
|
|
|
+ tmgs.price_wholesale as "priceWholesale",
|
|
|
+ tmgs.price_limited as "priceLimited",
|
|
|
+ tmgs.sku_images as "skuImages",
|
|
|
+ tpi.non_std_code as "nonStdCode",
|
|
|
+ tpi.inv_qty as "invQty",
|
|
|
+ tpi.outing_qty as "outingQty",
|
|
|
+ tpi.usable_qty as "usableQty",
|
|
|
+ tpi.wh_id as "whId",
|
|
|
+ tmw.wh_code as "whCode",
|
|
|
+ tmw.wh_name as "whName",
|
|
|
+ dkic_b.f_get_last_ivt_price(tpi.inv_id,null,null,null) as "priceInto",
|
|
|
+ tpi.remarks
|
|
|
+ from dkic_b.t_psi_inventory as tpi
|
|
|
+ inner join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
|
|
|
+ inner join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = tpi.sku_id
|
|
|
+ left join dkic_b.t_mst_goods_brand as tmgb on tmgs.brand_id = tmgb.brand_id
|
|
|
+ left join dkic_b.t_mst_goods_category as tmgc on tmgs.category_id = tmgc.cat_id
|
|
|
+ left join dkic_b.t_mst_goods_series as tmgseries on tmgs.series_id = tmgseries.series_id
|
|
|
+ left join dkic_b.t_mst_unit as tmgu on tmgs.unit_id = tmgu.unit_id
|
|
|
+ where tpi.flg_valid
|
|
|
+ AND tpi.cp_id = #{cpId}
|
|
|
+ <if test="skuId != null">
|
|
|
+ AND tpi.sku_id = #{skuId} ::uuid
|
|
|
+ </if>
|
|
|
+ <if test="nonStdCode != null">
|
|
|
+ AND tpi.non_std_code = #{nonStdCode}
|
|
|
+ </if>
|
|
|
+ <if test="skuCode != null">
|
|
|
+ AND tmgs.sku_code LIKE concat('%',my_ex.likequery(#{skuCode}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="skuName != null">
|
|
|
+ AND tmgs.sku_name LIKE concat('%',my_ex.likequery(#{skuName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="whName != null">
|
|
|
+ AND tmgs.wh_name LIKE concat('%',my_ex.likequery(#{whName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="whId != null">
|
|
|
+ AND tpi.wh_id = #{whId} ::uuid
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|