@things-factory/operato-mms 4.1.14 → 4.1.19

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.
@@ -10,82 +10,112 @@ const shell_1 = require("@things-factory/shell");
10
10
  const warehouse_base_1 = require("@things-factory/warehouse-base");
11
11
  exports.autoUpdateAllMarketplaceProductVariationQuantityResolver = {
12
12
  async autoUpdateAllMarketplaceProductVariationQuantity(_, { companyDomainId, warehouseId }, context) {
13
- var _a, _b;
14
- try {
15
- const { tx } = context.state;
16
- const companyDomain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(companyDomainId);
17
- const productVariations = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceProductVariation).find({
18
- where: { domain: companyDomain },
19
- relations: [
20
- 'marketplaceProduct',
21
- 'marketplaceProduct.marketplaceStore',
22
- 'marketplaceProduct.marketplaceStore.marketplaceDistributors',
23
- 'creator',
24
- 'updater'
25
- ]
13
+ const companyDomain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(companyDomainId);
14
+ const marketplaceStores = await (0, typeorm_1.getRepository)(integration_marketplace_1.MarketplaceStore).find({
15
+ where: { domain: companyDomain, status: 'ACTIVE' },
16
+ relations: ['marketplaceDistributors']
17
+ });
18
+ const fulfilmentCenter = await integration_fulfillment_1.FulfillmentAPI.getFulfillmentCenter(warehouseId);
19
+ const centerId = fulfilmentCenter.centerId;
20
+ const warehouseDomain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne({ where: { subdomain: centerId } });
21
+ let products = await (0, typeorm_1.getRepository)(product_base_1.Product).find({
22
+ where: { domain: companyDomain },
23
+ relations: ['productDetails']
24
+ });
25
+ let inventoryProducts = await Promise.all(products.map(async (product) => {
26
+ const productDetails = product.productDetails;
27
+ const defaultProductDetail = productDetails.filter(productDetail => productDetail.isDefault)[0];
28
+ let qb = await (0, typeorm_1.getRepository)(warehouse_base_1.Inventory).createQueryBuilder('inv');
29
+ qb.leftJoinAndSelect('inv.location', 'loc')
30
+ .andWhere('"inv"."domain_id" = :domainId')
31
+ .andWhere('"inv"."product_id" = :productId')
32
+ .andWhere('"inv"."status" != :status')
33
+ .andWhere('"loc"."type" NOT IN (:...locationTypes)')
34
+ .setParameters({
35
+ domainId: warehouseDomain.id,
36
+ productId: product.id,
37
+ status: warehouse_base_1.INVENTORY_STATUS.TERMINATED,
38
+ locationTypes: [warehouse_base_1.LOCATION_TYPE.QUARANTINE, warehouse_base_1.LOCATION_TYPE.RESERVE]
26
39
  });
27
- for (var i = 0; i < productVariations.length; i++) {
28
- const productVariation = productVariations[i];
29
- const sku = productVariation.sku;
30
- let warehouseProductQty = 0;
31
- if (sku) {
32
- const fulfilmentCenter = await integration_fulfillment_1.FulfillmentAPI.getFulfillmentCenter(warehouseId);
33
- const centerId = fulfilmentCenter.centerId;
34
- const warehouseDomain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne({ where: { subdomain: centerId } });
35
- const product = await (0, typeorm_1.getRepository)(product_base_1.Product).findOne({ where: { domain: companyDomain, sku } });
36
- const qb = await (0, typeorm_1.getRepository)(warehouse_base_1.Inventory).createQueryBuilder('INV');
37
- qb.select('SUM(INV.qty - INV.locked_qty)', 'remainQty')
38
- .where('"INV"."domain_id" = :domainId', { domainId: warehouseDomain.id })
39
- .andWhere('"INV"."product_id" = :productId', { productId: product.id })
40
- .andWhere('"INV"."status" = :invStatus', { invStatus: 'STORED' })
41
- .groupBy('"INV".product_id');
42
- const item = await qb.getRawOne();
43
- if (item)
44
- warehouseProductQty += parseFloat(item.remainQty) || 0;
45
- }
46
- const marketplaceStore = (_a = productVariation === null || productVariation === void 0 ? void 0 : productVariation.marketplaceProduct) === null || _a === void 0 ? void 0 : _a.marketplaceStore;
47
- const hasVariation = (_b = productVariation === null || productVariation === void 0 ? void 0 : productVariation.marketplaceProduct) === null || _b === void 0 ? void 0 : _b.hasVariation;
48
- if (marketplaceStore) {
49
- //Lazada Product quantity data update -> {sku, qty}
50
- //Shopee Product quantity data update -> variation = false: {itemId, qty} | variation = true: {itemId, variationId, qty}
51
- const productVariationQty = productVariation.qty || 0;
52
- const productVariationReserveQty = productVariation.reserveQty || 0;
53
- let adjustQty = productVariationQty == warehouseProductQty
54
- ? productVariationQty - productVariationReserveQty
55
- : warehouseProductQty - productVariationReserveQty;
56
- let productVariationLocationId = productVariation.locationId;
57
- if (marketplaceStore.platform === 'SHOPIFY') {
58
- adjustQty = productVariationReserveQty;
59
- let locationIds = JSON.parse(productVariationLocationId);
60
- productVariationLocationId = locationIds[0].location_id;
61
- }
62
- if (hasVariation) {
63
- await integration_marketplace_1.StoreAPI.updateStoreProductVariationStock(marketplaceStore, [
64
- {
65
- itemId: productVariation.marketplaceProduct.itemId,
66
- variationId: productVariation.variationId,
67
- qty: adjustQty,
68
- locationId: productVariationLocationId,
69
- inventoryItemId: productVariation.inventoryItemId
40
+ let inventories = await qb.getMany();
41
+ const inventoryQty = inventories.reduce((total, currentValue) => {
42
+ total += currentValue.qty;
43
+ return total;
44
+ }, 0);
45
+ const inventoryLockedQty = inventories.reduce((total, currentValue) => {
46
+ total += currentValue.lockedQty;
47
+ return total;
48
+ }, 0);
49
+ return {
50
+ product,
51
+ sku: product.sku,
52
+ name: product.name,
53
+ packingType: defaultProductDetail.packingType,
54
+ packingSize: defaultProductDetail.packingSize,
55
+ uom: defaultProductDetail.uom,
56
+ qty: inventoryQty - inventoryLockedQty
57
+ };
58
+ }));
59
+ await (0, typeorm_1.getConnection)().transaction(async (tx) => {
60
+ let bundleProductInventories = await (0, warehouse_base_1.getProductBundleInventory)(warehouseDomain, companyDomain, inventoryProducts, tx);
61
+ bundleProductInventories.map(bundleProductInventory => {
62
+ inventoryProducts.push(bundleProductInventory);
63
+ });
64
+ });
65
+ for (let i = 0; i < marketplaceStores.length; i++) {
66
+ try {
67
+ const marketplaceStore = marketplaceStores[i];
68
+ const marketplaceSetting = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceSetting).findOne({
69
+ where: { marketplaceStore, category: 'stock_allocation' }
70
+ });
71
+ for (let j = 0; j < inventoryProducts.length; j++) {
72
+ await (0, typeorm_1.getConnection)().transaction(async (tx) => {
73
+ var _a;
74
+ const inventoryProduct = inventoryProducts[j];
75
+ const marketplaceProductVariations = await tx
76
+ .getRepository(marketplace_base_1.MarketplaceProductVariation)
77
+ .find({
78
+ where: { domain: companyDomain, sku: inventoryProduct.sku },
79
+ relations: ['marketplaceProduct', 'marketplaceProduct.marketplaceStore']
80
+ });
81
+ let marketplaceProductVariation = marketplaceProductVariations.filter(productVariation => productVariation.marketplaceProduct.marketplaceStore.id === marketplaceStore.id)[0];
82
+ let percentageValue = 100;
83
+ if (marketplaceProductVariation) {
84
+ if (marketplaceSetting) {
85
+ percentageValue = parseInt(marketplaceSetting.value);
86
+ }
87
+ let productVariationLocationId = marketplaceProductVariation === null || marketplaceProductVariation === void 0 ? void 0 : marketplaceProductVariation.locationId;
88
+ let adjustQty = Math.floor((inventoryProduct.qty - marketplaceProductVariation.reserveQty) * (percentageValue / 100));
89
+ if (marketplaceStore.platform === 'shopify') {
90
+ let locationIds = JSON.parse(productVariationLocationId);
91
+ adjustQty = adjustQty - marketplaceProductVariation.qty;
92
+ if ((_a = locationIds[0]) === null || _a === void 0 ? void 0 : _a.location_id)
93
+ productVariationLocationId = locationIds[0].location_id;
70
94
  }
71
- ]);
72
- }
73
- else {
74
- await integration_marketplace_1.StoreAPI.updateStoreProductStock(marketplaceStore, [
75
- {
76
- itemId: productVariation.marketplaceProduct.itemId,
77
- variationId: productVariation.variationId,
78
- variationSku: productVariation.variationSku,
79
- qty: adjustQty,
80
- distributors: marketplaceStore.marketplaceDistributors
95
+ let validMarketplaceDistributors = [];
96
+ if (marketplaceStore.marketplaceDistributors) {
97
+ validMarketplaceDistributors = marketplaceStore.marketplaceDistributors.filter(distributor => distributor.status === 'ACTIVE');
81
98
  }
82
- ]);
83
- }
99
+ await integration_marketplace_1.StoreAPI.updateStoreProductVariationStock(marketplaceStore, [
100
+ {
101
+ itemId: marketplaceProductVariation.marketplaceProduct.itemId,
102
+ variationId: marketplaceProductVariation.variationId,
103
+ variationSku: marketplaceProductVariation.variationSku,
104
+ qty: adjustQty,
105
+ locationId: productVariationLocationId,
106
+ inventoryItemId: marketplaceProductVariation.inventoryItemId,
107
+ distributors: validMarketplaceDistributors
108
+ }
109
+ ]);
110
+ marketplaceProductVariation.qty = Math.floor(inventoryProduct.qty * (percentageValue / 100));
111
+ await tx.getRepository(marketplace_base_1.MarketplaceProductVariation).save(marketplaceProductVariation);
112
+ }
113
+ });
84
114
  }
85
115
  }
86
- return true;
116
+ catch (e) { }
87
117
  }
88
- catch (ex) { }
118
+ return true;
89
119
  }
90
120
  };
91
121
  //# sourceMappingURL=auto-update-all-marketplace-product-variation-quantity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auto-update-all-marketplace-product-variation-quantity.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/auto-update-all-marketplace-product-variation-quantity.ts"],"names":[],"mappings":";;;AAAA,qCAA0E;AAE1E,qFAAwE;AACxE,qFAAkE;AAClE,uEAA8E;AAC9E,+DAAsD;AACtD,iDAA8C;AAC9C,mEAA0D;AAE7C,QAAA,wDAAwD,GAAG;IACtE,KAAK,CAAC,gDAAgD,CAAC,CAAM,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE,EAAE,OAAY;;QAC3G,IAAI;YACF,MAAM,EAAE,EAAE,EAAE,GAA0B,OAAO,CAAC,KAAK,CAAA;YAEnD,MAAM,aAAa,GAAW,MAAM,IAAA,uBAAa,EAAC,cAAM,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;YAElF,MAAM,iBAAiB,GAAkC,MAAM,IAAA,uBAAa,EAAC,8CAA2B,CAAC,CAAC,IAAI,CAAC;gBAC7G,KAAK,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE;gBAChC,SAAS,EAAE;oBACT,oBAAoB;oBACpB,qCAAqC;oBACrC,6DAA6D;oBAC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CAAC,eAAe;6BAClD;yBACF,CAAC,CAAA;qBACH;yBAAM;wBACL,MAAM,kCAAQ,CAAC,uBAAuB,CAAC,gBAAgB,EAAE;4BACvD;gCACE,MAAM,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,MAAM;gCAClD,WAAW,EAAE,gBAAgB,CAAC,WAAW;gCACzC,YAAY,EAAE,gBAAgB,CAAC,YAAY;gCAC3C,GAAG,EAAE,SAAS;gCACd,YAAY,EAAE,gBAAgB,CAAC,uBAAuB;6BACvD;yBACF,CAAC,CAAA;qBACH;iBACF;aACF;YAED,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,EAAE,EAAE,GAAE;IACjB,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"auto-update-all-marketplace-product-variation-quantity.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/auto-update-all-marketplace-product-variation-quantity.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AAEtD,qFAAwE;AACxE,qFAAoF;AACpF,uEAAkG;AAClG,+DAAqE;AACrE,iDAA8C;AAC9C,mEAAsH;AAEzG,QAAA,wDAAwD,GAAG;IACtE,KAAK,CAAC,gDAAgD,CAAC,CAAM,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE,EAAE,OAAY;QAC3G,MAAM,aAAa,GAAW,MAAM,IAAA,uBAAa,EAAC,cAAM,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;QAElF,MAAM,iBAAiB,GAAuB,MAAM,IAAA,uBAAa,EAAC,0CAAgB,CAAC,CAAC,IAAI,CAAC;YACvF,KAAK,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE;YAClD,SAAS,EAAE,CAAC,yBAAyB,CAAC;SACvC,CAAC,CAAA;QAEF,MAAM,gBAAgB,GAAG,MAAM,wCAAc,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAA;QAE/E,MAAM,QAAQ,GAAW,gBAAgB,CAAC,QAAQ,C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+1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-mms",
3
- "version": "4.1.14",
3
+ "version": "4.1.19",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -60,50 +60,50 @@
60
60
  "@operato/scene-table": "^0.1.5",
61
61
  "@operato/scene-timer": "^0.1.5",
62
62
  "@operato/scene-wheel-sorter": "^0.1.5",
63
- "@things-factory/apptool-ui": "^4.1.14",
64
- "@things-factory/attachment-base": "^4.1.14",
65
- "@things-factory/auth-ui": "^4.1.14",
66
- "@things-factory/biz-base": "^4.1.14",
67
- "@things-factory/board-service": "^4.1.14",
68
- "@things-factory/board-ui": "^4.1.14",
69
- "@things-factory/code-ui": "^4.1.14",
70
- "@things-factory/context-ui": "^4.1.14",
71
- "@things-factory/dashboard": "^4.1.14",
72
- "@things-factory/export-ui": "^4.1.14",
73
- "@things-factory/export-ui-csv": "^4.1.14",
74
- "@things-factory/export-ui-excel": "^4.1.14",
75
- "@things-factory/geography": "^4.1.14",
76
- "@things-factory/grist-ui": "^4.1.14",
77
- "@things-factory/help": "^4.1.14",
78
- "@things-factory/i18n-base": "^4.1.14",
79
- "@things-factory/integration-fulfillment": "^4.1.14",
80
- "@things-factory/integration-lmd": "^4.1.14",
81
- "@things-factory/lite-menu": "^4.1.14",
82
- "@things-factory/marketplace-base": "^4.1.14",
83
- "@things-factory/more-ui": "^4.1.14",
84
- "@things-factory/notification": "^4.1.14",
85
- "@things-factory/oauth2-client": "^4.1.14",
86
- "@things-factory/pdf": "^4.1.14",
87
- "@things-factory/product-base": "^4.1.14",
88
- "@things-factory/resource-ui": "^4.1.14",
89
- "@things-factory/scene-data-transform": "^4.1.14",
90
- "@things-factory/scene-excel": "^4.1.14",
91
- "@things-factory/scene-firebase": "^4.1.14",
92
- "@things-factory/scene-form": "^4.1.14",
93
- "@things-factory/scene-google-map": "^4.1.14",
94
- "@things-factory/scene-graphql": "^4.1.14",
95
- "@things-factory/scene-label": "^4.1.14",
96
- "@things-factory/scene-marker": "^4.1.14",
97
- "@things-factory/scene-mqtt": "^4.1.14",
98
- "@things-factory/scene-restful": "^4.1.14",
99
- "@things-factory/scene-visualizer": "^4.1.14",
100
- "@things-factory/setting-ui": "^4.1.14",
101
- "@things-factory/system-ui": "^4.1.14",
102
- "@things-factory/warehouse-base": "^4.1.14"
63
+ "@things-factory/apptool-ui": "^4.1.19",
64
+ "@things-factory/attachment-base": "^4.1.19",
65
+ "@things-factory/auth-ui": "^4.1.19",
66
+ "@things-factory/biz-base": "^4.1.19",
67
+ "@things-factory/board-service": "^4.1.19",
68
+ "@things-factory/board-ui": "^4.1.19",
69
+ "@things-factory/code-ui": "^4.1.19",
70
+ "@things-factory/context-ui": "^4.1.19",
71
+ "@things-factory/dashboard": "^4.1.19",
72
+ "@things-factory/export-ui": "^4.1.19",
73
+ "@things-factory/export-ui-csv": "^4.1.19",
74
+ "@things-factory/export-ui-excel": "^4.1.19",
75
+ "@things-factory/geography": "^4.1.19",
76
+ "@things-factory/grist-ui": "^4.1.19",
77
+ "@things-factory/help": "^4.1.19",
78
+ "@things-factory/i18n-base": "^4.1.19",
79
+ "@things-factory/integration-fulfillment": "^4.1.19",
80
+ "@things-factory/integration-lmd": "^4.1.19",
81
+ "@things-factory/lite-menu": "^4.1.19",
82
+ "@things-factory/marketplace-base": "^4.1.19",
83
+ "@things-factory/more-ui": "^4.1.19",
84
+ "@things-factory/notification": "^4.1.19",
85
+ "@things-factory/oauth2-client": "^4.1.19",
86
+ "@things-factory/pdf": "^4.1.19",
87
+ "@things-factory/product-base": "^4.1.19",
88
+ "@things-factory/resource-ui": "^4.1.19",
89
+ "@things-factory/scene-data-transform": "^4.1.19",
90
+ "@things-factory/scene-excel": "^4.1.19",
91
+ "@things-factory/scene-firebase": "^4.1.19",
92
+ "@things-factory/scene-form": "^4.1.19",
93
+ "@things-factory/scene-google-map": "^4.1.19",
94
+ "@things-factory/scene-graphql": "^4.1.19",
95
+ "@things-factory/scene-label": "^4.1.19",
96
+ "@things-factory/scene-marker": "^4.1.19",
97
+ "@things-factory/scene-mqtt": "^4.1.19",
98
+ "@things-factory/scene-restful": "^4.1.19",
99
+ "@things-factory/scene-visualizer": "^4.1.19",
100
+ "@things-factory/setting-ui": "^4.1.19",
101
+ "@things-factory/system-ui": "^4.1.19",
102
+ "@things-factory/warehouse-base": "^4.1.19"
103
103
  },
104
104
  "devDependencies": {
105
- "@things-factory/builder": "^4.1.14",
105
+ "@things-factory/builder": "^4.1.19",
106
106
  "@types/node-fetch": "^2.5.7"
107
107
  },
108
- "gitHead": "15bbbacf728bbd3945ba9f757ef7af09db5241df"
108
+ "gitHead": "d7acb254cb15ce5e20a1dc013af52b057b2ef0b3"
109
109
  }
@@ -1,99 +1,151 @@
1
- import { EntityManager, getRepository, SelectQueryBuilder } from 'typeorm'
1
+ import { getConnection, getRepository } from 'typeorm'
2
2
 
3
3
  import { FulfillmentAPI } from '@things-factory/integration-fulfillment'
4
- import { StoreAPI } from '@things-factory/integration-marketplace'
5
- import { MarketplaceProductVariation } from '@things-factory/marketplace-base'
6
- import { Product } from '@things-factory/product-base'
4
+ import { MarketplaceStore, StoreAPI } from '@things-factory/integration-marketplace'
5
+ import { MarketplaceProductVariation, MarketplaceSetting } from '@things-factory/marketplace-base'
6
+ import { Product, ProductDetail } from '@things-factory/product-base'
7
7
  import { Domain } from '@things-factory/shell'
8
- import { Inventory } from '@things-factory/warehouse-base'
8
+ import { getProductBundleInventory, Inventory, INVENTORY_STATUS, LOCATION_TYPE } from '@things-factory/warehouse-base'
9
9
 
10
10
  export const autoUpdateAllMarketplaceProductVariationQuantityResolver = {
11
11
  async autoUpdateAllMarketplaceProductVariationQuantity(_: any, { companyDomainId, warehouseId }, context: any) {
12
- try {
13
- const { tx }: { tx: EntityManager } = context.state
14
-
15
- const companyDomain: Domain = await getRepository(Domain).findOne(companyDomainId)
16
-
17
- const productVariations: MarketplaceProductVariation[] = await getRepository(MarketplaceProductVariation).find({
18
- where: { domain: companyDomain },
19
- relations: [
20
- 'marketplaceProduct',
21
- 'marketplaceProduct.marketplaceStore',
22
- 'marketplaceProduct.marketplaceStore.marketplaceDistributors',
23
- 'creator',
24
- 'updater'
25
- ]
26
- })
12
+ const companyDomain: Domain = await getRepository(Domain).findOne(companyDomainId)
13
+
14
+ const marketplaceStores: MarketplaceStore[] = await getRepository(MarketplaceStore).find({
15
+ where: { domain: companyDomain, status: 'ACTIVE' },
16
+ relations: ['marketplaceDistributors']
17
+ })
18
+
19
+ const fulfilmentCenter = await FulfillmentAPI.getFulfillmentCenter(warehouseId)
20
+
21
+ const centerId: string = fulfilmentCenter.centerId
22
+ const warehouseDomain: Domain = await getRepository(Domain).findOne({ where: { subdomain: centerId } })
23
+
24
+ let products: Product[] = await getRepository(Product).find({
25
+ where: { domain: companyDomain },
26
+ relations: ['productDetails']
27
+ })
28
+
29
+ let inventoryProducts: any[] = await Promise.all(
30
+ products.map(async product => {
31
+ const productDetails: ProductDetail[] = product.productDetails
32
+ const defaultProductDetail: ProductDetail = productDetails.filter(productDetail => productDetail.isDefault)[0]
27
33
 
28
- for (var i = 0; i < productVariations.length; i++) {
29
- const productVariation: MarketplaceProductVariation = productVariations[i]
30
-
31
- const sku: string = productVariation.sku
32
-
33
- let warehouseProductQty: number = 0
34
- if (sku) {
35
- const fulfilmentCenter = await FulfillmentAPI.getFulfillmentCenter(warehouseId)
36
- const centerId: string = fulfilmentCenter.centerId
37
- const warehouseDomain: Domain = await getRepository(Domain).findOne({ where: { subdomain: centerId } })
38
- const product: Product = await getRepository(Product).findOne({ where: { domain: companyDomain, sku } })
39
- const qb: SelectQueryBuilder<Inventory> = await getRepository(Inventory).createQueryBuilder('INV')
40
- qb.select('SUM(INV.qty - INV.locked_qty)', 'remainQty')
41
- .where('"INV"."domain_id" = :domainId', { domainId: warehouseDomain.id })
42
- .andWhere('"INV"."product_id" = :productId', { productId: product.id })
43
- .andWhere('"INV"."status" = :invStatus', { invStatus: 'STORED' })
44
- .groupBy('"INV".product_id')
45
-
46
- const item: any = await qb.getRawOne()
47
- if (item) warehouseProductQty += parseFloat(item.remainQty) || 0
34
+ let qb = await getRepository(Inventory).createQueryBuilder('inv')
35
+ qb.leftJoinAndSelect('inv.location', 'loc')
36
+ .andWhere('"inv"."domain_id" = :domainId')
37
+ .andWhere('"inv"."product_id" = :productId')
38
+ .andWhere('"inv"."status" != :status')
39
+ .andWhere('"loc"."type" NOT IN (:...locationTypes)')
40
+ .setParameters({
41
+ domainId: warehouseDomain.id,
42
+ productId: product.id,
43
+ status: INVENTORY_STATUS.TERMINATED,
44
+ locationTypes: [LOCATION_TYPE.QUARANTINE, LOCATION_TYPE.RESERVE]
45
+ })
46
+
47
+ let inventories: Inventory[] = await qb.getMany()
48
+
49
+ const inventoryQty: number = inventories.reduce((total, currentValue) => {
50
+ total += currentValue.qty
51
+ return total
52
+ }, 0)
53
+
54
+ const inventoryLockedQty: number = inventories.reduce((total, currentValue) => {
55
+ total += currentValue.lockedQty
56
+ return total
57
+ }, 0)
58
+
59
+ return {
60
+ product,
61
+ sku: product.sku,
62
+ name: product.name,
63
+ packingType: defaultProductDetail.packingType,
64
+ packingSize: defaultProductDetail.packingSize,
65
+ uom: defaultProductDetail.uom,
66
+ qty: inventoryQty - inventoryLockedQty
48
67
  }
68
+ })
69
+ )
70
+
71
+ await getConnection().transaction(async tx => {
72
+ let bundleProductInventories: any[] = await getProductBundleInventory(
73
+ warehouseDomain,
74
+ companyDomain,
75
+ inventoryProducts,
76
+ tx
77
+ )
49
78
 
50
- const marketplaceStore = productVariation?.marketplaceProduct?.marketplaceStore
51
- const hasVariation = productVariation?.marketplaceProduct?.hasVariation
52
-
53
- if (marketplaceStore) {
54
- //Lazada Product quantity data update -> {sku, qty}
55
- //Shopee Product quantity data update -> variation = false: {itemId, qty} | variation = true: {itemId, variationId, qty}
56
-
57
- const productVariationQty: number = productVariation.qty || 0
58
- const productVariationReserveQty: number = productVariation.reserveQty || 0
59
-
60
- let adjustQty =
61
- productVariationQty == warehouseProductQty
62
- ? productVariationQty - productVariationReserveQty
63
- : warehouseProductQty - productVariationReserveQty
64
- let productVariationLocationId = productVariation.locationId
65
- if (marketplaceStore.platform === 'SHOPIFY') {
66
- adjustQty = productVariationReserveQty
67
-
68
- let locationIds: any[] = JSON.parse(productVariationLocationId)
69
- productVariationLocationId = locationIds[0].location_id
70
- }
71
-
72
- if (hasVariation) {
73
- await StoreAPI.updateStoreProductVariationStock(marketplaceStore, [
74
- {
75
- itemId: productVariation.marketplaceProduct.itemId,
76
- variationId: productVariation.variationId,
77
- qty: adjustQty,
78
- locationId: productVariationLocationId,
79
- inventoryItemId: productVariation.inventoryItemId
79
+ bundleProductInventories.map(bundleProductInventory => {
80
+ inventoryProducts.push(bundleProductInventory)
81
+ })
82
+ })
83
+
84
+ for (let i = 0; i < marketplaceStores.length; i++) {
85
+ try {
86
+ const marketplaceStore: MarketplaceStore = marketplaceStores[i]
87
+ const marketplaceSetting: MarketplaceSetting = await getRepository(MarketplaceSetting).findOne({
88
+ where: { marketplaceStore, category: 'stock_allocation' }
89
+ })
90
+
91
+ for (let j = 0; j < inventoryProducts.length; j++) {
92
+ await getConnection().transaction(async tx => {
93
+ const inventoryProduct = inventoryProducts[j]
94
+ const marketplaceProductVariations: MarketplaceProductVariation[] = await tx
95
+ .getRepository(MarketplaceProductVariation)
96
+ .find({
97
+ where: { domain: companyDomain, sku: inventoryProduct.sku },
98
+ relations: ['marketplaceProduct', 'marketplaceProduct.marketplaceStore']
99
+ })
100
+
101
+ let marketplaceProductVariation: MarketplaceProductVariation = marketplaceProductVariations.filter(
102
+ productVariation => productVariation.marketplaceProduct.marketplaceStore.id === marketplaceStore.id
103
+ )[0]
104
+
105
+ let percentageValue: number = 100
106
+ if (marketplaceProductVariation) {
107
+ if (marketplaceSetting) {
108
+ percentageValue = parseInt(marketplaceSetting.value)
80
109
  }
81
- ])
82
- } else {
83
- await StoreAPI.updateStoreProductStock(marketplaceStore, [
84
- {
85
- itemId: productVariation.marketplaceProduct.itemId,
86
- variationId: productVariation.variationId,
87
- variationSku: productVariation.variationSku,
88
- qty: adjustQty,
89
- distributors: marketplaceStore.marketplaceDistributors
110
+
111
+ let productVariationLocationId = marketplaceProductVariation?.locationId
112
+ let adjustQty: number = Math.floor(
113
+ (inventoryProduct.qty - marketplaceProductVariation.reserveQty) * (percentageValue / 100)
114
+ )
115
+
116
+ if (marketplaceStore.platform === 'shopify') {
117
+ let locationIds: any[] = JSON.parse(productVariationLocationId)
118
+ adjustQty = adjustQty - marketplaceProductVariation.qty
119
+ if (locationIds[0]?.location_id) productVariationLocationId = locationIds[0].location_id
120
+ }
121
+
122
+ let validMarketplaceDistributors: any[] = []
123
+ if (marketplaceStore.marketplaceDistributors) {
124
+ validMarketplaceDistributors = marketplaceStore.marketplaceDistributors.filter(
125
+ distributor => distributor.status === 'ACTIVE'
126
+ )
90
127
  }
91
- ])
92
- }
128
+
129
+ await StoreAPI.updateStoreProductVariationStock(marketplaceStore, [
130
+ {
131
+ itemId: marketplaceProductVariation.marketplaceProduct.itemId,
132
+ variationId: marketplaceProductVariation.variationId,
133
+ variationSku: marketplaceProductVariation.variationSku,
134
+ qty: adjustQty,
135
+ locationId: productVariationLocationId,
136
+ inventoryItemId: marketplaceProductVariation.inventoryItemId,
137
+ distributors: validMarketplaceDistributors
138
+ }
139
+ ])
140
+
141
+ marketplaceProductVariation.qty = Math.floor(inventoryProduct.qty * (percentageValue / 100))
142
+ await tx.getRepository(MarketplaceProductVariation).save(marketplaceProductVariation)
143
+ }
144
+ })
93
145
  }
94
- }
146
+ } catch (e) {}
147
+ }
95
148
 
96
- return true
97
- } catch (ex) {}
149
+ return true
98
150
  }
99
151
  }
@@ -1,160 +0,0 @@
1
- module.exports = {
2
- domainType: 'company',
3
- domainExtType: 'company',
4
- subdomainOffset: 2,
5
- ormconfig: {
6
- name: 'default',
7
- type: 'postgres',
8
- database: 'postgres',
9
- username: 'postgres',
10
- password: 'hatio',
11
- host: 'localhost',
12
- port: 15432,
13
- synchronize: true,
14
- logging: true
15
- },
16
- // ormconfig: {
17
- // name: 'default',
18
- // type: 'postgres',
19
- // database: 'postgres3',
20
- // username: 'postgres',
21
- // password: 'mysecretpassword',
22
- // host: 'samhouse.asuscomm.com',
23
- // port: 15432,
24
- // synchronize: true,
25
- // logging: true
26
- // },
27
- inspect: '9280',
28
- password: {
29
- lowerCase: true,
30
- upperCase: false,
31
- digit: false,
32
- specialCharacter: false,
33
- allowRepeat: true,
34
- useTightPattern: false,
35
- useLoosePattern: true,
36
- tightCharacterLength: 4,
37
- looseCharacterLength: 4,
38
- history: 2
39
- },
40
- oauth2: {
41
- platforms: [
42
- {
43
- name: 'Operato Hub',
44
- apiURL: 'http://operato-s.com:3000/api'
45
- }
46
- ]
47
- },
48
- useVirtualHostBasedDomain: false,
49
- port: 5000,
50
- uploads: 'uploads',
51
- attachmentsPath: 'attachments',
52
- SECRET: '0xD58F835B69D207A76CC5F84a70a1D0d4C79dfC95',
53
- logger: {
54
- file: {
55
- filename: 'logs/application-%DATE%.log',
56
- datePattern: 'YYYY-MM-DD-HH',
57
- zippedArchive: true,
58
- maxSize: '200m',
59
- maxFiles: '1m',
60
- level: 'info'
61
- }
62
- },
63
- email: {
64
- host: 'smtp.office365.com',
65
- port: 587,
66
- secure: false, // true for 465, false for other ports
67
- auth: {
68
- user: 'no-reply@hatiolab.com', // generated ethereal user
69
- pass: 'h@ti0LAB1008' // generated ethereal password
70
- },
71
- secureConnection: false,
72
- tls: {
73
- ciphers: 'SSLv3'
74
- }
75
- },
76
- sender: 'no-reply@hatiolab.com',
77
- notification: {
78
- fcm: {
79
- serviceAccount: {
80
- project_id: 'operato',
81
- private_key:
82
- '-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDYNOfyNjPMSeG9\nzU1qs0cpVK5cVfadcUaw5g+hkQZMOMlAA7uqW2eX4vkayj7MzbYUayH+sei8044Q\nJIyl6f26dNX1VT3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Lqml67VBHhwLcwpgPULoskd34/4V0Dvzy4c\nv1Esw8H5zVqIDLeLu+VpFjZMzQrjyl6RIWbyTExEc84rVWfpQYAu3qIGOQKBgAFr\nXatEk7TdAtRNSPflTfu/rTAaSeKROjQBkvBiU8x4US1YpOBDBxUUyAtG8wKh5FHC\nfnsaGq+fM3KXJVv2R6J62mXQOfg4xyDLpWlwcBK4aSBBMoiBcsjouqSlZQlqMpdf\nZBgixqHe6U8BsFJg/6ZxC0y+e3AIss4Bo4/lb+1lAoGAFOexvaBh21K6W3inmRW4\nLlkVYJaBJ20OwokXg5aXjBiHxqmk7VLAuFbkpb5LOKH2xPILRQ0OEkn51yVymS3T\n9lLpHOFTQXt5tF2/F7NW7kaQJNlLr/h5jPi3O9XHeFmuaN2z150ZB6zzgjeGKzr8\ni+1fgTsRfDtNw8xkSH9qL1Y=\n-----END PRIVATE KEY-----\n',
83
- client_email: 'firebase-adminsdk-xmm2e@operato.iam.gserviceaccount.com'
84
- },
85
- appConfig: {
86
- apiKey: 'AIzaSyDdTM2BTLHSt2LNS0G5QB8G0i4KBXFiG7U',
87
- projectId: 'operato',
88
- messagingSenderId: 79537064975,
89
- appId: '1:79537064975:web:32f53119e9c8c6ee2a277a'
90
- },
91
- serverKey:
92
- 'AAAAEoTHTA8:APA91bGwt-4HT82Dfwf_VwbQaKT0_qHd0Y3tuW41udjWz5Lz0Ko0mEMD6WbHHSILvQpa6yuoGGKCMsrU7VW2qWRrUm3CYpyG9oSwshNm1tIhljAnOuUfwHCoawbVLwf9qlWpHt4dwCoc'
93
- },
94
- vapidKey: {
95
- subject: 'mailto:heartyoh@hatiolab.com',
96
- publicKey: 'BAkVkITsCXBIsYL1yeaBmx5_dn57we-ZXMjirPPHzC2dan82cdEnAio_53PQ-1_w3ykWCBPrrFAWQ_d9N4cFF0o',
97
- privateKey: '4pmlt3Wk019u7nqU3Q_oGZE6LbUDjjf8DpmAcn9-iss'
98
- }
99
- },
100
- marketplaceIntegrationShopee: {
101
- platform: 'shopee',
102
- isUAT: false,
103
- application: 'Operato MMS',
104
- partnerId: 846025,
105
- partnerKey: 'd34cfd85a603f196a0d74ebe08043280c1a27788bb36bdffd61e7e0bb1c90b64'
106
- },
107
- // marketplaceIntegrationShopee: {
108
- // platform: 'shopee',
109
- // isUAT: true,
110
- // application: 'Staging MMS',
111
- // partnerId: 845525,
112
- // partnerKey: '4a3f4214fd0f0bda970b342a99b6f8705fc7bacad2743cffa7ed67b79840665e'
113
- // },
114
- marketplaceIntegrationLazada: {
115
- platform: 'lazada',
116
- application: 'operato-mms',
117
- appKey: '120961',
118
- appSecret: 'HB3RTNEXHlVSlBr9SmWF8AjbSUT7a825',
119
- callback: 'https://maybank.operato-m.com/lazada-callback'
120
- },
121
- fulfillmentIntegrationOperato: {
122
- host: 'operato-s.com:3000',
123
- protocol: 'http',
124
- platform: 'operato',
125
- application: 'Operato MMS',
126
- appKey: 'a9bf751e622bf146662b240d58971051',
127
- appSecret: '1c385935dc131c4b902b9bbf6a4798af',
128
- callback: 'http://operato-s.com:5000/callback-operato'
129
- },
130
- marketplaceIntegrationShopify: {
131
- platform: 'shopify',
132
- application: 'Operato',
133
- apiKey: '37da47200ab87c8aaf0634869c80bd5f',
134
- apiSecret: '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'
135
- },
136
- marketplaceIntegrationShopifyPrivate: {
137
- platform: 'shopify',
138
- application: 'Beacon Chicken 1',
139
- apiKey: '37da47200ab87c8aaf0634869c80bd5f',
140
- apiSecret: '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'
141
- },
142
- marketplaceIntegrationWoocommerce: {
143
- key_id: '',
144
- user_id: '',
145
- consumer_key: '',
146
- consumer_secret: '',
147
- key_permission: 'read' | 'write' | 'read_write'
148
- },
149
- marketplaceIntegrationMagento: {
150
- oauth_signature_method: 'HMAC-SHA1',
151
- oauth_verifier: '',
152
- oauth_consumer_key: '',
153
- oauth_consumer_secret: ''
154
- },
155
- sellercraftChannelIntegrationConfig: {
156
- apiKey: 'eqDVmIp0kxakM4sNnzqTkySBM73UGMS1nOPDN5Z1',
157
- tokenCraftUrl: 'https://staging-tokencraft.sellercraft.co/v1/get-shop',
158
- getShopsTokenCraftUrl: 'https://staging-tokencraft.sellercraft.co/v1/get-shops'
159
- }
160
- }