@things-factory/worksheet-base 4.3.350 → 4.3.351
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/entities/warehouse-bizplace-onhand-inventory.js +9 -3
- package/dist-server/entities/warehouse-bizplace-onhand-inventory.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/batch-picking-worksheet.js +2 -6
- package/dist-server/graphql/resolvers/worksheet/batch-picking-worksheet.js.map +1 -1
- package/package.json +5 -5
- package/server/entities/warehouse-bizplace-onhand-inventory.ts +9 -3
- package/server/graphql/resolvers/worksheet/batch-picking-worksheet.ts +15 -8
|
@@ -81,6 +81,7 @@ WarehouseBizplaceOnhandInventory = __decorate([
|
|
|
81
81
|
i.packing_size as "packing_size",
|
|
82
82
|
i.uom,
|
|
83
83
|
i.product_id as "product_id",
|
|
84
|
+
pd.ref_code as "ref_code",
|
|
84
85
|
null as "product_bundle_id",
|
|
85
86
|
COALESCE(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - COALESCE(pds.unassigned_qty, 0)) AS "remain_qty",
|
|
86
87
|
COALESCE(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - COALESCE(pds.unassigned_uom_value, 0)) AS "remain_uom_value",
|
|
@@ -92,6 +93,7 @@ WarehouseBizplaceOnhandInventory = __decorate([
|
|
|
92
93
|
FROM inventories i
|
|
93
94
|
INNER JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id AND l2.type NOT IN ('QUARANTINE', 'RESERVE')
|
|
94
95
|
INNER JOIN products p ON p.id = i.product_id
|
|
96
|
+
INNER JOIN product_details pd ON pd.id = i.product_detail_id
|
|
95
97
|
LEFT JOIN product_detail_stocks pds on pds.product_detail_id = i.product_detail_id
|
|
96
98
|
WHERE i.status = 'STORED' AND CASE WHEN i.expiration_date is not null and p.min_outbound_shelf_life is not null then CURRENT_DATE < i.expiration_date - p.min_outbound_shelf_life else true end
|
|
97
99
|
AND i.obsolete is false
|
|
@@ -103,7 +105,8 @@ WarehouseBizplaceOnhandInventory = __decorate([
|
|
|
103
105
|
i.packing_size,
|
|
104
106
|
i.uom,
|
|
105
107
|
pds.unassigned_qty,
|
|
106
|
-
pds.unassigned_uom_value
|
|
108
|
+
pds.unassigned_uom_value,
|
|
109
|
+
pd.ref_code
|
|
107
110
|
union all
|
|
108
111
|
-- BUNDLE ITEM INVENTORY QUERY
|
|
109
112
|
SELECT
|
|
@@ -113,6 +116,7 @@ WarehouseBizplaceOnhandInventory = __decorate([
|
|
|
113
116
|
pb.packing_size as "packing_size",
|
|
114
117
|
'UNIT' AS "uom",
|
|
115
118
|
null as "product_id",
|
|
119
|
+
null as "product_detail_id",
|
|
116
120
|
pb.id AS "product_bundle_id",
|
|
117
121
|
COALESCE(MIN(FLOOR(pbs."available_qty")),0) AS "remain_qty",
|
|
118
122
|
COALESCE(MIN(FLOOR(pbs."available_uom_value")),0) AS "remain_uom_value",
|
|
@@ -123,7 +127,7 @@ WarehouseBizplaceOnhandInventory = __decorate([
|
|
|
123
127
|
'BUNDLE' AS "group_type"
|
|
124
128
|
FROM product_bundles pb
|
|
125
129
|
INNER JOIN (
|
|
126
|
-
SELECT i.domain_id, i.bizplace_id, pbs.product_id, pbs.product_bundle_id, min(pbs.bundle_qty),
|
|
130
|
+
SELECT i.domain_id, i.bizplace_id, pbs.product_id, pd.ref_code, pbs.product_bundle_id, min(pbs.bundle_qty),
|
|
127
131
|
(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - COALESCE(pds.unassigned_qty, 0)) / min(pbs.bundle_qty) AS "available_qty",
|
|
128
132
|
(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - COALESCE(pds.unassigned_uom_value, 0)) / min(pbs.bundle_qty) AS "available_uom_value",
|
|
129
133
|
(sum(COALESCE(i.qty, 0::double precision))) / min(pbs.bundle_qty)::double precision AS "qty",
|
|
@@ -132,6 +136,7 @@ WarehouseBizplaceOnhandInventory = __decorate([
|
|
|
132
136
|
(sum(COALESCE(i.transfer_uom_value, 0::double precision))) / min(pbs.bundle_qty)::double precision AS "transfer_uom_value"
|
|
133
137
|
FROM product_bundle_settings pbs
|
|
134
138
|
LEFT JOIN inventories i ON i.product_id = pbs.product_id AND i.status = 'STORED' AND i.obsolete = false
|
|
139
|
+
LEFT JOIN product_details pd ON pd.id = i.product_detail_id
|
|
135
140
|
LEFT JOIN product_detail_stocks pds ON pds.product_detail_id = i.product_detail_id
|
|
136
141
|
INNER JOIN products p ON p.id = pbs.product_id AND CASE WHEN i.expiration_date is not null and p.min_outbound_shelf_life is not null then CURRENT_DATE < i.expiration_date - p.min_outbound_shelf_life else true end
|
|
137
142
|
INNER JOIN locations l ON i.location_id = l.id AND i.domain_id = l.domain_id AND l.type NOT IN ('QUARANTINE', 'RESERVE')
|
|
@@ -141,7 +146,8 @@ WarehouseBizplaceOnhandInventory = __decorate([
|
|
|
141
146
|
pbs.product_id,
|
|
142
147
|
pbs.product_bundle_id,
|
|
143
148
|
pds.unassigned_qty,
|
|
144
|
-
pds.unassigned_uom_value
|
|
149
|
+
pds.unassigned_uom_value,
|
|
150
|
+
pd.ref_code
|
|
145
151
|
) pbs ON pbs.product_bundle_id = pb.id
|
|
146
152
|
GROUP BY
|
|
147
153
|
pbs.domain_id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warehouse-bizplace-onhand-inventory.js","sourceRoot":"","sources":["../../server/entities/warehouse-bizplace-onhand-inventory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgD;
|
|
1
|
+
{"version":3,"file":"warehouse-bizplace-onhand-inventory.js","sourceRoot":"","sources":["../../server/entities/warehouse-bizplace-onhand-inventory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgD;AAkGzC,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;CA0C5C,CAAA;AAzCC;IAAC,IAAA,oBAAU,GAAE;;oEACK;AAElB;IAAC,IAAA,oBAAU,GAAE;;sEACO;AAEpB;IAAC,IAAA,oBAAU,GAAE;;kEACG;AAEhB;IAAC,IAAA,oBAAU,GAAE;;oEACK;AAElB;IAAC,IAAA,oBAAU,GAAE;;qEACM;AAEnB;IAAC,IAAA,oBAAU,GAAE;;qEACM;AAEnB;IAAC,IAAA,oBAAU,GAAE;;6DACF;AAEX;IAAC,IAAA,oBAAU,GAAE;;mEACI;AAEjB;IAAC,IAAA,oBAAU,GAAE;;yEACU;AAEvB;IAAC,IAAA,oBAAU,GAAE;;mEACI;AAEjB;IAAC,IAAA,oBAAU,GAAE;;wEACS;AAEtB;IAAC,IAAA,oBAAU,GAAE;;qEACM;AAEnB;IAAC,IAAA,oBAAU,GAAE;;0EACW;AAExB;IAAC,IAAA,oBAAU,GAAE;;mEACI;AAzCN,gCAAgC;IAhG5C,IAAA,oBAAU,EAAC;QACV,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FX;KACF,CAAC;GACW,gCAAgC,CA0C5C;AA1CY,4EAAgC"}
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.batchPickingWorksheetResolver = void 0;
|
|
4
4
|
const typeorm_1 = require("typeorm");
|
|
5
5
|
const sales_base_1 = require("@things-factory/sales-base");
|
|
6
|
+
const warehouse_base_1 = require("@things-factory/warehouse-base");
|
|
6
7
|
const constants_1 = require("../../../constants");
|
|
7
8
|
const entities_1 = require("../../../entities");
|
|
8
|
-
const warehouse_base_1 = require("@things-factory/warehouse-base");
|
|
9
9
|
exports.batchPickingWorksheetResolver = {
|
|
10
10
|
async batchPickingWorksheet(_, { taskNo, locationSortingRules }, context) {
|
|
11
11
|
var _a;
|
|
@@ -44,8 +44,6 @@ exports.batchPickingWorksheetResolver = {
|
|
|
44
44
|
.addSelect('LOC.row', 'row')
|
|
45
45
|
.addSelect('LOC.column', 'column')
|
|
46
46
|
.addSelect('LOC.shelf', 'shelf')
|
|
47
|
-
.addSelect('BIN_LOC.name', 'binLocationName')
|
|
48
|
-
.addSelect('WSD.status', 'status')
|
|
49
47
|
.leftJoin('WSD.targetInventory', 'T_INV')
|
|
50
48
|
.leftJoin('T_INV.inventory', 'INV')
|
|
51
49
|
.leftJoin('T_INV.product', 'PROD')
|
|
@@ -70,13 +68,11 @@ exports.batchPickingWorksheetResolver = {
|
|
|
70
68
|
.addGroupBy('"PROD_DET".id')
|
|
71
69
|
.addGroupBy('"T_INV".batch_id')
|
|
72
70
|
.addGroupBy('"T_INV".packing_type')
|
|
73
|
-
.addGroupBy('BIN_LOC.name')
|
|
74
71
|
.addGroupBy('LOC.name')
|
|
75
72
|
.addGroupBy('LOC.zone')
|
|
76
73
|
.addGroupBy('LOC.column')
|
|
77
74
|
.addGroupBy('LOC.row')
|
|
78
|
-
.addGroupBy('LOC.shelf')
|
|
79
|
-
.addGroupBy('WSD.status');
|
|
75
|
+
.addGroupBy('LOC.shelf');
|
|
80
76
|
if ((locationSortingRules === null || locationSortingRules === void 0 ? void 0 : locationSortingRules.length) > 0) {
|
|
81
77
|
locationSortingRules.forEach((rule) => {
|
|
82
78
|
qb.addOrderBy(`LOC.${rule.name}`, rule.desc ? 'DESC' : 'ASC');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-picking-worksheet.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/worksheet/batch-picking-worksheet.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"batch-picking-worksheet.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/worksheet/batch-picking-worksheet.ts"],"names":[],"mappings":";;;AAAA,qCAGgB;AAEhB,2DAAmE;AAEnE,mEAAgE;AAEhE,kDAG2B;AAC3B,gDAG0B;AAEb,QAAA,6BAA6B,GAA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AAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,iBAAiB;wBACpC,OAAO,EAAE;4BACP,EAAE,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS;4BACnB,IAAI,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW;4BACvB,WAAW,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,kBAAkB;4BACrC,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU;yBACtB;wBACD,aAAa,EAAE;4BACb,EAAE,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,eAAe;yBAC1B;qBACF;iBACF,CAAA;YACH,CAAC,CAAC;SACH,CAAA;IACH,CAAC;CACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/worksheet-base",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.351",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"@things-factory/integration-base": "^4.3.332",
|
|
32
32
|
"@things-factory/integration-lmd": "^4.3.345",
|
|
33
33
|
"@things-factory/integration-marketplace": "^4.3.345",
|
|
34
|
-
"@things-factory/integration-powrup": "^4.3.
|
|
34
|
+
"@things-factory/integration-powrup": "^4.3.351",
|
|
35
35
|
"@things-factory/integration-sellercraft": "^4.3.345",
|
|
36
36
|
"@things-factory/integration-sftp": "^4.3.344",
|
|
37
37
|
"@things-factory/marketplace-base": "^4.3.345",
|
|
38
38
|
"@things-factory/notification": "^4.3.281",
|
|
39
|
-
"@things-factory/sales-base": "^4.3.
|
|
39
|
+
"@things-factory/sales-base": "^4.3.351",
|
|
40
40
|
"@things-factory/setting-base": "^4.3.281",
|
|
41
41
|
"@things-factory/shell": "^4.3.281",
|
|
42
42
|
"@things-factory/transport-base": "^4.3.344",
|
|
43
|
-
"@things-factory/warehouse-base": "^4.3.
|
|
43
|
+
"@things-factory/warehouse-base": "^4.3.351",
|
|
44
44
|
"jspdf": "2.5.1",
|
|
45
45
|
"puppeteer": "21.0.3",
|
|
46
46
|
"uuid": "^9.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "b08dc0a8af6572743d3e7a2e5ec10830e89ae1c0"
|
|
49
49
|
}
|
|
@@ -11,6 +11,7 @@ import { ViewColumn, ViewEntity } from 'typeorm'
|
|
|
11
11
|
i.packing_size as "packing_size",
|
|
12
12
|
i.uom,
|
|
13
13
|
i.product_id as "product_id",
|
|
14
|
+
pd.ref_code as "ref_code",
|
|
14
15
|
null as "product_bundle_id",
|
|
15
16
|
COALESCE(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - COALESCE(pds.unassigned_qty, 0)) AS "remain_qty",
|
|
16
17
|
COALESCE(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - COALESCE(pds.unassigned_uom_value, 0)) AS "remain_uom_value",
|
|
@@ -22,6 +23,7 @@ import { ViewColumn, ViewEntity } from 'typeorm'
|
|
|
22
23
|
FROM inventories i
|
|
23
24
|
INNER JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id AND l2.type NOT IN ('QUARANTINE', 'RESERVE')
|
|
24
25
|
INNER JOIN products p ON p.id = i.product_id
|
|
26
|
+
INNER JOIN product_details pd ON pd.id = i.product_detail_id
|
|
25
27
|
LEFT JOIN product_detail_stocks pds on pds.product_detail_id = i.product_detail_id
|
|
26
28
|
WHERE i.status = 'STORED' AND CASE WHEN i.expiration_date is not null and p.min_outbound_shelf_life is not null then CURRENT_DATE < i.expiration_date - p.min_outbound_shelf_life else true end
|
|
27
29
|
AND i.obsolete is false
|
|
@@ -33,7 +35,8 @@ import { ViewColumn, ViewEntity } from 'typeorm'
|
|
|
33
35
|
i.packing_size,
|
|
34
36
|
i.uom,
|
|
35
37
|
pds.unassigned_qty,
|
|
36
|
-
pds.unassigned_uom_value
|
|
38
|
+
pds.unassigned_uom_value,
|
|
39
|
+
pd.ref_code
|
|
37
40
|
union all
|
|
38
41
|
-- BUNDLE ITEM INVENTORY QUERY
|
|
39
42
|
SELECT
|
|
@@ -43,6 +46,7 @@ import { ViewColumn, ViewEntity } from 'typeorm'
|
|
|
43
46
|
pb.packing_size as "packing_size",
|
|
44
47
|
'UNIT' AS "uom",
|
|
45
48
|
null as "product_id",
|
|
49
|
+
null as "product_detail_id",
|
|
46
50
|
pb.id AS "product_bundle_id",
|
|
47
51
|
COALESCE(MIN(FLOOR(pbs."available_qty")),0) AS "remain_qty",
|
|
48
52
|
COALESCE(MIN(FLOOR(pbs."available_uom_value")),0) AS "remain_uom_value",
|
|
@@ -53,7 +57,7 @@ import { ViewColumn, ViewEntity } from 'typeorm'
|
|
|
53
57
|
'BUNDLE' AS "group_type"
|
|
54
58
|
FROM product_bundles pb
|
|
55
59
|
INNER JOIN (
|
|
56
|
-
SELECT i.domain_id, i.bizplace_id, pbs.product_id, pbs.product_bundle_id, min(pbs.bundle_qty),
|
|
60
|
+
SELECT i.domain_id, i.bizplace_id, pbs.product_id, pd.ref_code, pbs.product_bundle_id, min(pbs.bundle_qty),
|
|
57
61
|
(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - COALESCE(pds.unassigned_qty, 0)) / min(pbs.bundle_qty) AS "available_qty",
|
|
58
62
|
(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - COALESCE(pds.unassigned_uom_value, 0)) / min(pbs.bundle_qty) AS "available_uom_value",
|
|
59
63
|
(sum(COALESCE(i.qty, 0::double precision))) / min(pbs.bundle_qty)::double precision AS "qty",
|
|
@@ -62,6 +66,7 @@ import { ViewColumn, ViewEntity } from 'typeorm'
|
|
|
62
66
|
(sum(COALESCE(i.transfer_uom_value, 0::double precision))) / min(pbs.bundle_qty)::double precision AS "transfer_uom_value"
|
|
63
67
|
FROM product_bundle_settings pbs
|
|
64
68
|
LEFT JOIN inventories i ON i.product_id = pbs.product_id AND i.status = 'STORED' AND i.obsolete = false
|
|
69
|
+
LEFT JOIN product_details pd ON pd.id = i.product_detail_id
|
|
65
70
|
LEFT JOIN product_detail_stocks pds ON pds.product_detail_id = i.product_detail_id
|
|
66
71
|
INNER JOIN products p ON p.id = pbs.product_id AND CASE WHEN i.expiration_date is not null and p.min_outbound_shelf_life is not null then CURRENT_DATE < i.expiration_date - p.min_outbound_shelf_life else true end
|
|
67
72
|
INNER JOIN locations l ON i.location_id = l.id AND i.domain_id = l.domain_id AND l.type NOT IN ('QUARANTINE', 'RESERVE')
|
|
@@ -71,7 +76,8 @@ import { ViewColumn, ViewEntity } from 'typeorm'
|
|
|
71
76
|
pbs.product_id,
|
|
72
77
|
pbs.product_bundle_id,
|
|
73
78
|
pds.unassigned_qty,
|
|
74
|
-
pds.unassigned_uom_value
|
|
79
|
+
pds.unassigned_uom_value,
|
|
80
|
+
pd.ref_code
|
|
75
81
|
) pbs ON pbs.product_bundle_id = pb.id
|
|
76
82
|
GROUP BY
|
|
77
83
|
pbs.domain_id,
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
getRepository,
|
|
3
|
+
SelectQueryBuilder
|
|
4
|
+
} from 'typeorm'
|
|
5
|
+
|
|
3
6
|
import { ORDER_INVENTORY_STATUS } from '@things-factory/sales-base'
|
|
4
|
-
import {
|
|
5
|
-
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
7
|
+
import { Domain } from '@things-factory/shell'
|
|
6
8
|
import { InventoryChange } from '@things-factory/warehouse-base'
|
|
7
9
|
|
|
10
|
+
import {
|
|
11
|
+
WORKSHEET_STATUS,
|
|
12
|
+
WORKSHEET_TYPE
|
|
13
|
+
} from '../../../constants'
|
|
14
|
+
import {
|
|
15
|
+
Worksheet,
|
|
16
|
+
WorksheetDetail
|
|
17
|
+
} from '../../../entities'
|
|
18
|
+
|
|
8
19
|
export const batchPickingWorksheetResolver = {
|
|
9
20
|
async batchPickingWorksheet(_: any, { taskNo, locationSortingRules }, context: any) {
|
|
10
21
|
const { domain }: { domain: Domain } = context.state
|
|
@@ -43,8 +54,6 @@ export const batchPickingWorksheetResolver = {
|
|
|
43
54
|
.addSelect('LOC.row', 'row')
|
|
44
55
|
.addSelect('LOC.column', 'column')
|
|
45
56
|
.addSelect('LOC.shelf', 'shelf')
|
|
46
|
-
.addSelect('BIN_LOC.name', 'binLocationName')
|
|
47
|
-
.addSelect('WSD.status', 'status')
|
|
48
57
|
.leftJoin('WSD.targetInventory', 'T_INV')
|
|
49
58
|
.leftJoin('T_INV.inventory', 'INV')
|
|
50
59
|
.leftJoin('T_INV.product', 'PROD')
|
|
@@ -69,13 +78,11 @@ export const batchPickingWorksheetResolver = {
|
|
|
69
78
|
.addGroupBy('"PROD_DET".id')
|
|
70
79
|
.addGroupBy('"T_INV".batch_id')
|
|
71
80
|
.addGroupBy('"T_INV".packing_type')
|
|
72
|
-
.addGroupBy('BIN_LOC.name')
|
|
73
81
|
.addGroupBy('LOC.name')
|
|
74
82
|
.addGroupBy('LOC.zone')
|
|
75
83
|
.addGroupBy('LOC.column')
|
|
76
84
|
.addGroupBy('LOC.row')
|
|
77
85
|
.addGroupBy('LOC.shelf')
|
|
78
|
-
.addGroupBy('WSD.status')
|
|
79
86
|
|
|
80
87
|
if (locationSortingRules?.length > 0) {
|
|
81
88
|
locationSortingRules.forEach((rule: { name: string; desc: boolean }) => {
|