@things-factory/operato-wms 4.3.16 → 4.3.19
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/dashboard/outbound-order-by-status.js +38 -20
- package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js.map +1 -1
- package/dist-server/index.js +0 -1
- package/dist-server/index.js.map +1 -1
- package/package.json +5 -5
- package/server/index.ts +0 -1
- package/dist-server/entities/index.js +0 -6
- package/dist-server/entities/index.js.map +0 -1
- package/dist-server/entities/warehouse-bizplace-onhand-inventory.js +0 -174
- package/dist-server/entities/warehouse-bizplace-onhand-inventory.js.map +0 -1
- package/server/entities/index.ts +0 -3
- package/server/entities/warehouse-bizplace-onhand-inventory.ts +0 -147
|
@@ -5,26 +5,40 @@ exports.outboundOrderByStatusResolver = {
|
|
|
5
5
|
async outboundOrderByStatus(_, params, context) {
|
|
6
6
|
const { domain, tx } = context.state;
|
|
7
7
|
const orderStatus = await tx.query(`
|
|
8
|
-
(
|
|
8
|
+
WITH cte_list ("status", "count") as (
|
|
9
|
+
select 'DONE' as status, 0 as "count"
|
|
10
|
+
union
|
|
11
|
+
select 'CANCELLED' as status, 0 as "count"
|
|
12
|
+
union
|
|
13
|
+
select 'PICKING UNASSIGNED' as status, 0 as "count"
|
|
14
|
+
union
|
|
15
|
+
select 'PACKING' as status, 0 as "count"
|
|
16
|
+
union
|
|
17
|
+
select 'AWAITING DISPATCH' as status, 0 as "count"
|
|
18
|
+
union
|
|
19
|
+
select 'OUT FROM WAREHOUSE' as status, 0 as "count"
|
|
20
|
+
union
|
|
21
|
+
select 'PICKING ASSIGNED' as status, 0 as "count"
|
|
22
|
+
union
|
|
23
|
+
select 'OTHERS' as status, 0 as "count"
|
|
24
|
+
) select l."status", coalesce(src."count", l."count") as "count"
|
|
25
|
+
from cte_list l
|
|
26
|
+
left join (
|
|
9
27
|
SELECT "status", COUNT(*) AS "count" FROM (
|
|
10
28
|
SELECT
|
|
11
29
|
CASE WHEN "status" = 'DONE' and rg.updated_at::date = CURRENT_DATE THEN 'DONE'
|
|
12
30
|
WHEN "status" = 'CANCELLED' THEN 'CANCELLED'
|
|
13
|
-
WHEN "status" IN('
|
|
14
|
-
WHEN "status" IN('READY_TO_PACK', 'PACKING') THEN 'PACKING'
|
|
15
|
-
WHEN "dispatchment_status" = 'READY_TO_DISPATCH' and "tracking_no" NOTNULL and "status" NOT IN ('CANCELLED', 'PENDING_CANCEL') THEN 'AWAITING DISPATCH'
|
|
16
|
-
WHEN "dispatchment_status" = 'DISPATCHED' and "tracking_no" NOTNULL and "status" NOT IN ('CANCELLED', 'PENDING_CANCEL') THEN 'OUT FROM WAREHOUSE'
|
|
31
|
+
WHEN "status" IN('PENDING_RECEIVE', 'PENDING_WORKSHEET') THEN 'PICKING UNASSIGNED'
|
|
17
32
|
END AS "status"
|
|
18
33
|
FROM release_goods rg
|
|
19
34
|
WHERE "domain_id" = $1
|
|
20
35
|
AND rg."status" IN ('CANCELLED','PENDING', 'PENDING_RECEIVE', 'PENDING_WORKSHEET', 'READY_TO_PICK', 'PICKING', 'READY_TO_PACK', 'PACKING', 'DONE')
|
|
21
36
|
) AS foo
|
|
22
37
|
GROUP BY "status"
|
|
23
|
-
|
|
38
|
+
UNION ALL
|
|
24
39
|
SELECT "status", COUNT(*) AS "count" FROM (
|
|
25
40
|
SELECT
|
|
26
|
-
CASE WHEN "dispatchment_status" = '
|
|
27
|
-
WHEN "dispatchment_status" = 'DISPATCHED' THEN 'OUT FROM WAREHOUSE'
|
|
41
|
+
CASE WHEN "dispatchment_status" = 'DISPATCHED' THEN 'OUT FROM WAREHOUSE'
|
|
28
42
|
END AS "status"
|
|
29
43
|
FROM release_goods rg
|
|
30
44
|
WHERE "domain_id" = $1
|
|
@@ -32,18 +46,22 @@ exports.outboundOrderByStatusResolver = {
|
|
|
32
46
|
AND rg."status" NOT IN ('CANCELLED', 'PENDING_CANCEL')
|
|
33
47
|
AND rg."tracking_no" NOTNULL
|
|
34
48
|
) AS foo
|
|
35
|
-
GROUP BY "status"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
GROUP BY "status"
|
|
50
|
+
union all
|
|
51
|
+
select 'AWAITING DISPATCH' as "status", count(*) from manifests m
|
|
52
|
+
inner join release_goods rg ON rg.manifest_id = m.id
|
|
53
|
+
where m."status" = 'OPEN' and m."domain_id" = $1
|
|
54
|
+
union all
|
|
55
|
+
select 'PICKING ASSIGNED' as "status", count(*) from worksheets w
|
|
56
|
+
where w."domain_id" = $1 and w."type" ='PICKING'
|
|
57
|
+
and w."status" in ('DEACTIVATED','EXECUTING','PENDING_CANCEL')
|
|
58
|
+
group by w."status"
|
|
59
|
+
union all
|
|
60
|
+
select 'PACKING' as "status", count(*) from worksheets w
|
|
61
|
+
where w."domain_id" = $1 and w."type" ='PACKING'
|
|
62
|
+
and w."status" in ('DEACTIVATED','EXECUTING','PENDING_CANCEL')
|
|
63
|
+
group by w."status"
|
|
64
|
+
) src on src."status" = l."status"
|
|
47
65
|
`, [domain.id]);
|
|
48
66
|
const statusList = [
|
|
49
67
|
'PICKING UNASSIGNED',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outbound-order-by-status.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/dashboard/outbound-order-by-status.ts"],"names":[],"mappings":";;;AAKa,QAAA,6BAA6B,GAAG;IAC3C,KAAK,CAAC,qBAAqB,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QACjE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAsD,OAAO,CAAC,KAAK,CAAA;QAEvF,MAAM,WAAW,GAAwC,MAAM,EAAE,CAAC,KAAK,CACrE
|
|
1
|
+
{"version":3,"file":"outbound-order-by-status.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/dashboard/outbound-order-by-status.ts"],"names":[],"mappings":";;;AAKa,QAAA,6BAA6B,GAAG;IAC3C,KAAK,CAAC,qBAAqB,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QACjE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAsD,OAAO,CAAC,KAAK,CAAA;QAEvF,MAAM,WAAW,GAAwC,MAAM,EAAE,CAAC,KAAK,CACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0DD,EACC,CAAC,MAAM,CAAC,EAAE,CAAC,CACZ,CAAA;QAED,MAAM,UAAU,GAAa;YAC3B,oBAAoB;YACpB,kBAAkB;YAClB,SAAS;YACT,mBAAmB;YACnB,oBAAoB;YACpB,WAAW;YACX,MAAM;YACN,cAAc;SACf,CAAA;QAED,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,YAAiD,EAAE,MAAc,EAAE,EAAE;YAC7F,IAAI,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,CAAA;YAEjE,IAAI,SAAS;gBAAE,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC,CAAA;;gBAC/D,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;YAE5C,OAAO,YAAY,CAAA;QACrB,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC;CACF,CAAA"}
|
package/dist-server/index.js
CHANGED
|
@@ -10,7 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./entities"), exports);
|
|
14
13
|
__exportStar(require("./graphql"), exports);
|
|
15
14
|
__exportStar(require("./migrations"), exports);
|
|
16
15
|
require("./routes");
|
package/dist-server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyB;AACzB,+CAA4B;AAE5B,oBAAiB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-wms",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.19",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@things-factory/print-ui": "^4.3.14",
|
|
93
93
|
"@things-factory/product-base": "^4.3.14",
|
|
94
94
|
"@things-factory/resource-ui": "^4.3.14",
|
|
95
|
-
"@things-factory/sales-ui": "^4.3.
|
|
95
|
+
"@things-factory/sales-ui": "^4.3.19",
|
|
96
96
|
"@things-factory/scene-data-transform": "^4.3.14",
|
|
97
97
|
"@things-factory/scene-excel": "^4.3.14",
|
|
98
98
|
"@things-factory/scene-firebase": "^4.3.14",
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
"@things-factory/system-ui": "^4.3.14",
|
|
109
109
|
"@things-factory/transport-base": "^4.3.14",
|
|
110
110
|
"@things-factory/tutorial-ui": "^4.3.14",
|
|
111
|
-
"@things-factory/warehouse-base": "^4.3.
|
|
112
|
-
"@things-factory/worksheet-base": "^4.3.
|
|
111
|
+
"@things-factory/warehouse-base": "^4.3.19",
|
|
112
|
+
"@things-factory/worksheet-base": "^4.3.19"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@things-factory/builder": "^4.3.14",
|
|
@@ -118,5 +118,5 @@
|
|
|
118
118
|
"cypress-localstorage-commands": "^1.6.1",
|
|
119
119
|
"eslint-plugin-cypress": "^2.12.1"
|
|
120
120
|
},
|
|
121
|
-
"gitHead": "
|
|
121
|
+
"gitHead": "2dddec18e371e5714d9f7a6bd0412741064af1d2"
|
|
122
122
|
}
|
package/server/index.ts
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.entities = void 0;
|
|
4
|
-
const warehouse_bizplace_onhand_inventory_1 = require("./warehouse-bizplace-onhand-inventory");
|
|
5
|
-
exports.entities = [warehouse_bizplace_onhand_inventory_1.WarehouseBizplaceOnhandInventory];
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/entities/index.ts"],"names":[],"mappings":";;;AAAA,+FAAwF;AAE3E,QAAA,QAAQ,GAAG,CAAC,sEAAgC,CAAC,CAAA"}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.WarehouseBizplaceOnhandInventory = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
let WarehouseBizplaceOnhandInventory = class WarehouseBizplaceOnhandInventory {
|
|
15
|
-
};
|
|
16
|
-
__decorate([
|
|
17
|
-
(0, typeorm_1.ViewColumn)(),
|
|
18
|
-
__metadata("design:type", String)
|
|
19
|
-
], WarehouseBizplaceOnhandInventory.prototype, "domainName", void 0);
|
|
20
|
-
__decorate([
|
|
21
|
-
(0, typeorm_1.ViewColumn)(),
|
|
22
|
-
__metadata("design:type", String)
|
|
23
|
-
], WarehouseBizplaceOnhandInventory.prototype, "bizplaceName", void 0);
|
|
24
|
-
__decorate([
|
|
25
|
-
(0, typeorm_1.ViewColumn)(),
|
|
26
|
-
__metadata("design:type", String)
|
|
27
|
-
], WarehouseBizplaceOnhandInventory.prototype, "domainId", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, typeorm_1.ViewColumn)(),
|
|
30
|
-
__metadata("design:type", String)
|
|
31
|
-
], WarehouseBizplaceOnhandInventory.prototype, "bizplaceId", void 0);
|
|
32
|
-
__decorate([
|
|
33
|
-
(0, typeorm_1.ViewColumn)(),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], WarehouseBizplaceOnhandInventory.prototype, "packingType", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, typeorm_1.ViewColumn)(),
|
|
38
|
-
__metadata("design:type", Number)
|
|
39
|
-
], WarehouseBizplaceOnhandInventory.prototype, "packingSize", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
(0, typeorm_1.ViewColumn)(),
|
|
42
|
-
__metadata("design:type", String)
|
|
43
|
-
], WarehouseBizplaceOnhandInventory.prototype, "uom", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
(0, typeorm_1.ViewColumn)(),
|
|
46
|
-
__metadata("design:type", String)
|
|
47
|
-
], WarehouseBizplaceOnhandInventory.prototype, "productId", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, typeorm_1.ViewColumn)(),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], WarehouseBizplaceOnhandInventory.prototype, "productBundleId", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, typeorm_1.ViewColumn)(),
|
|
54
|
-
__metadata("design:type", Number)
|
|
55
|
-
], WarehouseBizplaceOnhandInventory.prototype, "remainQty", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, typeorm_1.ViewColumn)(),
|
|
58
|
-
__metadata("design:type", Number)
|
|
59
|
-
], WarehouseBizplaceOnhandInventory.prototype, "remainUomValue", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, typeorm_1.ViewColumn)(),
|
|
62
|
-
__metadata("design:type", String)
|
|
63
|
-
], WarehouseBizplaceOnhandInventory.prototype, "groupType", void 0);
|
|
64
|
-
WarehouseBizplaceOnhandInventory = __decorate([
|
|
65
|
-
(0, typeorm_1.ViewEntity)({
|
|
66
|
-
expression: `
|
|
67
|
-
select d.name as "domainName", b.name as "bizplaceName", src.* from (
|
|
68
|
-
WITH oi as (
|
|
69
|
-
select
|
|
70
|
-
oi.domain_id,
|
|
71
|
-
oi.bizplace_id,
|
|
72
|
-
SUM(oi.release_qty) AS release_qty,
|
|
73
|
-
SUM(oi.release_uom_value) AS release_uom_value,
|
|
74
|
-
oi.batch_id,
|
|
75
|
-
oi.batch_id_ref,
|
|
76
|
-
oi.product_id,
|
|
77
|
-
oi.packing_type,
|
|
78
|
-
oi.packing_size,
|
|
79
|
-
oi.uom
|
|
80
|
-
FROM
|
|
81
|
-
order_inventories oi
|
|
82
|
-
WHERE
|
|
83
|
-
(oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
|
|
84
|
-
AND oi.batch_id NOTNULL
|
|
85
|
-
AND oi.product_id NOTNULL
|
|
86
|
-
AND oi.packing_type NOTNULL
|
|
87
|
-
AND oi.packing_size NOTNULL
|
|
88
|
-
AND oi.inventory_id IS NULL
|
|
89
|
-
GROUP BY
|
|
90
|
-
oi.domain_id,
|
|
91
|
-
oi.bizplace_id,
|
|
92
|
-
oi.batch_id,
|
|
93
|
-
oi.batch_id_ref,
|
|
94
|
-
oi.product_id,
|
|
95
|
-
oi.packing_type,
|
|
96
|
-
oi.packing_size,
|
|
97
|
-
oi.uom
|
|
98
|
-
)
|
|
99
|
-
-- SINGLE ITEM INVENTORY QUERY
|
|
100
|
-
select
|
|
101
|
-
i.domain_id as "domainId",
|
|
102
|
-
i.bizplace_id as "bizplaceId",
|
|
103
|
-
i.packing_type as "packingType",
|
|
104
|
-
i.packing_size as "packingSize",
|
|
105
|
-
i.uom,
|
|
106
|
-
i.product_id as "productId",
|
|
107
|
-
null as "productBundleId",
|
|
108
|
-
COALESCE(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) AS "remainQty",
|
|
109
|
-
COALESCE(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)), 0) AS "remainUomValue",
|
|
110
|
-
COALESCE(sum(COALESCE(i.qty, 0::double precision))) AS "qty",
|
|
111
|
-
COALESCE(sum(COALESCE(i.uom_value, 0::double precision))) AS "uomValue",
|
|
112
|
-
'SINGLE' AS "groupType"
|
|
113
|
-
FROM inventories i
|
|
114
|
-
INNER JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id AND l2.type NOT IN ('QUARANTINE', 'RESERVE')
|
|
115
|
-
LEFT JOIN oi ON i.batch_id = oi.batch_id AND i.product_id = oi.product_id AND i.packing_type = oi.packing_type AND i.packing_size = oi.packing_size AND i.uom = oi.uom
|
|
116
|
-
WHERE i.status = 'STORED'
|
|
117
|
-
GROUP by
|
|
118
|
-
i.domain_id,
|
|
119
|
-
i.bizplace_id,
|
|
120
|
-
i.product_id,
|
|
121
|
-
i.packing_type,
|
|
122
|
-
i.packing_size,
|
|
123
|
-
i.uom
|
|
124
|
-
union all
|
|
125
|
-
-- BUNDLE ITEM INVENTORY QUERY
|
|
126
|
-
SELECT
|
|
127
|
-
pbs.domain_id as "domainId",
|
|
128
|
-
pbs.bizplace_id as "bizplaceId",
|
|
129
|
-
pb.packing_type as "packingType",
|
|
130
|
-
pb.packing_size as "packingSize",
|
|
131
|
-
'UNIT' AS "uom",
|
|
132
|
-
null as "productId",
|
|
133
|
-
pb.id AS "productBundleId",
|
|
134
|
-
COALESCE(MIN(FLOOR(pbs."availableQty")),0) AS "remainQty",
|
|
135
|
-
COALESCE(MIN(FLOOR(pbs."availableUomValue")),0) AS "remainUomValue",
|
|
136
|
-
COALESCE(MIN(FLOOR(pbs."qty")), 0::double precision) AS "qty",
|
|
137
|
-
COALESCE(MIN(FLOOR(pbs."uomValue")), 0::double precision) AS "uomValue",
|
|
138
|
-
'BUNDLE' AS "groupType"
|
|
139
|
-
FROM product_bundles pb
|
|
140
|
-
INNER JOIN (
|
|
141
|
-
SELECT i.domain_id, i.bizplace_id, pbs.product_id, pbs.product_bundle_id, min(pbs.bundle_qty),
|
|
142
|
-
(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) / min(pbs.bundle_qty) AS "availableQty",
|
|
143
|
-
(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0))) / min(pbs.bundle_qty) AS "availableUomValue",
|
|
144
|
-
(sum(COALESCE(i.qty, 0::double precision))) / min(pbs.bundle_qty)::double precision AS "qty",
|
|
145
|
-
(sum(COALESCE(i.uom_value, 0::double precision))) / min(pbs.bundle_qty)::double precision AS "uomValue"
|
|
146
|
-
FROM product_bundle_settings pbs
|
|
147
|
-
LEFT JOIN inventories i ON i.product_id = pbs.product_id AND i.status = 'STORED'
|
|
148
|
-
INNER JOIN locations l ON i.location_id = l.id AND i.domain_id = l.domain_id AND l.type NOT IN ('QUARANTINE', 'RESERVE')
|
|
149
|
-
LEFT JOIN oi ON oi.product_id = i.product_id
|
|
150
|
-
GROUP by
|
|
151
|
-
i.domain_id,
|
|
152
|
-
i.bizplace_id,
|
|
153
|
-
pbs.product_id,
|
|
154
|
-
pbs.product_bundle_id
|
|
155
|
-
) pbs ON pbs.product_bundle_id = pb.id
|
|
156
|
-
GROUP BY
|
|
157
|
-
pbs.domain_id,
|
|
158
|
-
pbs.bizplace_id,
|
|
159
|
-
pb.packing_type,
|
|
160
|
-
pb.packing_size,
|
|
161
|
-
pb.name,
|
|
162
|
-
pb.sku,
|
|
163
|
-
pb.id
|
|
164
|
-
)
|
|
165
|
-
AS src
|
|
166
|
-
inner join domains d on d.id = src."domainId"
|
|
167
|
-
inner join bizplaces b on b.id = src."bizplaceId"
|
|
168
|
-
where src."remainQty" > 0
|
|
169
|
-
order by src."domainId"
|
|
170
|
-
`
|
|
171
|
-
})
|
|
172
|
-
], WarehouseBizplaceOnhandInventory);
|
|
173
|
-
exports.WarehouseBizplaceOnhandInventory = WarehouseBizplaceOnhandInventory;
|
|
174
|
-
//# sourceMappingURL=warehouse-bizplace-onhand-inventory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"warehouse-bizplace-onhand-inventory.js","sourceRoot":"","sources":["../../server/entities/warehouse-bizplace-onhand-inventory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgD;AA8GhD,IAAa,gCAAgC,GAA7C,MAAa,gCAAgC;CAoC5C,CAAA;AAlCC;IADC,IAAA,oBAAU,GAAE;;oEACK;AAGlB;IADC,IAAA,oBAAU,GAAE;;sEACO;AAGpB;IADC,IAAA,oBAAU,GAAE;;kEACG;AAGhB;IADC,IAAA,oBAAU,GAAE;;oEACK;AAGlB;IADC,IAAA,oBAAU,GAAE;;qEACM;AAGnB;IADC,IAAA,oBAAU,GAAE;;qEACM;AAGnB;IADC,IAAA,oBAAU,GAAE;;6DACF;AAGX;IADC,IAAA,oBAAU,GAAE;;mEACI;AAGjB;IADC,IAAA,oBAAU,GAAE;;yEACU;AAGvB;IADC,IAAA,oBAAU,GAAE;;mEACI;AAGjB;IADC,IAAA,oBAAU,GAAE;;wEACS;AAGtB;IADC,IAAA,oBAAU,GAAE;;mEACI;AAnCN,gCAAgC;IA5G5C,IAAA,oBAAU,EAAC;QACV,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwGX;KACF,CAAC;GAEW,gCAAgC,CAoC5C;AApCY,4EAAgC"}
|
package/server/entities/index.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { ViewColumn, ViewEntity } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
@ViewEntity({
|
|
4
|
-
expression: `
|
|
5
|
-
select d.name as "domainName", b.name as "bizplaceName", src.* from (
|
|
6
|
-
WITH oi as (
|
|
7
|
-
select
|
|
8
|
-
oi.domain_id,
|
|
9
|
-
oi.bizplace_id,
|
|
10
|
-
SUM(oi.release_qty) AS release_qty,
|
|
11
|
-
SUM(oi.release_uom_value) AS release_uom_value,
|
|
12
|
-
oi.batch_id,
|
|
13
|
-
oi.batch_id_ref,
|
|
14
|
-
oi.product_id,
|
|
15
|
-
oi.packing_type,
|
|
16
|
-
oi.packing_size,
|
|
17
|
-
oi.uom
|
|
18
|
-
FROM
|
|
19
|
-
order_inventories oi
|
|
20
|
-
WHERE
|
|
21
|
-
(oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
|
|
22
|
-
AND oi.batch_id NOTNULL
|
|
23
|
-
AND oi.product_id NOTNULL
|
|
24
|
-
AND oi.packing_type NOTNULL
|
|
25
|
-
AND oi.packing_size NOTNULL
|
|
26
|
-
AND oi.inventory_id IS NULL
|
|
27
|
-
GROUP BY
|
|
28
|
-
oi.domain_id,
|
|
29
|
-
oi.bizplace_id,
|
|
30
|
-
oi.batch_id,
|
|
31
|
-
oi.batch_id_ref,
|
|
32
|
-
oi.product_id,
|
|
33
|
-
oi.packing_type,
|
|
34
|
-
oi.packing_size,
|
|
35
|
-
oi.uom
|
|
36
|
-
)
|
|
37
|
-
-- SINGLE ITEM INVENTORY QUERY
|
|
38
|
-
select
|
|
39
|
-
i.domain_id as "domainId",
|
|
40
|
-
i.bizplace_id as "bizplaceId",
|
|
41
|
-
i.packing_type as "packingType",
|
|
42
|
-
i.packing_size as "packingSize",
|
|
43
|
-
i.uom,
|
|
44
|
-
i.product_id as "productId",
|
|
45
|
-
null as "productBundleId",
|
|
46
|
-
COALESCE(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) AS "remainQty",
|
|
47
|
-
COALESCE(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)), 0) AS "remainUomValue",
|
|
48
|
-
COALESCE(sum(COALESCE(i.qty, 0::double precision))) AS "qty",
|
|
49
|
-
COALESCE(sum(COALESCE(i.uom_value, 0::double precision))) AS "uomValue",
|
|
50
|
-
'SINGLE' AS "groupType"
|
|
51
|
-
FROM inventories i
|
|
52
|
-
INNER JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id AND l2.type NOT IN ('QUARANTINE', 'RESERVE')
|
|
53
|
-
LEFT JOIN oi ON i.batch_id = oi.batch_id AND i.product_id = oi.product_id AND i.packing_type = oi.packing_type AND i.packing_size = oi.packing_size AND i.uom = oi.uom
|
|
54
|
-
WHERE i.status = 'STORED'
|
|
55
|
-
GROUP by
|
|
56
|
-
i.domain_id,
|
|
57
|
-
i.bizplace_id,
|
|
58
|
-
i.product_id,
|
|
59
|
-
i.packing_type,
|
|
60
|
-
i.packing_size,
|
|
61
|
-
i.uom
|
|
62
|
-
union all
|
|
63
|
-
-- BUNDLE ITEM INVENTORY QUERY
|
|
64
|
-
SELECT
|
|
65
|
-
pbs.domain_id as "domainId",
|
|
66
|
-
pbs.bizplace_id as "bizplaceId",
|
|
67
|
-
pb.packing_type as "packingType",
|
|
68
|
-
pb.packing_size as "packingSize",
|
|
69
|
-
'UNIT' AS "uom",
|
|
70
|
-
null as "productId",
|
|
71
|
-
pb.id AS "productBundleId",
|
|
72
|
-
COALESCE(MIN(FLOOR(pbs."availableQty")),0) AS "remainQty",
|
|
73
|
-
COALESCE(MIN(FLOOR(pbs."availableUomValue")),0) AS "remainUomValue",
|
|
74
|
-
COALESCE(MIN(FLOOR(pbs."qty")), 0::double precision) AS "qty",
|
|
75
|
-
COALESCE(MIN(FLOOR(pbs."uomValue")), 0::double precision) AS "uomValue",
|
|
76
|
-
'BUNDLE' AS "groupType"
|
|
77
|
-
FROM product_bundles pb
|
|
78
|
-
INNER JOIN (
|
|
79
|
-
SELECT i.domain_id, i.bizplace_id, pbs.product_id, pbs.product_bundle_id, min(pbs.bundle_qty),
|
|
80
|
-
(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) / min(pbs.bundle_qty) AS "availableQty",
|
|
81
|
-
(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0))) / min(pbs.bundle_qty) AS "availableUomValue",
|
|
82
|
-
(sum(COALESCE(i.qty, 0::double precision))) / min(pbs.bundle_qty)::double precision AS "qty",
|
|
83
|
-
(sum(COALESCE(i.uom_value, 0::double precision))) / min(pbs.bundle_qty)::double precision AS "uomValue"
|
|
84
|
-
FROM product_bundle_settings pbs
|
|
85
|
-
LEFT JOIN inventories i ON i.product_id = pbs.product_id AND i.status = 'STORED'
|
|
86
|
-
INNER JOIN locations l ON i.location_id = l.id AND i.domain_id = l.domain_id AND l.type NOT IN ('QUARANTINE', 'RESERVE')
|
|
87
|
-
LEFT JOIN oi ON oi.product_id = i.product_id
|
|
88
|
-
GROUP by
|
|
89
|
-
i.domain_id,
|
|
90
|
-
i.bizplace_id,
|
|
91
|
-
pbs.product_id,
|
|
92
|
-
pbs.product_bundle_id
|
|
93
|
-
) pbs ON pbs.product_bundle_id = pb.id
|
|
94
|
-
GROUP BY
|
|
95
|
-
pbs.domain_id,
|
|
96
|
-
pbs.bizplace_id,
|
|
97
|
-
pb.packing_type,
|
|
98
|
-
pb.packing_size,
|
|
99
|
-
pb.name,
|
|
100
|
-
pb.sku,
|
|
101
|
-
pb.id
|
|
102
|
-
)
|
|
103
|
-
AS src
|
|
104
|
-
inner join domains d on d.id = src."domainId"
|
|
105
|
-
inner join bizplaces b on b.id = src."bizplaceId"
|
|
106
|
-
where src."remainQty" > 0
|
|
107
|
-
order by src."domainId"
|
|
108
|
-
`
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
export class WarehouseBizplaceOnhandInventory {
|
|
112
|
-
@ViewColumn()
|
|
113
|
-
domainName: string
|
|
114
|
-
|
|
115
|
-
@ViewColumn()
|
|
116
|
-
bizplaceName: string
|
|
117
|
-
|
|
118
|
-
@ViewColumn()
|
|
119
|
-
domainId: string
|
|
120
|
-
|
|
121
|
-
@ViewColumn()
|
|
122
|
-
bizplaceId: string
|
|
123
|
-
|
|
124
|
-
@ViewColumn()
|
|
125
|
-
packingType: string
|
|
126
|
-
|
|
127
|
-
@ViewColumn()
|
|
128
|
-
packingSize: number
|
|
129
|
-
|
|
130
|
-
@ViewColumn()
|
|
131
|
-
uom: string
|
|
132
|
-
|
|
133
|
-
@ViewColumn()
|
|
134
|
-
productId: string
|
|
135
|
-
|
|
136
|
-
@ViewColumn()
|
|
137
|
-
productBundleId: string
|
|
138
|
-
|
|
139
|
-
@ViewColumn()
|
|
140
|
-
remainQty: number
|
|
141
|
-
|
|
142
|
-
@ViewColumn()
|
|
143
|
-
remainUomValue: number
|
|
144
|
-
|
|
145
|
-
@ViewColumn()
|
|
146
|
-
groupType: string
|
|
147
|
-
}
|