@things-factory/operato-mms 4.0.0-alpha.7 → 4.0.0-beta.1

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 (71) hide show
  1. package/Dockerfile +2 -1
  2. package/client/bootstrap.js +32 -16
  3. package/client/components/marketplace-order-max-weight.js +158 -0
  4. package/client/components/mms-home-cards.js +1 -1
  5. package/client/components/stock-allocation-ratio.js +17 -23
  6. package/client/pages/catalogue/products.js +2 -1
  7. package/client/pages/catalogue/warehouse-products.js +2 -1
  8. package/client/pages/catalogue-variation/product-variations.js +72 -15
  9. package/client/pages/inventory/inventory-by-product.js +3 -2
  10. package/client/pages/order/logistics/batch-init-popup.js +566 -0
  11. package/client/pages/order/logistics/lazada-order-init-batch-popup.js +233 -21
  12. package/client/pages/order/logistics/order-shipping-items.js +47 -16
  13. package/client/pages/order/logistics/order-shipping.js +7 -4
  14. package/client/pages/order/logistics/request-ro-popup.js +104 -17
  15. package/client/pages/order/logistics/shopee-order-init-batch-popup.js +431 -129
  16. package/client/pages/order/order-by-store.js +176 -149
  17. package/client/pages/setting/marketplace-setting.js +12 -0
  18. package/dist-server/graphql/index.js +1 -1
  19. package/dist-server/graphql/resolvers/index.js +1 -1
  20. package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js +74 -13
  21. package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js.map +1 -1
  22. package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js +74 -13
  23. package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js.map +1 -1
  24. package/dist-server/graphql/resolvers/interface-with-hub/generate-replenishment-order.js +1 -1
  25. package/dist-server/graphql/resolvers/interface-with-hub/generate-replenishment-order.js.map +1 -1
  26. package/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js +53 -36
  27. package/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js.map +1 -1
  28. package/dist-server/graphql/resolvers/warehouse-product/auto-link-warehouse-marketplace-product-variations.js +5 -5
  29. package/dist-server/graphql/resolvers/warehouse-product/auto-link-warehouse-marketplace-product-variations.js.map +1 -1
  30. package/dist-server/graphql/types/index.js +1 -1
  31. package/dist-server/graphql/types/interface-with-hub/new-stock-replenishment.js +1 -1
  32. package/dist-server/graphql/types/interface-with-hub/new-stock-replenishment.js.map +1 -1
  33. package/dist-server/graphql/types/interface-with-hub/replenishment-order-product.js +1 -1
  34. package/dist-server/graphql/types/interface-with-hub/replenishment-order-product.js.map +1 -1
  35. package/dist-server/graphql/types/interface-with-hub/stock-replenishment-list.js +1 -1
  36. package/dist-server/graphql/types/interface-with-hub/stock-replenishment-list.js.map +1 -1
  37. package/dist-server/graphql/types/interface-with-hub/stock-replenishment.js +1 -1
  38. package/dist-server/graphql/types/interface-with-hub/stock-replenishment.js.map +1 -1
  39. package/dist-server/graphql/types/interface-with-hub/warehouse-inventory.js +1 -1
  40. package/dist-server/graphql/types/interface-with-hub/warehouse-inventory.js.map +1 -1
  41. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product-list.js +1 -1
  42. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product-list.js.map +1 -1
  43. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product.js +1 -1
  44. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product.js.map +1 -1
  45. package/dist-server/graphql/types/warehouse-product/warehouse-product.js +1 -1
  46. package/dist-server/graphql/types/warehouse-product/warehouse-product.js.map +1 -1
  47. package/dist-server/index.js +1 -1
  48. package/dist-server/migrations/1599732967233-SeedCommonCode.js +5 -5
  49. package/dist-server/migrations/1599732967233-SeedCommonCode.js.map +1 -1
  50. package/dist-server/migrations/1608009991075-SeedUser.js +4 -4
  51. package/dist-server/migrations/1608009991075-SeedUser.js.map +1 -1
  52. package/dist-server/routers/etrax-router.js +7 -6
  53. package/dist-server/routers/etrax-router.js.map +1 -1
  54. package/dist-server/routers/shopify-pos-public-router.js +10 -10
  55. package/dist-server/routers/shopify-pos-public-router.js.map +1 -1
  56. package/dist-server/util/interface-helper.js +2 -2
  57. package/dist-server/util/interface-helper.js.map +1 -1
  58. package/dist-server/util/no-generator.js +2 -2
  59. package/dist-server/util/no-generator.js.map +1 -1
  60. package/package.json +65 -63
  61. package/server/graphql/resolvers/interface-with-hub/add-release-order.ts +83 -14
  62. package/server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts +79 -11
  63. package/server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.ts +50 -33
  64. package/server/routers/etrax-router.ts +6 -4
  65. package/translations/en.json +16 -0
  66. package/translations/ko.json +14 -0
  67. package/translations/ms.json +14 -0
  68. package/translations/zh.json +14 -0
  69. package/views/auth-page.html +1 -1
  70. package/views/public/home.html +1 -1
  71. package/config.development.js +0 -54
@@ -1,39 +1,107 @@
1
+ import { createQueryBuilder, getRepository, SelectQueryBuilder } from 'typeorm'
2
+
3
+ import { Bizplace, getCustomerBizplaces } from '@things-factory/biz-base'
1
4
  import { FulfillmentAPI } from '@things-factory/integration-fulfillment'
5
+ import { MarketplaceOrder, MarketplaceOrderShipping } from '@things-factory/marketplace-base'
2
6
  import { Domain } from '@things-factory/shell'
