|
@@ -1097,6 +1097,115 @@
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ <!-- 销售明细查询 -->
|
|
|
|
|
+ <select id="getSalesItemReport" resultType="java.util.Map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ t.item_id AS "itemId",
|
|
|
|
|
+ t.order_id AS "orderId",
|
|
|
|
|
+ t.item_index AS "itemIndex",
|
|
|
|
|
+ t.sku_id AS "skuId",
|
|
|
|
|
+ tmgs.sku_code as "skuCode",
|
|
|
|
|
+ tmgs.sku_model as "skuModel",
|
|
|
|
|
+ tmgs.sku_name as "skuName",
|
|
|
|
|
+ t.item_qty AS "itemQty",
|
|
|
|
|
+ t.price_std AS "priceStd",
|
|
|
|
|
+ t.amt_std AS "amtStd",
|
|
|
|
|
+ t.price_sale AS "priceSale",
|
|
|
|
|
+ t.item_amt AS "itemAmt",
|
|
|
|
|
+ t.price_discount AS "priceDiscount",
|
|
|
|
|
+ t.non_std_code AS "nonStdCode",
|
|
|
|
|
+ t.out_status AS "outStatus",
|
|
|
|
|
+ t.outing_qty AS "outingQty",
|
|
|
|
|
+ t.outing_amt AS "outingAmt",
|
|
|
|
|
+ t.out_qty AS "outQty",
|
|
|
|
|
+ t.out_amt AS "outAmt",
|
|
|
|
|
+ t.return_qty AS "returnQty",
|
|
|
|
|
+ t.return_amt AS "returnAmt",
|
|
|
|
|
+ t.remarks,
|
|
|
|
|
+ t.wh_id AS "whId",
|
|
|
|
|
+ tmw.wh_name AS "whName"
|
|
|
|
|
+ FROM dkic_b.t_psi_order_item as t
|
|
|
|
|
+ inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
|
|
|
|
|
+ left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = t.wh_id
|
|
|
|
|
+ <include refid="ConditionSaleItem"/>
|
|
|
|
|
+ order by t.item_index
|
|
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
|
|
+ limit #{end} offset #{start}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <sql id="ConditionSaleItem">
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="orderId != null and orderId != ''">
|
|
|
|
|
+ AND t.order_id = #{orderId}::uuid
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="itemIndex != null">
|
|
|
|
|
+ AND t.item_index = #{itemIndex}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="skuId != null and skuId != ''">
|
|
|
|
|
+ AND t.sku_id = #{skuId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="itemQty != null">
|
|
|
|
|
+ AND t.item_qty = #{itemQty}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="priceStd != null">
|
|
|
|
|
+ AND t.price_std = #{priceStd}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="amtStd != null">
|
|
|
|
|
+ AND t.amt_std = #{amtStd}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="priceSale != null">
|
|
|
|
|
+ AND t.price_sale = #{priceSale}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="itemAmt != null">
|
|
|
|
|
+ AND t.item_amt = #{itemAmt}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="priceDiscount != null">
|
|
|
|
|
+ AND t.price_discount = #{priceDiscount}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="nonStdCode != null and nonStdCode != ''">
|
|
|
|
|
+ AND t.non_std_code = #{nonStdCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="outStatus != null and outStatus != ''">
|
|
|
|
|
+ AND t.out_status = #{outStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="outingQty != null">
|
|
|
|
|
+ AND t.outing_qty = #{outingQty}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="outingAmt != null">
|
|
|
|
|
+ AND t.outing_amt = #{outingAmt}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="outQty != null">
|
|
|
|
|
+ AND t.out_qty = #{outQty}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="outAmt != null">
|
|
|
|
|
+ AND t.out_amt = #{outAmt}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="returnQty != null">
|
|
|
|
|
+ AND t.return_qty = #{returnQty}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="returnAmt != null">
|
|
|
|
|
+ AND t.return_amt = #{returnAmt}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="remarks != null and remarks != ''">
|
|
|
|
|
+ AND t.remarks = #{remarks}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="flgValid != null">
|
|
|
|
|
+ AND t.flg_valid = #{flgValid}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="cpId != null">
|
|
|
|
|
+ AND t.cp_id = #{cpId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </sql>
|
|
|
|
|
+ <select id="getSalesItemReportCount" resultType="java.lang.Long">
|
|
|
|
|
+ SELECT count(1)
|
|
|
|
|
+ FROM
|
|
|
|
|
+ FROM dkic_b.t_psi_order_item t
|
|
|
|
|
+ <include refid="ConditionSaleItem"/>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
<select id="getSalesTrackingReportCount" resultType="java.lang.Long">
|
|
<select id="getSalesTrackingReportCount" resultType="java.lang.Long">
|
|
|
SELECT count(1)
|
|
SELECT count(1)
|
|
|
FROM
|
|
FROM
|
|
@@ -1104,6 +1213,7 @@
|
|
|
<include refid="ConditionSalesTrackingReport"/>
|
|
<include refid="ConditionSalesTrackingReport"/>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
+
|
|
|
<select id="getSalesTrackingReportDetail" resultType="java.util.Map">
|
|
<select id="getSalesTrackingReportDetail" resultType="java.util.Map">
|
|
|
SELECT T
|
|
SELECT T
|
|
|
."id",
|
|
."id",
|