@things-factory/operato-wms 4.0.24 → 4.0.28

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 (120) hide show
  1. package/client/bootstrap.js +1 -1
  2. package/client/pages/adjustment/transfer-inventory.js +32 -6
  3. package/client/pages/billing/claim-chit/claim-chit-detail.js +32 -35
  4. package/client/pages/billing/claim-chit/claim-chit-list.js +17 -17
  5. package/client/pages/billing/claim-chit/create-claim-chit.js +39 -30
  6. package/client/pages/billing/transport-summary-report.js +21 -23
  7. package/client/pages/bulk-operation/bulk-operation.js +189 -64
  8. package/client/pages/bulk-operation/validate-gan-popup.js +391 -0
  9. package/client/pages/bulk-operation/validate-ro-popup.js +44 -54
  10. package/client/pages/components/popup-unloading.js +47 -34
  11. package/client/pages/components/select-product-popup.js +74 -27
  12. package/client/pages/components/worksheet-information-popup.js +100 -0
  13. package/client/pages/inbound/expiry-date-popup.js +2 -2
  14. package/client/pages/inbound/inbound-reusable-pallet.js +21 -19
  15. package/client/pages/inbound/palletizing-pallets-popup.js +10 -9
  16. package/client/pages/inbound/putaway-product.js +196 -235
  17. package/client/pages/inbound/putaway-worksheet-generate-popup.js +4 -4
  18. package/client/pages/inbound/undo-unload-popup.js +295 -0
  19. package/client/pages/inbound/unload-product.js +236 -646
  20. package/client/pages/inbound/unloaded-inventories-popup.js +129 -0
  21. package/client/pages/inbound/vas-selector.js +9 -8
  22. package/client/pages/inbound/worksheet-unloading.js +15 -11
  23. package/client/pages/inventory/inventory-adjustment.js +9 -10
  24. package/client/pages/inventory-check/check-inventory-popup.js +20 -18
  25. package/client/pages/inventory-check/cycle-count-recheck-popup.js +25 -15
  26. package/client/pages/inventory-check/inspecting-product.js +2 -2
  27. package/client/pages/inventory-check/inventory-check-list.js +30 -19
  28. package/client/pages/inventory-check/search-popup.js +15 -14
  29. package/client/pages/inventory-check/worksheet-cycle-count.js +17 -15
  30. package/client/pages/master/location-list.js +61 -52
  31. package/client/pages/master/pallet-list.js +34 -30
  32. package/client/pages/master/print-location-label.js +142 -156
  33. package/client/pages/master/product/product-list.js +1 -1
  34. package/client/pages/master/warehouse-list.js +33 -29
  35. package/client/pages/master/worker-list.js +30 -30
  36. package/client/pages/order/arrival-notice/arrival-notice-detail.js +409 -21
  37. package/client/pages/order/arrival-notice/assign-buffer-location.js +1 -1
  38. package/client/pages/order/arrival-notice/create-arrival-notice.js +89 -13
  39. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +90 -10
  40. package/client/pages/order/arrival-notice/edit-product-popup.js +2 -2
  41. package/client/pages/order/goods-received-note/customer-grn-list.js +9 -8
  42. package/client/pages/order/goods-received-note/customer-received-note.js +8 -7
  43. package/client/pages/order/goods-received-note/received-note-detail.js +7 -6
  44. package/client/pages/order/goods-received-note/received-note-list.js +9 -8
  45. package/client/pages/order/release-order/b2b/b2b-order-list.js +78 -2
  46. package/client/pages/order/release-order/b2b/b2b-order-requests.js +32 -16
  47. package/client/pages/order/release-order/b2c/b2c-order-requests.js +49 -5
  48. package/client/pages/order/release-order/batch-generate-single-picking-worksheet-popup.js +314 -0
  49. package/client/pages/order/release-order/batch-picking-popup.js +19 -2
  50. package/client/pages/order/release-order/create-release-order.js +194 -89
  51. package/client/pages/order/release-order/release-extra-product-popup.js +3 -7
  52. package/client/pages/order/release-order/release-order-detail.js +392 -109
  53. package/client/pages/order/return-order/check-return-order.js +15 -13
  54. package/client/pages/order/return-order/create-return-order.js +3 -3
  55. package/client/pages/order/return-order/receive-return-order-requests.js +25 -22
  56. package/client/pages/order/return-order/rejected-return-order.js +8 -14
  57. package/client/pages/order/return-order/return-order-assign-buffer-location.js +16 -14
  58. package/client/pages/order/return-order/return-order-detail.js +35 -31
  59. package/client/pages/order/return-order/return-order-list.js +9 -8
  60. package/client/pages/order/return-order/return-order-requests.js +20 -18
  61. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-list.js +9 -8
  62. package/client/pages/order/transfer-order/receive-transfer-order-request.js +67 -66
  63. package/client/pages/order/transfer-order/rejected-transfer-order.js +7 -6
  64. package/client/pages/order/transfer-order/transfer-order-detail.js +7 -6
  65. package/client/pages/order/transfer-order/transfer-order-requests.js +20 -18
  66. package/client/pages/order/transport-order/contact-point-selector-popup.js +20 -20
  67. package/client/pages/order/transport-order/create-delivery-order.js +1 -1
  68. package/client/pages/order/transport-order/delivery-note-popup.js +52 -46
  69. package/client/pages/order/transport-order/delivery-order-list.js +1 -1
  70. package/client/pages/order/transport-order/print-delivery-note.js +17 -16
  71. package/client/pages/order/transport-order/upload-delivery-note.js +21 -18
  72. package/client/pages/order/transport-order/view-delivery-note.js +19 -22
  73. package/client/pages/order/vas-order/create-vas-order.js +12 -11
  74. package/client/pages/order/vas-order/receive-vas-order.js +25 -22
  75. package/client/pages/order/vas-order/vas-order-detail.js +26 -23
  76. package/client/pages/order/vas-order/vas-order-list.js +9 -8
  77. package/client/pages/order/vas-order/vas-order-requests.js +11 -12
  78. package/client/pages/outbound/outbound-reusable-pallet.js +25 -33
  79. package/client/pages/outbound/packing-product.js +115 -234
  80. package/client/pages/outbound/picking-product.js +288 -380
  81. package/client/pages/outbound/single-outbound-worksheet.js +9 -8
  82. package/client/pages/outbound/sorting-product.js +66 -63
  83. package/client/pages/outbound/worksheet-loading.js +23 -17
  84. package/client/pages/outbound/worksheet-packing.js +18 -16
  85. package/client/pages/outbound/worksheet-picking.js +22 -18
  86. package/client/pages/report/custom-elccl/elccl-daily-collection-report.js +8 -9
  87. package/client/pages/report/custom-elccl/elccl-daily-order-inventory-report.js +26 -25
  88. package/client/pages/report/custom-elccl/elccl-delivery-order-summary.js +10 -9
  89. package/client/pages/report/custom-elccl/elccl-inventory-pallet-detail-report.js +13 -8
  90. package/client/pages/report/custom-elccl/elccl-inventory-report.js +11 -10
  91. package/client/pages/report/inventory-pallet-report.js +13 -12
  92. package/client/pages/report/job-sheet-list.js +9 -8
  93. package/client/pages/report/job-sheet-popup.js +9 -9
  94. package/client/pages/report/job-sheet-report.js +6 -6
  95. package/client/pages/system/location-sorting-rule.js +53 -46
  96. package/client/pages/vas/abstract-execute-vas.js +47 -34
  97. package/client/pages/vas/execute-pure-vas.js +66 -62
  98. package/client/pages/vas/execute-ref-vas.js +39 -41
  99. package/client/pages/vas/print-product-label.js +17 -9
  100. package/client/pages/vas/related-vas-list.js +7 -6
  101. package/client/pages/vas/target-inventory-assignment-popup.js +16 -14
  102. package/client/pages/vas/vas-pallet-label-popup.js +1 -1
  103. package/client/pages/vas/vas-worksheet-list.js +9 -8
  104. package/client/pages/vas/worksheet-ref-vas.js +7 -6
  105. package/client/pages/vas/worksheet-vas.js +16 -14
  106. package/client/route.js +16 -32
  107. package/dist-server/graphql/resolvers/reports/product-label-report.js +1 -0
  108. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -1
  109. package/package.json +65 -65
  110. package/server/graphql/resolvers/reports/product-label-report.ts +1 -0
  111. package/things-factory.config.js +0 -16
  112. package/translations/en.json +34 -2
  113. package/translations/ko.json +34 -3
  114. package/translations/ms.json +34 -3
  115. package/translations/zh.json +34 -3
  116. package/client/pages/inbound/location-selector.js +0 -224
  117. package/client/pages/master/picking-bin-list.js +0 -354
  118. package/client/pages/order/retail-replenishment-order/retail-replenishment-order-detail.js +0 -315
  119. package/client/pages/order/retail-replenishment-order/retail-replenishment-order-requests.js +0 -307
  120. package/client/pages/order/vas-order/rejected-vas-order.js +0 -300
