|
|
@@ -721,14 +721,125 @@
|
|
|
SELECT
|
|
|
ti.item_id,ti.price_into,ti.cost_price,ti.cost_amt
|
|
|
FROM dkic_b.t_psi_inbound_item ti
|
|
|
- left join dkic_b.t_psi_inbound t ON ti.order_id = t.order_id
|
|
|
+ left join dkic_b.t_psi_inbound t ON ti.into_id = t.into_id
|
|
|
where t.flg_valid
|
|
|
and ti.flg_valid
|
|
|
and ti.price_into > 0
|
|
|
and t.into_type != '外协入库'
|
|
|
- and ti.wh_id #{whId}
|
|
|
- and ti.sku_id =#{skuId}
|
|
|
+ and ti.wh_id = #{whId}::uuid
|
|
|
+ and ti.sku_id =#{skuId}::uuid
|
|
|
and ti.non_std_code = #{nonStdCode}
|
|
|
order by make_time desc
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectCostCheckList" resultType="map">
|
|
|
+ SELECT
|
|
|
+ tpii.sku_model AS "skuModel",
|
|
|
+ tpii.sku_name AS "skuName",
|
|
|
+ tpii.sku_id AS "skuId",
|
|
|
+ tpii.cost_price AS "costPrice",
|
|
|
+ tpii.cost_amt AS "costAmt",
|
|
|
+ tmgs.brand_id AS "brandId",
|
|
|
+ json_agg(json_build_object(
|
|
|
+ 'itemId', tpii.item_id,
|
|
|
+ 'intoId', tpii.into_id,
|
|
|
+ 'invId', tpii.inv_id,
|
|
|
+ 'fromId', tpii.from_id,
|
|
|
+ 'fromItemId', tpii.from_item_id,
|
|
|
+ 'skuModel', tpii.sku_model,
|
|
|
+ 'skuName', tpii.sku_name,
|
|
|
+ 'skuId', tpii.sku_id,
|
|
|
+ 'intoQty', tpii.into_qty,
|
|
|
+ 'costPrice', tpii.cost_price,
|
|
|
+ 'costAmt', tpii.cost_amt,
|
|
|
+ 'brandId', tmgs.brand_id
|
|
|
+ )) AS "itemList"
|
|
|
+ FROM
|
|
|
+ dkic_b.t_psi_inbound_item tpii
|
|
|
+ LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpii.sku_id
|
|
|
+ <where>
|
|
|
+ tpii.cost_price = 0
|
|
|
+ AND tpii.into_qty != 0
|
|
|
+ AND tpii.sku_model is not null
|
|
|
+ <if test="intoId != null and intoId != ''">
|
|
|
+ AND tpii.into_id = #{intoId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="cpId != null">
|
|
|
+ AND tpii.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ <if test="brandId != null">
|
|
|
+ AND tmgs.brand_id = #{brandId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="viewNoCostDocuments !=null and viewNoCostDocuments == true">
|
|
|
+ AND tpii.flg_cost_check = false
|
|
|
+ </if>
|
|
|
+ <if test="staffName !=null">
|
|
|
+ AND tmss.staff_name LIKE concat('%',my_ex.likequery(#{staffName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="intoStatusList != null and intoStatusList.size()>0">
|
|
|
+ AND tpii.into_status =
|
|
|
+ any(#{intoStatusList, typeHandler= StringListTypeHandler})
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ tpii.sku_model,
|
|
|
+ tpii.sku_name,
|
|
|
+ tpii.sku_id,
|
|
|
+ tpii.cost_price,
|
|
|
+ tpii.cost_amt,
|
|
|
+ tmgs.brand_id
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
+ limit #{end} offset #{start}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countByCondList" resultType="Long">
|
|
|
+ SELECT COUNT
|
|
|
+ ( 1 )
|
|
|
+ FROM (
|
|
|
+ SELECT COUNT
|
|
|
+ ( 1 )
|
|
|
+ FROM
|
|
|
+ dkic_b.t_psi_inbound_item tpii
|
|
|
+ LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpii.sku_id
|
|
|
+ <where>
|
|
|
+ tpii.cost_price = 0
|
|
|
+ AND tpii.into_qty != 0
|
|
|
+ AND tpii.sku_model is not null
|
|
|
+ <if test="intoId != null and intoId != ''">
|
|
|
+ AND tpii.into_id = #{intoId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="cpId != null">
|
|
|
+ AND tpii.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ <if test="brandId != null">
|
|
|
+ AND tmgs.brand_id = #{brandId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="viewNoCostDocuments !=null and viewNoCostDocuments == true">
|
|
|
+ AND tpii.flg_cost_check = false
|
|
|
+ </if>
|
|
|
+ <if test="staffName !=null">
|
|
|
+ AND tmss.staff_name LIKE concat('%',my_ex.likequery(#{staffName}),'%')
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="intoStatusList != null and intoStatusList.size()>0">
|
|
|
+ AND tpii.into_status =
|
|
|
+ any(#{intoStatusList, typeHandler= StringListTypeHandler})
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ tpii.sku_model,
|
|
|
+ tpii.sku_name,
|
|
|
+ tpii.sku_id,
|
|
|
+ tpii.cost_price,
|
|
|
+ tpii.cost_amt ) AS "a"
|
|
|
+
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|