@things-factory/operato-wms 4.3.59 → 4.3.62

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 (65) hide show
  1. package/client/pages/components/select-inventory-popup.js +626 -0
  2. package/client/pages/inbound/select-product-batch.js +7 -1
  3. package/client/pages/inbound/unload-product.js +75 -25
  4. package/client/pages/inventory/inventory-adjustment.js +1 -1
  5. package/client/pages/inventory/inventory-by-product-detail.js +99 -92
  6. package/client/pages/inventory/inventory-by-product.js +170 -68
  7. package/client/pages/inventory-check/inspecting-product.js +1 -1
  8. package/client/pages/order/release-order/b2b/b2b-order-list.js +76 -80
  9. package/client/pages/order/release-order/b2c/b2c-order-requests.js +93 -81
  10. package/client/pages/order/release-order/batch-picking-popup.js +11 -0
  11. package/client/pages/order/release-order/create-release-order.js +258 -252
  12. package/client/pages/order/release-order/release-extra-product-popup.js +10 -3
  13. package/client/pages/order/release-order/release-order-detail.js +202 -63
  14. package/client/pages/order/transport-order/delivery-note-popup.js +12 -17
  15. package/client/pages/order/transport-order/upload-delivery-note.js +6 -4
  16. package/client/pages/order/transport-order/view-delivery-note.js +0 -1
  17. package/client/pages/outbound/generate-worksheet-popup.js +337 -0
  18. package/client/pages/outbound/inventory-reassign-popup.js +1097 -0
  19. package/client/pages/outbound/loading-product.js +2 -2
  20. package/client/pages/outbound/picking-product.js +174 -100
  21. package/client/pages/outbound/sorting-product.js +5 -5
  22. package/client/pages/outbound/worksheet-batch-picking.js +39 -5
  23. package/client/pages/outbound/worksheet-picking.js +45 -6
  24. package/client/pages/report/outbound-order-details-report.js +181 -49
  25. package/client/pages/report/release-inventory-report.js +503 -0
  26. package/client/route.js +5 -0
  27. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +3 -3
  28. package/dist-server/graphql/resolvers/extra/add-release-good-products.js +54 -3
  29. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
  30. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  31. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  32. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +63 -28
  33. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  34. package/dist-server/graphql/resolvers/reports/release-inventory-report.js +180 -0
  35. package/dist-server/graphql/resolvers/reports/release-inventory-report.js.map +1 -0
  36. package/dist-server/graphql/types/reports/index.js +6 -1
  37. package/dist-server/graphql/types/reports/index.js.map +1 -1
  38. package/dist-server/graphql/types/reports/outbound-order-details-report.js +14 -1
  39. package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
  40. package/dist-server/graphql/types/reports/release-inventory-report-list.js +14 -0
  41. package/dist-server/graphql/types/reports/release-inventory-report-list.js.map +1 -0
  42. package/dist-server/graphql/types/reports/release-inventory-report.js +29 -0
  43. package/dist-server/graphql/types/reports/release-inventory-report.js.map +1 -0
  44. package/dist-server/utils/report-query-util.js +4 -2
  45. package/dist-server/utils/report-query-util.js.map +1 -1
  46. package/helps/release-note.ko.md +13 -7
  47. package/helps/release-note.md +13 -7
  48. package/helps/release-note.ms.md +13 -7
  49. package/helps/release-note.zh.md +13 -7
  50. package/package.json +10 -10
  51. package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +3 -3
  52. package/server/graphql/resolvers/extra/add-release-good-products.ts +66 -3
  53. package/server/graphql/resolvers/reports/index.ts +3 -1
  54. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +66 -29
  55. package/server/graphql/resolvers/reports/release-inventory-report.ts +202 -0
  56. package/server/graphql/types/reports/index.ts +6 -1
  57. package/server/graphql/types/reports/outbound-order-details-report.ts +14 -1
  58. package/server/graphql/types/reports/release-inventory-report-list.ts +8 -0
  59. package/server/graphql/types/reports/release-inventory-report.ts +23 -0
  60. package/server/utils/report-query-util.ts +4 -2
  61. package/things-factory.config.js +4 -0
  62. package/translations/en.json +73 -16
  63. package/translations/ko.json +157 -110
  64. package/translations/ms.json +65 -16
  65. package/translations/zh.json +79 -29
