mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
#1494 Fehler bei Avaibility Berechnung
This commit is contained in:
@@ -4,8 +4,8 @@ import { AvailabilityDTO, BranchDTO, OLAAvailabilityDTO, StoreCheckoutService, S
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { AvailabilityService as SwaggerAvailabilityService } from '@swagger/availability';
|
||||
import { StockService } from '@swagger/cat';
|
||||
import { map, mergeMap, shareReplay, withLatestFrom } from 'rxjs/operators';
|
||||
import { isNullOrUndefined, memorize } from '@utils/common';
|
||||
import { map, mergeMap, shareReplay, switchMap, withLatestFrom } from 'rxjs/operators';
|
||||
import { isArray, isNullOrUndefined, memorize } from '@utils/common';
|
||||
import { OrderService } from '@swagger/oms';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@@ -80,21 +80,25 @@ export class AvailabilityService {
|
||||
.pipe(
|
||||
map((r) => {
|
||||
const availabilities = r.result;
|
||||
const preferred = availabilities.find((f) => f.preferred === 1);
|
||||
|
||||
const availability: AvailabilityDTO = {
|
||||
availabilityType: preferred?.status,
|
||||
ssc: preferred?.ssc,
|
||||
sscText: preferred?.sscText,
|
||||
supplier: { id: preferred?.supplierId },
|
||||
isPrebooked: preferred?.isPrebooked,
|
||||
estimatedShippingDate: preferred?.at,
|
||||
price: preferred?.price,
|
||||
inStock: preferred?.qty,
|
||||
supplierProductNumber: preferred.supplierProductNumber,
|
||||
};
|
||||
return availability;
|
||||
if (isArray(availabilities)) {
|
||||
const preferred = availabilities.find((f) => f.preferred === 1);
|
||||
|
||||
const availability: AvailabilityDTO = {
|
||||
availabilityType: preferred?.status,
|
||||
ssc: preferred?.ssc,
|
||||
sscText: preferred?.sscText,
|
||||
supplier: { id: preferred?.supplierId },
|
||||
isPrebooked: preferred?.isPrebooked,
|
||||
estimatedShippingDate: preferred?.at,
|
||||
price: preferred?.price,
|
||||
inStock: preferred?.qty,
|
||||
supplierProductNumber: preferred.supplierProductNumber,
|
||||
};
|
||||
return availability;
|
||||
}
|
||||
}),
|
||||
switchMap((availability) => (!!availability ? [availability] : this.getDeliveryAvailability({ item, quantity }))),
|
||||
shareReplay()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ export class ProductAvailabilityService {
|
||||
return {
|
||||
branchId: branchNumber,
|
||||
type: CheckoutType.deliveryB2b,
|
||||
av: availabilityDTO.result.map((av) => {
|
||||
av: availabilityDTO.result?.map((av) => {
|
||||
let at = undefined;
|
||||
const deliveryDate = new Date(av.at);
|
||||
if (new Date().getHours() >= 16) {
|
||||
|
||||
Reference in New Issue
Block a user