@@ -13,7 +13,7 @@ import { i18next, localize } from '@things-factory/i18n-base'
13
13
  import { openPopup } from '@things-factory/layout-base'
14
14
  import { client, CustomAlert, PageView, store } from '@things-factory/shell'
15
15
  import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
16
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
16
+ import { isMobileDevice } from '@things-factory/utils'
17
17
 
18
18
  import { LOCATION_LABEL_SETTING_KEY, LOCATION_STATUS, LOCATION_TYPE } from '../constants'
19
19
 
@@ -340,32 +340,33 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
340
340
 
341
341
  const response = await client.query({
342
342
  query: gql`
343
- query {
344
- locations(${gqlBuilder.buildArgs({
345
- filters: [...filters, ...this.searchForm.queryFilters],
346
- pagination: { page, limit },
347
- sortings: sorters
348
- })}) {
349
- items {
350
- id
351
- name
352
- zone
353
- row
354
- type
355
- column
356
- shelf
357
- status
358
- updatedAt
359
- updater{
343
+ query locations($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
344
+ locations(filters: $filters, pagination: $pagination, sortings: $sortings) {
345
+ items {
360
346
  id
361
347
  name
362
- description
348
+ zone
349
+ row
350
+ type
351
+ column
352
+ shelf
353
+ status
354
+ updatedAt
355
+ updater {
356
+ id
357
+ name
358
+ description
359
+ }
363
360
  }
361
+ total
364
362
  }
365
- total
366
363
  }
364
+ `,
365
+ variables: {
366
+ filters: [...filters, ...this.searchForm.queryFilters],
367
+ pagination: { page, limit },
368
+ sortings: sorters
367
369
  }
368
- `
369
370
  })
370
371
 
371
372
  if (!response.errors) {
@@ -398,16 +399,17 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
398
399
  }
399
400
  return patch
400
401
  })
401
- const response = await client.query({
402
- query: gql`
403
- mutation {
404
- updateMultipleLocation(${gqlBuilder.buildArgs({
405
- patches
406
- })}) {
402
+ const response = await client.mutate({
403
+ mutation: gql`
404
+ mutation updateMultipleLocation($patches: [LocationPatch!]!) {
405
+ updateMultipleLocation(patches: $patches) {
407
406
  name
408
407
  }
409
408
  }
410
- `
409
+ `,
410
+ variables: {
411
+ patches
412
+ }
411
413
  })
412
414
 
413
415
  if (!response.errors) {
@@ -439,14 +441,15 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
439
441
 
440
442
  const response = await client.query({
441
443
  query: gql`
442
- mutation {
443
- updateMultipleLocation(${gqlBuilder.buildArgs({
444
- patches
445
- })}) {
446
- name
447
- }
444
+ mutation updateMultipleLocation($patches: [LocationPatch!]!) {
445
+ updateMultipleLocation(patches: $patches) {
446
+ name
448
447
  }
449
- `
448
+ }
449
+ `,
450
+ variables: {
451
+ patches
452
+ }
450
453
  })
451
454
 
452
455
  if (!response.errors) {
@@ -488,12 +491,15 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
488
491
  if (record.id) ids.push(record.id)
489
492
  })
490
493
  if (ids && ids.length > 0) {
491
- const response = await client.query({
492
- query: gql`
493
- mutation {
494
- deleteLocations(${gqlBuilder.buildArgs({ ids })})
494
+ const response = await client.mutate({
495
+ mutation: gql`
496
+ mutation deleteLocations($ids: [String!]!) {
497
+ deleteLocations(ids: $ids)
495
498
  }
496
- `
499
+ `,
500
+ variables: {
501
+ ids
502
+ }
497
503
  })
498
504
 
499
505
  if (!response.errors) {
@@ -526,19 +532,20 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
526
532
 
527
533
  const retrieve = await client.query({
528
534
  query: gql`
529
- query {
530
- warehouses(${gqlBuilder.buildArgs({
531
- filters: [...filters],
532
- pagination: {},
533
- sortings: []
534
- })}) {
535
+ query warehouses($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
536
+ warehouses(filters: $filters, pagination: $pagination, sortings: $sortings) {
535
537
  items {
536
538
  id
537
539
  name
538
540
  }
539
541
  }
540
542
  }
541
- `
543
+ `,
544
+ variables: {
545
+ filters: [...filters],
546
+ pagination: {},
547
+ sortings: []
548
+ }
542
549
  })
543
550
  let name = retrieve.data.warehouses.items[0].name
544
551
 
@@ -551,12 +558,13 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
551
558
  cancelButton: { text: i18next.t('button.cancel'), color: '#cfcfcf' },
552
559
  callback: async result => {
553
560
  if (result.value && name !== '') {
554
- const response = await client.query({
555
- query: gql`
556
- mutation {
557
- deleteAllLocations(${gqlBuilder.buildArgs({ warehouseId: this._warehouseId })})
561
+ const response = await client.mutate({
562
+ mutation: gql`
563
+ mutation deleteAllLocations($warehouseId: String!) {
564
+ deleteAllLocations(warehouseId: $warehouseId)
558
565
  }
559
- `
566
+ `,
567
+ variables: { warehouseId: this._warehouseId }
560
568
  })
561
569
  if (!response.errors) this._clearTempLocation()
562
570
  }
@@ -665,6 +673,7 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
665
673
 
666
674
  /* for location record mapping */
667
675
  searchParams.append('location', record.name)
676
+ searchParams.append('originalName', record.originalName)
668
677
  searchParams.append('label', record.indicator)
669
678
 
670
679
  try {
@@ -6,7 +6,7 @@ import { connect } from 'pwa-helpers/connect-mixin'
6
6
  import { css, html } from 'lit-element'
7
7
  import { getCodeByName } from '@things-factory/code-base'
8
8
  import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
9
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
9
+ import { isMobileDevice } from '@things-factory/utils'
10
10
  import { i18next, localize } from '@things-factory/i18n-base'
11
11
  import { openPopup } from '@things-factory/layout-base'
12
12
  import { REUSABLE_PALLET_LABEL_SETTING_KEY } from '../constants'
@@ -231,28 +231,24 @@ class PalletList extends connect(store)(localize(i18next)(PageView)) {
231
231
  async fetchHandler({ page, limit, sorters = [] }) {
232
232
  const response = await client.query({
233
233
  query: gql`
234
- query {
235
- pallets(${gqlBuilder.buildArgs({
236
- filters: [...this.searchForm.queryFilters],
237
- pagination: { page, limit },
238
- sortings: sorters
239
- })}) {
234
+ query pallets($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
235
+ pallets(filters: $filters, pagination: $pagination, sortings: $sortings) {
240
236
  items {
241
237
  id
242
- name
243
- owner{
238
+ name
239
+ owner {
244
240
  id
245
241
  name
246
242
  description
247
243
  }
248
- holder{
244
+ holder {
249
245
  id
250
246
  name
251
247
  description
252
248
  }
253
249
  status
254
250
  updatedAt
255
- updater{
251
+ updater {
256
252
  id
257
253
  name
258
254
  description
@@ -261,7 +257,12 @@ class PalletList extends connect(store)(localize(i18next)(PageView)) {
261
257
  total
262
258
  }
263
259
  }
264
- `
260
+ `,
261
+ variables: {
262
+ filters: [...this.searchForm.queryFilters],
263
+ pagination: { page, limit },
264
+ sortings: sorters
265
+ }
265
266
  })
266
267
 
267
268
  return {
@@ -274,14 +275,15 @@ class PalletList extends connect(store)(localize(i18next)(PageView)) {
274
275
  this.dataGrist.showSpinner()
275
276
  const response = await client.query({
276
277
  query: gql`
277
- mutation {
278
- updateMultiplePallet(${gqlBuilder.buildArgs({
279
- patches
280
- })}) {
281
- name
282
- }
278
+ mutation updateMultiplePallet($patches: [PalletPatch!]!) {
279
+ updateMultiplePallet(patches: $patches) {
280
+ name
283
281
  }
284
- `
282
+ }
283
+ `,
284
+ variables: {
285
+ patches
286
+ }
285
287
  })
286
288
  if (!response.errors) {
287
289
  history.back()
@@ -301,16 +303,17 @@ class PalletList extends connect(store)(localize(i18next)(PageView)) {
301
303
  let patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
302
304
  if (patches && patches.length) {
303
305
  this.dataGrist.showSpinner()
304
- const response = await client.query({
305
- query: gql`
306
- mutation {
307
- updateMultiplePallet(${gqlBuilder.buildArgs({
308
- patches
309
- })}) {
306
+ const response = await client.mutate({
307
+ mutation: gql`
308
+ mutation updateMultiplePallet($patches: [PalletPatch!]!) {
309
+ updateMultiplePallet(patches: $patches) {
310
310
  name
311
311
  }
312
312
  }
313
- `
313
+ `,
314
+ variables: {
315
+ patches
316
+ }
314
317
  })
315
318
 
316
319
  if (!response.errors) {
@@ -341,10 +344,11 @@ class PalletList extends connect(store)(localize(i18next)(PageView)) {
341
344
  if (id && id.length > 0) {
342
345
  const response = await client.query({
343
346
  query: gql`
344
- mutation {
345
- deletePallets(${gqlBuilder.buildArgs({ id })})
346
- }
347
- `
347
+ mutation deletePallets($id: [String!]!) {
348
+ deletePallets(ids: $id)
349
+ }
350
+ `,
351
+ variables: { id }
348
352
  })
349
353
 
350
354
  if (!response.errors) {
@@ -1,12 +1,14 @@
1
1
  import '@things-factory/form-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, LitElement } from 'lit-element'
6
+
7
+ import { MultiColumnFormStyles } from '@things-factory/form-ui'
4
8
  import { i18next, localize } from '@things-factory/i18n-base'
5
9
  import { client } from '@things-factory/shell'
6
10
  import { ScrollbarStyles } from '@things-factory/styles'
7
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
8
- import gql from 'graphql-tag'
9
- import { css, html, LitElement } from 'lit-element'
11
+ import { isMobileDevice } from '@things-factory/utils'
10
12
 
11
13
  export class PrintLocationLabel extends localize(i18next)(LitElement) {
12
14
  static get properties() {
@@ -91,27 +93,24 @@ export class PrintLocationLabel extends localize(i18next)(LitElement) {
91
93
  <fieldset>
92
94
  <label>${i18next.t('label.label_format')}</label>
93
95
  <select
94
- name="labelFormat"
96
+ name="labelFormat"
95
97
  @change="${e => {
96
- this._fullLocationFormat =
97
- e.currentTarget.value === 'full_format'
98
- ? true
99
- : false
100
- if (this._labelIndicator.value != '') {
101
- this._getPrintPreview(this._labelIndicator.value)
102
- }
103
- }}">
98
+ this._fullLocationFormat = e.currentTarget.value === 'full_format' ? true : false
99
+ if (this._labelIndicator.value != '') this.dataGrist.fetch()
100
+ }}"
101
+ >
104
102
  <option value="full_format">A-01-01-01 (${i18next.t('text.full_format')})</option>
105
103
  <option value="partial_format">A-01-01 (${i18next.t('text.partial_format')})</option>
106
104
  </select>
107
105
 
108
106
  <label>${i18next.t('label.label_indicator')}</label>
109
- <select name="labelIndicator"
107
+ <select
108
+ name="labelIndicator"
110
109
  @change="${e => {
111
110
  let indicator = e.currentTarget.value
112
- if (indicator !== '')
113
- this._getPrintPreview(indicator)
114
- }}">
111
+ if (indicator !== '') this.dataGrist.fetch()
112
+ }}"
113
+ >
115
114
  <option value="">-- ${i18next.t('text.please_select_label_indicator')} --</option>
116
115
  <option value="zone">${i18next.t('label.zone')}</option>
117
116
  <option value="row">${i18next.t('label.row')}</option>
@@ -151,6 +150,12 @@ export class PrintLocationLabel extends localize(i18next)(LitElement) {
151
150
  header: i18next.t('field.name'),
152
151
  width: 250
153
152
  },
153
+ {
154
+ type: 'string',
155
+ name: 'originalName',
156
+ header: i18next.t('field.original_name'),
157
+ width: 250
158
+ },
154
159
  {
155
160
  type: 'string',
156
161
  name: 'indicator',
@@ -159,11 +164,6 @@ export class PrintLocationLabel extends localize(i18next)(LitElement) {
159
164
  }
160
165
  ]
161
166
  }
162
-
163
- if (this.selectedLocations && this.selectedLocations.length > 0) {
164
- this._records = []
165
- this._total = 0
166
- }
167
167
  }
168
168
 
169
169
  get _labelIndicator() {
@@ -174,171 +174,157 @@ export class PrintLocationLabel extends localize(i18next)(LitElement) {
174
174
  return this.shadowRoot.querySelector('data-grist')
175
175
  }
176
176
 
177
- async fetchHandler() {
178
- return {
179
- records: this._records || [],
180
- total: this._total || 0
181
- }
182
- }
177
+ async fetchHandler({ page, limit, sorters = [{ name: 'name' }] }) {
178
+ if (this._labelIndicator.value == '') return
179
+ const fetcherDetail = { page, limit, sorters }
180
+ const indicator = this._labelIndicator.value || ''
183
181
 
184
- async _getPrintPreview(indicator) {
185
- let locations = []
186
- let filters = []
182
+ let filters = [
183
+ {
184
+ name: 'warehouse_id',
185
+ operator: 'eq',
186
+ value: this.warehouseId
187
+ }
188
+ ]
189
+
190
+ let locations = [],
191
+ totalLocations = 0
187
192
 
188
- if (this.selectedLocations && this.selectedLocations.length > 0) {
189
- locations = this.selectedLocations
193
+ if (this.selectedLocations && this.selectedLocations.length) {
194
+ filters.push({
195
+ name: 'name',
196
+ operator: 'in',
197
+ value: this.selectedLocations.map(location => location.name)
198
+ })
199
+ const { records, total } = await this._fetchLocations(filters, fetcherDetail)
200
+ locations = records
201
+ totalLocations = total
190
202
  } else {
191
- if (this.warehouseId) {
192
- if (this._fullLocationFormat) {
193
- filters = [
194
- {
195
- name: 'warehouse_id',
196
- operator: 'eq',
197
- value: this.warehouseId
198
- },
199
- {
200
- name: 'type',
201
- operator: 'noteq',
202
- value: 'BUFFER'
203
- }
204
- ]
205
- locations = await this._fetchLocations(filters)
206
- }
203
+ if (this._fullLocationFormat) {
204
+ filters.push({
205
+ name: 'type',
206
+ operator: 'noteq',
207
+ value: 'BUFFER'
208
+ })
209
+ const { records, total } = await this._fetchLocations(filters, fetcherDetail)
210
+ locations = records
211
+ totalLocations = total
212
+ } else {
207
213
  // if partial format:
208
- // prevent from printing same location label. eg: A-01-01-01, A-01-01-02 > will print A-01-01 twice
209
- else {
210
- if (indicator === 'shelf') {
211
- this._showToast({
212
- level: 'error',
213
- message: i18next.t('text.shelf_is_not_allowed_as_an_indicator_for_partial_format')
214
- })
215
- return
216
- } else {
217
- filters = [{
218
- name: 'warehouse_id',
219
- operator: 'eq',
220
- value: this.warehouseId
221
- }]
222
- locations = await this._fetchLocationsByGroup(filters)
223
- }
214
+ // prevent from printing same location label. eg: A-01-01-01, A-01-01-02 > will print A-01-01 twice{
215
+ if (indicator == 'shelf') {
216
+ this._showToast({
217
+ level: 'error',
218
+ message: i18next.t('text.shelf_is_not_allowed_as_an_indicator_for_partial_format')
219
+ })
220
+ return
221
+ } else {
222
+ const { records, total } = await this._fetchLocationsByGroup(filters, fetcherDetail)
223
+ locations = records
224
+ totalLocations = total
224
225
  }
225
226
  }
226
227
  }
227
228
 
228
- locations = locations.map(location => {
229
- if (location.type === 'BUFFER') {
230
- return {
231
- ...location,
232
- indicator: location[indicator]
233
- }
234
- }
235
-
236
- else {
229
+ return {
230
+ total: totalLocations,
231
+ records: locations.map(location => {
237
232
  return {
238
233
  ...location,
239
- name: this._fullLocationFormat // check if full location format is true
240
- ? `${location.zone}-${location.row}-${location.column}-${location.shelf}`
241
- : `${location.zone}-${location.row}-${location.column}`,
242
- indicator: location[indicator]
234
+ indicator: location[indicator],
235
+ originalName: location.name,
236
+ name:
237
+ location.type === 'BUFFER'
238
+ ? ''
239
+ : this._fullLocationFormat // check if full location format is true
240
+ ? `${location.zone}-${location.row}-${location.column}-${location.shelf}`
241
+ : `${location.zone}-${location.row}-${location.column}`
243
242
  }
244
- }
245
- })
246
-
247
- this._records = locations
248
- this._total = locations.length
249
-
250
- this._config = {
251
- ...this._config,
252
- pagination: { pages: [20, 50, 100, 200] }
243
+ })
253
244
  }
254
-
255
- this.dataGrist.fetch()
256
245
  }
257
246
 
258
- async _fetchLocations(filters) {
259
- const sorters = [{ name: 'name', desc: false }]
260
-
261
- if (this.warehouseId) {
262
- try {
263
- this.dataGrist.showSpinner()
264
-
265
- const response = await client.query({
266
- query: gql`
267
- query {
268
- locations(${gqlBuilder.buildArgs({
269
- filters,
270
- sortings: sorters
271
- })}) {
272
- items {
273
- name
274
- zone
275
- row
276
- column
277
- shelf
278
- }
279
- total
247
+ async _fetchLocations(filters, fetcherDetail) {
248
+ try {
249
+ const response = await client.query({
250
+ query: gql`
251
+ query locations($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
252
+ locations(filters: $filters, pagination: $pagination, sortings: $sortings) {
253
+ items {
254
+ name
255
+ zone
256
+ row
257
+ column
258
+ shelf
259
+ type
280
260
  }
261
+ total
281
262
  }
282
- `
283
- })
263
+ }
264
+ `,
265
+ variables: {
266
+ filters,
267
+ paginations: { page: fetcherDetail.page, limit: fetcherDetail.limit },
268
+ sortings: fetcherDetail.sorters
269
+ }
270
+ })
284
271
 
285
- if (!response.errors) {
286
- return response.data.locations.items || []
272
+ if (!response.errors) {
273
+ return {
274
+ records: response.data.locations.items || [],
275
+ total: response.data.locations.total || 0
287
276
  }
288
- } catch (e) {
289
- this._showToast({
290
- level: 'error',
291
- message: e
292
- })
293
- } finally {
294
- this.dataGrist.hideSpinner()
295
277
  }
278
+ } catch (e) {
279
+ this._showToast({
280
+ level: 'error',
281
+ message: e
282
+ })
296
283
  }
297
284
  }
298
285
 
299
- async _fetchLocationsByGroup(filters) {
300
- const sorters = [{ name: 'name', desc: false }]
301
-
302
- if (this.warehouseId) {
303
- try {
304
- this.dataGrist.showSpinner()
305
-
306
- const response = await client.query({
307
- query: gql`
308
- query {
309
- locationsByGroup(${gqlBuilder.buildArgs({
310
- filters,
311
- sortings: sorters
312
- })}) {
313
- items {
314
- name
315
- zone
316
- row
317
- column
318
- }
319
- total
286
+ async _fetchLocationsByGroup(filters, fetcherDetail) {
287
+ try {
288
+ const response = await client.query({
289
+ query: gql`
290
+ query locationsByGroup($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
291
+ locationsByGroup(filters: $filters, pagination: $pagination, sortings: $sortings) {
292
+ items {
293
+ name
294
+ zone
295
+ row
296
+ column
297
+ type
320
298
  }
299
+ total
321
300
  }
322
- `
323
- })
301
+ }
302
+ `,
303
+ variables: {
304
+ filters,
305
+ paginations: { page: fetcherDetail.page, limit: fetcherDetail.limit },
306
+ sortings: fetcherDetail.sorters
307
+ }
308
+ })
324
309
 
325
- if (!response.errors) {
326
- return response.data.locationsByGroup.items || []
310
+ if (!response.errors) {
311
+ return {
312
+ records: response.data.locationsByGroup.items || [],
313
+ total: response.data.locationsByGroup.total || 0
327
314
  }
328
- } catch (e) {
329
- this._showToast({
330
- level: 'error',
331
- message: e
332
- })
333
- } finally {
334
- this.dataGrist.hideSpinner()
335
315
  }
316
+ } catch (e) {
317
+ this._showToast({
318
+ level: 'error',
319
+ message: e
320
+ })
336
321
  }
337
322
  }
338
323
 
339
324
  _printLocations() {
340
- if (this._records && this._records.length > 0) {
341
- this.dispatchEvent(new CustomEvent(i18next.t('text.printing'), { detail: this._records }))
325
+ const records = this.dataGrist.data && this.dataGrist.data.records
326
+ if (records && records.length) {
327
+ this.dispatchEvent(new CustomEvent(i18next.t('text.printing'), { detail: records }))
342
328
  history.back()
343
329
  } else {
344
330
  this._showToast({
@@ -960,7 +960,7 @@ class ProductList extends localize(i18next)(PageView) {
960
960
  if (_.isEmpty(itm.uom) || '') {
961
961
  if (!errors.find(err => err.type == 'uom')) errors.push({ type: 'uom', value: 'UOM is required' })
962
962
  }
963
- if (!_.isNumber(itm.uomValue) || _.isNaN(itm.uomValue) || '' || itm?.uomValue < 1) {
963
+ if (!_.isNumber(itm.uomValue) || _.isNaN(itm.uomValue) || '' || itm?.uomValue <= 0) {
964
964
  if (!errors.find(err => err.type == 'uomValue'))
965
965
  errors.push({ type: 'uomValue', value: 'UOM Value is required' })
966
966
  }