@colijnit/articleapi 254.1.2 → 254.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/articles.d.ts +3 -1
- package/build/articles.js +43 -41
- package/build/interface/json-article-flat-tree.interface.d.ts +7 -0
- package/build/interface/json-article-flat-tree.interface.js +1 -0
- package/build/model/article-flat-tree.bo.d.ts +2 -0
- package/build/model/article-flat-tree.bo.js +5 -0
- package/package.json +1 -1
package/build/articles.d.ts
CHANGED
|
@@ -101,7 +101,9 @@ export declare class Articles {
|
|
|
101
101
|
storeCatFarmCompositionArticle(catalogId: number, articleFlatTree: ArticleFlatTreeDTO): Promise<DataServiceResponseData>;
|
|
102
102
|
getArticleListWithBarcodeArticleNrEanCode(searchString: string, showLoader?: boolean): Promise<DataServiceResponseData>;
|
|
103
103
|
getJsonConfiguredArticles(configuratorStatistics?: ConfiguratorStatisticsEnvironment, showLoader?: boolean, instanceId?: number): Promise<DataServiceResponseData>;
|
|
104
|
-
getJsonArticleFlatTree(goodId: number, goodType: string, quantity: number, showLoader?: boolean, instanceId?: number, configuratorStatistics?: ConfiguratorStatisticsEnvironment): Promise<string>;
|
|
104
|
+
getJsonArticleFlatTree(goodId: number, goodType: string, quantity: number, externalSource?: boolean, showLoader?: boolean, instanceId?: number, configuratorStatistics?: ConfiguratorStatisticsEnvironment): Promise<string>;
|
|
105
105
|
static createConnector(isPublicSession: boolean, sessionExists: boolean): IoneApiArticles;
|
|
106
|
+
private _getFrozenArticle;
|
|
107
|
+
private _getArticleFlatTree;
|
|
106
108
|
private _handleConnectionReset;
|
|
107
109
|
}
|
package/build/articles.js
CHANGED
|
@@ -13,6 +13,7 @@ import { ArticlesPublic } from './articles-public';
|
|
|
13
13
|
import { Connector } from '@colijnit/ioneconnector/build/connector';
|
|
14
14
|
import { SelectorArticle } from './model/selector-article';
|
|
15
15
|
import { BusinessObjectFactory } from '@colijnit/ioneconnector/build/service/business-object-factory';
|
|
16
|
+
import { ArticleFlatTreeDTO } from "./model/article-flat-tree.bo";
|
|
16
17
|
export class Articles {
|
|
17
18
|
constructor(options) {
|
|
18
19
|
this.showLoader = new Subject();
|
|
@@ -232,54 +233,24 @@ export class Articles {
|
|
|
232
233
|
getJsonConfiguredArticles(configuratorStatistics, showLoader = true, instanceId = undefined) {
|
|
233
234
|
return this.articles.getFrozenArticle(configuratorStatistics, showLoader, instanceId);
|
|
234
235
|
}
|
|
235
|
-
getJsonArticleFlatTree(goodId, goodType, quantity, showLoader = true, instanceId = undefined, configuratorStatistics) {
|
|
236
|
+
getJsonArticleFlatTree(goodId, goodType, quantity, externalSource = false, showLoader = true, instanceId = undefined, configuratorStatistics) {
|
|
236
237
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
237
|
-
const returnObject = { goodId:
|
|
238
|
-
returnObject.baseGoodId = goodId;
|
|
239
|
-
returnObject.selectorData = {};
|
|
240
|
-
returnObject.quantity = quantity;
|
|
238
|
+
const returnObject = { goodId: goodId, baseGoodId: goodId, selectorData: {}, quantity: quantity, articleTree: {} };
|
|
241
239
|
if (goodType === 'B') {
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
const articles = this.boFactory.makeBOArrayFromRawBackendDataArray(SelectorArticle, rawArray);
|
|
246
|
-
const composedArticle = !!articles[0].compositionArticleNo;
|
|
247
|
-
let frozenart;
|
|
248
|
-
frozenart = this.boFactory.makeWithRawBackendData(SelectorArticle, articles[0]);
|
|
249
|
-
if (composedArticle) {
|
|
250
|
-
frozenart.compositions = [];
|
|
251
|
-
frozenart.compositions.push(articles);
|
|
252
|
-
}
|
|
253
|
-
const selectorDataObject = frozenart;
|
|
254
|
-
returnObject.goodId = (selectorDataObject.hasOwnProperty('compositionGoodId') &&
|
|
255
|
-
selectorDataObject['compositionGoodId'] !== undefined &&
|
|
256
|
-
selectorDataObject['compositionGoodId'] !== null) ? selectorDataObject['compositionGoodId'] : selectorDataObject.goodId;
|
|
257
|
-
returnObject.selectorData = selectorDataObject;
|
|
258
|
-
const articleFlatTreeResponse = yield this.articles.getJsonArticleFlatTree(returnObject.goodId, showLoader);
|
|
259
|
-
if (articleFlatTreeResponse && articleFlatTreeResponse.validationResult && articleFlatTreeResponse.validationResult.success) {
|
|
260
|
-
if (articleFlatTreeResponse.resultObject) {
|
|
261
|
-
returnObject.articleTree = articleFlatTreeResponse.resultObject;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
reject(articleFlatTreeResponse);
|
|
266
|
-
}
|
|
240
|
+
const frozenArt = yield this._getFrozenArticle(instanceId, configuratorStatistics, showLoader);
|
|
241
|
+
if (!frozenArt) {
|
|
242
|
+
reject("");
|
|
267
243
|
}
|
|
268
|
-
|
|
269
|
-
|
|
244
|
+
returnObject.goodId = (frozenArt.hasOwnProperty('compositionGoodId') &&
|
|
245
|
+
frozenArt['compositionGoodId'] !== undefined &&
|
|
246
|
+
frozenArt['compositionGoodId'] !== null) ? frozenArt['compositionGoodId'] : frozenArt.goodId;
|
|
247
|
+
returnObject.selectorData = frozenArt;
|
|
248
|
+
if (externalSource) {
|
|
249
|
+
returnObject.articleTree = yield this._getArticleFlatTree(returnObject.goodId, showLoader);
|
|
270
250
|
}
|
|
271
251
|
}
|
|
272
252
|
else {
|
|
273
253
|
returnObject.goodId = goodId;
|
|
274
|
-
const articleFlatTreeResponse = yield this.articles.getJsonArticleFlatTree(returnObject.goodId, showLoader);
|
|
275
|
-
if (articleFlatTreeResponse && articleFlatTreeResponse.validationResult && articleFlatTreeResponse.validationResult.success) {
|
|
276
|
-
if (articleFlatTreeResponse.resultObject) {
|
|
277
|
-
returnObject.articleTree = articleFlatTreeResponse.resultObject;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
reject(articleFlatTreeResponse);
|
|
282
|
-
}
|
|
283
254
|
}
|
|
284
255
|
resolve(JSON.stringify(returnObject));
|
|
285
256
|
}));
|
|
@@ -290,6 +261,37 @@ export class Articles {
|
|
|
290
261
|
}
|
|
291
262
|
return new ArticlesPublic();
|
|
292
263
|
}
|
|
264
|
+
_getFrozenArticle(instanceId, configuratorStatistics, showLoader) {
|
|
265
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
266
|
+
const frozenArticleResponse = yield this.articles.getFrozenArticle(configuratorStatistics, showLoader, instanceId);
|
|
267
|
+
if (frozenArticleResponse && frozenArticleResponse.validationResult && frozenArticleResponse.validationResult.success) {
|
|
268
|
+
const rawArray = frozenArticleResponse.resultObject;
|
|
269
|
+
const articles = this.boFactory.makeBOArrayFromRawBackendDataArray(SelectorArticle, rawArray);
|
|
270
|
+
const composedArticle = !!articles[0].compositionArticleNo;
|
|
271
|
+
let frozenart;
|
|
272
|
+
frozenart = this.boFactory.makeWithRawBackendData(SelectorArticle, articles[0]);
|
|
273
|
+
if (composedArticle) {
|
|
274
|
+
frozenart.compositions = [];
|
|
275
|
+
frozenart.compositions.push(articles);
|
|
276
|
+
}
|
|
277
|
+
return frozenart;
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
_getArticleFlatTree(goodId, showLoader) {
|
|
285
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
286
|
+
const articleFlatTreeResponse = yield this.articles.getJsonArticleFlatTree(goodId, showLoader);
|
|
287
|
+
if (articleFlatTreeResponse && articleFlatTreeResponse.validationResult && articleFlatTreeResponse.validationResult.success) {
|
|
288
|
+
if (articleFlatTreeResponse.resultObject) {
|
|
289
|
+
return this.boFactory.makeWithRawBackendData(ArticleFlatTreeDTO, articleFlatTreeResponse.resultObject);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return null;
|
|
293
|
+
});
|
|
294
|
+
}
|
|
293
295
|
_handleConnectionReset() {
|
|
294
296
|
this.connectionResetInactivity.next();
|
|
295
297
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,6 +5,7 @@ import { CompositeGood } from "./composite-good";
|
|
|
5
5
|
import { ArticlePriceList } from "./article-price-list";
|
|
6
6
|
import { PriceListInfo } from "./price-list-info";
|
|
7
7
|
import { CoDocument } from "./co-document.bo";
|
|
8
|
+
import { CoText } from '@colijnit/mainapi/build/model/co-text';
|
|
8
9
|
export declare class ArticleFlatTreeDTO extends BusinessObject {
|
|
9
10
|
article: ArticleFlat;
|
|
10
11
|
subArticles: ArticleFlat[];
|
|
@@ -14,4 +15,5 @@ export declare class ArticleFlatTreeDTO extends BusinessObject {
|
|
|
14
15
|
priceLists: PriceListInfo[];
|
|
15
16
|
supplierIdToNumber: Object;
|
|
16
17
|
documents: CoDocument[];
|
|
18
|
+
articleTexts: CoText[];
|
|
17
19
|
}
|
|
@@ -13,6 +13,7 @@ import { PriceListInfo } from "./price-list-info";
|
|
|
13
13
|
import { CoDocument } from "./co-document.bo";
|
|
14
14
|
import { ComplexField } from "@colijnit/ioneconnector/build/factory/decorators/complex-field.decorator";
|
|
15
15
|
import { ComplexArray } from "@colijnit/ioneconnector/build/factory/decorators/complex-array.decorator";
|
|
16
|
+
import { CoText } from '@colijnit/mainapi/build/model/co-text';
|
|
16
17
|
export class ArticleFlatTreeDTO extends BusinessObject {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
@@ -23,6 +24,7 @@ export class ArticleFlatTreeDTO extends BusinessObject {
|
|
|
23
24
|
this.priceLists = [];
|
|
24
25
|
this.supplierIdToNumber = {};
|
|
25
26
|
this.documents = [];
|
|
27
|
+
this.articleTexts = [];
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
__decorate([
|
|
@@ -46,3 +48,6 @@ __decorate([
|
|
|
46
48
|
__decorate([
|
|
47
49
|
ComplexArray(CoDocument)
|
|
48
50
|
], ArticleFlatTreeDTO.prototype, "documents", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
ComplexArray(CoText)
|
|
53
|
+
], ArticleFlatTreeDTO.prototype, "articleTexts", void 0);
|