@things-factory/operato-mms 4.0.21 → 4.0.25

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.
Files changed (29) hide show
  1. package/client/bootstrap.js +4 -0
  2. package/client/pages/catalogue-variation/product-variations.js +10 -0
  3. package/client/pages/order/logistics/batch-init-popup.js +26 -1
  4. package/client/pages/order/logistics/lazada-order-init-batch-popup.js +8 -0
  5. package/client/pages/order/logistics/shopee-order-init-batch-popup.js +22 -0
  6. package/client/pages/order/order-by-store.js +8 -0
  7. package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js +11 -8
  8. package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js.map +1 -1
  9. package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js +3 -1
  10. package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js.map +1 -1
  11. package/dist-server/graphql/resolvers/interface-with-hub/auto-update-all-marketplace-product-variation-quantity.js +91 -0
  12. package/dist-server/graphql/resolvers/interface-with-hub/auto-update-all-marketplace-product-variation-quantity.js.map +1 -0
  13. package/dist-server/graphql/resolvers/interface-with-hub/index.js +2 -1
  14. package/dist-server/graphql/resolvers/interface-with-hub/index.js.map +1 -1
  15. package/dist-server/graphql/types/interface-with-hub/index.js +5 -4
  16. package/dist-server/graphql/types/interface-with-hub/index.js.map +1 -1
  17. package/dist-server/routers/etrax-router.js +2 -0
  18. package/dist-server/routers/etrax-router.js.map +1 -1
  19. package/package.json +61 -61
  20. package/server/graphql/resolvers/interface-with-hub/add-release-order.ts +12 -9
  21. package/server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts +4 -1
  22. package/server/graphql/resolvers/interface-with-hub/auto-update-all-marketplace-product-variation-quantity.ts +99 -0
  23. package/server/graphql/resolvers/interface-with-hub/index.ts +3 -1
  24. package/server/graphql/types/interface-with-hub/index.ts +5 -4
  25. package/server/routers/etrax-router.ts +2 -0
  26. package/translations/en.json +2 -0
  27. package/translations/ko.json +3 -1
  28. package/translations/ms.json +3 -1
  29. package/translations/zh.json +3 -1
@@ -5,6 +5,7 @@ import './viewparts/user-circle'
5
5
 
6
6
  import { html } from 'lit-element'
7
7
 
8
+ import { registerDefaultGroups } from '@operato/board/dist/src/component/register-default-groups'
8
9
  import { APPEND_APP_TOOL } from '@things-factory/apptool-base'
9
10
  import { auth } from '@things-factory/auth-base'
10
11
  import { setAuthManagementMenus } from '@things-factory/auth-ui'
