@things-factory/operato-wms 5.0.0-alpha.2 → 5.0.0-alpha.22
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/serial-number-list-popup.js +342 -0
- package/client/pages/inbound/unload-product.js +220 -41
- package/client/pages/inbound/unloaded-inventories-popup.js +7 -0
- package/client/pages/inventory/non-loaded-inventory.js +297 -0
- package/client/pages/order/release-order/b2b/b2b-order-list.js +41 -18
- package/client/pages/order/release-order/b2c/b2c-order-requests.js +40 -18
- package/client/pages/outbound/packing-product.js +88 -80
- package/client/pages/outbound/picking-product.js +61 -36
- package/client/pages/outbound/serial-number-popup.js +150 -64
- package/client/pages/report/inbound-serial-number-report.js +452 -0
- package/client/pages/report/outbound-order-details-report.js +64 -9
- package/client/pages/report/outbound-serial-number-report.js +467 -0
- package/client/route.js +11 -0
- package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js +111 -0
- package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js.map +1 -0
- package/dist-server/graphql/resolvers/reports/index.js +3 -1
- package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +53 -48
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js +118 -0
- package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js.map +1 -0
- package/dist-server/graphql/types/reports/inbound-serial-number-report-list.js +14 -0
- package/dist-server/graphql/types/reports/inbound-serial-number-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/inbound-serial-number-report.js +23 -0
- package/dist-server/graphql/types/reports/inbound-serial-number-report.js.map +1 -0
- package/dist-server/graphql/types/reports/index.js +10 -0
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/outbound-order-details-report.js +3 -0
- package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/types/reports/outbound-serial-number-report-list.js +14 -0
- package/dist-server/graphql/types/reports/outbound-serial-number-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/outbound-serial-number-report.js +25 -0
- package/dist-server/graphql/types/reports/outbound-serial-number-report.js.map +1 -0
- package/dist-server/migrations/1568858861188-SeedSetting.js +2 -1
- package/dist-server/migrations/1568858861188-SeedSetting.js.map +1 -1
- package/package.json +67 -66
- package/server/graphql/resolvers/reports/inbound-serial-number-report.ts +128 -0
- package/server/graphql/resolvers/reports/index.ts +5 -0
- package/server/graphql/resolvers/reports/outbound-order-details-report.ts +54 -48
- package/server/graphql/resolvers/reports/outbound-serial-number-report.ts +135 -0
- package/server/graphql/types/reports/inbound-serial-number-report-list.ts +8 -0
- package/server/graphql/types/reports/inbound-serial-number-report.ts +17 -0
- package/server/graphql/types/reports/index.ts +11 -0
- package/server/graphql/types/reports/outbound-order-details-report.ts +3 -0
- package/server/graphql/types/reports/outbound-serial-number-report-list.ts +8 -0
- package/server/graphql/types/reports/outbound-serial-number-report.ts +19 -0
- package/server/migrations/1568858861188-SeedSetting.ts +5 -2
- package/things-factory.config.js +12 -0
- package/translations/en.json +26 -6
- package/translations/ko.json +21 -2
- package/translations/ms.json +21 -2
- package/translations/zh.json +25 -6
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
import '@things-factory/form-ui'
|
|
2
|
+
import '@things-factory/grist-ui'
|
|
3
|
+
import '../inventory/inventory-by-product-detail'
|
|
4
|
+
|
|
5
|
+
import gql from 'graphql-tag'
|
|
6
|
+
import { css, html } from 'lit-element'
|
|
7
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
8
|
+
|
|
9
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
10
|
+
import { client, gqlContext, PageView, store } from '@things-factory/shell'
|
|
11
|
+
import { flattenObject, isMobileDevice } from '@things-factory/utils'
|
|
12
|
+
|
|
13
|
+
class OutboundSerialNumberReport extends connect(store)(localize(i18next)(PageView)) {
|
|
14
|
+
static get styles() {
|
|
15
|
+
return css`
|
|
16
|
+
:host {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
data-grist {
|
|
23
|
+
overflow-y: auto;
|
|
24
|
+
flex: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.summary {
|
|
28
|
+
background-color: var(--main-section-background-color);
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
overflow-y: auto;
|
|
32
|
+
align-items: flex-end;
|
|
33
|
+
padding: var(--data-list-item-padding);
|
|
34
|
+
display: grid;
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
color: #394e64;
|
|
37
|
+
grid-template-columns: repeat(2, 1fr);
|
|
38
|
+
grid-auto-rows: minmax(24px, auto);
|
|
39
|
+
}
|
|
40
|
+
`
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static get properties() {
|
|
44
|
+
return {
|
|
45
|
+
_searchFields: Object,
|
|
46
|
+
_config: Object,
|
|
47
|
+
_partners: Object,
|
|
48
|
+
_gristData: Object,
|
|
49
|
+
data: Object
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get context() {
|
|
54
|
+
return {
|
|
55
|
+
title: i18next.t('title.outbound_serial_number_report'),
|
|
56
|
+
printable: {
|
|
57
|
+
accept: ['preview'],
|
|
58
|
+
content: this
|
|
59
|
+
},
|
|
60
|
+
help: 'operato-wms/report/outbound-serial-number-report'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get dataGrist() {
|
|
65
|
+
return this.shadowRoot.querySelector('data-grist')
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get searchForm() {
|
|
69
|
+
return this.shadowRoot.querySelector('search-form')
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
get _bizplaceSelector() {
|
|
73
|
+
return this.searchForm.shadowRoot.querySelector('select[name=bizplace]')
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
get _fromDateInput() {
|
|
77
|
+
return this.searchForm.shadowRoot.querySelector('input[name=fromDate]')
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get _toDateInput() {
|
|
81
|
+
return this.searchForm.shadowRoot.querySelector('input[name=toDate]')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
render() {
|
|
85
|
+
return html`
|
|
86
|
+
<search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
|
|
87
|
+
|
|
88
|
+
<data-grist
|
|
89
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
90
|
+
.config=${this._config}
|
|
91
|
+
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
92
|
+
></data-grist>
|
|
93
|
+
`
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
get searchFields() {
|
|
97
|
+
return [
|
|
98
|
+
{
|
|
99
|
+
label: i18next.t('field.company'),
|
|
100
|
+
name: 'bizplace',
|
|
101
|
+
type: 'select',
|
|
102
|
+
options: [
|
|
103
|
+
{ value: '' },
|
|
104
|
+
...this._partners
|
|
105
|
+
.map(partner => {
|
|
106
|
+
return {
|
|
107
|
+
name: `${partner.name} ${partner.description ? `(${partner.description})` : ''}`,
|
|
108
|
+
value: partner.id
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
.sort(this._compareValues('name', 'asc'))
|
|
112
|
+
],
|
|
113
|
+
props: { searchOper: 'eq' }
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: i18next.t('field.from_date'),
|
|
117
|
+
name: 'fromDate',
|
|
118
|
+
type: 'date',
|
|
119
|
+
props: {
|
|
120
|
+
searchOper: 'eq',
|
|
121
|
+
max: new Date().toISOString().split('T')[0]
|
|
122
|
+
},
|
|
123
|
+
value: (() => {
|
|
124
|
+
let date = new Date()
|
|
125
|
+
date.setMonth(date.getMonth() - 1)
|
|
126
|
+
return date.toISOString().split('T')[0]
|
|
127
|
+
})(),
|
|
128
|
+
handlers: { change: this._modifyDateRange.bind(this) }
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
label: i18next.t('field.to_date'),
|
|
132
|
+
name: 'toDate',
|
|
133
|
+
type: 'date',
|
|
134
|
+
props: {
|
|
135
|
+
searchOper: 'eq',
|
|
136
|
+
min: (() => {
|
|
137
|
+
let date = new Date()
|
|
138
|
+
date.setMonth(date.getMonth() - 1)
|
|
139
|
+
return date.toISOString().split('T')[0]
|
|
140
|
+
})()
|
|
141
|
+
},
|
|
142
|
+
value: new Date().toISOString().split('T')[0],
|
|
143
|
+
handlers: { change: this._submit.bind(this) }
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
get reportConfig() {
|
|
149
|
+
let columns = [
|
|
150
|
+
{
|
|
151
|
+
type: 'number',
|
|
152
|
+
name: 'no',
|
|
153
|
+
header: i18next.t('field.no'),
|
|
154
|
+
width: 50
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
type: 'string',
|
|
158
|
+
name: 'bizplace|name',
|
|
159
|
+
header: i18next.t('field.company'),
|
|
160
|
+
width: 200
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
type: 'string',
|
|
164
|
+
name: 'orderNo',
|
|
165
|
+
header: i18next.t('field.order_no'),
|
|
166
|
+
width: 200
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
type: 'string',
|
|
170
|
+
name: 'refNo1',
|
|
171
|
+
header: i18next.t('field.ref_no'),
|
|
172
|
+
width: 150
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
type: 'string',
|
|
176
|
+
name: 'refNo2',
|
|
177
|
+
header: i18next.t('field.ref_no_2'),
|
|
178
|
+
width: 150
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: 'string',
|
|
182
|
+
name: 'refNo3',
|
|
183
|
+
header: i18next.t('field.ref_no_3'),
|
|
184
|
+
width: 150
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: 'string',
|
|
188
|
+
name: 'attentionTo',
|
|
189
|
+
header: i18next.t('field.attention_to'),
|
|
190
|
+
width: 200
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
type: 'string',
|
|
194
|
+
name: 'fullDeliveryAddress',
|
|
195
|
+
header: i18next.t('field.full_delivery_address'),
|
|
196
|
+
width: 200
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
type: 'string',
|
|
200
|
+
name: 'palletId',
|
|
201
|
+
header: i18next.t('field.lot_id'),
|
|
202
|
+
width: 200
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
type: 'string',
|
|
206
|
+
name: 'cartonId',
|
|
207
|
+
header: i18next.t('field.carton_id'),
|
|
208
|
+
width: 200
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
type: 'string',
|
|
212
|
+
name: 'product|sku',
|
|
213
|
+
header: i18next.t('field.sku'),
|
|
214
|
+
width: 150
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
type: 'string',
|
|
218
|
+
name: 'product|brandSku',
|
|
219
|
+
header: i18next.t('field.brand_sku'),
|
|
220
|
+
width: 150
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
type: 'string',
|
|
224
|
+
name: 'product|name',
|
|
225
|
+
header: i18next.t('field.product_name'),
|
|
226
|
+
width: 200
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
type: 'string',
|
|
230
|
+
name: 'product|description',
|
|
231
|
+
header: i18next.t('field.product_description'),
|
|
232
|
+
width: 300
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
type: 'string',
|
|
236
|
+
name: 'product|type',
|
|
237
|
+
header: i18next.t('field.product_type'),
|
|
238
|
+
width: 150
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
type: 'number',
|
|
242
|
+
name: 'product|volume',
|
|
243
|
+
header: i18next.t('field.volume'),
|
|
244
|
+
width: 150
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
type: 'string',
|
|
248
|
+
name: 'serialNumber',
|
|
249
|
+
header: i18next.t('field.serial_number'),
|
|
250
|
+
width: 150
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
type: 'datetime',
|
|
254
|
+
name: 'etd',
|
|
255
|
+
header: i18next.t('field.etd'),
|
|
256
|
+
width: 170
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
let list = {
|
|
260
|
+
fields: [
|
|
261
|
+
'no',
|
|
262
|
+
'bizplace|name',
|
|
263
|
+
'orderNo',
|
|
264
|
+
'refNo1',
|
|
265
|
+
'refNo2',
|
|
266
|
+
'refNo3',
|
|
267
|
+
'fullDeliveryAddress',
|
|
268
|
+
'palletId',
|
|
269
|
+
'cartonId',
|
|
270
|
+
'product|sku',
|
|
271
|
+
'product|brandSku',
|
|
272
|
+
'product|name',
|
|
273
|
+
'product|description',
|
|
274
|
+
'product|type',
|
|
275
|
+
'product|volume',
|
|
276
|
+
'serialNumber',
|
|
277
|
+
'etd'
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return {
|
|
282
|
+
columns: columns,
|
|
283
|
+
list,
|
|
284
|
+
pagination: { limit: 100, pages: [50, 100, 200, 500, 1000] },
|
|
285
|
+
rows: {
|
|
286
|
+
selectable: false,
|
|
287
|
+
insertable: false,
|
|
288
|
+
appendable: false
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
async pageInitialized() {
|
|
294
|
+
this._gristData = { total: 0, records: [] }
|
|
295
|
+
this._partners = [...(await this._fetchPartners())]
|
|
296
|
+
|
|
297
|
+
this._searchFields = this.searchFields
|
|
298
|
+
this._config = this.reportConfig
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
async pageUpdated(changes, lifecycle) {
|
|
302
|
+
if (this.active) {
|
|
303
|
+
this.dataGrist.fetch()
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async fetchHandler({ page, limit, sorters = [] }) {
|
|
308
|
+
try {
|
|
309
|
+
this._validate()
|
|
310
|
+
let filters = this.searchForm.queryFilters.map(filter => {
|
|
311
|
+
switch (filter.name) {
|
|
312
|
+
case 'fromDate':
|
|
313
|
+
let fromDt = new Date(filter.value)
|
|
314
|
+
fromDt.setHours(0)
|
|
315
|
+
filter.value = fromDt.toISOString()
|
|
316
|
+
break
|
|
317
|
+
case 'toDate':
|
|
318
|
+
let toDt = new Date(filter.value)
|
|
319
|
+
toDt.setHours(23, 59, 59)
|
|
320
|
+
filter.value = toDt.toISOString()
|
|
321
|
+
break
|
|
322
|
+
default:
|
|
323
|
+
break
|
|
324
|
+
}
|
|
325
|
+
return filter
|
|
326
|
+
})
|
|
327
|
+
|
|
328
|
+
const pagination = { page, limit }
|
|
329
|
+
const sortings = sorters
|
|
330
|
+
|
|
331
|
+
const response = await client.query({
|
|
332
|
+
query: gql`
|
|
333
|
+
query outboundSerialNumberReport($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
334
|
+
outboundSerialNumberReport(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
335
|
+
items {
|
|
336
|
+
no
|
|
337
|
+
bizplace {
|
|
338
|
+
name
|
|
339
|
+
description
|
|
340
|
+
}
|
|
341
|
+
orderNo
|
|
342
|
+
refNo1
|
|
343
|
+
refNo2
|
|
344
|
+
refNo3
|
|
345
|
+
fullDeliveryAddress
|
|
346
|
+
attentionTo
|
|
347
|
+
palletId
|
|
348
|
+
cartonId
|
|
349
|
+
product {
|
|
350
|
+
id
|
|
351
|
+
sku
|
|
352
|
+
brandSku
|
|
353
|
+
name
|
|
354
|
+
description
|
|
355
|
+
type
|
|
356
|
+
volume
|
|
357
|
+
}
|
|
358
|
+
serialNumber
|
|
359
|
+
etd
|
|
360
|
+
}
|
|
361
|
+
total
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
`,
|
|
365
|
+
variables: { filters, pagination, sortings },
|
|
366
|
+
context: gqlContext()
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
const data = {
|
|
370
|
+
total: response.data.outboundSerialNumberReport.total,
|
|
371
|
+
records:
|
|
372
|
+
response.data.outboundSerialNumberReport.items.map(itm => {
|
|
373
|
+
return flattenObject({ ...itm, bizplace: { name: `${itm.bizplace.name} ${itm.bizplace.description}` } })
|
|
374
|
+
}) || []
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
this._gristData = {
|
|
378
|
+
...data
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
return data
|
|
382
|
+
} catch (e) {
|
|
383
|
+
this._showToast(e)
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
async _fetchPartners() {
|
|
388
|
+
const filters = []
|
|
389
|
+
const response = await client.query({
|
|
390
|
+
query: gql`
|
|
391
|
+
query partnersBizplaces($filters: [Filter!]) {
|
|
392
|
+
partnersBizplaces(filters: $filters) {
|
|
393
|
+
items {
|
|
394
|
+
id
|
|
395
|
+
name
|
|
396
|
+
description
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
`,
|
|
401
|
+
variables: { filters }
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
if (!response.errors) {
|
|
405
|
+
return response.data.partnersBizplaces.items
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
_validate() {
|
|
409
|
+
if (!this.searchForm.shadowRoot.querySelector('form').checkValidity())
|
|
410
|
+
throw new Error(i18next.t('text.invalid_form_value'))
|
|
411
|
+
if (!this._bizplaceSelector.value) throw new Error(i18next.t('text.no_company_selected'))
|
|
412
|
+
if (!this._fromDateInput.value) throw new Error(i18next.t('text.from_date_is_empty'))
|
|
413
|
+
if (!this._toDateInput.value) throw new Error(i18next.t('text.to_date_is_empty'))
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
_compareValues(key, order = 'asc') {
|
|
417
|
+
return function innerSort(a, b) {
|
|
418
|
+
if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
|
|
419
|
+
return 0
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
const varA = typeof a[key] === 'string' ? a[key].toUpperCase() : a[key]
|
|
423
|
+
const varB = typeof b[key] === 'string' ? b[key].toUpperCase() : b[key]
|
|
424
|
+
|
|
425
|
+
let comparison = 0
|
|
426
|
+
if (varA > varB) {
|
|
427
|
+
comparison = 1
|
|
428
|
+
} else if (varA < varB) {
|
|
429
|
+
comparison = -1
|
|
430
|
+
}
|
|
431
|
+
return order === 'desc' ? comparison * -1 : comparison
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
_modifyDateRange(e) {
|
|
436
|
+
const fromDate = e.currentTarget.value
|
|
437
|
+
|
|
438
|
+
if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
|
|
439
|
+
|
|
440
|
+
let min = new Date(fromDate)
|
|
441
|
+
let today = new Date()
|
|
442
|
+
today.setHours(0, 0, 0, 0)
|
|
443
|
+
|
|
444
|
+
min = min.toISOString().split('T')[0]
|
|
445
|
+
|
|
446
|
+
this._toDateInput.min = min
|
|
447
|
+
this._submit()
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
_submit(e) {
|
|
451
|
+
this._config = { ...this.reportConfig }
|
|
452
|
+
this.searchForm.submit()
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
_showToast({ type, message }) {
|
|
456
|
+
document.dispatchEvent(
|
|
457
|
+
new CustomEvent('notify', {
|
|
458
|
+
detail: {
|
|
459
|
+
type,
|
|
460
|
+
message
|
|
461
|
+
}
|
|
462
|
+
})
|
|
463
|
+
)
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
window.customElements.define('outbound-serial-number-report', OutboundSerialNumberReport)
|
package/client/route.js
CHANGED
|
@@ -265,6 +265,10 @@ export default function route(page) {
|
|
|
265
265
|
import('./pages/inventory/inventory-adjustment-approval')
|
|
266
266
|
return page
|
|
267
267
|
|
|
268
|
+
case 'non_loaded_inventory':
|
|
269
|
+
import('./pages/inventory/non-loaded-inventory')
|
|
270
|
+
return page
|
|
271
|
+
|
|
268
272
|
case 'create_cycle_count':
|
|
269
273
|
import('./pages/inventory-check/create-cycle-count')
|
|
270
274
|
return page
|
|
@@ -452,6 +456,13 @@ export default function route(page) {
|
|
|
452
456
|
import('./pages/report/product-label-report')
|
|
453
457
|
return page
|
|
454
458
|
|
|
459
|
+
case 'inbound_serial_number_report':
|
|
460
|
+
import('./pages/report/inbound-serial-number-report')
|
|
461
|
+
return page
|
|
462
|
+
|
|
463
|
+
case 'outbound_serial_number_report':
|
|
464
|
+
import('./pages/report/outbound-serial-number-report')
|
|
465
|
+
return page
|
|
455
466
|
/**
|
|
456
467
|
* Custom ELCCL Menus Section
|
|
457
468
|
*/
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inboundSerialNumberReport = void 0;
|
|
4
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
5
|
+
const biz_base_1 = require("@things-factory/biz-base");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
exports.inboundSerialNumberReport = {
|
|
8
|
+
async inboundSerialNumberReport(_, params, context) {
|
|
9
|
+
try {
|
|
10
|
+
const { tx } = context.state;
|
|
11
|
+
let bizplaceFilter = { name: '', operator: '', value: '' };
|
|
12
|
+
let userFilter = params.filters.find(data => data.name === 'user');
|
|
13
|
+
let fromDate = params.filters.find(data => data.name === 'fromDate');
|
|
14
|
+
let toDate = params.filters.find(data => data.name === 'toDate');
|
|
15
|
+
let ganNo = params.filters.find(data => data.name === 'ganNo');
|
|
16
|
+
if (userFilter) {
|
|
17
|
+
const user = await tx.getRepository(auth_base_1.User).findOne({
|
|
18
|
+
where: { id: userFilter.value },
|
|
19
|
+
relations: ['bizplaces']
|
|
20
|
+
});
|
|
21
|
+
const bizplace = user.bizplaces[0];
|
|
22
|
+
if (!bizplace)
|
|
23
|
+
throw 'Invalid input';
|
|
24
|
+
bizplaceFilter = { name: 'bizplace', operator: 'eq', value: bizplace.id };
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
bizplaceFilter = params.filters.find(data => data.name === 'bizplace');
|
|
28
|
+
}
|
|
29
|
+
if (!bizplaceFilter || !fromDate || !toDate)
|
|
30
|
+
throw 'Invalid input';
|
|
31
|
+
const bizplace = await tx.getRepository(biz_base_1.Bizplace).findOne({
|
|
32
|
+
id: bizplaceFilter.value
|
|
33
|
+
});
|
|
34
|
+
await (0, utils_1.rawProductsQuery)(tx, params, bizplace);
|
|
35
|
+
let extraQueryFilters = '';
|
|
36
|
+
if (ganNo) {
|
|
37
|
+
extraQueryFilters = `${extraQueryFilters} and order_no like '%${ganNo.value}%' `;
|
|
38
|
+
}
|
|
39
|
+
await tx.query(`
|
|
40
|
+
create temp table temp_inbound_serial_number_report on commit drop as (
|
|
41
|
+
select * from (
|
|
42
|
+
select
|
|
43
|
+
row_number() over(partition by an."name" order by coalesce(w.started_at, ii.created_at), p.sku ) as "no",
|
|
44
|
+
case when "source" = 'ADJUSTMENT' then 'adjustment' else an."name" end as "order_no",
|
|
45
|
+
i.pallet_id, i.carton_id,an.ref_no, an.ref_no_2, an.ref_no_3,
|
|
46
|
+
p.id as "product_id", p.sku as "product_sku", p.brand_sku as "product_brand_sku",
|
|
47
|
+
p.name as "product_name", p.description as "product_description", p."type" as "product_type",
|
|
48
|
+
coalesce(pd.volume, '0') as "product_volume",
|
|
49
|
+
ii.serial_number,
|
|
50
|
+
coalesce(w.started_at,ii.created_at) as "etd"
|
|
51
|
+
from inventory_items ii
|
|
52
|
+
inner join inventories i on i.id = ii.inventory_id
|
|
53
|
+
inner join products p on p.id = i.product_id
|
|
54
|
+
left join product_details pd on pd.product_id = p.id and pd.packing_type = i.packing_type and pd.packing_size = i.packing_size
|
|
55
|
+
left join arrival_notices an on an.id = ii.inbound_order_id::uuid
|
|
56
|
+
left join worksheets w on w.arrival_notice_id = an.id and w.type = 'UNLOADING'
|
|
57
|
+
where
|
|
58
|
+
i.domain_id = $1 and i.bizplace_id = $2
|
|
59
|
+
and coalesce(w.started_at, ii.created_at) between $3 and $4
|
|
60
|
+
order by coalesce(w.started_at, ii.created_at), p.sku
|
|
61
|
+
) src
|
|
62
|
+
where 1=1
|
|
63
|
+
${extraQueryFilters}
|
|
64
|
+
)
|
|
65
|
+
`, [context.state.domain.id, bizplace.id, fromDate.value, toDate.value]);
|
|
66
|
+
const total = await tx.query(`
|
|
67
|
+
select count(*) from temp_inbound_serial_number_report
|
|
68
|
+
`);
|
|
69
|
+
const result = await tx.query(`
|
|
70
|
+
select *
|
|
71
|
+
from temp_inbound_serial_number_report
|
|
72
|
+
offset $1 limit $2
|
|
73
|
+
`, [(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]);
|
|
74
|
+
let items = result.map(itm => {
|
|
75
|
+
let data = {
|
|
76
|
+
no: itm.no,
|
|
77
|
+
bizplace: {
|
|
78
|
+
description: bizplace.description,
|
|
79
|
+
name: bizplace.name
|
|
80
|
+
},
|
|
81
|
+
palletId: itm.pallet_id,
|
|
82
|
+
cartonId: itm.carton_id,
|
|
83
|
+
orderNo: itm.order_no,
|
|
84
|
+
refNo1: itm.ref_no,
|
|
85
|
+
refNo2: itm.ref_no_2,
|
|
86
|
+
refNo3: itm.ref_no_3,
|
|
87
|
+
product: {
|
|
88
|
+
id: itm.product_id,
|
|
89
|
+
sku: itm.product_sku,
|
|
90
|
+
brandSku: itm.product_brand_sku,
|
|
91
|
+
name: itm.product_name,
|
|
92
|
+
description: itm.product_description,
|
|
93
|
+
type: itm.product_type,
|
|
94
|
+
volume: itm.product_volume
|
|
95
|
+
},
|
|
96
|
+
serialNumber: itm.serial_number,
|
|
97
|
+
etd: itm.etd
|
|
98
|
+
};
|
|
99
|
+
return data;
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
items,
|
|
103
|
+
total: total[0].count
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=inbound-serial-number-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbound-serial-number-report.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/inbound-serial-number-report.ts"],"names":[],"mappings":";;;AAEA,yDAAgD;AAChD,uDAAmD;AAGnD,0CAAiD;AAEpC,QAAA,yBAAyB,GAAG;IACvC,KAAK,CAAC,yBAAyB,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QACrE,IAAI;YACF,MAAM,EAAE,EAAE,EAAE,GAA0B,OAAO,CAAC,KAAK,CAAA;YACnD,IAAI,cAAc,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;YAC1D,IAAI,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAA;YAClE,IAAI,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;YACpE,IAAI,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAA;YAChE,IAAI,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAA;YAE9D,IAAI,UAAU,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;gBACL,KAAK;gBACL,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK;aACtB,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Query = void 0;
|
|
4
|
+
const inbound_serial_number_report_1 = require("./inbound-serial-number-report");
|
|
5
|
+
const outbound_serial_number_report_1 = require("./outbound-serial-number-report");
|
|
4
6
|
const inbound_order_details_report_1 = require("./inbound-order-details-report");
|
|
5
7
|
const outbound_order_details_report_1 = require("./outbound-order-details-report");
|
|
6
8
|
const product_label_report_1 = require("./product-label-report");
|
|
7
|
-
exports.Query = Object.assign(Object.assign(Object.assign({}, inbound_order_details_report_1.inboundOrderDetailsReport), outbound_order_details_report_1.outboundOrderDetailsReport), product_label_report_1.productLabelReport);
|
|
9
|
+
exports.Query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, inbound_serial_number_report_1.inboundSerialNumberReport), outbound_serial_number_report_1.outboundSerialNumberReport), inbound_order_details_report_1.inboundOrderDetailsReport), outbound_order_details_report_1.outboundOrderDetailsReport), product_label_report_1.productLabelReport);
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/index.ts"],"names":[],"mappings":";;;AAAA,iFAA0E;AAC1E,mFAA4E;AAC5E,iEAA2D;AAE9C,QAAA,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/index.ts"],"names":[],"mappings":";;;AAAA,iFAA0E;AAC1E,mFAA4E;AAE5E,iFAA0E;AAC1E,mFAA4E;AAC5E,iEAA2D;AAE9C,QAAA,KAAK,6EACb,wDAAyB,GACzB,0DAA0B,GAC1B,wDAAyB,GACzB,0DAA0B,GAC1B,yCAAkB,EACtB"}
|