From a96948456e0a21ab33deeb2edfdd7ef343aec5bf Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期六, 25 四月 2026 16:20:34 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_New_pro
---
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java | 55 ++++++++++++++++++++++---------------------------------
1 files changed, 22 insertions(+), 33 deletions(-)
diff --git a/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java b/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java
index 21d76d4..4fc62fc 100644
--- a/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java
+++ b/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java
@@ -1,31 +1,26 @@
package com.ruoyi.warehouse.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-
import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.warehouse.dto.WarehouseGoodsShelvesDto;
import com.ruoyi.warehouse.mapper.DocumentationMapper;
import com.ruoyi.warehouse.mapper.WarehouseGoodsShelvesMapper;
import com.ruoyi.warehouse.mapper.WarehouseGoodsShelvesRowcolMapper;
import com.ruoyi.warehouse.pojo.Documentation;
+import com.ruoyi.warehouse.pojo.WarehouseGoodsShelves;
import com.ruoyi.warehouse.pojo.WarehouseGoodsShelvesRowcol;
import com.ruoyi.warehouse.service.DocumentationService;
import com.ruoyi.warehouse.service.WarehouseGoodsShelvesRowcolService;
import com.ruoyi.warehouse.service.WarehouseGoodsShelvesService;
+import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import com.ruoyi.warehouse.pojo.WarehouseGoodsShelves;
-
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -37,28 +32,21 @@
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
-public class WarehouseGoodsShelvesServiceImpl extends ServiceImpl<WarehouseGoodsShelvesMapper, WarehouseGoodsShelves>
- implements WarehouseGoodsShelvesService {
- @Autowired
- private WarehouseGoodsShelvesRowcolService warehouseGoodsShelvesRowcolService;
- @Autowired
- private WarehouseGoodsShelvesRowcolMapper warehouseGoodsShelvesRowcolMapper;
- @Autowired
- private WarehouseGoodsShelvesMapper warehouseGoodsShelvesMapper;
- @Autowired
- private DocumentationService documentationService;
- @Autowired
- private DocumentationMapper documentationMapper;
- @Override
- public IPage<WarehouseGoodsShelves> listPage(Page page, WarehouseGoodsShelves warehouseGoodsShelves) {
- return warehouseGoodsShelvesMapper.listPage(page,warehouseGoodsShelves);
- }
+@RequiredArgsConstructor
+public class WarehouseGoodsShelvesServiceImpl extends ServiceImpl<WarehouseGoodsShelvesMapper, WarehouseGoodsShelves> implements WarehouseGoodsShelvesService {
+
+ private final WarehouseGoodsShelvesRowcolService warehouseGoodsShelvesRowcolService;
+ private final WarehouseGoodsShelvesMapper warehouseGoodsShelvesMapper;
+ private final DocumentationMapper documentationMapper;
@Override
public boolean add(WarehouseGoodsShelves warehouseGoodsShelves) {
WarehouseGoodsShelves one = warehouseGoodsShelvesMapper.selectOne(new LambdaQueryWrapper<WarehouseGoodsShelves>().eq(WarehouseGoodsShelves::getId, warehouseGoodsShelves.getId()));
// 1. 妫�鏌ヨ揣鏋跺悕绉版槸鍚﹀凡瀛樺湪
if (one == null) {
+ if(warehouseGoodsShelves.getRow() == null || warehouseGoodsShelves.getRow() == 0 && warehouseGoodsShelves.getCol() == null || warehouseGoodsShelves.getCol() == 0){
+ throw new IllegalArgumentException("灞傛暟鍜屽垪鏁颁笉鑳戒负绌�");
+ }
int insert = warehouseGoodsShelvesMapper.insert(warehouseGoodsShelves);
if (insert <= 0) return false;
}
@@ -67,11 +55,11 @@
Long warehouseId = warehouseGoodsShelves.getWarehouseId();
// 3. 鎵归噺鍒涘缓琛屽垪璁板綍
List<WarehouseGoodsShelvesRowcol> rowcolList = new ArrayList<>();
- for (long i = 1; i <= warehouseGoodsShelves.getStorey(); i++) {
- for (long j = 1; j <= warehouseGoodsShelves.getArrange(); j++) {
+ for (long i = 1; i <= warehouseGoodsShelves.getRow(); i++) {
+ for (long j = 1; j <= warehouseGoodsShelves.getCol(); j++) {
WarehouseGoodsShelvesRowcol rowcol = new WarehouseGoodsShelvesRowcol();
- rowcol.setStorey(i);
- rowcol.setArrange(j);
+ rowcol.setRow(i);
+ rowcol.setCol(j);
rowcol.setWarehouseGoodsShelvesId(shelvesId);
rowcolList.add(rowcol);
}
@@ -109,7 +97,7 @@
Wrapper<Documentation> queryWrapper1 = new LambdaQueryWrapper<Documentation>()
.in(Documentation::getWarehouseGoodsShelvesRowcolId, rowcolIds);
List<Documentation> documentations = documentationMapper.selectList(queryWrapper1);
- if (!documentations.isEmpty()) return false;
+ if (!documentations.isEmpty()) throw new RuntimeException("璐ф灦涓嬫湁鍟嗗搧锛屼笉鑳藉垹闄�");
// 鍏堟洿鏂拌揣鏋朵富淇℃伅
updateById(warehouseGoodsShelves);
@@ -148,7 +136,7 @@
Wrapper<Documentation> queryWrapper1 = new LambdaQueryWrapper<Documentation>()
.in(Documentation::getWarehouseGoodsShelvesRowcolId, rowcolIds);
List<Documentation> documentations = documentationMapper.selectList(queryWrapper1);
- if (!documentations.isEmpty()) return false; // 浠讳竴璐ф灦鏈夊晢鍝佸垯缁堟鍒犻櫎
+ if (!documentations.isEmpty()) throw new RuntimeException("璐ф灦涓嬫湁鍟嗗搧锛屼笉鑳藉垹闄�"); // 浠讳竴璐ф灦鏈夊晢鍝佸垯缁堟鍒犻櫎
}
// 3. 鍏堝垹闄よ揣鏋朵富璁板綍
@@ -166,9 +154,10 @@
return true;
}
+
@Override
- public List<WarehouseGoodsShelves> list(WarehouseGoodsShelves warehouseGoodsShelves) {
- return warehouseGoodsShelvesMapper.list(warehouseGoodsShelves);
+ public List<WarehouseGoodsShelvesDto> findList(WarehouseGoodsShelves warehouseGoodsShelves) {
+ return warehouseGoodsShelvesMapper.listAll(warehouseGoodsShelves);
}
}
--
Gitblit v1.9.3