From 1a02baed6859aa85b1b6a23d5a591549ecfb91b4 Mon Sep 17 00:00:00 2001 From: zhaoyf <1783123481@qq.com> Date: Sat, 13 Jun 2026 15:35:58 +0800 Subject: [PATCH] =?UTF-8?q?opt:EAS=E5=90=8C=E6=AD=A5=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E5=8D=95=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=8D=95=E6=8D=AE=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E5=B9=B6=E4=B8=94=E5=B7=B2=E5=88=9B=E5=BB=BA=E7=8A=B6?= =?UTF-8?q?=E6=80=81=EF=BC=8C=E5=88=99=E5=88=A0=E9=99=A4=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/InboundEasSyncServiceImpl.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/nladmin-system/wms-server/src/main/java/org/nl/wms/ext_manage/purchase/service/impl/InboundEasSyncServiceImpl.java b/nladmin-system/wms-server/src/main/java/org/nl/wms/ext_manage/purchase/service/impl/InboundEasSyncServiceImpl.java index 7e383f5..eecc2a3 100644 --- a/nladmin-system/wms-server/src/main/java/org/nl/wms/ext_manage/purchase/service/impl/InboundEasSyncServiceImpl.java +++ b/nladmin-system/wms-server/src/main/java/org/nl/wms/ext_manage/purchase/service/impl/InboundEasSyncServiceImpl.java @@ -2,6 +2,7 @@ package org.nl.wms.ext_manage.purchase.service.impl; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.wms.ext_manage.service.WmsToZDWmdService; @@ -44,9 +45,19 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService { throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId); } - Purchasemst existing = purchasemstMapper.selectById(billId); + Purchasemst existing = purchasemstMapper.selectOne(new LambdaQueryWrapper() + .eq(Purchasemst::getBill_id, billId)); if (existing != null) { - throw new BadRequestException("EAS采购单同步失败:单据已存在: " + billId); + if (!existing.getBill_status().equals(PurchaseBillStatus.CREATED.getCode())){ + throw new BadRequestException("EAS采购单同步失败:该单据正在执行或已完成: " + billId); + }else { + //单据还未执行则删除重新插入单据 + purchasedtlMapper.delete(new LambdaQueryWrapper() + .eq(Purchasedtl::getBill_id, existing.getBill_id())); + purchasemstMapper.delete(new LambdaQueryWrapper() + .eq(Purchasemst::getBill_id, existing.getBill_id())); + } + } List easDtlList = easQueryService.queryDtlList(billId); @@ -65,9 +76,6 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService { } log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size()); - - - JSONObject result = new JSONObject(); result.put("status", 200); result.put("message", "同步成功");