From 72aa82ca406b95fd56de4c8233db44be0bb5a1a3 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期三, 08 一月 2025 13:46:50 +0800
Subject: [PATCH] bug修改

---
 manage/src/main/java/com/jilongda/manage/controller/TWarehousingController.java |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/manage/src/main/java/com/jilongda/manage/controller/TWarehousingController.java b/manage/src/main/java/com/jilongda/manage/controller/TWarehousingController.java
index bfc9c4f..e413752 100644
--- a/manage/src/main/java/com/jilongda/manage/controller/TWarehousingController.java
+++ b/manage/src/main/java/com/jilongda/manage/controller/TWarehousingController.java
@@ -92,17 +92,18 @@
     @ApiOperation(value = "镜片-根据系列id、球/非球、品牌id、折射率、ballMirror、columnMirror查询当前库存")
     @PostMapping(value = "/getCurrentByParamLens")
     public ApiResult<Integer> getCurrentByParamLens(@RequestBody GetCurrentByParamLens dto) {
-        TLensGoods one = lensGoodsService.lambdaQuery().eq(TLensGoods::getSeriesId, dto.getSeriesId())
+        List<TLensGoods> one = lensGoodsService.lambdaQuery().eq(TLensGoods::getSeriesId, dto.getSeriesId())
                 .eq(dto.getLensType()!=null,TLensGoods::getLensType, dto.getLensType())
                 .eq(StringUtils.hasLength(dto.getRefractiveIndex()),TLensGoods::getRefractiveIndex, dto.getRefractiveIndex())
                 .eq(StringUtils.hasLength(dto.getBallMirror()),TLensGoods::getBallMirror, dto.getBallMirror())
                 .eq(StringUtils.hasLength(dto.getColumnMirror()),TLensGoods::getColumnMirror, dto.getColumnMirror())
                 .eq(dto.getStoreId()!=null,TLensGoods::getStoreId, dto.getStoreId())
-                .one();
-        if (one!=null){
-            return ApiResult.success(one.getTotal());
-        }
-        return ApiResult.success(0);
+                .list();
+        if (one.isEmpty())return ApiResult.success(0);
+        Integer temp = one.stream()
+                .mapToInt(TLensGoods::getTotal)
+                .sum();
+       return ApiResult.success(temp);
     }
     @ApiOperation(value = "镜架库存分页列表")
     @PostMapping(value = "/frameReceiptList")
@@ -235,6 +236,9 @@
                     // 增加对应库存
                     one.setTotal(one.getTotal()-frameWarehousingDetail.getTotal());
                     list1.add(one);
+                }else {
+                    return ApiResult.failed("商品不存在");
+
                 }
             }
             if (!list1.isEmpty())frameGoodsService.updateBatchById(list1);
@@ -295,7 +299,6 @@
                         .eq(TLensGoods::getBallMirror, frameWarehousingDetail.getBallMirror())
                         .eq(TLensGoods::getColumnMirror, frameWarehousingDetail.getColumnMirror())
                         .eq(TLensGoods::getStoreId, dto.getStoreId())
-
                         .one();
                 if (one!=null){
                     if (one.getTotal()-frameWarehousingDetail.getTotal()<0){
@@ -304,6 +307,9 @@
                     // 减少对应库存
                     one.setTotal(one.getTotal()-frameWarehousingDetail.getTotal());
                     list1.add(one);
+                }else {
+                    return ApiResult.failed("商品不存在");
+
                 }
             }
             if (!list1.isEmpty())lensGoodsService.updateBatchById(list1);

--
Gitblit v1.7.1