@things-factory/operato-wms 4.3.32 → 4.3.33
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-wms",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.33",
|
|
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.32",
|
|
93
93
|
"@things-factory/product-base": "^4.3.32",
|
|
94
94
|
"@things-factory/resource-ui": "^4.3.32",
|
|
95
|
-
"@things-factory/sales-ui": "^4.3.
|
|
95
|
+
"@things-factory/sales-ui": "^4.3.33",
|
|
96
96
|
"@things-factory/scene-data-transform": "^4.3.32",
|
|
97
97
|
"@things-factory/scene-excel": "^4.3.32",
|
|
98
98
|
"@things-factory/scene-firebase": "^4.3.32",
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
"@things-factory/system-ui": "^4.3.32",
|
|
109
109
|
"@things-factory/transport-base": "^4.3.32",
|
|
110
110
|
"@things-factory/tutorial-ui": "^4.3.32",
|
|
111
|
-
"@things-factory/warehouse-base": "^4.3.
|
|
112
|
-
"@things-factory/worksheet-base": "^4.3.
|
|
111
|
+
"@things-factory/warehouse-base": "^4.3.33",
|
|
112
|
+
"@things-factory/worksheet-base": "^4.3.33"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@things-factory/builder": "^4.3.32",
|
|
@@ -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": "e4f9100eef61d010cca0a9692f413f60be2e462c"
|
|
122
122
|
}
|
|
@@ -2,10 +2,19 @@ import { EntityManager } from 'typeorm'
|
|
|
2
2
|
|
|
3
3
|
import { User } from '@things-factory/auth-base'
|
|
4
4
|
import { Domain, ListParam } from '@things-factory/shell'
|
|
5
|
+
import { getPermittedBizplaceIds } from '@things-factory/biz-base'
|
|
5
6
|
|
|
6
7
|
export const inventoryExpiryMonitorResolver = {
|
|
7
8
|
async inventoryExpiryMonitor(_: any, params: ListParam, context: any) {
|
|
8
|
-
const { domain, tx }: { domain: Domain; user: User; tx: EntityManager } = context.state
|
|
9
|
+
const { domain, user, tx }: { domain: Domain; user: User; tx: EntityManager } = context.state
|
|
10
|
+
|
|
11
|
+
const bizplaceId: string = params.filters.find((filter: any) => filter.name === 'bizplace')?.value || null
|
|
12
|
+
let bizplaceIds: string[]
|
|
13
|
+
|
|
14
|
+
let bizplaces = bizplaceId != 'ALL' ? [bizplaceId] : await getPermittedBizplaceIds(domain, user)
|
|
15
|
+
bizplaceIds = bizplaces.map(bizplace => {
|
|
16
|
+
return "'" + bizplace.trim() + "'"
|
|
17
|
+
}).join(',')
|
|
9
18
|
|
|
10
19
|
const expInventories: {
|
|
11
20
|
location: string
|
|
@@ -27,6 +36,7 @@ export const inventoryExpiryMonitorResolver = {
|
|
|
27
36
|
AND i.expiration_date NOTNULL
|
|
28
37
|
AND i.status = 'STORED'
|
|
29
38
|
AND i.domain_id = $1
|
|
39
|
+
AND i.bizplace_id IN (${bizplaceIds})
|
|
30
40
|
) AS foo
|
|
31
41
|
GROUP BY "location"
|
|
32
42
|
`,
|
|
@@ -2,92 +2,123 @@ import { EntityManager } from 'typeorm'
|
|
|
2
2
|
|
|
3
3
|
import { User } from '@things-factory/auth-base'
|
|
4
4
|
import { Domain, ListParam } from '@things-factory/shell'
|
|
5
|
+
import { getPermittedBizplaceIds } from '@things-factory/biz-base'
|
|
5
6
|
|
|
6
7
|
export const outboundOrderByStatusResolver = {
|
|
7
8
|
async outboundOrderByStatus(_: any, params: ListParam, context: any) {
|
|
8
|
-
const { domain, tx }: { domain: Domain; user: User; tx: EntityManager } = context.state
|
|
9
|
+
const { domain, user, tx }: { domain: Domain; user: User; tx: EntityManager } = context.state
|
|
10
|
+
|
|
11
|
+
const bizplaceId: string = params.filters.find((filter: any) => filter.name === 'bizplace')?.value || null
|
|
12
|
+
let bizplaceIds: string[]
|
|
13
|
+
|
|
14
|
+
let bizplaces = bizplaceId != 'ALL' ? [bizplaceId] : await getPermittedBizplaceIds(domain, user)
|
|
15
|
+
bizplaceIds = bizplaces.map(bizplace => {
|
|
16
|
+
return "'" + bizplace.trim() + "'"
|
|
17
|
+
}).join(',')
|
|
9
18
|
|
|
10
19
|
const orderStatus: { status: string; count: number }[] = await tx.query(
|
|
11
20
|
`
|
|
12
|
-
WITH cte_list ("status", "count")
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
SELECT
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
21
|
+
WITH cte_list ("status", "count") AS (
|
|
22
|
+
SELECT 'PICKING UNASSIGNED' AS status, 0 AS "count"
|
|
23
|
+
UNION
|
|
24
|
+
SELECT 'PICKING ASSIGNED' AS status, 0 AS "count"
|
|
25
|
+
UNION
|
|
26
|
+
SELECT 'BATCH PICKING ASSIGNED' AS status, 0 AS "count"
|
|
27
|
+
UNION
|
|
28
|
+
SELECT 'PACKING' AS status, 0 AS "count"
|
|
29
|
+
UNION
|
|
30
|
+
SELECT 'AWAITING DISPATCH' AS status, 0 AS "count"
|
|
31
|
+
UNION
|
|
32
|
+
SELECT 'OUT FROM WAREHOUSE' AS status, 0 AS "count"
|
|
33
|
+
UNION
|
|
34
|
+
SELECT 'PENDING MANIFEST CREATION' AS status, 0 AS "count"
|
|
35
|
+
UNION
|
|
36
|
+
SELECT 'DONE' AS status, 0 AS "count"
|
|
37
|
+
UNION
|
|
38
|
+
SELECT 'PENDING CANCEL' AS status, 0 AS "count"
|
|
39
|
+
UNION
|
|
40
|
+
SELECT 'CANCELLED' AS status, 0 AS "count"
|
|
41
|
+
UNION
|
|
42
|
+
SELECT 'OTHERS' AS status, 0 AS "count"
|
|
43
|
+
UNION
|
|
44
|
+
SELECT 'DRAFT' AS status, 0 AS "count"
|
|
45
|
+
) SELECT l."status", coalesce(src."count", l."count") AS "count"
|
|
46
|
+
FROM cte_list l
|
|
47
|
+
LEFT JOIN (
|
|
48
|
+
SELECT "status", SUM("count") AS count FROM (
|
|
49
|
+
SELECT "status", COUNT(*) AS "count" FROM (
|
|
50
|
+
SELECT
|
|
51
|
+
CASE WHEN "status" = 'DONE' AND rg.updated_at::date = CURRENT_DATE THEN 'DONE'
|
|
52
|
+
WHEN "status" = 'PENDING_CANCEL' THEN 'PENDING CANCEL'
|
|
53
|
+
WHEN "status" = 'CANCELLED' AND rg.updated_at::date = CURRENT_DATE THEN 'CANCELLED'
|
|
54
|
+
WHEN "status" IN('PENDING_RECEIVE','PENDING_WORKSHEET') THEN 'PICKING UNASSIGNED'
|
|
55
|
+
END AS "status"
|
|
56
|
+
FROM release_goods rg
|
|
57
|
+
WHERE "domain_id" = $1
|
|
58
|
+
AND rg."bizplace_id" IN (${bizplaceIds})
|
|
59
|
+
AND rg."status" IN ('PENDING','PENDING_RECEIVE','PENDING_WORKSHEET','READY_TO_PICK','PICKING','READY_TO_PACK','PACKING','PENDING_CANCEL','CANCELLED','DONE')
|
|
60
|
+
) AS foo
|
|
61
|
+
GROUP BY "status"
|
|
62
|
+
UNION ALL
|
|
63
|
+
SELECT "status", COUNT(*) AS "count" FROM (
|
|
64
|
+
SELECT
|
|
65
|
+
CASE WHEN "dispatchment_status" = 'DISPATCHED' AND rg.updated_at::date = CURRENT_DATE THEN 'OUT FROM WAREHOUSE'
|
|
66
|
+
END AS "status"
|
|
67
|
+
FROM release_goods rg
|
|
68
|
+
WHERE "domain_id" = $1
|
|
69
|
+
AND rg."bizplace_id" IN (${bizplaceIds})
|
|
70
|
+
AND rg."dispatchment_status" IN ('READY_TO_DISPATCH', 'DISPATCHED')
|
|
71
|
+
AND rg."status" NOT IN ('CANCELLED','PENDING_CANCEL')
|
|
72
|
+
AND rg."tracking_no" NOTNULL
|
|
73
|
+
AND rg."type" = 'b2c'
|
|
74
|
+
) AS foo
|
|
75
|
+
GROUP BY "status"
|
|
76
|
+
UNION ALL
|
|
77
|
+
SELECT 'AWAITING DISPATCH' AS "status", count(*) FROM manifests m
|
|
78
|
+
INNER JOIN release_goods rg ON rg.manifest_id = m.id
|
|
79
|
+
WHERE m."status" = 'OPEN'
|
|
80
|
+
AND m."domain_id" = $1
|
|
81
|
+
UNION ALL
|
|
82
|
+
SELECT 'PICKING ASSIGNED' AS "status", count(*) FROM worksheets w
|
|
83
|
+
WHERE w."domain_id" = $1
|
|
84
|
+
AND w."bizplace_id" IN (${bizplaceIds})
|
|
85
|
+
AND w."type" = 'PICKING'
|
|
86
|
+
AND w."status" IN ('DEACTIVATED','EXECUTING','PENDING_CANCEL')
|
|
87
|
+
GROUP BY w."status"
|
|
88
|
+
UNION ALL
|
|
89
|
+
SELECT 'BATCH PICKING ASSIGNED' AS "status", count(*) FROM worksheets w
|
|
90
|
+
WHERE w."domain_id" = $1
|
|
91
|
+
AND w."bizplace_id" IN (${bizplaceIds})
|
|
92
|
+
AND w."type" = 'BATCH_PICKING'
|
|
93
|
+
AND w."status" IN ('DEACTIVATED','EXECUTING','PENDING_CANCEL')
|
|
94
|
+
GROUP BY w."status"
|
|
95
|
+
UNION ALL
|
|
96
|
+
SELECT 'PACKING' AS "status", count(*) FROM worksheets w
|
|
97
|
+
WHERE w."domain_id" = $1 AND w."type" = 'PACKING'
|
|
98
|
+
AND w."bizplace_id" IN (${bizplaceIds})
|
|
99
|
+
AND w."status" IN ('DEACTIVATED','EXECUTING','PENDING_CANCEL')
|
|
100
|
+
GROUP BY w."status"
|
|
101
|
+
UNION ALL
|
|
102
|
+
SELECT 'PENDING MANIFEST CREATION' AS "status", count(*) FROM release_goods rg
|
|
103
|
+
WHERE rg."domain_id" = $1
|
|
104
|
+
AND rg."bizplace_id" IN (${bizplaceIds})
|
|
105
|
+
AND rg."status" = 'DONE'
|
|
106
|
+
AND rg."manifest_id" ISNULL
|
|
107
|
+
AND rg."type" = 'b2c'
|
|
108
|
+
AND rg."updated_at" >= (CURRENT_DATE - 30)
|
|
109
|
+
UNION ALL
|
|
110
|
+
SELECT 'DRAFT' AS "status", count(*) FROM draft_release_goods drg
|
|
111
|
+
WHERE drg."domain_id" = $1
|
|
112
|
+
AND drg."bizplace_id" IN (${bizplaceIds})
|
|
113
|
+
AND drg."status" = 'DRAFT'
|
|
114
|
+
AND drg."type" = 'b2c'
|
|
115
|
+
) AS src
|
|
41
116
|
GROUP BY "status"
|
|
42
|
-
|
|
43
|
-
SELECT "status", COUNT(*) AS "count" FROM (
|
|
44
|
-
SELECT
|
|
45
|
-
CASE WHEN "dispatchment_status" = 'DISPATCHED' THEN 'OUT FROM WAREHOUSE'
|
|
46
|
-
END AS "status"
|
|
47
|
-
FROM release_goods rg
|
|
48
|
-
WHERE "domain_id" = $1
|
|
49
|
-
AND rg."dispatchment_status" IN ('READY_TO_DISPATCH', 'DISPATCHED')
|
|
50
|
-
AND rg."status" NOT IN ('CANCELLED', 'PENDING_CANCEL')
|
|
51
|
-
AND rg."tracking_no" NOTNULL
|
|
52
|
-
) AS foo
|
|
53
|
-
GROUP BY "status"
|
|
54
|
-
union all
|
|
55
|
-
select 'AWAITING DISPATCH' as "status", count(*) from manifests m
|
|
56
|
-
inner join release_goods rg ON rg.manifest_id = m.id
|
|
57
|
-
where m."status" = 'OPEN' and m."domain_id" = $1
|
|
58
|
-
union all
|
|
59
|
-
select 'PICKING ASSIGNED' as "status", count(*) from worksheets w
|
|
60
|
-
where w."domain_id" = $1 and w."type" ='PICKING'
|
|
61
|
-
and w."status" in ('DEACTIVATED','EXECUTING','PENDING_CANCEL')
|
|
62
|
-
group by w."status"
|
|
63
|
-
union all
|
|
64
|
-
select 'PACKING' as "status", count(*) from worksheets w
|
|
65
|
-
where w."domain_id" = $1 and w."type" ='PACKING'
|
|
66
|
-
and w."status" in ('DEACTIVATED','EXECUTING','PENDING_CANCEL')
|
|
67
|
-
group by w."status"
|
|
68
|
-
) src on src."status" = l."status"
|
|
117
|
+
) src ON src."status" = l."status"
|
|
69
118
|
`,
|
|
70
119
|
[domain.id]
|
|
71
120
|
)
|
|
72
121
|
|
|
73
|
-
|
|
74
|
-
'PICKING UNASSIGNED',
|
|
75
|
-
'PICKING ASSIGNED',
|
|
76
|
-
'PACKING',
|
|
77
|
-
'AWAITING DISPATCH',
|
|
78
|
-
'OUT FROM WAREHOUSE',
|
|
79
|
-
'CANCELLED',
|
|
80
|
-
'DONE',
|
|
81
|
-
'OUT OF STOCK'
|
|
82
|
-
]
|
|
83
|
-
|
|
84
|
-
return statusList.reduce((statusCounts: { status: string; count: number }[], status: string) => {
|
|
85
|
-
let foundItem = orderStatus.find(order => order.status == status)
|
|
86
|
-
|
|
87
|
-
if (foundItem) statusCounts.push({ status, count: foundItem.count })
|
|
88
|
-
else statusCounts.push({ status, count: 0 })
|
|
89
|
-
|
|
90
|
-
return statusCounts
|
|
91
|
-
}, [])
|
|
122
|
+
return orderStatus
|
|
92
123
|
}
|
|
93
124
|
}
|