Merge remote-tracking branch 'origin/dev_WMS20260401' into dev_WMS20260401

This commit is contained in:
王奎兴
2026-06-12 16:09:31 +08:00
@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 库区 * 库区
* *
@@ -60,18 +61,11 @@ public class StorageSectionDomainService {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid()); AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null){ if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null) {
throw new ServiceException("获取当前登陆人组织与登陆仓库失败!"); throw new ServiceException("获取当前登陆人组织与登陆仓库失败!");
} }
int count = storageSectionService.count(new QueryWrapper<StorageSection>().lambda() checkStorageSectionDuplicate(topOrganizationId, associationWarehouseCacheDO.getWarehouseId(),
.eq(StorageSection::getOrganizationId, topOrganizationId) storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(), null);
.eq(StorageSection::getTopOrganizationId, topOrganizationId)
.eq(StorageSection::getWarehouseId, associationWarehouseCacheDO.getWarehouseId())
.eq(StorageSection::getStorageCode, storageSectionDO.getStorageCode())
.eq(StorageSection::getDelFlag, 1));
if (count > 0){
throw new ServiceException("库区编码【" + storageSectionDO.getStorageCode()+ "】已存在");
}
//设置仓库 //设置仓库
setWarehouseInfo(storageSectionDO); setWarehouseInfo(storageSectionDO);
return storageSectionService.insert(storageSectionDO); return storageSectionService.insert(storageSectionDO);
@@ -84,33 +78,46 @@ public class StorageSectionDomainService {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid()); AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null){ if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null) {
throw new ServiceException("获取当前登陆人组织与登陆仓库失败!"); throw new ServiceException("获取当前登陆人组织与登陆仓库失败!");
} }
int count = storageSectionService.count(new QueryWrapper<StorageSection>().lambda() checkStorageSectionDuplicate(topOrganizationId, associationWarehouseCacheDO.getWarehouseId(),
.eq(StorageSection::getStorageCode, storageSectionDO.getStorageCode()) storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(),
.eq(StorageSection::getDelFlag, 1) storageSectionDO.getStorageSectionId());
.eq(StorageSection::getTopOrganizationId, topOrganizationId)
.eq(StorageSection::getWarehouseId, associationWarehouseCacheDO.getWarehouseId())
.ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId()));
if (count > 0){
throw new ServiceException("库区编码【" + storageSectionDO.getStorageCode()+ "】已存在");
}
//设置仓库 //设置仓库
setWarehouseInfo(storageSectionDO); setWarehouseInfo(storageSectionDO);
return storageSectionService.update(storageSectionDO); return storageSectionService.update(storageSectionDO);
} }
/** /**
* 校验同一仓库下库区编码或名称是否重复
*/
private void checkStorageSectionDuplicate(Long topOrganizationId, Long warehouseId, String storageCode,
String storageName, Long excludeStorageSectionId) {
int count = storageSectionService.count(new QueryWrapper<StorageSection>().lambda()
.eq(StorageSection::getOrganizationId, topOrganizationId)
.eq(StorageSection::getTopOrganizationId, topOrganizationId)
.eq(StorageSection::getWarehouseId, warehouseId)
.eq(StorageSection::getDelFlag, 1)
.and(w -> w.eq(StorageSection::getStorageCode, storageCode)
.or()
.eq(StorageSection::getStorageName, storageName))
.ne(excludeStorageSectionId != null, StorageSection::getStorageSectionId, excludeStorageSectionId));
if (count > 0) {
throw new ServiceException("同一仓库下库区编码或名称已存在");
}
}
/**
* @param storageSectionDO
* @description 设置仓库信息 * @description 设置仓库信息
* @author ZhouGY * @author ZhouGY
* @date 2024/4/7 10:01 * @date 2024/4/7 10:01
* @param storageSectionDO
*/ */
private void setWarehouseInfo(StorageSectionDO storageSectionDO) { private void setWarehouseInfo(StorageSectionDO storageSectionDO) {
Warehouse warehouse = warehouseService.getOne(new QueryWrapper<Warehouse>().lambda() Warehouse warehouse = warehouseService.getOne(new QueryWrapper<Warehouse>().lambda()
.eq(Warehouse::getWarehouseId, storageSectionDO.getWarehouseId())); .eq(Warehouse::getWarehouseId, storageSectionDO.getWarehouseId()));
if (warehouse == null){ if (warehouse == null) {
throw new ServiceException("库区所属仓库不存在"); throw new ServiceException("库区所属仓库不存在");
} }
storageSectionDO.setWarehouseCode(warehouse.getWarehouseCode()); storageSectionDO.setWarehouseCode(warehouse.getWarehouseCode());
@@ -124,13 +131,13 @@ public class StorageSectionDomainService {
int count = storageLocationGroupService.count(new QueryWrapper<StorageLocationGroup>().lambda() int count = storageLocationGroupService.count(new QueryWrapper<StorageLocationGroup>().lambda()
.in(StorageLocationGroup::getStorageSectionId, Arrays.asList(storageSectionIds)) .in(StorageLocationGroup::getStorageSectionId, Arrays.asList(storageSectionIds))
.eq(StorageLocationGroup::getDelFlag, 1)); .eq(StorageLocationGroup::getDelFlag, 1));
if (count > 0){ if (count > 0) {
throw new ServiceException("库区存在库位组禁止删除"); throw new ServiceException("库区存在库位组禁止删除");
} }
int count2 = storageLocationService.count(new QueryWrapper<StorageLocation>().lambda() int count2 = storageLocationService.count(new QueryWrapper<StorageLocation>().lambda()
.in(StorageLocation::getStorageSectionId, Arrays.asList(storageSectionIds)) .in(StorageLocation::getStorageSectionId, Arrays.asList(storageSectionIds))
.eq(StorageLocation::getDelFlag, 1)); .eq(StorageLocation::getDelFlag, 1));
if (count2 > 0){ if (count2 > 0) {
throw new ServiceException("库区存在库位禁止删除"); throw new ServiceException("库区存在库位禁止删除");
} }
return storageSectionService.delete(storageSectionIds); return storageSectionService.delete(storageSectionIds);
@@ -139,17 +146,16 @@ public class StorageSectionDomainService {
/** /**
* 获取库区详细信息 * 获取库区详细信息
*/ */
public StorageSectionPO getInfo(Long storageSectionId) public StorageSectionPO getInfo(Long storageSectionId) {
{
return storageSectionService.getInfo(storageSectionId); return storageSectionService.getInfo(storageSectionId);
} }
/** /**
* @param storageSectionIds
* @return Boolean
* @description 作废库区 * @description 作废库区
* @author ZhouGY * @author ZhouGY
* @date 2024/4/3 17:06 * @date 2024/4/3 17:06
* @param storageSectionIds
* @return Boolean
*/ */
public Boolean nullifyByIds(Long[] storageSectionIds) { public Boolean nullifyByIds(Long[] storageSectionIds) {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();