@things-factory/operato-mms 4.0.35 → 4.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Dockerfile CHANGED
@@ -1,49 +1,5 @@
1
1
  # Use an official ubuntu image
2
- FROM ubuntu:18.04
3
-
4
- # Use an official node image
5
- FROM node:14.18
6
-
7
- ARG DEBIAN_FRONTEND=noninteractive
8
-
9
- # Install the required packages
10
- RUN apt-get update -o Acquire::CompressionTypes::Order::=gz
11
- RUN apt-get upgrade -y
12
-
13
- RUN echo "deb http://ftp.de.debian.org/debian stable main" > /etc/apt/sources.list
14
-
15
- RUN apt-get update
16
-
17
- RUN apt-get install -y --no-install-recommends apt-utils
18
- RUN apt-get install -y chromium
19
- RUN apt-get install -y libcups2-dev
20
- RUN apt-get install -y libavahi-compat-libdnssd-dev
21
- RUN apt-get install -y gconf-service libasound2 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libxss1 fonts-liberation libnss3 lsb-release xdg-utils libaio1
22
-
23
- RUN apt update
24
- RUN apt-get install -y ghostscript
25
- RUN apt-get install -y curl
26
- RUN apt-get install -y git
27
-
28
- # install chrome
29
- RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
30
- RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
31
- RUN rm google-chrome-stable_current_amd64.deb
32
-
33
-
34
-
35
- # make oracle path
36
- RUN mkdir -p /opt/oracle
37
- WORKDIR /opt/oracle
38
-
39
- # download newest oracle cilent for connect to Oracle Database
40
- RUN wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip && \
41
- unzip instantclient-basiclite-linuxx64.zip && \
42
- rm -f instantclient-basiclite-linuxx64.zip && \
43
- cd /opt/oracle/instantclient* && \
44
- rm -f *jdbc* *occi* *mysql* *mql1* *ipc1* *jar uidrvci genezi adrci && \
45
- echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf &&\
46
- ldconfig
2
+ FROM hatiolab/operato-env:latest
47
3
 
48
4
  # Set the working directory to /app
49
5
  WORKDIR /app
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.warehouseMarketplaceProduct = exports.warehouseMarketplaceProductsResolver = void 0;
4
4
  const biz_base_1 = require("@things-factory/biz-base");
