@things-factory/operato-mms 5.0.0-alpha.26 → 5.0.0-alpha.27

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.
@@ -1,35 +1,9 @@
1
1
  module.exports = {
2
- domainType: 'company',
3
- ormconfig: {
4
- name: 'default',
5
- type: 'sqlite',
6
- database: 'db.sqlite',
7
- synchronize: false,
8
- logging: true,
9
- logger: 'debug'
10
- // name: 'default',
11
- // type: 'postgres',
12
- // database: 'postgres',
13
- // username: 'postgres',
14
- // password: 'abcd1234',
15
- // host: 'localhost',
16
- // port: 15432,
17
- // synchronize: true,
18
- // logging: true
19
- },
20
- oauth2: {
21
- platforms: [
22
- {
23
- name: 'Operato Hub',
24
- apiURL: 'http://operato-m.localhost:3000/api'
25
- }
26
- ]
27
- },
28
2
  useVirtualHostBasedDomain: false,
29
- port: 5000,
3
+ port: 3000,
30
4
  uploads: 'uploads',
31
5
  attachmentsPath: 'attachments',
32
- SECRET: '0xD58F835B69D207A76CC5F84a70a1D0d4C79dfC95',
6
+ SECRET: '0xD58F835B69D207A76CC5F84a70a1D0d4C89dfC95',
33
7
  logger: {
34
8
  file: {
35
9
  filename: 'logs/application-%DATE%.log',
@@ -40,27 +14,18 @@ module.exports = {
40
14
  level: 'info'
41
15
  }
42
16
  },
43
- fulfillmentIntegrationOperato: {
44
- host: 'operatohub.com',
45
- platform: 'operato',
46
- application: 'Operato MMS',
47
- appKey: '480d19cbfb0655357878119559d47333',
48
- appSecret: 'dc5078bc17d50a18ef6fc3188934bbbd',
49
- callback: 'https://www.myoperato.com/callback-operato'
50
- },
51
- marketplaceIntegrationShopee: {
52
- platform: 'shopee',
53
- isUAT: false,
54
- application: 'Operato MMS',
55
- partnerId: 846025,
56
- partnerKey: 'd34cfd85a603f196a0d74ebe08043280c1a27788bb36bdffd61e7e0bb1c90b64'
57
- },
58
- marketplaceIntegrationLazada: {
59
- platform: 'lazada',
60
- application: 'operato-mms',
61
- appKey: '120961',
62
- appSecret: 'HB3RTNEXHlVSlBr9SmWF8AjbSUT7a825',
63
- callback: 'https://myoperato.com/lazada-callback'
17
+ email: {
18
+ host: 'smtp.office365.com',
19
+ port: 587,
20
+ secure: false, // true for 465, false for other ports
21
+ auth: {
22
+ user: 'no-reply@hatiolab.com', // generated ethereal user
23
+ pass: 'h@ti0LAB1008' // generated ethereal password
24
+ },
25
+ secureConnection: false,
26
+ tls: {
27
+ ciphers: 'SSLv3'
28
+ }
64
29
  },
65
30
  notification: {
66
31
  fcm: {
@@ -70,6 +35,7 @@ module.exports = {
70
35
  '-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDYNOfyNjPMSeG9\nzU1qs0cpVK5cVfadcUaw5g+hkQZMOMlAA7uqW2eX4vkayj7MzbYUayH+sei8044Q\nJIyl6f26dNX1VT3UgTmSmCS0v48EBEZHCgusrUGFjduLRN6OS6uvrXW1xKA18k9q\nai1C2EHCXF2AE4PTvf239RC1UIOnVePcMtT7rMTdHRO4s8OKVuSDbzIt8k1cV3Zt\nES0YsJlkELqBisYpV//2/ZSILTt39J9JzrVef03X9kkoo9p+YnNyy6tWsfQPfgJO\nybiRGBNxiyJ/E2pxRo/WqU0go9OzYJlGaSUrUx09heNiRD1b0MAOmyPDJz/6AaTk\nkU/A+kLzAgMBAAECggEADQ5s2gtR53VSujk1V/Xe8e0Di99DwaWUj5w6YhcK7/wX\nPdQRN4Fw6RLeLjL7xeG/rCNSwzm6hKSrQJL5zLnWW7XbMdyQRk6jdmnVAEv3zACi\nFH9+eFK3e+Q214XfgWz/v4p/FZdRLCYni5VBNHcwyWxLLS/V1ynzB3KM1sDiTRmI\npcT7+uTtwrKgJq64sXtFE2pYrFxDdCiyqzkhv/2ed4YIowAjpKBbbcCDKeVxVkoz\nC1P4PAzs9EeUuKSWYrWaUjN17lqtRlYeT1ylR1PIJuWqd4cKfgoEgz+lHwRPDCEX\nAYbk3nofiJIPBhSfCHrXS755wK48mY8vMwFdfCPJeQKBgQDsz4tjYTHdat5A25n5\nekwMxZwFQ5OvMV4eulwZUDMypTAYSz1iB6sDlgwKDm5omZIfuneqCEIvrqxV/kx3\n5wV/DANHO3hYxdp/NV7rM23xmqlaKZhHQbDono1Fm/LP6DEmJiD7N2eFKsXYcPpR\nSAIdCv0X3zkDQ4zRi51yJlCXzQKBgQDpufJBxCoXngiQJ2j14lWVAeOOdQ6zh5Ip\nBcDwF0X67cNSN3Wl40bS4yLFdolhEAyj5m0WPuYYXpjzhHhZ0W3V3ItdBkrmwIvy\nWOWu26qN0ZbwxVS2qVpHuj6iHWJKHuDZZUkFtJg3BeeBSOUHSA8TvjnA0xd83xeb\n8ZJasWoFvwKBgQDFs/gQ/gIdcq0exLfluh5nw0qgcmyHpNWJHdjqITS9IX/nqFkU\n0IYLtmdStf2jQiLmbkydHcvz9wZVvLqml67VBHhwLcwpgPULoskd34/4V0Dvzy4c\nv1Esw8H5zVqIDLeLu+VpFjZMzQrjyl6RIWbyTExEc84rVWfpQYAu3qIGOQKBgAFr\nXatEk7TdAtRNSPflTfu/rTAaSeKROjQBkvBiU8x4US1YpOBDBxUUyAtG8wKh5FHC\nfnsaGq+fM3KXJVv2R6J62mXQOfg4xyDLpWlwcBK4aSBBMoiBcsjouqSlZQlqMpdf\nZBgixqHe6U8BsFJg/6ZxC0y+e3AIss4Bo4/lb+1lAoGAFOexvaBh21K6W3inmRW4\nLlkVYJaBJ20OwokXg5aXjBiHxqmk7VLAuFbkpb5LOKH2xPILRQ0OEkn51yVymS3T\n9lLpHOFTQXt5tF2/F7NW7kaQJNlLr/h5jPi3O9XHeFmuaN2z150ZB6zzgjeGKzr8\ni+1fgTsRfDtNw8xkSH9qL1Y=\n-----END PRIVATE KEY-----\n',
71
36
  client_email: 'firebase-adminsdk-xmm2e@operato.iam.gserviceaccount.com'
72
37
  },
38
+
73
39
  appConfig: {
74
40
  apiKey: 'AIzaSyDdTM2BTLHSt2LNS0G5QB8G0i4KBXFiG7U',
75
41
  projectId: 'operato',
@@ -58,25 +58,8 @@ async function warehouseMarketplaceProduct(params, domain, user, tx) {
58
58
  )
59
59
  `);
60
60
  await tx.query(`
61
- CREATE TEMP TABLE "temp_inventory" ON COMMIT DROP AS (
62
- select "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
63
- "i2"."product_id", SUM(greatest(coalesce("locked_qty",0),0) + greatest(coalesce(oi.release_qty,0),0)) as "inventory_locked_qty", sum(coalesce("qty",0)) as "inventory_qty",
64
- "i2"."domain_id"
65
- from inventories "i2"
66
- inner join warehouses "w" on "w"."id" = "i2"."warehouse_id"
67
- inner join domains "d2" on "d2"."id" = "w"."domain_id" and "d2"."ext_type" ='warehouse'
68
- inner join fulfillment_centers "fc" ON "fc"."center_id" = "d2"."subdomain"
69
- inner join (
70
- select "Product"."product_id" from (
71
- select case when "Product"."type" = 'PRODUCT' then "Product"."product_id" else "pbs"."product_id" end as "product_id"
72
- from temp_products "Product"
73
- left join product_bundles "pb" on "pb"."id" = "Product"."product_id"
74
- left join product_bundle_settings "pbs" on "pbs"."product_bundle_id" = "pb"."id"
75
- ) "Product"
76
- group by "Product"."product_id"
77
- ) "Product" on "Product"."product_id" = "i2"."product_id"
78
- left join (
79
- SELECT
61
+ CREATE TEMP TABLE "temp_order_inventories" ON COMMIT DROP AS (
62
+ SELECT
80
63
  SUM(oi.release_qty) AS release_qty, SUM(oi.release_uom_value) AS release_uom_value, oi.batch_id, oi.batch_id_ref,
81
64
  oi.product_id, p.product_name, oi.packing_type, oi.packing_size, oi.uom
82
65
  FROM
@@ -94,10 +77,35 @@ async function warehouseMarketplaceProduct(params, domain, user, tx) {
94
77
  GROUP BY
95
78
  oi.batch_id, oi.batch_id_ref, oi.product_id, oi.packing_type,
96
79
  oi.packing_size, oi.uom, p.product_name
97
- )"oi" ON "i2".batch_id = "oi".batch_id AND "Product"."product_id" = "oi".product_id AND "i2".packing_type = "oi".packing_type AND "i2".packing_size = oi.packing_size AND "i2".uom = oi.uom
98
- where "fc"."domain_id" = $1
99
- and "i2"."status" = 'STORED'
100
- group by "i2"."domain_id", "fc"."id", "fc"."name", "i2"."product_id"
80
+ );
81
+ `, [domain.id]);
82
+ await tx.query(`
83
+ CREATE TEMP TABLE "temp_inventory" ON COMMIT DROP AS (
84
+ select "i2".*, coalesce("oi".release_qty,0) + coalesce("i2".locked_qty,0) as "inventory_locked_qty" from (
85
+ select "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
86
+ "i2"."product_id", sum(coalesce("locked_qty",0)) as "locked_qty", sum(coalesce("qty",0)) as "inventory_qty",
87
+ "i2"."domain_id", "i2"."packing_type", "i2"."packing_size", "i2"."uom"
88
+ from inventories "i2"
89
+ inner join warehouses "w" on "w"."id" = "i2"."warehouse_id"
90
+ inner join domains "d2" on "d2"."id" = "w"."domain_id" and "d2"."ext_type" ='warehouse'
91
+ inner join fulfillment_centers "fc" ON "fc"."center_id" = "d2"."subdomain"
92
+ inner join (
93
+ select "Product"."product_id" from (
94
+ select case when "Product"."type" = 'PRODUCT' then "Product"."product_id" else "pbs"."product_id" end as "product_id"
95
+ from temp_products "Product"
96
+ left join product_bundles "pb" on "pb"."id" = "Product"."product_id"
97
+ left join product_bundle_settings "pbs" on "pbs"."product_bundle_id" = "pb"."id"
98
+ ) "Product"
99
+ group by "Product"."product_id"
100
+ ) "Product" on "Product"."product_id" = "i2"."product_id"
101
+ where "fc"."domain_id" = $1
102
+ and "i2"."status" = 'STORED'
103
+ group by "i2"."domain_id", "fc"."id", "fc"."name", "i2"."product_id", "i2"."packing_type", "i2"."packing_size", "i2"."uom"
104
+ ) as "i2"
105
+ left join temp_order_inventories "oi" on "i2"."product_id" = "oi"."product_id"
106
+ AND "i2"."packing_type" = "oi"."packing_type"
107
+ AND "i2"."packing_size" = "oi"."packing_size"
108
+ AND "i2"."uom" = "oi"."uom"
101
109
  )
102
110
  `, [domain.id]);
103
111
  await tx.query(`
@@ -127,7 +135,7 @@ async function warehouseMarketplaceProduct(params, domain, user, tx) {
127
135
  max("bundledInv"."inventory_locked_qty") as "inventory_locked_qty", min("bundledInv"."inventory_qty") as "inventory_qty" from (
128
136
  select "Product"."product_id", fc.domain_id, "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
129
137
  "pbs"."bundle_qty",
130
- case when "pbs"."bundle_qty" <= 0 then 0 else ceil(greatest("i2"."inventory_locked_qty",0)/ "pbs"."bundle_qty") end AS "inventory_locked_qty",
138
+ case when "pbs"."bundle_qty" <= 0 then 0 else floor(greatest("i2"."inventory_qty", 0)/ "pbs"."bundle_qty")- floor((greatest("i2"."inventory_qty", 0) - greatest("i2"."inventory_locked_qty",0)) / "pbs"."bundle_qty") end AS "inventory_locked_qty",
131
139
  case when "pbs"."bundle_qty" <= 0 then 0 else floor(greatest("i2"."inventory_qty", 0)/ "pbs"."bundle_qty") end AS "inventory_qty"
132
140
  from temp_products "Product"
133
141
  inner join product_bundle_settings pbs ON pbs.product_bundle_id = "Product"."product_id"
@@ -1 +1 @@
1
- {"version":3,"file":"warehouse-marketplace-products.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.ts"],"names":[],"mappings":";;;AAGA,uDAAsF;AAGzE,QAAA,oCAAoC,GAAG;IAClD,KAAK,CAAC,4BAA4B,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QACxE,IAAI;YACF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAsD,OAAO,CAAC,KAAK,CAAA;YAC7F,OAAO,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;SAC7D;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA;AAEM,KAAK,UAAU,2BAA2B,CAAC,MAAiB,EAAE,MAAc,EAAE,IAAU,EAAE,EAAkB;IACjH,MAAM,cAAc,GAAG,MAAM,CAAC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AAC,CAAC;oBACJ,CAAC,CAAC,IAAI;aACT,CAAA;QACH,CAAC,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK;KACtB,CAAA;AACH,CAAC;AAzND,kEAyNC"}
1
+ {"version":3,"file":"warehouse-marketplace-products.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.ts"],"names":[],"mappings":";;;AAGA,uDAAsF;AAGzE,QAAA,oCAAoC,GAAG;IAClD,KAAK,CAAC,4BAA4B,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QACxE,IAAI;YACF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAsD,OAAO,CAAC,KAAK,CAAA;YAC7F,OAAO,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;SAC7D;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA;AAEM,KAAK,UAAU,2BAA2B,CAAC,MAAiB,EAAE,MAAc,EAAE,IAAU,EAAE,EAAkB;IACjH,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,cAAc,CAAC,CAAA;IAC3E,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,cAAc,CAAC,CAAA;IAEpE,MAAM,eAAe,GAAa,MAAM,IAAA,6BAAkB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACxE,MAAM,UAAU,GAAa,MAAM,IAAA,wBAAa,EAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAE9D,MAAM,CAAC,OAAO,GAAG,CAAC,GAAG,OAAO,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,E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tE,OAAO;oCACL,EAAE,EAAE,SAAS,CAAC,gCAAgC;oCAC9C,IAAI,EAAE,SAAS,CAAC,IAAI;oCACpB,GAAG,EAAE,SAAS,CAAC,GAAG;oCAClB,UAAU,EAAE,SAAS,CAAC,WAAW;iCAClC,CAAA;4BACH,CAAC,CAAC;yBACH,CAAA;oBACH,CAAC,CAAC;oBACJ,CAAC,CAAC,IAAI;gBACR,kBAAkB,EAAE,GAAG,CAAC,uBAAuB;oBAC7C,CAAC,CAAC,GAAG,CAAC,uBAAuB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;wBAC1C,OAAO;4BACL,QAAQ,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,gBAAgB,EAAE;4BAC5E,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,UAAU,EAAE;4BACrC,GAAG,EAAE,SAAS,CAAC,aAAa;4BAC5B,SAAS,EAAE,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;4BAC9E,SAAS,EACP,SAAS,CAAC,aAAa,GAAG,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;yBAClG,CAAA;oBACH,CAAC,CAAC;oBACJ,CAAC,CAAC,IAAI;aACT,CAAA;QACH,CAAC,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK;KACtB,CAAA;AACH,CAAC;AArOD,kEAqOC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-mms",
3
- "version": "5.0.0-alpha.26",
3
+ "version": "5.0.0-alpha.27",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -42,68 +42,68 @@
42
42
  "@material/mwc-linear-progress": "^0.25.3",
43
43
  "@material/mwc-radio": "^0.25.3",
44
44
  "@operato/ghost-print": "1.0.0-alpha.48",
45
- "@operato/scene-chartjs": "^1.0.0-alpha.4",
46
- "@operato/scene-clock": "^1.0.0-alpha.4",
47
- "@operato/scene-clone": "^1.0.0-alpha.4",
48
- "@operato/scene-compass": "^1.0.0-alpha.4",
49
- "@operato/scene-gauge": "^1.0.0-alpha.4",
50
- "@operato/scene-grist": "^1.0.0-alpha.4",
51
- "@operato/scene-half-roundrect": "^1.0.0-alpha.4",
52
- "@operato/scene-indoor-map": "^1.0.0-alpha.4",
53
- "@operato/scene-integration": "^1.0.0-alpha.4",
54
- "@operato/scene-legend": "^1.0.0-alpha.4",
55
- "@operato/scene-news-ticker": "^1.0.0-alpha.4",
56
- "@operato/scene-progressbar": "^1.0.0-alpha.4",
57
- "@operato/scene-random": "^1.0.0-alpha.4",
58
- "@operato/scene-switch": "^1.0.0-alpha.4",
59
- "@operato/scene-tab": "^1.0.0-alpha.4",
60
- "@operato/scene-table": "^1.0.0-alpha.4",
61
- "@operato/scene-timer": "^1.0.0-alpha.4",
62
- "@operato/scene-wheel-sorter": "^1.0.0-alpha.4",
63
- "@things-factory/apptool-ui": "^5.0.0-alpha.26",
64
- "@things-factory/attachment-base": "^5.0.0-alpha.26",
65
- "@things-factory/auth-ui": "^5.0.0-alpha.26",
66
- "@things-factory/biz-base": "^5.0.0-alpha.26",
67
- "@things-factory/board-service": "^5.0.0-alpha.26",
68
- "@things-factory/board-ui": "^5.0.0-alpha.26",
69
- "@things-factory/code-ui": "^5.0.0-alpha.26",
70
- "@things-factory/context-ui": "^5.0.0-alpha.26",
71
- "@things-factory/dashboard": "^5.0.0-alpha.26",
72
- "@things-factory/export-ui": "^5.0.0-alpha.26",
73
- "@things-factory/export-ui-csv": "^5.0.0-alpha.26",
74
- "@things-factory/export-ui-excel": "^5.0.0-alpha.26",
75
- "@things-factory/geography": "^5.0.0-alpha.26",
76
- "@things-factory/grist-ui": "^5.0.0-alpha.26",
77
- "@things-factory/help": "^5.0.0-alpha.26",
78
- "@things-factory/i18n-base": "^5.0.0-alpha.26",
79
- "@things-factory/integration-fulfillment": "^5.0.0-alpha.26",
80
- "@things-factory/integration-lmd": "^5.0.0-alpha.26",
81
- "@things-factory/lite-menu": "^5.0.0-alpha.26",
82
- "@things-factory/marketplace-base": "^5.0.0-alpha.26",
83
- "@things-factory/more-ui": "^5.0.0-alpha.26",
84
- "@things-factory/notification": "^5.0.0-alpha.26",
85
- "@things-factory/oauth2-client": "^5.0.0-alpha.26",
86
- "@things-factory/pdf": "^5.0.0-alpha.26",
87
- "@things-factory/product-base": "^5.0.0-alpha.26",
88
- "@things-factory/resource-ui": "^5.0.0-alpha.26",
89
- "@things-factory/scene-data-transform": "^5.0.0-alpha.26",
90
- "@things-factory/scene-excel": "^5.0.0-alpha.26",
91
- "@things-factory/scene-firebase": "^5.0.0-alpha.26",
92
- "@things-factory/scene-form": "^5.0.0-alpha.26",
93
- "@things-factory/scene-google-map": "^5.0.0-alpha.26",
94
- "@things-factory/scene-graphql": "^5.0.0-alpha.26",
95
- "@things-factory/scene-label": "^5.0.0-alpha.26",
96
- "@things-factory/scene-marker": "^5.0.0-alpha.26",
97
- "@things-factory/scene-mqtt": "^5.0.0-alpha.26",
98
- "@things-factory/scene-restful": "^5.0.0-alpha.26",
99
- "@things-factory/scene-visualizer": "^5.0.0-alpha.26",
100
- "@things-factory/setting-ui": "^5.0.0-alpha.26",
101
- "@things-factory/system-ui": "^5.0.0-alpha.26",
102
- "@things-factory/warehouse-base": "^5.0.0-alpha.26"
45
+ "@operato/scene-chartjs": "^1.0.0-alpha.5",
46
+ "@operato/scene-clock": "^1.0.0-alpha.5",
47
+ "@operato/scene-clone": "^1.0.0-alpha.5",
48
+ "@operato/scene-compass": "^1.0.0-alpha.5",
49
+ "@operato/scene-gauge": "^1.0.0-alpha.5",
50
+ "@operato/scene-grist": "^1.0.0-alpha.5",
51
+ "@operato/scene-half-roundrect": "^1.0.0-alpha.5",
52
+ "@operato/scene-indoor-map": "^1.0.0-alpha.5",
53
+ "@operato/scene-integration": "^1.0.0-alpha.5",
54
+ "@operato/scene-legend": "^1.0.0-alpha.5",
55
+ "@operato/scene-news-ticker": "^1.0.0-alpha.5",
56
+ "@operato/scene-progressbar": "^1.0.0-alpha.5",
57
+ "@operato/scene-random": "^1.0.0-alpha.5",
58
+ "@operato/scene-switch": "^1.0.0-alpha.5",
59
+ "@operato/scene-tab": "^1.0.0-alpha.5",
60
+ "@operato/scene-table": "^1.0.0-alpha.5",
61
+ "@operato/scene-timer": "^1.0.0-alpha.5",
62
+ "@operato/scene-wheel-sorter": "^1.0.0-alpha.5",
63
+ "@things-factory/apptool-ui": "^5.0.0-alpha.27",
64
+ "@things-factory/attachment-base": "^5.0.0-alpha.27",
65
+ "@things-factory/auth-ui": "^5.0.0-alpha.27",
66
+ "@things-factory/biz-base": "^5.0.0-alpha.27",
67
+ "@things-factory/board-service": "^5.0.0-alpha.27",
68
+ "@things-factory/board-ui": "^5.0.0-alpha.27",
69
+ "@things-factory/code-ui": "^5.0.0-alpha.27",
70
+ "@things-factory/context-ui": "^5.0.0-alpha.27",
71
+ "@things-factory/dashboard": "^5.0.0-alpha.27",
72
+ "@things-factory/export-ui": "^5.0.0-alpha.27",
73
+ "@things-factory/export-ui-csv": "^5.0.0-alpha.27",
74
+ "@things-factory/export-ui-excel": "^5.0.0-alpha.27",
75
+ "@things-factory/geography": "^5.0.0-alpha.27",
76
+ "@things-factory/grist-ui": "^5.0.0-alpha.27",
77
+ "@things-factory/help": "^5.0.0-alpha.27",
78
+ "@things-factory/i18n-base": "^5.0.0-alpha.27",
79
+ "@things-factory/integration-fulfillment": "^5.0.0-alpha.27",
80
+ "@things-factory/integration-lmd": "^5.0.0-alpha.27",
81
+ "@things-factory/lite-menu": "^5.0.0-alpha.27",
82
+ "@things-factory/marketplace-base": "^5.0.0-alpha.27",
83
+ "@things-factory/more-ui": "^5.0.0-alpha.27",
84
+ "@things-factory/notification": "^5.0.0-alpha.27",
85
+ "@things-factory/oauth2-client": "^5.0.0-alpha.27",
86
+ "@things-factory/pdf": "^5.0.0-alpha.27",
87
+ "@things-factory/product-base": "^5.0.0-alpha.27",
88
+ "@things-factory/resource-ui": "^5.0.0-alpha.27",
89
+ "@things-factory/scene-data-transform": "^5.0.0-alpha.27",
90
+ "@things-factory/scene-excel": "^5.0.0-alpha.27",
91
+ "@things-factory/scene-firebase": "^5.0.0-alpha.27",
92
+ "@things-factory/scene-form": "^5.0.0-alpha.27",
93
+ "@things-factory/scene-google-map": "^5.0.0-alpha.27",
94
+ "@things-factory/scene-graphql": "^5.0.0-alpha.27",
95
+ "@things-factory/scene-label": "^5.0.0-alpha.27",
96
+ "@things-factory/scene-marker": "^5.0.0-alpha.27",
97
+ "@things-factory/scene-mqtt": "^5.0.0-alpha.27",
98
+ "@things-factory/scene-restful": "^5.0.0-alpha.27",
99
+ "@things-factory/scene-visualizer": "^5.0.0-alpha.27",
100
+ "@things-factory/setting-ui": "^5.0.0-alpha.27",
101
+ "@things-factory/system-ui": "^5.0.0-alpha.27",
102
+ "@things-factory/warehouse-base": "^5.0.0-alpha.27"
103
103
  },
104
104
  "devDependencies": {
105
- "@things-factory/builder": "^5.0.0-alpha.26",
105
+ "@things-factory/builder": "^5.0.0-alpha.27",
106
106
  "@types/node-fetch": "^2.5.7"
107
107
  },
108
- "gitHead": "841b6ef41df481ea7ae4a925328ff5c0a7e9a9cd"
108
+ "gitHead": "57962482d2b5a5aaba07d7477f3f35938d6e66b8"
109
109
  }
@@ -67,25 +67,8 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
67
67
 
68
68
  await tx.query(
69
69
  `
70
- CREATE TEMP TABLE "temp_inventory" ON COMMIT DROP AS (
71
- select "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
72
- "i2"."product_id", SUM(greatest(coalesce("locked_qty",0),0) + greatest(coalesce(oi.release_qty,0),0)) as "inventory_locked_qty", sum(coalesce("qty",0)) as "inventory_qty",
73
- "i2"."domain_id"
74
- from inventories "i2"
75
- inner join warehouses "w" on "w"."id" = "i2"."warehouse_id"
76
- inner join domains "d2" on "d2"."id" = "w"."domain_id" and "d2"."ext_type" ='warehouse'
77
- inner join fulfillment_centers "fc" ON "fc"."center_id" = "d2"."subdomain"
78
- inner join (
79
- select "Product"."product_id" from (
80
- select case when "Product"."type" = 'PRODUCT' then "Product"."product_id" else "pbs"."product_id" end as "product_id"
81
- from temp_products "Product"
82
- left join product_bundles "pb" on "pb"."id" = "Product"."product_id"
83
- left join product_bundle_settings "pbs" on "pbs"."product_bundle_id" = "pb"."id"
84
- ) "Product"
85
- group by "Product"."product_id"
86
- ) "Product" on "Product"."product_id" = "i2"."product_id"
87
- left join (
88
- SELECT
70
+ CREATE TEMP TABLE "temp_order_inventories" ON COMMIT DROP AS (
71
+ SELECT
89
72
  SUM(oi.release_qty) AS release_qty, SUM(oi.release_uom_value) AS release_uom_value, oi.batch_id, oi.batch_id_ref,
90
73
  oi.product_id, p.product_name, oi.packing_type, oi.packing_size, oi.uom
91
74
  FROM
@@ -103,10 +86,39 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
103
86
  GROUP BY
104
87
  oi.batch_id, oi.batch_id_ref, oi.product_id, oi.packing_type,
105
88
  oi.packing_size, oi.uom, p.product_name
106
- )"oi" ON "i2".batch_id = "oi".batch_id AND "Product"."product_id" = "oi".product_id AND "i2".packing_type = "oi".packing_type AND "i2".packing_size = oi.packing_size AND "i2".uom = oi.uom
107
- where "fc"."domain_id" = $1
108
- and "i2"."status" = 'STORED'
109
- group by "i2"."domain_id", "fc"."id", "fc"."name", "i2"."product_id"
89
+ );
90
+ `,
91
+ [domain.id]
92
+ )
93
+
94
+ await tx.query(
95
+ `
96
+ CREATE TEMP TABLE "temp_inventory" ON COMMIT DROP AS (
97
+ select "i2".*, coalesce("oi".release_qty,0) + coalesce("i2".locked_qty,0) as "inventory_locked_qty" from (
98
+ select "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
99
+ "i2"."product_id", sum(coalesce("locked_qty",0)) as "locked_qty", sum(coalesce("qty",0)) as "inventory_qty",
100
+ "i2"."domain_id", "i2"."packing_type", "i2"."packing_size", "i2"."uom"
101
+ from inventories "i2"
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
+ inner join (
106
+ select "Product"."product_id" from (
107
+ select case when "Product"."type" = 'PRODUCT' then "Product"."product_id" else "pbs"."product_id" end as "product_id"
108
+ from temp_products "Product"
109
+ left join product_bundles "pb" on "pb"."id" = "Product"."product_id"
110
+ left join product_bundle_settings "pbs" on "pbs"."product_bundle_id" = "pb"."id"
111
+ ) "Product"
112
+ group by "Product"."product_id"
113
+ ) "Product" on "Product"."product_id" = "i2"."product_id"
114
+ where "fc"."domain_id" = $1
115
+ and "i2"."status" = 'STORED'
116
+ group by "i2"."domain_id", "fc"."id", "fc"."name", "i2"."product_id", "i2"."packing_type", "i2"."packing_size", "i2"."uom"
117
+ ) as "i2"
118
+ left join temp_order_inventories "oi" on "i2"."product_id" = "oi"."product_id"
119
+ AND "i2"."packing_type" = "oi"."packing_type"
120
+ AND "i2"."packing_size" = "oi"."packing_size"
121
+ AND "i2"."uom" = "oi"."uom"
110
122
  )
111
123
  `,
112
124
  [domain.id]
@@ -141,7 +153,7 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
141
153
  max("bundledInv"."inventory_locked_qty") as "inventory_locked_qty", min("bundledInv"."inventory_qty") as "inventory_qty" from (
142
154
  select "Product"."product_id", fc.domain_id, "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
143
155
  "pbs"."bundle_qty",
144
- case when "pbs"."bundle_qty" <= 0 then 0 else ceil(greatest("i2"."inventory_locked_qty",0)/ "pbs"."bundle_qty") end AS "inventory_locked_qty",
156
+ case when "pbs"."bundle_qty" <= 0 then 0 else floor(greatest("i2"."inventory_qty", 0)/ "pbs"."bundle_qty")- floor((greatest("i2"."inventory_qty", 0) - greatest("i2"."inventory_locked_qty",0)) / "pbs"."bundle_qty") end AS "inventory_locked_qty",
145
157
  case when "pbs"."bundle_qty" <= 0 then 0 else floor(greatest("i2"."inventory_qty", 0)/ "pbs"."bundle_qty") end AS "inventory_qty"
146
158
  from temp_products "Product"
147
159
  inner join product_bundle_settings pbs ON pbs.product_bundle_id = "Product"."product_id"