From f67161d150eb5720b28fd3f9fbb40c4145d1146c Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 10 六月 2026 11:42:37 +0800
Subject: [PATCH] feat:1.已审核只能编辑单价 2.添加完成按钮 3.添加标签打印和单据打印次数展示

---
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index 9c7f2a2..527268f 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -3640,4 +3640,58 @@
                 .eq(StockOutRecord::getSalesLedgerId, originalSalesLedgerId)
         );
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void markOrderCompleted(List<Long> ids) {
+        if (CollectionUtils.isEmpty(ids)) {
+            throw new ServiceException("璇烽�夋嫨瑕佹爣璁板畬鎴愮殑璁㈠崟");
+        }
+        for (Long id : ids) {
+            SalesLedger ledger = salesLedgerMapper.selectById(id);
+            if (ledger == null) {
+                throw new ServiceException("璁㈠崟涓嶅瓨鍦紝鏃犳硶鏍囪瀹屾垚");
+            }
+            if (ledger.getReviewStatus() == null || ledger.getReviewStatus() != 1) {
+                throw new ServiceException("璁㈠崟" + ledger.getSalesContractNo() + "涓嶆槸宸插鏍哥姸鎬侊紝鏃犳硶鏍囪瀹屾垚");
+            }
+            if (ledger.getOrderStatus() != null && ledger.getOrderStatus() == 1) {
+                throw new ServiceException("璁㈠崟" + ledger.getSalesContractNo() + "宸插畬鎴愶紝鏃犻渶閲嶅鏍囪");
+            }
+        }
+        salesLedgerMapper.update(null,
+            Wrappers.<SalesLedger>lambdaUpdate()
+                .in(SalesLedger::getId, ids)
+                .set(SalesLedger::getOrderStatus, 1)
+        );
+    }
+
+    @Override
+    public void incrementPrintCount(Long id, String printType) {
+        if (id == null) {
+            throw new ServiceException("閿�鍞彴璐D涓嶈兘涓虹┖");
+        }
+        if (printType == null || (!"label".equals(printType) && !"document".equals(printType))) {
+            throw new ServiceException("鎵撳嵃绫诲瀷蹇呴』涓� label 鎴� document");
+        }
+        SalesLedger ledger = salesLedgerMapper.selectById(id);
+        if (ledger == null) {
+            throw new ServiceException("閿�鍞彴璐︿笉瀛樺湪");
+        }
+        if ("label".equals(printType)) {
+            int currentCount = ledger.getLabelPrintCount() == null ? 0 : ledger.getLabelPrintCount();
+            salesLedgerMapper.update(null,
+                Wrappers.<SalesLedger>lambdaUpdate()
+                    .eq(SalesLedger::getId, id)
+                    .set(SalesLedger::getLabelPrintCount, currentCount + 1)
+            );
+        } else {
+            int currentCount = ledger.getDocumentPrintCount() == null ? 0 : ledger.getDocumentPrintCount();
+            salesLedgerMapper.update(null,
+                Wrappers.<SalesLedger>lambdaUpdate()
+                    .eq(SalesLedger::getId, id)
+                    .set(SalesLedger::getDocumentPrintCount, currentCount + 1)
+            );
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3