5
- const product_base_1 = require("@things-factory/product-base");
6
5
  exports.warehouseMarketplaceProductsResolver = {
7
6
  async warehouseMarketplaceProducts(_, params, context) {
8
7
  try {
@@ -33,7 +32,7 @@ async function warehouseMarketplaceProduct(params, domain, user, tx) {
33
32
  OR Lower("Product"."description") LIKE '${productInfo.value.toLowerCase()}')`;
34
33
  }
35
34
  await tx.query(`
36
- CREATE TEMP TABLE "temp_products" AS (
35
+ CREATE TEMP TABLE "temp_products" ON COMMIT DROP AS (
37
36
  SELECT * FROM (
38
37
  SELECT "Product"."id" AS "product_id", "Product"."sku" AS "product_sku", "Product"."name" AS "product_name",
39
38
  "Product"."description" AS "product_description", "Product"."creator_id", "Product"."updater_id",
@@ -59,7 +58,50 @@ async function warehouseMarketplaceProduct(params, domain, user, tx) {
59
58
  )
60
59
  `);
61
60
  await tx.query(`
62
- CREATE TEMP TABLE "temp_json_warehouse_marketplace_products" AS (
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
80
+ SUM(oi.release_qty) AS release_qty, SUM(oi.release_uom_value) AS release_uom_value, oi.batch_id, oi.batch_id_ref,
81
+ oi.product_id, p.product_name, oi.packing_type, oi.packing_size, oi.uom
82
+ FROM
83
+ order_inventories oi
84
+ LEFT JOIN
85
+ temp_products p ON oi.product_id = p.product_id
86
+ INNER JOIN
87
+ domains d2 on d2.id = oi.domain_id and d2.ext_type ='warehouse'
88
+ INNER JOIN
89
+ fulfillment_centers fc ON fc.center_id = d2.subdomain
90
+ WHERE
91
+ fc.domain_id = $1
92
+ AND (oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
93
+ AND oi.batch_id NOTNULL AND oi.product_id NOTNULL AND oi.packing_type NOTNULL AND oi.packing_size NOTNULL AND oi.inventory_id IS NULL
94
+ GROUP BY
95
+ oi.batch_id, oi.batch_id_ref, oi.product_id, oi.packing_type,
96
+ 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"
101
+ )
102
+ `, [domain.id]);
103
+ await tx.query(`
104
+ CREATE TEMP TABLE "temp_json_warehouse_marketplace_products" ON COMMIT DROP AS (
63
105
  select "product_id", array_to_json(array_agg(row_to_json(dt))) AS "Json_marketplaceProducts" FROM (
64
106
  select "dt"."marketplace_store_id", "dt"."product_id", "dt"."sku", array_agg(row_to_json(dt)) as product_variation
65
107
  from (
@@ -75,32 +117,33 @@ async function warehouseMarketplaceProduct(params, domain, user, tx) {
75
117
  )
76
118
  `);
77
119
  await tx.query(`
78
- CREATE TEMP TABLE temp_json_warehouse_inventory AS (
120
+ CREATE TEMP TABLE temp_json_warehouse_inventory ON COMMIT DROP AS (
79
121
  select "product_id", array_to_json(array_agg((row_to_json("dt")))) AS "Json_warehouseInventory" from(
80
- select "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
81
- "i2"."product_id", sum(coalesce("locked_qty",0)) as "inventory_locked_qty", sum(coalesce("qty",0)) as "inventory_qty"
82
- from inventories "i2"
83
- inner join warehouses "w" on "w"."id" = "i2"."warehouse_id"
84
- inner join domains "d2" on "d2"."id" = "w"."domain_id" and "d2"."ext_type" ='warehouse'
85
- inner join fulfillment_centers "fc" ON "fc"."center_id" = "d2"."subdomain"
86
- inner join temp_products "Product" on "Product"."product_id" = "i2"."product_id" AND "Product"."type" = 'PRODUCT'
87
- group by "fc"."id", "fc"."name", "i2"."product_id"
88
- UNION
89
- select "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
90
- "i2"."product_id", max(CEILING(COALESCE(i2.locked_qty,0))) AS "locked_qty", min(floor(i2.qty/pbs.bundle_qty)) AS "inventory_qty"
91
- from temp_products "Product"
92
- inner join product_bundle_settings pbs ON pbs.product_bundle_id = "Product"."product_id"
93
- inner join inventories i2 ON i2.product_id = pbs.product_id
94
- inner join warehouses "w" on "w"."id" = "i2"."warehouse_id"
95
- inner join domains "d2" on "d2"."id" = "w"."domain_id" and "d2"."ext_type" ='warehouse'
96
- inner join fulfillment_centers "fc" ON "fc"."center_id" = "d2"."subdomain"
97
- where "Product"."type" = 'BUNDLE'
98
- group by "fc"."id", "fc"."name", "i2"."product_id"
122
+ select "domain_id", "fulfillment_id", "fulfillment_name",
123
+ "product_id", "inventory_locked_qty", "inventory_qty"
124
+ from temp_inventory
125
+ union
126
+ select "bundledInv"."domain_id", "bundledInv"."fulfillment_id", "bundledInv"."fulfillment_name", "bundledInv"."product_id",
127
+ max("bundledInv"."inventory_locked_qty") as "inventory_locked_qty", min("bundledInv"."inventory_qty") as "inventory_qty" from (
128
+ select "Product"."product_id", fc.domain_id, "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
129
+ "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",
131
+ case when "pbs"."bundle_qty" <= 0 then 0 else floor(greatest("i2"."inventory_qty", 0)/ "pbs"."bundle_qty") end AS "inventory_qty"
132
+ from temp_products "Product"
133
+ inner join product_bundle_settings pbs ON pbs.product_bundle_id = "Product"."product_id"
134
+ inner join products p on p.id = pbs.product_id
135
+ cross join fulfillment_centers fc
136
+ inner join domains "d2" on "d2"."ext_type" ='warehouse' and "fc"."center_id" = "d2"."subdomain"
137
+ left join temp_inventory i2 ON i2.product_id = pbs.product_id and "d2"."id" = "i2"."domain_id"
138
+ where "fc"."domain_id" = $1
139
+ order by fc.id, "Product"."product_sku", p.sku
140
+ ) "bundledInv"
141
+ group by "domain_id","fulfillment_id","fulfillment_name","product_id"
99
142
  ) "dt" group by "dt"."product_id"
100
143
  )
101
- `);
102
- await tx.getRepository(product_base_1.Product).query(`
103
- create temp table temp_warehouse_marketplace_products as (
144
+ `, [domain.id]);
145
+ await tx.query(`
146
+ CREATE TEMP TABLE temp_warehouse_marketplace_products ON COMMIT DROP as (
104
147
  SELECT "Product"."product_id" AS "Product_id", "Product"."product_sku" AS "Product_sku",
105
148
  "Product"."product_name" AS "Product_name", "Product"."product_description" AS "Product_description",
106
149
  "Product"."product_bizplace_id" AS "Product_bizplace_id",
@@ -126,9 +169,6 @@ async function warehouseMarketplaceProduct(params, domain, user, tx) {
126
169
  const total = await tx.query(`select count(*) from temp_warehouse_marketplace_products`);
127
170
  const items = await tx.query(`
128
171
  select * from temp_warehouse_marketplace_products ${offsetQuery}
129
- `);
130
- tx.query(`
131
- drop table temp_products, temp_json_warehouse_marketplace_products, temp_json_warehouse_inventory, temp_warehouse_marketplace_products
132
172
  `);
133
173
  return {
134
174
  items: items.map((itm, index) => {
@@ -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;AACtF,+DAAsD;AAGzC,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,IAA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S,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;AA5KD,kEA4KC"}
1
+ {"version":3,"file":"warehouse-marketplace-products.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.ts"],"names":[],"mappings":";;;AAGA,uDAAsF;AAIzE,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,KA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AAG,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;oBACF,CAAC,CAAC,IAAI;aACT,CAAA;QACH,CAAC,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK;KACtB,CAAA;AACH,CAAC;AAnND,kEAmNC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-mms",
3
- "version": "4.0.35",
3
+ "version": "4.0.39",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -33,15 +33,15 @@
33
33
  "migration:revert": "node ../../node_modules/typeorm/cli.js migration:revert",
34
34
  "stop:dev": "kill $(lsof -t -i:3000,3001)",
35
35
  "stop": "things-factory-stop operato-mms",
36
- "docker": "things-factory-dockerize hatiolab/operato-mms:latest hatiolab/operato-mms:$npm_package_version",
36
+ "docker": "things-factory-dockerize hatiolab/operato-mms:latest hatiolab/operato-mms:$npm_package_version linux/amd64",
37
37
  "docker:push": "docker image push hatiolab/operato-mms:latest && docker image push hatiolab/operato-mms:$npm_package_version",
38
- "docker:run": "docker run -p 4000:3000 hatiolab/operato-mms:latest"
38
+ "docker:run": "docker run --platform linux/amd64 -p 4000:3000 hatiolab/operato-mms:latest"
39
39
  },
40
40
  "dependencies": {
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.3.15",
44
+ "@operato/ghost-print": "^0.3.19",
45
45
  "@operato/scene-chartjs": "^0.1.2",
46
46
  "@operato/scene-clock": "^0.1.2",
47
47
  "@operato/scene-clone": "^0.1.2",
@@ -58,52 +58,52 @@
58
58
  "@operato/scene-table": "^0.1.2",
59
59
  "@operato/scene-timer": "^0.1.2",
60
60
  "@operato/scene-wheel-sorter": "^0.1.2",
61
- "@things-factory/apptool-ui": "^4.0.35",
62
- "@things-factory/attachment-base": "^4.0.35",
63
- "@things-factory/auth-ui": "^4.0.35",
64
- "@things-factory/biz-base": "^4.0.35",
65
- "@things-factory/board-service": "^4.0.35",
66
- "@things-factory/board-ui": "^4.0.35",
67
- "@things-factory/code-ui": "^4.0.35",
68
- "@things-factory/context-ui": "^4.0.35",
69
- "@things-factory/dashboard": "^4.0.35",
70
- "@things-factory/export-ui": "^4.0.35",
71
- "@things-factory/export-ui-csv": "^4.0.35",
72
- "@things-factory/export-ui-excel": "^4.0.35",
73
- "@things-factory/geography": "^4.0.35",
74
- "@things-factory/grist-ui": "^4.0.35",
75
- "@things-factory/help": "^4.0.35",
76
- "@things-factory/i18n-ui": "^4.0.35",
77
- "@things-factory/integration-fulfillment": "^4.0.35",
78
- "@things-factory/integration-lmd": "^4.0.35",
79
- "@things-factory/lite-menu": "^4.0.35",
80
- "@things-factory/marketplace-base": "^4.0.35",
81
- "@things-factory/more-ui": "^4.0.35",
82
- "@things-factory/notification": "^4.0.35",
83
- "@things-factory/oauth2-client": "^4.0.35",
84
- "@things-factory/pdf": "^4.0.35",
85
- "@things-factory/product-base": "^4.0.35",
86
- "@things-factory/resource-ui": "^4.0.35",
87
- "@things-factory/scene-data-transform": "^4.0.35",
88
- "@things-factory/scene-excel": "^4.0.35",
89
- "@things-factory/scene-firebase": "^4.0.35",
90
- "@things-factory/scene-form": "^4.0.35",
91
- "@things-factory/scene-google-map": "^4.0.35",
92
- "@things-factory/scene-graphql": "^4.0.35",
61
+ "@things-factory/apptool-ui": "^4.0.39",
62
+ "@things-factory/attachment-base": "^4.0.39",
63
+ "@things-factory/auth-ui": "^4.0.39",
64
+ "@things-factory/biz-base": "^4.0.39",
65
+ "@things-factory/board-service": "^4.0.39",
66
+ "@things-factory/board-ui": "^4.0.39",
67
+ "@things-factory/code-ui": "^4.0.39",
68
+ "@things-factory/context-ui": "^4.0.39",
69
+ "@things-factory/dashboard": "^4.0.39",
70
+ "@things-factory/export-ui": "^4.0.39",
71
+ "@things-factory/export-ui-csv": "^4.0.39",
72
+ "@things-factory/export-ui-excel": "^4.0.39",
73
+ "@things-factory/geography": "^4.0.39",
74
+ "@things-factory/grist-ui": "^4.0.39",
75
+ "@things-factory/help": "^4.0.39",
76
+ "@things-factory/i18n-ui": "^4.0.39",
77
+ "@things-factory/integration-fulfillment": "^4.0.39",
78
+ "@things-factory/integration-lmd": "^4.0.39",
79
+ "@things-factory/lite-menu": "^4.0.39",
80
+ "@things-factory/marketplace-base": "^4.0.39",
81
+ "@things-factory/more-ui": "^4.0.39",
82
+ "@things-factory/notification": "^4.0.39",
83
+ "@things-factory/oauth2-client": "^4.0.39",
84
+ "@things-factory/pdf": "^4.0.39",
85
+ "@things-factory/product-base": "^4.0.39",
86
+ "@things-factory/resource-ui": "^4.0.39",
87
+ "@things-factory/scene-data-transform": "^4.0.39",
88
+ "@things-factory/scene-excel": "^4.0.39",
89
+ "@things-factory/scene-firebase": "^4.0.39",
90
+ "@things-factory/scene-form": "^4.0.39",
91
+ "@things-factory/scene-google-map": "^4.0.39",
92
+ "@things-factory/scene-graphql": "^4.0.39",
93
93
  "@things-factory/scene-half-roundrect": "^4.0.9",
94
- "@things-factory/scene-label": "^4.0.35",
95
- "@things-factory/scene-marker": "^4.0.35",
96
- "@things-factory/scene-mqtt": "^4.0.35",
97
- "@things-factory/scene-news-ticker": "^4.0.35",
98
- "@things-factory/scene-restful": "^4.0.35",
99
- "@things-factory/scene-visualizer": "^4.0.35",
100
- "@things-factory/setting-ui": "^4.0.35",
101
- "@things-factory/system-ui": "^4.0.35",
102
- "@things-factory/warehouse-base": "^4.0.35"
94
+ "@things-factory/scene-label": "^4.0.39",
95
+ "@things-factory/scene-marker": "^4.0.39",
96
+ "@things-factory/scene-mqtt": "^4.0.39",
97
+ "@things-factory/scene-news-ticker": "^4.0.39",
98
+ "@things-factory/scene-restful": "^4.0.39",
99
+ "@things-factory/scene-visualizer": "^4.0.39",
100
+ "@things-factory/setting-ui": "^4.0.39",
101
+ "@things-factory/system-ui": "^4.0.39",
102
+ "@things-factory/warehouse-base": "^4.0.39"
103
103
  },
104
104
  "devDependencies": {
105
- "@things-factory/builder": "^4.0.35",
105
+ "@things-factory/builder": "^4.0.39",
106
106
  "@types/node-fetch": "^2.5.7"
107
107
  },
108
- "gitHead": "842a39426de15e808ee3aaf5972f1024afe5281f"
108
+ "gitHead": "a4f93ea85a26cf70ae0aa2fcd298aa59b55dd039"
109
109
  }
@@ -40,7 +40,7 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
40
40
  }
41
41
 
42
42
  await tx.query(`
43
- CREATE TEMP TABLE "temp_products" AS (
43
+ CREATE TEMP TABLE "temp_products" ON COMMIT DROP AS (
44
44
  SELECT * FROM (
45
45
  SELECT "Product"."id" AS "product_id", "Product"."sku" AS "product_sku", "Product"."name" AS "product_name",
46
46
  "Product"."description" AS "product_description", "Product"."creator_id", "Product"."updater_id",
@@ -67,7 +67,51 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
67
67
  `)
68
68
 
69
69
  await tx.query(`
70
- CREATE TEMP TABLE "temp_json_warehouse_marketplace_products" AS (
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
89
+ SUM(oi.release_qty) AS release_qty, SUM(oi.release_uom_value) AS release_uom_value, oi.batch_id, oi.batch_id_ref,
90
+ oi.product_id, p.product_name, oi.packing_type, oi.packing_size, oi.uom
91
+ FROM
92
+ order_inventories oi
93
+ LEFT JOIN
94
+ temp_products p ON oi.product_id = p.product_id
95
+ INNER JOIN
96
+ domains d2 on d2.id = oi.domain_id and d2.ext_type ='warehouse'
97
+ INNER JOIN
98
+ fulfillment_centers fc ON fc.center_id = d2.subdomain
99
+ WHERE
100
+ fc.domain_id = $1
101
+ AND (oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
102
+ AND oi.batch_id NOTNULL AND oi.product_id NOTNULL AND oi.packing_type NOTNULL AND oi.packing_size NOTNULL AND oi.inventory_id IS NULL
103
+ GROUP BY
104
+ oi.batch_id, oi.batch_id_ref, oi.product_id, oi.packing_type,
105
+ 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"
110
+ )
111
+ `, [domain.id])
112
+
113
+ await tx.query(`
114
+ CREATE TEMP TABLE "temp_json_warehouse_marketplace_products" ON COMMIT DROP AS (
71
115
  select "product_id", array_to_json(array_agg(row_to_json(dt))) AS "Json_marketplaceProducts" FROM (
72
116
  select "dt"."marketplace_store_id", "dt"."product_id", "dt"."sku", array_agg(row_to_json(dt)) as product_variation
73
117
  from (
@@ -84,34 +128,34 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
84
128
  `)
85
129
 
86
130
  await tx.query(`
87
- CREATE TEMP TABLE temp_json_warehouse_inventory AS (
131
+ CREATE TEMP TABLE temp_json_warehouse_inventory ON COMMIT DROP AS (
88
132
  select "product_id", array_to_json(array_agg((row_to_json("dt")))) AS "Json_warehouseInventory" from(
89
- select "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
90
- "i2"."product_id", sum(coalesce("locked_qty",0)) as "inventory_locked_qty", sum(coalesce("qty",0)) as "inventory_qty"
91
- from inventories "i2"
92
- inner join warehouses "w" on "w"."id" = "i2"."warehouse_id"
93
- inner join domains "d2" on "d2"."id" = "w"."domain_id" and "d2"."ext_type" ='warehouse'
94
- inner join fulfillment_centers "fc" ON "fc"."center_id" = "d2"."subdomain"
95
- inner join temp_products "Product" on "Product"."product_id" = "i2"."product_id" AND "Product"."type" = 'PRODUCT'
96
- group by "fc"."id", "fc"."name", "i2"."product_id"
97
- UNION
98
- select "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
99
- "i2"."product_id", max(CEILING(COALESCE(i2.locked_qty,0))) AS "locked_qty", min(floor(i2.qty/pbs.bundle_qty)) AS "inventory_qty"
100
- from temp_products "Product"
101
- inner join product_bundle_settings pbs ON pbs.product_bundle_id = "Product"."product_id"
102
- inner join inventories i2 ON i2.product_id = pbs.product_id
103
- inner join warehouses "w" on "w"."id" = "i2"."warehouse_id"
104
- inner join domains "d2" on "d2"."id" = "w"."domain_id" and "d2"."ext_type" ='warehouse'
105
- inner join fulfillment_centers "fc" ON "fc"."center_id" = "d2"."subdomain"
106
- where "Product"."type" = 'BUNDLE'
107
- group by "fc"."id", "fc"."name", "i2"."product_id"
133
+ select "domain_id", "fulfillment_id", "fulfillment_name",
134
+ "product_id", "inventory_locked_qty", "inventory_qty"
135
+ from temp_inventory
136
+ union
137
+ select "bundledInv"."domain_id", "bundledInv"."fulfillment_id", "bundledInv"."fulfillment_name", "bundledInv"."product_id",
138
+ max("bundledInv"."inventory_locked_qty") as "inventory_locked_qty", min("bundledInv"."inventory_qty") as "inventory_qty" from (
139
+ select "Product"."product_id", fc.domain_id, "fc"."id" as "fulfillment_id", "fc"."name" as "fulfillment_name",
140
+ "pbs"."bundle_qty",
141
+ case when "pbs"."bundle_qty" <= 0 then 0 else ceil(greatest("i2"."inventory_locked_qty",0)/ "pbs"."bundle_qty") end AS "inventory_locked_qty",
142
+ case when "pbs"."bundle_qty" <= 0 then 0 else floor(greatest("i2"."inventory_qty", 0)/ "pbs"."bundle_qty") end AS "inventory_qty"
143
+ from temp_products "Product"
144
+ inner join product_bundle_settings pbs ON pbs.product_bundle_id = "Product"."product_id"
145
+ inner join products p on p.id = pbs.product_id
146
+ cross join fulfillment_centers fc
147
+ inner join domains "d2" on "d2"."ext_type" ='warehouse' and "fc"."center_id" = "d2"."subdomain"
148
+ left join temp_inventory i2 ON i2.product_id = pbs.product_id and "d2"."id" = "i2"."domain_id"
149
+ where "fc"."domain_id" = $1
150
+ order by fc.id, "Product"."product_sku", p.sku
151
+ ) "bundledInv"
152
+ group by "domain_id","fulfillment_id","fulfillment_name","product_id"
108
153
  ) "dt" group by "dt"."product_id"
109
154
  )
110
- `)
155
+ `, [domain.id])
111
156
 
112
- await tx.getRepository(Product).query(
113
- `
114
- create temp table temp_warehouse_marketplace_products as (
157
+ await tx.query(`
158
+ CREATE TEMP TABLE temp_warehouse_marketplace_products ON COMMIT DROP as (
115
159
  SELECT "Product"."product_id" AS "Product_id", "Product"."product_sku" AS "Product_sku",
116
160
  "Product"."product_name" AS "Product_name", "Product"."product_description" AS "Product_description",
117
161
  "Product"."product_bizplace_id" AS "Product_bizplace_id",
@@ -130,8 +174,7 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
130
174
  LEFT JOIN "temp_json_warehouse_inventory" "whInv" ON "whInv"."product_id" = "Product"."product_id"
131
175
  LEFT JOIN "temp_json_warehouse_marketplace_products" "mktPrd" ON "mktPrd"."product_id" = "Product"."product_id"
132
176
  )
133
- `
134
- )
177
+ `)
135
178
 
136
179
  const offsetQuery: string = params?.pagination
137
180
  ? `OFFSET ${(params.pagination.page - 1) * params.pagination.limit} LIMIT ${params.pagination.limit}`
@@ -145,10 +188,6 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
145
188
  `
146
189
  )
147
190
 
148
- tx.query(`
149
- drop table temp_products, temp_json_warehouse_marketplace_products, temp_json_warehouse_inventory, temp_warehouse_marketplace_products
150
- `)
151
-
152
191
  return {
153
192
  items: items.map((itm, index) => {
154
193
  return {
@@ -159,30 +198,30 @@ export async function warehouseMarketplaceProduct(params: ListParam, domain: Dom
159
198
  description: itm.Product_description,
160
199
  marketplaceProduct: itm.Json_marketplaceProducts
161
200
  ? itm.Json_marketplaceProducts.map(product => {
162
- return {
163
- marketplaceStore: { id: product.marketplace_store_id },
164
- marketplaceProductVariations: product.product_variation.map(variation => {
165
- return {
166
- id: variation.marketplace_product_variation_id,
167
- name: variation.name,
168
- qty: variation.qty,
169
- reserveQty: variation.reserve_qty
170
- }
171
- })
172
- }
173
- })
201
+ return {
202
+ marketplaceStore: { id: product.marketplace_store_id },
203
+ marketplaceProductVariations: product.product_variation.map(variation => {
204
+ return {
205
+ id: variation.marketplace_product_variation_id,
206
+ name: variation.name,
207
+ qty: variation.qty,
208
+ reserveQty: variation.reserve_qty
209
+ }
210
+ })
211
+ }
212
+ })
174
213
  : null,
175
214
  warehouseInventory: itm.Json_warehouseInventory
176
215
  ? itm.Json_warehouseInventory.map(inventory => {
177
- return {
178
- bizplace: { id: inventory.fulfillment_id, name: inventory.fulfillment_name },
179
- product: { id: inventory.product_id },
180
- qty: inventory.inventory_qty,
181
- lockedQty: inventory.inventory_locked_qty ? inventory.inventory_locked_qty : 0,
182
- remainQty:
183
- inventory.inventory_qty - (inventory.inventory_locked_qty ? inventory.inventory_locked_qty : 0)
184
- }
185
- })
216
+ return {
217
+ bizplace: { id: inventory.fulfillment_id, name: inventory.fulfillment_name },
218
+ product: { id: inventory.product_id },
219
+ qty: inventory.inventory_qty,
220
+ lockedQty: inventory.inventory_locked_qty ? inventory.inventory_locked_qty : 0,
221
+ remainQty:
222
+ inventory.inventory_qty - (inventory.inventory_locked_qty ? inventory.inventory_locked_qty : 0)
223
+ }
224
+ })
186
225
  : null
187
226
  }
188
227
  }),