|
@@ -1,14 +1,19 @@
|
|
package com.imcs.admin.business.service.impl;
|
|
package com.imcs.admin.business.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
+import com.imcs.admin.business.constants.Status;
|
|
import com.imcs.admin.business.service.WInventoryManagementService;
|
|
import com.imcs.admin.business.service.WInventoryManagementService;
|
|
-import com.imcs.admin.entity.WInventoryManagement;
|
|
|
|
-import com.imcs.admin.entity.WInventoryManagementDetail;
|
|
|
|
|
|
+import com.imcs.admin.entity.*;
|
|
import com.imcs.admin.entity.assemble.WInventoryManagementGroup;
|
|
import com.imcs.admin.entity.assemble.WInventoryManagementGroup;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 物料挂载位置管理(WInventoryManagement)表服务实现类
|
|
* 物料挂载位置管理(WInventoryManagement)表服务实现类
|
|
@@ -51,4 +56,161 @@ public class WInventoryManagementServiceImpl extends BaseServiceImpl implements
|
|
PageInfo pageInfo=new PageInfo(list);
|
|
PageInfo pageInfo=new PageInfo(list);
|
|
return pageInfo;
|
|
return pageInfo;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map signage() {
|
|
|
|
+ Map map=new HashMap<>();
|
|
|
|
+ LambdaQueryWrapper<WWarehouseManagement> wrapper= Wrappers.lambdaQuery(WWarehouseManagement.class).eq(WWarehouseManagement::getWarehouseType,1);
|
|
|
|
+ List<WWarehouseManagement> wWarehouseManagements = wWarehouseManagementMapper.selectList(wrapper);
|
|
|
|
+ AtomicInteger shelfCount= new AtomicInteger();
|
|
|
|
+ wWarehouseManagements.forEach(ware->{
|
|
|
|
+ LambdaQueryWrapper<WShelfManagement> shelfWrapper= Wrappers.lambdaQuery(WShelfManagement.class).eq(WShelfManagement::getWarehouseManagementId,ware.getId());
|
|
|
|
+ List<WShelfManagement> wShelfManagementList = wShelfManagementDao.selectList(shelfWrapper);
|
|
|
|
+ shelfCount.addAndGet(wShelfManagementList.size());
|
|
|
|
+ wShelfManagementList.forEach(shelf->{
|
|
|
|
+
|
|
|
|
+ AtomicInteger allCount=new AtomicInteger(0);
|
|
|
|
+ AtomicInteger userdCount=new AtomicInteger(0);
|
|
|
|
+ AtomicInteger lockCount=new AtomicInteger(0);
|
|
|
|
+ AtomicInteger preReservedCount=new AtomicInteger(0);
|
|
|
|
+ AtomicInteger nullPalletCount=new AtomicInteger(0);
|
|
|
|
+ AtomicInteger unusedCount=new AtomicInteger(0);
|
|
|
|
+ LambdaQueryWrapper<WStorageLocationManagement> storageWrapper= Wrappers.lambdaQuery(WStorageLocationManagement.class).eq(WStorageLocationManagement::getShelfManagementId,shelf.getId()).eq(WStorageLocationManagement::getPalletType,1);
|
|
|
|
+ List<WStorageLocationManagement> storageManagementList = wStorageLocationManagementDao.selectList(storageWrapper);
|
|
|
|
+ storageManagementList.forEach(storage->{
|
|
|
|
+ List<WInventoryManagementDetail> bigWInventoryManagementDetailList=wInventoryManagementDao.selectByStorage(storage.getLocationCode());
|
|
|
|
+ storage.setWInventoryManagementDetailList(bigWInventoryManagementDetailList);
|
|
|
|
+
|
|
|
|
+ if(CollectionUtil.isNotEmpty(bigWInventoryManagementDetailList)){
|
|
|
|
+ userdCount.addAndGet(1);
|
|
|
|
+ }
|
|
|
|
+ if(storage.getStorageLocationStatus() == Status.LOCKED.getCode()){
|
|
|
|
+ lockCount.addAndGet(1);
|
|
|
|
+ }
|
|
|
|
+ if(storage.getStorageLocationStatus() == Status.PRE_RESERVED.getCode()){
|
|
|
|
+ preReservedCount.addAndGet(1);
|
|
|
|
+ }
|
|
|
|
+ if(storage.getStorageLocationStatus() == Status.NULL_PALLET.getCode()){
|
|
|
|
+ nullPalletCount.addAndGet(1);
|
|
|
|
+ }
|
|
|
|
+ if(storage.getStorageLocationStatus() == Status.UNUSED.getCode()){
|
|
|
|
+ unusedCount.addAndGet(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<WStorageLocationManagement> smallStorageWrapper= Wrappers.lambdaQuery(WStorageLocationManagement.class).eq(WStorageLocationManagement::getParentId,storage.getId()).eq(WStorageLocationManagement::getPalletType,2);
|
|
|
|
+ List<WStorageLocationManagement> smallStorageManagementList = wStorageLocationManagementDao.selectList(smallStorageWrapper);
|
|
|
|
+ storage.setSubWStorageLocationManagementList(smallStorageManagementList);
|
|
|
|
+
|
|
|
|
+ AtomicReference<Boolean> flag= new AtomicReference<>(true);
|
|
|
|
+ smallStorageManagementList.stream().forEach(small->{
|
|
|
|
+ List<WInventoryManagementDetail> wInventoryManagementDetailList=wInventoryManagementDao.selectByStorage(small.getLocationCode());
|
|
|
|
+ small.setWInventoryManagementDetailList(wInventoryManagementDetailList);
|
|
|
|
+ if(CollectionUtil.isNotEmpty(wInventoryManagementDetailList) && flag.get()){
|
|
|
|
+ flag.set(false);
|
|
|
|
+ }
|
|
|
|
+ if(CollectionUtil.isNotEmpty(wInventoryManagementDetailList)){
|
|
|
|
+ userdCount.addAndGet(1);
|
|
|
|
+ }
|
|
|
|
+ if(small.getStorageLocationStatus() == Status.LOCKED.getCode()){
|
|
|
|
+ lockCount.addAndGet(1);
|
|
|
|
+ }
|
|
|
|
+ if(small.getStorageLocationStatus() == Status.PRE_RESERVED.getCode()){
|
|
|
|
+ preReservedCount.addAndGet(1);
|
|
|
|
+ }
|
|
|
|
+ if(small.getStorageLocationStatus() == Status.NULL_PALLET.getCode()){
|
|
|
|
+ nullPalletCount.addAndGet(1);
|
|
|
|
+ }
|
|
|
|
+ if(small.getStorageLocationStatus() == Status.UNUSED.getCode()){
|
|
|
|
+ unusedCount.addAndGet(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ if(flag.get()){
|
|
|
|
+ allCount.getAndAdd(1);
|
|
|
|
+ }else{
|
|
|
|
+ allCount.getAndAdd(smallStorageManagementList.size());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ Map<Integer, List<WStorageLocationManagement>> layerMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ // 按层高归类库位,并对每层内的库位根据列进行排序
|
|
|
|
+ for (WStorageLocationManagement location : storageManagementList) {
|
|
|
|
+ int layer = location.getStorageLocationZ();
|
|
|
|
+ layerMap.computeIfAbsent(layer, k -> new ArrayList<>()).add(location);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 对每一层的库位根据列进行排序
|
|
|
|
+ for (List<WStorageLocationManagement> locations : layerMap.values()) {
|
|
|
|
+ locations.sort(Comparator.comparingInt(WStorageLocationManagement::getStorageLocationY));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 将 layerMap 转换为 Entry 列表并按键从大到小排序
|
|
|
|
+ List<Map.Entry<Integer, List<WStorageLocationManagement>>> sortedEntries = new ArrayList<>(layerMap.entrySet());
|
|
|
|
+ sortedEntries.sort((entry1, entry2) -> entry2.getKey().compareTo(entry1.getKey()));
|
|
|
|
+ List<WStorageLocationManagement> childrenList=new ArrayList<>();
|
|
|
|
+ for (Map.Entry<Integer, List<WStorageLocationManagement>> entry : sortedEntries) {
|
|
|
|
+ WStorageLocationManagement toolStorge=new WStorageLocationManagement();
|
|
|
|
+ toolStorge.setChildren(entry.getValue());
|
|
|
|
+ childrenList.add(toolStorge);
|
|
|
|
+ }
|
|
|
|
+ // 将分组后的值设置为 vo 的 children
|
|
|
|
+ shelf.setWStorageLocationManagementList(childrenList);
|
|
|
|
+
|
|
|
|
+ shelf.setAllCount(allCount.get());
|
|
|
|
+ shelf.setUseCount(userdCount.get());
|
|
|
|
+ shelf.setLockCount(lockCount.get());
|
|
|
|
+ shelf.setPreReservedCount(preReservedCount.get());
|
|
|
|
+ shelf.setUnuseCount(unusedCount.get());
|
|
|
|
+ shelf.setNullPalletCount(nullPalletCount.get());
|
|
|
|
+ /*int used = allStorage.stream().filter(use -> use.getStorageLocationStatus() == Status.USED.getCode()).collect(Collectors.toList()).size();
|
|
|
|
+ int unused = allStorage.stream().filter(use -> use.getStorageLocationStatus() == Status.UNUSED.getCode()).collect(Collectors.toList()).size();
|
|
|
|
+ int nullPattet = allStorage.stream().filter(use -> use.getStorageLocationStatus() == Status.NULL_PALLET.getCode()).collect(Collectors.toList()).size();
|
|
|
|
+ int lock = allStorage.stream().filter(use -> use.getStorageLocationStatus() == Status.LOCKED.getCode()).collect(Collectors.toList()).size();
|
|
|
|
+ int preReserved = allStorage.stream().filter(use -> use.getStorageLocationStatus() == Status.PRE_RESERVED.getCode()).collect(Collectors.toList()).size();*/
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*shelf.setUseCount(used);
|
|
|
|
+ shelf.setUnuseCount(unused);
|
|
|
|
+ shelf.setNullPalletCount(nullPattet);
|
|
|
|
+ shelf.setLockCount(lock);
|
|
|
|
+ shelf.setPreReservedCount(preReserved);*/
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ map.put("shelfList",wShelfManagementList);
|
|
|
|
+ });
|
|
|
|
+ LambdaQueryWrapper<WStorageLocationManagement> allStorageWrapper= Wrappers.lambdaQuery(WStorageLocationManagement.class);
|
|
|
|
+ Long allStorageLocation = wStorageLocationManagementDao.selectCount(allStorageWrapper);
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<WStorageLocationManagement> useStorageWrapper= Wrappers.lambdaQuery(WStorageLocationManagement.class).eq(WStorageLocationManagement::getStorageLocationStatus, Status.USED.getCode());
|
|
|
|
+ Long useStorageLocation = wStorageLocationManagementDao.selectCount(useStorageWrapper);
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<WStorageLocationManagement> unusedStorageWrapper= Wrappers.lambdaQuery(WStorageLocationManagement.class).eq(WStorageLocationManagement::getStorageLocationStatus, Status.UNUSED.getCode());
|
|
|
|
+ Long unuseStorageLocation = wStorageLocationManagementDao.selectCount(unusedStorageWrapper);
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<WStorageLocationManagement> nullPalletStorageWrapper= Wrappers.lambdaQuery(WStorageLocationManagement.class).eq(WStorageLocationManagement::getStorageLocationStatus, Status.NULL_PALLET.getCode());
|
|
|
|
+ Long nullPalletStorageLocation = wStorageLocationManagementDao.selectCount(nullPalletStorageWrapper);
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<WStorageLocationManagement> lockStorageWrapper= Wrappers.lambdaQuery(WStorageLocationManagement.class).eq(WStorageLocationManagement::getStorageLocationStatus, Status.LOCKED.getCode());
|
|
|
|
+ Long lockStorageLocation = wStorageLocationManagementDao.selectCount(lockStorageWrapper);
|
|
|
|
+
|
|
|
|
+ map.put("wareCount",wWarehouseManagements.size());//库房数
|
|
|
|
+ map.put("shelfCount",shelfCount.get());//货架数
|
|
|
|
+ map.put("allCount",allStorageLocation);//库位数
|
|
|
|
+ map.put("useCount",useStorageLocation);//已占用库位数
|
|
|
|
+ map.put("unuseCount",unuseStorageLocation);//空库位数
|
|
|
|
+ map.put("nullPalletCount",nullPalletStorageLocation);//空托盘占用库位数
|
|
|
|
+ map.put("lockCount",lockStorageLocation);//锁定库位数
|
|
|
|
+
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
}
|
|
}
|