|
|
@@ -326,7 +326,80 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
+ <sql id="ConditionIsSup">
|
|
|
+ <where>
|
|
|
+ <if test="intoNo != null and intoNo != ''">
|
|
|
+ AND tpi.into_no LIKE concat('%',my_ex.likequery(#{intoNo}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="intoType != null and intoType != ''">
|
|
|
+ AND tpi.into_type LIKE concat('%',my_ex.likequery(#{intoType}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="intoTypes != null and intoTypes.size()>0">
|
|
|
+ AND tpi.into_type =any(#{intoTypes,typeHandler=StringListTypeHandler})
|
|
|
+ </if>
|
|
|
+ <if test="intoReasonList != null and intoReasonList.size()>0">
|
|
|
+ AND tpi.into_reason =any(#{intoReasonList,typeHandler=UuidListTypeHandler})
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="fromId != null and fromId != ''">
|
|
|
+ AND tpi.from_id = #{fromId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="fromNo != null and fromNo != ''">
|
|
|
+ AND tpi.from_no LIKE concat('%',my_ex.likequery(#{fromNo}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="orgId != null and orgId != ''">
|
|
|
+ AND tpi.org_id = #{orgId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="orgName != null and orgName != ''">
|
|
|
+ AND tmo.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="supName != null and supName != ''">
|
|
|
+ AND tmp.sup_name LIKE concat('%',my_ex.likequery(#{supName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="staffName != null and staffName != ''">
|
|
|
+ AND tms.staff_name LIKE concat('%',my_ex.likequery(#{staffName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="whName != null and whName != ''">
|
|
|
+ AND tmw.wh_name LIKE concat('%',my_ex.likequery(#{whName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="staffId != null and staffId != ''">
|
|
|
+ AND tpi.staff_id = #{staffId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="cusId != null and cusId != ''">
|
|
|
+ AND tpi.cus_id = #{cusId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="supId != null and supId != ''">
|
|
|
+ AND tpi.sup_id = #{supId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="makeStaff != null and makeStaff != ''">
|
|
|
+ AND tpi.make_staff = #{makeStaff}
|
|
|
+ </if>
|
|
|
|
|
|
+ <if test="makeTime != null">
|
|
|
+ AND tpi.make_time = #{makeTime}
|
|
|
+ </if>
|
|
|
+ <if test="receivableId != null and receivableId != ''">
|
|
|
+ AND tpi.receivable_id = #{receivableId}
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ AND tpi.flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+ <if test="cpId != null">
|
|
|
+ AND tpi.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ <if test="searchText !=null and searchText != ''">
|
|
|
+ AND ( tpi.into_no LIKE concat('%',my_ex.likequery(#{searchText}),'%')
|
|
|
+ or (exists (select 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
|
|
|
+ tpi.into_id = tpii.into_id
|
|
|
+ and tpii.flg_valid
|
|
|
+ AND position(#{searchText} in tmgs.sku_model) > 0
|
|
|
+ ))
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
<sql id="idsForeach">
|
|
|
<!-- 根据主键intoId批量操作 -->
|
|
|
WHERE into_id in
|
|
|
@@ -572,7 +645,9 @@
|
|
|
left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id) T
|
|
|
WHERE T.RK = 1) as i
|
|
|
on i.sku_id = tpii.sku_id and i.non_std_code = tpii.non_std_code and i.cp_id = tpii.cp_id
|
|
|
- <include refid="Condition"/>
|
|
|
+
|
|
|
+
|
|
|
+ <include refid="ConditionIsSup"/>
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
@@ -584,7 +659,9 @@
|
|
|
count(1)
|
|
|
FROM dkic_b.t_psi_inbound tpi
|
|
|
left join dkic_b.t_psi_inbound_item tpii on tpi.into_id = tpii.into_id
|
|
|
- <include refid="Condition"/>
|
|
|
+ left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpii.wh_id
|
|
|
+ inner join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = tpii.sku_id
|
|
|
+ <include refid="ConditionIsSup"/>
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@@ -997,6 +1074,10 @@
|
|
|
<result column="channel_name" property="channelName" />
|
|
|
<result column="cus_from_name" property="cusFromName" />
|
|
|
<result column="return_address" property="returnAddress" />
|
|
|
+ <result column="purSumAmount" property="purSumAmount" />
|
|
|
+ <result column="purReturnAmt" property="purReturnAmt" />
|
|
|
+
|
|
|
+
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="Join_Table_Return">
|
|
|
@@ -1060,8 +1141,11 @@
|
|
|
,case when tpi.receivable_id is null then false
|
|
|
when tmai.amt_handle = 0 then false
|
|
|
else true end as "paymentFlag"
|
|
|
+ ,tpp.sum_amount AS "purSumAmount"
|
|
|
+ ,tpp.return_amt AS "purReturnAmt"
|
|
|
FROM dkic_b.t_psi_inbound tpi
|
|
|
Left join dkic_b.t_mst_org tmo on tmo.org_id = tpi.org_id
|
|
|
+ Left join dkic_b.t_psi_purchase tpp on tpp.pur_id = tpi.from_id
|
|
|
Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = tpi.sup_id
|
|
|
Left join dkic_b.t_mst_staff tms on tms.staff_id = tpi.staff_id
|
|
|
Left join dkic_b.t_mst_staff tms1 on tms1.staff_id = tpi.make_staff
|