@@ -32,6 +33,9 @@ console.log(
32
33
  export default function bootstrap() {
33
34
  store.addReducers({ mms })
34
35
 
36
+ /* set board-modeller group and default templates */
37
+ registerDefaultGroups()
38
+
35
39
  setupMenuPart({
36
40
  slotTemplate: html` <domain-switch slot="head"></domain-switch> `
37
41
  })
@@ -183,6 +183,15 @@ class ProductVariations extends localize(i18next)(PageView) {
183
183
  record: { align: 'center' },
184
184
  width: 150
185
185
  },
186
+ {
187
+ type: 'float',
188
+ name: 'reserveQty',
189
+ header: i18next.t('field.variation_reserve_qty'),
190
+ sortable: true,
191
+ imex: { header: i18next.t('field.variation_reserve_qty'), key: 'reserveQty', width: 25, type: 'string' },
192
+ record: { align: 'center' },
193
+ width: 150
194
+ },
186
195
  {
187
196
  type: 'float',
188
197
  name: 'costPrice',
@@ -305,6 +314,7 @@ class ProductVariations extends localize(i18next)(PageView) {
305
314
  variationSku
306
315
  channelSku
307
316
  qty
317
+ reserveQty
308
318
  bufferQty
309
319
  thresholdQty
310
320
  name
@@ -176,6 +176,13 @@ class BatchInitPopup extends localize(i18next)(LitElement) {
176
176
  columns: [
177
177
  { type: 'gutter', gutterName: 'sequence' },
178
178
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
179
+ {
180
+ type: 'boolean',
181
+ name: 'isSplitted',
182
+ header: i18next.t('field.is_splitted'),
183
+ record: { align: 'center' },
184
+ width: 40
185
+ },
179
186
  {
180
187
  type: 'string',
181
188
  name: 'orderNoRef',
@@ -253,6 +260,20 @@ class BatchInitPopup extends localize(i18next)(LitElement) {
253
260
  label: true,
254
261
  sortable: true,
255
262
  width: 120
263
+ },
264
+ {
265
+ type: 'datetime',
266
+ name: 'orderCreatedAt',
267
+ header: i18next.t('field.created_at'),
268
+ sortable: true,
269
+ width: 180
270
+ },
271
+ {
272
+ type: 'datetime',
273
+ name: 'orderUpdatedAt',
274
+ header: i18next.t('field.updated_at'),
275
+ sortable: true,
276
+ width: 180
256
277
  }
257
278
  ]
258
279
  }
@@ -360,6 +381,7 @@ class BatchInitPopup extends localize(i18next)(LitElement) {
360
381
  paymentMethod
361
382
  status
362
383
  itemCount
384
+ isSplitted
363
385
  shippingProvider
364
386
  totalAmount
365
387
  orderCreatedAt
@@ -384,8 +406,11 @@ class BatchInitPopup extends localize(i18next)(LitElement) {
384
406
  return {
385
407
  ...itm,
386
408
  status: itm.marketplaceOrder.status,
409
+ idSplitted: itm.marketplaceOrder.isSplitted,
387
410
  shippingProvider: itm.transporter,
388
- ownShippingProvider: itm.ownTransporter
411
+ ownShippingProvider: itm.ownTransporter,
412
+ orderCreatedAt: itm.marketplaceOrder.orderCreatedAt,
413
+ orderUpdatedAt: itm.marketplaceOrder.orderUpdatedAt
389
414
  }
390
415
  }) || []
391
416
  }
@@ -150,6 +150,13 @@ class LazadaOrderInitBatchPopup extends localize(i18next)(LitElement) {
150
150
  columns: [
151
151
  { type: 'gutter', gutterName: 'sequence' },
152
152
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
153
+ {
154
+ type: 'boolean',
155
+ name: 'isSplitted',
156
+ header: i18next.t('field.is_splitted'),
157
+ record: { align: 'center' },
158
+ width: 40
159
+ },
153
160
  {
154
161
  type: 'string',
155
162
  name: 'docRefNo',
@@ -342,6 +349,7 @@ class LazadaOrderInitBatchPopup extends localize(i18next)(LitElement) {
342
349
  paymentMethod
343
350
  status
344
351
  itemCount
352
+ isSplitted
345
353
  shippingProvider
346
354
  ownShippingProvider
347
355
  totalAmount
@@ -201,6 +201,13 @@ class ShopeeOrderInitBatchPopup extends localize(i18next)(LitElement) {
201
201
  columns: [
202
202
  { type: 'gutter', gutterName: 'sequence' },
203
203
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
204
+ {
205
+ type: 'boolean',
206
+ name: 'isSplitted',
207
+ header: i18next.t('field.is_splitted'),
208
+ record: { align: 'center' },
209
+ width: 40
210
+ },
204
211
  {
205
212
  type: 'string',
206
213
  name: 'docRefNo',
@@ -268,6 +275,20 @@ class ShopeeOrderInitBatchPopup extends localize(i18next)(LitElement) {
268
275
  header: i18next.t('field.status'),
269
276
  sortable: true,
270
277
  width: 120
278
+ },
279
+ {
280
+ type: 'datetime',
281
+ name: 'orderCreatedAt',
282
+ header: i18next.t('field.created_at'),
283
+ sortable: true,
284
+ width: 180
285
+ },
286
+ {
287
+ type: 'datetime',
288
+ name: 'orderUpdatedAt',
289
+ header: i18next.t('field.updated_at'),
290
+ sortable: true,
291
+ width: 180
271
292
  }
272
293
  ]
273
294
  }
@@ -392,6 +413,7 @@ class ShopeeOrderInitBatchPopup extends localize(i18next)(LitElement) {
392
413
  paymentMethod
393
414
  status
394
415
  itemCount
416
+ isSplitted
395
417
  shippingProvider
396
418
  ownShippingProvider
397
419
  totalAmount
@@ -249,6 +249,13 @@ class OrderByStore extends localize(i18next)(PageView) {
249
249
  record: { align: 'center' },
250
250
  width: 40
251
251
  },
252
+ {
253
+ type: 'boolean',
254
+ name: 'isSplitted',
255
+ header: i18next.t('field.is_splitted'),
256
+ record: { align: 'center' },
257
+ width: 40
258
+ },
252
259
  {
253
260
  type: 'object',
254
261
  name: 'marketplaceStore',
@@ -476,6 +483,7 @@ class OrderByStore extends localize(i18next)(PageView) {
476
483
  type
477
484
  paymentMethod
478
485
  status
486
+ isSplitted
479
487
  itemCount
480
488
  releaseOrderId
481
489
  totalAmount
@@ -1,30 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addReleaseOrderResolver = void 0;
4
+ const typeorm_1 = require("typeorm");
4
5
  const biz_base_1 = require("@things-factory/biz-base");
5
6
  const integration_fulfillment_1 = require("@things-factory/integration-fulfillment");
6
7
  const marketplace_base_1 = require("@things-factory/marketplace-base");
7
8
  const shell_1 = require("@things-factory/shell");
8
9
  exports.addReleaseOrderResolver = {
9
10
  async addReleaseOrder(_, { marketplaceOrderIds, warehouseId }, context) {
10
- const { tx, domain } = context.state;
11
+ const { domain } = context.state;
11
12
  const fulfilmentCenter = await integration_fulfillment_1.FulfillmentAPI.getFulfillmentCenter(warehouseId);
12
13
  const centerId = fulfilmentCenter.centerId;
13
- var warehouseDomain = await tx.getRepository(shell_1.Domain).findOne({ where: { subdomain: centerId } });
14
+ var warehouseDomain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne({ where: { subdomain: centerId } });
14
15
  var customerBizplaces = await (0, biz_base_1.getCustomerBizplaces)(warehouseDomain);
15
16
  const customerBizplaceId = customerBizplaces.find(customerBizplace => customerBizplace.company.domain.id === domain.id).id;
16
17
  for (var i = 0; i < marketplaceOrderIds.length; i++) {
17
18
  const marketplaceOrderId = marketplaceOrderIds[i];
18
- const marketplaceOrder = await tx.getRepository(marketplace_base_1.MarketplaceOrder).findOne(marketplaceOrderId, {
19
+ const marketplaceOrder = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrder).findOne(marketplaceOrderId, {
19
20
  relations: [
20
21
  'marketplaceOrderItems',
21
22
  'marketplaceOrderItems.marketplaceProductVariation',
22
23
  'marketplaceOrderItems.marketplaceOrderShipping'
23
24
  ]
24
25
  });
25
- const marketplaceOrderShippings = await tx
26
- .getRepository(marketplace_base_1.MarketplaceOrderShipping)
27
- .find({ where: { orderNoRef: marketplaceOrder.orderNo, domain } });
26
+ const marketplaceOrderShippings = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrderShipping).find({
27
+ where: { orderNoRef: marketplaceOrder.orderNo, domain }
28
+ });
28
29
  for (var j = 0; j < marketplaceOrderShippings.length; j++) {
29
30
  const marketplaceOrderShipping = marketplaceOrderShippings[j];
30
31
  const date = new Date();
@@ -44,7 +45,9 @@ exports.addReleaseOrderResolver = {
44
45
  courierOption: true,
45
46
  collectionOrderNo: marketplaceOrder.orderNo,
46
47
  refNo: marketplaceOrder.orderNo,
47
- refNo2: marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length,
48
+ refNo2: marketplaceOrderShippings.length > 1
49
+ ? marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length
50
+ : marketplaceOrder.orderNo,
48
51
  deliverTo: {
49
52
  deliveryAddress1: marketplaceOrderShipping.address1,
50
53
  deliveryAddress2: marketplaceOrderShipping.address2,
@@ -85,7 +88,7 @@ exports.addReleaseOrderResolver = {
85
88
  }
86
89
  marketplaceOrder.releaseOrderId = releaseOrder.id;
87
90
  marketplaceOrder.fulfillmentCenter = fulfilmentCenter;
88
- await tx.getRepository(marketplace_base_1.MarketplaceOrder).save(marketplaceOrder);
91
+ await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrder).save(marketplaceOrder);
89
92
  }
90
93
  }
91
94
  };
@@ -1 +1 @@
1
- {"version":3,"file":"add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/add-release-order.ts"],"names":[],"mappings":";;;AAEA,uDAAyE;AACzE,qFAA2F;AAC3F,uEAA6F;AAC7F,iDAA8C;AAEjC,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,eAAe,CACnB,CAAO,EACP,EAAE,mBAAmB,EAAE,WAAW,EAAqD,EACvF,OAAY;QAEZ,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAA0C,OAAO,CAAC,KAAK,CAAA;QAE3E,MAAM,gBAAgB,GAAsB,MAAM,wCAAc,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAA;QAClG,MAAM,QAAQ,GAAW,gBAAgB,CAAC,QAAQ,CAAA;QAElD,IAAI,eAAe,GAAW,MAAM,EAAE,CAAC,aAAa,CAAC,cAA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AgB,CAAC,CAAA;SAChE;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/add-release-order.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,uDAAyE;AACzE,qFAA2F;AAC3F,uEAA6F;AAC7F,iDAA8C;AAEjC,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,eAAe,CACnB,CAAO,EACP,EAAE,mBAAmB,EAAE,WAAW,EAAqD,EACvF,OAAY;QAEZ,MAAM,EAAE,MAAM,EAAE,GAAuB,OAAO,CAAC,KAAK,CAAA;QAEpD,MAAM,gBAAgB,GAAsB,MAAM,wCAAc,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAA;QAClG,MAAM,QAAQ,GAAW,gBAAgB,CAAC,QAAQ,CAAA;QAElD,IAAI,eAAe,GAAW,MAAM,IAAA,uBAAa,EAAC,cAAM,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAA;QACrG,IAAI,iBAAiB,GAAe,MAAM,IAAA,+BAAoB,EAAC,eAAe,CAAC,CAAA;QAE/E,MAAM,kBAAkB,GAAW,iBAAiB,CAAC,IAAI,CACvD,gBAAgB,CAAC,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CACrE,CAAC,EAAE,CAAA;QAEJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnD,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;YAEjD,MAAM,gBAAgB,GAAqB,MAAM,IAAA,uBAAa,EAAC,mCAAgB,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE;gBAC3G,SAAS,EAAE;oBACT,uBAAuB;oBACvB,mDAAmD;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,wBAAwB,CAAC,EAAE,EAAE;4BACpE,OAAO,IAAI,CAAA;yBACZ;oBACH,CAAC,CAAC;yBACD,GAAG,CAAC,CAAC,SAAc,EAAE,EAAE;wBACtB,MAAM,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,GAAQ,SAAS,CAAA;wBACxE,OAAO;4BACL,OAAO,EAAE;gCACP,GAAG,EAAE,gBAAgB,CAAC,GAAG;6BAC1B;4BACD,UAAU,EAAE,SAAS,CAAC,GAAG;yBAC1B,CAAA;oBACH,CAAC,CAAC;iBACL,CAAA;gBAED,IAAI,YAAY,GAAQ,MAAM,wCAAc,CAAC,mBAAmB,CAAC,gBAAgB,EAAE;oBACjF,kBAAkB;oBAClB,YAAY,EAAE,mBAAmB;iBAClC,CAAC,CAAA;aACH;YAED,gBAAgB,CAAC,cAAc,GAAG,YAAY,CAAC,EAAE,CAAA;YACjD,gBAAgB,CAAC,iBAAiB,GAAG,gBAAgB,CAAA;YACrD,MAAM,IAAA,uBAAa,EAAC,mCAAgB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;SAC7D;IACH,CAAC;CACF,CAAA"}
@@ -51,7 +51,9 @@ exports.autoAddReleaseOrderResolver = {
51
51
  courierOption: true,
52
52
  collectionOrderNo: marketplaceOrder.orderNo,
53
53
  refNo: marketplaceOrder.orderNo,
54
- refNo2: marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length,
54
+ refNo2: marketplaceOrderShippings.length > 1
55
+ ? marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length
56
+ : marketplaceOrder.orderNo,
55
57
  deliverTo: {
56
58
  deliveryAddress1: marketplaceOrderShipping.address1,
57
59
  deliveryAddress2: marketplaceOrderShipping.address2,
@@ -1 +1 @@
1
- {"version":3,"file":"auto-add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts"],"names":[],"mappings":";;;AAAA,qCAA+E;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C,CAAC,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;oBACpF,gBAAgB,EAAE,gBAAgB,CAAC,qBAAqB;yBACrD,MAAM,CAAC,IAAI,CAAC,EAAE;wBACb,IAAI,IAAI,CAAC,wBAAwB,CAAC,EAAE,KAAK,wBAAwB,CAAC,EAAE,EAAE;4BACpE,OAAO,IAAI,CAAA;yBACZ;oBACH,CAAC,CAAC;yBACD,GAAG,CAAC,CAAC,SAAc,EAAE,EAAE;wBACtB,MAAM,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,GAAQ,SAAS,CAAA;wBACxE,OAAO;4BACL,OAAO,EAAE;gCACP,GAAG,EAAE,gBAAgB,CAAC,GAAG;6BAC1B;4BACD,UAAU,EAAE,SAAS,CAAC,GAAG;yBAC1B,CAAA;oBACH,CAAC,CAAC;iBACL,CAAA;gBAED,IAAI,YAAY,GAAQ,MAAM,wCAAc,CAAC,mBAAmB,CAAC,gBAAgB,EAAE;oBACjF,kBAAkB;oBAClB,YAAY,EAAE,mBAAmB;iBAClC,CAAC,CAAA;aACH;YAED,gBAAgB,CAAC,cAAc,GAAG,YAAY,CAAC,EAAE,CAAA;YACjD,gBAAgB,CAAC,iBAAiB,GAAG,gBAAgB,CAAA;YACrD,MAAM,IAAA,uBAAa,EAAC,mCAAgB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;SAC7D;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"auto-add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts"],"names":[],"mappings":";;;AAAA,qCAA+E;AAE/E,uDAAyE;AACzE,qFAAwE;AACxE,uEAA6F;AAC7F,iDAA8C;AAEjC,QAAA,2BAA2B,GAAG;IACzC,KAAK,CAAC,mBAAmB,CAAC,CAAO,EAAE,EAAE,WAAW,EAA2B,EAAE,OAAY;QACvF,MAAM,EAAE,MAAM,EAAE,GAAuB,OAAO,CAAC,KA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AAI,CAAC,EAAE;wBACb,IAAI,IAAI,CAAC,wBAAwB,CAAC,EAAE,KAAK,wBAAwB,CAAC,EAAE,EAAE;4BACpE,OAAO,IAAI,CAAA;yBACZ;oBACH,CAAC,CAAC;yBACD,GAAG,CAAC,CAAC,SAAc,EAAE,EAAE;wBACtB,MAAM,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,GAAQ,SAAS,CAAA;wBACxE,OAAO;4BACL,OAAO,EAAE;gCACP,GAAG,EAAE,gBAAgB,CAAC,GAAG;6BAC1B;4BACD,UAAU,EAAE,SAAS,CAAC,GAAG;yBAC1B,CAAA;oBACH,CAAC,CAAC;iBACL,CAAA;gBAED,IAAI,YAAY,GAAQ,MAAM,wCAAc,CAAC,mBAAmB,CAAC,gBAAgB,EAAE;oBACjF,kBAAkB;oBAClB,YAAY,EAAE,mBAAmB;iBAClC,CAAC,CAAA;aACH;YAED,gBAAgB,CAAC,cAAc,GAAG,YAAY,CAAC,EAAE,CAAA;YACjD,gBAAgB,CAAC,iBAAiB,GAAG,gBAAgB,CAAA;YACrD,MAAM,IAAA,uBAAa,EAAC,mCAAgB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;SAC7D;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.autoUpdateAllMarketplaceProductVariationQuantityResolver = void 0;
4
+ const typeorm_1 = require("typeorm");
5
+ const integration_fulfillment_1 = require("@things-factory/integration-fulfillment");
6
+ const integration_marketplace_1 = require("@things-factory/integration-marketplace");
7
+ const marketplace_base_1 = require("@things-factory/marketplace-base");
8
+ const product_base_1 = require("@things-factory/product-base");
9
+ const shell_1 = require("@things-factory/shell");
10
+ const warehouse_base_1 = require("@things-factory/warehouse-base");
11
+ exports.autoUpdateAllMarketplaceProductVariationQuantityResolver = {
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
+ ]
26
+ });
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
70
+ }
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
81
+ }
82
+ ]);
83
+ }
84
+ }
85
+ }
86
+ return true;
87
+ }
88
+ catch (ex) { }
89
+ }
90
+ };
91
+ //# sourceMappingURL=auto-update-all-marketplace-product-variation-quantity.js.map
@@ -0,0 +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,CA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,SAAS,EAAE;wBAC3C,SAAS,GAAG,0BAA0B,CAAA;wBAEtC,IAAI,WAAW,GAAU,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;wBAC/D,0BAA0B,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;qBACxD;oBAED,IAAI,YAAY,EAAE;wBAChB,MAAM,kCAAQ,CAAC,gCAAgC,CAAC,gBAAgB,EAAE;4BAChE;gCACE,MAAM,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,MAAM;gCAClD,WAAW,EAAE,gBAAgB,CAAC,WAAW;gCACzC,GAAG,EAAE,SAAS;gCACd,UAAU,EAAE,0BAA0B;gCACtC,eAAe,EAAE,gBAAgB,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"}
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.warehouseMarketplaceProduct = exports.Mutation = exports.Query = void 0;
4
4
  const add_release_order_1 = require("./add-release-order");
5
5
  const auto_add_release_order_1 = require("./auto-add-release-order");
6
+ const auto_update_all_marketplace_product_variation_quantity_1 = require("./auto-update-all-marketplace-product-variation-quantity");
6
7
  const generate_replenishment_order_1 = require("./generate-replenishment-order");
7
8
  const warehouse_marketplace_products_1 = require("./warehouse-marketplace-products");
8
9
  Object.defineProperty(exports, "warehouseMarketplaceProduct", { enumerable: true, get: function () { return warehouse_marketplace_products_1.warehouseMarketplaceProduct; } });
9
10
  exports.Query = Object.assign({}, warehouse_marketplace_products_1.warehouseMarketplaceProductsResolver);
10
- exports.Mutation = Object.assign(Object.assign(Object.assign({}, add_release_order_1.addReleaseOrderResolver), auto_add_release_order_1.autoAddReleaseOrderResolver), generate_replenishment_order_1.generateReplenishmentOrderResolver);
11
+ exports.Mutation = Object.assign(Object.assign(Object.assign(Object.assign({}, add_release_order_1.addReleaseOrderResolver), auto_add_release_order_1.autoAddReleaseOrderResolver), generate_replenishment_order_1.generateReplenishmentOrderResolver), auto_update_all_marketplace_product_variation_quantity_1.autoUpdateAllMarketplaceProductVariationQuantityResolver);
11
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/index.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAC7D,qEAAsE;AACtE,iFAAmF;AACnF,qFAAoH;AAY3G,4GAZA,4DAA2B,OAYA;AAVvB,QAAA,KAAK,qBACb,qEAAoC,EACxC;AAEY,QAAA,QAAQ,iDAChB,2CAAuB,GACvB,oDAA2B,GAC3B,iEAAkC,EACtC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/index.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAC7D,qEAAsE;AACtE,qIAAmI;AACnI,iFAAmF;AACnF,qFAAoH;AAa3G,4GAbA,4DAA2B,OAaA;AAXvB,QAAA,KAAK,qBACb,qEAAoC,EACxC;AAEY,QAAA,QAAQ,+DAChB,2CAAuB,GACvB,oDAA2B,GAC3B,iEAAkC,GAClC,iHAAwD,EAC5D"}
@@ -1,17 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Types = exports.Query = exports.Mutation = void 0;
4
+ const new_stock_replenishment_1 = require("./new-stock-replenishment");
5
+ const replenishment_order_product_1 = require("./replenishment-order-product");
6
+ const stock_replenishment_1 = require("./stock-replenishment");
7
+ const stock_replenishment_list_1 = require("./stock-replenishment-list");
4
8
  const warehouse_inventory_1 = require("./warehouse-inventory");
5
9
  const warehouse_marketplace_product_1 = require("./warehouse-marketplace-product");
6
10
  const warehouse_marketplace_product_list_1 = require("./warehouse-marketplace-product-list");
7
- const stock_replenishment_1 = require("./stock-replenishment");
8
- const new_stock_replenishment_1 = require("./new-stock-replenishment");
9
- const stock_replenishment_list_1 = require("./stock-replenishment-list");
10
- const replenishment_order_product_1 = require("./replenishment-order-product");
11
11
  exports.Mutation = `
12
12
  addReleaseOrder(marketplaceOrderIds: [String]!, warehouseId: String!): Boolean @transaction
13
13
  autoAddReleaseOrder(warehouseId: String): Boolean @transaction
14
14
  generateReplenishmentOrder(stockReplenishmentId: String!, warehouseId: String!): StockReplenishment @transaction
15
+ autoUpdateAllMarketplaceProductVariationQuantity(companyDomainId: String, warehouseId: String): Boolean @transaction
15
16
  `;
16
17
  exports.Query = `
17
18
  warehouseMarketplaceProducts(filters: [Filter], pagination: Pagination, sortings: [Sorting]): WarehouseMarketplaceProductList @transaction
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/interface-with-hub/index.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,mFAA6E;AAC7E,6FAAsF;AACtF,+DAA0D;AAC1D,uEAAiE;AACjE,yEAAmE;AACnE,+EAAyE;AAE5D,QAAA,QAAQ,GAAiB;;;;CAIrC,CAAA;AAEY,QAAA,KAAK,GAAiB;;CAElC,CAAA;AAEY,QAAA,KAAK,GAAG;IACnB,wCAAkB;IAClB,+CAAqB;IACrB,uDAAyB;IACzB,iDAAsB;IACtB,wCAAkB;IAClB,2DAA2B;IAC3B,oEAA+B;CAChC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/interface-with-hub/index.ts"],"names":[],"mappings":";;;AAAA,uEAAiE;AACjE,+EAAyE;AACzE,+DAA0D;AAC1D,yEAAmE;AACnE,+DAA0D;AAC1D,mFAA6E;AAC7E,6FAAsF;AAEzE,QAAA,QAAQ,GAAiB;;;;;CAKrC,CAAA;AAEY,QAAA,KAAK,GAAiB;;CAElC,CAAA;AAEY,QAAA,KAAK,GAAG;IACnB,wCAAkB;IAClB,+CAAqB;IACrB,uDAAyB;IACzB,iDAAsB;IACtB,wCAAkB;IAClB,2DAA2B;IAC3B,oEAA+B;CAChC,CAAA"}
@@ -47,6 +47,7 @@ exports.etraxRouter.post(`/lmd/etrax/status_update`, async (context, next) => {
47
47
  Code: 302,
48
48
  Message: 'Validate failed'
49
49
  };
50
+ context.type = 'application/json';
50
51
  context.body = JSON.stringify(resp);
51
52
  return;
52
53
  }
@@ -80,6 +81,7 @@ exports.etraxRouter.post(`/lmd/etrax/status_update`, async (context, next) => {
80
81
  Code: 200,
81
82
  Message: 'Updated'
82
83
  };
84
+ context.type = 'application/json';
83
85
  context.body = JSON.stringify(resp);
84
86
  //let orderShipping: MarketplaceOrderShipping = orderItemRepo.find({})
85
87
  //await orderItemRepo.save(orderItem)
@@ -1 +1 @@
1
- {"version":3,"file":"etrax-router.js","sourceRoot":"","sources":["../../server/routers/etrax-router.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAC/B,qCAAuC;AAEvC,qEAAyE;AACzE,qFAAoF;AACpF,uEAAmH;AAEnH,qHAAqH;AAErH,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,CAAA;AAC/C,QAAA,WAAW,GAAG,IAAI,oBAAM,EAAE,CAAA;AAEvC,mBAAW,CAAC,IAAI,CAAC,0BAA0B,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACnE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IACtC,MAAM,IAAI,GAAG,IAAA,u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AAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;SAClG;QAED,MAAM,IAAI,GAAG;YACX,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,SAAS;SACnB,CAAA;QACD,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;QACjC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QACnC,sEAAsE;QACtE,qCAAqC;QACrC,6CAA6C;KAC9C;AACH,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-mms",
3
- "version": "4.0.21",
3
+ "version": "4.0.25",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -41,69 +41,69 @@
41
41
  "@material/mwc-formfield": "^0.25.3",
42
42
  "@material/mwc-linear-progress": "^0.25.3",
43
43
  "@material/mwc-radio": "^0.25.3",
44
- "@operato/ghost-print": "^0.2.50",
45
- "@operato/scene-chartjs": "^0.0.22",
46
- "@operato/scene-clock": "^0.0.22",
47
- "@operato/scene-clone": "^0.0.22",
48
- "@operato/scene-compass": "^0.0.22",
49
- "@operato/scene-gauge": "^0.0.22",
50
- "@operato/scene-grist": "^0.0.22",
51
- "@operato/scene-indoor-map": "^0.0.22",
52
- "@operato/scene-integration": "^0.0.22",
53
- "@operato/scene-legend": "^0.0.22",
54
- "@operato/scene-progressbar": "^0.0.22",
55
- "@operato/scene-random": "^0.0.22",
56
- "@operato/scene-switch": "^0.0.22",
57
- "@operato/scene-tab": "^0.0.22",
58
- "@operato/scene-table": "^0.0.22",
59
- "@operato/scene-timer": "^0.0.22",
60
- "@operato/scene-wheel-sorter": "^0.0.22",
61
- "@things-factory/apptool-ui": "^4.0.21",
62
- "@things-factory/attachment-base": "^4.0.21",
63
- "@things-factory/auth-ui": "^4.0.21",
64
- "@things-factory/biz-base": "^4.0.21",
65
- "@things-factory/board-service": "^4.0.21",
66
- "@things-factory/board-ui": "^4.0.21",
67
- "@things-factory/code-ui": "^4.0.21",
68
- "@things-factory/context-ui": "^4.0.21",
69
- "@things-factory/dashboard": "^4.0.21",
70
- "@things-factory/export-ui": "^4.0.21",
71
- "@things-factory/export-ui-csv": "^4.0.21",
72
- "@things-factory/export-ui-excel": "^4.0.21",
73
- "@things-factory/geography": "^4.0.21",
74
- "@things-factory/grist-ui": "^4.0.21",
75
- "@things-factory/help": "^4.0.21",
76
- "@things-factory/i18n-ui": "^4.0.21",
77
- "@things-factory/integration-fulfillment": "^4.0.21",
78
- "@things-factory/integration-lmd": "^4.0.21",
79
- "@things-factory/lite-menu": "^4.0.21",
80
- "@things-factory/marketplace-base": "^4.0.21",
81
- "@things-factory/more-ui": "^4.0.21",
82
- "@things-factory/notification": "^4.0.21",
83
- "@things-factory/oauth2-client": "^4.0.21",
84
- "@things-factory/pdf": "^4.0.21",
85
- "@things-factory/product-base": "^4.0.21",
86
- "@things-factory/resource-ui": "^4.0.21",
87
- "@things-factory/scene-data-transform": "^4.0.21",
88
- "@things-factory/scene-excel": "^4.0.21",
89
- "@things-factory/scene-firebase": "^4.0.21",
90
- "@things-factory/scene-form": "^4.0.21",
91
- "@things-factory/scene-google-map": "^4.0.21",
92
- "@things-factory/scene-graphql": "^4.0.21",
44
+ "@operato/ghost-print": "^0.2.52",
45
+ "@operato/scene-chartjs": "^0.0.24",
46
+ "@operato/scene-clock": "^0.0.24",
47
+ "@operato/scene-clone": "^0.0.24",
48
+ "@operato/scene-compass": "^0.0.24",
49
+ "@operato/scene-gauge": "^0.0.24",
50
+ "@operato/scene-grist": "^0.0.24",
51
+ "@operato/scene-indoor-map": "^0.0.24",
52
+ "@operato/scene-integration": "^0.0.24",
53
+ "@operato/scene-legend": "^0.0.24",
54
+ "@operato/scene-progressbar": "^0.0.24",
55
+ "@operato/scene-random": "^0.0.24",
56
+ "@operato/scene-switch": "^0.0.24",
57
+ "@operato/scene-tab": "^0.0.24",
58
+ "@operato/scene-table": "^0.0.24",
59
+ "@operato/scene-timer": "^0.0.24",
60
+ "@operato/scene-wheel-sorter": "^0.0.24",
61
+ "@things-factory/apptool-ui": "^4.0.25",
62
+ "@things-factory/attachment-base": "^4.0.25",
63
+ "@things-factory/auth-ui": "^4.0.25",
64
+ "@things-factory/biz-base": "^4.0.25",
65
+ "@things-factory/board-service": "^4.0.25",
66
+ "@things-factory/board-ui": "^4.0.25",
67
+ "@things-factory/code-ui": "^4.0.25",
68
+ "@things-factory/context-ui": "^4.0.25",
69
+ "@things-factory/dashboard": "^4.0.25",
70
+ "@things-factory/export-ui": "^4.0.25",
71
+ "@things-factory/export-ui-csv": "^4.0.25",
72
+ "@things-factory/export-ui-excel": "^4.0.25",
73
+ "@things-factory/geography": "^4.0.25",
74
+ "@things-factory/grist-ui": "^4.0.25",
75
+ "@things-factory/help": "^4.0.25",
76
+ "@things-factory/i18n-ui": "^4.0.25",
77
+ "@things-factory/integration-fulfillment": "^4.0.25",
78
+ "@things-factory/integration-lmd": "^4.0.25",
79
+ "@things-factory/lite-menu": "^4.0.25",
80
+ "@things-factory/marketplace-base": "^4.0.25",
81
+ "@things-factory/more-ui": "^4.0.25",
82
+ "@things-factory/notification": "^4.0.25",
83
+ "@things-factory/oauth2-client": "^4.0.25",
84
+ "@things-factory/pdf": "^4.0.25",
85
+ "@things-factory/product-base": "^4.0.25",
86
+ "@things-factory/resource-ui": "^4.0.25",
87
+ "@things-factory/scene-data-transform": "^4.0.25",
88
+ "@things-factory/scene-excel": "^4.0.25",
89
+ "@things-factory/scene-firebase": "^4.0.25",
90
+ "@things-factory/scene-form": "^4.0.25",
91
+ "@things-factory/scene-google-map": "^4.0.25",
92
+ "@things-factory/scene-graphql": "^4.0.25",
93
93
  "@things-factory/scene-half-roundrect": "^4.0.9",
94
- "@things-factory/scene-label": "^4.0.21",
95
- "@things-factory/scene-marker": "^4.0.21",
96
- "@things-factory/scene-mqtt": "^4.0.21",
97
- "@things-factory/scene-news-ticker": "^4.0.21",
98
- "@things-factory/scene-restful": "^4.0.21",
99
- "@things-factory/scene-visualizer": "^4.0.21",
100
- "@things-factory/setting-ui": "^4.0.21",
101
- "@things-factory/system-ui": "^4.0.21",
102
- "@things-factory/warehouse-base": "^4.0.21"
94
+ "@things-factory/scene-label": "^4.0.25",
95
+ "@things-factory/scene-marker": "^4.0.25",
96
+ "@things-factory/scene-mqtt": "^4.0.25",
97
+ "@things-factory/scene-news-ticker": "^4.0.25",
98
+ "@things-factory/scene-restful": "^4.0.25",
99
+ "@things-factory/scene-visualizer": "^4.0.25",
100
+ "@things-factory/setting-ui": "^4.0.25",
101
+ "@things-factory/system-ui": "^4.0.25",
102
+ "@things-factory/warehouse-base": "^4.0.25"
103
103
  },
104
104
  "devDependencies": {
105
- "@things-factory/builder": "^4.0.21",
105
+ "@things-factory/builder": "^4.0.25",
106
106
  "@types/node-fetch": "^2.5.7"
107
107
  },
108
- "gitHead": "ab5451f749a4e886ae3668bee82777b566538e17"
108
+ "gitHead": "9c44141d651dab7b4a9c0f0b6fecb8d6937d116f"
109
109
  }
@@ -1,4 +1,4 @@
1
- import { EntityManager } from 'typeorm'
1
+ import { getRepository } from 'typeorm'
2
2
 
3
3
  import { Bizplace, getCustomerBizplaces } from '@things-factory/biz-base'
4
4
  import { FulfillmentAPI, FulfillmentCenter } from '@things-factory/integration-fulfillment'
@@ -11,12 +11,12 @@ export const addReleaseOrderResolver = {
11
11
  { marketplaceOrderIds, warehouseId }: { marketplaceOrderIds: any; warehouseId: string },
12
12
  context: any
13
13
  ): Promise<void> {
14
- const { tx, domain }: { tx: EntityManager; domain: Domain } = context.state
14
+ const { domain }: { domain: Domain } = context.state
15
15
 
16
16
  const fulfilmentCenter: FulfillmentCenter = await FulfillmentAPI.getFulfillmentCenter(warehouseId)
17
17
  const centerId: string = fulfilmentCenter.centerId
18
18
 
19
- var warehouseDomain: Domain = await tx.getRepository(Domain).findOne({ where: { subdomain: centerId } })
19
+ var warehouseDomain: Domain = await getRepository(Domain).findOne({ where: { subdomain: centerId } })
20
20
  var customerBizplaces: Bizplace[] = await getCustomerBizplaces(warehouseDomain)
21
21
 
22
22
  const customerBizplaceId: string = customerBizplaces.find(
@@ -26,7 +26,7 @@ export const addReleaseOrderResolver = {
26
26
  for (var i = 0; i < marketplaceOrderIds.length; i++) {
27
27
  const marketplaceOrderId = marketplaceOrderIds[i]
28
28
 
29
- const marketplaceOrder: MarketplaceOrder = await tx.getRepository(MarketplaceOrder).findOne(marketplaceOrderId, {
29
+ const marketplaceOrder: MarketplaceOrder = await getRepository(MarketplaceOrder).findOne(marketplaceOrderId, {
30
30
  relations: [
31
31
  'marketplaceOrderItems',
32
32
  'marketplaceOrderItems.marketplaceProductVariation',
@@ -34,9 +34,9 @@ export const addReleaseOrderResolver = {
34
34
  ]
35
35
  })
36
36
 
37
- const marketplaceOrderShippings: MarketplaceOrderShipping[] = await tx
38
- .getRepository(MarketplaceOrderShipping)
39
- .find({ where: { orderNoRef: marketplaceOrder.orderNo, domain } })
37
+ const marketplaceOrderShippings: MarketplaceOrderShipping[] = await getRepository(MarketplaceOrderShipping).find({
38
+ where: { orderNoRef: marketplaceOrder.orderNo, domain }
39
+ })
40
40
 
41
41
  for (var j = 0; j < marketplaceOrderShippings.length; j++) {
42
42
  const marketplaceOrderShipping: MarketplaceOrderShipping = marketplaceOrderShippings[j]
@@ -59,7 +59,10 @@ export const addReleaseOrderResolver = {
59
59
  courierOption: true,
60
60
  collectionOrderNo: marketplaceOrder.orderNo,
61
61
  refNo: marketplaceOrder.orderNo,
62
- refNo2: marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length,
62
+ refNo2:
63
+ marketplaceOrderShippings.length > 1
64
+ ? marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length
65
+ : marketplaceOrder.orderNo,
63
66
  deliverTo: {
64
67
  deliveryAddress1: marketplaceOrderShipping.address1,
65
68
  deliveryAddress2: marketplaceOrderShipping.address2,
@@ -102,7 +105,7 @@ export const addReleaseOrderResolver = {
102
105
 
103
106
  marketplaceOrder.releaseOrderId = releaseOrder.id
104
107
  marketplaceOrder.fulfillmentCenter = fulfilmentCenter
105
- await tx.getRepository(MarketplaceOrder).save(marketplaceOrder)
108
+ await getRepository(MarketplaceOrder).save(marketplaceOrder)
106
109
  }
107
110
  }
108
111
  }
@@ -60,7 +60,10 @@ export const autoAddReleaseOrderResolver = {
60
60
  courierOption: true,
61
61
  collectionOrderNo: marketplaceOrder.orderNo,
62
62
  refNo: marketplaceOrder.orderNo,
63
- refNo2: marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length,
63
+ refNo2:
64
+ marketplaceOrderShippings.length > 1
65
+ ? marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length
66
+ : marketplaceOrder.orderNo,
64
67
  deliverTo: {
65
68
  deliveryAddress1: marketplaceOrderShipping.address1,
66
69
  deliveryAddress2: marketplaceOrderShipping.address2,
@@ -0,0 +1,99 @@
1
+ import { EntityManager, getRepository, SelectQueryBuilder } from 'typeorm'
2
+
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'
7
+ import { Domain } from '@things-factory/shell'
8
+ import { Inventory } from '@things-factory/warehouse-base'
9
+
10
+ export const autoUpdateAllMarketplaceProductVariationQuantityResolver = {
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
+ })
27
+
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
48
+ }
49
+
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
80
+ }
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
90
+ }
91
+ ])
92
+ }
93
+ }
94
+ }
95
+
96
+ return true
97
+ } catch (ex) {}
98
+ }
99
+ }
@@ -1,5 +1,6 @@
1
1
  import { addReleaseOrderResolver } from './add-release-order'
2
2
  import { autoAddReleaseOrderResolver } from './auto-add-release-order'
3
+ import { autoUpdateAllMarketplaceProductVariationQuantityResolver } from './auto-update-all-marketplace-product-variation-quantity'
3
4
  import { generateReplenishmentOrderResolver } from './generate-replenishment-order'
4
5
  import { warehouseMarketplaceProduct, warehouseMarketplaceProductsResolver } from './warehouse-marketplace-products'
5
6
 
@@ -10,7 +11,8 @@ export const Query = {
10
11
  export const Mutation = {
11
12
  ...addReleaseOrderResolver,
12
13
  ...autoAddReleaseOrderResolver,
13
- ...generateReplenishmentOrderResolver
14
+ ...generateReplenishmentOrderResolver,
15
+ ...autoUpdateAllMarketplaceProductVariationQuantityResolver
14
16
  }
15
17
 
16
18
  export { warehouseMarketplaceProduct }
@@ -1,15 +1,16 @@
1
+ import { NewStockReplenishment } from './new-stock-replenishment'
2
+ import { ReplenishmentOrderProduct } from './replenishment-order-product'
3
+ import { StockReplenishment } from './stock-replenishment'
4
+ import { StockReplenishmentList } from './stock-replenishment-list'
1
5
  import { WarehouseInventory } from './warehouse-inventory'
2
6
  import { WarehouseMarketplaceProduct } from './warehouse-marketplace-product'
3
7
  import { WarehouseMarketplaceProductList } from './warehouse-marketplace-product-list'
4
- import { StockReplenishment } from './stock-replenishment'
5
- import { NewStockReplenishment } from './new-stock-replenishment'
6
- import { StockReplenishmentList } from './stock-replenishment-list'
7
- import { ReplenishmentOrderProduct } from './replenishment-order-product'
8
8
 
9
9
  export const Mutation = /* GraphQL */ `
10
10
  addReleaseOrder(marketplaceOrderIds: [String]!, warehouseId: String!): Boolean @transaction
11
11
  autoAddReleaseOrder(warehouseId: String): Boolean @transaction
12
12
  generateReplenishmentOrder(stockReplenishmentId: String!, warehouseId: String!): StockReplenishment @transaction
13
+ autoUpdateAllMarketplaceProductVariationQuantity(companyDomainId: String, warehouseId: String): Boolean @transaction
13
14
  `
14
15
 
15
16
  export const Query = /* GraphQL */ `
@@ -51,6 +51,7 @@ etraxRouter.post(`/lmd/etrax/status_update`, async (context, next) => {
51
51
  Code: 302,
52
52
  Message: 'Validate failed'
53
53
  }
54
+ context.type = 'application/json'
54
55
  context.body = JSON.stringify(resp)
55
56
  return
56
57
  }
@@ -93,6 +94,7 @@ etraxRouter.post(`/lmd/etrax/status_update`, async (context, next) => {
93
94
  Code: 200,
94
95
  Message: 'Updated'
95
96
  }
97
+ context.type = 'application/json'
96
98
  context.body = JSON.stringify(resp)
97
99
  //let orderShipping: MarketplaceOrderShipping = orderItemRepo.find({})
98
100
  //await orderItemRepo.save(orderItem)
@@ -66,6 +66,7 @@
66
66
  "field.grand_total": "grand total",
67
67
  "field.import_cargo": "import cargo",
68
68
  "field.isku": "ISKU",
69
+ "field.is_splitted": "splitted",
69
70
  "field.item_count": "item count",
70
71
  "field.item_price_credit": "item price credit",
71
72
  "field.item": "item",
@@ -151,6 +152,7 @@
151
152
  "field.variation_marketplace_status": "variation marketplace status",
152
153
  "field.variation_name": "variation name",
153
154
  "field.variation_qty": "variation qty",
155
+ "field.variation_reserve_qty": "variation reserve qty",
154
156
  "field.variation_selling_price": "variation selling price",
155
157
  "field.variation_sku": "variation sku",
156
158
  "field.variation_uom_value": "variation uom value",
@@ -6,7 +6,7 @@
6
6
  "field.service_fee": "[ko] service fee",
7
7
  "field.transaction_fee": "[ko] transaction fee",
8
8
  "field.total_released_amt": "[ko] total release amt",
9
- "field.voucher_code": "[ko] voucher code",
9
+ "field.voucher_code": "[ko] voucher code",
10
10
  "field.comission_fee": "[ko] comission fee",
11
11
  "field.fulfilment_center": "[ko] fulfilment center",
12
12
  "button.add_product": "[ko] add product",
@@ -66,6 +66,7 @@
66
66
  "field.grand_total": "[ko] grand total",
67
67
  "field.import_cargo": "[ko] import cargo",
68
68
  "field.isku": "[ko] ISKU",
69
+ "field.is_splitted": "[ko] splitted",
69
70
  "field.item_count": "[ko] item count",
70
71
  "field.item_price_credit": "[ko] item price credit",
71
72
  "field.item": "[ko] item",
@@ -150,6 +151,7 @@
150
151
  "field.variation_marketplace_status": "[ko] variation marketplace status",
151
152
  "field.variation_name": "[ko] variation name",
152
153
  "field.variation_qty": "[ko] variation qty",
154
+ "field.variation_reserve_qty": "[ko] variation reserve qty",
153
155
  "field.variation_selling_price": "[ko] variation selling price",
154
156
  "field.variation_sku": "[ko] variation sku",
155
157
  "field.variation_uom_value": "[ko] variation uom value",
@@ -6,7 +6,7 @@
6
6
  "field.service_fee": "[ms] service fee",
7
7
  "field.transaction_fee": "[ms] transaction fee",
8
8
  "field.total_released_amt": "[ms] total release amt",
9
- "field.voucher_code": "[ms] voucher code",
9
+ "field.voucher_code": "[ms] voucher code",
10
10
  "field.comission_fee": "[ms] comission fee",
11
11
  "field.fulfilment_center": "[ms] fulfilment center",
12
12
  "button.add_product": "[ms] add product",
@@ -66,6 +66,7 @@
66
66
  "field.grand_total": "[ms] grand total",
67
67
  "field.import_cargo": "[ms] import cargo",
68
68
  "field.isku": "[ms] ISKU",
69
+ "field.is_splitted": "[ms] splitted",
69
70
  "field.item_count": "[ms] item count",
70
71
  "field.item_price_credit": "[ms] item price credit",
71
72
  "field.item": "[ms] item",
@@ -150,6 +151,7 @@
150
151
  "field.variation_marketplace_status": "[ms] variation marketplace status",
151
152
  "field.variation_name": "[ms] variation name",
152
153
  "field.variation_qty": "[ms] variation qty",
154
+ "field.variation_reserve_qty": "[ms] variation reserve qty",
153
155
  "field.variation_selling_price": "[ms] variation selling price",
154
156
  "field.variation_sku": "[ms] variation sku",
155
157
  "field.variation_uom_value": "[ms] variation uom value",
@@ -6,7 +6,7 @@
6
6
  "field.service_fee": "[zh] service fee",
7
7
  "field.transaction_fee": "[zh] transaction fee",
8
8
  "field.total_released_amt": "[zh] total release amt",
9
- "field.voucher_code": "[zh] voucher code",
9
+ "field.voucher_code": "[zh] voucher code",
10
10
  "field.comission_fee": "[zh] comission fee",
11
11
  "field.fulfilment_center": "[zh] fulfilment center",
12
12
  "button.add_product": "[zh] add product",
@@ -66,6 +66,7 @@
66
66
  "field.grand_total": "[zh] grand total",
67
67
  "field.import_cargo": "[zh] import cargo",
68
68
  "field.isku": "[zh] ISKU",
69
+ "field.is_splitted": "[zh] splitted",
69
70
  "field.item_count": "[zh] item count",
70
71
  "field.item_price_credit": "[zh] item price credit",
71
72
  "field.item": "[zh] item",
@@ -150,6 +151,7 @@
150
151
  "field.variation_marketplace_status": "[zh] variation marketplace status",
151
152
  "field.variation_name": "[zh] variation name",
152
153
  "field.variation_qty": "[zh] variation qty",
154
+ "field.variation_reserve_qty": "[zh] variation reserve qty",
153
155
  "field.variation_selling_price": "[zh] variation selling price",
154
156
  "field.variation_sku": "[zh] variation sku",
155
157
  "field.variation_uom_value": "[zh] variation uom value",