@ -65,7 +65,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.* ;
import java.util.concurrent.ConcurrentHashMap ;
import java.util.concurrent.atomic.AtomicInteger ;
import java.util.concurrent.atomic.AtomicReference ;
import java.util.function.Function ;
import java.util.function.Predicate ;
@ -515,9 +514,17 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
y . setScanNum ( y . getScanNum ( ) + 1 ) ;
}
//t托盘信息
if ( ObjectUtils . isNotNull ( y . getTrayId ( ) ) & & y . getTrayId ( ) . equals ( i . getTrayId ( ) ) ) {
if ( ObjectUtils . isNotNull ( y . getTrayId ( ) ) & & ! y . getTrayId ( ) . equals ( i . getTrayId ( ) ) ) {
y . setPallet ( y . getPallet ( ) + "," + i . getPallet ( ) ) ;
}
//订单自编号信息
if ( ObjectUtils . isNotNull ( y . getOrderCode ( ) ) & & ! y . getOrderCode ( ) . equals ( i . getOrderCode ( ) ) ) {
y . setOrderCode ( y . getOrderCode ( ) + "," + i . getOrderCode ( ) ) ;
}
//订单Id信息
if ( ObjectUtils . isNotNull ( y . getStockArticleId ( ) ) & & ! y . getStockArticleId ( ) . equals ( i . getStockArticleId ( ) ) ) {
y . setStockArticleId ( y . getStockArticleId ( ) + "," + i . getStockArticleId ( ) ) ;
}
}
} ) ;
} else {
@ -542,23 +549,50 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
} ) ;
//获取没有货位的数据
List < DistributionStockupOrderListVO > collect22 = list . stream ( ) . filter ( o - > ObjectUtils . isNull ( o . getAllocationId ( ) ) ) . collect ( Collectors . toList ( ) ) ;
List < DistributionStockupOrderListVO > listLi = new ArrayList < > ( ) ; //历史
if ( ! collect22 . isEmpty ( ) ) {
collect22 . forEach ( i - > {
boolean b = listYou . stream ( ) . anyMatch ( ii - > ObjectUtils . isNull ( ii . getAllocationId ( ) ) ) ;
DistributionStockAllocationVO stockAllocationVO = distributionStockService . selectSelfAllocation ( stockupDTO . getReservationId ( ) , stockupDTO . getStockupId ( ) , i . getParcelListId ( ) ) ;
if ( ObjectUtils . isNotNull ( stockAllocationVO ) ) {
//添加以扫货位信息
i . setAllocation ( stockAllocationVO . getPositionCode ( ) ) ;
i . setAllocationId ( stockAllocationVO . getAllocationId ( ) ) ;
listLi . add ( i ) ;
} else {
listLi . add ( i ) ;
}
} ) ;
}
List < DistributionStockupOrderListVO > collectY = listLi . stream ( ) . filter ( o - > ObjectUtils . isNotNull ( o . getAllocationId ( ) ) ) . collect ( Collectors . toList ( ) ) ;
List < DistributionStockupOrderListVO > collectW = listLi . stream ( ) . filter ( o - > ObjectUtils . isNull ( o . getAllocationId ( ) ) ) . collect ( Collectors . toList ( ) ) ;
//有
if ( ! collectY . isEmpty ( ) ) {
collectY . forEach ( i - > {
boolean b = listYou . stream ( ) . anyMatch ( ii - > ii . getAllocationId ( ) . equals ( i . getAllocationId ( ) ) ) ;
if ( b ) {
listYou . forEach ( wu - > {
if ( ObjectUtils . isNull ( wu . getAllocationId ( ) ) ) {
if ( wu . getAllocationId ( ) . equals ( i . getAllocationId ( ) ) ) {
//相同
wu . setPlanNum ( wu . getPlanNum ( ) + 1 ) ;
if ( ObjectUtils . isNotNull ( i . getStockId ( ) ) ) {
wu . setScanNum ( wu . getScanNum ( ) + 1 ) ;
}
//托盘信息
if ( ObjectUtils . isNotNull ( wu . getTrayId ( ) ) & & wu . getTrayId ( ) . equals ( i . getTrayId ( ) ) ) {
if ( ObjectUtils . isNotNull ( wu . getTrayId ( ) ) & & ! wu . getTrayId ( ) . equals ( i . getTrayId ( ) ) ) {
wu . setPallet ( wu . getPallet ( ) + "," + i . getPallet ( ) ) ;
}
//订单自编号信息
if ( ObjectUtils . isNotNull ( wu . getOrderCode ( ) ) & & ! wu . getOrderCode ( ) . equals ( i . getOrderCode ( ) ) ) {
wu . setOrderCode ( wu . getOrderCode ( ) + "," + i . getOrderCode ( ) ) ;
}
//订单ID信息
if ( ObjectUtils . isNotNull ( wu . getStockArticleId ( ) ) & & ! wu . getStockArticleId ( ) . equals ( i . getStockArticleId ( ) ) ) {
wu . setStockArticleId ( wu . getStockArticleId ( ) + "," + i . getStockArticleId ( ) ) ;
}
if ( wu . getPlanNum ( ) . equals ( wu . getScanNum ( ) ) ) {
wu . setCompleteStact ( true ) ;
} else {
wu . setCompleteStact ( false ) ;
}
}
} ) ;
@ -566,6 +600,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
i . setPlanNum ( 1 ) ;
if ( ObjectUtils . isNotNull ( i . getStockId ( ) ) ) {
i . setScanNum ( 1 ) ;
i . setCompleteStact ( true ) ;
} else {
i . setScanNum ( 0 ) ;
}
@ -573,6 +608,48 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
}
} ) ;
}
collectW . forEach ( i - > {
boolean b = listYou . stream ( ) . anyMatch ( ko - > ObjectUtils . isNull ( ko . getAllocationId ( ) ) ) ;
if ( b ) {
listYou . forEach ( wu - > {
if ( ObjectUtils . isNull ( wu . getAllocationId ( ) ) ) {
//相同
wu . setPlanNum ( wu . getPlanNum ( ) + 1 ) ;
if ( ObjectUtils . isNotNull ( i . getStockId ( ) ) ) {
wu . setScanNum ( wu . getScanNum ( ) + 1 ) ;
}
//托盘信息
if ( ObjectUtils . isNotNull ( wu . getTrayId ( ) ) & & ! wu . getTrayId ( ) . equals ( i . getTrayId ( ) ) ) {
wu . setPallet ( wu . getPallet ( ) + "," + i . getPallet ( ) ) ;
}
//订单自编号信息
if ( ObjectUtils . isNotNull ( wu . getOrderCode ( ) ) & & ! wu . getOrderCode ( ) . equals ( i . getOrderCode ( ) ) ) {
wu . setOrderCode ( wu . getOrderCode ( ) + "," + i . getOrderCode ( ) ) ;
}
//订单id信息
if ( ObjectUtils . isNotNull ( wu . getStockArticleId ( ) ) & & ! wu . getStockArticleId ( ) . equals ( i . getStockArticleId ( ) ) ) {
wu . setStockArticleId ( wu . getStockArticleId ( ) + "," + i . getStockArticleId ( ) ) ;
}
if ( wu . getPlanNum ( ) . equals ( wu . getScanNum ( ) ) ) {
wu . setCompleteStact ( true ) ;
} else {
wu . setCompleteStact ( false ) ;
}
}
} ) ;
} else {
i . setPlanNum ( 1 ) ;
if ( ObjectUtils . isNotNull ( i . getStockId ( ) ) ) {
i . setScanNum ( 1 ) ;
i . setCompleteStact ( true ) ;
} else {
i . setScanNum ( 0 ) ;
}
listYou . add ( i ) ;
}
} ) ;
// List<DistributionStockupOrderListVO> collect = list.stream().filter(o -> ObjectUtils.isNotNull(o.getAllocationId())).collect(Collectors.toList());//不为空
// List<DistributionStockupOrderListVO> collect2 = collect.stream().filter(distinctByKey(person -> person.getAllocationId())).collect(Collectors.toList()); //去重
// List<DistributionStockupOrderListVO> collect1 = list.stream().filter(o -> ObjectUtils.isNull(o.getAllocationId())).collect(Collectors.toList());//为空
@ -598,7 +675,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
y . setScanNum ( y . getScanNum ( ) + 1 ) ;
}
//t托盘信息
if ( ObjectUtils . isNotNull ( y . getTrayId ( ) ) & & y . getTrayId ( ) . equals ( p . getTrayId ( ) ) ) {
if ( ObjectUtils . isNotNull ( y . getTrayId ( ) ) & & ! y . getTrayId ( ) . equals ( p . getTrayId ( ) ) ) {
y . setPallet ( y . getPallet ( ) + "," + p . getPallet ( ) ) ;
}
}
@ -655,7 +732,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
y . setScanNum ( y . getScanNum ( ) + 1 ) ;
}
//t托盘信息
if ( ObjectUtils . isNotNull ( y . getTrayId ( ) ) & & y . getTrayId ( ) . equals ( p . getTrayId ( ) ) ) {
if ( ObjectUtils . isNotNull ( y . getTrayId ( ) ) & & ! y . getTrayId ( ) . equals ( p . getTrayId ( ) ) ) {
y . setPallet ( y . getPallet ( ) + "," + p . getPallet ( ) ) ;
}
if ( y . getPlanNum ( ) . equals ( y . getScanNum ( ) ) ) {
@ -878,10 +955,16 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
public DistributionStockupOrderInfoVO selectOrderInfoSelf ( StockupDTO stockupDTO ) {
DistributionStockArticleEntity byId = distributionStockArticleService . getById ( stockupDTO . getStockArticleId ( ) ) ;
if ( stockupDTO . getStatus ( ) . equals ( 1 ) ) {
//已备货
DistributionStockupSelfVO distributionStockupSelfVO = distrilbutionBillStockService . selectDistrilbutionBillOverPackWuSelf ( stockupDTO ) ;
// DistributionStockupSelfVO distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackWuSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId());
QueryWrapper < DistributionParcelListEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "stock_article_id" , stockupDTO . getStockArticleId ( ) ) ;
if ( stockupDTO . getStockArticleId ( ) . contains ( "," ) ) {
queryWrapper . in ( "stock_article_id" , stockupDTO . getStockArticleId ( ) . split ( "," ) ) ;
} else {
queryWrapper . eq ( "stock_article_id" , stockupDTO . getStockArticleId ( ) ) ;
}
if ( ! stockupDTO . getTypeService ( ) . equals ( "3" ) ) {
queryWrapper . eq ( "order_package_reservation_status" , OrderPackageReservationStatusConstant . yiyueyue . getValue ( ) ) ;
}
@ -926,12 +1009,71 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
DistributionStockupSelfVO distributionStockupSelfVO = new DistributionStockupSelfVO ( ) ;
if ( ObjectUtils . isNotNull ( stockupDTO . getAllocationId ( ) ) ) {
//查询订单数量 有库位
distributionStockupSelfVO = distrilbutionBillStockService . selectDistrilbutionBillPackSelf ( stockupDTO ) ;
List < DistributionStockupSelfVO > distributionStockupSelfVOS = distrilbutionBillStockService . selectDistrilbutionBillPackSelf ( stockupDTO ) ;
DistributionStockupSelfVO distributionStockup = new DistributionStockupSelfVO ( ) ;
AtomicReference < Integer > j = new AtomicReference < > ( 0 ) ;
AtomicReference < Integer > y = new AtomicReference < > ( 0 ) ;
distributionStockupSelfVOS . forEach ( i - > {
j . updateAndGet ( v - > v + i . getPlanNum ( ) ) ;
y . updateAndGet ( v - > v + i . getScanNum ( ) ) ;
if ( ObjectUtils . isNull ( distributionStockup . getConsignee ( ) ) ) {
distributionStockup . setConsignee ( i . getConsignee ( ) ) ;
} else {
if ( ObjectUtils . isNotNull ( i . getConsignee ( ) ) ) {
String s = distributionStockup . getConsignee ( ) + i . getConsignee ( ) ;
distributionStockup . setConsignee ( s ) ;
}
}
if ( ObjectUtils . isNull ( distributionStockup . getTrays ( ) ) ) {
distributionStockup . setTrays ( i . getTrays ( ) ) ;
} else {
if ( ObjectUtils . isNotNull ( i . getTrays ( ) ) ) {
String s = distributionStockup . getTrays ( ) + i . getTrays ( ) ;
distributionStockup . setTrays ( s ) ;
}
}
} ) ;
distributionStockup . setPlanNum ( j . get ( ) ) ;
distributionStockup . setScanNum ( y . get ( ) ) ;
distributionStockupSelfVO = distributionStockup ;
} else {
//查询订单数量 无库位
distributionStockupSelfVO = distrilbutionBillStockService . selectDistrilbutionBillPackWuSelf ( stockupDTO . getReservationId ( ) , stockupDTO . getStockupId ( ) ) ;
List < DistributionStockupSelfVO > distributionStockupSelfVOS = distrilbutionBillStockService . selectDistrilbutionBillPackWuSelf ( stockupDTO . getReservationId ( ) , stockupDTO . getStockupId ( ) ) ;
DistributionStockupSelfVO distributionStockup = new DistributionStockupSelfVO ( ) ;
AtomicReference < Integer > j = new AtomicReference < > ( 0 ) ;
AtomicReference < Integer > y = new AtomicReference < > ( 0 ) ;
distributionStockupSelfVOS . forEach ( i - > {
j . updateAndGet ( v - > v + i . getPlanNum ( ) ) ;
y . updateAndGet ( v - > v + i . getScanNum ( ) ) ;
if ( ObjectUtils . isNull ( distributionStockup . getConsignee ( ) ) ) {
distributionStockup . setConsignee ( i . getConsignee ( ) ) ;
} else {
if ( ObjectUtils . isNotNull ( i . getConsignee ( ) ) ) {
String s = distributionStockup . getConsignee ( ) + i . getConsignee ( ) ;
distributionStockup . setConsignee ( s ) ;
}
}
if ( ObjectUtils . isNull ( distributionStockup . getTrays ( ) ) ) {
distributionStockup . setTrays ( i . getTrays ( ) ) ;
} else {
if ( ObjectUtils . isNotNull ( i . getTrays ( ) ) ) {
String s = distributionStockup . getTrays ( ) + i . getTrays ( ) ;
distributionStockup . setTrays ( s ) ;
}
}
} ) ;
distributionStockup . setPlanNum ( j . get ( ) ) ;
distributionStockup . setScanNum ( y . get ( ) ) ;
distributionStockupSelfVO = distributionStockup ;
}
if ( stockupDTO . getStockArticleId ( ) . contains ( "," ) ) {
stockupDTO . setStockArticleIdList ( stockupDTO . getStockArticleId ( ) . split ( "," ) ) ;
stockupDTO . setStockArticleId ( null ) ;
}
// if(stockupDTO.getOrderCode().contains(",")){
// stockupDTO.setOrderCodeList(stockupDTO.getOrderCode().split(","));
// stockupDTO.setOrderCode(null);
// }
List < PackageStockupVO > list = distributionParcelListService . selectOrderInfoSelfList ( stockupDTO ) ;
Iterator < PackageStockupVO > iterator = list . iterator ( ) ;