给采购入库和销售出库增加最终欠款的展示列

This commit is contained in:
jishenghua
2026-01-06 12:17:55 +08:00
parent faa8582f81
commit dc17fd6872
7 changed files with 43 additions and 31 deletions

View File

@@ -38,7 +38,7 @@ public interface AccountHeadMapperEx {
List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds); List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
List<AccountItem> getFinancialBillNoByBillIdList( List<AccountItem> getFinancialBillPriceByBillIdList(
@Param("idList") List<Long> idList); @Param("idList") List<Long> idList);
List<AccountHead> getFinancialBillNoByBillId( List<AccountHead> getFinancialBillNoByBillId(

View File

@@ -47,6 +47,12 @@ public class DepotHeadVo4List extends DepotHead{
* 是否有付款单或收款单 * 是否有付款单或收款单
*/ */
private Boolean hasFinancialFlag; private Boolean hasFinancialFlag;
/**
* 最终欠款
*/
private BigDecimal lastDebt;
/** /**
* 是否有退款单 * 是否有退款单
*/ */
@@ -229,6 +235,14 @@ public class DepotHeadVo4List extends DepotHead{
this.hasFinancialFlag = hasFinancialFlag; this.hasFinancialFlag = hasFinancialFlag;
} }
public BigDecimal getLastDebt() {
return lastDebt;
}
public void setLastDebt(BigDecimal lastDebt) {
this.lastDebt = lastDebt;
}
public Boolean getHasBackFlag() { public Boolean getHasBackFlag() {
return hasBackFlag; return hasBackFlag;
} }

View File

@@ -410,8 +410,8 @@ public class AccountHeadService {
return resList; return resList;
} }
public List<AccountItem> getFinancialBillNoByBillIdList(List<Long> idList) { public List<AccountItem> getFinancialBillPriceByBillIdList(List<Long> idList) {
return accountHeadMapperEx.getFinancialBillNoByBillIdList(idList); return accountHeadMapperEx.getFinancialBillPriceByBillIdList(idList);
} }
public List<AccountHead> getFinancialBillNoByBillId(Long billId) { public List<AccountHead> getFinancialBillNoByBillId(Long billId) {

View File

@@ -133,7 +133,7 @@ public class DepotHeadService {
} }
//通过批量查询去构造map //通过批量查询去构造map
Map<String,BigDecimal> finishDepositMap = getFinishDepositMapByNumberList(numberList); Map<String,BigDecimal> finishDepositMap = getFinishDepositMapByNumberList(numberList);
Map<Long,Integer> financialBillNoMap = getFinancialBillNoMapByBillIdList(idList); Map<Long,BigDecimal> financialBillPriceMap = getFinancialBillPriceMapByBillIdList(idList);
Map<String,Integer> billSizeMap = getBillSizeMapByLinkNumberList(numberList); Map<String,Integer> billSizeMap = getBillSizeMapByLinkNumberList(numberList);
Map<Long,String> materialsListMap = findMaterialsListMapByHeaderIdList(idList); Map<Long,String> materialsListMap = findMaterialsListMapByHeaderIdList(idList);
Map<Long,BigDecimal> materialCountListMap = getMaterialCountListMapByHeaderIdList(idList); Map<Long,BigDecimal> materialCountListMap = getMaterialCountListMapByHeaderIdList(idList);
@@ -180,10 +180,11 @@ public class DepotHeadService {
BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount():BigDecimal.ZERO; BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount():BigDecimal.ZERO;
BigDecimal debt = discountLastMoney.add(otherMoney).subtract((deposit.add(changeAmount))); BigDecimal debt = discountLastMoney.add(otherMoney).subtract((deposit.add(changeAmount)));
dh.setDebt(roleService.parseBillPriceByLimit(debt, billCategory, priceLimit, request)); dh.setDebt(roleService.parseBillPriceByLimit(debt, billCategory, priceLimit, request));
//是否有付款单或收款单 //最终欠款的金额
if(financialBillNoMap!=null) { if(financialBillPriceMap!=null) {
Integer financialBillNoSize = financialBillNoMap.get(dh.getId()); BigDecimal financialBillPrice = financialBillPriceMap.get(dh.getId())!=null?financialBillPriceMap.get(dh.getId()):BigDecimal.ZERO;
dh.setHasFinancialFlag(financialBillNoSize!=null && financialBillNoSize>0); BigDecimal lastDebt = debt.subtract(financialBillPrice);
dh.setLastDebt(roleService.parseBillPriceByLimit(lastDebt, billCategory, priceLimit, request));
} }
//是否有退款单 //是否有退款单
if(billSizeMap!=null) { if(billSizeMap!=null) {
@@ -345,14 +346,14 @@ public class DepotHeadService {
return billListMap; return billListMap;
} }
public Map<Long,Integer> getFinancialBillNoMapByBillIdList(List<Long> idList) { private Map<Long, BigDecimal> getFinancialBillPriceMapByBillIdList(List<Long> idList) {
Map<Long, Integer> billListMap = new HashMap<>(); Map<Long, BigDecimal> billListMap = new HashMap<>();
if(idList.size()>0) { if(!idList.isEmpty()) {
List<AccountItem> list = accountHeadService.getFinancialBillNoByBillIdList(idList); List<AccountItem> list = accountHeadService.getFinancialBillPriceByBillIdList(idList);
if(list!=null && list.size()>0) { if(list!=null && !list.isEmpty()) {
for (AccountItem accountItem : list) { for (AccountItem accountItem : list) {
if(accountItem!=null) { if(accountItem!=null) {
billListMap.put(accountItem.getBillId(), list.size()); billListMap.put(accountItem.getBillId(), accountItem.getEachAmount().abs());
} }
} }
} }
@@ -982,7 +983,6 @@ public class DepotHeadService {
numberList.add(dh.getNumber()); numberList.add(dh.getNumber());
} }
//通过批量查询去构造map //通过批量查询去构造map
Map<Long,Integer> financialBillNoMap = getFinancialBillNoMapByBillIdList(idList);
Map<String,Integer> billSizeMap = getBillSizeMapByLinkNumberList(numberList); Map<String,Integer> billSizeMap = getBillSizeMapByLinkNumberList(numberList);
Map<Long,String> materialsListMap = findMaterialsListMapByHeaderIdList(idList); Map<Long,String> materialsListMap = findMaterialsListMapByHeaderIdList(idList);
Map<Long,BigDecimal> materialCountListMap = getMaterialCountListMapByHeaderIdList(idList); Map<Long,BigDecimal> materialCountListMap = getMaterialCountListMapByHeaderIdList(idList);
@@ -1023,11 +1023,6 @@ public class DepotHeadService {
BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount():BigDecimal.ZERO; BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount():BigDecimal.ZERO;
BigDecimal debt = discountLastMoney.add(otherMoney).subtract((deposit.add(changeAmount))); BigDecimal debt = discountLastMoney.add(otherMoney).subtract((deposit.add(changeAmount)));
dh.setDebt(roleService.parseBillPriceByLimit(debt, billCategory, priceLimit, request)); dh.setDebt(roleService.parseBillPriceByLimit(debt, billCategory, priceLimit, request));
//是否有付款单或收款单
if(financialBillNoMap!=null) {
Integer financialBillNoSize = financialBillNoMap.get(dh.getId());
dh.setHasFinancialFlag(financialBillNoSize!=null && financialBillNoSize>0);
}
//是否有退款单 //是否有退款单
if(billSizeMap!=null) { if(billSizeMap!=null) {
Integer billListSize = billSizeMap.get(dh.getNumber()); Integer billListSize = billSizeMap.get(dh.getNumber());

View File

@@ -133,8 +133,8 @@
and ifnull(delete_flag,'0') !='1' and ifnull(delete_flag,'0') !='1'
</select> </select>
<select id="getFinancialBillNoByBillIdList" resultType="com.jsh.erp.datasource.entities.AccountItem"> <select id="getFinancialBillPriceByBillIdList" resultType="com.jsh.erp.datasource.entities.AccountItem">
select ai.bill_id from jsh_account_head ah select ai.bill_id, sum(ai.each_amount) each_amount from jsh_account_head ah
left join jsh_account_item ai on ah.id=ai.header_id and ifnull(ai.delete_flag,'0') !='1' left join jsh_account_item ai on ah.id=ai.header_id and ifnull(ai.delete_flag,'0') !='1'
where 1=1 where 1=1
<if test="idList.size()>0"> <if test="idList.size()>0">
@@ -144,6 +144,7 @@
</foreach> </foreach>
</if> </if>
and ifnull(ah.delete_flag,'0') !='1' and ifnull(ah.delete_flag,'0') !='1'
group by ai.bill_id
</select> </select>
<select id="getFinancialBillNoByBillId" resultType="com.jsh.erp.datasource.entities.AccountHead"> <select id="getFinancialBillNoByBillId" resultType="com.jsh.erp.datasource.entities.AccountHead">

View File

@@ -186,10 +186,10 @@
</span> </span>
<template slot="customRenderDebt" slot-scope="value, record"> <template slot="customRenderDebt" slot-scope="value, record">
<a-tooltip title="有付款单"> <a-tooltip title="有付款单">
<span style="color:green" v-if="value>0 && record.hasFinancialFlag">{{value}}</span> <span style="color:green" v-if="value>0 && value>record.lastDebt">{{value}}</span>
</a-tooltip> </a-tooltip>
<a-tooltip title="暂未付款"> <a-tooltip title="暂未付款">
<span style="color:red" v-if="value>0 && !record.hasFinancialFlag">{{value}}</span> <span style="color:red" v-if="value>0 && value===record.lastDebt">{{value}}</span>
</a-tooltip> </a-tooltip>
<span v-if="value===0">{{value}}</span> <span v-if="value===0">{{value}}</span>
</template> </template>
@@ -279,7 +279,7 @@
}, },
// 默认索引 // 默认索引
defDataIndex:['action','organName','number','materialsList','operTimeStr','userName','materialCount','totalPrice','totalTaxLastMoney', defDataIndex:['action','organName','number','materialsList','operTimeStr','userName','materialCount','totalPrice','totalTaxLastMoney',
'needInMoney','changeAmount','debt','status'], 'changeAmount','debt','lastDebt','status'],
// 默认列 // 默认列
defColumns: [ defColumns: [
{ {
@@ -326,6 +326,7 @@
{ title: '本次欠款', dataIndex: 'debt',width:80, { title: '本次欠款', dataIndex: 'debt',width:80,
scopedSlots: { customRender: 'customRenderDebt' } scopedSlots: { customRender: 'customRenderDebt' }
}, },
{ title: '最终欠款', dataIndex: 'lastDebt',width:80},
{ title: '备注', dataIndex: 'remark',width:200}, { title: '备注', dataIndex: 'remark',width:200},
{ title: '状态', dataIndex: 'status', width: 80, align: "center", { title: '状态', dataIndex: 'status', width: 80, align: "center",
scopedSlots: { customRender: 'customRenderStatus' } scopedSlots: { customRender: 'customRenderStatus' }

View File

@@ -196,10 +196,10 @@
</span> </span>
<template slot="customRenderDebt" slot-scope="value, record"> <template slot="customRenderDebt" slot-scope="value, record">
<a-tooltip title="有收款单"> <a-tooltip title="有收款单">
<span style="color:green" v-if="value>0 && record.hasFinancialFlag">{{value}}</span> <span style="color:green" v-if="value>0 && value>record.lastDebt">{{value}}</span>
</a-tooltip> </a-tooltip>
<a-tooltip title="暂未收款"> <a-tooltip title="暂未收款">
<span style="color:red" v-if="value>0 && !record.hasFinancialFlag">{{value}}</span> <span style="color:red" v-if="value>0 && value===record.lastDebt">{{value}}</span>
</a-tooltip> </a-tooltip>
<span v-if="value===0">{{value}}</span> <span v-if="value===0">{{value}}</span>
</template> </template>
@@ -289,7 +289,7 @@
}, },
// 默认索引 // 默认索引
defDataIndex:['action','organName','number','materialsList','operTimeStr','userName','materialCount','totalPrice','totalTaxLastMoney', defDataIndex:['action','organName','number','materialsList','operTimeStr','userName','materialCount','totalPrice','totalTaxLastMoney',
'needOutMoney','changeAmount','debt','status'], 'changeAmount','debt','lastDebt','status'],
// 默认列 // 默认列
defColumns: [ defColumns: [
{ {
@@ -336,6 +336,7 @@
{ title: '本次欠款', dataIndex: 'debt',width:80, { title: '本次欠款', dataIndex: 'debt',width:80,
scopedSlots: { customRender: 'customRenderDebt' } scopedSlots: { customRender: 'customRenderDebt' }
}, },
{ title: '最终欠款', dataIndex: 'lastDebt',width:80},
{ title: '销售人员', dataIndex: 'salesManStr',width:120}, { title: '销售人员', dataIndex: 'salesManStr',width:120},
{ title: '备注', dataIndex: 'remark',width:200}, { title: '备注', dataIndex: 'remark',width:200},
{ title: '状态', dataIndex: 'status', width: 80, align: "center", { title: '状态', dataIndex: 'status', width: 80, align: "center",