|
|
@@ -3083,6 +3083,7 @@
|
|
|
left join dkic_b.t_psi_outbound tpo on tpo.out_id = tpoi.out_id
|
|
|
</if>
|
|
|
<include refid="getSaleProfitCond"/>
|
|
|
+ <include refid="getSaleProfitDateCond"/>
|
|
|
<if test="orgIds!=null and orgIds.size()>0">
|
|
|
and (
|
|
|
tpo.org_id = any(#{orgIds, typeHandler=com.dk.common.infrastructure.handler.UuidListTypeHandler})
|
|
|
@@ -3104,7 +3105,7 @@
|
|
|
</if>
|
|
|
<include refid="getSaleProfitInOutBound"/>
|
|
|
from dkic_b.t_psi_outbound_item tpoi
|
|
|
- where tpoi.cp_id = #{cpId} and tpoi.out_status = '出库状态-已出库'
|
|
|
+ <include refid="getSaleProfitCond"/>
|
|
|
AND tpoi.op_create_time >= now() - interval
|
|
|
<if test="byDate==null or (byDate!=null and byDate=='false')">
|
|
|
'1 year'
|
|
|
@@ -3135,6 +3136,7 @@
|
|
|
from dkic_b.t_psi_outbound_item tpoi
|
|
|
left join dkic_b.t_psi_outbound tpo on tpo.out_id = tpoi.out_id
|
|
|
<include refid="getSaleProfitCond"/>
|
|
|
+ <include refid="getSaleProfitDateCond"/>
|
|
|
group by tpo.org_id) t
|
|
|
) tt
|
|
|
left join dkic_b.t_mst_org tmo on tmo.org_id = tt.org_id
|
|
|
@@ -3152,6 +3154,7 @@
|
|
|
from dkic_b.t_psi_outbound_item tpoi
|
|
|
left join dkic_b.t_psi_outbound tpo on tpo.out_id = tpoi.out_id
|
|
|
<include refid="getSaleProfitCond"/>
|
|
|
+ <include refid="getSaleProfitDateCond"/>
|
|
|
<if test="orgIds!=null and orgIds.size()>0">
|
|
|
and (
|
|
|
tpo.org_id = any(#{orgIds, typeHandler=com.dk.common.infrastructure.handler.UuidListTypeHandler})
|
|
|
@@ -3173,6 +3176,7 @@
|
|
|
<include refid="getSaleProfitInOutBound"/>
|
|
|
from dkic_b.t_psi_outbound_item tpoi
|
|
|
<include refid="getSaleProfitCond"/>
|
|
|
+ <include refid="getSaleProfitDateCond"/>
|
|
|
group by sku_id) t
|
|
|
) tt
|
|
|
left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = tt.sku_id
|
|
|
@@ -3185,7 +3189,10 @@
|
|
|
</sql>
|
|
|
|
|
|
<sql id="getSaleProfitCond">
|
|
|
- where tpoi.cp_id = #{cpId} and tpoi.out_status = '出库状态-已出库'
|
|
|
+ where tpoi.cp_id = #{cpId} and tpoi.out_status = '出库状态-已出库' and tpoi.sku_id is not null
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="getSaleProfitDateCond">
|
|
|
<if test="makeTimeStart != null and makeTimeEnd != null">
|
|
|
AND tpoi.op_create_time >= #{makeTimeStart}::timestamp with time zone
|
|
|
AND tpoi.op_create_time < #{makeTimeEnd}::timestamp with time zone + interval '1 day'
|