From 3e5f65ea3c17324d02b374b77dae490ebc87261a Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期二, 26 五月 2026 15:29:46 +0800
Subject: [PATCH] 调整

---
 src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
index c5b4136..1430619 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -7,7 +7,6 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
 import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
-import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.domain.R;
 import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
@@ -47,11 +46,12 @@
 @AllArgsConstructor
 public class StockInventoryServiceImpl extends ServiceImpl<StockInventoryMapper, StockInventory> implements StockInventoryService {
 
-    private  StockInventoryMapper stockInventoryMapper;
-    private StockInRecordService stockInRecordService;
-    private StockOutRecordService stockOutRecordService;
-    private StockUninventoryService stockUninventoryService;
-    private SalesLedgerProductMapper salesLedgerProductMapper;
+    private final StockInventoryMapper stockInventoryMapper;
+    private final StockInRecordService stockInRecordService;
+    private final StockOutRecordService stockOutRecordService;
+    private final StockUninventoryService stockUninventoryService;
+    private final SalesLedgerProductMapper salesLedgerProductMapper;
+
     @Override
     public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) {
         return stockInventoryMapper.pagestockInventory(page, stockInventoryDto);
@@ -86,8 +86,8 @@
             newStockInventory.setLockedQuantity(stockInventoryDto.getLockedQuantity());
             newStockInventory.setWarnNum(stockInventoryDto.getWarnNum());
             stockInventoryMapper.insert(newStockInventory);
-        }else {
-             stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
+        } else {
+            stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
         }
         return true;
     }
@@ -145,7 +145,7 @@
                 // 鏋勫缓鏌ユ壘閿�
                 String key = dto.getProductName() + "|" + dto.getModel();
                 SalesLedgerProduct matchedProduct = productMap.get(key);
-                
+
                 if (matchedProduct != null) {
                     // 澶勭悊鍚堟牸搴撳瓨
                     if (dto.getQualifiedQuantity() != null && dto.getQualifiedQuantity().compareTo(BigDecimal.ZERO) > 0) {
@@ -155,7 +155,7 @@
                         stockInventoryDto.setQualitity(dto.getQualifiedQuantity());
                         stockInventoryDto.setRemark(dto.getRemark());
                         stockInventoryDto.setWarnNum(dto.getWarnNum());
-                        
+
                         // 楠岃瘉鍚堟牸鍐荤粨鏁伴噺
                         if (ObjectUtils.isNotEmpty(dto.getQualifiedLockedQuantity())) {
                             if (dto.getQualifiedLockedQuantity().compareTo(dto.getQualifiedQuantity()) > 0) {
@@ -165,7 +165,7 @@
                         } else {
                             stockInventoryDto.setLockedQuantity(BigDecimal.ZERO);
                         }
-                        
+
                         stockInventoryDto.setProductModelId(matchedProduct.getProductModelId());
                         this.addstockInventory(stockInventoryDto);
                         successCount++;
@@ -178,7 +178,7 @@
                         stockUninventoryDto.setRecordType(StockInUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode());
                         stockUninventoryDto.setQualitity(dto.getUnQualifiedQuantity());
                         stockUninventoryDto.setRemark(dto.getRemark());
-                        
+
                         // 楠岃瘉涓嶅悎鏍煎喕缁撴暟閲�
                         if (ObjectUtils.isNotEmpty(dto.getUnQualifiedLockedQuantity())) {
                             if (dto.getUnQualifiedLockedQuantity().compareTo(dto.getUnQualifiedQuantity()) > 0) {
@@ -199,7 +199,7 @@
                     unmatchedRecords.add(unmatchedRecord);
                 }
             }
-            
+
             // 鏋勫缓杩斿洖淇℃伅
             StringBuilder message = new StringBuilder();
             if (!unmatchedRecords.isEmpty()) {
@@ -209,7 +209,7 @@
                 }
                 return R.ok(message.toString());
             }
-            
+
             return R.ok("瀵煎叆鎴愬姛锛屽叡澶勭悊 " + successCount + " 鏉¤褰�");
         } catch (Exception e) {
             log.error("瀵煎叆搴撳瓨澶辫触", e);
@@ -223,28 +223,28 @@
 
         List<StockInventoryExportData> list = stockInventoryMapper.listStockInventoryExportData(stockInventoryDto);
         ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class);
-        util.exportExcel(response,list, "搴撳瓨淇℃伅");
+        util.exportExcel(response, list, "搴撳瓨淇℃伅");
     }
 
     @Override
     public IPage<StockInRecordDto> stockInventoryPage(StockInventoryDto stockInventoryDto, Page page) {
-        return stockInventoryMapper.stockInventoryPage(stockInventoryDto,page);
+        return stockInventoryMapper.stockInventoryPage(stockInventoryDto, page);
     }
 
     @Override
     public IPage<StockInventoryDto> stockInAndOutRecord(StockInventoryDto stockInventoryDto, Page page) {
-        return stockInventoryMapper.stockInAndOutRecord(stockInventoryDto,page);
+        return stockInventoryMapper.stockInAndOutRecord(stockInventoryDto, page);
     }
 
     @Override
     public Boolean frozenStock(StockInventoryDto stockInventoryDto) {
         StockInventory stockInventory = stockInventoryMapper.selectById(stockInventoryDto.getId());
-        if (stockInventory.getQualitity().compareTo(stockInventoryDto.getLockedQuantity())<0) {
+        if (stockInventory.getQualitity().compareTo(stockInventoryDto.getLockedQuantity()) < 0) {
             throw new RuntimeException("鍐荤粨鏁伴噺涓嶈兘瓒呰繃搴撳瓨鏁伴噺");
         }
         if (ObjectUtils.isEmpty(stockInventory.getLockedQuantity())) {
             stockInventory.setLockedQuantity(stockInventoryDto.getLockedQuantity());
-        }else {
+        } else {
             stockInventory.setLockedQuantity(stockInventory.getLockedQuantity().add(stockInventoryDto.getLockedQuantity()));
         }
         return this.updateById(stockInventory);
@@ -253,7 +253,7 @@
     @Override
     public Boolean thawStock(StockInventoryDto stockInventoryDto) {
         StockInventory stockInventory = stockInventoryMapper.selectById(stockInventoryDto.getId());
-        if (stockInventory.getLockedQuantity().compareTo(stockInventoryDto.getLockedQuantity())<0) {
+        if (stockInventory.getLockedQuantity().compareTo(stockInventoryDto.getLockedQuantity()) < 0) {
             throw new RuntimeException("瑙e喕鏁伴噺涓嶈兘瓒呰繃鍐荤粨鏁伴噺");
         }
         stockInventory.setLockedQuantity(stockInventory.getLockedQuantity().subtract(stockInventoryDto.getLockedQuantity()));

--
Gitblit v1.9.3