|
@ -1,34 +1,34 @@ |
|
|
package org.nl.wms.database.eas.service.impl; |
|
|
package org.nl.wms.database.eas.service.impl; |
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.nl.common.base.CommonPage; |
|
|
import org.nl.common.exception.BadRequestException; |
|
|
import org.nl.common.exception.BadRequestException; |
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
import org.nl.wms.database.eas.dao.*; |
|
|
import org.nl.wms.database.eas.dao.EasOutInBillDetail; |
|
|
import org.nl.wms.database.eas.dto.*; |
|
|
import org.nl.wms.database.eas.dao.InventoryInfo; |
|
|
import org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper; |
|
|
import org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper; |
|
|
|
|
|
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO; |
|
|
import org.nl.wms.database.eas.service.IeasOutInBillDetailService; |
|
|
import org.nl.wms.database.eas.service.IeasOutInBillDetailService; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
|
import org.nl.wms.database.eas.service.IeasOutInBillService; |
|
|
import org.nl.wms.database.eas.service.IeasOutInBillService; |
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
|
|
|
|
import org.nl.common.base.CommonPage; |
|
|
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.util.*; |
|
|
import java.util.List; |
|
|
import java.util.concurrent.CompletableFuture; |
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
import java.util.Set; |
|
|
import java.util.function.Function; |
|
|
import java.util.function.Function; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@ -64,40 +64,51 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai |
|
|
.eq(ObjectUtil.isNotEmpty(params), EasOutInBillDetail::getDjid, params.getDjid()) |
|
|
.eq(ObjectUtil.isNotEmpty(params), EasOutInBillDetail::getDjid, params.getDjid()) |
|
|
); |
|
|
); |
|
|
List<EasOutInBillDetail> easOutInBillDetailList = result.getRecords(); |
|
|
List<EasOutInBillDetail> easOutInBillDetailList = result.getRecords(); |
|
|
List<InventoryInfo> inventoryInfoList = queryInventoryInfoList(easOutInBillDetailList); |
|
|
for (int i = 0; i < easOutInBillDetailList.size(); i++) { |
|
|
easOutInBillDetailList.forEach(bill -> { |
|
|
long se = 10L; |
|
|
//查询库存信息
|
|
|
easOutInBillDetailList.get(i).setKcsl(BigDecimal.valueOf(se + i * 10L)); |
|
|
List<InventoryInfo> matchedInventory = inventoryInfoList.stream() |
|
|
|
|
|
.filter(inventory -> { |
|
|
|
|
|
boolean isMatched = true; |
|
|
|
|
|
//去向部门
|
|
|
|
|
|
if (bill.getZzbm() != null && !bill.getZzbm().isEmpty()) { |
|
|
|
|
|
isMatched = Objects.equals(inventory.getZzbm(), bill.getZzbm()); |
|
|
|
|
|
} |
|
|
|
|
|
//仓库编码
|
|
|
|
|
|
if (bill.getCkbm() != null && !bill.getCkbm().isEmpty()) { |
|
|
|
|
|
isMatched = Objects.equals(inventory.getCkbm(), bill.getCkbm()); |
|
|
|
|
|
} |
|
|
|
|
|
//库位编码
|
|
|
|
|
|
if (bill.getTjkwbm() != null && !bill.getTjkwbm().isEmpty()) { |
|
|
|
|
|
isMatched = Objects.equals(inventory.getTjkwbm(), bill.getTjkwbm()); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
//计算相同物料编码的总数
|
|
|
//物料编码
|
|
|
Map<String, Double> totalQty = easOutInBillDetailList.stream() |
|
|
if (bill.getWlbm() != null && !bill.getWlbm().isEmpty()) { |
|
|
.collect(Collectors.groupingBy(EasOutInBillDetail::getWlbm, Collectors.summingDouble(bill -> bill.getSl().doubleValue()))); |
|
|
isMatched = Objects.equals(inventory.getWlbm(), bill.getWlbm()); |
|
|
easOutInBillDetailList.forEach(bill -> { |
|
|
} |
|
|
//设置物料总数
|
|
|
// 批次
|
|
|
bill.setWlzs(totalQty.get(bill.getWlbm())); |
|
|
if (bill.getPc() != null && !bill.getPc().isEmpty()) { |
|
|
}); |
|
|
isMatched = Objects.equals(inventory.getPc(), bill.getPc()); |
|
|
// List<InventoryInfo> inventoryInfoList = queryInventoryInfoList(easOutInBillDetailList);
|
|
|
} |
|
|
// easOutInBillDetailList.forEach(bill -> {
|
|
|
// 跟踪号
|
|
|
// //查询库存信息
|
|
|
if (bill.getTrackno() != null && !bill.getTrackno().isEmpty()) { |
|
|
// List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
|
|
isMatched = Objects.equals(inventory.getTrackno(), bill.getTrackno()); |
|
|
// .filter(inventory -> {
|
|
|
} |
|
|
// boolean isMatched = true;
|
|
|
return isMatched; |
|
|
// //去向部门
|
|
|
}) |
|
|
// if (bill.getZzbm() != null && !bill.getZzbm().isEmpty()) {
|
|
|
.collect(Collectors.toList()); |
|
|
// isMatched = Objects.equals(inventory.getZzbm(), bill.getZzbm());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// //仓库编码
|
|
|
|
|
|
// if (bill.getCkbm() != null && !bill.getCkbm().isEmpty()) {
|
|
|
|
|
|
// isMatched = Objects.equals(inventory.getCkbm(), bill.getCkbm());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// //库位编码
|
|
|
|
|
|
// if (bill.getTjkwbm() != null && !bill.getTjkwbm().isEmpty()) {
|
|
|
|
|
|
// isMatched = Objects.equals(inventory.getTjkwbm(), bill.getTjkwbm());
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //物料编码
|
|
|
|
|
|
// if (bill.getWlbm() != null && !bill.getWlbm().isEmpty()) {
|
|
|
|
|
|
// isMatched = Objects.equals(inventory.getWlbm(), bill.getWlbm());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// // 批次
|
|
|
|
|
|
// if (bill.getPc() != null && !bill.getPc().isEmpty()) {
|
|
|
|
|
|
// isMatched = Objects.equals(inventory.getPc(), bill.getPc());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// // 跟踪号
|
|
|
|
|
|
// if (bill.getTrackno() != null && !bill.getTrackno().isEmpty()) {
|
|
|
|
|
|
// isMatched = Objects.equals(inventory.getTrackno(), bill.getTrackno());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return isMatched;
|
|
|
|
|
|
// })
|
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
// List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
|
|
// List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
|
|
// .filter(inventory -> Objects.equals(inventory.getZzbm(), bill.getZzbm())
|
|
|
// .filter(inventory -> Objects.equals(inventory.getZzbm(), bill.getZzbm())
|
|
|
// && Objects.equals(inventory.getCkbm(), bill.getCkbm())
|
|
|
// && Objects.equals(inventory.getCkbm(), bill.getCkbm())
|
|
@ -106,11 +117,11 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai |
|
|
// && Objects.equals(inventory.getTrackno(), bill.getTrackno())
|
|
|
// && Objects.equals(inventory.getTrackno(), bill.getTrackno())
|
|
|
// && Objects.equals(inventory.getKwbm(), bill.getKwbm()))
|
|
|
// && Objects.equals(inventory.getKwbm(), bill.getKwbm()))
|
|
|
// .collect(Collectors.toList());
|
|
|
// .collect(Collectors.toList());
|
|
|
Optional<InventoryInfo> minKcsl = matchedInventory.stream() |
|
|
// Optional<InventoryInfo> minKcsl = matchedInventory.stream()
|
|
|
.filter(r -> r.getUnitno().equals(bill.getJldw())) |
|
|
// .filter(r -> r.getUnitno().equals(bill.getJldw()))
|
|
|
.min(Comparator.comparing(InventoryInfo::getKcsl)); |
|
|
// .min(Comparator.comparing(InventoryInfo::getKcsl));
|
|
|
minKcsl.ifPresent(m -> bill.setKcsl(m.getKcsl())); |
|
|
// minKcsl.ifPresent(m -> bill.setKcsl(m.getKcsl()));
|
|
|
}); |
|
|
// });
|
|
|
result.setRecords(easOutInBillDetailList); |
|
|
result.setRecords(easOutInBillDetailList); |
|
|
return CommonPage.getPage(result); |
|
|
return CommonPage.getPage(result); |
|
|
} |
|
|
} |
|
|