From 598333207f292d18c99026c733a317e39f1b4e6b Mon Sep 17 00:00:00 2001 From: aike <17730485278@139.com> Date: Wed, 14 Jan 2026 10:38:23 +0800 Subject: [PATCH] =?UTF-8?q?demand:=20=20TMS=E7=B3=BB=E7=BB=9F=20-=20?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E8=B4=A6=E5=8D=95=E7=AE=A1=E7=90=86=20-=20?= =?UTF-8?q?=E9=94=80=E8=B4=A6=E5=AE=A1=E6=A0=B8=E9=80=9A=E8=BF=87=E5=90=8E?= =?UTF-8?q?=E4=BA=A4=E6=98=93=E6=97=B6=E9=97=B4=E5=8F=96=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E7=9A=84=E4=BA=A4=E6=98=93=E6=97=B6=E9=97=B4=20=20TMS=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=20-=20=E5=AE=A2=E6=88=B7=E8=B4=A6=E5=8D=95=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20-=20=E4=B8=9A=E5=8A=A1=E9=94=80=E8=B4=A6=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=20-=20=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8C=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E6=94=AF=E4=BB=98=E7=B1=BB=E5=9E=8B=E7=9A=84=E8=BF=90?= =?UTF-8?q?=E5=8D=95=E4=B8=8D=E8=83=BD=E4=B8=80=E8=B5=B7=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=20=20TMS=E7=B3=BB=E7=BB=9F=20-=20=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E8=B4=A6=E5=8D=95=E7=AE=A1=E7=90=86=20-=20=E8=B4=A2?= =?UTF-8?q?=E5=8A=A1=E9=94=80=E8=B4=A6=E5=AE=A1=E6=A0=B8=20-=20=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E9=80=9A=E8=BF=87=E5=90=8E=E9=94=80=E8=B4=A6=E6=94=B6?= =?UTF-8?q?=E6=AC=BE=E7=B1=BB=E5=9E=8B=E3=80=81=E8=B4=A6=E5=8D=95=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=8F=96=E5=80=BC=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EmisWriteoffApplyServiceImpl.java | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWriteoffApplyServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWriteoffApplyServiceImpl.java index 701656789..c2e7743e8 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWriteoffApplyServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWriteoffApplyServiceImpl.java @@ -186,6 +186,37 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm } } + /** + * 验证明细列表中结算账单的结算类型是否一致 + * + * @param emisWriteoffApply 销账申请 + * @throws EmisBizError 如果结算类型不一致则抛出异常 + */ + private void validateSettleTypeConsistency(EmisWriteoffApply emisWriteoffApply) throws EmisBizError { + if (CollectionUtils.isEmpty(emisWriteoffApply.getDetailList())) { + return; + } + + String firstSettleType = null; + for (EmisWriteoffApplyDetail detail : emisWriteoffApply.getDetailList()) { + if (detail.getEmisSettleBill() == null) { + throw new EmisBizError("运单号 " + detail.getBillCode() + " 的账单信息为空"); + } + + String settleType = detail.getEmisSettleBill().getSettleType(); + if (settleType == null) { + throw new EmisBizError("运单号 " + detail.getBillCode() + " 的结算账单类型为空"); + } + + if (firstSettleType == null) { + firstSettleType = settleType; + } else if (!firstSettleType.equals(settleType)) { + throw new EmisBizError("明细列表中的结算账单类型不一致,运单号 " + detail.getBillCode() + + " 的结算类型为 " + settleType + ",与其他明细的结算类型 " + firstSettleType + " 不一致"); + } + } + } + /** * 新增销账申请 * @@ -199,6 +230,9 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm // 先验证销账金额 validateWriteoffAmount(emisWriteoffApply); + // 验证结算账单类型一致性 + validateSettleTypeConsistency(emisWriteoffApply); + // 设置申请编号 String applyNo = generateApplyNo(); emisWriteoffApply.setApplyNo(applyNo); @@ -1592,7 +1626,7 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm EmisSettlePayRecord payRecord = new EmisSettlePayRecord(); payRecord.setPayId(payId); payRecord.setWriteoffApplyNo(apply.getApplyNo()); // 设置销账申请编号 - payRecord.setPayType("7"); // 销账收款类型 + payRecord.setPayType(apply.getPayType()); // 销账收款类型 payRecord.setRecType("1"); // 收款类型 payRecord.setPayMan(apply.getApplyManName()); payRecord.setPayManCode(apply.getApplyManCode()); @@ -1611,7 +1645,10 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm payRecord.setPayMoney(totalApplyMoney); payRecord.setPayStatus("2"); // 支付成功 - payRecord.setSettleType("1"); // 现金结算 + if (!detailList.isEmpty() && detailList.get(0).getEmisSettleBill() != null) { + EmisSettleBill emisSettleBill = detailList.get(0).getEmisSettleBill(); + payRecord.setSettleType(emisSettleBill.getSettleType()); + } payRecord.setTradeDate(apply.getTradeDate()); payRecord.setRecManCode(currentUser.getEmpCode());