@things-factory/operato-wms 5.0.0-alpha.36 → 5.0.0-alpha.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/client/pages/inbound/unload-product.js +11 -7
- package/client/pages/inventory/inventory-adjustment.js +8 -8
- package/client/pages/inventory-check/inspecting-product.js +13 -7
- package/client/pages/order/goods-received-note/customer-received-note.js +3 -0
- package/client/pages/order/goods-received-note/received-note-detail.js +3 -0
- package/client/pages/order/release-order/release-extra-product-popup.js +15 -10
- package/client/pages/outbound/merged-outbound-worksheet.js +7 -1
- package/client/pages/outbound/picking-product.js +1 -1
- package/client/pages/outbound/select-operator-popup.js +86 -14
- package/client/pages/outbound/single-outbound-worksheet.js +22 -14
- package/client/pages/outbound/worksheet-batch-picking.js +1 -1
- package/client/pages/outbound/worksheet-picking.js +1 -1
- package/client/pages/report/costing-report.js +453 -0
- package/client/pages/report/inbound-order-details-report.js +14 -0
- package/client/pages/report/outbound-order-details-report.js +12 -0
- package/client/pages/vas/print-product-label.js +15 -6
- package/client/route.js +4 -0
- package/dist-server/graphql/resolvers/reports/costing-report.js +172 -0
- package/dist-server/graphql/resolvers/reports/costing-report.js.map +1 -0
- package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +2 -0
- package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/index.js +2 -1
- package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +10 -3
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/types/reports/costing-report-list.js +14 -0
- package/dist-server/graphql/types/reports/costing-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/costing-report.js +19 -0
- package/dist-server/graphql/types/reports/costing-report.js.map +1 -0
- package/dist-server/graphql/types/reports/inbound-order-details-report.js +1 -0
- package/dist-server/graphql/types/reports/inbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/types/reports/index.js +6 -1
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/outbound-order-details-report.js +1 -0
- package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
- package/helps/release-note.ko.md +22 -19
- package/helps/release-note.md +22 -19
- package/helps/release-note.ms.md +22 -19
- package/helps/release-note.zh.md +22 -19
- package/package.json +65 -65
- package/server/graphql/resolvers/reports/costing-report.ts +196 -0
- package/server/graphql/resolvers/reports/inbound-order-details-report.ts +2 -0
- package/server/graphql/resolvers/reports/index.ts +2 -0
- package/server/graphql/resolvers/reports/outbound-order-details-report.ts +10 -3
- package/server/graphql/types/reports/costing-report-list.ts +8 -0
- package/server/graphql/types/reports/costing-report.ts +13 -0
- package/server/graphql/types/reports/inbound-order-details-report.ts +1 -0
- package/server/graphql/types/reports/index.ts +7 -1
- package/server/graphql/types/reports/outbound-order-details-report.ts +1 -0
- package/things-factory.config.js +4 -0
- package/translations/en.json +8 -2
- package/translations/ko.json +2 -0
- package/translations/ms.json +2 -0
- package/translations/zh.json +2 -0
- package/config.development.js +0 -73
- package/config.production.js +0 -113
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-wms",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.39",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -47,75 +47,75 @@
|
|
|
47
47
|
"db:reset": "yarn run db:clear && yarn run db:restore && yarn run db:seed && yarn run db:setpass"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@operato/ghost-print": "1.0.0-beta.
|
|
51
|
-
"@operato/scene-chartjs": "^1.0.0-alpha.
|
|
52
|
-
"@operato/scene-clock": "^1.0.0-alpha.
|
|
53
|
-
"@operato/scene-clone": "^1.0.0-alpha.
|
|
54
|
-
"@operato/scene-compass": "^1.0.0-alpha.
|
|
55
|
-
"@operato/scene-excel": "^1.0.0-alpha.
|
|
56
|
-
"@operato/scene-form": "^1.0.0-alpha.
|
|
57
|
-
"@operato/scene-gauge": "^1.0.0-alpha.
|
|
58
|
-
"@operato/scene-graphql": "^1.0.0-alpha.
|
|
59
|
-
"@operato/scene-half-roundrect": "^1.0.0-alpha.
|
|
60
|
-
"@operato/scene-indoor-map": "^1.0.0-alpha.
|
|
61
|
-
"@operato/scene-label": "^1.0.0-alpha.
|
|
62
|
-
"@operato/scene-legend": "^1.0.0-alpha.
|
|
63
|
-
"@operato/scene-marker": "^1.0.0-alpha.
|
|
64
|
-
"@operato/scene-news-ticker": "^1.0.0-alpha.
|
|
65
|
-
"@operato/scene-progressbar": "^1.0.0-alpha.
|
|
66
|
-
"@operato/scene-random": "^1.0.0-alpha.
|
|
67
|
-
"@operato/scene-restful": "^1.0.0-alpha.
|
|
68
|
-
"@operato/scene-switch": "^1.0.0-alpha.
|
|
69
|
-
"@operato/scene-tab": "^1.0.0-alpha.
|
|
70
|
-
"@operato/scene-table": "^1.0.0-alpha.
|
|
71
|
-
"@operato/scene-wheel-sorter": "^1.0.0-alpha.
|
|
72
|
-
"@things-factory/apptool-ui": "^5.0.0-alpha.
|
|
73
|
-
"@things-factory/attachment-ui": "^5.0.0-alpha.
|
|
74
|
-
"@things-factory/auth-ui": "^5.0.0-alpha.
|
|
75
|
-
"@things-factory/barcode-ui": "^5.0.0-alpha.
|
|
76
|
-
"@things-factory/biz-ui": "^5.0.0-alpha.
|
|
77
|
-
"@things-factory/board-service": "^5.0.0-alpha.
|
|
78
|
-
"@things-factory/board-ui": "^5.0.0-alpha.
|
|
79
|
-
"@things-factory/code-ui": "^5.0.0-alpha.
|
|
80
|
-
"@things-factory/context-ui": "^5.0.0-alpha.
|
|
81
|
-
"@things-factory/env": "^5.0.0-alpha.
|
|
82
|
-
"@things-factory/export-ui": "^5.0.0-alpha.
|
|
83
|
-
"@things-factory/export-ui-csv": "^5.0.0-alpha.
|
|
84
|
-
"@things-factory/export-ui-excel": "^5.0.0-alpha.
|
|
85
|
-
"@things-factory/fav-base": "^5.0.0-alpha.
|
|
86
|
-
"@things-factory/form-ui": "^5.0.0-alpha.
|
|
87
|
-
"@things-factory/grist-ui": "^5.0.0-alpha.
|
|
88
|
-
"@things-factory/help": "^5.0.0-alpha.
|
|
89
|
-
"@things-factory/i18n-base": "^5.0.0-alpha.
|
|
90
|
-
"@things-factory/id-rule-base": "^5.0.0-alpha.
|
|
91
|
-
"@things-factory/import-ui": "^5.0.0-alpha.
|
|
92
|
-
"@things-factory/import-ui-excel": "^5.0.0-alpha.
|
|
93
|
-
"@things-factory/menu-ui": "^5.0.0-alpha.
|
|
94
|
-
"@things-factory/more-ui": "^5.0.0-alpha.
|
|
95
|
-
"@things-factory/notification": "^5.0.0-alpha.
|
|
96
|
-
"@things-factory/pdf": "^5.0.0-alpha.
|
|
97
|
-
"@things-factory/print-proxy-service": "^5.0.0-alpha.
|
|
98
|
-
"@things-factory/print-service": "^5.0.0-alpha.
|
|
99
|
-
"@things-factory/print-ui": "^5.0.0-alpha.
|
|
100
|
-
"@things-factory/product-base": "^5.0.0-alpha.
|
|
101
|
-
"@things-factory/resource-ui": "^5.0.0-alpha.
|
|
102
|
-
"@things-factory/sales-ui": "^5.0.0-alpha.
|
|
103
|
-
"@things-factory/scene-data-transform": "^5.0.0-alpha.
|
|
104
|
-
"@things-factory/scene-google-map": "^5.0.0-alpha.
|
|
105
|
-
"@things-factory/scene-visualizer": "^5.0.0-alpha.
|
|
106
|
-
"@things-factory/setting-ui": "^5.0.0-alpha.
|
|
107
|
-
"@things-factory/system-ui": "^5.0.0-alpha.
|
|
108
|
-
"@things-factory/transport-base": "^5.0.0-alpha.
|
|
109
|
-
"@things-factory/tutorial-ui": "^5.0.0-alpha.
|
|
110
|
-
"@things-factory/warehouse-base": "^5.0.0-alpha.
|
|
111
|
-
"@things-factory/worksheet-base": "^5.0.0-alpha.
|
|
50
|
+
"@operato/ghost-print": "1.0.0-beta.5",
|
|
51
|
+
"@operato/scene-chartjs": "^1.0.0-alpha.12",
|
|
52
|
+
"@operato/scene-clock": "^1.0.0-alpha.12",
|
|
53
|
+
"@operato/scene-clone": "^1.0.0-alpha.12",
|
|
54
|
+
"@operato/scene-compass": "^1.0.0-alpha.12",
|
|
55
|
+
"@operato/scene-excel": "^1.0.0-alpha.12",
|
|
56
|
+
"@operato/scene-form": "^1.0.0-alpha.12",
|
|
57
|
+
"@operato/scene-gauge": "^1.0.0-alpha.12",
|
|
58
|
+
"@operato/scene-graphql": "^1.0.0-alpha.12",
|
|
59
|
+
"@operato/scene-half-roundrect": "^1.0.0-alpha.12",
|
|
60
|
+
"@operato/scene-indoor-map": "^1.0.0-alpha.12",
|
|
61
|
+
"@operato/scene-label": "^1.0.0-alpha.12",
|
|
62
|
+
"@operato/scene-legend": "^1.0.0-alpha.12",
|
|
63
|
+
"@operato/scene-marker": "^1.0.0-alpha.12",
|
|
64
|
+
"@operato/scene-news-ticker": "^1.0.0-alpha.12",
|
|
65
|
+
"@operato/scene-progressbar": "^1.0.0-alpha.12",
|
|
66
|
+
"@operato/scene-random": "^1.0.0-alpha.12",
|
|
67
|
+
"@operato/scene-restful": "^1.0.0-alpha.12",
|
|
68
|
+
"@operato/scene-switch": "^1.0.0-alpha.12",
|
|
69
|
+
"@operato/scene-tab": "^1.0.0-alpha.12",
|
|
70
|
+
"@operato/scene-table": "^1.0.0-alpha.12",
|
|
71
|
+
"@operato/scene-wheel-sorter": "^1.0.0-alpha.12",
|
|
72
|
+
"@things-factory/apptool-ui": "^5.0.0-alpha.39",
|
|
73
|
+
"@things-factory/attachment-ui": "^5.0.0-alpha.39",
|
|
74
|
+
"@things-factory/auth-ui": "^5.0.0-alpha.39",
|
|
75
|
+
"@things-factory/barcode-ui": "^5.0.0-alpha.39",
|
|
76
|
+
"@things-factory/biz-ui": "^5.0.0-alpha.39",
|
|
77
|
+
"@things-factory/board-service": "^5.0.0-alpha.39",
|
|
78
|
+
"@things-factory/board-ui": "^5.0.0-alpha.39",
|
|
79
|
+
"@things-factory/code-ui": "^5.0.0-alpha.39",
|
|
80
|
+
"@things-factory/context-ui": "^5.0.0-alpha.39",
|
|
81
|
+
"@things-factory/env": "^5.0.0-alpha.39",
|
|
82
|
+
"@things-factory/export-ui": "^5.0.0-alpha.39",
|
|
83
|
+
"@things-factory/export-ui-csv": "^5.0.0-alpha.39",
|
|
84
|
+
"@things-factory/export-ui-excel": "^5.0.0-alpha.39",
|
|
85
|
+
"@things-factory/fav-base": "^5.0.0-alpha.39",
|
|
86
|
+
"@things-factory/form-ui": "^5.0.0-alpha.39",
|
|
87
|
+
"@things-factory/grist-ui": "^5.0.0-alpha.39",
|
|
88
|
+
"@things-factory/help": "^5.0.0-alpha.39",
|
|
89
|
+
"@things-factory/i18n-base": "^5.0.0-alpha.39",
|
|
90
|
+
"@things-factory/id-rule-base": "^5.0.0-alpha.39",
|
|
91
|
+
"@things-factory/import-ui": "^5.0.0-alpha.39",
|
|
92
|
+
"@things-factory/import-ui-excel": "^5.0.0-alpha.39",
|
|
93
|
+
"@things-factory/menu-ui": "^5.0.0-alpha.39",
|
|
94
|
+
"@things-factory/more-ui": "^5.0.0-alpha.39",
|
|
95
|
+
"@things-factory/notification": "^5.0.0-alpha.39",
|
|
96
|
+
"@things-factory/pdf": "^5.0.0-alpha.39",
|
|
97
|
+
"@things-factory/print-proxy-service": "^5.0.0-alpha.39",
|
|
98
|
+
"@things-factory/print-service": "^5.0.0-alpha.39",
|
|
99
|
+
"@things-factory/print-ui": "^5.0.0-alpha.39",
|
|
100
|
+
"@things-factory/product-base": "^5.0.0-alpha.39",
|
|
101
|
+
"@things-factory/resource-ui": "^5.0.0-alpha.39",
|
|
102
|
+
"@things-factory/sales-ui": "^5.0.0-alpha.39",
|
|
103
|
+
"@things-factory/scene-data-transform": "^5.0.0-alpha.39",
|
|
104
|
+
"@things-factory/scene-google-map": "^5.0.0-alpha.39",
|
|
105
|
+
"@things-factory/scene-visualizer": "^5.0.0-alpha.39",
|
|
106
|
+
"@things-factory/setting-ui": "^5.0.0-alpha.39",
|
|
107
|
+
"@things-factory/system-ui": "^5.0.0-alpha.39",
|
|
108
|
+
"@things-factory/transport-base": "^5.0.0-alpha.39",
|
|
109
|
+
"@things-factory/tutorial-ui": "^5.0.0-alpha.39",
|
|
110
|
+
"@things-factory/warehouse-base": "^5.0.0-alpha.39",
|
|
111
|
+
"@things-factory/worksheet-base": "^5.0.0-alpha.39"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
|
-
"@things-factory/builder": "^5.0.0-alpha.
|
|
114
|
+
"@things-factory/builder": "^5.0.0-alpha.39",
|
|
115
115
|
"cypress": "^9.4.1",
|
|
116
116
|
"cypress-file-upload": "^5.0.8",
|
|
117
117
|
"cypress-localstorage-commands": "^1.6.1",
|
|
118
118
|
"eslint-plugin-cypress": "^2.12.1"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "23e58562a4724f157c3bc492cdedb7e32efee6a1"
|
|
121
121
|
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { EntityManager } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { User } from '@things-factory/auth-base'
|
|
4
|
+
import { Bizplace } from '@things-factory/biz-base'
|
|
5
|
+
import { ListParam } from '@things-factory/shell'
|
|
6
|
+
|
|
7
|
+
import { rawProductsQuery } from '../../../utils'
|
|
8
|
+
|
|
9
|
+
export const costingReport = {
|
|
10
|
+
async costingReport(_: any, params: ListParam, context: any) {
|
|
11
|
+
try {
|
|
12
|
+
const { tx }: { tx: EntityManager } = context.state
|
|
13
|
+
let bizplaceFilter = { name: '', operator: '', value: '' }
|
|
14
|
+
let userFilter = params.filters.find(data => data.name === 'user')
|
|
15
|
+
let fromDate = params.filters.find(data => data.name === 'fromDate')
|
|
16
|
+
let toDate = params.filters.find(data => data.name === 'toDate')
|
|
17
|
+
|
|
18
|
+
if (userFilter) {
|
|
19
|
+
const user: User = await tx.getRepository(User).findOne({
|
|
20
|
+
where: { id: userFilter.value },
|
|
21
|
+
relations: ['bizplaces']
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const bizplace: Bizplace = user.bizplaces[0]
|
|
25
|
+
|
|
26
|
+
if (!bizplace) throw 'Invalid input'
|
|
27
|
+
|
|
28
|
+
bizplaceFilter = { name: 'bizplace', operator: 'eq', value: bizplace.id }
|
|
29
|
+
} else {
|
|
30
|
+
bizplaceFilter = params.filters.find(data => data.name === 'bizplace')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!bizplaceFilter || !fromDate || !toDate) throw 'Invalid input'
|
|
34
|
+
|
|
35
|
+
const bizplace: Bizplace = await tx.getRepository(Bizplace).findOne({
|
|
36
|
+
id: bizplaceFilter.value
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
await rawProductsQuery(tx, params, bizplace)
|
|
40
|
+
|
|
41
|
+
await tx.query(
|
|
42
|
+
`
|
|
43
|
+
create temp table tmp_outbound_ord on commit drop as (
|
|
44
|
+
select p.sku, rih.domain_id, rih.bizplace_id, rih.product_id, rih.packing_type, rih.packing_size, coalesce(rih.uom, pd.uom, pd2.uom) as uom,
|
|
45
|
+
sum(rih.qty) as total_picked_qty, sum(rih.uom_value) as total_picked_uom_value
|
|
46
|
+
from reduced_inventory_histories rih
|
|
47
|
+
inner join inventories inv on inv.domain_id = rih.domain_id and inv.pallet_id = rih.pallet_id
|
|
48
|
+
left join product_details pd on pd.product_id = rih.product_id and pd.packing_type = rih.packing_type and pd.packing_size = rih.packing_size
|
|
49
|
+
left join product_details pd2 on pd2.product_id = rih.product_id and pd2.is_default = true
|
|
50
|
+
left join products p on p.id = rih.product_id
|
|
51
|
+
where rih.domain_id = $1
|
|
52
|
+
and inv.bizplace_id = $2
|
|
53
|
+
and rih.created_at >= $3 and rih.created_at <= $4
|
|
54
|
+
and rih.transaction_type = 'PICKING'
|
|
55
|
+
group by p.sku, rih.domain_id, rih.bizplace_id, rih.product_id, rih.packing_type, rih.packing_size, coalesce(rih.uom, pd.uom, pd2.uom)
|
|
56
|
+
);
|
|
57
|
+
`,
|
|
58
|
+
[context.state.domain.id, bizplace.id, fromDate.value, toDate.value]
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
await tx.query(
|
|
62
|
+
`
|
|
63
|
+
create temp table tmp_stored_inv on commit drop as (
|
|
64
|
+
select src2.sku, src2.domain_id, src2.bizplace_id, src2.pallet_id, src2.product_id, src2.packing_type, src2.packing_size, src2.uom,
|
|
65
|
+
to_char(src2.created_at, 'YYYY-MM') as created_year_month, sum(closing_qty) as closing_qty from (
|
|
66
|
+
select distinct on (rih.pallet_id) p.sku, rih.domain_id, rih.bizplace_id, rih.pallet_id, rih.product_id, rih.packing_type, rih.packing_size,
|
|
67
|
+
coalesce(rih.uom, pd.uom, pd2.uom) as uom,
|
|
68
|
+
rih.created_at, rih.transaction_type, rih.status, rih.opening_qty + rih.qty as closing_qty
|
|
69
|
+
from reduced_inventory_histories rih
|
|
70
|
+
inner join inventories i on i.domain_id = rih.domain_id and i.pallet_id = rih.pallet_id
|
|
71
|
+
left join product_details pd on pd.product_id = rih.product_id and pd.packing_type = rih.packing_type and pd.packing_size = rih.packing_size
|
|
72
|
+
left join product_details pd2 on pd2.product_id = rih.product_id and pd2.is_default = true
|
|
73
|
+
left join products p on p.id = rih.product_id
|
|
74
|
+
where rih.domain_id = $1
|
|
75
|
+
and i.bizplace_id = $2
|
|
76
|
+
and rih.created_at <= $3
|
|
77
|
+
order by rih.pallet_id, rih.seq desc
|
|
78
|
+
) src2 where src2.status <> 'TERMINATED'
|
|
79
|
+
and exists (
|
|
80
|
+
select * from tmp_outbound_ord outboundOrd
|
|
81
|
+
where outboundOrd.domain_id = src2.domain_id
|
|
82
|
+
and outboundOrd.bizplace_id = src2.bizplace_id
|
|
83
|
+
and outboundOrd.product_id = src2.product_id
|
|
84
|
+
and outboundOrd.packing_type = src2.packing_type
|
|
85
|
+
and outboundOrd.packing_size = src2.packing_size
|
|
86
|
+
and outboundOrd.uom = src2.uom
|
|
87
|
+
)
|
|
88
|
+
group by src2.sku, src2.domain_id, src2.bizplace_id, src2.pallet_id, src2.product_id, src2.packing_type, src2.packing_size, src2.uom, to_char(src2.created_at, 'YYYY-MM')
|
|
89
|
+
);
|
|
90
|
+
`,
|
|
91
|
+
[context.state.domain.id, bizplace.id, toDate.value]
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
await tx.query(
|
|
95
|
+
`
|
|
96
|
+
create temp table temp_costing_report on commit drop as (
|
|
97
|
+
WITH RECURSIVE cte_forwarded_cost as (
|
|
98
|
+
select src.domain_id, src.bizplace_id, src.product_id, src.packing_type, src.packing_size, src.uom, TO_DATE(src.created_year_month,'YYYY-MM')::timestamp as running_year_month,
|
|
99
|
+
sum(src.qty) as qty, sum(src.total_cost)/ sum(src.qty) as monthly_avg_cost,
|
|
100
|
+
coalesce((select sum(closing_qty) from tmp_stored_inv st where st.domain_id = src.domain_id and st.bizplace_id = src.bizplace_id and st.product_id = src.product_id and st.packing_type = src.packing_type and st.packing_size = src.packing_size and st.uom = src.uom and st.created_year_month = src.created_year_month),sum(src.qty)) as closing_qty from (
|
|
101
|
+
select distinct on (pallet_id)
|
|
102
|
+
ih.domain_id, ih.bizplace_id, ih.pallet_id, ih.unit_cost, (ih.unit_cost * (ih.opening_qty + ih.qty)) as total_cost, ih.status, ih.transaction_type, ih.product_id, ih.packing_type, ih.packing_size, coalesce(ih.uom, pd.uom) as uom,
|
|
103
|
+
ih.created_at, to_char(ih.created_at, 'YYYY-MM') as created_year_month,
|
|
104
|
+
ih.opening_qty,
|
|
105
|
+
ih.qty as transaction_qty,
|
|
106
|
+
ih.opening_qty + ih.qty as qty,
|
|
107
|
+
ih.opening_uom_value,
|
|
108
|
+
ih.uom_value as transaction_uom_value,
|
|
109
|
+
ih.opening_uom_value + ih.uom_value as uom_value
|
|
110
|
+
from reduced_inventory_histories ih
|
|
111
|
+
inner join inventories i on i.domain_id = ih.domain_id and i.pallet_id = ih.pallet_id
|
|
112
|
+
left join product_details pd on pd.product_id = ih.product_id and pd.packing_type = ih.packing_type and pd.packing_size = ih.packing_size
|
|
113
|
+
where ih.domain_id = $1
|
|
114
|
+
and i.bizplace_id = $2
|
|
115
|
+
and ih.created_at <= $3 and ih.unit_cost is not null
|
|
116
|
+
and exists (
|
|
117
|
+
select * from tmp_outbound_ord outboundOrd
|
|
118
|
+
where outboundOrd.domain_id = ih.domain_id
|
|
119
|
+
and outboundOrd.bizplace_id = ih.bizplace_id
|
|
120
|
+
and outboundOrd.product_id = ih.product_id
|
|
121
|
+
and outboundOrd.packing_type = ih.packing_type
|
|
122
|
+
and outboundOrd.packing_size = ih.packing_size
|
|
123
|
+
and outboundOrd.uom = ih.uom
|
|
124
|
+
)
|
|
125
|
+
order by ih.pallet_id, ih.seq
|
|
126
|
+
) src
|
|
127
|
+
group by src.domain_id, src.bizplace_id, src.product_id, src.packing_type, src.packing_size, src.uom, src.created_year_month
|
|
128
|
+
union all
|
|
129
|
+
select dt1.domain_id, dt1.bizplace_id, dt1.product_id, dt1.packing_type, dt1.packing_size, dt1.uom,
|
|
130
|
+
dt1.running_year_month + interval '1 month' as running_year_month, dt1.qty, dt1.monthly_avg_cost, dt1.closing_qty
|
|
131
|
+
from cte_forwarded_cost dt1
|
|
132
|
+
where dt1.running_year_month + interval '1 month' < $3
|
|
133
|
+
) select fc.*, -outboundord.total_picked_qty as "qty", -outboundord.total_picked_uom_value as "uom_value", (-outboundord.total_picked_qty * fc.weighted_avg_unit_cost) as "total_cost" from (
|
|
134
|
+
select p.sku as "product_sku", p."name" as "product_name", p.description as "product_description", p."type" as "product_type",
|
|
135
|
+
fc.domain_id, fc.bizplace_id, fc.product_id, fc.packing_type, fc.packing_size, fc.uom, fc.running_year_month,
|
|
136
|
+
ROUND(cast(sum(fc.monthly_avg_cost * fc.closing_qty) / sum(fc.qty) as numeric),2) as "weighted_avg_unit_cost"
|
|
137
|
+
from cte_forwarded_cost fc
|
|
138
|
+
left join products p on p.id = fc.product_id
|
|
139
|
+
where running_year_month = to_date(to_char($3::date, 'YYYY-MM'),'YYYY-MM')::timestamp
|
|
140
|
+
group by p.sku, p."name", p.description, p."type", fc.domain_id, fc.bizplace_id, fc.product_id, fc.packing_type, fc.packing_size, fc.uom, fc.running_year_month
|
|
141
|
+
) fc
|
|
142
|
+
left join tmp_outbound_ord outboundord on outboundord.domain_id = fc.domain_id
|
|
143
|
+
and outboundord.bizplace_id = fc.bizplace_id
|
|
144
|
+
and outboundord.product_id = fc.product_id
|
|
145
|
+
and outboundord.packing_type = fc.packing_type
|
|
146
|
+
and outboundord.packing_size = fc.packing_size
|
|
147
|
+
and outboundord.uom = fc.uom
|
|
148
|
+
);
|
|
149
|
+
`,
|
|
150
|
+
[context.state.domain.id, bizplace.id, toDate.value]
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
const total: any = await tx.query(`
|
|
154
|
+
select count(*) from temp_costing_report
|
|
155
|
+
`)
|
|
156
|
+
|
|
157
|
+
const result: any = await tx.query(
|
|
158
|
+
`
|
|
159
|
+
select * from temp_costing_report
|
|
160
|
+
offset $1 limit $2
|
|
161
|
+
`,
|
|
162
|
+
[(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
let items = result.map(itm => {
|
|
166
|
+
let data = {
|
|
167
|
+
bizplace: {
|
|
168
|
+
description: bizplace.description,
|
|
169
|
+
name: bizplace.name
|
|
170
|
+
},
|
|
171
|
+
product: {
|
|
172
|
+
id: itm.product_id,
|
|
173
|
+
sku: itm.product_sku,
|
|
174
|
+
name: itm.product_name,
|
|
175
|
+
description: itm.product_description,
|
|
176
|
+
type: itm.product_type
|
|
177
|
+
},
|
|
178
|
+
qty: itm.qty,
|
|
179
|
+
uom: itm.uom,
|
|
180
|
+
uomValue: itm.uom_value,
|
|
181
|
+
weightedAvgUnitCost: itm.weighted_avg_unit_cost,
|
|
182
|
+
totalCost: itm.total_cost
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return data
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
items,
|
|
190
|
+
total: total[0].count
|
|
191
|
+
}
|
|
192
|
+
} catch (error) {
|
|
193
|
+
throw error
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -78,6 +78,7 @@ export const inboundOrderDetailsReport = {
|
|
|
78
78
|
ih.packing_type as "pack_type", op.packing_size as "pack_size",
|
|
79
79
|
ih.qty, ih.uom_value, ih.uom, ih.pallet_id, ih.carton_id, ih.batch_id, ih.batch_id_ref,
|
|
80
80
|
i.expiration_date, i.manufacture_date,
|
|
81
|
+
ih.unit_cost,
|
|
81
82
|
ih.created_at as "unloaded_at",u2.name as "unloaded_by",
|
|
82
83
|
ih2.created_at as "putaway_at", u3.name as "putaway_by",
|
|
83
84
|
coalesce((select volume from product_details pd where pd.product_id = i.product_id and pd.packing_type = i.packing_type and pd.packing_size = i.packing_size
|
|
@@ -177,6 +178,7 @@ export const inboundOrderDetailsReport = {
|
|
|
177
178
|
uomValue: itm.uom_value,
|
|
178
179
|
uom: itm.uom,
|
|
179
180
|
unitVolume: itm.unit_volume,
|
|
181
|
+
unitCost: itm.unit_cost,
|
|
180
182
|
totalVolume: itm.total_volume,
|
|
181
183
|
unitNettWeight: itm.unit_nett_weight,
|
|
182
184
|
totalUnitNettWeight: itm.total_unit_nett_weight,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { inboundSerialNumberReport } from './inbound-serial-number-report'
|
|
2
2
|
import { outboundSerialNumberReport } from './outbound-serial-number-report'
|
|
3
3
|
|
|
4
|
+
import { costingReport } from './costing-report'
|
|
4
5
|
import { inboundOrderDetailsReport } from './inbound-order-details-report'
|
|
5
6
|
import { outboundOrderDetailsReport } from './outbound-order-details-report'
|
|
6
7
|
import { productLabelReport } from './product-label-report'
|
|
@@ -8,6 +9,7 @@ import { productLabelReport } from './product-label-report'
|
|
|
8
9
|
export const Query = {
|
|
9
10
|
...inboundSerialNumberReport,
|
|
10
11
|
...outboundSerialNumberReport,
|
|
12
|
+
...costingReport,
|
|
11
13
|
...inboundOrderDetailsReport,
|
|
12
14
|
...outboundOrderDetailsReport,
|
|
13
15
|
...productLabelReport
|
|
@@ -62,9 +62,9 @@ export const outboundOrderDetailsReport = {
|
|
|
62
62
|
p.id as "product_id", p.sku as "product_sku", p.name AS "product_name", p.description AS "product_description", p.type as "product_type",
|
|
63
63
|
i.packing_type as "pack_type", i.packing_size as "pack_size", oi.release_qty AS "release_qty",
|
|
64
64
|
oi.picked_at, oi.picked_by, oi.packed_at, oi.packed_by, oi.loaded_at, oi.loaded_by, oi.shipped_at,
|
|
65
|
-
oi.release_qty as "qty", oi.release_uom_value as "uom_value", i.uom,
|
|
65
|
+
oi.release_qty as "qty", oi.release_uom_value as "uom_value", i.uom, i.unit_cost,
|
|
66
66
|
oi.return_to_location_qty, oi.return_to_location_uom_value,
|
|
67
|
-
i.pallet_id, i.carton_id, i.batch_id, i.batch_id_ref, i.expiration_date, i.manufacture_date
|
|
67
|
+
i.id as inventory_id, i.pallet_id, i.carton_id, i.batch_id, i.batch_id_ref, i.expiration_date, i.manufacture_date
|
|
68
68
|
from order_inventories oi
|
|
69
69
|
inner join release_goods rg on rg.id = oi.release_good_id
|
|
70
70
|
left join users u4 on u4.id = rg.accepted_by_id
|
|
@@ -114,7 +114,13 @@ export const outboundOrderDetailsReport = {
|
|
|
114
114
|
fetch first 1 rows only),0) as unit_gross_weight,
|
|
115
115
|
coalesce((select weight_unit from product_details pd where pd.product_id = oi.product_id and pd.packing_type = oi.pack_type and pd.packing_size = oi.pack_size
|
|
116
116
|
order by created_at desc
|
|
117
|
-
fetch first 1 rows only),'') as weight_unit
|
|
117
|
+
fetch first 1 rows only),'') as weight_unit,
|
|
118
|
+
coalesce((select unit_cost from reduced_inventory_histories rih where
|
|
119
|
+
rih.ref_order_id::uuid = oi.id and
|
|
120
|
+
rih.inventory_id::uuid = oi.inventory_id and
|
|
121
|
+
rih.transaction_type = 'PICKING'
|
|
122
|
+
order by created_at desc
|
|
123
|
+
fetch first 1 rows only), oi.unit_cost, 0) as unit_cost
|
|
118
124
|
from temp_outbound_order_report oi
|
|
119
125
|
left join worksheet_details wd on wd.target_inventory_id = oi.id
|
|
120
126
|
left join worksheets w on w.id = wd.worksheet_id
|
|
@@ -162,6 +168,7 @@ export const outboundOrderDetailsReport = {
|
|
|
162
168
|
qty: Math.abs(itm.qty),
|
|
163
169
|
uomValue: Math.abs(itm.uom_value),
|
|
164
170
|
uom: itm.uom,
|
|
171
|
+
unitCost: itm.unit_cost,
|
|
165
172
|
returnToLocationQty: itm.return_to_location_qty,
|
|
166
173
|
returnToLocationUomValue: itm.return_to_location_uom_value,
|
|
167
174
|
unitVolume: itm.unit_volume,
|
|
@@ -10,12 +10,16 @@ import { OutboundOrderDetailsReportList } from './outbound-order-details-report-
|
|
|
10
10
|
import { ProductLabelReport } from './product-label-report'
|
|
11
11
|
import { ProductLabelReportList } from './product-label-report-list'
|
|
12
12
|
|
|
13
|
+
import { CostingReport } from './costing-report'
|
|
14
|
+
import { CostingReportList } from './costing-report-list'
|
|
15
|
+
|
|
13
16
|
export const Query = `
|
|
14
17
|
inboundSerialNumberReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundSerialNumberReportList @transaction
|
|
15
18
|
outboundSerialNumberReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OutboundSerialNumberReportList @transaction
|
|
16
19
|
inboundOrderDetailsReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundOrderDetailsReportList @transaction
|
|
17
20
|
outboundOrderDetailsReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OutboundOrderDetailsReportList @transaction
|
|
18
21
|
productLabelReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): ProductLabelReportList @transaction
|
|
22
|
+
costingReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): CostingReportList @transaction
|
|
19
23
|
`
|
|
20
24
|
|
|
21
25
|
export const Types = [
|
|
@@ -28,5 +32,7 @@ export const Types = [
|
|
|
28
32
|
OutboundOrderDetailsReport,
|
|
29
33
|
OutboundOrderDetailsReportList,
|
|
30
34
|
ProductLabelReport,
|
|
31
|
-
ProductLabelReportList
|
|
35
|
+
ProductLabelReportList,
|
|
36
|
+
CostingReport,
|
|
37
|
+
CostingReportList
|
|
32
38
|
]
|
package/things-factory.config.js
CHANGED
package/translations/en.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"button.approve_cancellation": "approve cancellation",
|
|
10
10
|
"button.approve": "approve",
|
|
11
11
|
"button.arrived": "arrived",
|
|
12
|
-
"button.assign_warehouse": "assign warehouse",
|
|
13
12
|
"button.assign_picker": "assign picker",
|
|
13
|
+
"button.assign_warehouse": "assign warehouse",
|
|
14
14
|
"button.assign": "assign",
|
|
15
15
|
"button.auto_assign": "auto assign",
|
|
16
16
|
"button.auto_select": "auto select",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"button.print_invoice": "print invoice",
|
|
71
71
|
"button.print_label": "print label",
|
|
72
72
|
"button.print_packing_list": "print packing list",
|
|
73
|
+
"button.print_purchase_order": "print purchase order",
|
|
73
74
|
"button.print_route_label": "print route label",
|
|
74
75
|
"button.print": "print",
|
|
75
76
|
"button.product_changes": "product changes",
|
|
@@ -131,10 +132,10 @@
|
|
|
131
132
|
"field.arrival_notice": "arrival notice",
|
|
132
133
|
"field.assigned_load": "assigned load",
|
|
133
134
|
"field.assigned_pack_qty": "assigned pack qty",
|
|
135
|
+
"field.assigned_picker": "assigned picker",
|
|
134
136
|
"field.assigned_qty": "assigned qty",
|
|
135
137
|
"field.assigned_uom_value": "assigned uom value",
|
|
136
138
|
"field.assigned": "assigned",
|
|
137
|
-
"field.assigned_picker":"assigned picker",
|
|
138
139
|
"field.attention_to": "attention to",
|
|
139
140
|
"field.aux_unit_2": "aux unit 2",
|
|
140
141
|
"field.aux_unit": "aux unit",
|
|
@@ -368,6 +369,7 @@
|
|
|
368
369
|
"field.picked_at": "picked at",
|
|
369
370
|
"field.picked_by": "picked by",
|
|
370
371
|
"field.picked_qty": "picked qty",
|
|
372
|
+
"field.picker": "picker",
|
|
371
373
|
"field.picking_complete": "picking complete",
|
|
372
374
|
"field.picking_start": "picking start",
|
|
373
375
|
"field.pickup_time_id": "pickup time id",
|
|
@@ -436,6 +438,7 @@
|
|
|
436
438
|
"field.ro_no": "RO no.",
|
|
437
439
|
"field.ro_type": "RO type",
|
|
438
440
|
"field.ro": "RO",
|
|
441
|
+
"filed.role": "role",
|
|
439
442
|
"field.rounded_uom_value": "rounded uom value",
|
|
440
443
|
"field.route": "route",
|
|
441
444
|
"field.route_label": "route label",
|
|
@@ -799,6 +802,7 @@
|
|
|
799
802
|
"label.picking_type": "picking type",
|
|
800
803
|
"label.picking": "picking",
|
|
801
804
|
"label.pickup_date": "pickup date",
|
|
805
|
+
"label.picker": "picker",
|
|
802
806
|
"label.please_select_a_container_size": "please select a container size",
|
|
803
807
|
"label.please_select_an_item": "please select an item",
|
|
804
808
|
"label.please_select_template_type": "please select template type",
|
|
@@ -1173,6 +1177,7 @@
|
|
|
1173
1177
|
"text.manufacture-date-cannot-be-later-than-today": "manufacture date cannot be later than today",
|
|
1174
1178
|
"text.missing_zone_name": "missing zone name",
|
|
1175
1179
|
"text.new_batch_id_is_empty": "new batch no is empty",
|
|
1180
|
+
"text.no_available_worksheet_selected": "no available worksheet selected",
|
|
1176
1181
|
"text.no_changes_to_be_submitted": "no changes to be submitted",
|
|
1177
1182
|
"text.no_company_selected": "no company selected",
|
|
1178
1183
|
"text.no_document_available": "no document available",
|
|
@@ -1355,6 +1360,7 @@
|
|
|
1355
1360
|
"text.truck_is_not_selected": "truck is not selected",
|
|
1356
1361
|
"text.truck_no_is_empty": "truck number is empty",
|
|
1357
1362
|
"text.unable_to_find_matching_x": "unable to find matching {state.x}",
|
|
1363
|
+
"text.unable_to_save_print_history_x": "unable to save print history ({state.counter} label(s) printed). Kindly contact our support",
|
|
1358
1364
|
"text.undo_inventory": "undo inventory",
|
|
1359
1365
|
"text.undo_picking_worksheet": "undo inventory selection",
|
|
1360
1366
|
"text.undo_preunload": "undo preunload",
|
package/translations/ko.json
CHANGED
|
@@ -1224,6 +1224,7 @@
|
|
|
1224
1224
|
"text.missing_input": "missing input",
|
|
1225
1225
|
"text.missing_zone_name": "존 명칭이 없습니다",
|
|
1226
1226
|
"text.new_batch_id_is_empty": "새 배치 번호가 없습니다",
|
|
1227
|
+
"text.no_available_worksheet_selected": "[ko]no available worksheet selected",
|
|
1227
1228
|
"text.no_changes_to_be_submitted": "[ko]no changes to be submitted",
|
|
1228
1229
|
"text.no_company_selected": "회사가 선택되지 않았습니다",
|
|
1229
1230
|
"text.no_document_available": "[ko] no document available",
|
|
@@ -1437,6 +1438,7 @@
|
|
|
1437
1438
|
"text.truck_is_not_selected": "[ko] truck is not selected",
|
|
1438
1439
|
"text.truck_no_is_empty": "[ko] truck number is empty",
|
|
1439
1440
|
"text.turn_to_pdf_successfully": "turn to pdf successfully",
|
|
1441
|
+
"text.unable_to_save_print_history_x": "[ko] unable to save print history ({state.counter} label(s) printed). Kindly contact our support",
|
|
1440
1442
|
"text.undo_inventory": "[ko]undo inventory",
|
|
1441
1443
|
"text.undo_picking_worksheet": "재고 피킹 되돌리기",
|
|
1442
1444
|
"text.undo_preunload": "임시하차 되돌리기",
|
package/translations/ms.json
CHANGED
|
@@ -1185,6 +1185,7 @@
|
|
|
1185
1185
|
"text.manifest_items_is_empty": "[ms] manifest items is empty",
|
|
1186
1186
|
"text.missing_zone_name": "nama zon tidak lengkap",
|
|
1187
1187
|
"text.new_batch_id_is_empty": "new batch no is empty",
|
|
1188
|
+
"text.no_available_worksheet_selected": "[ms]no available worksheet selected",
|
|
1188
1189
|
"text.no_changes_to_be_submitted": "[ms]no changes to be submitted",
|
|
1189
1190
|
"text.no_company_selected": "no company selected",
|
|
1190
1191
|
"text.no_document_available": "[ms] no document available",
|
|
@@ -1354,6 +1355,7 @@
|
|
|
1354
1355
|
"text.transfer_location_completed": "[ms] transfer location completed",
|
|
1355
1356
|
"text.truck_is_not_selected": "[ms] truck is not selected",
|
|
1356
1357
|
"text.truck_no_is_empty": "[ms] truck number is empty",
|
|
1358
|
+
"text.unable_to_save_print_history_x": "[ms] unable to save print history ({state.counter} label(s) printed). Kindly contact our support",
|
|
1357
1359
|
"text.undo_inventory": "[ms]undo inventory",
|
|
1358
1360
|
"text.undo_picking_worksheet": "undo inventory selection",
|
|
1359
1361
|
"text.undo_preunload": "undo preunload",
|
package/translations/zh.json
CHANGED
|
@@ -1153,6 +1153,7 @@
|
|
|
1153
1153
|
"text.manifest_items_is_empty": "[zh] manifest items is empty",
|
|
1154
1154
|
"text.missing_zone_name": "missing zone name",
|
|
1155
1155
|
"text.new_batch_id_is_empty": "new batch no is empty",
|
|
1156
|
+
"text.no_available_worksheet_selected": "[zh]no available worksheet selected",
|
|
1156
1157
|
"text.no_changes_to_be_submitted": "[zh]no changes to be submitted",
|
|
1157
1158
|
"text.no_company_selected": "no company selected",
|
|
1158
1159
|
"text.no_document_available": "[zh] no document available",
|
|
@@ -1321,6 +1322,7 @@
|
|
|
1321
1322
|
"text.transfer_location_completed": "[zh] transfer location completed",
|
|
1322
1323
|
"text.truck_is_not_selected": "[zh] truck is not selected",
|
|
1323
1324
|
"text.truck_no_is_empty": "[zh] truck number is empty",
|
|
1325
|
+
"text.unable_to_save_print_history_x": "[zh] unable to save print history ({state.counter} label(s) printed). Kindly contact our support",
|
|
1324
1326
|
"text.undo_inventory": "[zh]undo inventory",
|
|
1325
1327
|
"text.undo_picking_worksheet": "undo inventory selection",
|
|
1326
1328
|
"text.undo_preunload": "undo preunload",
|