|
|
@ -56,22 +56,22 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai |
|
|
|
.eq(ObjectUtil.isNotEmpty(params), EasOutInBillDetail::getDjid, params.getDjid()) |
|
|
|
); |
|
|
|
List<EasOutInBillDetail> easOutInBillDetailList = result.getRecords(); |
|
|
|
List<InventoryInfo> inventoryInfoList = queryInventoryInfoList(easOutInBillDetailList); |
|
|
|
easOutInBillDetailList.forEach(bill -> { |
|
|
|
//查询库存信息
|
|
|
|
List<InventoryInfo> matchedInventory = inventoryInfoList.stream() |
|
|
|
.filter(inventory -> Objects.equals(inventory.getZzbm(), bill.getZzbm()) |
|
|
|
&& Objects.equals(inventory.getCkbm(), bill.getCkbm()) |
|
|
|
&& Objects.equals(inventory.getWlbm(), bill.getWlbm()) |
|
|
|
&& Objects.equals(inventory.getPc(), bill.getPc()) |
|
|
|
&& Objects.equals(inventory.getTrackno(), bill.getTrackno()) |
|
|
|
&& Objects.equals(inventory.getKwbm(), bill.getKwbm())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
//将库存数量赋值给单据
|
|
|
|
if (CollectionUtils.isNotEmpty(matchedInventory)) { |
|
|
|
bill.setKcsl(matchedInventory.get(0).getKcsl()); |
|
|
|
} |
|
|
|
}); |
|
|
|
//List<InventoryInfo> inventoryInfoList = queryInventoryInfoList(easOutInBillDetailList);
|
|
|
|
// easOutInBillDetailList.forEach(bill -> {
|
|
|
|
// //查询库存信息
|
|
|
|
// List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
|
|
|
// .filter(inventory -> Objects.equals(inventory.getZzbm(), bill.getZzbm())
|
|
|
|
// && Objects.equals(inventory.getCkbm(), bill.getCkbm())
|
|
|
|
// && Objects.equals(inventory.getWlbm(), bill.getWlbm())
|
|
|
|
// && Objects.equals(inventory.getPc(), bill.getPc())
|
|
|
|
// && Objects.equals(inventory.getTrackno(), bill.getTrackno())
|
|
|
|
// && Objects.equals(inventory.getKwbm(), bill.getKwbm()))
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
// //将库存数量赋值给单据
|
|
|
|
// if (CollectionUtils.isNotEmpty(matchedInventory)) {
|
|
|
|
// bill.setKcsl(matchedInventory.get(0).getKcsl());
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
result.setRecords(easOutInBillDetailList); |
|
|
|
return CommonPage.getPage(result); |
|
|
|
} |
|
|
@ -149,11 +149,10 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai |
|
|
|
@Override |
|
|
|
public void update(List<EasOutInBillDetailVO> entityList) { |
|
|
|
if (CollectionUtils.isNotEmpty(entityList)) { |
|
|
|
List<EasOutInBillDetailVO> entityLists= entityList.stream().filter(r->StringUtils.isNotEmpty(r.getKwbm())).collect(Collectors.toList()); |
|
|
|
List<String> ids =entityLists.stream().map(EasOutInBillDetailVO::getCode).collect(Collectors.toList()); |
|
|
|
if(ids.size()==entityList.size()&&ids.size()>1) |
|
|
|
{ |
|
|
|
entityList.forEach(r->{ |
|
|
|
List<EasOutInBillDetailVO> entityLists = entityList.stream().filter(r -> StringUtils.isNotEmpty(r.getKwbm())).collect(Collectors.toList()); |
|
|
|
List<String> ids = entityLists.stream().map(EasOutInBillDetailVO::getCode).collect(Collectors.toList()); |
|
|
|
if (ids.size() == entityList.size() && ids.size() > 1) { |
|
|
|
entityList.forEach(r -> { |
|
|
|
UpdateWrapper<EasOutInBillDetail> updateWrapper = new UpdateWrapper<>(); |
|
|
|
updateWrapper.eq("flid", r.getFlid()); |
|
|
|
updateWrapper.set("czsl", r.getSl()); |
|
|
@ -165,16 +164,14 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai |
|
|
|
easOutInBillDetailMapper.update(null, updateWrapper); |
|
|
|
|
|
|
|
}); |
|
|
|
}else |
|
|
|
{ |
|
|
|
} else { |
|
|
|
boolean isValid = entityList.stream() |
|
|
|
.filter(r -> StringUtils.isNotEmpty(r.getKwbm())) |
|
|
|
.map(EasOutInBillDetailVO::getSysl) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add) |
|
|
|
.compareTo(BigDecimal.ZERO) == 0; |
|
|
|
|
|
|
|
if(isValid) |
|
|
|
{ |
|
|
|
if (isValid) { |
|
|
|
throw new BadRequestException("请检查库位和数量信息"); |
|
|
|
} |
|
|
|
BigDecimal amount = entityList.stream() |
|
|
@ -198,8 +195,6 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|