@things-factory/operato-mms 4.1.37 → 4.1.41
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/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js +32 -24
- package/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js.map +1 -1
- package/package.json +43 -43
- package/server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.ts +36 -24
|
@@ -58,25 +58,8 @@ async function warehouseMarketplaceProduct(params, domain, user, tx) {
|
|
|
58
58
|
)
|
|
59
59
|
`);
|
|
60
60
|
await tx.query(`
|
|
61
|
-
CREATE TEMP TABLE "
|
|
62
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
|
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"
|
package/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warehouse-marketplace-products.js","sourceR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I,KAAK,aAAa,CAAC;SACpD,KAAK,CAAC,GAAG,CAAC,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;SACpC,IAAI,EAAE,CAAA;IAET,IAAI,YAAY,GAAG,EAAE,CAAA;IACrB,IAAI,cAAc,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/C,IAAI,WAAW,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;QACnC,YAAY,GAAG;qCACkB,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE;yCAC3B,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE;gDACxB,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAA;KAChF;IAED,MAAM,EAAE,CAAC,KAAK,CAAC;;;;;;;;;0CASyB,WAAW;UAC3C,YAAY;;;;;;;;;;;0CAWoB,WAAW;UAC3C,YAAY;;;GAGnB,CAAC,CAAA;IAEF,MAAM,EAAE,CAAC,KAAK,CACZ
|
|
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,C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AAC,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": "4.1.
|
|
3
|
+
"version": "4.1.41",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -60,50 +60,50 @@
|
|
|
60
60
|
"@operato/scene-table": "^0.1.5",
|
|
61
61
|
"@operato/scene-timer": "^0.1.5",
|
|
62
62
|
"@operato/scene-wheel-sorter": "^0.1.5",
|
|
63
|
-
"@things-factory/apptool-ui": "^4.1.
|
|
64
|
-
"@things-factory/attachment-base": "^4.1.
|
|
65
|
-
"@things-factory/auth-ui": "^4.1.
|
|
66
|
-
"@things-factory/biz-base": "^4.1.
|
|
67
|
-
"@things-factory/board-service": "^4.1.
|
|
68
|
-
"@things-factory/board-ui": "^4.1.
|
|
69
|
-
"@things-factory/code-ui": "^4.1.
|
|
70
|
-
"@things-factory/context-ui": "^4.1.
|
|
71
|
-
"@things-factory/dashboard": "^4.1.
|
|
72
|
-
"@things-factory/export-ui": "^4.1.
|
|
73
|
-
"@things-factory/export-ui-csv": "^4.1.
|
|
74
|
-
"@things-factory/export-ui-excel": "^4.1.
|
|
75
|
-
"@things-factory/geography": "^4.1.
|
|
76
|
-
"@things-factory/grist-ui": "^4.1.
|
|
77
|
-
"@things-factory/help": "^4.1.
|
|
78
|
-
"@things-factory/i18n-base": "^4.1.
|
|
79
|
-
"@things-factory/integration-fulfillment": "^4.1.
|
|
80
|
-
"@things-factory/integration-lmd": "^4.1.
|
|
81
|
-
"@things-factory/lite-menu": "^4.1.
|
|
82
|
-
"@things-factory/marketplace-base": "^4.1.
|
|
83
|
-
"@things-factory/more-ui": "^4.1.
|
|
84
|
-
"@things-factory/notification": "^4.1.
|
|
85
|
-
"@things-factory/oauth2-client": "^4.1.
|
|
86
|
-
"@things-factory/pdf": "^4.1.
|
|
87
|
-
"@things-factory/product-base": "^4.1.
|
|
88
|
-
"@things-factory/resource-ui": "^4.1.
|
|
89
|
-
"@things-factory/scene-data-transform": "^4.1.
|
|
90
|
-
"@things-factory/scene-excel": "^4.1.
|
|
91
|
-
"@things-factory/scene-firebase": "^4.1.
|
|
92
|
-
"@things-factory/scene-form": "^4.1.
|
|
93
|
-
"@things-factory/scene-google-map": "^4.1.
|
|
94
|
-
"@things-factory/scene-graphql": "^4.1.
|
|
95
|
-
"@things-factory/scene-label": "^4.1.
|
|
96
|
-
"@things-factory/scene-marker": "^4.1.
|
|
97
|
-
"@things-factory/scene-mqtt": "^4.1.
|
|
98
|
-
"@things-factory/scene-restful": "^4.1.
|
|
99
|
-
"@things-factory/scene-visualizer": "^4.1.
|
|
100
|
-
"@things-factory/setting-ui": "^4.1.
|
|
101
|
-
"@things-factory/system-ui": "^4.1.
|
|
102
|
-
"@things-factory/warehouse-base": "^4.1.
|
|
63
|
+
"@things-factory/apptool-ui": "^4.1.40",
|
|
64
|
+
"@things-factory/attachment-base": "^4.1.40",
|
|
65
|
+
"@things-factory/auth-ui": "^4.1.40",
|
|
66
|
+
"@things-factory/biz-base": "^4.1.40",
|
|
67
|
+
"@things-factory/board-service": "^4.1.40",
|
|
68
|
+
"@things-factory/board-ui": "^4.1.40",
|
|
69
|
+
"@things-factory/code-ui": "^4.1.40",
|
|
70
|
+
"@things-factory/context-ui": "^4.1.40",
|
|
71
|
+
"@things-factory/dashboard": "^4.1.40",
|
|
72
|
+
"@things-factory/export-ui": "^4.1.40",
|
|
73
|
+
"@things-factory/export-ui-csv": "^4.1.40",
|
|
74
|
+
"@things-factory/export-ui-excel": "^4.1.40",
|
|
75
|
+
"@things-factory/geography": "^4.1.40",
|
|
76
|
+
"@things-factory/grist-ui": "^4.1.40",
|
|
77
|
+
"@things-factory/help": "^4.1.40",
|
|
78
|
+
"@things-factory/i18n-base": "^4.1.40",
|
|
79
|
+
"@things-factory/integration-fulfillment": "^4.1.40",
|
|
80
|
+
"@things-factory/integration-lmd": "^4.1.40",
|
|
81
|
+
"@things-factory/lite-menu": "^4.1.40",
|
|
82
|
+
"@things-factory/marketplace-base": "^4.1.41",
|
|
83
|
+
"@things-factory/more-ui": "^4.1.40",
|
|
84
|
+
"@things-factory/notification": "^4.1.40",
|
|
85
|
+
"@things-factory/oauth2-client": "^4.1.40",
|
|
86
|
+
"@things-factory/pdf": "^4.1.40",
|
|
87
|
+
"@things-factory/product-base": "^4.1.40",
|
|
88
|
+
"@things-factory/resource-ui": "^4.1.40",
|
|
89
|
+
"@things-factory/scene-data-transform": "^4.1.40",
|
|
90
|
+
"@things-factory/scene-excel": "^4.1.40",
|
|
91
|
+
"@things-factory/scene-firebase": "^4.1.40",
|
|
92
|
+
"@things-factory/scene-form": "^4.1.40",
|
|
93
|
+
"@things-factory/scene-google-map": "^4.1.40",
|
|
94
|
+
"@things-factory/scene-graphql": "^4.1.40",
|
|
95
|
+
"@things-factory/scene-label": "^4.1.40",
|
|
96
|
+
"@things-factory/scene-marker": "^4.1.40",
|
|
97
|
+
"@things-factory/scene-mqtt": "^4.1.40",
|
|
98
|
+
"@things-factory/scene-restful": "^4.1.40",
|
|
99
|
+
"@things-factory/scene-visualizer": "^4.1.40",
|
|
100
|
+
"@things-factory/setting-ui": "^4.1.40",
|
|
101
|
+
"@things-factory/system-ui": "^4.1.40",
|
|
102
|
+
"@things-factory/warehouse-base": "^4.1.41"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@things-factory/builder": "^4.1.
|
|
105
|
+
"@things-factory/builder": "^4.1.40",
|
|
106
106
|
"@types/node-fetch": "^2.5.7"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "980df4303a7b3946466c531260634dd1e1a62e64"
|
|
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 "
|
|
71
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
|
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"
|