@things-factory/operato-wms 4.3.503 → 4.3.505

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.
Files changed (24) hide show
  1. package/client/pages/bulk-operation/validate-b2c-ro-popup.js +5 -1
  2. package/client/pages/manifest/create-loading-manifest.js +12 -21
  3. package/client/pages/manifest/existing-manifest-list.js +15 -20
  4. package/client/pages/manifest/generate-manifest-popup.js +9 -12
  5. package/client/pages/manifest/loading-manifest-detail.js +6 -1
  6. package/client/pages/manifest/loading-manifest-list.js +15 -17
  7. package/client/pages/order/release-order/b2c/b2c-order-requests.js +10 -28
  8. package/client/pages/order/release-order/b2c/create-b2c-release-order.js +4 -1
  9. package/client/pages/outbound/item-label-popup.js +1 -0
  10. package/client/pages/outbound/picking-product.js +3 -3
  11. package/client/pages/outbound/worksheet-packing.js +5 -1
  12. package/client/pages/outbound/worksheet-picking.js +2 -0
  13. package/client/pages/report/manifest-report.js +321 -325
  14. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +22 -3
  15. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js.map +1 -1
  16. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +7 -3
  17. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +1 -1
  18. package/package.json +5 -5
  19. package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +22 -3
  20. package/server/graphql/resolvers/shipping-provider/shipping-providers.ts +7 -3
  21. package/translations/en.json +1 -2
  22. package/translations/ko.json +1 -2
  23. package/translations/ms.json +1 -2
  24. package/translations/zh.json +1 -2
@@ -2,116 +2,106 @@ import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
3
 
4
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'
5
+ import { css, html } from 'lit-element'
6
+
7
+ import { i18next, localize } from '@things-factory/i18n-base'
8
+ import { client, gqlContext, PageView } from '@things-factory/shell'
19
9
  import { ScrollbarStyles } from '@things-factory/styles'
20
10
  import { isMobileDevice } from '@things-factory/utils'
21
11
 
