From 4ebe912a88461a3c02b45f0a3a1541d0fc87f8f4 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Thu, 9 Oct 2025 21:27:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=8D=95=E5=AF=BC=E5=85=A5=E5=90=8E?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=B0=86=E5=8F=91=E8=B4=A7=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=8D=95=E7=A1=AE=E8=AE=A4=E9=87=8C=E5=AF=B9=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=8D=95=E7=8A=B6=E6=80=81=E6=94=B9=E6=88=90?= =?UTF-8?q?=E5=B7=B2=E4=B8=8B=E8=BE=BE=EF=BC=8C=E9=9C=80=E8=A6=81=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E9=87=8D=E6=96=B0=E7=A1=AE=E8=AE=A4=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=98=AF=E5=B7=B2=E6=8A=A5=E5=85=B3=E5=B0=B1=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=B0=86=E5=AF=B9=E5=BA=94=E7=9A=84=E6=8A=A5=E5=85=B3?= =?UTF-8?q?=E5=8D=95=E5=88=A0=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ecss/service/impl/CoDelServiceImpl.java | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java b/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java index 45145bcc..72d36080 100644 --- a/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java +++ b/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java @@ -793,6 +793,9 @@ public class CoDelServiceImpl implements CoDelService { if (mailAddressAll.length>0) { sendMailUtil(textHead, emailContent.toString(), mailAddressAll, headerData); } + + // 改单导入后的状态处理逻辑 + handleNotifyStatusAfterModify(headerData); } /** @@ -2844,7 +2847,7 @@ public class CoDelServiceImpl implements CoDelService { } } - notifyHeader.setModifyFlag(false); + //notifyHeader.setModifyFlag(false); coDelMapper.updateEcssDelHeaderForModify(notifyHeader); coDelMapper.updateEcssDelDetailForModify(notifyHeader); } @@ -3281,4 +3284,56 @@ public class CoDelServiceImpl implements CoDelService { } } + /** + * 改单导入后处理通知单状态 + * 1. 如果当前状态是已报关,则删除对应的报关单 + * 2. 将通知单状态更新为已下达 + * + * @param headerData 发货通知单头数据 + * @author AI Assistant + * @date 2024-10-09 + */ + private void handleNotifyStatusAfterModify(EcssCoDelNotifyHeaderData headerData) { + try { + log.info("开始处理改单导入后的状态更新,发货通知单号:{}, 当前状态:{}", + headerData.getDelNo(), headerData.getNotifyStatus()); + + // 检查当前通知单状态 + String currentStatus = headerData.getNotifyStatus(); + + // 如果当前状态是已报关,需要删除对应的报关单 + if ("已报关".equals(currentStatus)) { + log.info("发货通知单{}状态为已报关,开始删除对应的报关单", headerData.getDelNo()); + + // 查找对应的报关单 + EcssDeclarationHeaderData declarationQuery = new EcssDeclarationHeaderData(); + declarationQuery.setSite(headerData.getSite()); + declarationQuery.setDelNo(headerData.getDelNo()); + + List declarations = coDelMapper.searchDeclarationHeader( + new Page(1, 1000), declarationQuery).getRecords(); + + // 删除找到的报关单 + for (EcssDeclarationHeaderData declaration : declarations) { + log.info("删除报关单,报关单号:{}", declaration.getDeclarationNo()); + coDelMapper.deleteDeclarationHeader(declaration); + coDelMapper.deleteDeclarationDetail(declaration); + } + + log.info("已删除发货通知单{}对应的{}个报关单", headerData.getDelNo(), declarations.size()); + } + + // 将通知单状态更新为已下达 + headerData.setNotifyStatus("已下达"); + coDelMapper.changeEcssDelStatus(headerData); + + log.info("发货通知单{}状态已更新为已下达", headerData.getDelNo()); + + } catch (Exception e) { + log.error("处理改单导入后状态更新失败,发货通知单号:{}, 错误信息:{}", + headerData.getDelNo(), e.getMessage(), e); + throw new RuntimeException("改单导入后状态处理失败:" + e.getMessage()); + } + } + }