@things-factory/operato-wms 4.3.465 → 4.3.467
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/outbound/picking-product.js +25 -6
- package/client/pages/outbound/route-label-popup.js +97 -27
- package/client/pages/report/manifest-report.js +448 -0
- package/client/route.js +4 -0
- package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js +5 -4
- package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/index.js +3 -2
- package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/manifest-report.js +96 -0
- package/dist-server/graphql/resolvers/reports/manifest-report.js.map +1 -0
- package/dist-server/graphql/types/dashboard/inventory-expiry-counter.js +1 -0
- package/dist-server/graphql/types/dashboard/inventory-expiry-counter.js.map +1 -1
- package/dist-server/graphql/types/reports/index.js +8 -3
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/manifest-report-list.js +14 -0
- package/dist-server/graphql/types/reports/manifest-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/manifest-report-type.js +22 -0
- package/dist-server/graphql/types/reports/manifest-report-type.js.map +1 -0
- package/package.json +4 -4
- package/server/graphql/resolvers/dashboard/inventory-expiry-monitor.ts +9 -5
- package/server/graphql/resolvers/reports/index.ts +8 -3
- package/server/graphql/resolvers/reports/manifest-report.ts +109 -0
- package/server/graphql/types/dashboard/inventory-expiry-counter.ts +1 -0
- package/server/graphql/types/reports/index.ts +16 -5
- package/server/graphql/types/reports/manifest-report-list.ts +8 -0
- package/server/graphql/types/reports/manifest-report-type.ts +16 -0
- package/things-factory.config.js +4 -0
- package/translations/en.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import '@things-factory/form-ui'
|
|
2
|
+
import '@things-factory/grist-ui'
|
|
3
|
+
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
import {
|
|
6
|
+
css,
|
|
7
|
+
html
|
|
8
|
+
} from 'lit-element'
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
i18next,
|
|
12
|
+
localize
|
|
13
|
+
} from '@things-factory/i18n-base'
|
|
14
|
+
import {
|
|
15
|
+
client,
|
|
16
|
+
gqlContext,
|
|
17
|
+
PageView
|
|
18
|
+
} from '@things-factory/shell'
|
|
19
|
+
import { ScrollbarStyles } from '@things-factory/styles'
|
|
20
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
21
|
+
|
|
22
|
+
class ManifestReport extends localize(i18next)(PageView) {
|
|
23
|
+
static get styles() {
|
|
24
|
+
return [
|
|
25
|
+
ScrollbarStyles,
|
|
26
|
+
css`
|
|
27
|
+
:host {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
search-form {
|
|
34
|
+
overflow: visible;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
data-grist {
|
|
38
|
+
overflow-y: auto;
|
|
39
|
+
flex: 1;
|
|
40
|
+
}
|
|
41
|
+
`
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static get properties() {
|
|
46
|
+
return {
|
|
47
|
+
_searchFields: Array,
|
|
48
|
+
config: Object,
|
|
49
|
+
data: Object,
|
|
50
|
+
_shippingProviderList: Array,
|
|
51
|
+
_partners: Object
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get context() {
|
|
56
|
+
return {
|
|
57
|
+
title: i18next.t('title.manifest_report'),
|
|
58
|
+
exportable: {
|
|
59
|
+
name: i18next.t('title.manifest_report'),
|
|
60
|
+
data: this._exportableData.bind(this)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get _fromDateInput() {
|
|
66
|
+
return this.searchForm.shadowRoot.querySelector('input[name=fromDate]')
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get _toDateInput() {
|
|
70
|
+
return this.searchForm.shadowRoot.querySelector('input[name=toDate]')
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
get searchForm() {
|
|
74
|
+
return this.shadowRoot.querySelector('search-form')
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
get dataGrist() {
|
|
78
|
+
return this.shadowRoot.querySelector('data-grist')
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
get _bizplaceSelector() {
|
|
82
|
+
return this.searchForm.shadowRoot.querySelector('select[name=bizplace]')
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
render() {
|
|
86
|
+
return html`
|
|
87
|
+
<search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
|
|
88
|
+
|
|
89
|
+
<data-grist
|
|
90
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID' }
|
|
91
|
+
.config=${this.config}
|
|
92
|
+
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
93
|
+
></data-grist>
|
|
94
|
+
`
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
pageUpdated(changes, lifecycle) {
|
|
98
|
+
if (this.active) {
|
|
99
|
+
this.dataGrist.fetch()
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
constructor() {
|
|
104
|
+
super()
|
|
105
|
+
this._shippingProviderList = []
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async pageInitialized() {
|
|
109
|
+
const partners = await this._fetchPartners()
|
|
110
|
+
this._searchFields = [
|
|
111
|
+
{
|
|
112
|
+
label: i18next.t('field.company'),
|
|
113
|
+
name: 'bizplace',
|
|
114
|
+
type: 'select',
|
|
115
|
+
options:
|
|
116
|
+
partners?.length == 1
|
|
117
|
+
? [
|
|
118
|
+
{
|
|
119
|
+
name: `${partners[0].name} ${partners[0].description ? `(${partners[0].description})` : ''}`,
|
|
120
|
+
value: partners[0].id
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
: [
|
|
124
|
+
{ value: '' },
|
|
125
|
+
...partners
|
|
126
|
+
.map(partner => {
|
|
127
|
+
return {
|
|
128
|
+
name: `${partner.name} ${partner.description ? `(${partner.description})` : ''}`,
|
|
129
|
+
value: partner.id
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
.sort(this._compareValues('name', 'asc'))
|
|
133
|
+
],
|
|
134
|
+
props: { searchOper: 'eq' }
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
label: i18next.t('field.from_date'),
|
|
138
|
+
name: 'fromDate',
|
|
139
|
+
type: 'date',
|
|
140
|
+
props: {
|
|
141
|
+
searchOper: 'eq',
|
|
142
|
+
max: new Date().toISOString().split('T')[0]
|
|
143
|
+
},
|
|
144
|
+
value: (() => {
|
|
145
|
+
let date = new Date()
|
|
146
|
+
date.setMonth(date.getMonth() - 1)
|
|
147
|
+
return date.toISOString().split('T')[0]
|
|
148
|
+
})(),
|
|
149
|
+
handlers: { change: this._modifyDateRange.bind(this) }
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
label: i18next.t('field.to_date'),
|
|
153
|
+
name: 'toDate',
|
|
154
|
+
type: 'date',
|
|
155
|
+
props: {
|
|
156
|
+
searchOper: 'eq',
|
|
157
|
+
max: new Date().toISOString().split('T')[0],
|
|
158
|
+
min: (() => {
|
|
159
|
+
let date = new Date()
|
|
160
|
+
date.setMonth(date.getMonth() - 1)
|
|
161
|
+
return date.toISOString().split('T')[0]
|
|
162
|
+
})()
|
|
163
|
+
},
|
|
164
|
+
value: new Date().toISOString().split('T')[0]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
label: i18next.t('field.tracking_no'),
|
|
168
|
+
name: 'trackingNo',
|
|
169
|
+
type: 'text',
|
|
170
|
+
props: { searchOper: 'eq' }
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: i18next.t('field.ro_no'),
|
|
174
|
+
name: 'releaseGoodNo',
|
|
175
|
+
type: 'text',
|
|
176
|
+
props: { searchOper: 'eq' }
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
label: i18next.t('field.tracking_no'),
|
|
180
|
+
name: 'hasTrackingNo',
|
|
181
|
+
type: 'checkbox',
|
|
182
|
+
props: { searchOper: 'eq' },
|
|
183
|
+
attrs: ['indeterminate']
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
this.config = {
|
|
188
|
+
list: {
|
|
189
|
+
fields: [
|
|
190
|
+
'company',
|
|
191
|
+
'refNo',
|
|
192
|
+
'roNo',
|
|
193
|
+
'status',
|
|
194
|
+
'trackingNo',
|
|
195
|
+
'name',
|
|
196
|
+
'manifestedAt',
|
|
197
|
+
'manifestedBy',
|
|
198
|
+
'createdAt',
|
|
199
|
+
'transporter'
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
rows: { appendable: false, selectable: false },
|
|
203
|
+
columns: [
|
|
204
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
205
|
+
{
|
|
206
|
+
type: 'string',
|
|
207
|
+
name: 'bizplace',
|
|
208
|
+
header: i18next.t('field.company'),
|
|
209
|
+
label: true,
|
|
210
|
+
width: 130
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
type: 'string',
|
|
214
|
+
name: 'refNo',
|
|
215
|
+
header: i18next.t('field.ref_no'),
|
|
216
|
+
label: true,
|
|
217
|
+
width: 140
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
type: 'string',
|
|
221
|
+
name: 'roNo',
|
|
222
|
+
header: i18next.t('field.ro_no'),
|
|
223
|
+
label: true,
|
|
224
|
+
width: 150
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
type: 'string',
|
|
228
|
+
name: 'status',
|
|
229
|
+
header: i18next.t('field.status'),
|
|
230
|
+
label: true,
|
|
231
|
+
width: 120
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
type: 'string',
|
|
235
|
+
name: 'trackingNo',
|
|
236
|
+
header: i18next.t('field.tracking_no'),
|
|
237
|
+
label: true,
|
|
238
|
+
width: 120
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
type: 'string',
|
|
242
|
+
name: 'manifestNo',
|
|
243
|
+
header: i18next.t('field.manifest_no'),
|
|
244
|
+
label: true,
|
|
245
|
+
width: 140
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: 'datetime',
|
|
249
|
+
name: 'manifestedAt',
|
|
250
|
+
header: i18next.t('field.manifested_at'),
|
|
251
|
+
label: true,
|
|
252
|
+
width: 120
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
type: 'string',
|
|
256
|
+
name: 'manifestedBy',
|
|
257
|
+
header: i18next.t('field.manifested_by'),
|
|
258
|
+
label: true,
|
|
259
|
+
width: 130
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
type: 'datetime',
|
|
263
|
+
name: 'orderedAt',
|
|
264
|
+
header: i18next.t('field.created_at'),
|
|
265
|
+
label: true,
|
|
266
|
+
width: 120
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
type: 'string',
|
|
270
|
+
name: 'transporter',
|
|
271
|
+
header: i18next.t('field.transporter'),
|
|
272
|
+
label: true,
|
|
273
|
+
width: 120
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
async fetchHandler({ page, limit, sorters = [{ name: 'createdAt', desc: true }] }) {
|
|
280
|
+
try {
|
|
281
|
+
this._validate()
|
|
282
|
+
let filters = this.searchForm.queryFilters.map(filter => {
|
|
283
|
+
switch (filter.name) {
|
|
284
|
+
case 'fromDate':
|
|
285
|
+
let fromDt = new Date(filter.value)
|
|
286
|
+
fromDt.setHours(0)
|
|
287
|
+
filter.value = fromDt.toISOString()
|
|
288
|
+
break
|
|
289
|
+
case 'toDate':
|
|
290
|
+
let toDt = new Date(filter.value)
|
|
291
|
+
toDt.setHours(23, 59, 59)
|
|
292
|
+
filter.value = toDt.toISOString()
|
|
293
|
+
break
|
|
294
|
+
default:
|
|
295
|
+
break
|
|
296
|
+
}
|
|
297
|
+
return filter
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
const response = await client.query({
|
|
301
|
+
query: gql`
|
|
302
|
+
query manifestReport($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
303
|
+
manifestReport(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
304
|
+
items {
|
|
305
|
+
bizplace
|
|
306
|
+
refNo
|
|
307
|
+
roNo
|
|
308
|
+
status
|
|
309
|
+
trackingNo
|
|
310
|
+
manifestNo
|
|
311
|
+
manifestedAt
|
|
312
|
+
manifestedBy
|
|
313
|
+
orderedAt
|
|
314
|
+
transporter
|
|
315
|
+
}
|
|
316
|
+
total
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
`,
|
|
320
|
+
variables: { filters, pagination: { page, limit }, sortings: sorters },
|
|
321
|
+
context: gqlContext()
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
if (!response.errors) {
|
|
325
|
+
return {
|
|
326
|
+
total: response.data.manifestReport.total || 0,
|
|
327
|
+
records: response.data.manifestReport.items || []
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
} catch(e) {
|
|
331
|
+
this._showToast(e)
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
async _fetchPartners() {
|
|
336
|
+
const filters = []
|
|
337
|
+
const response = await client.query({
|
|
338
|
+
query: gql`
|
|
339
|
+
query partnersBizplaces($filters: [Filter!]) {
|
|
340
|
+
partnersBizplaces(filters: $filters) {
|
|
341
|
+
items {
|
|
342
|
+
id
|
|
343
|
+
name
|
|
344
|
+
description
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
`,
|
|
349
|
+
variables: { filters }
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
if (!response.errors) {
|
|
353
|
+
return response.data.partnersBizplaces.items
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
_validate() {
|
|
358
|
+
if (!this.searchForm.shadowRoot.querySelector('form').checkValidity())
|
|
359
|
+
throw new Error(i18next.t('text.invalid_form_value'))
|
|
360
|
+
if (!this._bizplaceSelector.value) throw new Error(i18next.t('text.no_company_selected'))
|
|
361
|
+
if (!this._fromDateInput.value) throw new Error(i18next.t('text.from_date_is_empty'))
|
|
362
|
+
if (!this._toDateInput.value) throw new Error(i18next.t('text.to_date_is_empty'))
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
_compareValues(key, order = 'asc') {
|
|
366
|
+
return function innerSort(a, b) {
|
|
367
|
+
if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
|
|
368
|
+
return 0
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const varA = typeof a[key] === 'string' ? a[key].toUpperCase() : a[key]
|
|
372
|
+
const varB = typeof b[key] === 'string' ? b[key].toUpperCase() : b[key]
|
|
373
|
+
|
|
374
|
+
let comparison = 0
|
|
375
|
+
if (varA > varB) {
|
|
376
|
+
comparison = 1
|
|
377
|
+
} else if (varA < varB) {
|
|
378
|
+
comparison = -1
|
|
379
|
+
}
|
|
380
|
+
return order === 'desc' ? comparison * -1 : comparison
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
_modifyDateRange(e) {
|
|
385
|
+
const fromDate = e.currentTarget.value
|
|
386
|
+
if (fromDate == '') return
|
|
387
|
+
if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
|
|
388
|
+
|
|
389
|
+
let min = new Date(fromDate)
|
|
390
|
+
let max = new Date(fromDate)
|
|
391
|
+
max.setMonth(max.getMonth() + 3)
|
|
392
|
+
|
|
393
|
+
let today = new Date()
|
|
394
|
+
today.setHours(0, 0, 0, 0)
|
|
395
|
+
|
|
396
|
+
min = min.toISOString().split('T')[0]
|
|
397
|
+
max = max.toISOString().split('T')[0]
|
|
398
|
+
|
|
399
|
+
if (this._toDateInput.value > max) this._toDateInput.value = max
|
|
400
|
+
|
|
401
|
+
this._toDateInput.min = min
|
|
402
|
+
this._toDateInput.max = max
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
async _exportableData() {
|
|
406
|
+
try {
|
|
407
|
+
var headerSetting = [
|
|
408
|
+
{ header: i18next.t('field.company'), key: 'bizplace', width: 40, type: 'string' },
|
|
409
|
+
{ header: i18next.t('field.ref_no'), key: 'refNo', width: 20, type: 'string' },
|
|
410
|
+
{ header: i18next.t('field.ro_no'), key: 'roNo', width: 30, type: 'string' },
|
|
411
|
+
{ header: i18next.t('field.status'), key: 'status', width: 15, type: 'string' },
|
|
412
|
+
{ header: i18next.t('field.tracking_no'), key: 'trackingNo', width: 15, type: 'string' },
|
|
413
|
+
{ header: i18next.t('field.manifest_no'), key: 'manifestNo', width: 20, type: 'string' },
|
|
414
|
+
{ header: i18next.t('field.manifested_at'), key: 'manifestedAt', width: 20, type: 'string' },
|
|
415
|
+
{ header: i18next.t('field.manifested_by'), key: 'manifestedBy', width: 20, type: 'string' },
|
|
416
|
+
{ header: i18next.t('field.created_at'), key: 'orderedAt', width: 20, type: 'string' },
|
|
417
|
+
{ header: i18next.t('field.transporter'), key: 'transporter', width: 20, type: 'string' },
|
|
418
|
+
]
|
|
419
|
+
|
|
420
|
+
var exportData = {
|
|
421
|
+
header: [...headerSetting],
|
|
422
|
+
data: (await this.fetchHandler({ page: 1, limit: 999999})).records.map(itm => {
|
|
423
|
+
return {
|
|
424
|
+
...itm,
|
|
425
|
+
manifestedAt: itm.manifestedAt ? new Date(parseInt(itm.manifestedAt)).toLocaleString() : '',
|
|
426
|
+
orderedAt: itm.orderedAt ? new Date(parseInt(itm.orderedAt)).toLocaleString() : ''
|
|
427
|
+
}
|
|
428
|
+
})
|
|
429
|
+
}
|
|
430
|
+
return exportData
|
|
431
|
+
} catch (e) {
|
|
432
|
+
this._showToast(e)
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
_showToast({ type, message }) {
|
|
437
|
+
document.dispatchEvent(
|
|
438
|
+
new CustomEvent('notify', {
|
|
439
|
+
detail: {
|
|
440
|
+
type,
|
|
441
|
+
message
|
|
442
|
+
}
|
|
443
|
+
})
|
|
444
|
+
)
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
customElements.define('manifest-report', ManifestReport)
|
package/client/route.js
CHANGED
|
@@ -523,6 +523,10 @@ export default function route(page) {
|
|
|
523
523
|
import('./pages/report/analysis-picking-packing-report')
|
|
524
524
|
return page
|
|
525
525
|
|
|
526
|
+
case 'manifest_report':
|
|
527
|
+
import('./pages/report/manifest-report')
|
|
528
|
+
return page
|
|
529
|
+
|
|
526
530
|
case 'replenishment_report':
|
|
527
531
|
import('./pages/report/replenishment-report')
|
|
528
532
|
return page
|
|
@@ -29,11 +29,12 @@ exports.inventoryExpiryMonitorResolver = {
|
|
|
29
29
|
else
|
|
30
30
|
throw new Error('invalid bizplaceId');
|
|
31
31
|
const expInventories = await tx.query(`
|
|
32
|
-
SELECT "location", sum("expired") AS "expired", sum("sixMonths") AS "sixMonths", sum("nineMonths") AS "nineMonths" FROM (
|
|
32
|
+
SELECT "location", sum("expired") AS "expired", SUM("threeMonths") AS "threeMonths", sum("sixMonths") AS "sixMonths", sum("nineMonths") AS "nineMonths" FROM (
|
|
33
33
|
SELECT
|
|
34
34
|
CASE WHEN l.TYPE IN ('QUARANTINE','RESERVE') THEN 'QUARANTINED' ELSE 'IN SHELF' END AS "location",
|
|
35
35
|
CASE WHEN i.expiration_date - now()::date <= 0 THEN 1 ELSE 0 END AS "expired",
|
|
36
|
-
CASE WHEN i.expiration_date - now()::date > 0 AND i.expiration_date - now()::date <=
|
|
36
|
+
CASE WHEN i.expiration_date - now()::date > 0 AND i.expiration_date - now()::date <= 90 THEN 1 ELSE 0 END AS "threeMonths",
|
|
37
|
+
CASE WHEN i.expiration_date - now()::date > 90 AND i.expiration_date - now()::date <= 180 THEN 1 ELSE 0 END AS "sixMonths",
|
|
37
38
|
CASE WHEN i.expiration_date - now()::date > 180 AND i.expiration_date - now()::date <= 270 THEN 1 ELSE 0 END AS "nineMonths"
|
|
38
39
|
FROM inventories i
|
|
39
40
|
INNER JOIN locations l ON i.location_id = l.id
|
|
@@ -41,7 +42,7 @@ exports.inventoryExpiryMonitorResolver = {
|
|
|
41
42
|
AND i.expiration_date NOTNULL
|
|
42
43
|
AND i.status = 'STORED'
|
|
43
44
|
AND i.domain_id = $1
|
|
44
|
-
AND i.bizplace_id
|
|
45
|
+
AND i.bizplace_id in (${bizplaceIds})
|
|
45
46
|
) AS foo
|
|
46
47
|
GROUP BY "location"
|
|
47
48
|
`, [domain.id]);
|
|
@@ -59,6 +60,6 @@ function getExpiryCountByStatus(expInventories, location) {
|
|
|
59
60
|
return inv;
|
|
60
61
|
})(matchedInv);
|
|
61
62
|
else
|
|
62
|
-
return { expired: 0, sixMonths: 0, nineMonths: 0 };
|
|
63
|
+
return { expired: 0, threeMonths: 0, sixMonths: 0, nineMonths: 0 };
|
|
63
64
|
}
|
|
64
65
|
//# sourceMappingURL=inventory-expiry-monitor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inventory-expiry-monitor.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/dashboard/inventory-expiry-monitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"inventory-expiry-monitor.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/dashboard/inventory-expiry-monitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,uDAAkE;AAMrD,QAAA,8BAA8B,GAAG;IAC5C,KAAK,CAAC,sBAAsB,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;;QAClE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IACtD,IAAI,UAAU,GAAQ,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAA;IAE1E,IAAI,UAAU;QAAE,OAAO,CAAC,CAAC,EAAoB,EAAE,EAAE;gBAAxB,EAAE,QAAQ,OAAU,EAAL,GAAG,cAAlB,YAAoB,CAAF;YAAO,OAAA,GAAG,CAAA;SAAA,CAAC,CAAC,UAAU,CAAC,CAAA;;QAC7D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAA;AACzE,CAAC"}
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Query = void 0;
|
|
4
4
|
const analysis_picking_packing_report_1 = require("./analysis-picking-packing-report");
|
|
5
5
|
const costing_report_1 = require("./costing-report");
|
|
6
|
+
const cycle_count_report_1 = require("./cycle-count-report");
|
|
6
7
|
const inbound_order_details_report_1 = require("./inbound-order-details-report");
|
|
7
8
|
const inbound_serial_number_report_1 = require("./inbound-serial-number-report");
|
|
9
|
+
const manifest_report_1 = require("./manifest-report");
|
|
8
10
|
const non_loaded_inventory_report_1 = require("./non-loaded-inventory-report");
|
|
9
11
|
const outbound_order_details_report_1 = require("./outbound-order-details-report");
|
|
10
12
|
const outbound_serial_number_report_1 = require("./outbound-serial-number-report");
|
|
@@ -13,6 +15,5 @@ const release_inventory_report_1 = require("./release-inventory-report");
|
|
|
13
15
|
const shortage_report_1 = require("./shortage-report");
|
|
14
16
|
const tote_loading_qc_report_1 = require("./tote-loading-qc-report");
|
|
15
17
|
const vas_report_1 = require("./vas-report");
|
|
16
|
-
|
|
17
|
-
exports.Query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, inbound_serial_number_report_1.inboundSerialNumberReport), outbound_serial_number_report_1.outboundSerialNumberReport), costing_report_1.costingReport), inbound_order_details_report_1.inboundOrderDetailsReport), outbound_order_details_report_1.outboundOrderDetailsReport), product_label_report_1.productLabelReport), release_inventory_report_1.releaseInventoryReport), shortage_report_1.shortageReport), tote_loading_qc_report_1.loadingQcReport), vas_report_1.orderVasReport), vas_report_1.vasReport), analysis_picking_packing_report_1.analysisPickingPackingReport), cycle_count_report_1.cycleCountReport), non_loaded_inventory_report_1.nonLoadedOrderInventoriesReport);
|
|
18
|
+
exports.Query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, inbound_serial_number_report_1.inboundSerialNumberReport), outbound_serial_number_report_1.outboundSerialNumberReport), costing_report_1.costingReport), inbound_order_details_report_1.inboundOrderDetailsReport), outbound_order_details_report_1.outboundOrderDetailsReport), product_label_report_1.productLabelReport), release_inventory_report_1.releaseInventoryReport), shortage_report_1.shortageReport), tote_loading_qc_report_1.loadingQcReport), vas_report_1.orderVasReport), vas_report_1.vasReport), analysis_picking_packing_report_1.analysisPickingPackingReport), cycle_count_report_1.cycleCountReport), non_loaded_inventory_report_1.nonLoadedOrderInventoriesReport), manifest_report_1.manifestReport);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/index.ts"],"names":[],"mappings":";;;AAAA,uFAAgF;AAChF,qDAAgD;AAChD,iFAA0E;AAC1E,iFAA0E;AAC1E,+EAA+E;AAC/E,mFAA4E;AAC5E,mFAA4E;AAC5E,iEAA2D;AAC3D,yEAAmE;AACnE,uDAAkD;AAClD,qEAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/index.ts"],"names":[],"mappings":";;;AAAA,uFAAgF;AAChF,qDAAgD;AAChD,6DAAuD;AACvD,iFAA0E;AAC1E,iFAA0E;AAC1E,uDAAkD;AAClD,+EAA+E;AAC/E,mFAA4E;AAC5E,mFAA4E;AAC5E,iEAA2D;AAC3D,yEAAmE;AACnE,uDAAkD;AAClD,qEAA0D;AAC1D,6CAGqB;AAER,QAAA,KAAK,yNACb,wDAAyB,GACzB,0DAA0B,GAC1B,8BAAa,GACb,wDAAyB,GACzB,0DAA0B,GAC1B,yCAAkB,GAClB,iDAAsB,GACtB,gCAAc,GACd,wCAAe,GACf,2BAAc,GACd,sBAAS,GACT,8DAA4B,GAC5B,qCAAgB,GAChB,6DAA+B,GAC/B,gCAAc,EAClB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.manifestReport = void 0;
|
|
4
|
+
exports.manifestReport = {
|
|
5
|
+
async manifestReport(_, params, context) {
|
|
6
|
+
try {
|
|
7
|
+
const { tx } = context.state;
|
|
8
|
+
let bizplace = params.filters.find(items => items.name === 'bizplace');
|
|
9
|
+
let trackingNo = params.filters.findIndex(items => items.name === 'trackingNo');
|
|
10
|
+
let releaseGoodNo = params.filters.find(items => items.name === 'releaseGoodNo');
|
|
11
|
+
let fromDate = params.filters.find(items => items.name === 'fromDate');
|
|
12
|
+
let toDate = params.filters.find(items => items.name === 'toDate');
|
|
13
|
+
let hasTrackingNo = params.filters.find(items => items.name === 'hasTrackingNo');
|
|
14
|
+
if (!bizplace)
|
|
15
|
+
throw 'Invalid input';
|
|
16
|
+
let hasTrackingNoFilter = '';
|
|
17
|
+
if ((hasTrackingNo === null || hasTrackingNo === void 0 ? void 0 : hasTrackingNo.value) == true) {
|
|
18
|
+
hasTrackingNoFilter += `AND op.tracking_no NOTNULL`;
|
|
19
|
+
}
|
|
20
|
+
else if ((hasTrackingNo === null || hasTrackingNo === void 0 ? void 0 : hasTrackingNo.value) == false) {
|
|
21
|
+
hasTrackingNoFilter += `AND op.tracking_no ISNULL`;
|
|
22
|
+
}
|
|
23
|
+
let releaseGoodFilter = '';
|
|
24
|
+
if (releaseGoodNo) {
|
|
25
|
+
releaseGoodFilter += `AND rg.name = '${releaseGoodNo.value}'`;
|
|
26
|
+
}
|
|
27
|
+
let trackingNoFilterValue;
|
|
28
|
+
let trackingNoFilter = '';
|
|
29
|
+
if (trackingNo >= 0) {
|
|
30
|
+
trackingNoFilterValue = params.filters[trackingNo].value
|
|
31
|
+
.split(',')
|
|
32
|
+
.map(value => `'${value.trim().toUpperCase()}'`);
|
|
33
|
+
params.filters.splice(trackingNo, 1);
|
|
34
|
+
trackingNoFilter += `AND op.tracking_no in (${trackingNoFilterValue})`;
|
|
35
|
+
}
|
|
36
|
+
await tx.query(`
|
|
37
|
+
CREATE TEMP TABLE manifest_report ON COMMIT DROP AS (
|
|
38
|
+
SELECT
|
|
39
|
+
rg.created_at AS "ordered_at",
|
|
40
|
+
rg.status,
|
|
41
|
+
op.tracking_no,
|
|
42
|
+
m.name AS "manifest_no",
|
|
43
|
+
m.created_at AS "manifested_at",
|
|
44
|
+
op.transporter AS "transporter",
|
|
45
|
+
u.name AS "manifested_by",
|
|
46
|
+
b.name AS "company",
|
|
47
|
+
rg.ref_no AS "ref_no",
|
|
48
|
+
rg.name AS "ro_no"
|
|
49
|
+
FROM order_packages op
|
|
50
|
+
LEFT JOIN
|
|
51
|
+
manifests m on m.id = op.manifest_id
|
|
52
|
+
LEFT JOIN
|
|
53
|
+
users u on u.id = op.manifested_by_id
|
|
54
|
+
INNER JOIN
|
|
55
|
+
bizplaces b on op.bizplace_id = b.id
|
|
56
|
+
INNER JOIN
|
|
57
|
+
release_goods rg on op.release_good_id = rg.id
|
|
58
|
+
WHERE
|
|
59
|
+
op.domain_id = $1
|
|
60
|
+
AND op.bizplace_id = '${bizplace.value}'
|
|
61
|
+
AND op.created_at >= $2
|
|
62
|
+
AND op.created_at <= $3
|
|
63
|
+
${releaseGoodFilter}
|
|
64
|
+
${trackingNoFilter}
|
|
65
|
+
${hasTrackingNoFilter}
|
|
66
|
+
)
|
|
67
|
+
`, [context.state.domain.id, fromDate.value, toDate.value]);
|
|
68
|
+
const total = await tx.query(`
|
|
69
|
+
SELECT count(*) FROM manifest_report
|
|
70
|
+
`);
|
|
71
|
+
const result = await tx.query(`
|
|
72
|
+
SELECT * FROM manifest_report
|
|
73
|
+
offset $1 limit $2
|
|
74
|
+
`, [(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]);
|
|
75
|
+
let items = result.map(itm => {
|
|
76
|
+
return {
|
|
77
|
+
bizplace: itm.company,
|
|
78
|
+
refNo: itm.ref_no,
|
|
79
|
+
roNo: itm.ro_no,
|
|
80
|
+
status: itm.status,
|
|
81
|
+
trackingNo: itm.tracking_no,
|
|
82
|
+
manifestNo: itm.manifest_no,
|
|
83
|
+
manifestedAt: itm.manifested_at,
|
|
84
|
+
manifestedBy: itm.manifested_by,
|
|
85
|
+
orderedAt: itm.ordered_at,
|
|
86
|
+
transporter: itm.transporter
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
return { items, total: total[0].count };
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
throw e;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=manifest-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-report.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/manifest-report.ts"],"names":[],"mappings":";;;AAIa,QAAA,cAAc,GAAG;IAC7B,KAAK,CAAC,cAAc,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QAC3D,IAAI;YACH,MAAM,EAAE,EAAE,EAAE,GAA0B,OAAO,CAAC,KAAK,CAAA;YACnD,IAAI,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,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,CAAC,aAAa;oBAC/B,YAAY,EAAE,GAAG,CAAC,aAAa;oBAC/B,SAAS,EAAE,GAAG,CAAC,UAAU;oBACzB,WAAW,EAAE,GAAG,CAAC,WAAW;iBAC5B,CAAA;YACF,CAAC,CAAC,CAAA;YAEF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAA;SACvC;QAAC,OAAO,CAAC,EAAE;YACX,MAAM,CAAC,CAAA;SACP;IACF,CAAC;CACD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inventory-expiry-counter.js","sourceRoot":"","sources":["../../../../server/graphql/types/dashboard/inventory-expiry-counter.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,sBAAsB,GAAG,IAAA,qBAAG,EAAA
|
|
1
|
+
{"version":3,"file":"inventory-expiry-counter.js","sourceRoot":"","sources":["../../../../server/graphql/types/dashboard/inventory-expiry-counter.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,sBAAsB,GAAG,IAAA,qBAAG,EAAA;;;;;;;CAOxC,CAAA"}
|