From f4534007aa5461630439fbb74f54ad49ed2b826b Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Tue, 12 May 2026 16:21:54 +0800 Subject: [PATCH] =?UTF-8?q?2026-05-12=20=E5=BE=85=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E6=B8=85=E5=8D=95=E3=80=90=E6=8A=A5=E4=BB=B7=E3=80=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quote/service/impl/QuoteServiceImpl.java | 14 ++++++++++++-- .../quotation/QuotationInformationMapper.xml | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java b/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java index 5ace98c3..b32dfbbb 100644 --- a/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java +++ b/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java @@ -252,6 +252,8 @@ public class QuoteServiceImpl extends ServiceImpl implements @Transactional public List batchSaveQuoteByQuotation(List list) { List ids = new ArrayList<>();// 获取保存成功的报价单ID + // 按 site 缓存下一个可用报价序号,避免批量处理时重复扫描 plm_quote 获取最大号 + Map siteNextQuoteNoMap = new HashMap<>(); for (QuotationInformationVo quotation : list) { if (Objects.isNull(quotation.getCurrency())){ throw new RuntimeException("币种不能为空"); @@ -278,8 +280,16 @@ public class QuoteServiceImpl extends ServiceImpl implements quote.setCreateDate(new Date()); quote.setQuoteDate(new Date()); // quote.setCustomerInquiryNo(quotation.getCustomer()); - // 2、获取报价单号 - String quoteNo = Constant.BJ+baseMapper.queryQuoteNo(quote); + // 2、获取报价单号(按站点批量缓存起始号,循环内递增) + Integer nextQuoteNo = siteNextQuoteNoMap.get(quote.getSite()); + if (Objects.isNull(nextQuoteNo)) { + Quote seedQuote = new Quote(); + seedQuote.setSite(quote.getSite()); + String quoteNoSeed = baseMapper.queryQuoteNo(seedQuote); + nextQuoteNo = StringUtils.hasText(quoteNoSeed) ? Integer.parseInt(quoteNoSeed) : 1; + } + String quoteNo = Constant.BJ + String.format("%08d", nextQuoteNo); + siteNextQuoteNoMap.put(quote.getSite(), nextQuoteNo + 1); quote.setQuoteNo(quoteNo); quote.setVersionNo("A001"); quote.setQuoteVersionNo(quote.getQuoteNo() + "-" + quote.getVersionNo()); diff --git a/src/main/resources/mapper/quotation/QuotationInformationMapper.xml b/src/main/resources/mapper/quotation/QuotationInformationMapper.xml index b5386f6b..a3a3ada2 100644 --- a/src/main/resources/mapper/quotation/QuotationInformationMapper.xml +++ b/src/main/resources/mapper/quotation/QuotationInformationMapper.xml @@ -285,7 +285,12 @@ left join plm_customer_part_info pcpi on a.site = pcpi.site and a.test_part_no = pcpi.part_no and a.customer_no = pcpi.customer_no a.site = #{query.site} and d.node_id = '400' - and a.quotation_no not in (select inside_inquiry_no from plm_quote where site = #{query.site}) + and not exists ( + select 1 + from plm_quote + where site = #{query.site} + and inside_inquiry_no = a.quotation_no + ) and vpp.bu_no in (select bu_No from dbo.Get_Now_BU_chooseAble(a.site, #{query.createBy}))