@things-factory/operato-wms 3.7.15 → 3.8.3

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 (88) hide show
  1. package/client/pages/adjustment/transfer-inventory.js +390 -158
  2. package/client/pages/bulk-operation/bulk-operation.js +316 -0
  3. package/client/pages/bulk-operation/validate-ro-popup.js +445 -0
  4. package/client/pages/components/select-product-popup.js +1 -1
  5. package/client/pages/constants/inventory.js +1 -0
  6. package/client/pages/constants/location.js +33 -6
  7. package/client/pages/constants/worksheet.js +2 -2
  8. package/client/pages/inbound/inbound-worksheet.js +81 -15
  9. package/client/pages/inbound/putaway-product.js +61 -9
  10. package/client/pages/inbound/putaway-worksheet-generate-popup.js +29 -5
  11. package/client/pages/inbound/unload-product.js +80 -19
  12. package/client/pages/inbound/worksheet-putaway-return.js +14 -5
  13. package/client/pages/inbound/worksheet-putaway.js +13 -8
  14. package/client/pages/inbound/worksheet-unloading-return.js +14 -5
  15. package/client/pages/inventory/inventory-adjustment-approval.js +15 -23
  16. package/client/pages/inventory/inventory-adjustment.js +84 -80
  17. package/client/pages/inventory/inventory-by-product-detail.js +1 -1
  18. package/client/pages/inventory/inventory-by-product.js +1 -1
  19. package/client/pages/inventory/inventory-history-by-pallet.js +1 -1
  20. package/client/pages/inventory/inventory-history.js +2 -2
  21. package/client/pages/inventory/onhand-inventory.js +1 -2
  22. package/client/pages/inventory-check/create-cycle-count.js +1 -6
  23. package/client/pages/master/location-list.js +58 -17
  24. package/client/pages/order/arrival-notice/arrival-notice-detail.js +15 -8
  25. package/client/pages/order/arrival-notice/arrival-notice-list.js +87 -6
  26. package/client/pages/order/arrival-notice/arrival-notice-requests.js +83 -6
  27. package/client/pages/order/arrival-notice/create-arrival-notice.js +23 -2
  28. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +290 -25
  29. package/client/pages/order/arrival-notice/edit-product-popup.js +36 -5
  30. package/client/pages/order/release-order/b2c/b2c-order-requests.js +60 -0
  31. package/client/pages/order/release-order/batch-picking-popup.js +18 -1
  32. package/client/pages/order/release-order/create-release-order.js +2 -2
  33. package/client/pages/order/release-order/release-extra-product-popup.js +12 -4
  34. package/client/pages/order/release-order/release-order-detail.js +1 -1
  35. package/client/pages/order/return-order/create-return-order.js +1 -1
  36. package/client/pages/order/return-order/return-order-detail.js +6 -5
  37. package/client/pages/order/transport-order/delivery-order-list.js +4 -1
  38. package/client/pages/outbound/inventory-assign-popup.js +1 -1
  39. package/client/pages/outbound/merged-outbound-worksheet.js +9 -5
  40. package/client/pages/outbound/picking-product.js +223 -184
  41. package/client/pages/outbound/picking-replacement-popup.js +2 -2
  42. package/client/pages/outbound/single-outbound-worksheet.js +47 -1
  43. package/client/pages/outbound/worksheet-loading.js +14 -5
  44. package/client/pages/outbound/worksheet-picking.js +10 -5
  45. package/client/pages/report/custom-elccl/elccl-inventory-report.js +31 -30
  46. package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +23 -26
  47. package/client/pages/report/inventory-pallet-storage-report.js +11 -10
  48. package/client/pages/report/inventory-report.js +41 -43
  49. package/client/pages/report/inventory-summary-report.js +25 -28
  50. package/client/pages/vas/print-product-label.js +3 -1
  51. package/client/route.js +5 -0
  52. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +1 -1
  53. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  54. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +1 -1
  55. package/dist-server/graphql/resolvers/index.js +3 -1
  56. package/dist-server/graphql/resolvers/index.js.map +1 -1
  57. package/dist-server/graphql/resolvers/reports/product-label-report.js +1 -0
  58. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -1
  59. package/dist-server/graphql/resolvers/shipping-provider/index.js +6 -0
  60. package/dist-server/graphql/resolvers/shipping-provider/index.js.map +1 -0
  61. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +20 -0
  62. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +1 -0
  63. package/dist-server/graphql/types/custom/elccl/elccl-inventory-report.js +1 -1
  64. package/dist-server/graphql/types/index.js +5 -2
  65. package/dist-server/graphql/types/index.js.map +1 -1
  66. package/dist-server/graphql/types/shipping-provider/index.js +10 -0
  67. package/dist-server/graphql/types/shipping-provider/index.js.map +1 -0
  68. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js +13 -0
  69. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js.map +1 -0
  70. package/dist-server/graphql/types/shipping-provider/shipping-provider.js +13 -0
  71. package/dist-server/graphql/types/shipping-provider/shipping-provider.js.map +1 -0
  72. package/package.json +37 -37
  73. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +4 -2
  74. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +1 -1
  75. package/server/graphql/resolvers/index.ts +3 -1
  76. package/server/graphql/resolvers/reports/product-label-report.ts +1 -0
  77. package/server/graphql/resolvers/shipping-provider/index.ts +5 -0
  78. package/server/graphql/resolvers/shipping-provider/shipping-providers.ts +20 -0
  79. package/server/graphql/types/custom/elccl/elccl-inventory-report.ts +1 -1
  80. package/server/graphql/types/index.ts +5 -2
  81. package/server/graphql/types/shipping-provider/index.ts +8 -0
  82. package/server/graphql/types/shipping-provider/shipping-provider-list.ts +7 -0
  83. package/server/graphql/types/shipping-provider/shipping-provider.ts +7 -0
  84. package/things-factory.config.js +6 -0
  85. package/translations/en.json +28 -0
  86. package/translations/ko.json +85 -36
  87. package/translations/ms.json +86 -37
  88. package/translations/zh.json +99 -51
