|
|
|
@ -289,12 +289,54 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
// IPage<DistributionStockupListVO> distributionStockupEntityIPage = baseMapper.selectStockupPage(page, stockupDTO);
|
|
|
|
|
List<DistributionStockupListVO> records = distributionStockupEntityIPage.getRecords(); |
|
|
|
|
for (DistributionStockupListVO vo : records) { |
|
|
|
|
AtomicReference<Boolean> b = new AtomicReference<>(false); |
|
|
|
|
AtomicReference<Integer> nu = new AtomicReference<>(0); |
|
|
|
|
List<DistributionStockupInfoEntity> list1 = distributionStockupInfoService.list(Wrappers.<DistributionStockupInfoEntity>query().lambda().eq(DistributionStockupInfoEntity::getStockupId, vo.getId())); |
|
|
|
|
list1.forEach( z ->{ |
|
|
|
|
//查询有没有零担
|
|
|
|
|
List<DistributionReservationZeroPackageEntity> list = reservationZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda() |
|
|
|
|
.eq(DistributionReservationZeroPackageEntity::getReservationId, z.getReservationId()) |
|
|
|
|
); |
|
|
|
|
if(list.isEmpty()){ |
|
|
|
|
//有定制品 查询数量
|
|
|
|
|
if(z.getStockUpType().equals("3")){ |
|
|
|
|
//自提
|
|
|
|
|
List<DistributionStockPackageVO> list2 = distrilbutionBillStockService.listPackageSelf(z.getReservationId()); |
|
|
|
|
nu.set(list2.size()); |
|
|
|
|
}else{ |
|
|
|
|
//商,市
|
|
|
|
|
List<DistributionReservationPackageEntity> list2 = distributionReservationPackageService.list(Wrappers.<DistributionReservationPackageEntity>query().lambda() |
|
|
|
|
.eq(DistributionReservationPackageEntity::getReservationId, z.getReservationId()) |
|
|
|
|
.eq(DistributionReservationPackageEntity::getIsDeleted,0) |
|
|
|
|
.in(DistributionReservationPackageEntity::getPacketBarStatus,"1","3") |
|
|
|
|
); |
|
|
|
|
nu.set(list2.size()); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
// 查询零担数量
|
|
|
|
|
List<DistributionReservationZeroPackageEntity> list2 = reservationZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda() |
|
|
|
|
.eq(DistributionReservationZeroPackageEntity::getReservationId, z.getReservationId()) |
|
|
|
|
.eq(DistributionReservationZeroPackageEntity::getIsDeleted, 0) |
|
|
|
|
.in(DistributionReservationZeroPackageEntity::getZeroPackageStatus, "1", "3") |
|
|
|
|
); |
|
|
|
|
int sum = list2.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum(); |
|
|
|
|
nu.set((int) (nu.get() + sum)); |
|
|
|
|
b.set(true); |
|
|
|
|
//自提
|
|
|
|
|
List<DistributionStockPackageVO> list2self = distrilbutionBillStockService.listPackageSelf(z.getReservationId()); |
|
|
|
|
nu.set(nu.get()+list2self.size()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
if(b.get()){ |
|
|
|
|
vo.setPlanNum(nu.get()); |
|
|
|
|
} |
|
|
|
|
//查询以扫数量
|
|
|
|
|
List<DistributionStockEntity> list = distributionStockService.list(Wrappers.<DistributionStockEntity>query().lambda().eq(DistributionStockEntity::getStockupId, vo.getId())); |
|
|
|
|
if(list.isEmpty()){ |
|
|
|
|
vo.setRealNum(0); |
|
|
|
|
}else{ |
|
|
|
|
vo.setRealNum(list.size()); |
|
|
|
|
vo.setRealNum(list.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum()); |
|
|
|
|
} |
|
|
|
|
intToStrDistributionStockupListVO(vo); |
|
|
|
|
if (ObjectUtils.isNull(vo.getInventoryNub())) { |
|
|
|
@ -378,6 +420,23 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (vo.getTypeService().equals(3)) { |
|
|
|
|
//自
|
|
|
|
|
List<DistributionStockupListVO> list = baseMapper.selectStockupClientInfoSelf(stockupDTO); |
|
|
|
|
list.forEach( i ->{ |
|
|
|
|
QueryWrapper<DistributionReservationZeroPackageEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
//查询有没有零担数据
|
|
|
|
|
queryWrapper.eq("reservation_id",i.getReservationId()); |
|
|
|
|
queryWrapper.eq("is_deleted",0); |
|
|
|
|
queryWrapper.in("zero_package_status","1","3"); |
|
|
|
|
List<DistributionReservationZeroPackageEntity> list1 = reservationZeroPackageService.list(queryWrapper); |
|
|
|
|
if(!list1.isEmpty()){ |
|
|
|
|
//有
|
|
|
|
|
i.setPlanNum(list1.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum()); |
|
|
|
|
} |
|
|
|
|
//没有
|
|
|
|
|
List<DistributionStockPackageVO> list2 = distrilbutionBillStockService.listPackageSelf(i.getReservationId()); |
|
|
|
|
i.setPlanNum(i.getPlanNum()+list2.size()); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
map.put("orderList", list); |
|
|
|
|
} else { |
|
|
|
|
//商 ,市
|
|
|
|
@ -534,15 +593,21 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
List<DistributionStockupOrderListVO> collect11 = list.stream().filter(o -> ObjectUtils.isNotNull(o.getAllocationId())).collect(Collectors.toList()); |
|
|
|
|
Set<DistributionStockupOrderListVO> listYou = new HashSet<>(); |
|
|
|
|
collect11.forEach( i -> { |
|
|
|
|
DistributionReservationZeroPackageEntity one = new DistributionReservationZeroPackageEntity(); |
|
|
|
|
if(stockupDTO.getIsZero().equals("1")) { |
|
|
|
|
//零担 查询预约数量
|
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId()); |
|
|
|
|
} |
|
|
|
|
int i1 = stockupDTO.getIsZero().equals("1") ? one.getQuantity() : 1; |
|
|
|
|
if(listYou.size() > 0){ |
|
|
|
|
boolean b = listYou.stream().anyMatch(o -> o.getAllocationId().equals(i.getAllocationId())); |
|
|
|
|
if(b){ |
|
|
|
|
listYou.forEach( y -> { |
|
|
|
|
if(y.getAllocationId().equals(i.getAllocationId())){ |
|
|
|
|
//相同
|
|
|
|
|
y.setPlanNum(y.getPlanNum()+1); |
|
|
|
|
y.setPlanNum(y.getPlanNum()+i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
y.setScanNum(y.getScanNum()+1); |
|
|
|
|
y.setScanNum(y.getScanNum()+i1); |
|
|
|
|
} |
|
|
|
|
//t托盘信息
|
|
|
|
|
if(ObjectUtils.isNotNull(y.getTrayId()) && ObjectUtils.isNotNull(i.getTrayId()) && !y.getTrayId().equals(i.getTrayId())){ |
|
|
|
@ -559,9 +624,9 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
} |
|
|
|
|
} ); |
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(1); |
|
|
|
|
i.setPlanNum(i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(1); |
|
|
|
|
i.setScanNum(i1); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
|
} |
|
|
|
@ -569,9 +634,9 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(1); |
|
|
|
|
i.setPlanNum(i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(1); |
|
|
|
|
i.setScanNum(i1); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
|
} |
|
|
|
@ -599,14 +664,20 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
//有
|
|
|
|
|
if(!collectY.isEmpty()){ |
|
|
|
|
collectY.forEach( i -> { |
|
|
|
|
DistributionReservationZeroPackageEntity one = new DistributionReservationZeroPackageEntity(); |
|
|
|
|
if(stockupDTO.getIsZero().equals("1")) { |
|
|
|
|
//零担 查询预约数量
|
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId()); |
|
|
|
|
} |
|
|
|
|
int i1 = stockupDTO.getIsZero().equals("1") ? one.getQuantity() : 1; |
|
|
|
|
boolean b = listYou.stream().anyMatch(ii ->ii.getAllocationId().equals(i.getAllocationId())); |
|
|
|
|
if(b){ |
|
|
|
|
listYou.forEach( wu -> { |
|
|
|
|
if(wu.getAllocationId().equals(i.getAllocationId())){ |
|
|
|
|
//相同
|
|
|
|
|
wu.setPlanNum(wu.getPlanNum()+1); |
|
|
|
|
wu.setPlanNum(wu.getPlanNum()+i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
wu.setScanNum(wu.getScanNum()+1); |
|
|
|
|
wu.setScanNum(wu.getScanNum()+i1); |
|
|
|
|
} |
|
|
|
|
//托盘信息
|
|
|
|
|
if(ObjectUtils.isNotNull(wu.getTrayId()) && ObjectUtils.isNotNull(i.getTrayId()) && !wu.getTrayId().equals(i.getTrayId())){ |
|
|
|
@ -628,9 +699,9 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(1); |
|
|
|
|
i.setPlanNum( i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(1); |
|
|
|
|
i.setScanNum(i1); |
|
|
|
|
i.setCompleteStact(true); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
@ -640,14 +711,22 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
collectW.forEach(i ->{ |
|
|
|
|
DistributionReservationZeroPackageEntity one = new DistributionReservationZeroPackageEntity(); |
|
|
|
|
if(stockupDTO.getIsZero().equals("1")) { |
|
|
|
|
//零担 查询预约数量
|
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId()); |
|
|
|
|
} |
|
|
|
|
int i1 = stockupDTO.getIsZero().equals("1") ? one.getQuantity() : 1; |
|
|
|
|
boolean b = listYou.stream().anyMatch(ko -> ObjectUtils.isNull(ko.getAllocationId())); |
|
|
|
|
if(b){ |
|
|
|
|
listYou.forEach( wu -> { |
|
|
|
|
|
|
|
|
|
listYou.forEach(wu -> { |
|
|
|
|
if(ObjectUtils.isNull(wu.getAllocationId())){ |
|
|
|
|
//相同
|
|
|
|
|
wu.setPlanNum(wu.getPlanNum()+1); |
|
|
|
|
|
|
|
|
|
wu.setPlanNum(wu.getPlanNum()+i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
wu.setScanNum(wu.getScanNum()+1); |
|
|
|
|
wu.setScanNum(wu.getScanNum()+i1); |
|
|
|
|
} |
|
|
|
|
//托盘信息
|
|
|
|
|
if(ObjectUtils.isNotNull(wu.getTrayId()) && ObjectUtils.isNotNull(i.getTrayId()) && !wu.getTrayId().equals(i.getTrayId())){ |
|
|
|
@ -669,9 +748,9 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(1); |
|
|
|
|
i.setPlanNum(i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(1); |
|
|
|
|
i.setScanNum(i1); |
|
|
|
|
i.setCompleteStact(true); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
@ -1773,10 +1852,18 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param reservationId |
|
|
|
|
* @param isZero |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public DistributionStockupSelfVO selectStockupDetails(Long reservationId) { |
|
|
|
|
return baseMapper.selectStockupDetails(reservationId); |
|
|
|
|
public DistributionStockupSelfVO selectStockupDetails(Long reservationId, String isZero) { |
|
|
|
|
DistributionStockupSelfVO distributionStockupSelfVO = new DistributionStockupSelfVO(); |
|
|
|
|
if(isZero.equals("1")){ |
|
|
|
|
//零担
|
|
|
|
|
distributionStockupSelfVO = baseMapper.selectStockupDetailsZero(reservationId); |
|
|
|
|
}else{ |
|
|
|
|
distributionStockupSelfVO = baseMapper.selectStockupDetails(reservationId); |
|
|
|
|
} |
|
|
|
|
return distributionStockupSelfVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -1976,6 +2063,8 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
DistributionStockEntity stockEntity = new DistributionStockEntity(); |
|
|
|
|
stockEntity.setStockArticle(i.getStockArticleId()); |
|
|
|
|
stockEntity.setStockupId(stockupDTO.getStockupId()); |
|
|
|
|
DistributionReservationZeroPackageEntity byId = reservationZeroPackageService.getById(i.getId()); |
|
|
|
|
stockEntity.setParcelListId(Optional.ofNullable(byId.getParcelListId()).orElse(null) ); |
|
|
|
|
stockEntity.setBillLadingId(stockupDTO.getReservationId()); |
|
|
|
|
stockEntity.setConditions("2"); |
|
|
|
|
stockEntity.setGoodsName(i.getFirsts()); |
|
|
|
|