@things-factory/operato-wms 4.0.10 → 4.0.14

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 (160) hide show
  1. package/client/pages/adjustment/transfer-inventory.js +368 -165
  2. package/client/pages/billing/claim-chit/claim-chit-list.js +7 -6
  3. package/client/pages/bulk-operation/bulk-operation.js +316 -0
  4. package/client/pages/bulk-operation/validate-ro-popup.js +445 -0
  5. package/client/pages/components/select-product-popup.js +15 -2
  6. package/client/pages/constants/inventory.js +1 -0
  7. package/client/pages/constants/location.js +33 -6
  8. package/client/pages/constants/order.js +10 -0
  9. package/client/pages/constants/worksheet.js +2 -2
  10. package/client/pages/inbound/inbound-worksheet.js +78 -9
  11. package/client/pages/inbound/putaway-product.js +214 -139
  12. package/client/pages/inbound/putaway-worksheet-generate-popup.js +24 -2
  13. package/client/pages/inbound/unload-product.js +149 -76
  14. package/client/pages/inbound/worksheet-putaway-return.js +22 -5
  15. package/client/pages/inbound/worksheet-putaway.js +21 -8
  16. package/client/pages/inbound/worksheet-unloading-return.js +22 -5
  17. package/client/pages/inbound/worksheet-unloading.js +8 -0
  18. package/client/pages/inventory/inventory-adjustment-approval.js +11 -19
  19. package/client/pages/inventory/inventory-adjustment.js +136 -101
  20. package/client/pages/inventory/inventory-by-product-detail.js +3 -5
  21. package/client/pages/inventory/inventory-by-product.js +8 -0
  22. package/client/pages/inventory/inventory-history-by-pallet.js +12 -5
  23. package/client/pages/inventory/inventory-history.js +14 -5
  24. package/client/pages/inventory/onhand-inventory.js +11 -2
  25. package/client/pages/inventory-check/create-cycle-count.js +12 -6
  26. package/client/pages/inventory-check/cycle-count-report.js +8 -0
  27. package/client/pages/inventory-check/inspecting-product.js +146 -80
  28. package/client/pages/inventory-check/worksheet-cycle-count.js +14 -0
  29. package/client/pages/manifest/create-loading-manifest.js +314 -0
  30. package/client/pages/manifest/dispatcher-verification-popup.js +86 -0
  31. package/client/pages/manifest/loading-manifest-detail.js +345 -0
  32. package/client/pages/manifest/loading-manifest-list.js +305 -0
  33. package/client/pages/master/location-list.js +58 -17
  34. package/client/pages/master/product/product-detail-bizplace-setting-popup.js +2 -2
  35. package/client/pages/master/product/product-details-popup.js +2 -2
  36. package/client/pages/master/product/product-list.js +5 -5
  37. package/client/pages/order/arrival-notice/arrival-notice-detail.js +134 -115
  38. package/client/pages/order/arrival-notice/arrival-notice-list.js +87 -6
  39. package/client/pages/order/arrival-notice/arrival-notice-requests.js +83 -6
  40. package/client/pages/order/arrival-notice/assign-buffer-location.js +8 -1
  41. package/client/pages/order/arrival-notice/check-arrived-notice.js +9 -1
  42. package/client/pages/order/arrival-notice/create-arrival-notice.js +38 -3
  43. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +290 -25
  44. package/client/pages/order/arrival-notice/edit-product-popup.js +36 -5
  45. package/client/pages/order/arrival-notice/receive-arrival-notice.js +8 -1
  46. package/client/pages/order/goods-received-note/received-note-list.js +138 -6
  47. package/client/pages/order/release-order/b2b/b2b-order-list.js +45 -5
  48. package/client/pages/order/release-order/b2b/b2b-order-requests.js +52 -12
  49. package/client/pages/order/release-order/b2c/b2c-order-requests.js +244 -24
  50. package/client/pages/order/release-order/bulk-print-packing-list.js +23 -0
  51. package/client/pages/order/release-order/create-release-order.js +55 -8
  52. package/client/pages/order/release-order/receive-release-order-request.js +35 -24
  53. package/client/pages/order/release-order/release-extra-product-popup.js +204 -63
  54. package/client/pages/order/release-order/release-order-detail.js +301 -74
  55. package/client/pages/order/return-order/check-return-order.js +9 -1
  56. package/client/pages/order/return-order/create-return-order.js +14 -2
  57. package/client/pages/order/return-order/receive-return-order-requests.js +9 -1
  58. package/client/pages/order/return-order/return-order-detail.js +15 -6
  59. package/client/pages/order/return-order/return-order-inventory-popup.js +7 -0
  60. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-detail.js +124 -59
  61. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-list.js +1 -6
  62. package/client/pages/order/reverse-kitting-order/reverse-kitting-pallet-label-popup.js +239 -0
  63. package/client/pages/order/transport-order/delivery-order-list.js +102 -59
  64. package/client/pages/outbound/inventory-assign-popup.js +23 -6
  65. package/client/pages/outbound/inventory-auto-assign-popup.js +22 -6
  66. package/client/pages/outbound/loading-product.js +4 -1
  67. package/client/pages/outbound/merged-outbound-worksheet.js +43 -1
  68. package/client/pages/outbound/packing-product.js +4 -1
  69. package/client/pages/outbound/packing-worksheet-list.js +39 -1
  70. package/client/pages/outbound/picking-product.js +803 -431
  71. package/client/pages/outbound/picking-replacement-popup.js +1 -1
  72. package/client/pages/outbound/serial-number-popup.js +280 -0
  73. package/client/pages/outbound/single-outbound-worksheet.js +47 -1
  74. package/client/pages/outbound/worksheet-batch-picking.js +22 -8
  75. package/client/pages/outbound/worksheet-loading.js +22 -5
  76. package/client/pages/outbound/worksheet-packing.js +8 -0
  77. package/client/pages/outbound/worksheet-picking.js +62 -8
  78. package/client/pages/outbound/worksheet-return.js +9 -1
  79. package/client/pages/outbound/worksheet-sorting.js +9 -1
  80. package/client/pages/report/custom-elccl/elccl-inventory-report.js +31 -30
  81. package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +23 -26
  82. package/client/pages/report/inventory-pallet-storage-report.js +11 -10
  83. package/client/pages/report/inventory-report.js +41 -43
  84. package/client/pages/report/inventory-summary-report.js +25 -28
  85. package/client/pages/report/product-label-report.js +401 -0
  86. package/client/pages/support/inventory-comparison.js +296 -0
  87. package/client/pages/vas/print-product-label.js +298 -132
  88. package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +38 -23
  89. package/client/pages/vas/reverse-kitting/popup-combination-sets.js +98 -15
  90. package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +129 -21
  91. package/client/pages/vas/vas-pallet-label-popup.js +5 -8
  92. package/client/route.js +28 -0
  93. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +1 -1
  94. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  95. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +64 -54
  96. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js.map +1 -1
  97. package/dist-server/graphql/resolvers/extra/add-release-good-products.js +34 -9
  98. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
  99. package/dist-server/graphql/resolvers/index.js +5 -1
  100. package/dist-server/graphql/resolvers/index.js.map +1 -1
  101. package/dist-server/graphql/resolvers/inventory-comparison/index.js +6 -0
  102. package/dist-server/graphql/resolvers/inventory-comparison/index.js.map +1 -0
  103. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js +78 -0
  104. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js.map +1 -0
  105. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  106. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  107. package/dist-server/graphql/resolvers/reports/product-label-report.js +56 -0
  108. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -0
  109. package/dist-server/graphql/resolvers/shipping-provider/index.js +6 -0
  110. package/dist-server/graphql/resolvers/shipping-provider/index.js.map +1 -0
  111. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +20 -0
  112. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +1 -0
  113. package/dist-server/graphql/types/custom/elccl/elccl-inventory-report.js +1 -1
  114. package/dist-server/graphql/types/index.js +8 -2
  115. package/dist-server/graphql/types/index.js.map +1 -1
  116. package/dist-server/graphql/types/inventory-comparison/index.js +13 -0
  117. package/dist-server/graphql/types/inventory-comparison/index.js.map +1 -0
  118. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js +14 -0
  119. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js.map +1 -0
  120. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js +18 -0
  121. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js.map +1 -0
  122. package/dist-server/graphql/types/reports/index.js +6 -1
  123. package/dist-server/graphql/types/reports/index.js.map +1 -1
  124. package/dist-server/graphql/types/reports/product-label-report-list.js +14 -0
  125. package/dist-server/graphql/types/reports/product-label-report-list.js.map +1 -0
  126. package/dist-server/graphql/types/reports/product-label-report.js +16 -0
  127. package/dist-server/graphql/types/reports/product-label-report.js.map +1 -0
  128. package/dist-server/graphql/types/shipping-provider/index.js +10 -0
  129. package/dist-server/graphql/types/shipping-provider/index.js.map +1 -0
  130. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js +13 -0
  131. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js.map +1 -0
  132. package/dist-server/graphql/types/shipping-provider/shipping-provider.js +13 -0
  133. package/dist-server/graphql/types/shipping-provider/shipping-provider.js.map +1 -0
  134. package/package.json +65 -65
  135. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +4 -2
  136. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +75 -65
  137. package/server/graphql/resolvers/extra/add-release-good-products.ts +57 -15
  138. package/server/graphql/resolvers/index.ts +5 -1
  139. package/server/graphql/resolvers/inventory-comparison/index.ts +5 -0
  140. package/server/graphql/resolvers/inventory-comparison/inventory-comparison-list.ts +99 -0
  141. package/server/graphql/resolvers/reports/index.ts +3 -1
  142. package/server/graphql/resolvers/reports/product-label-report.ts +56 -0
  143. package/server/graphql/resolvers/shipping-provider/index.ts +5 -0
  144. package/server/graphql/resolvers/shipping-provider/shipping-providers.ts +20 -0
  145. package/server/graphql/types/custom/elccl/elccl-inventory-report.ts +1 -1
  146. package/server/graphql/types/index.ts +8 -2
  147. package/server/graphql/types/inventory-comparison/index.ts +11 -0
  148. package/server/graphql/types/inventory-comparison/inventory-comparison-list.ts +8 -0
  149. package/server/graphql/types/inventory-comparison/inventory-comparison.ts +12 -0
  150. package/server/graphql/types/reports/index.ts +6 -1
  151. package/server/graphql/types/reports/product-label-report-list.ts +8 -0
  152. package/server/graphql/types/reports/product-label-report.ts +10 -0
  153. package/server/graphql/types/shipping-provider/index.ts +8 -0
  154. package/server/graphql/types/shipping-provider/shipping-provider-list.ts +7 -0
  155. package/server/graphql/types/shipping-provider/shipping-provider.ts +7 -0
  156. package/things-factory.config.js +30 -0
  157. package/translations/en.json +91 -11
  158. package/translations/ko.json +109 -11
  159. package/translations/ms.json +111 -12
  160. package/translations/zh.json +123 -26