3
- import { MarketplaceOrder } from '@things-factory/marketplace-base'
4
- import { Bizplace, getCustomerBizplaces } from '@things-factory/biz-base'
5
- import { EntityManager, SelectQueryBuilder, createQueryBuilder } from 'typeorm'
6
7
 
7
8
  export const autoAddReleaseOrderResolver = {
8
9
  async autoAddReleaseOrder(_: void, { warehouseId }: { warehouseId: string }, context: any): Promise<void> {
9
- const { tx, domain }: { tx: EntityManager; domain: Domain } = context.state
10
+ const { domain }: { domain: Domain } = context.state
10
11
 
11
12
  const qb: SelectQueryBuilder<MarketplaceOrder> = createQueryBuilder(MarketplaceOrder, 'MO')
12
13
  const marketplaceOrders: MarketplaceOrder[] = await qb
13
14
  .leftJoinAndSelect('MO.marketplaceOrderItems', 'MOI')
15
+ .leftJoinAndSelect('MOI.marketplaceOrderShipping', 'MOS')
14
16
  .leftJoinAndSelect('MOI.marketplaceProductVariation', 'MPV')
17
+ .leftJoinAndSelect('MO.marketplaceStore', 'MPS')
15
18
  .where('MO.domain = :domainId', { domainId: domain.id })
16
19
  .andWhere('MO.releaseOrderId IS NULL')
17
- .andWhere('MO.status IN (:...status)', { status: ['ready_to_ship', 'unfulfilled'] })
20
+ .andWhere('MO.status IN (:...status)', { status: ['ready_to_ship', 'unfulfilled', 'packed'] })
21
+ .andWhere('MPS.status = :marketplaceStatus', { marketplaceStatus: 'ACTIVE' })
18
22
  .getMany()
19
23
 
20
24
  var fulfilmentCenter = await FulfillmentAPI.getFulfillmentCenter(warehouseId)
21
25
  var centerId: string = fulfilmentCenter.centerId
22
26
 
23
- var warehouseDomain: Domain = await tx.getRepository(Domain).findOne({ where: { subdomain: centerId } })
27
+ var warehouseDomain: Domain = await getRepository(Domain).findOne({ where: { subdomain: centerId } })
24
28
  var customerBizplaces: Bizplace[] = await getCustomerBizplaces(warehouseDomain)
25
- var customerBizplaceId: string = customerBizplaces[0].id
29
+ const customerBizplaceId: string = customerBizplaces.find(
30
+ customerBizplace => customerBizplace.company.domain.id === domain.id
31
+ ).id
26
32
 
27
33
  for (var i = 0; i < marketplaceOrders.length; i++) {
28
34
  const marketplaceOrder = marketplaceOrders[i]
29
35
 
30
- var releaseOrder: any = await FulfillmentAPI.createOutboundOrder(fulfilmentCenter, {
31
- customerBizplaceId,
32
- marketplaceOrder
36
+ const marketplaceOrderShippings: MarketplaceOrderShipping[] = await getRepository(MarketplaceOrderShipping).find({
37
+ where: { orderNoRef: marketplaceOrder.orderNo, domain }
33
38
  })
34
39
 
40
+ for (var j = 0; j < marketplaceOrderShippings.length; j++) {
41
+ const marketplaceOrderShipping: MarketplaceOrderShipping = marketplaceOrderShippings[j]
42
+
43
+ const date: Date = new Date()
44
+ const releaseDate = `${date.getFullYear()}-${(date.getMonth() + 1)
45
+ .toString()
46
+ .padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`
47
+
48
+ const newMarketplaceOrder: any = {
49
+ releaseDate,
50
+ type: 'b2c',
51
+ transporter: marketplaceOrder.shippingProvider,
52
+ trackingNo: marketplaceOrderShipping?.ownTrackingNo
53
+ ? marketplaceOrderShipping.ownTrackingNo
54
+ : marketplaceOrderShipping.trackingNo,
55
+ packingOption: true,
56
+ exportOption: false,
57
+ ownTransport: true,
58
+ courierOption: true,
59
+ collectionOrderNo: marketplaceOrder.orderNo,
60
+ refNo: marketplaceOrder.orderNo,
61
+ refNo2: marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length,
62
+ deliverTo: {
63
+ deliveryAddress1: marketplaceOrderShipping.address1,
64
+ deliveryAddress2: marketplaceOrderShipping.address2,
65
+ deliveryAddress3: marketplaceOrderShipping.address3,
66
+ deliveryAddress4: marketplaceOrderShipping.address4,
67
+ deliveryAddress5: marketplaceOrderShipping.address5,
68
+ attentionTo: marketplaceOrderShipping.attentionTo,
69
+ city: marketplaceOrderShipping.city,
70
+ postalCode: marketplaceOrderShipping.postCode,
71
+ country: marketplaceOrderShipping.country,
72
+ state: marketplaceOrderShipping.state,
73
+ phone1: marketplaceOrderShipping.phone1,
74
+ phone2: marketplaceOrderShipping?.phone2 ? marketplaceOrderShipping.phone2 : null
75
+ },
76
+ marketplaceOrderStatus: marketplaceOrder.status,
77
+ airwayBill: marketplaceOrderShipping?.airwayBill ? marketplaceOrderShipping.airwayBill : null,
78
+ invoice: marketplaceOrderShipping?.invoice ? marketplaceOrderShipping.invoice : null,
79
+ orderInventories: marketplaceOrder.marketplaceOrderItems
80
+ .filter(item => {
81
+ if (item.marketplaceOrderShipping.id === marketplaceOrderShipping.id) {
82
+ return item
83
+ }
84
+ })
85
+ .map((orderItem: any) => {
86
+ const { marketplaceProductVariation: productVariation }: any = orderItem
87
+ return {
88
+ product: {
89
+ sku: productVariation.sku
90
+ },
91
+ releaseQty: orderItem.qty
92
+ }
93
+ })
94
+ }
95
+
96
+ var releaseOrder: any = await FulfillmentAPI.createOutboundOrder(fulfilmentCenter, {
97
+ customerBizplaceId,
98
+ releaseOrder: newMarketplaceOrder
99
+ })
100
+ }
101
+
35
102
  marketplaceOrder.releaseOrderId = releaseOrder.id
36
- await tx.getRepository(MarketplaceOrder).save(marketplaceOrder)
103
+ marketplaceOrder.fulfillmentCenter = fulfilmentCenter
104
+ await getRepository(MarketplaceOrder).save(marketplaceOrder)
37
105
  }
38
106
  }
39
107
  }
@@ -38,6 +38,33 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
38
38
  OR Lower("Product"."description") LIKE '${productInfo.value.toLowerCase()}')`
39
39
  }
40
40
 
41
+ await tx.query(`
42
+ CREATE TEMP TABLE "temp_products" AS (
43
+ SELECT * FROM (
44
+ SELECT "Product"."id" AS "product_id", "Product"."sku" AS "product_sku", "Product"."name" AS "product_name",
45
+ "Product"."description" AS "product_description", "Product"."creator_id", "Product"."updater_id",
46
+ "Product"."bizplace_id" AS "product_bizplace_id", 'PRODUCT' AS "type"
47
+ FROM products "Product"
48
+ WHERE 1=1
49
+ AND "Product"."deleted_at" IS NULL
50
+ AND "Product"."bizplace_id" IN (${bizplaceIds})
51
+ ${productQuery}
52
+ ) d1
53
+ UNION ALL
54
+ SELECT * FROM
55
+ (
56
+ SELECT "Product"."id" AS "product_id", "Product"."sku" AS "product_sku", "Product"."name" AS "product_name",
57
+ "Product"."description" AS "product_description", "Product"."creator_id", "Product"."updater_id",
58
+ "Product"."bizplace_id" AS "product_bizplace_id", 'BUNDLE' AS "type"
59
+ FROM product_bundles "Product"
60
+ WHERE 1 = 1
61
+ AND "Product"."status" = 'ACTIVATED'
62
+ AND "Product"."bizplace_id" IN (${bizplaceIds})
63
+ ${productQuery}
64
+ ) d2
65
+ )
66
+ `)
67
+
41
68
  await tx.query(`
42
69
  CREATE TEMP TABLE "temp_json_warehouse_marketplace_products" AS (
43
70
  select "product_id", array_to_json(array_agg(row_to_json(dt))) AS "Json_marketplaceProducts" FROM (
@@ -45,13 +72,10 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
45
72
  from (
46
73
  select "mp"."marketplace_store_id" as "marketplace_store_id", "mpv"."sku", "mpv"."id" as "marketplace_product_variation_id",
47
74
  concat("mpv"."variation_sku", ' (', "mpv"."name", ')') as "name", "mpv"."qty" as "qty",
48
- "Product"."id" AS "product_id"
75
+ "Product"."product_id" AS "product_id"
49
76
  from marketplace_product_variations "mpv"
50
77
  inner join marketplace_products "mp" on "mp"."id" = "mpv"."marketplace_product_id"
51
- inner join products "Product" on "mpv"."sku" = "Product"."sku"
52
- where "Product"."bizplace_id" IN (${bizplaceIds})
53
- and "mpv"."sku" is not null
54
- ${productQuery}
78
+ inner join temp_products "Product" on "mpv"."sku" = "Product"."product_sku"
55
79
  ) as "dt"
56
80
  group by "dt"."marketplace_store_id", "dt"."sku", "dt"."product_id"
57
81
  ) "dt" group by "dt"."product_id"
@@ -67,9 +91,18 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
67
91
  inner join warehouses "w" on "w"."id" = "i2"."warehouse_id"
68
92
  inner join domains "d2" on "d2"."id" = "w"."domain_id" and "d2"."ext_type" ='warehouse'
69
93
  inner join fulfillment_centers "fc" ON "fc"."center_id" = "d2"."subdomain"
70
- inner join products "Product" on "Product"."id" = "i2"."product_id"
71
- where "Product"."bizplace_id" IN (${bizplaceIds})
72
- ${productQuery}
94
+ inner join temp_products "Product" on "Product"."product_id" = "i2"."product_id" AND "Product"."type" = 'PRODUCT'
95
+ group by "fc"."id", "fc"."name", "i2"."product_id"
96
+ UNION
97
+ select "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
98
+ "i2"."product_id", max(CEILING(COALESCE(i2.locked_qty,0))) AS "locked_qty", min(floor(i2.qty/pbs.bundle_qty)) AS "inventory_qty"
99
+ from temp_products "Product"
100
+ inner join product_bundle_settings pbs ON pbs.product_bundle_id = "Product"."product_id"
101
+ inner join inventories i2 ON i2.product_id = pbs.product_id
102
+ inner join warehouses "w" on "w"."id" = "i2"."warehouse_id"
103
+ inner join domains "d2" on "d2"."id" = "w"."domain_id" and "d2"."ext_type" ='warehouse'
104
+ inner join fulfillment_centers "fc" ON "fc"."center_id" = "d2"."subdomain"
105
+ where "Product"."type" = 'BUNDLE'
73
106
  group by "fc"."id", "fc"."name", "i2"."product_id"
74
107
  ) "dt" group by "dt"."product_id"
75
108
  )
