@things-factory/operato-wms 4.3.273 → 4.3.276
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/constants/vas.js +4 -0
- package/client/pages/constants/order.js +2 -1
- package/client/pages/order/release-order/release-order-detail.js +5 -12
- package/client/pages/outbound/worksheet-picking.js +3 -2
- package/client/pages/report/order-vas-report.js +577 -0
- package/client/pages/report/vas-report.js +52 -182
- package/client/pages/vas/vas-execution-page.js +3 -3
- package/client/route.js +4 -0
- package/dist-server/graphql/resolvers/reports/index.js +1 -1
- package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/vas-report.js +166 -24
- package/dist-server/graphql/resolvers/reports/vas-report.js.map +1 -1
- package/dist-server/graphql/types/reports/index.js +4 -1
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/vas-report-list.js +9 -3
- package/dist-server/graphql/types/reports/vas-report-list.js.map +1 -1
- package/dist-server/graphql/types/reports/vas-report.js +12 -2
- package/dist-server/graphql/types/reports/vas-report.js.map +1 -1
- package/package.json +8 -8
- package/server/graphql/resolvers/reports/index.ts +2 -1
- package/server/graphql/resolvers/reports/vas-report.ts +186 -23
- package/server/graphql/types/reports/index.ts +6 -3
- package/server/graphql/types/reports/vas-report-list.ts +8 -2
- package/server/graphql/types/reports/vas-report.ts +13 -2
- package/things-factory.config.js +4 -0
- package/translations/en.json +12 -2
- package/translations/ko.json +14 -3
- package/translations/ms.json +13 -3
- package/translations/zh.json +13 -3
|
@@ -8,6 +8,7 @@ import { connect } from 'pwa-helpers/connect-mixin'
|
|
|
8
8
|
import { i18next, localize } from '@things-factory/i18n-base'
|
|
9
9
|
import { client, PageView, store } from '@things-factory/shell'
|
|
10
10
|
import { flattenObject } from '@things-factory/utils'
|
|
11
|
+
import { VAS_TYPES } from '@things-factory/sales-ui/client/constants/vas'
|
|
11
12
|
|
|
12
13
|
class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
13
14
|
static get styles() {
|
|
@@ -37,13 +38,13 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
37
38
|
|
|
38
39
|
get context() {
|
|
39
40
|
return {
|
|
40
|
-
title: i18next.t('title.
|
|
41
|
+
title: i18next.t('title.vas_summary_report'),
|
|
41
42
|
printable: {
|
|
42
43
|
accept: ['preview'],
|
|
43
44
|
content: this
|
|
44
45
|
},
|
|
45
46
|
exportable: {
|
|
46
|
-
name: i18next.t('title.
|
|
47
|
+
name: i18next.t('title.date_vas_summary_report', {
|
|
47
48
|
state: {
|
|
48
49
|
text: (() => {
|
|
49
50
|
let date = new Date()
|
|
@@ -86,13 +87,14 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
get searchFields() {
|
|
90
|
+
const type = VAS_TYPES
|
|
89
91
|
return [
|
|
90
92
|
{
|
|
91
93
|
label: i18next.t('field.company'),
|
|
92
94
|
name: 'bizplace',
|
|
93
95
|
type: 'select',
|
|
94
96
|
options: [
|
|
95
|
-
|
|
97
|
+
{ value: '' },
|
|
96
98
|
...this._partners
|
|
97
99
|
.map(partner => {
|
|
98
100
|
return {
|
|
@@ -105,7 +107,7 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
105
107
|
props: { searchOper: 'eq' }
|
|
106
108
|
},
|
|
107
109
|
{
|
|
108
|
-
label: i18next.t('field.
|
|
110
|
+
label: i18next.t('field.latest_execution_from_date'),
|
|
109
111
|
name: 'fromDate',
|
|
110
112
|
type: 'date',
|
|
111
113
|
props: {
|
|
@@ -115,7 +117,7 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
115
117
|
handlers: { change: this._modifyDateRange.bind(this) }
|
|
116
118
|
},
|
|
117
119
|
{
|
|
118
|
-
label: i18next.t('field.
|
|
120
|
+
label: i18next.t('field.latest_execution_to_date'),
|
|
119
121
|
name: 'toDate',
|
|
120
122
|
type: 'date',
|
|
121
123
|
props: {
|
|
@@ -129,17 +131,27 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
129
131
|
}
|
|
130
132
|
},
|
|
131
133
|
{
|
|
132
|
-
label: i18next.t('field.
|
|
133
|
-
name: '
|
|
134
|
+
label: i18next.t('field.vas'),
|
|
135
|
+
name: 'vas',
|
|
134
136
|
type: 'string',
|
|
135
137
|
props: { searchOper: 'i_like' }
|
|
136
138
|
},
|
|
137
139
|
{
|
|
138
|
-
label: i18next.t('field.
|
|
139
|
-
name: '
|
|
140
|
-
type: '
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
label: i18next.t('field.type'),
|
|
141
|
+
name: 'type',
|
|
142
|
+
type: 'select',
|
|
143
|
+
options: [
|
|
144
|
+
{ value: '' },
|
|
145
|
+
...Object.values(type)
|
|
146
|
+
.map(type => { return {
|
|
147
|
+
name: type,
|
|
148
|
+
value: type
|
|
149
|
+
}})
|
|
150
|
+
.sort()
|
|
151
|
+
|
|
152
|
+
],
|
|
153
|
+
props: { searchOper: 'eq' }
|
|
154
|
+
},
|
|
143
155
|
]
|
|
144
156
|
}
|
|
145
157
|
|
|
@@ -148,17 +160,9 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
148
160
|
rows: {
|
|
149
161
|
selectable: false,
|
|
150
162
|
groups: [
|
|
151
|
-
{ column: 'bizplaceName' }
|
|
152
|
-
{ column: 'ro' },
|
|
153
|
-
{ column: 'refNo' },
|
|
154
|
-
{ column: 'sku' },
|
|
155
|
-
{ column: 'batchId' },
|
|
156
|
-
{ column: 'packingType' },
|
|
157
|
-
{ column: 'uom' },
|
|
158
|
-
{ column: 'uomValue' },
|
|
159
|
-
{ column: 'releaseQty' }
|
|
163
|
+
{ column: 'bizplaceName' }
|
|
160
164
|
],
|
|
161
|
-
totals: []
|
|
165
|
+
totals: ['vasQty']
|
|
162
166
|
},
|
|
163
167
|
columns: [
|
|
164
168
|
{
|
|
@@ -166,81 +170,25 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
166
170
|
name: 'bizplaceName',
|
|
167
171
|
header: i18next.t('field.company'),
|
|
168
172
|
sortable: false,
|
|
169
|
-
imex: {
|
|
170
|
-
width: 150
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
type: 'string',
|
|
174
|
-
name: 'ro',
|
|
175
|
-
header: i18next.t('field.order_no'),
|
|
176
|
-
sortable: false,
|
|
177
|
-
imex: { header: i18next.t('field.order_no'), key: 'ro', width: 25, type: 'string' },
|
|
178
|
-
width: 160
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
type: 'string',
|
|
182
|
-
name: 'refNo',
|
|
183
|
-
header: i18next.t('field.ref_no'),
|
|
184
|
-
sortable: false,
|
|
185
|
-
imex: { header: i18next.t('field.ref_no'), key: 'refNo', width: 25, type: 'string' },
|
|
173
|
+
imex: { header: i18next.t('field.company'), key: 'bizplaceName', width: 30, type: 'string' },
|
|
186
174
|
width: 150
|
|
187
175
|
},
|
|
188
|
-
{
|
|
189
|
-
type: 'string',
|
|
190
|
-
name: 'sku',
|
|
191
|
-
header: i18next.t('field.sku'),
|
|
192
|
-
sortable: false,
|
|
193
|
-
imex: { header: i18next.t('field.sku'), key: 'sku', width: 20, type: 'string' },
|
|
194
|
-
width: 150
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
type: 'string',
|
|
198
|
-
name: 'batchId',
|
|
199
|
-
header: i18next.t('field.batch_no'),
|
|
200
|
-
sortable: false,
|
|
201
|
-
imex: { header: i18next.t('field.batch_no'), key: 'batchId', width: 20, type: 'string' },
|
|
202
|
-
width: 100
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
type: 'string',
|
|
206
|
-
name: 'packingType',
|
|
207
|
-
header: i18next.t('field.packing_type'),
|
|
208
|
-
sortable: false,
|
|
209
|
-
imex: { header: i18next.t('field.packing_type'), key: 'packingType', width: 20, type: 'string' },
|
|
210
|
-
width: 130
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
type: 'string',
|
|
214
|
-
name: 'uom',
|
|
215
|
-
header: i18next.t('field.uom'),
|
|
216
|
-
sortable: false,
|
|
217
|
-
imex: { header: i18next.t('field.uom'), key: 'uom', width: 5, type: 'string' },
|
|
218
|
-
width: 70
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
type: 'number',
|
|
222
|
-
name: 'uomValue',
|
|
223
|
-
header: i18next.t('field.unit_uom_value'),
|
|
224
|
-
sortable: false,
|
|
225
|
-
imex: { header: i18next.t('field.unit_uom_value'), key: 'uomValue', width: 10, type: 'string' },
|
|
226
|
-
width: 80
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
type: 'number',
|
|
230
|
-
name: 'releaseQty',
|
|
231
|
-
header: i18next.t('field.release_qty'),
|
|
232
|
-
sortable: false,
|
|
233
|
-
imex: { header: i18next.t('field.release_qty'), key: 'releaseQty', width: 10, type: 'string' },
|
|
234
|
-
width: 80
|
|
235
|
-
},
|
|
236
176
|
{
|
|
237
177
|
type: 'string',
|
|
238
178
|
name: 'vas',
|
|
239
179
|
header: i18next.t('field.vas'),
|
|
240
180
|
sortable: false,
|
|
241
|
-
imex: { header: i18next.t('field.vas'), key: 'vas', width:
|
|
242
|
-
width:
|
|
181
|
+
imex: { header: i18next.t('field.vas'), key: 'vas', width: 90, type: 'string' },
|
|
182
|
+
width: 600
|
|
243
183
|
},
|
|
184
|
+
{
|
|
185
|
+
type: 'string',
|
|
186
|
+
name: 'type',
|
|
187
|
+
header: i18next.t('field.type'),
|
|
188
|
+
sortable: false,
|
|
189
|
+
imex: { header: i18next.t('field.type'), key: 'type', width: 10, type: 'string' },
|
|
190
|
+
width: 150
|
|
191
|
+
},
|
|
244
192
|
{
|
|
245
193
|
type: 'number',
|
|
246
194
|
name: 'vasQty',
|
|
@@ -250,53 +198,13 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
250
198
|
width: 70
|
|
251
199
|
},
|
|
252
200
|
{
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
{
|
|
261
|
-
type: 'string',
|
|
262
|
-
name: 'newPackingType',
|
|
263
|
-
header: i18next.t('field.packing_type'),
|
|
264
|
-
sortable: false,
|
|
265
|
-
imex: { header: i18next.t('field.packing_type'), key: 'newPackingType', width: 10, type: 'string' },
|
|
266
|
-
width: 90
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
type: 'string',
|
|
270
|
-
name: 'newUom',
|
|
271
|
-
header: i18next.t('field.uom'),
|
|
272
|
-
sortable: false,
|
|
273
|
-
imex: { header: i18next.t('field.uom'), key: 'newUom', width: 5, type: 'string' },
|
|
274
|
-
width: 70
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
type: 'number',
|
|
278
|
-
name: 'outputQty',
|
|
279
|
-
header: i18next.t('field.output_qty'),
|
|
280
|
-
sortable: false,
|
|
281
|
-
imex: { header: i18next.t('field.output_qty'), key: 'outputQty', width: 10, type: 'string' },
|
|
282
|
-
width: 80
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
type: 'number',
|
|
286
|
-
name: 'newUomValue',
|
|
287
|
-
header: i18next.t('field.uom_value'),
|
|
288
|
-
sortable: false,
|
|
289
|
-
imex: { header: i18next.t('field.uom_value'), key: 'newUomValue', width: 10, type: 'string' },
|
|
290
|
-
width: 80
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
type: 'datetime',
|
|
294
|
-
name: 'completionDate',
|
|
295
|
-
header: i18next.t('field.completion_date'),
|
|
296
|
-
sortable: false,
|
|
297
|
-
imex: { header: i18next.t('field.completion_date'), key: 'completionDate', width: 20, type: 'string' },
|
|
298
|
-
width: 160
|
|
299
|
-
}
|
|
201
|
+
type: 'datetime',
|
|
202
|
+
name: 'executedAt',
|
|
203
|
+
header: i18next.t('field.latest_execution'),
|
|
204
|
+
sortable: false,
|
|
205
|
+
imex: { header: i18next.t('field.latest_execution'), key: 'executedAt', width: 20, type: 'string' },
|
|
206
|
+
width: 160
|
|
207
|
+
}
|
|
300
208
|
]
|
|
301
209
|
}
|
|
302
210
|
}
|
|
@@ -305,6 +213,7 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
305
213
|
this._releaseOrders = []
|
|
306
214
|
this._partners = [...(await this._fetchPartners())]
|
|
307
215
|
this._orderVass = []
|
|
216
|
+
this._vasTypes = VAS_TYPES
|
|
308
217
|
|
|
309
218
|
this._searchFields = this.searchFields
|
|
310
219
|
this._config = this.reportConfig
|
|
@@ -326,40 +235,15 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
326
235
|
items {
|
|
327
236
|
bizplace {
|
|
328
237
|
name
|
|
329
|
-
description
|
|
330
|
-
}
|
|
331
|
-
releaseGood {
|
|
332
|
-
name
|
|
333
|
-
refNo
|
|
334
|
-
}
|
|
335
|
-
orderVas {
|
|
336
|
-
batchId
|
|
337
|
-
packingType
|
|
338
|
-
uom
|
|
339
|
-
uomValue
|
|
340
|
-
newPackingType
|
|
341
|
-
newUom
|
|
342
|
-
newUomValue
|
|
343
|
-
outputQty
|
|
344
|
-
product {
|
|
345
|
-
sku
|
|
346
|
-
}
|
|
347
|
-
newProduct {
|
|
348
|
-
sku
|
|
349
|
-
}
|
|
350
238
|
}
|
|
351
239
|
orderVasItem {
|
|
352
240
|
vas {
|
|
353
241
|
name
|
|
354
242
|
description
|
|
243
|
+
type
|
|
355
244
|
}
|
|
356
245
|
vasQty
|
|
357
|
-
|
|
358
|
-
orderInventory {
|
|
359
|
-
releaseQty
|
|
360
|
-
}
|
|
361
|
-
worksheet {
|
|
362
|
-
endedAt
|
|
246
|
+
executedAt
|
|
363
247
|
}
|
|
364
248
|
}
|
|
365
249
|
}
|
|
@@ -396,22 +280,10 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
396
280
|
return {
|
|
397
281
|
...item,
|
|
398
282
|
bizplaceName: item.bizplace.name,
|
|
399
|
-
ro: item.releaseGood.name,
|
|
400
|
-
refNo: item.releaseGood.refNo,
|
|
401
|
-
sku: item.orderVas.product.sku,
|
|
402
|
-
batchId: item.orderVas.batchId,
|
|
403
|
-
packingType: item.orderVas.packingType,
|
|
404
|
-
uom: item.orderVas.uom,
|
|
405
|
-
uomValue: item.orderVas.uomValue,
|
|
406
|
-
releaseQty: item.orderInventory.releaseQty,
|
|
407
283
|
vas: `${item.orderVasItem.vas.name}(${item.orderVasItem.vas.description})`,
|
|
408
284
|
vasQty: item.orderVasItem.vasQty,
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
newUom: item.orderVas.newUom,
|
|
412
|
-
outputQty: item.orderVas.outputQty,
|
|
413
|
-
newUomValue: item.orderVas.newUomValue,
|
|
414
|
-
completionDate: item.worksheet.endedAt
|
|
285
|
+
executedAt: item.orderVasItem.executedAt,
|
|
286
|
+
type: item.orderVasItem.vas.type
|
|
415
287
|
}
|
|
416
288
|
})
|
|
417
289
|
}
|
|
@@ -455,8 +327,6 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
455
327
|
if (!this.searchForm.shadowRoot.querySelector('form').checkValidity())
|
|
456
328
|
throw new Error(i18next.t('text.invalid_form_value'))
|
|
457
329
|
if (!this._bizplaceSelector.value) throw new Error(i18next.t('text.no_company_selected'))
|
|
458
|
-
// if (!this._fromDateInput.value) throw new Error(i18next.t('text.from_date_is_empty'))
|
|
459
|
-
// if (!this._toDateInput.value) throw new Error(i18next.t('text.to_date_is_empty'))
|
|
460
330
|
}
|
|
461
331
|
|
|
462
332
|
_modifyDateRange(e) {
|
|
@@ -505,11 +375,11 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
505
375
|
return {
|
|
506
376
|
header: headerSetting,
|
|
507
377
|
data: this.report.data.records.map(record => {
|
|
508
|
-
let date = new Date(parseInt(record.
|
|
378
|
+
let date = new Date(parseInt(record.orderVasItem.executedAt))
|
|
509
379
|
return flattenObject({
|
|
510
380
|
...record,
|
|
511
|
-
|
|
512
|
-
record.
|
|
381
|
+
executedAt:
|
|
382
|
+
record.orderVasItem.executedAt !== null
|
|
513
383
|
? date.getDate().toString() +
|
|
514
384
|
'/' +
|
|
515
385
|
(date.getMonth() + 1).toString() +
|
|
@@ -383,14 +383,14 @@ class VasExecution extends connect(store)(localize(i18next)(PageView)) {
|
|
|
383
383
|
|
|
384
384
|
const response = await client.mutate({
|
|
385
385
|
mutation: gql`
|
|
386
|
-
mutation
|
|
387
|
-
|
|
386
|
+
mutation executeOrderVasItems($releaseGoodNo: String!, $patches: [OrderVasItemPatch!]!) {
|
|
387
|
+
executeOrderVasItems(releaseGoodNo: $releaseGoodNo, patches: $patches) {
|
|
388
388
|
id
|
|
389
389
|
name
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
`,
|
|
393
|
-
variables: { patches }
|
|
393
|
+
variables: { releaseGoodNo: this.orderNo, patches }
|
|
394
394
|
})
|
|
395
395
|
|
|
396
396
|
if (!response.errors) {
|
package/client/route.js
CHANGED
|
@@ -489,6 +489,10 @@ export default function route(page) {
|
|
|
489
489
|
import('./pages/report/tote-loading-qc-report')
|
|
490
490
|
return page
|
|
491
491
|
|
|
492
|
+
case 'order_vas_report':
|
|
493
|
+
import('./pages/report/order-vas-report')
|
|
494
|
+
return page
|
|
495
|
+
|
|
492
496
|
case 'vas_report':
|
|
493
497
|
import('./pages/report/vas-report')
|
|
494
498
|
return page
|
|
@@ -10,5 +10,5 @@ const product_label_report_1 = require("./product-label-report");
|
|
|
10
10
|
const release_inventory_report_1 = require("./release-inventory-report");
|
|
11
11
|
const tote_loading_qc_report_1 = require("./tote-loading-qc-report");
|
|
12
12
|
const vas_report_1 = require("./vas-report");
|
|
13
|
-
exports.Query = 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.vasReport);
|
|
13
|
+
exports.Query = 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);
|
|
14
14
|
//# 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;AAE5E,qDAAgD;AAChD,iFAA0E;AAC1E,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,iFAA0E;AAC1E,mFAA4E;AAE5E,qDAAgD;AAChD,iFAA0E;AAC1E,mFAA4E;AAC5E,iEAA2D;AAC3D,yEAAmE;AACnE,qEAA0D;AAC1D,6CAAwD;AAE3C,QAAA,KAAK,mJACb,wDAAyB,GACzB,0DAA0B,GAC1B,8BAAa,GACb,wDAAyB,GACzB,0DAA0B,GAC1B,yCAAkB,GAClB,iDAAsB,GACtB,wCAAe,GACf,2BAAc,GACd,sBAAS,EACb"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vasReport = void 0;
|
|
3
|
+
exports.vasReport = exports.orderVasReport = void 0;
|
|
4
4
|
const biz_base_1 = require("@things-factory/biz-base");
|
|
5
5
|
const utils_1 = require("../../../utils");
|
|
6
|
-
exports.
|
|
7
|
-
async
|
|
6
|
+
exports.orderVasReport = {
|
|
7
|
+
async orderVasReport(_, params, context) {
|
|
8
8
|
try {
|
|
9
9
|
const { tx } = context.state;
|
|
10
10
|
let bizplaceFilter = params.filters.find(data => data.name === 'bizplace');
|
|
@@ -38,40 +38,79 @@ exports.vasReport = {
|
|
|
38
38
|
extraQueryFilter = `${extraQueryFilter} and order_no ilike '%${orderNo.value}%' `;
|
|
39
39
|
}
|
|
40
40
|
if (fromDate) {
|
|
41
|
-
extraQueryFilter = `${extraQueryFilter} and
|
|
41
|
+
extraQueryFilter = `${extraQueryFilter} and executed_at >= '%${fromDate.value}%' `;
|
|
42
42
|
}
|
|
43
43
|
if (toDate) {
|
|
44
|
-
extraQueryFilter = `${extraQueryFilter} and
|
|
44
|
+
extraQueryFilter = `${extraQueryFilter} and executed_at <= '%${toDate.value}%' `;
|
|
45
45
|
}
|
|
46
46
|
await tx.query(`
|
|
47
47
|
create temp table temp_vas_order_report on commit drop as (
|
|
48
48
|
select * from (
|
|
49
|
-
select
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
select
|
|
50
|
+
ov.id as "order_vas_id",
|
|
51
|
+
ov.name as "order_vas_name",
|
|
52
|
+
b.name as "company",
|
|
53
|
+
rg.name as "order_no",
|
|
54
|
+
rg.ref_no as "ref_no",
|
|
55
|
+
p.sku as "sku",
|
|
56
|
+
ov.batch_id as "batch_no",
|
|
57
|
+
ov.packing_type as "packing_type",
|
|
58
|
+
ov.uom as "uom",
|
|
59
|
+
v.id as "vas_id",
|
|
60
|
+
v.name as "vas_name",
|
|
61
|
+
v.description as "vas_description",
|
|
62
|
+
ovi.vas_qty as "vas_qty",
|
|
63
|
+
p2.sku as "new_sku",
|
|
64
|
+
ov.new_packing_type as "new_packing_type",
|
|
65
|
+
ov.new_uom as "new_uom",
|
|
66
|
+
ov.new_uom_value as "new_uom_value",
|
|
67
|
+
w.ended_at as "completion_date",
|
|
68
|
+
p.name as "old_product_name",
|
|
69
|
+
p.description as "old_p_description",
|
|
70
|
+
p.brand as "old_p_brand",
|
|
71
|
+
p.brand_sku as "old_p_brand_sku",
|
|
72
|
+
p2.name as "new_product_name",
|
|
73
|
+
p2.description as "new_p_description",
|
|
74
|
+
p2.brand as "new_p_brand",
|
|
75
|
+
p2.brand_sku as "new_p_brand_sku",
|
|
76
|
+
ovi.executed_at as "executed_at",
|
|
77
|
+
ov.created_at as "created_at",
|
|
78
|
+
(SELECT coalesce(SUM(op.release_qty), 0)
|
|
79
|
+
FROM order_products op
|
|
80
|
+
WHERE op.release_good_id = rg.id and p.id = op.product_id and pd.id = op.product_detail_id and op.batch_id = ov.batch_id) as "release_qty",
|
|
81
|
+
(SELECT coalesce(SUM(ov2.qty), 0)
|
|
82
|
+
FROM order_vass ov2
|
|
83
|
+
WHERE ov2.id = ov.id) as "qty",
|
|
84
|
+
(SELECT coalesce(SUM(ov3.output_qty), 0)
|
|
85
|
+
FROM order_vass ov3
|
|
86
|
+
WHERE ov3.id = ov.id) as "output_qty"
|
|
87
|
+
from order_vas_items ovi
|
|
88
|
+
inner join order_vass ov on ovi.order_vas_id = ov.id
|
|
89
|
+
inner join products p on ov.product_id = p.id
|
|
90
|
+
inner join product_details pd on pd.id = ov.product_detail_id
|
|
91
|
+
left join products p2 on p2.id = ov.new_product_id
|
|
92
|
+
left join product_details pd2 on pd2.id = ov.new_product_detail_id
|
|
93
|
+
inner join vass v on v.id = ovi.vas_id
|
|
94
|
+
inner join worksheet_details wd on ov.id = wd.target_vas_id
|
|
95
|
+
inner join worksheets w on w.id = wd.worksheet_id
|
|
96
|
+
inner join release_goods rg on w.release_good_id = rg.id
|
|
97
|
+
inner join bizplaces b on b.id = rg.bizplace_id
|
|
98
|
+
where b.id = $1
|
|
99
|
+
and w.type = 'VAS'
|
|
100
|
+
and ((w.status <> 'CANCELLED'
|
|
101
|
+
and rg.status not in ('CANCELLED', 'PENDING_CANCEL'))
|
|
102
|
+
or (ovi.executed_at notnull and rg.status in ('CANCELLED', 'PENDING_CANCEL')))
|
|
65
103
|
) src
|
|
66
104
|
where 1=1
|
|
67
105
|
${extraQueryFilter}
|
|
68
|
-
)
|
|
106
|
+
)
|
|
69
107
|
`, [bizplace.id]);
|
|
70
108
|
const total = await tx.query(`
|
|
71
109
|
select count(*) from temp_vas_order_report
|
|
72
110
|
`);
|
|
73
111
|
const result = await tx.query(`
|
|
74
112
|
select * from temp_vas_order_report
|
|
113
|
+
order by "created_at" desc, "order_no", "sku", "batch_no", "order_vas_name"
|
|
75
114
|
`);
|
|
76
115
|
let items = result.map(item => {
|
|
77
116
|
let data = {
|
|
@@ -84,6 +123,8 @@ exports.vasReport = {
|
|
|
84
123
|
refNo: item.ref_no
|
|
85
124
|
},
|
|
86
125
|
orderVas: {
|
|
126
|
+
id: item.order_vas_id,
|
|
127
|
+
name: item.order_vas_name,
|
|
87
128
|
batchId: item.batch_no,
|
|
88
129
|
packingType: item.packing_type,
|
|
89
130
|
uom: item.uom,
|
|
@@ -93,11 +134,13 @@ exports.vasReport = {
|
|
|
93
134
|
newUomValue: item.new_uom_value,
|
|
94
135
|
outputQty: item.output_qty,
|
|
95
136
|
product: { sku: item.sku },
|
|
96
|
-
newProduct: { sku: item.new_sku }
|
|
137
|
+
newProduct: { sku: item.new_sku },
|
|
138
|
+
qty: item.qty
|
|
97
139
|
},
|
|
98
140
|
orderVasItem: {
|
|
99
141
|
vas: { id: item.vas_id, name: item.vas_name, description: item.vas_description },
|
|
100
|
-
vasQty: item.vas_qty
|
|
142
|
+
vasQty: item.vas_qty,
|
|
143
|
+
executedAt: item.executed_at
|
|
101
144
|
},
|
|
102
145
|
orderInventory: {
|
|
103
146
|
releaseQty: item.release_qty
|
|
@@ -118,4 +161,103 @@ exports.vasReport = {
|
|
|
118
161
|
}
|
|
119
162
|
}
|
|
120
163
|
};
|
|
164
|
+
exports.vasReport = {
|
|
165
|
+
async vasReport(_, params, context) {
|
|
166
|
+
try {
|
|
167
|
+
const { tx } = context.state;
|
|
168
|
+
let bizplaceFilter = params.filters.find(data => data.name === 'bizplace');
|
|
169
|
+
let fromDate = params.filters.find(data => data.name === 'fromDate');
|
|
170
|
+
let toDate = params.filters.find(data => data.name === 'toDate');
|
|
171
|
+
let vasFilter = params.filters.find(data => data.name === 'vas');
|
|
172
|
+
let typeFilter = params.filters.find(data => data.name === 'type');
|
|
173
|
+
const domain = context.state.domain;
|
|
174
|
+
if (!bizplaceFilter) {
|
|
175
|
+
throw 'Invalid input';
|
|
176
|
+
}
|
|
177
|
+
const bizplace = await tx.getRepository(biz_base_1.Bizplace).findOne({
|
|
178
|
+
id: bizplaceFilter.value
|
|
179
|
+
});
|
|
180
|
+
await (0, utils_1.rawProductsQuery)(tx, params, bizplace);
|
|
181
|
+
let extraQueryFilter = '';
|
|
182
|
+
if (fromDate) {
|
|
183
|
+
extraQueryFilter = `${extraQueryFilter} and executed_at >= '%${fromDate.value}%' `;
|
|
184
|
+
}
|
|
185
|
+
if (toDate) {
|
|
186
|
+
extraQueryFilter = `${extraQueryFilter} and executed_at <= '%${toDate.value}%' `;
|
|
187
|
+
}
|
|
188
|
+
if (vasFilter) {
|
|
189
|
+
extraQueryFilter = `${extraQueryFilter} and (
|
|
190
|
+
vas_name ilike '%${vasFilter.value}%'
|
|
191
|
+
or vas_description ilike '%${vasFilter.value}%') `;
|
|
192
|
+
}
|
|
193
|
+
if (typeFilter) {
|
|
194
|
+
extraQueryFilter = `${extraQueryFilter} and vas_type = '${typeFilter.value}' `;
|
|
195
|
+
}
|
|
196
|
+
await tx.query(`
|
|
197
|
+
create temp table temp_vas_order_report on commit drop as (
|
|
198
|
+
select * from (
|
|
199
|
+
select v.id as "vas_id",
|
|
200
|
+
v."name" as "vas_name",
|
|
201
|
+
v.description as "vas_description",
|
|
202
|
+
v.type as "vas_type",
|
|
203
|
+
(SELECT coalesce(SUM(ovi.vas_qty), 0)
|
|
204
|
+
FROM order_vas_items ovi
|
|
205
|
+
inner join order_vass ov on ov.id = ovi.order_vas_id
|
|
206
|
+
inner join worksheet_details wd on ov.id = wd.target_vas_id
|
|
207
|
+
inner join worksheets w on wd.worksheet_id = w.id
|
|
208
|
+
inner join release_goods rg on w.release_good_id = rg.id
|
|
209
|
+
inner join bizplaces b on rg.bizplace_id = b.id
|
|
210
|
+
WHERE ovi.vas_id = v.id
|
|
211
|
+
and b.id = $1
|
|
212
|
+
and ((w.status <> 'CANCELLED'
|
|
213
|
+
and rg.status not in ('CANCELLED', 'PENDING_CANCEL'))
|
|
214
|
+
or (ovi.executed_at notnull and rg.status in ('CANCELLED', 'PENDING_CANCEL')))
|
|
215
|
+
) as "vas_qty",
|
|
216
|
+
(SELECT max(ovi2.executed_at)
|
|
217
|
+
FROM order_vas_items ovi2
|
|
218
|
+
inner join order_vass ov2 on ov2.id = ovi2.order_vas_id
|
|
219
|
+
inner join worksheet_details wd2 on wd2.target_vas_id = ov2.id
|
|
220
|
+
inner join worksheets w2 on w2.id = wd2.worksheet_id
|
|
221
|
+
inner join release_goods rg2 on rg2.id = w2.release_good_id
|
|
222
|
+
inner join bizplaces b2 on b2.id = rg2.bizplace_id
|
|
223
|
+
WHERE ovi2.vas_id = v.id
|
|
224
|
+
and b2.id = $1
|
|
225
|
+
) as "executed_at"
|
|
226
|
+
from vass v
|
|
227
|
+
where v.domain_id = $2
|
|
228
|
+
)src
|
|
229
|
+
where 1=1
|
|
230
|
+
${extraQueryFilter}
|
|
231
|
+
)
|
|
232
|
+
`, [bizplace.id, domain.id]);
|
|
233
|
+
const total = await tx.query(`
|
|
234
|
+
select count(*) from temp_vas_order_report
|
|
235
|
+
`);
|
|
236
|
+
const result = await tx.query(`
|
|
237
|
+
select * from temp_vas_order_report
|
|
238
|
+
order by "vas_name", "vas_description"
|
|
239
|
+
`);
|
|
240
|
+
let items = result.map(item => {
|
|
241
|
+
let data = {
|
|
242
|
+
bizplace: {
|
|
243
|
+
name: bizplace.name
|
|
244
|
+
},
|
|
245
|
+
orderVasItem: {
|
|
246
|
+
vas: { id: item.vas_id, name: item.vas_name, description: item.vas_description, type: item.vas_type },
|
|
247
|
+
vasQty: item.vas_qty,
|
|
248
|
+
executedAt: item.executed_at
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
return data;
|
|
252
|
+
});
|
|
253
|
+
return {
|
|
254
|
+
items,
|
|
255
|
+
total: total[0].count
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
throw error;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
121
263
|
//# sourceMappingURL=vas-report.js.map
|