22
12
  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() {
13
+ static get styles() {
14
+ return [
15
+ ScrollbarStyles,
16
+ css`
17
+ :host {
18
+ display: flex;
19
+ flex-direction: column;
20
+ overflow: hidden;
21
+ }
22
+
23
+ search-form {
24
+ overflow: visible;
25
+ }
26
+
27
+ data-grist {
28
+ overflow-y: auto;
29
+ flex: 1;
30
+ }
31
+ `
32
+ ]
33
+ }
34
+
35
+ static get properties() {
36
+ return {
37
+ _searchFields: Array,
38
+ config: Object,
39
+ data: Object,
40
+ _shippingProviderList: Array,
41
+ _partners: Object
42
+ }
43
+ }
44
+
45
+ get context() {
46
+ return {
47
+ title: i18next.t('title.manifest_report'),
48
+ exportable: {
49
+ name: i18next.t('title.manifest_report'),
50
+ data: this._exportableData.bind(this)
51
+ }
52
+ }
53
+ }
54
+
55
+ get _fromDateInput() {
56
+ return this.searchForm.shadowRoot.querySelector('input[name=fromDate]')
57
+ }
58
+
59
+ get _toDateInput() {
60
+ return this.searchForm.shadowRoot.querySelector('input[name=toDate]')
61
+ }
62
+
63
+ get searchForm() {
64
+ return this.shadowRoot.querySelector('search-form')
65
+ }
66
+
67
+ get dataGrist() {
68
+ return this.shadowRoot.querySelector('data-grist')
69
+ }
70
+
71
+ get _bizplaceSelector() {
82
72
  return this.searchForm.shadowRoot.querySelector('select[name=bizplace]')
83
73
  }
84
74
 
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',
75
+ render() {
76
+ return html`
77
+ <search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
78
+
79
+ <data-grist
80
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
81
+ .config=${this.config}
82
+ .fetchHandler="${this.fetchHandler.bind(this)}"
83
+ ></data-grist>
84
+ `
85
+ }
86
+
87
+ pageUpdated(changes, lifecycle) {
88
+ if (this.active) {
89
+ this.dataGrist.fetch()
90
+ }
91
+ }
92
+
93
+ constructor() {
94
+ super()
95
+ this._shippingProviderList = []
96
+ }
97
+
98
+ async pageInitialized() {
99
+ const partners = await this._fetchPartners()
100
+ this._searchFields = [
101
+ {
102
+ label: i18next.t('field.company'),
103
+ name: 'bizplace',
104
+ type: 'select',
115
105
  options:
116
106
  partners?.length == 1
117
107
  ? [
@@ -131,155 +121,155 @@ class ManifestReport extends localize(i18next)(PageView) {
131
121
  })
132
122
  .sort(this._compareValues('name', 'asc'))
133
123
  ],
134
- props: { searchOper: 'eq' }
135
- },
136
- {
137
- label: i18next.t('field.from_date'),
138
- name: 'fromDate',
139
- type: 'date',
140
- props: {
124
+ props: { searchOper: 'eq' }
125
+ },
126
+ {
127
+ label: i18next.t('field.from_date'),
128
+ name: 'fromDate',
129
+ type: 'date',
130
+ props: {
141
131
  searchOper: 'eq',
142
132
  max: new Date().toISOString().split('T')[0]
143
133
  },
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
- }
134
+ value: (() => {
135
+ let date = new Date()
136
+ date.setMonth(date.getMonth() - 1)
137
+ return date.toISOString().split('T')[0]
138
+ })(),
139
+ handlers: { change: this._modifyDateRange.bind(this) }
140
+ },
141
+ {
142
+ label: i18next.t('field.to_date'),
143
+ name: 'toDate',
144
+ type: 'date',
145
+ props: {
146
+ searchOper: 'eq',
147
+ max: new Date().toISOString().split('T')[0],
148
+ min: (() => {
149
+ let date = new Date()
150
+ date.setMonth(date.getMonth() - 1)
151
+ return date.toISOString().split('T')[0]
152
+ })()
153
+ },
154
+ value: new Date().toISOString().split('T')[0]
155
+ },
156
+ {
157
+ label: i18next.t('field.tracking_no'),
158
+ name: 'trackingNo',
159
+ type: 'text',
160
+ props: { searchOper: 'eq' }
161
+ },
162
+ {
163
+ label: i18next.t('field.ro_no'),
164
+ name: 'releaseGoodNo',
165
+ type: 'text',
166
+ props: { searchOper: 'eq' }
167
+ },
168
+ {
169
+ label: i18next.t('field.tracking_no'),
170
+ name: 'hasTrackingNo',
171
+ type: 'checkbox',
172
+ props: { searchOper: 'eq' },
173
+ attrs: ['indeterminate']
174
+ }
175
+ ]
176
+
177
+ this.config = {
178
+ list: {
179
+ fields: [
180
+ 'company',
181
+ 'refNo',
182
+ 'roNo',
183
+ 'status',
184
+ 'trackingNo',
185
+ 'name',
186
+ 'manifestedAt',
187
+ 'manifestedBy',
188
+ 'createdAt',
189
+ 'transporter'
190
+ ]
191
+ },
192
+ rows: { appendable: false, selectable: false },
193
+ columns: [
194
+ { type: 'gutter', gutterName: 'sequence' },
195
+ {
196
+ type: 'string',
197
+ name: 'bizplace',
198
+ header: i18next.t('field.company'),
199
+ label: true,
200
+ width: 130
201
+ },
202
+ {
203
+ type: 'string',
204
+ name: 'refNo',
205
+ header: i18next.t('field.ref_no'),
206
+ label: true,
207
+ width: 140
208
+ },
209
+ {
210
+ type: 'string',
211
+ name: 'roNo',
212
+ header: i18next.t('field.ro_no'),
213
+ label: true,
214
+ width: 150
215
+ },
216
+ {
217
+ type: 'string',
218
+ name: 'status',
219
+ header: i18next.t('field.status'),
220
+ label: true,
221
+ width: 120
222
+ },
223
+ {
224
+ type: 'string',
225
+ name: 'trackingNo',
226
+ header: i18next.t('field.tracking_no'),
227
+ label: true,
228
+ width: 120
229
+ },
230
+ {
231
+ type: 'string',
232
+ name: 'manifestNo',
233
+ header: i18next.t('field.manifest_no'),
234
+ label: true,
235
+ width: 140
236
+ },
237
+ {
238
+ type: 'datetime',
239
+ name: 'manifestedAt',
240
+ header: i18next.t('field.manifested_at'),
241
+ label: true,
242
+ width: 120
243
+ },
244
+ {
245
+ type: 'string',
246
+ name: 'manifestedBy',
247
+ header: i18next.t('field.manifested_by'),
248
+ label: true,
249
+ width: 130
250
+ },
251
+ {
252
+ type: 'datetime',
253
+ name: 'orderedAt',
254
+ header: i18next.t('field.created_at'),
255
+ label: true,
256
+ width: 120
257
+ },
258
+ {
259
+ type: 'string',
260
+ name: 'transporter',
261
+ header: i18next.t('field.transporter'),
262
+ label: true,
263
+ width: 120
264
+ }
265
+ ]
266
+ }
267
+ }
278
268
 
