From 6e48c86221ae3a88c7a0234b98b81e7326f9c8da Mon Sep 17 00:00:00 2001 From: qiezi <15576055375@163.com> Date: Tue, 23 Jul 2024 16:02:11 +0800 Subject: [PATCH] =?UTF-8?q?24-05-16=20=E6=A0=87=E7=AD=BE=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/board/service/impl/BoardServiceImpl.java | 4 +++- .../modules/production/entity/PrintLabelRecord.java | 2 ++ .../service/impl/OutboundLabelScanServiceImpl.java | 12 ++++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/heai/modules/board/service/impl/BoardServiceImpl.java b/src/main/java/com/heai/modules/board/service/impl/BoardServiceImpl.java index f094d2d..5387bfe 100644 --- a/src/main/java/com/heai/modules/board/service/impl/BoardServiceImpl.java +++ b/src/main/java/com/heai/modules/board/service/impl/BoardServiceImpl.java @@ -613,8 +613,10 @@ public class BoardServiceImpl implements BoardService { record.setPrintQty(BigDecimal.valueOf(packagePrintData.getUnitQty())); record.setCreateTime(new Date()); printLabelRecordService.save(record); + Integer count = printLabelRecordService.lambdaQuery().eq(PrintLabelRecord::getSeqNo, packagePrintData.getSeqNo()).count(); + printLabelRecordService.lambdaUpdate().set(PrintLabelRecord::getItemNo,count).eq(PrintLabelRecord::getId,record.getId()).update(); // 参数赋值 - packagePrintData.setPrintId(record.getId()); + packagePrintData.setPrintId(count.longValue()); List resultList = new ArrayList<>(); resultList.add(packagePrintData); return resultList; diff --git a/src/main/java/com/heai/modules/production/entity/PrintLabelRecord.java b/src/main/java/com/heai/modules/production/entity/PrintLabelRecord.java index 4228f06..8c1a6a8 100644 --- a/src/main/java/com/heai/modules/production/entity/PrintLabelRecord.java +++ b/src/main/java/com/heai/modules/production/entity/PrintLabelRecord.java @@ -24,4 +24,6 @@ public class PrintLabelRecord { private BigDecimal printQty; private Date createTime; + + private Long itemNo; } diff --git a/src/main/java/com/heai/modules/production/service/impl/OutboundLabelScanServiceImpl.java b/src/main/java/com/heai/modules/production/service/impl/OutboundLabelScanServiceImpl.java index ba4c4ee..a53d0f1 100644 --- a/src/main/java/com/heai/modules/production/service/impl/OutboundLabelScanServiceImpl.java +++ b/src/main/java/com/heai/modules/production/service/impl/OutboundLabelScanServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.heai.modules.production.dao.OutboundLabelScanMapper; import com.heai.modules.production.entity.OutboundLabelScan; import com.heai.modules.production.entity.OutboundLabelScanData; +import com.heai.modules.production.entity.PrintLabelRecord; import com.heai.modules.production.service.OutboundLabelScanService; import com.heai.modules.production.service.PrintLabelRecordService; import lombok.extern.slf4j.Slf4j; @@ -18,6 +19,9 @@ import java.util.Objects; @Slf4j public class OutboundLabelScanServiceImpl extends ServiceImpl implements OutboundLabelScanService { + @Autowired + private PrintLabelRecordService printLabelRecordService; + @Override @Transactional public boolean save(OutboundLabelScan entity) { @@ -63,9 +67,13 @@ public class OutboundLabelScanServiceImpl extends ServiceImpl list = lambdaQuery().eq(OutboundLabelScan::getPrintId, outboundLabelScan.getPrintId()).list(); + PrintLabelRecord record = printLabelRecordService.lambdaQuery().eq(PrintLabelRecord::getSeqNo, outboundLabelScan.getSeqNo()).eq(PrintLabelRecord::getItemNo, outboundLabelScan.getPrintId()).one(); + if (Objects.isNull(record)){ + throw new RuntimeException("标签异常,请重新打印"); + } + List list = lambdaQuery().eq(OutboundLabelScan::getPrintId, record.getId()).list(); if (!list.isEmpty()){ - throw new RuntimeException("标签已扫描,请勿重复扫描"); + throw new RuntimeException("重复扫描"); } } // 查询用户信息