|
|
@@ -194,48 +194,48 @@
|
|
|
<!-- 查询应收账款明细 -->
|
|
|
<select id="getReceivableAccountItem" resultMap="BaseResultMapResponse">
|
|
|
SELECT t.item_id,
|
|
|
- t.item_id as "accItemId",
|
|
|
- t.acc_item_type,
|
|
|
- t.object_id,
|
|
|
- tmc.cus_code as "cusCode",
|
|
|
- tmc.cus_name as "cusName",
|
|
|
- tmc.cus_phone as "cusPhone",
|
|
|
- tmc.address_full as "addressFull",
|
|
|
- t.org_id,
|
|
|
- tmo.org_name as "orgName",
|
|
|
- t.staff_id,
|
|
|
- tms.staff_name as "staffName",
|
|
|
- t.biznis_type,
|
|
|
- t.biznis_id,
|
|
|
- t.biznis_no,
|
|
|
- t.acc_date,
|
|
|
- t.rec_status,
|
|
|
- sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "recStatusName",
|
|
|
- coalesce(sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n}), '其他收入') as "biznisTypeName",
|
|
|
- t.amt_rec,
|
|
|
- t.amt_pay,
|
|
|
- t.amt_should,
|
|
|
- t.amt_handle,
|
|
|
- t.amt_waive,
|
|
|
- t.amt_residue as "amtNotHandle",
|
|
|
- t.amt_residue as "amtReceivableHandle",
|
|
|
- t.amt_residue,
|
|
|
- t.remarks,
|
|
|
- t.make_staff,
|
|
|
- t.make_time,
|
|
|
- t.flg_valid,
|
|
|
- t.cp_id
|
|
|
+ t.item_id as "accItemId",
|
|
|
+ t.acc_item_type,
|
|
|
+ t.object_id,
|
|
|
+ tmc.cus_code as "cusCode",
|
|
|
+ tmc.cus_name as "cusName",
|
|
|
+ tmc.cus_phone as "cusPhone",
|
|
|
+ tmc.address_full as "addressFull",
|
|
|
+ t.org_id,
|
|
|
+ tmo.org_name as "orgName",
|
|
|
+ t.staff_id,
|
|
|
+ tms.staff_name as "staffName",
|
|
|
+ t.biznis_type,
|
|
|
+ t.biznis_id,
|
|
|
+ t.biznis_no,
|
|
|
+ t.acc_date,
|
|
|
+ t.rec_status,
|
|
|
+ sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "recStatusName",
|
|
|
+ coalesce(sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n}), '其他收入') as "biznisTypeName",
|
|
|
+ t.amt_rec,
|
|
|
+ t.amt_pay,
|
|
|
+ t.amt_should,
|
|
|
+ t.amt_handle,
|
|
|
+ t.amt_waive,
|
|
|
+ t.amt_residue as "amtNotHandle",
|
|
|
+ t.amt_residue as "amtReceivableHandle",
|
|
|
+ t.amt_residue,
|
|
|
+ t.remarks,
|
|
|
+ t.make_staff,
|
|
|
+ t.make_time,
|
|
|
+ t.flg_valid,
|
|
|
+ t.cp_id
|
|
|
FROM dkic_b.t_mac_account_item as t
|
|
|
- left join dkic_b.t_psi_outbound as tpo on tpo.out_id = t.biznis_id and t.biznis_type = 't_psi_outbound'
|
|
|
- LEFT JOIN sys.t_data_kind tdk2 ON tdk2.kind_code = tpo.out_type
|
|
|
- left join dkic_b.t_mac_other_receivable as tmor
|
|
|
- on tmor.receivable_id = t.biznis_id and t.biznis_type = 't_mac_other_receivable'
|
|
|
- left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
|
|
|
- left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
|
|
|
- left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
|
|
|
- left join sys.t_data_kind as tdk1 on t.rec_status = tdk1.kind_code
|
|
|
+ left join dkic_b.t_psi_outbound as tpo on tpo.out_id = t.biznis_id and t.biznis_type = 't_psi_outbound'
|
|
|
+ LEFT JOIN sys.t_data_kind tdk2 ON tdk2.kind_code = tpo.out_type
|
|
|
+ left join dkic_b.t_mac_other_receivable as tmor
|
|
|
+ on tmor.receivable_id = t.biznis_id and t.biznis_type = 't_mac_other_receivable'
|
|
|
+ left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
|
|
|
+ left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
|
|
|
+ left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
|
|
|
+ left join sys.t_data_kind as tdk1 on t.rec_status = tdk1.kind_code
|
|
|
where t.flg_valid
|
|
|
- and t.acc_item_type = '账款类型-应收'
|
|
|
+ and t.acc_item_type = '账款类型-应收'
|
|
|
and t.amt_residue <![CDATA[ <> ]]> 0
|
|
|
<include refid="Condition"/>
|
|
|
order by t.acc_date
|
|
|
@@ -247,45 +247,45 @@
|
|
|
<!-- 查询应付账款明细 -->
|
|
|
<select id="getPayableAccountItem" resultMap="BaseResultMapResponse">
|
|
|
SELECT t.item_id,
|
|
|
- t.item_id as "accItemId",
|
|
|
- t.acc_item_type,
|
|
|
- t.object_id,
|
|
|
- supplier.sup_code as "supCode",
|
|
|
- supplier.sup_name as "supName",
|
|
|
- t.org_id,
|
|
|
- tmo.org_name as "orgName",
|
|
|
- t.staff_id,
|
|
|
- tms.staff_name as "staffName",
|
|
|
- t.biznis_type,
|
|
|
- t.biznis_id,
|
|
|
- t.biznis_no,
|
|
|
- t.acc_date,
|
|
|
- t.rec_status,
|
|
|
- sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "recStatusName",
|
|
|
- sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n}) as "biznisTypeName",
|
|
|
- t.amt_rec,
|
|
|
- t.amt_pay,
|
|
|
- t.amt_should,
|
|
|
- t.amt_handle,
|
|
|
- t.amt_waive,
|
|
|
- t.amt_residue,
|
|
|
- t.amt_residue as "amtNotHandle",
|
|
|
- t.amt_residue as "amtPayableHandle",
|
|
|
- t.remarks,
|
|
|
- t.make_staff,
|
|
|
- t.make_time,
|
|
|
- t.flg_valid,
|
|
|
- t.cp_id
|
|
|
+ t.item_id as "accItemId",
|
|
|
+ t.acc_item_type,
|
|
|
+ t.object_id,
|
|
|
+ supplier.sup_code as "supCode",
|
|
|
+ supplier.sup_name as "supName",
|
|
|
+ t.org_id,
|
|
|
+ tmo.org_name as "orgName",
|
|
|
+ t.staff_id,
|
|
|
+ tms.staff_name as "staffName",
|
|
|
+ t.biznis_type,
|
|
|
+ t.biznis_id,
|
|
|
+ t.biznis_no,
|
|
|
+ t.acc_date,
|
|
|
+ t.rec_status,
|
|
|
+ sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "recStatusName",
|
|
|
+ sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n}) as "biznisTypeName",
|
|
|
+ t.amt_rec,
|
|
|
+ t.amt_pay,
|
|
|
+ t.amt_should,
|
|
|
+ t.amt_handle,
|
|
|
+ t.amt_waive,
|
|
|
+ t.amt_residue,
|
|
|
+ t.amt_residue as "amtNotHandle",
|
|
|
+ t.amt_residue as "amtPayableHandle",
|
|
|
+ t.remarks,
|
|
|
+ t.make_staff,
|
|
|
+ t.make_time,
|
|
|
+ t.flg_valid,
|
|
|
+ t.cp_id
|
|
|
FROM dkic_b.t_mac_account_item as t
|
|
|
- left join dkic_b.t_psi_inbound as tpi on tpi.into_id = t.biznis_id and t.biznis_type = 't_psi_inbound'
|
|
|
- LEFT JOIN sys.t_data_kind tdk2 ON tdk2.kind_code = tpi.into_type
|
|
|
- left join dkic_b.t_mst_supplier supplier on supplier.sup_id = t.object_id
|
|
|
- left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
|
|
|
- left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
|
|
|
- left join sys.t_data_kind as tdk1 on t.rec_status = tdk1.kind_code
|
|
|
+ left join dkic_b.t_psi_inbound as tpi on tpi.into_id = t.biznis_id and t.biznis_type = 't_psi_inbound'
|
|
|
+ LEFT JOIN sys.t_data_kind tdk2 ON tdk2.kind_code = tpi.into_type
|
|
|
+ left join dkic_b.t_mst_supplier supplier on supplier.sup_id = t.object_id
|
|
|
+ left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
|
|
|
+ left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
|
|
|
+ left join sys.t_data_kind as tdk1 on t.rec_status = tdk1.kind_code
|
|
|
where t.flg_valid
|
|
|
- and t.acc_item_type = '账款类型-应付'
|
|
|
- and t.amt_residue <![CDATA[ <> ]]> 0
|
|
|
+ and t.acc_item_type = '账款类型-应付'
|
|
|
+ and t.amt_residue <![CDATA[<>]]> 0
|
|
|
<include refid="Condition"/>
|
|
|
order by t.acc_date
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
@@ -293,6 +293,43 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 查询应收账款明细 -->
|
|
|
+ <select id="getReceivableAccountItemForUpdate" resultMap="BaseResultMapResponse">
|
|
|
+ SELECT t.item_id,
|
|
|
+ t.item_id as "accItemId",
|
|
|
+ t.acc_item_type,
|
|
|
+ t.object_id,
|
|
|
+ t.org_id,
|
|
|
+ t.staff_id,
|
|
|
+ t.biznis_type,
|
|
|
+ t.biznis_id,
|
|
|
+ t.biznis_no,
|
|
|
+ t.acc_date,
|
|
|
+ t.rec_status,
|
|
|
+ t.amt_rec,
|
|
|
+ t.amt_pay,
|
|
|
+ t.amt_should,
|
|
|
+ t.amt_handle,
|
|
|
+ t.amt_waive,
|
|
|
+ t.amt_residue as "amtNotHandle",
|
|
|
+ t.amt_residue as "amtReceivableHandle",
|
|
|
+ t.amt_residue,
|
|
|
+ t.remarks,
|
|
|
+ t.make_staff,
|
|
|
+ t.make_time,
|
|
|
+ t.flg_valid,
|
|
|
+ t.cp_id
|
|
|
+ FROM dkic_b.t_mac_account_item as t
|
|
|
+ inner join dkic_b.t_psi_outbound as tpo on tpo.out_id = t.biznis_id and t.biznis_type = 't_psi_outbound'
|
|
|
+ where t.flg_valid
|
|
|
+ and t.acc_item_type = '账款类型-应收'
|
|
|
+ and t.amt_residue <![CDATA[<>]]> 0
|
|
|
+ AND t.object_id = #{objectId}::uuid
|
|
|
+ AND tpo.from_id = #{orderId}::uuid
|
|
|
+ order by t.acc_date
|
|
|
+ for update
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- 根据主键查询表t_mac_account_item的一行数据 -->
|
|
|
<select id="selectById" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
@@ -408,7 +445,7 @@
|
|
|
SELECT COALESCE(sum(tpo.sum_amount - tpo.out_amt), 0) as "sumAmtOrder"
|
|
|
FROM dkic_b.t_psi_order as tpo
|
|
|
where tpo.flg_valid
|
|
|
- and tpo.out_status in('出库状态-出库中','出库状态-待出库')
|
|
|
+ and tpo.out_status in ('出库状态-出库中', '出库状态-待出库')
|
|
|
and tpo.cus_id = #{id}::uuid
|
|
|
</select>
|
|
|
|
|
|
@@ -417,7 +454,7 @@
|
|
|
SELECT COALESCE(sum(tpp.sum_amount - tpp.into_amt), 0) as "sumAmtPur"
|
|
|
FROM dkic_b.t_psi_purchase as tpp
|
|
|
where tpp.flg_valid
|
|
|
- and tpp.into_status in('入库状态-待入库','入库状态-入库中')
|
|
|
+ and tpp.into_status in ('入库状态-待入库', '入库状态-入库中')
|
|
|
and tpp.sup_id = #{id}::uuid
|
|
|
</select>
|
|
|
|