279
269
  async fetchHandler({ page, limit, sorters = [{ name: 'createdAt', desc: true }] }) {
280
- try {
281
- this._validate()
282
- let filters = this.searchForm.queryFilters.map(filter => {
270
+ try {
271
+ this._validate()
272
+ let filters = this.searchForm.queryFilters.map(filter => {
283
273
  switch (filter.name) {
284
274
  case 'fromDate':
285
275
  let fromDt = new Date(filter.value)
@@ -297,39 +287,45 @@ class ManifestReport extends localize(i18next)(PageView) {
297
287
  return filter
298
288
  })
299
289
 
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
- }
290
+ const response = await client.query({
291
+ query: gql`
292
+ query manifestReport($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
293
+ manifestReport(filters: $filters, pagination: $pagination, sortings: $sortings) {
294
+ items {
295
+ bizplace
296
+ refNo
297
+ roNo
298
+ status
299
+ trackingNo
300
+ manifestNo
301
+ manifestedAt
302
+ manifestedBy
303
+ orderedAt
304
+ transporter
305
+ }
306
+ total
307
+ }
308
+ }
309
+ `,
310
+ variables: { filters, pagination: { page, limit }, sortings: sorters },
311
+ context: gqlContext()
312
+ })
313
+
314
+ if (!response.errors) {
315
+ return {
316
+ total: response.data.manifestReport.total || 0,
317
+ records: (response.data.manifestReport.items || []).map(item => {
318
+ let transporterData = item?.transporter == 'EMS' ? 'EFMX' : item.transporter
319
+ return {
320
+ ...item,
321
+ transporter: transporterData
322
+ }
323
+ })
324
+ }
325
+ }
326
+ } catch (e) {
327
+ this._showToast(e)
328
+ }
333
329
  }
334
330
 
335
331
  async _fetchPartners() {
@@ -354,7 +350,7 @@ class ManifestReport extends localize(i18next)(PageView) {
354
350
  }
355
351
  }
356
352
 
357
- _validate() {
353
+ _validate() {
358
354
  if (!this.searchForm.shadowRoot.querySelector('form').checkValidity())
359
355
  throw new Error(i18next.t('text.invalid_form_value'))
360
356
  if (!this._bizplaceSelector.value) throw new Error(i18next.t('text.no_company_selected'))
@@ -362,7 +358,7 @@ class ManifestReport extends localize(i18next)(PageView) {
362
358
  if (!this._toDateInput.value) throw new Error(i18next.t('text.to_date_is_empty'))
363
359
  }
364
360
 
365
- _compareValues(key, order = 'asc') {
361
+ _compareValues(key, order = 'asc') {
366
362
  return function innerSort(a, b) {
367
363
  if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
368
364
  return 0
@@ -381,7 +377,7 @@ class ManifestReport extends localize(i18next)(PageView) {
381
377
  }
382
378
  }
383
379
 
384
- _modifyDateRange(e) {
380
+ _modifyDateRange(e) {
385
381
  const fromDate = e.currentTarget.value
386
382
  if (fromDate == '') return
387
383
  if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
@@ -402,47 +398,47 @@ class ManifestReport extends localize(i18next)(PageView) {
402
398
  this._toDateInput.max = max
403
399
  }
404
400
 
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
- }
401
+ async _exportableData() {
402
+ try {
403
+ var headerSetting = [
404
+ { header: i18next.t('field.company'), key: 'bizplace', width: 40, type: 'string' },
405
+ { header: i18next.t('field.ref_no'), key: 'refNo', width: 20, type: 'string' },
406
+ { header: i18next.t('field.ro_no'), key: 'roNo', width: 30, type: 'string' },
407
+ { header: i18next.t('field.status'), key: 'status', width: 15, type: 'string' },
408
+ { header: i18next.t('field.tracking_no'), key: 'trackingNo', width: 15, type: 'string' },
409
+ { header: i18next.t('field.manifest_no'), key: 'manifestNo', width: 20, type: 'string' },
410
+ { header: i18next.t('field.manifested_at'), key: 'manifestedAt', width: 20, type: 'string' },
411
+ { header: i18next.t('field.manifested_by'), key: 'manifestedBy', width: 20, type: 'string' },
412
+ { header: i18next.t('field.created_at'), key: 'orderedAt', width: 20, type: 'string' },
413
+ { header: i18next.t('field.transporter'), key: 'transporter', width: 20, type: 'string' }
414
+ ]
415
+
416
+ var exportData = {
417
+ header: [...headerSetting],
418
+ data: (await this.fetchHandler({ page: 1, limit: 999999 })).records.map(itm => {
419
+ return {
420
+ ...itm,
421
+ manifestedAt: itm.manifestedAt ? new Date(parseInt(itm.manifestedAt)).toLocaleString() : '',
422
+ orderedAt: itm.orderedAt ? new Date(parseInt(itm.orderedAt)).toLocaleString() : ''
423
+ }
424
+ })
425
+ }
426
+ return exportData
427
+ } catch (e) {
428
+ this._showToast(e)
429
+ }
430
+ }
431
+
432
+ _showToast({ type, message }) {
433
+ document.dispatchEvent(
434
+ new CustomEvent('notify', {
435
+ detail: {
436
+ type,
437
+ message
438
+ }
439
+ })
440
+ )
441
+ }
446
442
  }
447
443
 
448
- customElements.define('manifest-report', ManifestReport)
444
+ customElements.define('manifest-report', ManifestReport)