@@ -78,24 +111,10 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
78
111
  await tx.getRepository(Product).query(
79
112
  `
80
113
  create temp table temp_warehouse_marketplace_products as (
81
- SELECT "Product"."id" AS "Product_id", "Product"."sku" AS "Product_sku", "Product"."brand_sku" AS "Product_brand_sku",
82
- "Product"."brand" AS "Product_brand", "Product"."sub_brand" AS "Product_sub_brand", "Product"."gtin" AS "Product_gtin",
83
- "Product"."case_gtin" AS "Product_case_gtin", "Product"."name" AS "Product_name", "Product"."type" AS "Product_type",
84
- "Product"."packing_type" AS "Product_packing_type", "Product"."description" AS "Product_description", "Product"."bundle_qty" AS "Product_bundle_qty",
85
- "Product"."expiration_period" AS "Product_expiration_period", "Product"."weight_unit" AS "Product_weight_unit", "Product"."weight" AS "Product_weight",
86
- "Product"."gross_weight" AS "Product_gross_weight", "Product"."case_weight" AS "Product_case_weight", "Product"."case_gross_weight" AS "Product_case_gross_weight",
87
- "Product"."density" AS "Product_density", "Product"."length_unit" AS "Product_length_unit", "Product"."cost_price" AS "Product_cost_price",
88
- "Product"."mrp_price" AS "Product_mrp_price", "Product"."sell_price" AS "Product_sell_price", "Product"."after_tax_cost_price" AS "Product_after_tax_cost_price",
89
- "Product"."after_tax_sales_price" AS "Product_after_tax_sales_price", "Product"."width" AS "Product_width", "Product"."depth" AS "Product_depth",
90
- "Product"."height" AS "Product_height", "Product"."volume" AS "Product_volume", "Product"."case_width" AS "Product_case_width", "Product"."case_depth" AS "Product_case_depth",
91
- "Product"."case_height" AS "Product_case_height", "Product"."case_volume" AS "Product_case_volume", "Product"."volume_size" AS "Product_volume_size",
92
- "Product"."primary_unit" AS "Product_primary_unit", "Product"."primary_value" AS "Product_primary_value", "Product"."aux_unit_1" AS "Product_aux_unit_1",
93
- "Product"."aux_value_1" AS "Product_aux_value_1", "Product"."aux_unit_2" AS "Product_aux_unit_2", "Product"."aux_value_2" AS "Product_aux_value_2", "Product"."aux_unit_3" AS "Product_aux_unit_3",
94
- "Product"."aux_value_3" AS "Product_aux_value_3", "Product"."inventory_account_code" AS "Product_inventory_account_code", "Product"."cogs_account_code" AS "Product_cogs_account_code",
95
- "Product"."movement" AS "Product_movement", "Product"."buffer_qty" AS "Product_buffer_qty", "Product"."min_qty" AS "Product_min_qty", "Product"."max_qty" AS "Product_max_qty", "Product"."discount_id" AS "Product_discount_id",
96
- "Product"."status" AS "Product_status", "Product"."is_tracked_as_inventory" AS "Product_is_tracked_as_inventory", "Product"."created_at" AS "Product_created_at",
97
- "Product"."updated_at" AS "Product_updated_at", "Product"."domain_id" AS "Product_domain_id", "Product"."bizplace_id" AS "Product_bizplace_id",
98
- "Product"."product_set_id" AS "Product_product_set_id", "Product"."creator_id" AS "Product_creator_id", "Product"."updater_id" AS "Product_updater_id",
114
+ SELECT "Product"."product_id" AS "Product_id", "Product"."product_sku" AS "Product_sku",
115
+ "Product"."product_name" AS "Product_name", "Product"."product_description" AS "Product_description",
116
+ "Product"."product_bizplace_id" AS "Product_bizplace_id",
117
+ "Product"."creator_id" AS "Product_creator_id", "Product"."updater_id" AS "Product_updater_id",
99
118
  "Bizplace"."name" AS "Bizplace_name", "Bizplace"."description" AS "Bizplace_description", "Bizplace"."address" AS "Bizplace_address", "Bizplace"."postal_code" AS "Bizplace_postal_code",
100
119
  "Bizplace"."latlng" AS "Bizplace_latlng", "Bizplace"."status" AS "Bizplace_status", "Bizplace"."created_at" AS "Bizplace_created_at", "Bizplace"."updated_at" AS "Bizplace_updated_at",
101
120
  "Bizplace"."domain_id" AS "Bizplace_domain_id", "Bizplace"."company_id" AS "Bizplace_company_id", "Bizplace"."creator_id" AS "Bizplace_creator_id", "Bizplace"."updater_id" AS "Bizplace_updater_id",
@@ -103,14 +122,12 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
103
122
  "Updater"."id" AS "Updater_id", "Updater"."name" AS "Updater_name", "Updater"."description" AS "Updater_description", "Updater"."email" AS "Updater_email"
104
123
  ,COALESCE("whInv"."Json_warehouseInventory", null) AS "Json_warehouseInventory"
105
124
  ,COALESCE("mktPrd"."Json_marketplaceProducts", null) AS "Json_marketplaceProducts"
106
- FROM "products" "Product"
107
- LEFT JOIN "bizplaces" "Bizplace" ON "Bizplace"."id"="Product"."bizplace_id"
125
+ FROM "temp_products" "Product"
126
+ LEFT JOIN "bizplaces" "Bizplace" ON "Bizplace"."id" = "Product"."product_bizplace_id"
108
127
  LEFT JOIN "users" "Creator" ON "Creator"."id"="Product"."creator_id"
109
128
  LEFT JOIN "users" "Updater" ON "Updater"."id"="Product"."updater_id"
110
- LEFT JOIN "temp_json_warehouse_inventory" "whInv" ON "whInv"."product_id" = "Product"."id"
111
- LEFT JOIN "temp_json_warehouse_marketplace_products" "mktPrd" ON "mktPrd"."product_id" = "Product"."id"
112
- WHERE "Product"."bizplace_id" IN (${bizplaceIds})
113
- ${productQuery}
129
+ LEFT JOIN "temp_json_warehouse_inventory" "whInv" ON "whInv"."product_id" = "Product"."product_id"
130
+ LEFT JOIN "temp_json_warehouse_marketplace_products" "mktPrd" ON "mktPrd"."product_id" = "Product"."product_id"
114
131
  )
115
132
  `
116
133
  )
