From a6869a8a9a3a5e1b54e6d5271fb2cb844cc63e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Thu, 27 Jun 2024 22:57:34 +0800 Subject: [PATCH] =?UTF-8?q?optimize(ebom):=20=E5=AF=BC=E5=85=A5SAP?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BomNewPbomExportToSAPImpl.java | 29 +++++++++---------- .../service/IBomNewPbomExportToSAP.java | 2 +- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomExportToSAPImpl.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomExportToSAPImpl.java index c3335930..9367f655 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomExportToSAPImpl.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomExportToSAPImpl.java @@ -273,25 +273,22 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP { * @param materialNo 直发包编号 */ @Override - public void exportFromZFB(String materialNo) { - List pfhbs = bomNewPbomParentService.lambdaQuery() + public void exportFromZFB(String materialNo, String facCode) { + BomNewPbomParentEntity pfhb = bomNewPbomParentService.lambdaQuery() .eq(BomNewPbomParentEntity::getMaterialNo, materialNo) + .eq(BomNewPbomParentEntity::getFacCode, facCode) .ge(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue()) - .list(); - VUtils.isTure(Objects.isNull(pfhbs)).throwMessage("没有需要导入的数据"); + .one(); + VUtils.isTure(Objects.isNull(pfhb)).throwMessage("没有需要导入的数据"); - pfhbs.forEach(pfhb -> { - List errorMsgVOS = export(pfhb.getRowId()); - if (CollUtil.isNotEmpty(errorMsgVOS)) { - //如果导入SAP出错了,得将该bom提升为用户根节点,以便用户手动尝试导入到SAP去 - pfhb.setUserRootIs(1); - pfhb.setModifyTime(LocalDateTime.now()); - } - }); - - pfhbs.removeIf(p -> Objects.equals(p.getLastVersionIs(), 0)); - if (CollUtil.isNotEmpty(pfhbs)) { - bomNewPbomParentService.updateBatchById(pfhbs); + List errorMsgVOS = export(pfhb.getRowId()); + if (CollUtil.isNotEmpty(errorMsgVOS)) { + //如果导入SAP出错了,得将该bom提升为用户根节点,以便用户手动尝试导入到SAP去 + pfhb.setUserRootIs(1); + pfhb.setModifyTime(LocalDateTime.now()); + } + if (Objects.equals(pfhb.getLastVersionIs(), 1)) { + bomNewPbomParentService.updateById(pfhb); } } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/IBomNewPbomExportToSAP.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/IBomNewPbomExportToSAP.java index 13fb5c7f..e2d0ee00 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/IBomNewPbomExportToSAP.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/IBomNewPbomExportToSAP.java @@ -27,5 +27,5 @@ public interface IBomNewPbomExportToSAP { * 根据直发包编号导入上级物料到SAP * @param materialNo 直发包编号 */ - void exportFromZFB(String materialNo); + void exportFromZFB(String materialNo, String facCode); }