fix: A303-1 开票申请推送放开上游来源单据字段,awrp_src_con_no 传首张结算单金蝶应收单编号(金蝶确认单据编号口径,取 A302-4 查询结果)
This commit is contained in:
+11
-10
@@ -558,7 +558,6 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
|
||||
.eq(InvoiceApplicationSettlement::getInvoiceApplicationId, id));
|
||||
if (Func.isEmpty(relations)) throw new ServiceException("推送金蝶开票申请失败:开票申请未关联正式结算单");
|
||||
List<String> arSrcCodes = new ArrayList<>();
|
||||
String firstArBillNo = null;
|
||||
Map<String, String> settlementNoBySrcCode = new LinkedHashMap<>();
|
||||
for (InvoiceApplicationSettlement relation : relations) {
|
||||
FormalSettlement settlement = formalSettlementMapper.selectById(relation.getFormalSettlementId());
|
||||
@@ -573,9 +572,6 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
|
||||
String srcCode = kingdeeArBillSyncSupport.arBillSrcCode(settlement, details);
|
||||
arSrcCodes.add(srcCode);
|
||||
settlementNoBySrcCode.put(srcCode, Func.toStr(settlement.getFormalSettlementNo()));
|
||||
if (firstArBillNo == null) {
|
||||
firstArBillNo = settlement.getKingdeeBillNo();
|
||||
}
|
||||
}
|
||||
Map<String, String> existArNos = kingdeeArBillSyncSupport.queryArBillExistNos(arSrcCodes);
|
||||
for (Map.Entry<String, String> entry : settlementNoBySrcCode.entrySet()) {
|
||||
@@ -584,6 +580,9 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
|
||||
+ "]财务应收单未在金蝶生成,请先在正式付款单页面同步金蝶");
|
||||
}
|
||||
}
|
||||
// 上游来源单据号(awrp_src_con_no):首张关联结算单的金蝶应收单单据编号(金蝶确认传单据编号口径),
|
||||
// 以 A302-4 查询结果为准(存量本地单号缺失也能取到),多张结算单取第一张
|
||||
String firstArBillNo = existArNos.get(arSrcCodes.get(0));
|
||||
// 加载发票张次与商品行:每张发票张次对应一张金蝶开票申请单(按张次拆分开票)
|
||||
List<InvoiceApplicationSheet> sheets = sheetMapper.selectList(Wrappers.<InvoiceApplicationSheet>lambdaQuery()
|
||||
.eq(InvoiceApplicationSheet::getInvoiceApplicationId, id).orderByAsc(InvoiceApplicationSheet::getSheetNo));
|
||||
@@ -681,7 +680,7 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
|
||||
+ "]无商品行,无法组装分录");
|
||||
}
|
||||
BfiInvoiceApplySaveDTO param = this.buildInvoiceApplyParam(entity, sheetBillNo, seller, salerAddr, salerBank,
|
||||
dept, customer, money(sheet.getInvoiceAmount()), items);
|
||||
dept, customer, firstArBillNo, money(sheet.getInvoiceAmount()), items);
|
||||
log.info("金蝶开票申请推送:开票申请[{}]发票张[{}],billno=[{}],价税合计=[{}],分录{}条",
|
||||
entity.getApplicationNo(), sheet.getSheetNo(), sheetBillNo, sheet.getInvoiceAmount(), items.size());
|
||||
BfiBillSaveResultVO saveResult = bfiService.saveInvoiceApply(param);
|
||||
@@ -729,10 +728,12 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
|
||||
/**
|
||||
* 组装 A303-1 单张开票申请单入参(字段映射见设计文档 6.3/6.4),
|
||||
* 购销方等主表公共字段随开票申请取数,价税合计与单据体分录取本张发票
|
||||
*
|
||||
* @param firstArBillNo 上游来源单据号:首张关联结算单的金蝶应收单单据编号(多张结算单取第一张)
|
||||
*/
|
||||
private BfiInvoiceApplySaveDTO buildInvoiceApplyParam(InvoiceApplication entity, String billNo,
|
||||
CustomerArchive seller, String salerAddr, String salerBank, Dept dept, CustomerArchive customer,
|
||||
BigDecimal sheetAmount, List<BfiInvoiceApplySaveEntryDTO> items) {
|
||||
String firstArBillNo, BigDecimal sheetAmount, List<BfiInvoiceApplySaveEntryDTO> items) {
|
||||
BfiInvoiceApplySaveDTO param = new BfiInvoiceApplySaveDTO();
|
||||
// ==================== 以下为【必填】字段(BfiInvoiceApplySaveDTO 标注),非必填字段先注释保留 ====================
|
||||
// 【必填】组织.编码:申请部门 deptId → 金蝶组织编码
|
||||
@@ -790,10 +791,10 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
|
||||
// param.setTotaltax(totaltax);
|
||||
// 数据来源:固定 3
|
||||
// param.setBillsource("3");
|
||||
// 来源单据:ar_finarbill 财务应收单
|
||||
// param.setAwrpSrcBt(KingdeeBfiConstant.BFI_AR_BILL_SRC_BT);
|
||||
// 上游外部系统单据号:第一张关联结算单的金蝶应收单号(多张拼接规则待联调确认)
|
||||
// param.setAwrpSrcConNo(firstArBillNo);
|
||||
// 来源单据:ar_finarbill 财务应收单(金蝶联调确认开票申请须挂上游应收单)
|
||||
param.setAwrpSrcBt(KingdeeBfiConstant.BFI_AR_BILL_SRC_BT);
|
||||
// 上游单据号:首张关联结算单的金蝶应收单单据编号(金蝶确认传单据编号口径,A302-4 预检已确认存在)
|
||||
param.setAwrpSrcConNo(firstArBillNo);
|
||||
// 数据来源系统
|
||||
param.setSystemsource(bfiProperties.getSrcSys());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user