Merge remote-tracking branch 'origin/dev_WMS20260401' into dev_WMS20260401
This commit is contained in:
+34
-28
@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库区
|
||||
*
|
||||
@@ -60,18 +61,11 @@ public class StorageSectionDomainService {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null){
|
||||
if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null) {
|
||||
throw new ServiceException("获取当前登陆人组织与登陆仓库失败!");
|
||||
}
|
||||
int count = storageSectionService.count(new QueryWrapper<StorageSection>().lambda()
|
||||
.eq(StorageSection::getOrganizationId, topOrganizationId)
|
||||
.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()+ "】已存在");
|
||||
}
|
||||
checkStorageSectionDuplicate(topOrganizationId, associationWarehouseCacheDO.getWarehouseId(),
|
||||
storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(), null);
|
||||
//设置仓库
|
||||
setWarehouseInfo(storageSectionDO);
|
||||
return storageSectionService.insert(storageSectionDO);
|
||||
@@ -84,33 +78,46 @@ public class StorageSectionDomainService {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null){
|
||||
if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null) {
|
||||
throw new ServiceException("获取当前登陆人组织与登陆仓库失败!");
|
||||
}
|
||||
int count = storageSectionService.count(new QueryWrapper<StorageSection>().lambda()
|
||||
.eq(StorageSection::getStorageCode, storageSectionDO.getStorageCode())
|
||||
.eq(StorageSection::getDelFlag, 1)
|
||||
.eq(StorageSection::getTopOrganizationId, topOrganizationId)
|
||||
.eq(StorageSection::getWarehouseId, associationWarehouseCacheDO.getWarehouseId())
|
||||
.ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId()));
|
||||
if (count > 0){
|
||||
throw new ServiceException("库区编码【" + storageSectionDO.getStorageCode()+ "】已存在");
|
||||
}
|
||||
checkStorageSectionDuplicate(topOrganizationId, associationWarehouseCacheDO.getWarehouseId(),
|
||||
storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(),
|
||||
storageSectionDO.getStorageSectionId());
|
||||
//设置仓库
|
||||
setWarehouseInfo(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 设置仓库信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 10:01
|
||||
* @param storageSectionDO
|
||||
*/
|
||||
private void setWarehouseInfo(StorageSectionDO storageSectionDO) {
|
||||
Warehouse warehouse = warehouseService.getOne(new QueryWrapper<Warehouse>().lambda()
|
||||
.eq(Warehouse::getWarehouseId, storageSectionDO.getWarehouseId()));
|
||||
if (warehouse == null){
|
||||
if (warehouse == null) {
|
||||
throw new ServiceException("库区所属仓库不存在");
|
||||
}
|
||||
storageSectionDO.setWarehouseCode(warehouse.getWarehouseCode());
|
||||
@@ -124,13 +131,13 @@ public class StorageSectionDomainService {
|
||||
int count = storageLocationGroupService.count(new QueryWrapper<StorageLocationGroup>().lambda()
|
||||
.in(StorageLocationGroup::getStorageSectionId, Arrays.asList(storageSectionIds))
|
||||
.eq(StorageLocationGroup::getDelFlag, 1));
|
||||
if (count > 0){
|
||||
if (count > 0) {
|
||||
throw new ServiceException("库区存在库位组禁止删除");
|
||||
}
|
||||
int count2 = storageLocationService.count(new QueryWrapper<StorageLocation>().lambda()
|
||||
.in(StorageLocation::getStorageSectionId, Arrays.asList(storageSectionIds))
|
||||
.eq(StorageLocation::getDelFlag, 1));
|
||||
if (count2 > 0){
|
||||
if (count2 > 0) {
|
||||
throw new ServiceException("库区存在库位禁止删除");
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param storageSectionIds
|
||||
* @return Boolean
|
||||
* @description 作废库区
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/3 17:06
|
||||
* @param storageSectionIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(Long[] storageSectionIds) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
Reference in New Issue
Block a user