@@ -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
 
@@ -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,
@@ -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',
@@ -277,6 +283,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
277
283
  { name: 'productId', hidden: true },
278
284
  { name: 'sku', header: i18next.t('field.sku'), width: 150 },
279
285
  { name: 'name', header: i18next.t('field.name'), width: 250 },
286
+ { name: 'brand', header: i18next.t('field.brand'), width: 150 },
280
287
  { name: 'description', header: i18next.t('field.description'), width: 450 },
281
288
  { name: 'type', header: i18next.t('field.type'), width: 200 },
282
289
  { name: 'packingType', header: i18next.t('field.packing_type'), width: 200 },
@@ -295,6 +302,12 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
295
302
  sortable: true,
296
303
  width: 500
297
304
  },
305
+ {
306
+ type: 'string',
307
+ name: 'brand',
308
+ header: i18next.t('field.brand'),
309
+ width: 120
310
+ },
298
311
  {
299
312
  type: 'code',
300
313
  name: 'packingType',
@@ -305,7 +318,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
305
318
  key: 'packingType',
306
319
  width: 50,
307
320
  type: 'array',
308
- arrData: _packingType
321
+ arrData: packingType
309
322
  },
310
323
  width: 150
311
324
  },
@@ -369,7 +382,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
369
382
  name: 'uom',
