|
@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.common.entity.InOutBo;
|
|
|
import com.fjhx.common.utils.Assert;
|
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
|
+import com.fjhx.item.entity.product.po.ProductStockInfo;
|
|
|
import com.fjhx.item.service.product.ProductInfoService;
|
|
|
+import com.fjhx.item.service.product.ProductStockInfoService;
|
|
|
import com.fjhx.wms.entity.stock.dto.StockJournalDetailsDto;
|
|
|
import com.fjhx.wms.entity.stock.dto.StockWaitDto;
|
|
|
import com.fjhx.wms.entity.stock.dto.StockWaitSelectDto;
|
|
@@ -61,14 +63,16 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
|
|
|
|
|
|
@Autowired
|
|
|
private ISysDeptService deptService;
|
|
|
+ @Autowired
|
|
|
+ private ProductStockInfoService productStockInfoService;
|
|
|
|
|
|
@Override
|
|
|
public Page<StockWaitVo> getPage(StockWaitSelectDto dto) {
|
|
|
IWrapper<StockWait> wrapper = getWrapper();
|
|
|
|
|
|
//权限过滤:待出入库
|
|
|
- wrapper.in("sw", StockWait::getCompanyId, SecurityUtils.getCompanyIds());
|
|
|
- wrapper.eq("sw", StockWait::getCompanyId, dto.getCompanyId());
|
|
|
+ wrapper.in("sw", StockWait::getCompanyId, SecurityUtils.getCompanyIds());
|
|
|
+ wrapper.eq("sw", StockWait::getCompanyId, dto.getCompanyId());
|
|
|
|
|
|
|
|
|
//状态过滤
|
|
@@ -121,6 +125,18 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
|
|
|
item.setProductSpec(productInfo.getSpec());
|
|
|
item.setProductDefinition(productInfo.getDefinition());
|
|
|
});
|
|
|
+
|
|
|
+ //赋值可用库存信息
|
|
|
+ List<Long> pIds = voList.stream().map(StockWaitDetails::getProductId).collect(Collectors.toList());
|
|
|
+ Map<Long, BigDecimal> productStockInfoMap = productStockInfoService.mapKV(ProductStockInfo::getProductId, ProductStockInfo::getAvailableQuantity, q -> q
|
|
|
+ .in(ProductStockInfo::getProductId, pIds)
|
|
|
+ .eq(ProductStockInfo::getCompanyId, SecurityUtils.getCompanyId())
|
|
|
+ );
|
|
|
+ for (StockWaitDetailsVo stockWaitDetailsVo : voList) {
|
|
|
+ stockWaitDetailsVo.setAvailableQuantity(productStockInfoMap.getOrDefault(stockWaitDetailsVo.getProductId(), BigDecimal.ZERO));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
Map<Long, List<StockWaitDetailsVo>> voMap = voList.stream().collect(Collectors.groupingBy(StockWaitDetails::getStockWaitId));
|
|
|
|
|
|
//赋值明细列表
|