|
|
|
@ -39,12 +39,10 @@ import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity;
|
|
|
|
|
import com.logpm.warehouse.entity.WarehouseUpdownGoodsLogEntity; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseTaryAllocationClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseTrayGoodsClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseUpdownGoodsClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseUpdownGoodsLogClient; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springblade.common.constant.CodeDesEnum; |
|
|
|
|
import org.springblade.common.constant.DictBizConstant; |
|
|
|
|
import org.springblade.common.constant.DistributionTypeConstant; |
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stocklist.StockLockingStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stocklist.StockSignfoStatusConstant; |
|
|
|
@ -64,9 +62,13 @@ import org.springframework.context.annotation.Lazy;
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import javax.xml.ws.BindingType; |
|
|
|
|
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; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 备货信息表 服务实现类 |
|
|
|
@ -479,6 +481,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static <T> Predicate<T> distinctByKey(Function<? super T,?> keyExtractor){ |
|
|
|
|
Map<Object,Boolean> map=new ConcurrentHashMap<>(); |
|
|
|
|
return t -> map.putIfAbsent(keyExtractor.apply(t),Boolean.TRUE)==null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<DistributionStockupOrderListVO> selectStockupOrderList(StockupDTO stockupDTO) { |
|
|
|
@ -486,40 +492,91 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (stockupDTO.getTypeService().equals("3")) { |
|
|
|
|
//查询客户数据 自
|
|
|
|
|
List<DistributionStockupOrderListVO> list = distrilbutionBillStockService.selectDistrilbutionBillSelf(reservationId); |
|
|
|
|
//查询包件的库位的
|
|
|
|
|
if(!list.isEmpty()){ |
|
|
|
|
list.forEach( i ->{ |
|
|
|
|
if(ObjectUtils.isNull(i.getAllocationId())){ |
|
|
|
|
//查询包件信息
|
|
|
|
|
List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getStockArticleId, i.getStockArticleId()) |
|
|
|
|
); |
|
|
|
|
if(!list1.isEmpty()){ |
|
|
|
|
list1.forEach( a ->{ |
|
|
|
|
WarehouseUpdownGoodsLogEntity updownGoodsLog = new WarehouseUpdownGoodsLogEntity(); |
|
|
|
|
updownGoodsLog.setAssociationType("3"); |
|
|
|
|
updownGoodsLog.setAssociationId(a.getId()); |
|
|
|
|
updownGoodsLog.setBindingType("2"); //下架
|
|
|
|
|
BasicdataWarehouseEntity my = basicdataWarehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
updownGoodsLog.setWarehouseId(my.getId()); |
|
|
|
|
WarehouseUpdownGoodsLogEntity updownGoods = warehouseUpdownGoodsLogClient.getUpdownGoods(updownGoodsLog); |
|
|
|
|
if(ObjectUtils.isNotNull(updownGoods)){ |
|
|
|
|
i.setAllocation(updownGoods.getPositionCode()); |
|
|
|
|
i.setAllocationId(updownGoods.getAllocationId()); |
|
|
|
|
i.setCompleteStact(true); |
|
|
|
|
//获取有货位的数据
|
|
|
|
|
List<DistributionStockupOrderListVO> collect11 = list.stream().filter(o -> ObjectUtils.isNotNull(o.getAllocationId())).collect(Collectors.toList()); |
|
|
|
|
Set<DistributionStockupOrderListVO> listYou = new HashSet<>(); |
|
|
|
|
collect11.forEach( i -> { |
|
|
|
|
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); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
y.setScanNum(y.getScanNum()+1); |
|
|
|
|
} |
|
|
|
|
//t托盘信息
|
|
|
|
|
if(ObjectUtils.isNotNull(y.getTrayId()) && y.getTrayId().equals(i.getTrayId())){ |
|
|
|
|
y.setPallet(y.getPallet()+","+i.getPallet()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} ); |
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(1); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
listYou.add(i); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(1); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
|
} |
|
|
|
|
listYou.add(i); |
|
|
|
|
} |
|
|
|
|
} ); |
|
|
|
|
//获取没有货位的数据
|
|
|
|
|
List<DistributionStockupOrderListVO> collect22 = list.stream().filter(o -> ObjectUtils.isNull(o.getAllocationId())).collect(Collectors.toList()); |
|
|
|
|
if(!collect22.isEmpty()){ |
|
|
|
|
collect22.forEach( i -> { |
|
|
|
|
boolean b = listYou.stream().anyMatch(ii -> ObjectUtils.isNull(ii.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(wu.getPlanNum().equals(wu.getScanNum())){ |
|
|
|
|
wu.setCompleteStact(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(1); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
|
} |
|
|
|
|
return list; |
|
|
|
|
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());//为空
|
|
|
|
|
//查询包件的库位的
|
|
|
|
|
return new ArrayList<>(listYou); |
|
|
|
|
} else { |
|
|
|
|
//商 市
|
|
|
|
|
//1.根据预约单id 查询到对应的数据
|
|
|
|
|
List<DistributionStockupOrderListVO> list = distributionReservationService.selectStockupOrderList(reservationId); |
|
|
|
|
// list.forEach( p ->{
|
|
|
|
|
//
|
|
|
|
|
// });
|
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -649,7 +706,10 @@ 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.selectDistrilbutionBillPackWuSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId()); |
|
|
|
|
DistributionStockupSelfVO distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillOverPackWuSelf(stockupDTO); |
|
|
|
|
// DistributionStockupSelfVO distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackWuSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DistributionParcelListEntity> list = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getStockArticleId, stockupDTO.getStockArticleId()) |
|
|
|
|
); |
|
|
|
@ -658,11 +718,13 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
list.forEach( i ->{ |
|
|
|
|
WarehouseUpdownGoodsLogEntity updownGoodsLogEntity = new WarehouseUpdownGoodsLogEntity(); |
|
|
|
|
updownGoodsLogEntity.setAssociationType("3"); |
|
|
|
|
updownGoodsLogEntity.setAssociationId(stockupDTO.getAllocationId()); |
|
|
|
|
updownGoodsLogEntity.setAssociationId(i.getId()); |
|
|
|
|
updownGoodsLogEntity.setAllocationId(stockupDTO.getAllocationId()); |
|
|
|
|
updownGoodsLogEntity.setBindingType("2"); |
|
|
|
|
updownGoodsLogEntity.setWarehouseId(myCurrentWarehouse.getId()); |
|
|
|
|
updownGoodsLogEntity.setAllocationId(i.getId()); |
|
|
|
|
// updownGoodsLogEntity.setAllocationId(i.getId());
|
|
|
|
|
WarehouseUpdownGoodsLogEntity updownGoods = warehouseUpdownGoodsLogClient.getUpdownGoods(updownGoodsLogEntity); |
|
|
|
|
if(ObjectUtils.isNotNull(updownGoods)){ |
|
|
|
|
PackageStockupVO packageStockupVO = new PackageStockupVO(); |
|
|
|
|
packageStockupVO.setOrderCode(i.getOrderCode()); |
|
|
|
|
packageStockupVO.setPackageBarCode(i.getOrderPackageCode()); |
|
|
|
@ -672,6 +734,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
packageStockupVO.setIsScanStr("已备货"); |
|
|
|
|
packageStockupVO.setIsScan(2); |
|
|
|
|
listPack.add(packageStockupVO); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
DistributionStockupOrderInfoVO vo = new DistributionStockupOrderInfoVO(); |
|
|
|
|
vo.setReservationId(stockupDTO.getReservationId()); //预约id
|
|
|
|
@ -690,13 +753,13 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
DistributionStockupSelfVO distributionStockupSelfVO = new DistributionStockupSelfVO(); |
|
|
|
|
if(ObjectUtils.isNotNull(stockupDTO.getAllocationId())){ |
|
|
|
|
//查询订单数量 有库位
|
|
|
|
|
distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId(),stockupDTO.getAllocationId()); |
|
|
|
|
distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackSelf(stockupDTO); |
|
|
|
|
}else{ |
|
|
|
|
//查询订单数量 无库位
|
|
|
|
|
distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackWuSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<PackageStockupVO> list = distributionParcelListService.selectOrderInfoSelfList(stockupDTO.getReservationId(), stockupDTO.getStockArticleId(), stockupDTO.getStockupId(), stockupDTO.getTrayId()); |
|
|
|
|
List<PackageStockupVO> list = distributionParcelListService.selectOrderInfoSelfList(stockupDTO); |
|
|
|
|
Iterator<PackageStockupVO> iterator = list.iterator(); |
|
|
|
|
|
|
|
|
|
if(Objects.isNull(stockupDTO.getAllocationId())){ |
|
|
|
|