fix: 金蝶分录拆分跳过0元费用项避免生成0元明细行
fee_items_json 中金额为0的费用项(附加运输补贴/仓储服务费等)不再参与分组,0元货物行整体跳过;修复FJS2026101300005推送8条分录(其中5条为0元行)的问题,修复后该单应为3条有效分录
This commit is contained in:
+7
-1
@@ -463,7 +463,9 @@ public class KingdeeApBillSyncSupport {
|
||||
List<FeeLineSplit> splits = splitFeeItems(parseFeeItems(feeItemsJson), context.feeCategoryByName(),
|
||||
context.taxRateByRule(), rowAmount);
|
||||
if (splits.isEmpty()) {
|
||||
throw new ServiceException("推送金蝶失败:" + sourceDesc + "无费用项金额,无法拆分明细分录");
|
||||
// 0元货物行(费用项与结算金额均为0)跳过不生成0元分录
|
||||
log.info("金蝶应付单分录生成:来源[{}],费用项与结算金额均为0,跳过该货物行", sourceDesc);
|
||||
return;
|
||||
}
|
||||
// 运输类数量:取运单运输量(未维护兜底 1)
|
||||
BigDecimal freightQuantity = transportQuantity != null && transportQuantity.compareTo(BigDecimal.ZERO) > 0
|
||||
@@ -656,6 +658,10 @@ public class KingdeeApBillSyncSupport {
|
||||
continue;
|
||||
}
|
||||
BigDecimal amount = item.getValue() == null ? BigDecimal.ZERO : item.getValue();
|
||||
// 0元费用项跳过,不生成0元分录(金额缺失由运输类无税率组残差兜底)
|
||||
if (amount.signum() == 0) {
|
||||
continue;
|
||||
}
|
||||
boolean loading = isLoadingCategory(item.getKey(), feeCategoryByName);
|
||||
BigDecimal taxRate = taxRateByRule == null ? null : taxRateByRule.get(item.getKey());
|
||||
FeeLineSplit split = grouped.get(splitGroupKey(loading, taxRate));
|
||||
|
||||
Reference in New Issue
Block a user