370
383
  header: i18next.t('field.uom'),
371
384
  record: { editable: true, codeName: 'WEIGHT_UNITS' },
372
- 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 },
373
386
  sortable: true,
374
387
  width: 80
375
388
  },
@@ -397,7 +410,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
397
410
  key: 'location.name',
398
411
  width: 15,
399
412
  type: 'array',
400
- arrData: this.location
413
+ arrData: []
401
414
  },
402
415
  sortable: true,
403
416
  width: 120
@@ -428,7 +441,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
428
441
  sortable: true,
429
442
  width: 200,
430
443
  handlers: {
431
- click: this._openRemarkNote.bind(this)
444
+ click: this.openRemarkNote.bind(this)
432
445
  }
433
446
  },
434
447
  {
@@ -472,20 +485,6 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
472
485
  }
473
486
  }
474
487
 
475
- async pageUpdated(changes, lifecycle) {
476
- if (this.active) {
477
- this.dataGrist.fetch()
478
- }
479
- }
480
-
481
- get dataGrist() {
482
- return this.shadowRoot.querySelector('data-grist')
483
- }
484
-
485
- get searchForm() {
486
- return this.shadowRoot.querySelector('search-form')
487
- }
488
-
489
488
  async fetchHandler({ page, limit, sorters = [] }) {
490
489
  const filters = await this.searchForm.getQueryFilters()
491
490
  const response = await client.query({
@@ -512,6 +511,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
512
511
  id
513
512
  name
514
513
  sku
514
+ brand
515
515
  auxUnit1
516
516
  auxValue1
517
517
  description
@@ -555,6 +555,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
555
555
  return {
556
556
  ...item,
557
557
  sku: item.product.sku,
558
+ brand: item.product.brand,
558
559
  lockedQty: item.qty - item.remainQty,
559
560
  remainingQty: item.remainQty
560
561
  }
@@ -594,6 +595,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
594
595
  product {
595
596
  id
596
597
  sku
598
+ brand
597
599
  name
598
600
  description
599
601
  }
@@ -650,7 +652,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
650
652
  }
651
653
  }
652
654
 
653
- _setProductRefCondition(columns, data, column, record, rowIndex) {
655
+ setProductRefCondition(columns, data, column, record, rowIndex) {
654
656
  this.config.columns.map(column => {
655
657
  if (column.name === 'product') {
656
658
  if (record && record.bizplace && record.bizplace.id) {
@@ -662,22 +664,33 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
662
664
  })
663
665
  }
664
666
 
665
- _customerChange(event) {
667
+ customerChange(event) {
666
668
  const record = event.detail
667
669
  const columnName = event.detail.column.name
668
670
 
669
671
  if (columnName === 'bizplace' && record.before?.bizplace?.id != record.after?.bizplace?.id) {
670
672
  delete this.dataGrist._data.records[event.detail.row].product
673
+ delete this.dataGrist._data.records[event.detail.row].sku
674
+ delete this.dataGrist._data.records[event.detail.row].brand
675
+ delete this.dataGrist._data.records[event.detail.row].packingType
676
+ delete this.dataGrist._data.records[event.detail.row].packingSize
677
+ delete this.dataGrist._data.records[event.detail.row].uom
678
+ delete this.dataGrist._data.records[event.detail.row].qty
679
+ delete this.dataGrist._data.records[event.detail.row].uomValue
671
680
  }
672
681
  }
673
682
 
674
- _fieldChange(e) {
683
+ fieldChange(e) {
675
684
  switch (e.detail.column.name) {
676
685
  case 'uomValue':
677
686
  if (e.detail.after < 0) this.dataGrist._data.records[e.detail.row].uomValue = 0
678
687
  break
679
688
  case 'qty':
680
- if (e.detail.after < 0) this.dataGrist._data.records[e.detail.row].qty = 0
689
+ if (e.detail.after < 0 || !Number.isInteger(e.detail.after))
690
+ this.dataGrist._data.records[e.detail.row].qty = e.detail.before
691
+ break
692
+ case 'unitCost':
693
+ if (e.detail.after < 0) this.dataGrist._data.records[e.detail.row].unitCost = e.detail.before
681
694
  break
682
695
  case 'manufactureYear':
683
696
  if (
@@ -704,49 +717,62 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
704
717
  this.dataGrist._data.records[e.detail.row].packingSize = e.detail.after?.packingSize
705
718
  ? e.detail.after.packingSize
706
719
  : 1
720
+
721
+ this.dataGrist._data.records[e.detail.row].brand = e.detail.after?.brand ? e.detail.after.brand : ''
722
+
723
+ this.dataGrist._data.records[e.detail.row].sku = e.detail.after?.sku ? e.detail.after.sku : ''
707
724
  break
708
725
  default:
709
726
  break
710
727
  }
711
728
  }
712
729
 
713
- async _saveInventories() {
714
- var patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
715
- patches = patches.map(row => {
716
- delete row.productUomValue
717
- if (row.bizplace) {
718
- row.bizplace = { id: row.bizplace.id }
719
- }
720
- if (row.location) {
721
- row.location = { id: row.location.id }
722
- }
723
- if (row.product) {
724
- row.product = { id: row.product.productId }
725
- }
726
- if (row.uomValue) {
727
- row.uomValue = parseFloat(row.uomValue)
728
- }
729
- return row
730
- })
731
-
732
- if (patches && patches.length) {
733
- const response = await client.mutate({
734
- mutation: gql`
735
- mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
736
- submitInventoryChanges(patches: $patches)
730
+ async saveInventories() {
731
+ try {
732
+ var patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
733
+ patches = patches.map(row => {
734
+ delete row.productUomValue
735
+ if (row.cuFlag == '+') {
736
+ if (!row.bizplace || !row.location || !row.product || !row.batchId || !row.qty || !row.uomValue) {
737
+ throw new Error(i18next.t('text.empty_value_in_list'))
737
738
  }
738
- `,
739
- variables: { patches }
739
+ }
740
+ if (row.bizplace) {
741
+ row.bizplace = { id: row.bizplace.id }
742
+ }
743
+ if (row.location) {
744
+ row.location = { id: row.location.id }
745
+ }
746
+ if (row.product) {
747
+ row.product = { id: row.product.productId }
748
+ }
749
+ if (row.uomValue) {
750
+ row.uomValue = parseFloat(row.uomValue)
751
+ }
752
+ return row
740
753
  })
741
754
 
742
- if (!response.errors) {
743
- this.dataGrist.fetch()
744
- this._showToast({ message: i18next.t('text.data_submitted_for_approval') })
755
+ if (patches && patches.length) {
756
+ const response = await client.mutate({
757
+ mutation: gql`
758
+ mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
759
+ submitInventoryChanges(patches: $patches)
760
+ }
761
+ `,
762
+ variables: { patches }
763
+ })
764
+
765
+ if (!response.errors) {
766
+ this.dataGrist.fetch()
767
+ this._showToast({ message: i18next.t('text.data_submitted_for_approval') })
768
+ }
745
769
  }
770
+ } catch (e) {
771
+ this._showToast(e)
746
772
  }
747
773
  }
748
774
 
749
- get _columns() {
775
+ get columns() {
750
776
  return this.config.columns
751
777
  }
752
778
 
@@ -762,7 +788,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
762
788
 
763
789
  const response = await client.mutate({
764
790
  mutation: gql`
765
- mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
791
+ mutation submitInventoryChanges($patches: [InventoryPatch]!) {
766
792
  submitInventoryChanges(patches: $patches)
767
793
  }
768
794
  `,
@@ -776,7 +802,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
776
802
  }
777
803
  }
778
804
 
779
- _importableData(records) {
805
+ importableData(records) {
780
806
  setTimeout(() => {
781
807
  openPopup(
782
808
  html`
@@ -798,7 +824,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
798
824
  }, 500)
799
825
  }
800
826
 
801
- async _exportableData() {
827
+ async exportableData() {
802
828
  try {
803
829
  let data = []
804
830
 
@@ -827,6 +853,8 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
827
853
  this.fetchBizplaces([{ ...bizplaceFilters[0], name: 'bizplace' }])
828
854
  ])
829
855
 
856
+ let location = this.fetchLocation()
857
+
830
858
  headerSetting = headerSetting.map(column => {
831
859
  switch (column.key) {
832
860
  case 'bizplace.name':
@@ -837,6 +865,9 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
837
865
  return { ...itm, name: `(${itm.sku}) ${itm.name} - ${itm.description}` }
838
866
  })
839
867
  break
868
+ case 'location':
869
+ column.arrData = location
870
+ break
840
871
  default:
841
872
  break
842
873
  }
@@ -851,7 +882,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
851
882
  item.product.name = `(${item.product.sku}) ${item.product.name} - ${item.product.description}`
852
883
  return {
853
884
  id: item.id,
854
- ...this._columns
885
+ ...this.columns
855
886
  .filter(column => column.type !== 'gutter' && column.imex !== undefined)
856
887
  .reduce((record, column) => {
857
888
  record[column.imex.key] = column.imex.key.split('.').reduce((obj, key) => {
@@ -896,23 +927,27 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
896
927
  }
897
928
 
898
929
  async fetchProduct(bizplace = []) {
899
- bizplace[0].name = 'bizplace'
900
- const response = await client.query({
901
- query: gql`
902
- query productsByBizplace($filters: [Filter!]) {
903
- productsByBizplace(filters: $filters) {
904
- items {
905
- id
906
- sku
907
- name
908
- description
930
+ try {
931
+ bizplace[0].name = 'bizplace'
932
+ const response = await client.query({
933
+ query: gql`
934
+ query productsByBizplace($filters: [Filter!]) {
935
+ productsByBizplace(filters: $filters) {
936
+ items {
937
+ id
938
+ sku
939
+ name
940
+ description
941
+ }
909
942
  }
910
943
  }
911
- }
912
- `,
913
- variables: { filters: [...bizplace] }
914
- })
915
- return response.data.productsByBizplace.items
944
+ `,
945
+ variables: { filters: [...bizplace] }
946
+ })
947
+ return response.data.productsByBizplace.items
948
+ } catch (ex) {
949
+ throw ex
950
+ }
916
951
  }
917
952
 
918
953
  async fetchLocation() {
@@ -949,7 +984,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
949
984
  }
950
985
  }
951
986
 
952
- _showInventoryMovement(columns, data, column, record, rowIndex) {
987
+ showInventoryMovement(columns, data, column, record, rowIndex) {
953
988
  openPopup(html` <inventory-history-by-pallet .palletId="${record.palletId}"></inventory-history-by-pallet> `, {
954
989
  backdrop: true,
955
990
  size: 'large',
@@ -957,7 +992,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
957
992
  })
958
993
  }
959
994
 
960
- _openRemarkNote(columns, data, column, record, rowIndex) {
995
+ openRemarkNote(columns, data, column, record, rowIndex) {
961
996
  openPopup(
962
997
  html`
963
998
  <popup-note
@@ -983,7 +1018,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
983
1018
  )
984
1019
  }
985
1020
 
986
- async _printLotLabel() {
1021
+ async printLotLabel() {
987
1022
  const records = this.dataGrist.selected
988
1023
  var labelId = this._palletLabel && this._palletLabel.id
989
1024
 
@@ -994,7 +1029,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
994
1029
  })
995
1030
  } else {
996
1031
  for (var record of records) {
997
- let dateIn = this._getDateStr(record.createdAt)
1032
+ let dateIn = this.getDateStr(record.createdAt)
998
1033
  var searchParams = new URLSearchParams()
999
1034
 
1000
1035
  /* for pallet record mapping */
@@ -1039,7 +1074,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1039
1074
  }
1040
1075
  }
1041
1076
 
1042
- async _printCartonLabel() {
1077
+ async printCartonLabel() {
1043
1078
  const records = this.dataGrist.selected
1044
1079
  const labelId = this._cartonLabel && this._cartonLabel.id
1045
1080
 
@@ -1083,7 +1118,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1083
1118
  }
1084
1119
  }
1085
1120
 
1086
- _getDateStr(date) {
1121
+ getDateStr(date) {
1087
1122
  const newDate = new Date(parseInt(date))
1088
1123
 
1089
1124
  const month = String(newDate.getMonth() + 1).padStart(2, '0')
@@ -1094,7 +1129,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1094
1129
  return date
1095
1130
  }
1096
1131
 
1097
- _compareValues(key, order = 'asc') {
1132
+ compareValues(key, order = 'asc') {
1098
1133
  return function innerSort(a, b) {
1099
1134
  if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
1100
1135
  return 0
@@ -1,15 +1,13 @@
1
1
  import '@material/mwc-button/mwc-button'
2
2
  import '@things-factory/grist-ui'
3
- import './inventory-history-by-pallet'
4
-
5
- import gql from 'graphql-tag'
6
- import { css, html, LitElement } from 'lit-element'
7
-
8
3
  import { i18next, localize } from '@things-factory/i18n-base'
9
4
  import { openPopup } from '@things-factory/layout-base'
10
5
  import { client } from '@things-factory/shell'
11
6
  import { ScrollbarStyles } from '@things-factory/styles'
12
7
  import { isMobileDevice } from '@things-factory/utils'
8
+ import gql from 'graphql-tag'
9
+ import { css, html, LitElement } from 'lit-element'
10
+ import './inventory-history-by-pallet'
13
11
 
14
12
  class InventoryByProductDetail extends localize(i18next)(LitElement) {
15
13
  static get styles() {
@@ -193,6 +193,13 @@ class InventoryByProduct extends localize(i18next)(PageView) {
193
193
  header: i18next.t('field.name'),
194
194
  width: 200
195
195
  },
196
+ {
197
+ type: 'string',
198
+ name: 'brand',
199
+ imex: { header: i18next.t('field.brand'), key: 'brand', width: 30, type: 'string' },
200
+ header: i18next.t('field.brand'),
201
+ width: 100
202
+ },
196
203
  {
197
204
  type: 'string',
198
205
  name: 'description',
@@ -256,6 +263,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
256
263
  product {
257
264
  id
258
265
  sku
266
+ brand
259
267
  name
260
268
  description
261
269
  type
@@ -1,13 +1,11 @@
1
1
  import '@material/mwc-button/mwc-button'
2
2
  import '@things-factory/grist-ui'
3
-
4
- import gql from 'graphql-tag'
5
- import { css, html, LitElement } from 'lit-element'
6
-
7
3
  import { i18next, localize } from '@things-factory/i18n-base'
8
4
  import { client } from '@things-factory/shell'
9
- import { ScrollbarStyles } from '@things-factory/styles'
10
5
  import { isMobileDevice } from '@things-factory/utils'
6
+ import { ScrollbarStyles } from '@things-factory/styles'
7
+ import gql from 'graphql-tag'
8
+ import { css, html, LitElement } from 'lit-element'
11
9
 
12
10
  class InventoryHistoryByPallet extends localize(i18next)(LitElement) {
13
11
  static get styles() {
@@ -103,6 +101,13 @@ class InventoryHistoryByPallet extends localize(i18next)(LitElement) {
103
101
  sortable: true,
104
102
  width: 500
105
103
  },
104
+ {
105
+ type: 'string',
106
+ name: 'productBrand',
107
+ header: i18next.t('field.brand'),
108
+ sortable: true,
109
+ width: 150
110
+ },
106
111
  {
107
112
  type: 'string',
108
113
  name: 'batchId',
@@ -227,6 +232,7 @@ class InventoryHistoryByPallet extends localize(i18next)(LitElement) {
227
232
  transactionType
228
233
  product {
229
234
  sku
235
+ brand
230
236
  name
231
237
  description
232
238
  }
@@ -264,6 +270,7 @@ class InventoryHistoryByPallet extends localize(i18next)(LitElement) {
264
270
  return {
265
271
  ...itm,
266
272
  productSku: itm.product.sku,
273
+ productBrand: itm.product.brand,
267
274
  uomValue: `${itm.uomValue} ${itm.uom}`,
268
275
  openingUomValue: `${itm.openingUomValue} ${itm.uom}`
269
276
  }