@@ -128,7 +145,7 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
128
145
  )
129
146
 
130
147
  tx.query(`
131
- drop table temp_json_warehouse_marketplace_products, temp_json_warehouse_inventory, temp_warehouse_marketplace_products
148
+ drop table temp_products, temp_json_warehouse_marketplace_products, temp_json_warehouse_inventory, temp_warehouse_marketplace_products
132
149
  `)
133
150
 
134
151
  return {
@@ -1,9 +1,10 @@
1
1
  import Router from 'koa-router'
2
2
  import { getRepository } from 'typeorm'
3
- import { config } from '@things-factory/env'
4
- import { StoreAPI, MarketplaceStore } from '@things-factory/integration-marketplace'
5
- import { LastMileDelivery, Etrax } from '@things-factory/integration-lmd'
3
+
4
+ import { Etrax, LastMileDelivery } from '@things-factory/integration-lmd'
5
+ import { MarketplaceStore, StoreAPI } from '@things-factory/integration-marketplace'
6
6
  import { MarketplaceOrder, MarketplaceOrderItem, MarketplaceOrderShipping } from '@things-factory/marketplace-base'
7
+
7
8
  //import { MarketplaceOrder, MarketplaceOrderShipping, MarketplaceOrderItem } from "@things-factory/marketplace-base"
8
9
 
9
10
  const debug = require('debug')('things-factory:jest.config')
@@ -81,9 +82,10 @@ etraxRouter.post(`/lmd/etrax/status_update`, async (context, next) => {
81
82
  const storeId = order.marketplaceStore.id
82
83
  const marketplaceStore: MarketplaceStore = await StoreAPI.getMarketplaceStore(storeId)
83
84
 
85
+ // to-do update tracking no to every marketplaces
84
86
  if (marketplaceStore.platform === 'woocommerce') {
85
87
  const note = 'http://ets.sntglobal.com/?mod=tracking&action=index&orders=' + trackingNo
86
- const orderNote = await StoreAPI.createOrderNote(marketplaceStore, { orderId: order.orderNo, note })
88
+ const orderNote = await StoreAPI.createOrderNote(marketplaceStore, { orderId: order.name, note })
87
89
  }
88
90
 
89
91
  const resp = {
@@ -21,6 +21,7 @@
21
21
  "button.save-and-next": "save and next",
22
22
  "button.save-and-prev": "save and prev",
23
23
  "button.set": "set",
24
+ "button.split_order": "split order",
24
25
  "button.submit": "submit",
25
26
  "button.sync_order": "sync order",
26
27
  "button.sync_product": "sync product",
@@ -56,12 +57,15 @@
56
57
  "field.not_assigned": "not assigned",
57
58
  "field.on_hold": "on hold",
58
59
  "field.order_no": "order no",
60
+ "field.own_shipping_carrier": "own shipping carrier",
61
+ "field.own_tracking_no": "own tracking no",
59
62
  "field.pack_qty": "pack qty",
60
63
  "field.pack_weight": "pack weight",
61
64
  "field.packing_type": "packing type",
62
65
  "field.pallet_qty": "pallet qty",
63
66
  "field.pickup_date": "pickup date",
64
67
  "field.pickup_time_id": "pickup time id",
68
+ "field.post_code": "post code",
65
69
  "field.price": "price",
66
70
  "field.product_info": "product info",
67
71
  "field.product_name": "product name",
@@ -90,6 +94,7 @@
90
94
  "field.total_amount": "total amount",
91
95
  "field.total_uom_value": "total UOM value",
92
96
  "field.total_weight": "total weight",
97
+ "field.total_volume": "total volume",
93
98
  "field.town": "town",
94
99
  "field.tracking_no": "tracking no",
95
100
  "field.type": "type",
@@ -103,6 +108,7 @@
103
108
  "field.variation_qty": "variation qty",
104
109
  "field.variation_selling_price": "variation selling price",
105
110
  "field.variation_sku": "variation sku",
111
+ "field.variation_uom_value": "variation uom value",
106
112
  "field.zipcode": "zipcode",
107
113
  "label.address": "address",
108
114
  "label.address_id": "address id",
@@ -115,12 +121,15 @@
115
121
  "label.buffer_stock": "buffer stock",
116
122
  "label.bundle_product": "bundle product",
117
123
  "label.canceled": "canceled",
124
+ "label.cancelled": "cancelled",
118
125
  "label.channel_sku": "channel SKU",
119
126
  "label.city": "city",
127
+ "label.completed": "completed",
120
128
  "label.container_no": "container no.",
121
129
  "label.container_size": "container size",
122
130
  "label.container": "container",
123
131
  "label.cost_price": "cost price",
132
+ "label.courier_service": "courier service",
124
133
  "label.create_release_order": "create release order",
125
134
  "label.delivered": "delivered",
126
135
  "label.delivery_type": "delivery type",
@@ -135,6 +144,7 @@
135
144
  "label.items": "items",
136
145
  "label.length": "length",
137
146
  "label.loose_item": "loose item",
147
+ "label.order_max_weight": "order maximum weight",
138
148
  "label.order_status_approved": "approved",
139
149
  "label.order_status_arrived": "arrived",
140
150
  "label.order_status_canceled": "canceled",
@@ -169,8 +179,11 @@
169
179
  "label.order_status_rejected": "rejected",
170
180
  "label.order_status_shipped": "shipped",
171
181
  "label.order_status_to_confirm_receive": "to confirm receive",
182
+ "label.own_shipping_provider": "own shipping provider",
183
+ "label.own_tracking_no": "own tracking no",
172
184
  "label.own_transport": "own transport",
173
185
  "label.oversell_will_happen_with_all_full_allocation": "oversell will happen with all 100% allocation",
186
+ "label.packed": "packed",
174
187
  "label.parent_sku": "parent SKU",
175
188
  "label.pending": "pending",
176
189
  "label.phone": "phone",
@@ -199,6 +212,7 @@
199
212
  "label.sku": "sku",
200
213
  "label.threshold_value": "threshold value",
201
214
  "label.timeslot_info": "timeslot",
215
+ "label.to_confirm_receive": "to confirm receive",
202
216
  "label.to_date": "to date",
203
217
  "label.tracking_no": "tracking no",
204
218
  "label.truck_no": "truck no.",
@@ -253,6 +267,7 @@
253
267
  "text.product_stock_is_empty": "product is empty",
254
268
  "text.product_weight_is_empty": "product weight is empty",
255
269
  "text.reason_x": "reason: {x}",
270
+ "text.select_courier": "select courier",
256
271
  "text.select_a_delivery_type": "select a delivery type",
257
272
  "text.select_a_logistics_type": "select a logistics type",
258
273
  "text.select_a_shipping_provider": "select a shipping provider",
@@ -270,6 +285,7 @@
270
285
  "text.tracking_no_is_empty": "tracking no is empty",
271
286
  "text.update_draft_product": "update draft product",
272
287
  "text.update_stock_allocation_ratio": "update stock allocation ratio",
288
+ "text.update_marketplace_order_max_weight": "update marketplace order maximum weight",
273
289
  "text.you_wont_be_able_to_revert_this": "you won't be able to revert this",
274
290
  "title.are_you_sure": "are you sure",
275
291
  "title.attachment": "attachment",
@@ -21,6 +21,7 @@
21
21
  "button.save-and-next": "[ko] save and next",
22
22
  "button.save-and-prev": "[ko] save and prev",
23
23
  "button.set": "[ko] set",
24
+ "button.split_order": "[ko] split order",
24
25
  "button.submit": "[ko] submit",
25
26
  "button.sync_order": "[ko] sync order",
26
27
  "button.sync_product": "[ko] sync product",
@@ -56,12 +57,15 @@
56
57
  "field.not_assigned": "[ko] not assigned",
57
58
  "field.on_hold": "[ko] on hold",
58
59
  "field.order_no": "[ko] order no",
60
+ "field.own_shipping_carrier": "[ko] own shipping carrier",
61
+ "field.own_tracking_no": "[ko] own tracking no",
59
62
  "field.pack_qty": "[ko] pack qty",
60
63
  "field.pack_weight": "[ko] pack weight",
61
64
  "field.packing_type": "[ko] packing type",
62
65
  "field.pallet_qty": "[ko] pallet qty",
63
66
  "field.pickup_date": "[ko] pickup date",
64
67
  "field.pickup_time_id": "[ko] pickup time id",
68
+ "field.post_code": "[ko] post code",
65
69
  "field.price": "[ko] price",
66
70
  "field.product_info": "[ko] product info",
67
71
  "field.product_name": "[ko] product name",
@@ -103,6 +107,7 @@
103
107
  "field.variation_qty": "[ko] variation qty",
104
108
  "field.variation_selling_price": "[ko] variation selling price",
105
109
  "field.variation_sku": "[ko] variation sku",
110
+ "field.variation_uom_value": "[ko] variation uom value",
106
111
  "field.zipcode": "[ko] zipcode",
107
112
  "label.address": "[ko] address",
108
113
  "label.address_id": "[ko] address id",
@@ -115,8 +120,10 @@
115
120
  "label.buffer_stock": "[ko] buffer stock",
116
121
  "label.bundle_product": "[ko] bundle product",
117
122
  "label.canceled": "[ko] canceled",
123
+ "label.cancelled": "[ko] cancelled",
118
124
  "label.channel_sku": "[ko] channel SKU",
119
125
  "label.city": "[ko] city",
126
+ "label.completed": "[ko] completed",
120
127
  "label.container_no": "[ko] container no.",
121
128
  "label.container_size": "[ko] container size",
122
129
  "label.container": "[ko] container",
@@ -134,6 +141,7 @@
134
141
  "label.isku": "[ko] ISKU",
135
142
  "label.length": "[ko] length",
136
143
  "label.loose_item": "[ko] loose item",
144
+ "label.order_max_weight": "[ko] order maximum weight",
137
145
  "label.order_status_approved": "[ko] approved",
138
146
  "label.order_status_arrived": "[ko] arrived",
139
147
  "label.order_status_canceled": "[ko] canceled",
@@ -168,7 +176,10 @@
168
176
  "label.order_status_rejected": "[ko] rejected",
169
177
  "label.order_status_shipped": "[ko] shipped",
170
178
  "label.order_status_to_confirm_receive": "[ko] to confirm receive",
179
+ "label.own_shipping_provider": "[ko] own shipping provider",
180
+ "label.own_tracking_no": "[ko] own tracking no",
171
181
  "label.own_transport": "[ko] own transport",
182
+ "label.packed": "[ko] packed",
172
183
  "label.parent_sku": "[ko] parent SKU",
173
184
  "label.pending": "[ko] pending",
174
185
  "label.phone": "[ko] phone",
@@ -195,6 +206,7 @@
195
206
  "label.sku": "[ko] sku",
196
207
  "label.threshold_value": "[ko] threshold value",
197
208
  "label.timeslot_info": "[ko] timeslot",
209
+ "label.to_confirm_receive": "[ko] to confirm receive",
198
210
  "label.to_date": "[ko] to date",
199
211
  "label.tracking_no": "[ko] tracking no",
200
212
  "label.truck_no": "[ko] truck no.",
@@ -257,6 +269,8 @@
257
269
  "text.successfully_fetch_latest_data": "[ko] successfully fetch latest data",
258
270
  "text.tracking_no_is_empty": "[ko] tracking no is empty",
259
271
  "text.update_draft_product": "[ko] update draft product",
272
+ "text.update_stock_allocation_ratio": "[ko] update stock allocation ratio",
273
+ "text.update_marketplace_order_max_weight": "[ko] update marketplace order maximum weight",
260
274
  "text.you_wont_be_able_to_revert_this": "[ko] you won't be able to revert this",
261
275
  "title.are_you_sure": "[ko] are you sure",
262
276
  "title.attachment": "[ko] attachment",
@@ -21,6 +21,7 @@
21
21
  "button.save-and-next": "[ms] save and next",
22
22
  "button.save-and-prev": "[ms] save and prev",
23
23
  "button.set": "[ms] set",
24
+ "button.split_order": "[ms] split order",
24
25
  "button.submit": "[ms] submit",
25
26
  "button.sync_order": "[ms] sync order",
26
27
  "button.sync_product": "[ms] sync product",
@@ -56,12 +57,15 @@
56
57
  "field.not_assigned": "[ms] not assigned",
57
58
  "field.on_hold": "[ms] on hold",
58
59
  "field.order_no": "[ms] order no",
60
+ "field.own_shipping_carrier": "[ms] own shipping carrier",
61
+ "field.own_tracking_no": "[ms] own tracking no",
59
62
  "field.pack_qty": "[ms] pack qty",
60
63
  "field.pack_weight": "[ms] pack weight",
61
64
  "field.packing_type": "[ms] packing type",
62
65
  "field.pallet_qty": "[ms] pallet qty",
63
66
  "field.pickup_date": "[ms] pickup date",
64
67
  "field.pickup_time_id": "[ms] pickup time id",
68
+ "field.post_code": "[ms] post code",
65
69
  "field.price": "[ms] price",
66
70
  "field.product_info": "[ms] product info",
67
71
  "field.product_name": "[ms] product name",
@@ -103,6 +107,7 @@
103
107
  "field.variation_qty": "[ms] variation qty",
104
108
  "field.variation_selling_price": "[ms] variation selling price",
105
109
  "field.variation_sku": "[ms] variation sku",
110
+ "field.variation_uom_value": "[ms] variation uom value",
106
111
  "field.zipcode": "[ms] zipcode",
107
112
  "label.address": "[ms] address",
108
113
  "label.address_id": "[ms] address id",
@@ -115,8 +120,10 @@
115
120
  "label.buffer_stock": "[ms] buffer stock",
116
121
  "label.bundle_product": "[ms] bundle product",
117
122
  "label.canceled": "[ms] canceled",
123
+ "label.cancelled": "[ms] cancelled",
118
124
  "label.channel_sku": "[ms] channel SKU",
119
125
  "label.city": "[ms] city",
126
+ "label.completed": "[ms] completed",
120
127
  "label.container_no": "[ms] container no.",
121
128
  "label.container_size": "[ms] container size",
122
129
  "label.container": "[ms] container",
@@ -134,6 +141,7 @@
134
141
  "label.isku": "[ms] ISKU",
135
142
  "label.length": "[ms] length",
136
143
  "label.loose_item": "[ms] loose item",
144
+ "label.order_max_weight": "[ms] order maximum weight",
137
145
  "label.order_status_approved": "[ms] approved",
138
146
  "label.order_status_arrived": "[ms] arrived",
139
147
  "label.order_status_canceled": "[ms] canceled",
@@ -168,7 +176,10 @@
168
176
  "label.order_status_rejected": "[ms] rejected",
169
177
  "label.order_status_shipped": "[ms] shipped",
170
178
  "label.order_status_to_confirm_receive": "[ms] to confirm receive",
179
+ "label.own_shipping_provider": "[ms] own shipping provider",
180
+ "label.own_tracking_no": "[ms] own tracking no",
171
181
  "label.own_transport": "[ms] own transport",
182
+ "label.packed": "[ms] packed",
172
183
  "label.parent_sku": "[ms] parent SKU",
173
184
  "label.pending": "[ms] pending",
174
185
  "label.phone": "[ms] phone",
@@ -195,6 +206,7 @@
195
206
  "label.sku": "[ms] sku",
196
207
  "label.threshold_value": "[ms] threshold value",
197
208
  "label.timeslot_info": "[ms] timeslot",
209
+ "label.to_confirm_receive": "[ms] to confirm receive",
198
210
  "label.to_date": "[ms] to date",
199
211
  "label.tracking_no": "[ms] tracking no",
200
212
  "label.truck_no": "[ms] truck no.",
@@ -257,6 +269,8 @@
257
269
  "text.successfully_fetch_latest_data": "[ms] successfully fetch latest data",
258
270
  "text.tracking_no_is_empty": "[ms] tracking no is empty",
259
271
  "text.update_draft_product": "[ms] update draft product",
272
+ "text.update_stock_allocation_ratio": "[ms] update stock allocation ratio",
273
+ "text.update_marketplace_order_max_weight": "[ms] update marketplace order maximum weight",
260
274
  "text.you_wont_be_able_to_revert_this": "[ms] you won't be able to revert this",
261
275
  "title.are_you_sure": "[ms] are you sure",
262
276
  "title.attachment": "[ms] attachment",
@@ -21,6 +21,7 @@
21
21
  "button.save-and-next": "[zh] save and next",
22
22
  "button.save-and-prev": "[zh] save and prev",
23
23
  "button.set": "[zh] set",
24
+ "button.split_order": "[zh] split order",
24
25
  "button.submit": "[zh] submit",
25
26
  "button.sync_order": "[zh] sync order",
26
27
  "button.sync_product": "[zh] sync product",
@@ -56,12 +57,15 @@
56
57
  "field.not_assigned": "[zh] not assigned",
57
58
  "field.on_hold": "[zh] on hold",
58
59
  "field.order_no": "[zh] order no",
60
+ "field.own_shipping_carrier": "[zh] own shipping carrier",
61
+ "field.own_tracking_no": "[zh] own tracking no",
59
62
  "field.pack_qty": "[zh] pack qty",
60
63
  "field.pack_weight": "[zh] pack weight",
61
64
  "field.packing_type": "[zh] packing type",
62
65
  "field.pallet_qty": "[zh] pallet qty",
63
66
  "field.pickup_date": "[zh] pickup date",
64
67
  "field.pickup_time_id": "[zh] pickup time id",
68
+ "field.post_code": "[zh] post code",
65
69
  "field.price": "[zh] price",
66
70
  "field.product_info": "[zh] product info",
67
71
  "field.product_name": "[zh] product name",
@@ -103,6 +107,7 @@
103
107
  "field.variation_qty": "[zh] variation qty",
104
108
  "field.variation_selling_price": "[zh] variation selling price",
105
109
  "field.variation_sku": "[zh] variation sku",
110
+ "field.variation_uom_value": "[zh] variation uom value",
106
111
  "field.zipcode": "[zh] zipcode",
107
112
  "label.address": "[zh] address",
108
113
  "label.address_id": "[zh] address id",
@@ -115,8 +120,10 @@
115
120
  "label.buffer_stock": "[zh] buffer stock",
116
121
  "label.bundle_product": "[zh] bundle product",
117
122
  "label.canceled": "[zh] canceled",
123
+ "label.cancelled": "[zh] cancelled",
118
124
  "label.channel_sku": "[zh] channel SKU",
119
125
  "label.city": "[zh] city",
126
+ "label.completed": "[zh] completed",
120
127
  "label.container_no": "[zh] container no.",
121
128
  "label.container_size": "[zh] container size",
122
129
  "label.container": "[zh] container",
@@ -134,6 +141,7 @@
134
141
  "label.isku": "[zh] ISKU",
135
142
  "label.length": "[zh] length",
136
143
  "label.loose_item": "[zh] loose item",
144
+ "label.order_max_weight": "[zh] order maximum weight",
137
145
  "label.order_status_approved": "[zh] approved",
138
146
  "label.order_status_arrived": "[zh] arrived",
139
147
  "label.order_status_canceled": "[zh] canceled",
@@ -168,7 +176,10 @@
168
176
  "label.order_status_rejected": "[zh] rejected",
169
177
  "label.order_status_shipped": "[zh] shipped",
170
178
  "label.order_status_to_confirm_receive": "[zh] to confirm receive",
179
+ "label.own_shipping_provider": "[zh] own shipping provider",
180
+ "label.own_tracking_no": "[zh] own tracking no",
171
181
  "label.own_transport": "[zh] own transport",
182
+ "label.packed": "[zh] packed",
172
183
  "label.parent_sku": "[zh] parent SKU",
173
184
  "label.pending": "[zh] pending",
174
185
  "label.phone": "[zh] phone",
@@ -195,6 +206,7 @@
195
206
  "label.sku": "[zh] sku",
196
207
  "label.threshold_value": "[zh] threshold value",
197
208
  "label.timeslot_info": "[zh] timeslot",
209
+ "label.to_confirm_receive": "[zh] to confirm receive",
198
210
  "label.to_date": "[zh] to date",
199
211
  "label.tracking_no": "[zh] tracking no",
200
212
  "label.truck_no": "[zh] truck no.",
@@ -257,6 +269,8 @@
257
269
  "text.successfully_fetch_latest_data": "[zh] successfully fetch latest data",
258
270
  "text.tracking_no_is_empty": "[zh] tracking no is empty",
259
271
  "text.update_draft_product": "[zh] update draft product",
272
+ "text.update_stock_allocation_ratio": "[zh] update stock allocation ratio",
273
+ "text.update_marketplace_order_max_weight": "[zh] update marketplace order maximum weight",
260
274
  "text.you_wont_be_able_to_revert_this": "[zh] you won't be able to revert this",
261
275
  "title.are_you_sure": "[zh] are you sure",
262
276
  "title.attachment": "[zh] attachment",
@@ -15,7 +15,7 @@
15
15
  <link rel="manifest" href="/assets/manifest.json" />
16
16
 
17
17
  <!-- See https://goo.gl/qRE0vM -->
18
- <meta name="theme-color" content="#3f51b5" />
18
+ <meta name="theme-color" content="#22a6a7" />
19
19
 
20
20
  <!-- Add to homescreen for Chrome on Android. Fallback for manifest.json -->
21
21
  <meta name="mobile-web-app-capable" content="yes" />
@@ -15,7 +15,7 @@
15
15
  <link rel="manifest" href="/assets/manifest.json" />
16
16
 
17
17
  <!-- See https://goo.gl/qRE0vM -->
18
- <meta name="theme-color" content="#3f51b5" />
18
+ <meta name="theme-color" content="#22a6a7" />
19
19
 
20
20
  <!-- Add to homescreen for Chrome on Android. Fallback for manifest.json -->
21
21
  <meta name="mobile-web-app-capable" content="yes" />