Merge remote-tracking branch 'origin/dev_WMS20260401' into dev_WMS20260401
This commit is contained in:
+29
-23
@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库区
|
||||
*
|
||||
@@ -63,15 +64,8 @@ public class StorageSectionDomainService {
|
||||
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);
|
||||
@@ -87,25 +81,38 @@ public class StorageSectionDomainService {
|
||||
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()
|
||||
@@ -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