@@ -15,6 +15,7 @@ import { isMobileDevice } from '@things-factory/utils'
15
15
  class InventoryByProduct extends localize(i18next)(PageView) {
16
16
  static get properties() {
17
17
  return {
18
+ _checkedBoxes: Array,
18
19
  _searchFields: Array,
19
20
  config: Object,
20
21
  data: Object
@@ -43,6 +44,11 @@ class InventoryByProduct extends localize(i18next)(PageView) {
43
44
  ]
44
45
  }
45
46
 
47
+ constructor() {
48
+ super()
49
+ this._checkedBoxes = []
50
+ }
51
+
46
52
  render() {
47
53
  return html`
48
54
  <search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
@@ -70,12 +76,8 @@ class InventoryByProduct extends localize(i18next)(PageView) {
70
76
  return this.shadowRoot.querySelector('search-form')
71
77
  }
72
78
 
73
- get _lowStockCheckbox() {
74
- return this.searchForm.shadowRoot.querySelector('input[name=lowStock]')
75
- }
76
-
77
- get _overStockCheckbox() {
78
- return this.searchForm.shadowRoot.querySelector('input[name=overStock]')
79
+ get _availabletockCheckbox() {
80
+ return this.searchForm.shadowRoot.querySelector('input[name=availableStock]')
79
81
  }
80
82
 
81
83
  get dataGrist() {
@@ -84,6 +86,9 @@ class InventoryByProduct extends localize(i18next)(PageView) {
84
86
 
85
87
  pageUpdated(changes, lifecycle) {
86
88
  if (this.active) {
89
+ if (this._availabletockCheckbox && !this._checkedBoxes.length)
90
+ this._checkedBoxes = [this._availabletockCheckbox, { name: 'temp', checked: false }]
91
+
87
92
  this.dataGrist.fetch()
88
93
  }
89
94
  }
@@ -95,17 +100,25 @@ class InventoryByProduct extends localize(i18next)(PageView) {
95
100
  label: i18next.t('field.company'),
96
101
  name: 'bizplace',
97
102
  type: 'select',
98
- options: [
99
- { value: '' },
100
- ...partners
101
- .map(partner => {
102
- return {
103
- name: `${partner.name} ${partner.description ? `(${partner.description})` : ''}`,
104
- value: partner.id
105
- }
106
- })
107
- .sort(this._compareValues('name', 'asc'))
108
- ],
103
+ options:
104
+ partners?.length == 1
105
+ ? [
106
+ {
107
+ name: `${partners[0].name} ${partners[0].description ? `(${partners[0].description})` : ''}`,
108
+ value: partners[0].id
109
+ }
110
+ ]
111
+ : [
112
+ { value: '' },
113
+ ...partners
114
+ .map(partner => {
115
+ return {
116
+ name: `${partner.name} ${partner.description ? `(${partner.description})` : ''}`,
117
+ value: partner.id
118
+ }
119
+ })
120
+ .sort(this._compareValues('name', 'asc'))
121
+ ],
109
122
  props: { searchOper: 'eq' }
110
123
  },
111
124
  {
@@ -115,18 +128,18 @@ class InventoryByProduct extends localize(i18next)(PageView) {
115
128
  props: { searchOper: 'eq' }
116
129
  },
117
130
  {
118
- label: i18next.t('field.type'),
119
- name: 'type',
131
+ label: i18next.t('field.packing_type'),
132
+ name: 'packingType',
120
133
  type: 'string',
121
134
  props: { searchOper: 'eq' }
122
135
  },
123
- ,
124
136
  {
125
- label: i18next.t('field.available_stock_only'),
137
+ label: i18next.t('field.available_qty_only'),
126
138
  name: 'availableStock',
127
139
  type: 'checkbox',
128
140
  value: true,
129
- props: { searchOper: 'eq' }
141
+ props: { searchOper: 'eq' },
142
+ handlers: { change: this._updateSearchInputState.bind(this, 'availableStock') }
130
143
  },
131
144
  {
132
145
  label: i18next.t('field.low_on_stock'),
@@ -143,6 +156,22 @@ class InventoryByProduct extends localize(i18next)(PageView) {
143
156
  value: false,
144
157
  props: { searchOper: 'eq' },
145
158
  handlers: { change: this._updateSearchInputState.bind(this, 'overStock') }
159
+ },
160
+ {
161
+ label: i18next.t('field.quarantine_stock_only'),
162
+ name: 'quarantineStock',
163
+ type: 'checkbox',
164
+ value: false,
165
+ props: { searchOper: 'eq' },
166
+ handlers: { change: this._updateSearchInputState.bind(this, 'quarantineStock') }
167
+ },
168
+ {
169
+ label: i18next.t('field.reserve_stock_only'),
170
+ name: 'reserveStock',
171
+ type: 'checkbox',
172
+ value: false,
173
+ props: { searchOper: 'eq' },
174
+ handlers: { change: this._updateSearchInputState.bind(this, 'reserveStock') }
146
175
  }
147
176
  ]
148
177
 
@@ -167,6 +196,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
167
196
  header: i18next.t('field.company'),
168
197
  imex: { header: i18next.t('field.company'), key: 'bizplace', width: 50, type: 'string' },
169
198
  sortable: true,
199
+ label: true,
170
200
  width: 300
171
201
  },
172
202
  {
@@ -174,6 +204,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
174
204
  name: 'sku',
175
205
  imex: { header: i18next.t('field.sku'), key: 'sku', width: 30, type: 'string' },
176
206
  header: i18next.t('field.sku'),
207
+ label: true,
177
208
  width: 100
178
209
  },
179
210
  {
@@ -181,6 +212,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
181
212
  name: 'name',
182
213
  imex: { header: i18next.t('field.name'), key: 'name', width: 50, type: 'string' },
183
214
  header: i18next.t('field.name'),
215
+ label: true,
184
216
  width: 200
185
217
  },
186
218
  {
@@ -188,6 +220,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
188
220
  name: 'brand',
189
221
  imex: { header: i18next.t('field.brand'), key: 'brand', width: 30, type: 'string' },
190
222
  header: i18next.t('field.brand'),
223
+ label: true,
191
224
  width: 100
192
225
  },
193
226
  {
@@ -195,21 +228,15 @@ class InventoryByProduct extends localize(i18next)(PageView) {
195
228
  name: 'description',
196
229
  imex: { header: i18next.t('field.description'), key: 'description', width: 50, type: 'string' },
197
230
  header: i18next.t('field.description'),
198
- width: 300
199
- },
200
- {
201
- type: 'object',
202
- name: 'productRef',
203
- record: { options: { queryName: 'products' } },
204
- imex: { header: i18next.t('field.product_ref'), key: 'product_ref', width: 50, type: 'string' },
205
- header: i18next.t('field.product_ref'),
231
+ label: true,
206
232
  width: 300
207
233
  },
208
234
  {
209
235
  type: 'string',
210
- name: 'type',
211
- imex: { header: i18next.t('field.type'), key: 'type', width: 25, type: 'string' },
212
- header: i18next.t('field.type'),
236
+ name: 'packingType',
237
+ imex: { header: i18next.t('field.packing_type'), key: 'packingType', width: 25, type: 'string' },
238
+ header: i18next.t('field.packing_type'),
239
+ label: true,
213
240
  width: 150
214
241
  },
215
242
  {
@@ -217,6 +244,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
217
244
  name: 'minQty',
218
245
  imex: { header: i18next.t('field.min_qty'), key: 'minQty', width: 20, type: 'integer' },
219
246
  header: i18next.t('field.min_qty'),
247
+ label: true,
220
248
  width: 80
221
249
  },
222
250
  {
@@ -224,13 +252,52 @@ class InventoryByProduct extends localize(i18next)(PageView) {
224
252
  name: 'maxQty',
225
253
  imex: { header: i18next.t('field.max_qty'), key: 'maxQty', width: 20, type: 'integer' },
226
254
  header: i18next.t('field.max_qty'),
255
+ label: true,
256
+ width: 80
257
+ },
258
+ {
259
+ type: 'integer',
260
+ name: 'availableQty',
261
+ imex: { header: i18next.t('field.available_qty'), key: 'availableQty', width: 20, type: 'integer' },
262
+ header: i18next.t('field.available_qty'),
263
+ label: true,
264
+ sortable: true,
265
+ width: 80
266
+ },
267
+ {
268
+ type: 'integer',
269
+ name: 'releaseQty',
270
+ imex: { header: i18next.t('field.release_qty'), key: 'releaseQty', width: 20, type: 'integer' },
271
+ header: i18next.t('field.release_qty'),
272
+ label: true,
273
+ sortable: true,
227
274
  width: 80
228
275
  },
229
276
  {
230
277
  type: 'integer',
231
- name: 'qty',
232
- imex: { header: i18next.t('field.qty'), key: 'qty', width: 20, type: 'integer' },
233
- header: i18next.t('field.qty'),
278
+ name: 'quarantineQty',
279
+ imex: { header: i18next.t('field.quarantine_qty'), key: 'quarantineQty', width: 20, type: 'integer' },
280
+ header: i18next.t('field.quarantine_qty'),
281
+ label: true,
282
+ sortable: true,
283
+ width: 80
284
+ },
285
+ {
286
+ type: 'integer',
287
+ name: 'reserveQty',
288
+ imex: { header: i18next.t('field.reserve_qty'), key: 'reserveQty', width: 20, type: 'integer' },
289
+ header: i18next.t('field.reserve_qty'),
290
+ label: true,
291
+ sortable: true,
292
+ width: 80
293
+ },
294
+ {
295
+ type: 'integer',
296
+ name: 'warehouseQty',
297
+ imex: { header: i18next.t('field.warehouse_qty'), key: 'warehouseQty', width: 20, type: 'integer' },
298
+ header: i18next.t('field.warehouse_qty'),
299
+ label: true,
300
+ sortable: true,
234
301
  width: 80
235
302
  }
236
303
  ]
@@ -249,19 +316,19 @@ class InventoryByProduct extends localize(i18next)(PageView) {
249
316
  brand
250
317
  name
251
318
  description
252
- type
253
- bizplace {
254
- name
255
- }
256
- productRef {
257
- name
258
- description
259
- }
260
319
  minQty
261
320
  maxQty
262
321
  }
263
- qty
322
+ bizplace {
323
+ name
324
+ }
325
+ packingType
264
326
  averageUnitCost
327
+ availableQty
328
+ releaseQty
329
+ quarantineQty
330
+ reserveQty
331
+ warehouseQty
265
332
  }
266
333
  total
267
334
  }
@@ -274,10 +341,18 @@ class InventoryByProduct extends localize(i18next)(PageView) {
274
341
  return {
275
342
  total: response.data.inventoriesByProduct.total || 0,
276
343
  records: (response.data.inventoriesByProduct.items || []).map(item => {
277
- return {
278
- ...item,
279
- ...item.product
280
- }
344
+ // changed to direct assign instead of spread ...item, ...item.product to improve performance
345
+ let record = item.product
346
+ record.packingType = item.packingType
347
+ record.averageUnitCost = item.averageUnitCost
348
+ record.availableQty = item.availableQty
349
+ record.releaseQty = item.releaseQty
350
+ record.quarantineQty = item.quarantineQty
351
+ record.reserveQty = item.reserveQty
352
+ record.warehouseQty = item.warehouseQty
353
+ record.bizplace = item.bizplace
354
+
355
+ return record
281
356
  })
282
357
  }
283
358
  }
@@ -287,16 +362,44 @@ class InventoryByProduct extends localize(i18next)(PageView) {
287
362
  return this.config.columns
288
363
  }
289
364
 
290
- _updateSearchInputState(input) {
291
- switch (input) {
292
- case 'lowStock':
293
- this._overStockCheckbox.checked = false
294
- break
295
- case 'overStock':
296
- this._lowStockCheckbox.checked = false
297
- break
298
- default:
299
- break
365
+ _updateSearchInputState(fieldName) {
366
+ const targetField = this.searchForm.shadowRoot.querySelector(`input[name=${fieldName}]`)
367
+
368
+ if (targetField.checked) {
369
+ // clear all previously checked fields
370
+ this._checkedBoxes[1].checked = false
371
+ this._checkedBoxes[0].checked = false
372
+
373
+ const tempIdx = this._checkedBoxes.findIndex(cb => cb.name == 'temp')
374
+
375
+ if (fieldName == 'lowStock' || fieldName == 'overStock') {
376
+ const idx = this._checkedBoxes.findIndex(cb => cb.name == (fieldName == 'lowStock' ? 'overStock' : 'lowStock'))
377
+ if (idx == 1) {
378
+ this._checkedBoxes[1] = targetField
379
+ } else {
380
+ if (tempIdx == 1) {
381
+ this._checkedBoxes[1] = targetField
382
+ } else {
383
+ this._checkedBoxes[0] = this._checkedBoxes[1]
384
+ this._checkedBoxes[1] = targetField
385
+ }
386
+ }
387
+ } else {
388
+ if (tempIdx == 1) {
389
+ this._checkedBoxes[1] = targetField
390
+ } else {
391
+ this._checkedBoxes[0] = this._checkedBoxes[1]
392
+ this._checkedBoxes[1] = targetField
393
+ }
394
+ }
395
+
396
+ // reset all fields in _checkedBoxes array to TRUE
397
+ this._checkedBoxes[1].checked = true
398
+ this._checkedBoxes[0].checked = true
399
+ } else {
400
+ // replace unchecked field with default
401
+ const idx = this._checkedBoxes.findIndex(cb => cb.name == fieldName)
402
+ if (idx >= 0) this._checkedBoxes[idx] = { name: 'temp', checked: false }
300
403
  }
301
404
  }
302
405
 
@@ -321,6 +424,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
321
424
  return response.data.partnersBizplaces.items
322
425
  }
323
426
  }
427
+
324
428
  _compareValues(key, order = 'asc') {
325
429
  return function innerSort(a, b) {
326
430
  if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
@@ -360,11 +464,6 @@ class InventoryByProduct extends localize(i18next)(PageView) {
360
464
  })
361
465
 
362
466
  var data = records.map(item => {
363
- if (item.productRef) {
364
- var refName = item.productRef.name ? item.productRef.name : ''
365
- var refDesc = item.productRef.description ? ` (${item.productRef.description})` : ''
366
- }
367
-
368
467
  return {
369
468
  ...this._columns
370
469
  .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
@@ -378,12 +477,15 @@ class InventoryByProduct extends localize(i18next)(PageView) {
378
477
  name: item.name,
379
478
  sku: item.sku,
380
479
  description: item.description,
381
- type: item.type,
480
+ packingType: item.packingType,
382
481
  bizplace: item.bizplace.name,
383
- product_ref: refName + refDesc,
384
- qty: item.qty,
385
482
  minQty: item.minQty,
386
- maxQty: item.maxQty
483
+ maxQty: item.maxQty,
484
+ availableQty: item.availableQty,
485
+ releaseQty: item.releaseQty,
486
+ quarantineQty: item.quarantineQty,
487
+ reserveQty: item.reserveQty,
488
+ warehouseQty: item.warehouseQty
387
489
  // averageUnitCost: item.averageUnitCost
388
490
  }
389
491
  })
@@ -1013,7 +1013,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
1013
1013
  async checkOrderInventory() {
1014
1014
  try {
1015
1015
  const filters = [
1016
- { name: 'inventory', operator: 'eq', value: this.selectedInventory.inventoryId },
1016
+ { name: 'inventoryId', operator: 'eq', value: this.selectedInventory.inventoryId },
1017
1017
  { name: 'status', operator: 'noteq', value: ORDER_INVENTORY_STATUS.TERMINATED.value },
1018
1018
  { name: 'type', operator: 'eq', value: ORDER_TYPES.RELEASE_OF_GOODS.value }
1019
1019
  ]
@@ -1,6 +1,7 @@
1
1
  import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
3
  import '../batch-picking-popup'
4
+ import '../../../outbound/generate-worksheet-popup'
4
5
 
5
6
  import gql from 'graphql-tag'
6
7
  import { css, html } from 'lit-element'
@@ -10,7 +11,7 @@ import { i18next, localize } from '@things-factory/i18n-base'
10
11
  import { client, navigate, PageView, CustomAlert } from '@things-factory/shell'
11
12
  import { openPopup } from '@things-factory/layout-base'
12
13
  import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
13
- import { isMobileDevice } from '@things-factory/utils'
14
+ import { isMobileDevice, sleep } from '@things-factory/utils'
14
15
 
15
16
  import { ORDER_STATUS } from '../../../constants'
16
17
 
@@ -65,18 +66,11 @@ class B2bOrderList extends localize(i18next)(PageView) {
65
66
  var actions = []
66
67
 
67
68
  if (this.isUserBelongsDomain) {
68
- actions.push(
69
- {
70
- title: i18next.t('button.batch_picking'),
71
- action: this._openBatchPickingPopup.bind(this),
72
- ...CommonButtonStyles.activate
73
- },
74
- {
75
- title: i18next.t('button.generate_worksheet'),
76
- action: this._generatePickingWorksheet.bind(this),
77
- ...CommonButtonStyles.activate
78
- }
79
- )
69
+ actions.push({
70
+ title: i18next.t('button.generate_worksheet'),
71
+ action: this._openGenerateWorksheetPopup.bind(this),
72
+ ...CommonButtonStyles.activate
73
+ })
80
74
  }
81
75
  return {
82
76
  title: i18next.t('title.release_orders'),
@@ -114,7 +108,7 @@ class B2bOrderList extends localize(i18next)(PageView) {
114
108
  const _bizplaces = _bizplacesReq.status == 'fulfilled' ? _bizplacesReq.value : []
115
109
  this._searchFields = [
116
110
  {
117
- label: i18next.t('field.ro'),
111
+ label: i18next.t('field.order_info'),
118
112
  name: 'name',
119
113
  type: 'text',
120
114
  props: { searchOper: 'i_like' }
@@ -142,24 +136,6 @@ class B2bOrderList extends localize(i18next)(PageView) {
142
136
  type: 'date',
143
137
  props: { searchOper: 'i_like' }
144
138
  },
145
- {
146
- label: i18next.t('field.ref_no'),
147
- name: 'refNo',
148
- type: 'text',
149
- props: { searchOper: 'i_like' }
150
- },
151
- {
152
- label: i18next.t('field.ref_no_2'),
153
- name: 'refNo2',
154
- type: 'text',
155
- props: { searchOper: 'i_like' }
156
- },
157
- {
158
- label: i18next.t('field.ref_no_3'),
159
- name: 'refNo3',
160
- type: 'text',
161
- props: { searchOper: 'i_like' }
162
- },
163
139
  {
164
140
  label: i18next.t('field.status'),
165
141
  name: 'status',
@@ -177,7 +153,7 @@ class B2bOrderList extends localize(i18next)(PageView) {
177
153
  name: 'fromDate',
178
154
  type: 'date',
179
155
  props: {
180
- searchOper: 'eq'
156
+ searchOper: 'gte'
181
157
  },
182
158
  value: (() => {
183
159
  let date = new Date()
@@ -191,7 +167,7 @@ class B2bOrderList extends localize(i18next)(PageView) {
191
167
  name: 'toDate',
192
168
  type: 'date',
193
169
  props: {
194
- searchOper: 'eq',
170
+ searchOper: 'lte',
195
171
  min: (() => {
196
172
  let date = new Date()
197
173
  date.setMonth(date.getMonth() - 6)
@@ -220,6 +196,13 @@ class B2bOrderList extends localize(i18next)(PageView) {
220
196
  type: 'checkbox',
221
197
  props: { searchOper: 'noteq' },
222
198
  attrs: ['indeterminate']
199
+ },
200
+ {
201
+ label: i18next.t('field.recall'),
202
+ name: 'recall',
203
+ type: 'checkbox',
204
+ props: { searchOper: 'eq' },
205
+ attrs: ['indeterminate']
223
206
  }
224
207
  ]
225
208
 
@@ -336,6 +319,13 @@ class B2bOrderList extends localize(i18next)(PageView) {
336
319
  imex: { header: i18next.t('field.route'), key: 'routeId', width: 20, type: 'string' },
337
320
  width: 60
338
321
  },
322
+ {
323
+ type: 'boolean',
324
+ name: 'recall',
325
+ header: i18next.t('field.recall'),
326
+ imex: { header: i18next.t('field.recall'), key: 'recall', width: 20, type: 'string' },
327
+ width: 60
328
+ },
339
329
  {
340
330
  type: 'object',
341
331
  name: 'arrivalNotice',
@@ -359,6 +349,14 @@ class B2bOrderList extends localize(i18next)(PageView) {
359
349
  sortable: true,
360
350
  width: 160
361
351
  },
352
+ {
353
+ type: 'datetime',
354
+ name: 'acceptedAt',
355
+ header: i18next.t('field.accepted_at'),
356
+ imex: { header: i18next.t('field.accepted_at'), key: 'acceptedAt', width: 30, type: 'datetime' },
357
+ sortable: true,
358
+ width: 160
359
+ },
362
360
  {
363
361
  type: 'datetime',
364
362
  name: 'updatedAt',
@@ -382,6 +380,14 @@ class B2bOrderList extends localize(i18next)(PageView) {
382
380
  imex: { header: i18next.t('field.accepted_by'), key: 'acceptedBy.name', width: 30, type: 'string' },
383
381
  sortable: true,
384
382
  width: 200
383
+ },
384
+ {
385
+ type: 'object',
386
+ name: 'updater',
387
+ header: i18next.t('field.updated_by'),
388
+ imex: { header: i18next.t('field.updated_by'), key: 'updater.name', width: 30, type: 'string' },
389
+ sortable: true,
390
+ width: 200
385
391
  }
386
392
  ]
387
393
  }
@@ -400,6 +406,25 @@ class B2bOrderList extends localize(i18next)(PageView) {
400
406
  }
401
407
 
402
408
  async fetchHandler({ page, limit, sorters = [] }) {
409
+ let filters = this.searchForm.queryFilters.map(filter => {
410
+ switch (filter.name) {
411
+ case 'fromDate':
412
+ let fromDt = new Date(filter.value)
413
+ fromDt.setHours(0)
414
+ filter.value = fromDt.toISOString()
415
+ filter.name = 'createdAt'
416
+ break
417
+ case 'toDate':
418
+ let toDt = new Date(filter.value)
419
+ toDt.setHours(23, 59, 59)
420
+ filter.value = toDt.toISOString()
421
+ filter.name = 'createdAt'
422
+ break
423
+ default:
424
+ break
425
+ }
426
+ return filter
427
+ })
403
428
  const response = await client.query({
404
429
  query: gql`
405
430
  query releaseGoodRequests($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -425,26 +450,32 @@ class B2bOrderList extends localize(i18next)(PageView) {
425
450
  exportOption
426
451
  routeId
427
452
  releaseDate
453
+ recall
428
454
  status
429
455
  createdAt
430
- updatedAt
431
456
  creator {
432
457
  id
433
458
  name
434
459
  description
435
460
  }
461
+ acceptedAt
436
462
  acceptedBy {
437
463
  id
438
464
  name
439
465
  description
440
466
  }
467
+ updatedAt
468
+ updater {
469
+ id
470
+ name
471
+ }
441
472
  }
442
473
  total
443
474
  }
444
475
  }
445
476
  `,
446
477
  variables: {
447
- filters: [...(await this.searchForm.getQueryFilters()), { name: 'type', operator: 'eq', value: 'b2b' }],
478
+ filters: [...filters, { name: 'type', operator: 'eq', value: 'b2b' }],
448
479
  pagination: { page, limit },
449
480
  sortings: sorters
450
481
  }
@@ -507,60 +538,25 @@ class B2bOrderList extends localize(i18next)(PageView) {
507
538
  }
508
539
  }
509
540
 
510
- _openBatchPickingPopup() {
511
- openPopup(
512
- html`
513
- <batch-picking-popup
514
- @generated="${() => {
515
- navigate('merged_outbound_worksheets')
516
- this._showToast({ message: i18next.t('text.worksheet_has_been_generated') })
517
- }}"
518
- ></batch-picking-popup>
519
- `,
520
- {
521
- backdrop: true,
522
- size: 'large',
523
- title: i18next.t('title.generate_batch_picking')
524
- }
525
- )
526
- }
527
-
528
- async _generatePickingWorksheet() {
541
+ async _openGenerateWorksheetPopup() {
529
542
  try {
530
- let releaseGoodNos = []
531
543
  if (this.dataGrist.selected.length <= 0)
532
544
  throw new Error(i18next.t('text.please_select_one_or_more_order_to_generate_worksheet'))
533
545
 
546
+ let releaseGoodNos = []
547
+
534
548
  let readyToPick = this.dataGrist.selected.filter(itm => itm.status === ORDER_STATUS.PENDING_WORKSHEET.value)
535
549
  releaseGoodNos = readyToPick.map(record => record.name)
536
550
 
537
551
  if (releaseGoodNos.length <= 0)
538
- throw new Error(i18next.t('text.selected_release_order(s)_has_existing_worksheet'))
539
-
540
- let result = await CustomAlert({
541
- title: i18next.t('title.are_you_sure'),
542
- text: i18next.t('text.generate_worksheet'),
543
- confirmButton: { text: i18next.t('button.submit') },
544
- cancelButton: { text: i18next.t('button.cancel') }
545
- })
552
+ throw new Error(i18next.t('text.selected_release_order(s)_is_not_in_pending_worksheet_status'))
546
553
 
547
- if (!result.value) return
548
-
549
- const response = await client.mutate({
550
- mutation: gql`
551
- mutation generateMultipleReleaseGoodWorksheet($releaseGoodNos: [String!]) {
552
- generateMultipleReleaseGoodWorksheet(releaseGoodNos: $releaseGoodNos)
553
- }
554
- `,
555
- variables: {
556
- releaseGoodNos
557
- }
554
+ await sleep(1010)
555
+ openPopup(html` <generate-worksheet-popup .gristData=${this.dataGrist}></generate-worksheet-popup> `, {
556
+ backdrop: true,
557
+ size: 'medium',
558
+ title: i18next.t('title.generate_picking_worksheet')
558
559
  })
559
-
560
- if (!response.errors) {
561
- navigate('single_outbound_worksheets')
562
- this._showToast({ message: i18next.t('text.worksheet(s)_has_been_generated') })
563
- }
564
560
  } catch (e) {
565
561
  this._showToast(e)
566
562
  }