@things-factory/operato-wms 4.3.301 → 4.3.303
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/inventory/onhand-inventory.js +23 -19
- package/client/pages/order/release-order/release-order-detail.js +57 -14
- package/client/pages/outbound/route-label-popup.js +56 -3
- package/client/pages/report/outbound-order-details-report.js +1 -0
- package/client/pages/report/shortage-report.js +475 -0
- package/client/route.js +4 -0
- 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/shortage-report.js +115 -0
- package/dist-server/graphql/resolvers/reports/shortage-report.js.map +1 -0
- package/dist-server/graphql/types/reports/index.js +5 -0
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/shortage-report-list.js +14 -0
- package/dist-server/graphql/types/reports/shortage-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/shortage-report-type.js +25 -0
- package/dist-server/graphql/types/reports/shortage-report-type.js.map +1 -0
- package/package.json +5 -5
- package/server/graphql/resolvers/reports/index.ts +6 -1
- package/server/graphql/resolvers/reports/shortage-report.ts +132 -0
- package/server/graphql/types/reports/index.ts +13 -2
- package/server/graphql/types/reports/shortage-report-list.ts +8 -0
- package/server/graphql/types/reports/shortage-report-type.ts +19 -0
- package/things-factory.config.js +6 -0
- package/translations/en.json +2 -0
- package/translations/ko.json +2 -0
- package/translations/ms.json +2 -0
- package/translations/zh.json +2 -0
|
@@ -0,0 +1,475 @@
|
|
|
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 {
|
|
7
|
+
css,
|
|
8
|
+
html
|
|
9
|
+
} from 'lit-element'
|
|
10
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
i18next,
|
|
14
|
+
localize
|
|
15
|
+
} from '@things-factory/i18n-base'
|
|
16
|
+
import {
|
|
17
|
+
client,
|
|
18
|
+
gqlContext,
|
|
19
|
+
PageView,
|
|
20
|
+
store
|
|
21
|
+
} from '@things-factory/shell'
|
|
22
|
+
// import { ScrollbarStyles } from '@things-factory/styles'
|
|
23
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
24
|
+
|
|
25
|
+
import { showToast } from '../../util'
|
|
26
|
+
|
|
27
|
+
class shortageReport extends connect(store)(localize(i18next)(PageView)){
|
|
28
|
+
static get styles(){
|
|
29
|
+
return [
|
|
30
|
+
// ScrollbarStyles,
|
|
31
|
+
css`
|
|
32
|
+
:host {
|
|
33
|
+
display:flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
width: 100%
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
data-grist{
|
|
39
|
+
overflow-y: auto;
|
|
40
|
+
flex: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.summary {
|
|
44
|
+
background-color: var(--main-section-background-color);
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
align-items: flex-end;
|
|
49
|
+
padding: var(--data-list-item-padding);
|
|
50
|
+
display: grid;
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
color: #394e64;
|
|
53
|
+
grid-template-columns: repeat(2, 1fr);
|
|
54
|
+
grid-auto-rows: minmax(24px, auto);
|
|
55
|
+
}
|
|
56
|
+
`
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static get properties() {
|
|
61
|
+
return{
|
|
62
|
+
_searchFields: Array,
|
|
63
|
+
_config: Object,
|
|
64
|
+
_gristData:Object,
|
|
65
|
+
_partners:Object,
|
|
66
|
+
items: Object,
|
|
67
|
+
// importHandler: Object
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get context() {
|
|
72
|
+
return {
|
|
73
|
+
title: i18next.t('Shortage Report'),
|
|
74
|
+
exportable: {
|
|
75
|
+
name: i18next.t('this.Shortage_report'),
|
|
76
|
+
data: this._exportableData.bind(this)
|
|
77
|
+
},
|
|
78
|
+
help: 'operato-wms/report/shortage-report'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
get dataGrist() {
|
|
83
|
+
return this.shadowRoot.querySelector('data-grist')
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get searchForm() {
|
|
87
|
+
return this.shadowRoot.querySelector('search-form')
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get _bizplaceSelector() {
|
|
91
|
+
return this.searchForm.shadowRoot.querySelector('select[name=bizplace]')
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
get _fromDateInput() {
|
|
95
|
+
return this.searchForm.shadowRoot.querySelector('input[name=fromDate]')
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
get _toDateInput() {
|
|
99
|
+
return this.searchForm.shadowRoot.querySelector('input[name=toDate]')
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
render () {
|
|
103
|
+
return html`
|
|
104
|
+
<search-form
|
|
105
|
+
id="search-form"
|
|
106
|
+
.fields=${this._searchFields}
|
|
107
|
+
initFocus="description"
|
|
108
|
+
@submit=${e => this.dataGrist.fetch()}
|
|
109
|
+
></search-form>
|
|
110
|
+
|
|
111
|
+
<data-grist
|
|
112
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
113
|
+
.config=${this._config}
|
|
114
|
+
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
115
|
+
></data-grist>
|
|
116
|
+
`
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
get searchFields() {
|
|
120
|
+
return [
|
|
121
|
+
{
|
|
122
|
+
label: i18next.t('Company'),
|
|
123
|
+
name:'bizplace',
|
|
124
|
+
type:'select',
|
|
125
|
+
options: [
|
|
126
|
+
{ value: ''},
|
|
127
|
+
...this._partners
|
|
128
|
+
.map(partner => {
|
|
129
|
+
return {
|
|
130
|
+
name: `${partner.name} ${partner.description ? `(${partner.description})` : ''}`,
|
|
131
|
+
value: partner.id
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
.sort(this._compareValues('name', 'asc'))
|
|
135
|
+
],
|
|
136
|
+
props: {searchOper: 'eq'}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
label: i18next.t('field.from_date'),
|
|
140
|
+
name: 'fromDate',
|
|
141
|
+
type: 'date',
|
|
142
|
+
props: {
|
|
143
|
+
searchOper: 'eq',
|
|
144
|
+
max: new Date().toISOString().split('T')[0]
|
|
145
|
+
},
|
|
146
|
+
value: (() => {
|
|
147
|
+
let date = new Date()
|
|
148
|
+
date.setMonth(date.getMonth() - 1)
|
|
149
|
+
return date.toISOString().split('T')[0]
|
|
150
|
+
})(),
|
|
151
|
+
handlers: { change: this._modifyDateRange.bind(this) }
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
label: i18next.t('field.to_date'),
|
|
155
|
+
name: 'toDate',
|
|
156
|
+
type: 'date',
|
|
157
|
+
props: {
|
|
158
|
+
searchOper: 'eq',
|
|
159
|
+
min: (() => {
|
|
160
|
+
let date = new Date()
|
|
161
|
+
date.setMonth(date.getMonth() - 1)
|
|
162
|
+
return date.toISOString().split('T')[0]
|
|
163
|
+
})(),
|
|
164
|
+
max: new Date().toISOString().split('T')[0]
|
|
165
|
+
},
|
|
166
|
+
value: new Date().toISOString().split('T')[0],
|
|
167
|
+
handlers: { change: this._submit.bind(this) }
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
label: i18next.t('field.product_info'),
|
|
171
|
+
name: 'product',
|
|
172
|
+
type: 'string',
|
|
173
|
+
props: { searchOper: 'in' }
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
label: i18next.t('field.order_no'),
|
|
177
|
+
name: 'orderNo',
|
|
178
|
+
type: 'text',
|
|
179
|
+
props: { searchOper: 'custom' }
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
get reportConfig() {
|
|
186
|
+
// let rows = {
|
|
187
|
+
// selectable: false,
|
|
188
|
+
// insertable: false,
|
|
189
|
+
// appendable: false
|
|
190
|
+
// }
|
|
191
|
+
let columns = [
|
|
192
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
193
|
+
{
|
|
194
|
+
type: 'string',
|
|
195
|
+
name: 'bizplaceName',
|
|
196
|
+
header: i18next.t('field.company'),
|
|
197
|
+
width: 200
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: 'string',
|
|
201
|
+
name: 'orderNo',
|
|
202
|
+
header: i18next.t('field.order_no'),
|
|
203
|
+
width: 200
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
type: 'string',
|
|
207
|
+
name: 'refNo',
|
|
208
|
+
header: i18next.t('field.ref_no'),
|
|
209
|
+
width: 150
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
type: 'string',
|
|
213
|
+
name: 'productSku',
|
|
214
|
+
header: i18next.t('field.sku'),
|
|
215
|
+
width: 200
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
type: 'string',
|
|
219
|
+
name: 'productName',
|
|
220
|
+
header: i18next.t('field.product'),
|
|
221
|
+
width: 200
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
type: 'string',
|
|
225
|
+
name: 'orderQty',
|
|
226
|
+
header: i18next.t('field.order_quantity'),
|
|
227
|
+
width: 170
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
type: 'string',
|
|
231
|
+
name: 'avQty',
|
|
232
|
+
header: i18next.t('field.available_qty'),
|
|
233
|
+
width: 150
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
type: 'string',
|
|
237
|
+
name: 'nettStock',
|
|
238
|
+
header: i18next.t('field.nett_stock'),
|
|
239
|
+
width: 150
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
type: 'datetime',
|
|
243
|
+
name: 'createdAt',
|
|
244
|
+
header: i18next.t('field.created_at'),
|
|
245
|
+
width: 170
|
|
246
|
+
}
|
|
247
|
+
]
|
|
248
|
+
let list = {
|
|
249
|
+
fields: [
|
|
250
|
+
'bizplaceName',
|
|
251
|
+
'orderNo',
|
|
252
|
+
'refNo',
|
|
253
|
+
'productSku',
|
|
254
|
+
'productName',
|
|
255
|
+
'orderQty',
|
|
256
|
+
'avQty',
|
|
257
|
+
'nettStock',
|
|
258
|
+
'createdAt'
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return {
|
|
263
|
+
// rows: rows,
|
|
264
|
+
columns: columns,
|
|
265
|
+
list,
|
|
266
|
+
pagination: { limit: 50, pages: [50, 100, 200, 500, 1000] },
|
|
267
|
+
rows: {
|
|
268
|
+
selectable: false,
|
|
269
|
+
insertable: false,
|
|
270
|
+
appendable: false
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
async pageInitialized(){
|
|
276
|
+
this._gristData = { total: 0, records: [] }
|
|
277
|
+
this._products = []
|
|
278
|
+
|
|
279
|
+
const [_partnersReq] = await Promise.allSettled([this._fetchPartners()])
|
|
280
|
+
|
|
281
|
+
this._partners = _partnersReq.status == 'fulfilled' ? _partnersReq.value : []
|
|
282
|
+
|
|
283
|
+
this._searchFields = this.searchFields
|
|
284
|
+
this._config = this.reportConfig
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
pageUpdated(changes, lifecycle) {
|
|
289
|
+
if (this.active) {
|
|
290
|
+
this.dataGrist.fetch()
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async fetchHandler({page, limit, sorters = []}) {
|
|
295
|
+
try {
|
|
296
|
+
this._validate()
|
|
297
|
+
let filters = this.searchForm.queryFilters.map(filter => {
|
|
298
|
+
switch (filter.name) {
|
|
299
|
+
case 'fromDate':
|
|
300
|
+
let fromDt = new Date(filter.value)
|
|
301
|
+
fromDt.setHours(0)
|
|
302
|
+
filter.value = fromDt.toISOString()
|
|
303
|
+
break
|
|
304
|
+
case 'toDate':
|
|
305
|
+
let toDt = new Date(filter.value)
|
|
306
|
+
toDt.setHours(23, 59, 59)
|
|
307
|
+
filter.value = toDt.toISOString()
|
|
308
|
+
break
|
|
309
|
+
default:
|
|
310
|
+
break
|
|
311
|
+
}
|
|
312
|
+
return filter
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
const pagination = { page, limit }
|
|
316
|
+
const sortings = sorters
|
|
317
|
+
|
|
318
|
+
const response = await client.query({
|
|
319
|
+
query:gql`
|
|
320
|
+
query shortageReport($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
321
|
+
shortageReport(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
322
|
+
items {
|
|
323
|
+
bizplaceName
|
|
324
|
+
orderNo
|
|
325
|
+
refNo
|
|
326
|
+
productSku
|
|
327
|
+
productName
|
|
328
|
+
orderQty
|
|
329
|
+
avQty
|
|
330
|
+
nettStock
|
|
331
|
+
deliveryAddress
|
|
332
|
+
state
|
|
333
|
+
city
|
|
334
|
+
country
|
|
335
|
+
createdAt
|
|
336
|
+
}
|
|
337
|
+
total
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
`,
|
|
341
|
+
variables: { filters,pagination,sortings},
|
|
342
|
+
context:gqlContext()
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
return{
|
|
346
|
+
total: response.data.shortageReport.total || 0,
|
|
347
|
+
records: response.data.shortageReport.items || []
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
this._gristData = {
|
|
351
|
+
...items
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return items
|
|
355
|
+
} catch (e) {
|
|
356
|
+
showToast(e)
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
async _fetchPartners() {
|
|
361
|
+
const filters = []
|
|
362
|
+
const response = await client.query({
|
|
363
|
+
query: gql`
|
|
364
|
+
query partnersBizplaces($filters: [Filter!]) {
|
|
365
|
+
partnersBizplaces(filters: $filters) {
|
|
366
|
+
items {
|
|
367
|
+
id
|
|
368
|
+
name
|
|
369
|
+
description
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
`,
|
|
374
|
+
variables: { filters }
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
if (!response.errors) {
|
|
378
|
+
return response.data.partnersBizplaces.items
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
_validate() {
|
|
383
|
+
if (!this.searchForm.shadowRoot.querySelector('form').checkValidity())
|
|
384
|
+
throw new Error(i18next.t('text.invalid_form_value'))
|
|
385
|
+
if (!this._bizplaceSelector.value) throw new Error(i18next.t('text.no_company_selected'))
|
|
386
|
+
if (!this._fromDateInput.value) throw new Error(i18next.t('text.from_date_is_empty'))
|
|
387
|
+
if (!this._toDateInput.value) throw new Error(i18next.t('text.to_date_is_empty'))
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
_compareValues(key, order = 'asc') {
|
|
391
|
+
return function innerSort(a, b) {
|
|
392
|
+
if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
|
|
393
|
+
return 0
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const varA = typeof a[key] === 'string' ? a[key].toUpperCase() : a[key]
|
|
397
|
+
const varB = typeof b[key] === 'string' ? b[key].toUpperCase() : b[key]
|
|
398
|
+
|
|
399
|
+
let comparison = 0
|
|
400
|
+
if (varA > varB) {
|
|
401
|
+
comparison = 1
|
|
402
|
+
} else if (varA < varB) {
|
|
403
|
+
comparison = -1
|
|
404
|
+
}
|
|
405
|
+
return order === 'desc' ? comparison * -1 : comparison
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
_modifyDateRange(e) {
|
|
410
|
+
const fromDate = e.currentTarget.value
|
|
411
|
+
|
|
412
|
+
if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
|
|
413
|
+
|
|
414
|
+
let min = new Date(fromDate)
|
|
415
|
+
let today = new Date()
|
|
416
|
+
today.setHours(0, 0, 0, 0)
|
|
417
|
+
|
|
418
|
+
min = min.toISOString().split('T')[0]
|
|
419
|
+
|
|
420
|
+
this._toDateInput.min = min
|
|
421
|
+
this._submit()
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
_submit(e) {
|
|
425
|
+
this._config = { ...this.reportConfig }
|
|
426
|
+
this.searchForm.submit()
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
async _exportableData() {
|
|
430
|
+
try {
|
|
431
|
+
var headerSetting = [
|
|
432
|
+
{ header: i18next.t('field.company'), key: 'bizplaceName', width: 60, type: 'string' },
|
|
433
|
+
{ header: i18next.t('field.order_no'), key: 'orderNo', width: 30, type: 'string' },
|
|
434
|
+
{ header: i18next.t('field.ref_no'), key: 'refNo', width: 60, type: 'string' },
|
|
435
|
+
{ header: i18next.t('field.sku'), key: 'productSku', width: 25, type: 'string' },
|
|
436
|
+
{header: i18next.t('field.product'), key: 'productName', width: 50, type: 'string' },
|
|
437
|
+
{header: i18next.t('field.order_quantity'), key: 'orderQty', width: 15, type: 'string' },
|
|
438
|
+
{header: i18next.t('field.available_qty'), key: 'avQty', width: 15, type: 'string' },
|
|
439
|
+
{header: i18next.t('field.nett_stock'), key: 'nettStock', width: 15, type: 'string' },
|
|
440
|
+
{header: i18next.t('field.delivery_address'), key: 'deliveryAddress', width: 15, type: 'string' },
|
|
441
|
+
{header: i18next.t('field.state'), key: 'state', width: 15, type: 'string' },
|
|
442
|
+
{header: i18next.t('field.city'), key: 'city', width: 15, type: 'string' },
|
|
443
|
+
{header: i18next.t('field.country'), key: 'country', width: 15, type: 'string' },
|
|
444
|
+
{ header: i18next.t('field.created_at'), key: 'createdAt', width: 30, type: 'string' }
|
|
445
|
+
]
|
|
446
|
+
|
|
447
|
+
var exportData = {
|
|
448
|
+
header: [...headerSetting],
|
|
449
|
+
data: (await this.fetchHandler({ page: 1, limit: 9999999 })).records.map(itm => {
|
|
450
|
+
return {
|
|
451
|
+
...itm,
|
|
452
|
+
createdAt: itm.createdAt ? new Date(parseInt(itm.createdAt)).toLocaleString() : '',
|
|
453
|
+
}
|
|
454
|
+
})
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
return exportData
|
|
458
|
+
} catch (e) {
|
|
459
|
+
this._showToast(e)
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
_showToast({ type, message }) {
|
|
464
|
+
document.dispatchEvent(
|
|
465
|
+
new CustomEvent('notify', {
|
|
466
|
+
detail: {
|
|
467
|
+
type,
|
|
468
|
+
message
|
|
469
|
+
}
|
|
470
|
+
})
|
|
471
|
+
)
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
window.customElements.define('shortage-report', shortageReport)
|
package/client/route.js
CHANGED
|
@@ -497,6 +497,10 @@ export default function route(page) {
|
|
|
497
497
|
import('./pages/report/vas-report')
|
|
498
498
|
return page
|
|
499
499
|
|
|
500
|
+
case 'shortage_report':
|
|
501
|
+
import('./pages/report/shortage-report')
|
|
502
|
+
return page
|
|
503
|
+
|
|
500
504
|
case 'analysis_picking_packing_report':
|
|
501
505
|
import('./pages/report/analysis-picking-packing-report')
|
|
502
506
|
return page
|
|
@@ -9,7 +9,8 @@ const outbound_order_details_report_1 = require("./outbound-order-details-report
|
|
|
9
9
|
const outbound_serial_number_report_1 = require("./outbound-serial-number-report");
|
|
10
10
|
const product_label_report_1 = require("./product-label-report");
|
|
11
11
|
const release_inventory_report_1 = require("./release-inventory-report");
|
|
12
|
+
const shortage_report_1 = require("./shortage-report");
|
|
12
13
|
const tote_loading_qc_report_1 = require("./tote-loading-qc-report");
|
|
13
14
|
const vas_report_1 = require("./vas-report");
|
|
14
|
-
exports.Query = 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), tote_loading_qc_report_1.loadingQcReport), vas_report_1.orderVasReport), vas_report_1.vasReport), analysis_picking_packing_report_1.analysisPickingPackingReport);
|
|
15
|
+
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({}, 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);
|
|
15
16
|
//# 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,mFAA4E;AAC5E,mFAA4E;AAC5E,iEAA2D;AAC3D,yEAAmE;AACnE,qEAA0D;AAC1D,
|
|
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,mFAA4E;AAC5E,mFAA4E;AAC5E,iEAA2D;AAC3D,yEAAmE;AACnE,uDAAkD;AAClD,qEAA0D;AAC1D,6CAGqB;AAER,QAAA,KAAK,+KACb,wDAAyB,GACzB,0DAA0B,GAC1B,8BAAa,GACb,wDAAyB,GACzB,0DAA0B,GAC1B,yCAAkB,GAClB,iDAAsB,GACtB,gCAAc,GACd,wCAAe,GACf,2BAAc,GACd,sBAAS,GACT,8DAA4B,EAChC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shortageReport = void 0;
|
|
4
|
+
exports.shortageReport = {
|
|
5
|
+
async shortageReport(_, params, context) {
|
|
6
|
+
try {
|
|
7
|
+
const { tx } = context.state;
|
|
8
|
+
let bizplaceFilter = { name: '', operator: '', value: '' };
|
|
9
|
+
let order = params.filters.find(items => items.name === 'order');
|
|
10
|
+
let fromDate = params.filters.find(items => items.name === 'fromDate');
|
|
11
|
+
let toDate = params.filters.find(items => items.name === 'toDate');
|
|
12
|
+
let orderNo = params.filters.find(items => items.name === 'orderNo');
|
|
13
|
+
let product = params.filters.find(items => items.name === 'product');
|
|
14
|
+
let bizplace = params.filters.find(items => items.name === 'bizplace');
|
|
15
|
+
if (!bizplace)
|
|
16
|
+
throw 'Invalid input';
|
|
17
|
+
let roFilter = '', queryFilter = '';
|
|
18
|
+
if (product) {
|
|
19
|
+
let productInfoValue = product.value
|
|
20
|
+
.toLowerCase()
|
|
21
|
+
.split(',')
|
|
22
|
+
.map(prod => {
|
|
23
|
+
return "'%" + prod.trim().replace(/'/g, "''") + "%'";
|
|
24
|
+
})
|
|
25
|
+
.join(',');
|
|
26
|
+
roFilter += `AND (
|
|
27
|
+
Lower(drg.name) LIKE ANY(ARRAY[${productInfoValue}])
|
|
28
|
+
OR Lower(p.sku) LIKE ANY(ARRAY[${productInfoValue}])
|
|
29
|
+
OR Lower(p.sku) LIKE ANY(ARRAY[${productInfoValue}])
|
|
30
|
+
OR Lower(p.sku) LIKE ANY(ARRAY[${productInfoValue}])
|
|
31
|
+
OR Lower(p."name") LIKE ANY(ARRAY[${productInfoValue}])
|
|
32
|
+
OR Lower(p."name") LIKE ANY(ARRAY[${productInfoValue}])
|
|
33
|
+
OR Lower(p."name") LIKE ANY(ARRAY[${productInfoValue}])
|
|
34
|
+
|
|
35
|
+
)`;
|
|
36
|
+
}
|
|
37
|
+
if (orderNo) {
|
|
38
|
+
let orderValue = orderNo.value
|
|
39
|
+
.toLowerCase()
|
|
40
|
+
.split(',')
|
|
41
|
+
.map(prod => {
|
|
42
|
+
return "'%" + prod.trim().replace(/'/g, "''") + "%'";
|
|
43
|
+
})
|
|
44
|
+
.join(',');
|
|
45
|
+
roFilter += `AND (
|
|
46
|
+
Lower(drg.name) LIKE ANY(ARRAY[${orderValue}])
|
|
47
|
+
OR Lower(drg.ref_no) LIKE ANY(ARRAY[${orderValue}])
|
|
48
|
+
OR Lower(drg.ref_no_2) LIKE ANY(ARRAY[${orderValue}])
|
|
49
|
+
OR Lower(drg.ref_no_3) LIKE ANY(ARRAY[${orderValue}])
|
|
50
|
+
)`;
|
|
51
|
+
}
|
|
52
|
+
if (bizplace) {
|
|
53
|
+
queryFilter += ` AND drg.bizplace_id = '${bizplace.value}'`;
|
|
54
|
+
}
|
|
55
|
+
if (!bizplaceFilter || !fromDate || !toDate)
|
|
56
|
+
throw 'Invalid input';
|
|
57
|
+
await tx.query(`
|
|
58
|
+
create temp table shortage_report on commit drop as (
|
|
59
|
+
select b."name" as "company", drg.name as "order_no",drg.ref_no, p.sku as "product_sku", p."name" as "product_name", op.release_qty as "order_quantity",
|
|
60
|
+
coalesce(src.av_qty,0) as available_qty, coalesce(src.av_qty - op.release_qty,0)as "Nett_Stock",
|
|
61
|
+
concat(drg.delivery_address_1, ' ', drg.delivery_address_2, ' ', drg.delivery_address_3, ' ', drg.delivery_address_4, ' ', drg.delivery_address_5) as "delivery_address",
|
|
62
|
+
drg.state,drg.city, drg.country, drg.created_at
|
|
63
|
+
from draft_release_goods drg
|
|
64
|
+
inner join bizplaces b on b.id = drg.bizplace_id
|
|
65
|
+
inner join order_products op on op.draft_release_good_id = drg.id
|
|
66
|
+
inner join products p on p.id = op.product_id
|
|
67
|
+
left join (
|
|
68
|
+
select product_id, sum(qty - locked_qty)as "av_qty" from inventories i where i.domain_id = $1
|
|
69
|
+
group by product_id ) src
|
|
70
|
+
on op.product_id = src.product_id
|
|
71
|
+
where drg.status = 'DRAFT'
|
|
72
|
+
and drg.domain_id = $1
|
|
73
|
+
and coalesce(src.av_qty - op.release_qty,0) < 0
|
|
74
|
+
and drg.created_at >= $2
|
|
75
|
+
and drg.created_at <= $3
|
|
76
|
+
${roFilter}
|
|
77
|
+
${queryFilter}
|
|
78
|
+
order by drg.created_at desc
|
|
79
|
+
);
|
|
80
|
+
`, [context.state.domain.id, fromDate.value, toDate.value]);
|
|
81
|
+
const total = await tx.query(`
|
|
82
|
+
select count(*) from shortage_report
|
|
83
|
+
`);
|
|
84
|
+
const result = await tx.query(`
|
|
85
|
+
select * from shortage_report
|
|
86
|
+
offset $1 limit $2
|
|
87
|
+
`, [(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]);
|
|
88
|
+
let items = result.map(itm => {
|
|
89
|
+
return {
|
|
90
|
+
bizplaceName: itm.company,
|
|
91
|
+
orderNo: itm.order_no,
|
|
92
|
+
refNo: itm.ref_no,
|
|
93
|
+
productSku: itm.product_sku,
|
|
94
|
+
productName: itm.product_name,
|
|
95
|
+
orderQty: itm.order_quantity,
|
|
96
|
+
avQty: itm.available_qty,
|
|
97
|
+
nettStock: itm.Nett_Stock,
|
|
98
|
+
deliveryAddress: itm.delivery_address,
|
|
99
|
+
state: itm.state,
|
|
100
|
+
city: itm.city,
|
|
101
|
+
country: itm.country,
|
|
102
|
+
createdAt: itm.created_at
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
items,
|
|
107
|
+
total: total[0].count
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=shortage-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortage-report.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/shortage-report.ts"],"names":[],"mappings":";;;AAIa,QAAA,cAAc,GAAG;IAC1B,KAAK,CAAC,cAAc,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QAC1D,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,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAA;YAChE,IAAI,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;YACtE,IAAI,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAA;YAClE,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAA;YACpE,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAA;YACpE,IAAI,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,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ACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA"}
|
|
@@ -19,6 +19,8 @@ const product_label_report_1 = require("./product-label-report");
|
|
|
19
19
|
const product_label_report_list_1 = require("./product-label-report-list");
|
|
20
20
|
const release_inventory_report_1 = require("./release-inventory-report");
|
|
21
21
|
const release_inventory_report_list_1 = require("./release-inventory-report-list");
|
|
22
|
+
const shortage_report_list_1 = require("./shortage-report-list");
|
|
23
|
+
const shortage_report_type_1 = require("./shortage-report-type");
|
|
22
24
|
const vas_report_1 = require("./vas-report");
|
|
23
25
|
const vas_report_list_1 = require("./vas-report-list");
|
|
24
26
|
exports.Query = `
|
|
@@ -29,6 +31,7 @@ exports.Query = `
|
|
|
29
31
|
productLabelReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): ProductLabelReportList @transaction
|
|
30
32
|
costingReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): CostingReportList @transaction
|
|
31
33
|
releaseInventoryReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): ReleaseInventoryReportList @transaction
|
|
34
|
+
shortageReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]):ShortageReportList @transaction
|
|
32
35
|
loadingQcReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): [LoadingQcReport] @transaction
|
|
33
36
|
orderVasReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OrderVasReportList @transaction
|
|
34
37
|
vasReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OrderVasReportList @transaction
|
|
@@ -49,6 +52,8 @@ exports.Types = [
|
|
|
49
52
|
costing_report_list_1.CostingReportList,
|
|
50
53
|
release_inventory_report_1.ReleaseInventoryReport,
|
|
51
54
|
release_inventory_report_list_1.ReleaseInventoryReportList,
|
|
55
|
+
shortage_report_type_1.ShortageReport,
|
|
56
|
+
shortage_report_list_1.ShortageReportList,
|
|
52
57
|
loading_qc_report_1.LoadingQcReport,
|
|
53
58
|
loading_qc_report_list_1.LoadingQcReportList,
|
|
54
59
|
vas_report_1.OrderVasReport,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/index.ts"],"names":[],"mappings":";;;AAAA,uFAAgF;AAChF,iGAAyF;AACzF,qDAAgD;AAChD,+DAAyD;AACzD,iFAA0E;AAC1E,2FAAmF;AACnF,iFAA0E;AAC1E,2FAAmF;AACnF,2DAAqD;AACrD,qEAA8D;AAC9D,mFAA4E;AAC5E,6FAAqF;AACrF,mFAA4E;AAC5E,6FAAqF;AACrF,iEAA2D;AAC3D,2EAAoE;AACpE,yEAAmE;AACnE,mFAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/index.ts"],"names":[],"mappings":";;;AAAA,uFAAgF;AAChF,iGAAyF;AACzF,qDAAgD;AAChD,+DAAyD;AACzD,iFAA0E;AAC1E,2FAAmF;AACnF,iFAA0E;AAC1E,2FAAmF;AACnF,2DAAqD;AACrD,qEAA8D;AAC9D,mFAA4E;AAC5E,6FAAqF;AACrF,mFAA4E;AAC5E,6FAAqF;AACrF,iEAA2D;AAC3D,2EAAoE;AACpE,yEAAmE;AACnE,mFAA4E;AAC5E,iEAA2D;AAC3D,iEAAuD;AACvD,6CAGqB;AACrB,uDAG0B;AAEb,QAAA,KAAK,GAAG;;;;;;;;;;;;;CAapB,CAAA;AAEY,QAAA,KAAK,GAAG;IACnB,wDAAyB;IACzB,iEAA6B;IAC7B,0DAA0B;IAC1B,mEAA8B;IAC9B,wDAAyB;IACzB,iEAA6B;IAC7B,0DAA0B;IAC1B,mEAA8B;IAC9B,yCAAkB;IAClB,kDAAsB;IACtB,8BAAa;IACb,uCAAiB;IACjB,iDAAsB;IACtB,0DAA0B;IAC1B,qCAAc;IACd,yCAAkB;IAClB,mCAAe;IACf,4CAAmB;IACnB,2BAAc;IACd,oCAAkB;IAClB,sBAAS;IACT,+BAAa;IACb,8DAA4B;IAC5B,uEAAgC;CACjC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ShortageReportList = void 0;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
exports.ShortageReportList = (0, graphql_tag_1.default) `
|
|
9
|
+
type ShortageReportList {
|
|
10
|
+
items: [ShortageReport]
|
|
11
|
+
total: Int
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
//# sourceMappingURL=shortage-report-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortage-report-list.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/shortage-report-list.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,kBAAkB,GAAG,IAAA,qBAAG,EAAA;;;;;CAKpC,CAAA"}
|