@@ -15,6 +15,7 @@ class WorksheetPutawayReturn extends localize(i18next)(PageView) {
15
15
  _worksheetNo: String,
16
16
  _worksheetStatus: String,
17
17
  _returnOrderNo: String,
18
+ _statusList: Array,
18
19
  config: Object,
19
20
  data: Object
20
21
  }
@@ -107,6 +108,13 @@ class WorksheetPutawayReturn extends localize(i18next)(PageView) {
107
108
  }
108
109
  }
109
110
 
111
+ constructor() {
112
+ super()
113
+ this._statusList = Object.keys(WORKSHEET_STATUS).map(key => {
114
+ return { value: WORKSHEET_STATUS[key].value, display: WORKSHEET_STATUS[key].name }
115
+ })
116
+ }
117
+
110
118
  render() {
111
119
  return html`
112
120
  <div class="form-container">
@@ -126,11 +134,12 @@ class WorksheetPutawayReturn extends localize(i18next)(PageView) {
126
134
  <input name="refNo" readonly />
127
135
 
128
136
  <label>${i18next.t('label.status')}</label>
129
- <select name="status" disabled>
130
- ${Object.keys(WORKSHEET_STATUS).map(
131
- key => html` <option value="${WORKSHEET_STATUS[key].value}">${WORKSHEET_STATUS[key].name}</option> `
132
- )}
133
- </select>
137
+ <input
138
+ name="status"
139
+ value="${this._statusList.find(x => x.value == this._worksheetStatus)?.display || ''}"
140
+ readonly
141
+ disabled
142
+ />
134
143
  </fieldset>
135
144
  </form>
136
145
 
@@ -1,13 +1,16 @@
1
1
  import '@things-factory/barcode-ui'
2
- import { MultiColumnFormStyles } from '@things-factory/form-ui'
3
2
  import '@things-factory/grist-ui'
3
+
4
+ import gql from 'graphql-tag'
5
+ import { css, html } from 'lit-element'
6
+
7
+ import { MultiColumnFormStyles } from '@things-factory/form-ui'
4
8
  import { getRenderer } from '@things-factory/grist-ui'
5
9
  import { i18next, localize } from '@things-factory/i18n-base'
6
10
  import { client, CustomAlert, navigate, PageView } from '@things-factory/shell'
7
11
  import { CommonButtonStyles } from '@things-factory/styles'
8
12
  import { isMobileDevice } from '@things-factory/utils'
9
- import gql from 'graphql-tag'
10
- import { css, html } from 'lit-element'
13
+
11
14
  import {
12
15
  VAS_BATCH_AND_PRODUCT_TYPE,
13
16
  VAS_BATCH_NO_TYPE,
@@ -513,17 +516,19 @@ class WorksheetPutaway extends localize(i18next)(PageView) {
513
516
  !this.preConfig.columns.some(e => e.name === 'status') &&
514
517
  this._worksheetStatus !== WORKSHEET_STATUS.DEACTIVATED.value
515
518
  ) {
516
- this.preConfig.columns = [...this.preConfig.columns, currentLocationColumn, statusColumnConfig]
519
+ this.preConfig.columns = [
520
+ ...this.preConfig.columns,
521
+ currentLocationColumn,
522
+ statusColumnConfig,
523
+ batchIdRefColumnConfig
524
+ ]
517
525
  } else if (
518
526
  this.preConfig.columns.some(e => e.name === 'status') &&
519
527
  this._worksheetStatus === WORKSHEET_STATUS.DEACTIVATED.value
520
528
  ) {
521
529
  this.preConfig.columns.splice(this.preConfig.columns.map(e => e.name).indexOf('location'))
522
530
  this.preConfig.columns.splice(this.preConfig.columns.map(e => e.name).indexOf('status'))
523
- }
524
-
525
- if (this.data.records.some(e => e.batchIdRef)) {
526
- this.preConfig.columns = [...this.preConfig.columns, batchIdRefColumnConfig]
531
+ this.preConfig.columns.splice(this.preConfig.columns.map(e => e.name).indexOf('batchIdRef'))
527
532
  }
528
533
 
529
534
  this.config = { ...this.preConfig }
@@ -19,6 +19,7 @@ class WorksheetUnloadingReturn extends localize(i18next)(PageView) {
19
19
  return {
20
20
  _worksheetNo: String,
21
21
  _worksheetStatus: String,
22
+ _statusList: Array,
22
23
  _returnOrderNo: String,
23
24
  _enableCartonLabel: Boolean,
24
25
  config: Object,
@@ -143,6 +144,13 @@ class WorksheetUnloadingReturn extends localize(i18next)(PageView) {
143
144
  }
144
145
  }
145
146
 
147
+ constructor() {
148
+ super()
149
+ this._statusList = Object.keys(WORKSHEET_STATUS).map(key => {
150
+ return { value: WORKSHEET_STATUS[key].value, display: WORKSHEET_STATUS[key].name }
151
+ })
152
+ }
153
+
146
154
  render() {
147
155
  return html`
148
156
  <div class="form-container">
@@ -159,11 +167,12 @@ class WorksheetUnloadingReturn extends localize(i18next)(PageView) {
159
167
  <input name="refNo" readonly />
160
168
 
161
169
  <label>${i18next.t('label.status')}</label>
162
- <select name="status" disabled>
163
- ${Object.keys(WORKSHEET_STATUS).map(
164
- key => html` <option value="${WORKSHEET_STATUS[key].value}">${WORKSHEET_STATUS[key].name}</option> `
165
- )}
166
- </select>
170
+ <input
171
+ name="status"
172
+ value="${this._statusList.find(x => x.value == this._worksheetStatus)?.display || ''}"
173
+ readonly
174
+ disabled
175
+ />
167
176
  </fieldset>
168
177
  </form>
169
178
 
@@ -120,7 +120,6 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
120
120
 
121
121
  async pageInitialized() {
122
122
  this._lockedPallet = []
123
- this.location = await this.fetchLocation()
124
123
  const partners = await this._fetchPartners()
125
124
  const _approvalStatus = await getCodeByName('APPROVAL_STATUS')
126
125
 
@@ -353,7 +352,7 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
353
352
  const filters = await this.searchForm.getQueryFilters()
354
353
  const response = await client.query({
355
354
  query: gql`
356
- query inventoryChanges($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
355
+ query inventoryChanges($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
357
356
  inventoryChanges(filters: $filters, pagination: $pagination, sortings: $sortings) {
358
357
  items {
359
358
  id
@@ -464,11 +463,16 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
464
463
  total: response.data.inventoryChanges.total || 0,
465
464
  records:
466
465
  response.data.inventoryChanges.items.map(item => {
467
- let inventoryChangesExpDate = item?.expirationDate ? item?.expirationDate : null
466
+ let inventoryChangesExpDate = item?.expirationDate
467
+ ? this._convertUnixTimestampToDate(item?.expirationDate)
468
+ : null
468
469
  let lastInventoryChangesExpDate = item?.lastInventoryHistory?.expirationDate
469
- ? item?.lastInventoryHistory?.expirationDate
470
+ ? this._convertUnixTimestampToDate(item?.lastInventoryHistory?.expirationDate)
471
+ : null
472
+
473
+ let inventoryExpDate = item?.inventory?.expirationDate
474
+ ? this._convertUnixTimestampToDate(item?.inventory?.expirationDate)
470
475
  : null
471
- let inventoryExpDate = item?.inventory?.expirationDate ? item?.inventory?.expirationDate : null
472
476
 
473
477
  return {
474
478
  ...item,
@@ -518,7 +522,7 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
518
522
  if (patches && patches.length) {
519
523
  const response = await client.mutate({
520
524
  mutation: gql`
521
- mutation approveInventoryChanges($patches: [InventoryChangePatch]!) {
525
+ mutation approveInventoryChanges($patches: [InventoryChangePatch!]!) {
522
526
  approveInventoryChanges(patches: $patches) {
523
527
  items {
524
528
  id
@@ -552,7 +556,7 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
552
556
  if (patches && patches.length) {
553
557
  const response = await client.mutate({
554
558
  mutation: gql`
555
- mutation rejectInventoryChanges($patches: [InventoryChangePatch]!) {
559
+ mutation rejectInventoryChanges($patches: [InventoryChangePatch!]!) {
556
560
  rejectInventoryChanges(patches: $patches)
557
561
  }
558
562
  `,
@@ -573,7 +577,7 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
573
577
  async fetchProduct(bizplace = []) {
574
578
  const response = await client.query({
575
579
  query: gql`
576
- query productsByBizplace($filters: [Filter]) {
580
+ query productsByBizplace($filters: [Filter!]) {
577
581
  productsByBizplace(filters: $filters) {
578
582
  items {
579
583
  id
@@ -587,21 +591,9 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
587
591
  return response.data.productsByBizplace.items
588
592
  }
589
593
 
590
- async fetchLocation() {
591
- const response = await client.query({
592
- query: gql`
593
- query locations($filters: [Filter]) {
594
- locations(filters: $filters) {
595
- items {
596
- id
597
- name
598
- }
599
- }
600
- }
601
- `,
602
- variables: { filters: [] }
603
- })
604
- return response.data.locations.items
594
+ _convertUnixTimestampToDate(unixTimestampValue) {
595
+ let convertedUnix = new Date(unixTimestampValue)
596
+ return `${convertedUnix.getDate()}/${convertedUnix.getMonth() + 1}/${convertedUnix.getFullYear()}`
605
597
  }
606
598
 
607
599
  _compareValues(key, order = 'asc') {
@@ -50,18 +50,12 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
50
50
  }
51
51
  }
52
52
 
53
- render() {
54
- return html`
55
- <search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
53
+ get dataGrist() {
54
+ return this.shadowRoot.querySelector('data-grist')
55
+ }
56
56
 
57
- <data-grist
58
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
59
- .config=${this.config}
60
- .fetchHandler="${this.fetchHandler.bind(this)}"
61
- @record-change="${this._customerChange.bind(this)}"
62
- @field-change="${this._fieldChange.bind(this)}"
63
- ></data-grist>
64
- `
57
+ get searchForm() {
58
+ return this.shadowRoot.querySelector('search-form')
65
59
  }
66
60
 
67
61
  get context() {
@@ -70,17 +64,17 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
70
64
  actions: [
71
65
  {
72
66
  title: i18next.t('button.lot_label_print'),
73
- action: this._printLotLabel.bind(this),
67
+ action: this.printLotLabel.bind(this),
74
68
  ...CommonButtonStyles.label
75
69
  },
76
70
  {
77
71
  title: i18next.t('button.carton_label_print'),
78
- action: this._printCartonLabel.bind(this),
72
+ action: this.printCartonLabel.bind(this),
79
73
  ...CommonButtonStyles.label
80
74
  },
81
75
  {
82
76
  title: i18next.t('button.save'),
83
- action: this._saveInventories.bind(this),
77
+ action: this.saveInventories.bind(this),
84
78
  ...CommonButtonStyles.save
85
79
  }
86
80
  ],
@@ -90,23 +84,35 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
90
84
  },
91
85
  exportable: {
92
86
  name: i18next.t('title.inventory_adjustment'),
93
- data: this._exportableData.bind(this)
87
+ data: this.exportableData.bind(this)
94
88
  },
95
89
  importable: {
96
- handler: this._importableData.bind(this)
90
+ handler: this.importableData.bind(this)
97
91
  },
98
92
  help: 'operato-wms/inventory/inventory-adjustment'
99
93
  }
100
94
  }
101
95
 
96
+ render() {
97
+ return html`
98
+ <search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
99
+
100
+ <data-grist
101
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
102
+ .config=${this.config}
103
+ .fetchHandler="${this.fetchHandler.bind(this)}"
104
+ @record-change="${this.customerChange.bind(this)}"
105
+ @field-change="${this.fieldChange.bind(this)}"
106
+ ></data-grist>
107
+ `
108
+ }
109
+
102
110
  async pageInitialized() {
103
- let [locations, partners, _packingType, _uom] = await Promise.all([
104
- this.fetchLocation(),
111
+ let [partners, packingType, uom] = await Promise.all([
105
112
  this._fetchPartners(),
106
113
  getCodeByName('PACKING_TYPES'),
107
114
  getCodeByName('UOM')
108
115
  ])
109
- this.location = locations
110
116
 
111
117
  this._searchFields = [
112
118
  {
@@ -122,7 +128,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
122
128
  value: partner.id
123
129
  }
124
130
  })
125
- .sort(this._compareValues('name', 'asc'))
131
+ .sort(this.compareValues('name', 'asc'))
126
132
  ],
127
133
  handlers: {
128
134
  change: () => {
@@ -167,7 +173,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
167
173
  type: 'select',
168
174
  options: [
169
175
  { value: '' },
170
- ..._packingType.map(packingType => {
176
+ ...packingType.map(packingType => {
171
177
  return {
172
178
  name: packingType.name,
173
179
  value: packingType.name
@@ -200,7 +206,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
200
206
  ]
201
207
  },
202
208
  rows: {
203
- handlers: { click: this._setProductRefCondition.bind(this) },
209
+ handlers: { click: this.setProductRefCondition.bind(this) },
204
210
  selectable: { multiple: true }
205
211
  },
206
212
  columns: [
@@ -210,7 +216,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
210
216
  type: 'gutter',
211
217
  gutterName: 'button',
212
218
  icon: 'reorder',
213
- handlers: { click: this._showInventoryMovement.bind(this) }
219
+ handlers: { click: this.showInventoryMovement.bind(this) }
214
220
  },
215
221
  {
216
222
  type: 'string',
@@ -312,7 +318,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
312
318
  key: 'packingType',
313
319
  width: 50,
314
320
  type: 'array',
315
- arrData: _packingType
321
+ arrData: packingType
316
322
  },
317
323
  width: 150
318
324
  },
@@ -376,7 +382,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
376
382
  name: 'uom',
377
383
  header: i18next.t('field.uom'),
378
384
  record: { editable: true, codeName: 'WEIGHT_UNITS' },
379
- imex: { header: i18next.t('field.uom'), key: 'uom', width: 25, type: 'array', arrData: _uom },
385
+ imex: { header: i18next.t('field.uom'), key: 'uom', width: 25, type: 'array', arrData: uom },
380
386
  sortable: true,
381
387
  width: 80
382
388
  },
@@ -404,7 +410,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
404
410
  key: 'location.name',
405
411
  width: 15,
406
412
  type: 'array',
407
- arrData: this.location
413
+ arrData: []
408
414
  },
409
415
  sortable: true,
410
416
  width: 120
@@ -435,7 +441,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
435
441
  sortable: true,
436
442
  width: 200,
437
443
  handlers: {
438
- click: this._openRemarkNote.bind(this)
444
+ click: this.openRemarkNote.bind(this)
439
445
  }
440
446
  },
441
447
  {
@@ -479,25 +485,11 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
479
485
  }
480
486
  }
481
487
 
482
- async pageUpdated(changes, lifecycle) {
483
- if (this.active) {
484
- this.dataGrist.fetch()
485
- }
486
- }
487
-
488
- get dataGrist() {
489
- return this.shadowRoot.querySelector('data-grist')
490
- }
491
-
492
- get searchForm() {
493
- return this.shadowRoot.querySelector('search-form')
494
- }
495
-
496
488
  async fetchHandler({ page, limit, sorters = [] }) {
497
489
  const filters = await this.searchForm.getQueryFilters()
498
490
  const response = await client.query({
499
491
  query: gql`
500
- query inventories($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
492
+ query inventories($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
501
493
  inventories(filters: $filters, pagination: $pagination, sortings: $sortings) {
502
494
  items {
503
495
  id
@@ -579,7 +571,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
579
571
  const filters = await this.searchForm.getQueryFilters()
580
572
  const response = await client.query({
581
573
  query: gql`
582
- query inventories($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
574
+ query inventories($filters: [Filter!]!, $pagination: Pagination, $sortings: [Sorting!]!) {
583
575
  inventories(filters: $filters, pagination: $pagination, sortings: $sortings) {
584
576
  items {
585
577
  id
@@ -660,7 +652,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
660
652
  }
661
653
  }
662
654
 
663
- _setProductRefCondition(columns, data, column, record, rowIndex) {
655
+ setProductRefCondition(columns, data, column, record, rowIndex) {
664
656
  this.config.columns.map(column => {
665
657
  if (column.name === 'product') {
666
658
  if (record && record.bizplace && record.bizplace.id) {
@@ -672,7 +664,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
672
664
  })
673
665
  }
674
666
 
675
- _customerChange(event) {
667
+ customerChange(event) {
676
668
  const record = event.detail
677
669
  const columnName = event.detail.column.name
678
670
 
@@ -681,13 +673,17 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
681
673
  }
682
674
  }
683
675
 
684
- _fieldChange(e) {
676
+ fieldChange(e) {
685
677
  switch (e.detail.column.name) {
686
678
  case 'uomValue':
687
679
  if (e.detail.after < 0) this.dataGrist._data.records[e.detail.row].uomValue = 0
688
680
  break
689
681
  case 'qty':
690
- if (e.detail.after < 0) this.dataGrist._data.records[e.detail.row].qty = 0
682
+ if (e.detail.after < 0 || !Number.isInteger(e.detail.after))
683
+ this.dataGrist._data.records[e.detail.row].qty = e.detail.before
684
+ break
685
+ case 'unitCost':
686
+ if (e.detail.after < 0) this.dataGrist._data.records[e.detail.row].unitCost = e.detail.before
691
687
  break
692
688
  case 'manufactureYear':
693
689
  if (
@@ -720,7 +716,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
720
716
  }
721
717
  }
722
718
 
723
- async _saveInventories() {
719
+ async saveInventories() {
724
720
  var patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
725
721
  patches = patches.map(row => {
726
722
  delete row.productUomValue
@@ -742,7 +738,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
742
738
  if (patches && patches.length) {
743
739
  const response = await client.mutate({
744
740
  mutation: gql`
745
- mutation submitInventoryChanges($patches: [InventoryPatch]!) {
741
+ mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
746
742
  submitInventoryChanges(patches: $patches)
747
743
  }
748
744
  `,
@@ -756,7 +752,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
756
752
  }
757
753
  }
758
754
 
759
- get _columns() {
755
+ get columns() {
760
756
  return this.config.columns
761
757
  }
762
758
 
@@ -772,7 +768,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
772
768
 
773
769
  const response = await client.mutate({
774
770
  mutation: gql`
775
- mutation submitInventoryChanges($patches: [InventoryPatch]!) {
771
+ mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
776
772
  submitInventoryChanges(patches: $patches)
777
773
  }
778
774
  `,
@@ -786,7 +782,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
786
782
  }
787
783
  }
788
784
 
789
- _importableData(records) {
785
+ importableData(records) {
790
786
  setTimeout(() => {
791
787
  openPopup(
792
788
  html`
@@ -808,7 +804,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
808
804
  }, 500)
809
805
  }
810
806
 
811
- async _exportableData() {
807
+ async exportableData() {
812
808
  try {
813
809
  let data = []
814
810
 
@@ -832,9 +828,10 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
832
828
  data = await this.fetchInventoriesForExport()
833
829
  }
834
830
 
835
- let [product, bizplace] = await Promise.all([
831
+ let [product, bizplace, location] = await Promise.all([
836
832
  this.fetchProduct(bizplaceFilters),
837
- this.fetchBizplaces([{ ...bizplaceFilters[0], name: 'bizplace' }])
833
+ this.fetchBizplaces([{ ...bizplaceFilters[0], name: 'bizplace' }]),
834
+ this.fetchLocation()
838
835
  ])
839
836
 
840
837
  headerSetting = headerSetting.map(column => {
@@ -847,6 +844,9 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
847
844
  return { ...itm, name: `(${itm.sku}) ${itm.name} - ${itm.description}` }
848
845
  })
849
846
  break
847
+ case 'location.name':
848
+ column.arrData = location
849
+ break
850
850
  default:
851
851
  break
852
852
  }
@@ -861,7 +861,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
861
861
  item.product.name = `(${item.product.sku}) ${item.product.name} - ${item.product.description}`
862
862
  return {
863
863
  id: item.id,
864
- ...this._columns
864
+ ...this.columns
865
865
  .filter(column => column.type !== 'gutter' && column.imex !== undefined)
866
866
  .reduce((record, column) => {
867
867
  record[column.imex.key] = column.imex.key.split('.').reduce((obj, key) => {
@@ -890,7 +890,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
890
890
  async fetchBizplaces(bizplace = []) {
891
891
  const response = await client.query({
892
892
  query: gql`
893
- query bizplaces($filters: [Filter!]) {
893
+ query bizplaces($filters: [Filter!]!) {
894
894
  bizplaces(filters: $filters) {
895
895
  items {
896
896
  id
@@ -906,29 +906,33 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
906
906
  }
907
907
 
908
908
  async fetchProduct(bizplace = []) {
909
- bizplace[0].name = 'bizplace'
910
- const response = await client.query({
911
- query: gql`
912
- query productsByBizplace($filters: [Filter]) {
913
- productsByBizplace(filters: $filters) {
914
- items {
915
- id
916
- sku
917
- name
918
- description
909
+ try {
910
+ bizplace[0].name = 'bizplace'
911
+ const response = await client.query({
912
+ query: gql`
913
+ query productsByBizplace($filters: [Filter!]!) {
914
+ productsByBizplace(filters: $filters) {
915
+ items {
916
+ id
917
+ sku
918
+ name
919
+ description
920
+ }
919
921
  }
920
922
  }
921
- }
922
- `,
923
- variables: { filters: [...bizplace] }
924
- })
925
- return response.data.productsByBizplace.items
923
+ `,
924
+ variables: { filters: [...bizplace] }
925
+ })
926
+ return response.data.productsByBizplace.items
927
+ } catch (ex) {
928
+ throw ex
929
+ }
926
930
  }
927
931
 
928
932
  async fetchLocation() {
929
933
  const response = await client.query({
930
934
  query: gql`
931
- query locations($filters: [Filter]) {
935
+ query locations($filters: [Filter!]!) {
932
936
  locations(filters: $filters) {
933
937
  items {
934
938
  id
@@ -959,7 +963,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
959
963
  }
960
964
  }
961
965
 
962
- _showInventoryMovement(columns, data, column, record, rowIndex) {
966
+ showInventoryMovement(columns, data, column, record, rowIndex) {
963
967
  openPopup(html` <inventory-history-by-pallet .palletId="${record.palletId}"></inventory-history-by-pallet> `, {
964
968
  backdrop: true,
965
969
  size: 'large',
@@ -967,7 +971,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
967
971
  })
968
972
  }
969
973
 
970
- _openRemarkNote(columns, data, column, record, rowIndex) {
974
+ openRemarkNote(columns, data, column, record, rowIndex) {
971
975
  openPopup(
972
976
  html`
973
977
  <popup-note
@@ -993,7 +997,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
993
997
  )
994
998
  }
995
999
 
996
- async _printLotLabel() {
1000
+ async printLotLabel() {
997
1001
  const records = this.dataGrist.selected
998
1002
  var labelId = this._palletLabel && this._palletLabel.id
999
1003
 
@@ -1004,7 +1008,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1004
1008
  })
1005
1009
  } else {
1006
1010
  for (var record of records) {
1007
- let dateIn = this._getDateStr(record.createdAt)
1011
+ let dateIn = this.getDateStr(record.createdAt)
1008
1012
  var searchParams = new URLSearchParams()
1009
1013
 
1010
1014
  /* for pallet record mapping */
@@ -1049,7 +1053,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1049
1053
  }
1050
1054
  }
1051
1055
 
1052
- async _printCartonLabel() {
1056
+ async printCartonLabel() {
1053
1057
  const records = this.dataGrist.selected
1054
1058
  const labelId = this._cartonLabel && this._cartonLabel.id
1055
1059
 
@@ -1093,7 +1097,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1093
1097
  }
1094
1098
  }
1095
1099
 
1096
- _getDateStr(date) {
1100
+ getDateStr(date) {
1097
1101
  const newDate = new Date(parseInt(date))
1098
1102
 
1099
1103
  const month = String(newDate.getMonth() + 1).padStart(2, '0')
@@ -1104,7 +1108,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1104
1108
  return date
1105
1109
  }
1106
1110
 
1107
- _compareValues(key, order = 'asc') {
1111
+ compareValues(key, order = 'asc') {
1108
1112
  return function innerSort(a, b) {
1109
1113
  if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
1110
1114
  return 0
@@ -202,7 +202,7 @@ class InventoryByProductDetail extends localize(i18next)(LitElement) {
202
202
  const filters = await this.searchForm.getQueryFilters()
203
203
  const response = await client.query({
204
204
  query: gql`
205
- query inventories($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
205
+ query inventories($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
206
206
  inventories(filters: $filters, pagination: $pagination, sortings: $sortings) {
207
207
  items {
208
208
  packingType
@@ -257,7 +257,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
257
257
  async fetchHandler({ page, limit, sorters = [] }) {
258
258
  const response = await client.query({
259
259
  query: gql`
260
- query inventoriesByProduct($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
260
+ query inventoriesByProduct($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
261
261
  inventoriesByProduct(filters: $filters, pagination: $pagination, sortings: $sortings) {
262
262
  items {
263
263
  product {
@@ -212,7 +212,7 @@ class InventoryHistoryByPallet extends localize(i18next)(LitElement) {
212
212
  if (!this.palletId) return
213
213
  const response = await client.query({
214
214
  query: gql`
215
- query inventoryHistories($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
215
+ query inventoryHistories($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
216
216
  inventoryHistories(filters: $filters, pagination: $pagination, sortings: $sortings) {
217
217
  items {
218
218
  palletId