@things-factory/operato-wms 3.7.2 → 3.7.7

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 (84) hide show
  1. package/client/pages/components/select-product-popup.js +5 -1
  2. package/client/pages/constants/order.js +10 -0
  3. package/client/pages/inbound/putaway-product.js +162 -139
  4. package/client/pages/inventory-check/inspecting-product.js +146 -80
  5. package/client/pages/manifest/create-loading-manifest.js +314 -0
  6. package/client/pages/manifest/dispatcher-verification-popup.js +86 -0
  7. package/client/pages/manifest/loading-manifest-detail.js +345 -0
  8. package/client/pages/manifest/loading-manifest-list.js +305 -0
  9. package/client/pages/order/arrival-notice/create-arrival-notice.js +8 -1
  10. package/client/pages/order/goods-received-note/received-note-list.js +138 -6
  11. package/client/pages/order/release-order/b2b/b2b-order-list.js +45 -5
  12. package/client/pages/order/release-order/b2b/b2b-order-requests.js +45 -5
  13. package/client/pages/order/release-order/b2c/b2c-order-requests.js +181 -21
  14. package/client/pages/order/release-order/bulk-print-packing-list.js +23 -0
  15. package/client/pages/order/release-order/create-release-order.js +25 -4
  16. package/client/pages/order/release-order/receive-release-order-request.js +27 -24
  17. package/client/pages/order/release-order/release-extra-product-popup.js +189 -56
  18. package/client/pages/order/release-order/release-order-detail.js +292 -71
  19. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-detail.js +115 -50
  20. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-list.js +1 -6
  21. package/client/pages/order/reverse-kitting-order/reverse-kitting-pallet-label-popup.js +239 -0
  22. package/client/pages/order/transport-order/delivery-order-list.js +99 -59
  23. package/client/pages/outbound/loading-product.js +4 -1
  24. package/client/pages/outbound/merged-outbound-worksheet.js +39 -1
  25. package/client/pages/outbound/packing-product.js +4 -1
  26. package/client/pages/outbound/packing-worksheet-list.js +39 -1
  27. package/client/pages/outbound/picking-product.js +622 -290
  28. package/client/pages/outbound/serial-number-popup.js +280 -0
  29. package/client/pages/outbound/worksheet-picking.js +28 -2
  30. package/client/pages/report/product-label-report.js +401 -0
  31. package/client/pages/support/inventory-comparison.js +296 -0
  32. package/client/pages/vas/print-product-label.js +298 -132
  33. package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +30 -12
  34. package/client/pages/vas/reverse-kitting/popup-combination-sets.js +75 -5
  35. package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +113 -18
  36. package/client/route.js +23 -0
  37. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +64 -54
  38. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js.map +1 -1
  39. package/dist-server/graphql/resolvers/extra/add-release-good-products.js +34 -9
  40. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
  41. package/dist-server/graphql/resolvers/index.js +3 -1
  42. package/dist-server/graphql/resolvers/index.js.map +1 -1
  43. package/dist-server/graphql/resolvers/inventory-comparison/index.js +6 -0
  44. package/dist-server/graphql/resolvers/inventory-comparison/index.js.map +1 -0
  45. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js +78 -0
  46. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js.map +1 -0
  47. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  48. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  49. package/dist-server/graphql/resolvers/reports/product-label-report.js +56 -0
  50. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -0
  51. package/dist-server/graphql/types/index.js +5 -2
  52. package/dist-server/graphql/types/index.js.map +1 -1
  53. package/dist-server/graphql/types/inventory-comparison/index.js +13 -0
  54. package/dist-server/graphql/types/inventory-comparison/index.js.map +1 -0
  55. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js +14 -0
  56. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js.map +1 -0
  57. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js +18 -0
  58. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js.map +1 -0
  59. package/dist-server/graphql/types/reports/index.js +6 -1
  60. package/dist-server/graphql/types/reports/index.js.map +1 -1
  61. package/dist-server/graphql/types/reports/product-label-report-list.js +14 -0
  62. package/dist-server/graphql/types/reports/product-label-report-list.js.map +1 -0
  63. package/dist-server/graphql/types/reports/product-label-report.js +16 -0
  64. package/dist-server/graphql/types/reports/product-label-report.js.map +1 -0
  65. package/package.json +65 -65
  66. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +75 -65
  67. package/server/graphql/resolvers/extra/add-release-good-products.ts +57 -15
  68. package/server/graphql/resolvers/index.ts +3 -1
  69. package/server/graphql/resolvers/inventory-comparison/index.ts +5 -0
  70. package/server/graphql/resolvers/inventory-comparison/inventory-comparison-list.ts +99 -0
  71. package/server/graphql/resolvers/reports/index.ts +3 -1
  72. package/server/graphql/resolvers/reports/product-label-report.ts +56 -0
  73. package/server/graphql/types/index.ts +5 -2
  74. package/server/graphql/types/inventory-comparison/index.ts +11 -0
  75. package/server/graphql/types/inventory-comparison/inventory-comparison-list.ts +8 -0
  76. package/server/graphql/types/inventory-comparison/inventory-comparison.ts +12 -0
  77. package/server/graphql/types/reports/index.ts +6 -1
  78. package/server/graphql/types/reports/product-label-report-list.ts +8 -0
  79. package/server/graphql/types/reports/product-label-report.ts +10 -0
  80. package/things-factory.config.js +24 -0
  81. package/translations/en.json +64 -12
  82. package/translations/ko.json +50 -1
  83. package/translations/ms.json +51 -1
  84. package/translations/zh.json +50 -1
@@ -12,7 +12,7 @@ import { MultiColumnFormStyles } from '@things-factory/form-ui'
12
12
  import { i18next, localize } from '@things-factory/i18n-base'
13
13
  import { client, CustomAlert, PageView, store } from '@things-factory/shell'
14
14
  import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
15
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
15
+ import { isMobileDevice } from '@things-factory/utils'
16
16
 
17
17
  import { PRODUCT_LABEL_SETTING_KEY } from '../constants'
18
18
 
@@ -42,7 +42,6 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
42
42
  static get properties() {
43
43
  return {
44
44
  config: Object,
45
- _selectedRecords: Array,
46
45
  _searchingType: String
47
46
  }
48
47
  }
@@ -63,7 +62,6 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
63
62
  name="orderType"
64
63
  @change="${e => {
65
64
  this._searchingType = e.currentTarget.value
66
- this.dataGrist.data.records = []
67
65
  }}"
68
66
  >
69
67
  ${Object.keys(SEARCH_TYPES).map(
@@ -99,8 +97,6 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
99
97
  .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
100
98
  .config=${this.config}
101
99
  .fetchHandler="${this.fetchHandler.bind(this)}"
102
- @select-record-change=${e => (this._selectedRecords = e.detail.selectedRecords)}
103
- }
104
100
  ></data-grist>
105
101
  `
106
102
  }
@@ -116,7 +112,7 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
116
112
  actions: [
117
113
  {
118
114
  title: i18next.t('button.print_label'),
119
- action: this._printProductLabels.bind(this),
115
+ action: this._printProductLabel.bind(this),
120
116
  ...CommonButtonStyles.label
121
117
  }
122
118
  ]
@@ -127,15 +123,7 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
127
123
  return this.shadowRoot.querySelector('data-grist')
128
124
  }
129
125
 
130
- get orderNoInput() {
131
- return this.shadowRoot.querySelector('barcode-scanable-input[name=orderNo]').shadowRoot.querySelector('input')
132
- }
133
-
134
- get productInfoInput() {
135
- return this.shadowRoot.querySelector('input[name=productInfo]')
136
- }
137
-
138
- get searchInfo() {
126
+ get _searchInfo() {
139
127
  if (this._searchingType == 'INVENTORY') {
140
128
  return {
141
129
  productInfo: this.shadowRoot.querySelector('input[name=productInfo]').value,
@@ -149,7 +137,7 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
149
137
  }
150
138
  }
151
139
 
152
- get targetData() {
140
+ get _targetData() {
153
141
  return this.dataGrist.selected.map(record => {
154
142
  if (!record.printQty || record.printQty == '' || Number(record.printQty) < 1) {
155
143
  return {
@@ -165,13 +153,15 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
165
153
  pageInitialized() {
166
154
  this.config = {
167
155
  pagination: { infinite: true },
168
- rows: { selectable: { multiple: true } },
156
+ rows: { appendable: false, selectable: { multiple: true } },
169
157
  list: {
170
158
  fields: [
171
159
  'palletId',
172
160
  'batchId',
161
+ 'gtin',
173
162
  'sku',
174
- 'productInfo',
163
+ 'productName',
164
+ 'description',
175
165
  'auxUnit1',
176
166
  'auxValue1',
177
167
  'auxUnit2',
@@ -197,6 +187,13 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
197
187
  sortable: true,
198
188
  width: 150
199
189
  },
190
+ {
191
+ type: 'string',
192
+ name: 'gtin',
193
+ header: i18next.t('field.gtin'),
194
+ sortable: true,
195
+ width: 150
196
+ },
200
197
  {
201
198
  type: 'string',
202
199
  name: 'sku',
@@ -206,8 +203,15 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
206
203
  },
207
204
  {
208
205
  type: 'string',
209
- name: 'productInfo',
210
- header: i18next.t('field.product_info'),
206
+ name: 'productName',
207
+ header: i18next.t('field.product_name'),
208
+ sortable: true,
209
+ width: 200
210
+ },
211
+ {
212
+ type: 'string',
213
+ name: 'description',
214
+ header: i18next.t('field.description'),
211
215
  sortable: true,
212
216
  width: 200
213
217
  },
@@ -275,22 +279,20 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
275
279
  async fetchHandler({ page, limit, sorters = [] }) {
276
280
  const fetcherDetail = { page, limit, sorters }
277
281
  const searchType = this._searchingType
278
- const searchInfo = this.searchInfo
282
+ const searchInfo = this._searchInfo
279
283
 
280
- if (!searchInfo || Object.values(searchInfo).every(search => search === '')) return
284
+ if (!searchInfo || Object.values(searchInfo).every(search => search === ''))
285
+ return {
286
+ records: [],
287
+ total: 0
288
+ }
281
289
 
282
290
  switch (searchType) {
283
291
  case 'GAN':
284
292
  return await this._fetchArrivalNotice(searchInfo.orderNo)
285
293
 
286
294
  case 'RO':
287
- return await this._fetchOrderInventories([
288
- {
289
- name: 'releaseGoodNo',
290
- operator: 'eq',
291
- value: searchInfo.orderNo
292
- }
293
- ])
295
+ return await this._fetchReleaseOrder(searchInfo.orderNo)
294
296
 
295
297
  case 'INVENTORY':
296
298
  const filters = [{ name: 'status', operator: 'notin', value: ['INTRANSIT', 'TERMINATED', 'DELETED'] }]
@@ -312,10 +314,8 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
312
314
  try {
313
315
  const response = await client.query({
314
316
  query: gql`
315
- query {
316
- arrivalNotice(${gqlBuilder.buildArgs({
317
- name
318
- })}) {
317
+ query arrivalNotice($name: String!) {
318
+ arrivalNotice(name: $name) {
319
319
  orderInventories {
320
320
  inventory {
321
321
  batchId
@@ -333,12 +333,17 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
333
333
  auxValue1
334
334
  auxUnit2
335
335
  auxValue2
336
+ productDetails {
337
+ name
338
+ gtin
339
+ }
336
340
  }
337
341
  }
338
342
  }
339
343
  orderProducts {
340
344
  batchId
341
345
  palletQty
346
+ actualPalletQty
342
347
  product {
343
348
  name
344
349
  sku
@@ -348,60 +353,106 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
348
353
  auxValue1
349
354
  auxUnit2
350
355
  auxValue2
356
+ productDetails {
357
+ name
358
+ gtin
359
+ }
351
360
  }
352
361
  }
362
+ bizplace {
363
+ id
364
+ name
365
+ }
353
366
  }
354
367
  }
355
- `
368
+ `,
369
+ variables: { name }
356
370
  })
357
371
 
358
372
  if (!response.errors) {
359
- const orderInventories = response.data.arrivalNotice.orderInventories
360
- const orderProducts = response.data.arrivalNotice.orderProducts
373
+ const arrivalNotice = response.data.arrivalNotice
374
+ const orderInventories = arrivalNotice.orderInventories
375
+ const orderProducts = arrivalNotice.orderProducts
361
376
 
362
377
  if (orderInventories && orderInventories.length) {
363
378
  return {
364
- records: orderInventories.map(oi => {
365
- const inventory = oi.inventory
366
- const product = inventory.product
367
- return {
368
- batchId: inventory.batchId,
369
- palletId: inventory.palletId,
370
- location: inventory.location?.name || '',
371
- expirationDate: inventory.expirationDate || '',
372
- productName: product.name,
373
- sku: product.sku,
374
- description: product.description,
375
- type: product.type,
376
- auxUnit1: product.auxUnit1 || '',
377
- auxValue1: product.auxValue1 || '',
378
- auxUnit2: product.auxUnit2 || '',
379
- auxValue2: product.auxValue2 || '',
380
- productInfo: product.description ? `${product.name} (${product.description})` : `${product.name}`
381
- }
382
- })
379
+ total: 0,
380
+ records: orderInventories
381
+ .map(oi => {
382
+ const inventory = oi.inventory
383
+ const product = inventory.product
384
+ const record = {
385
+ batchId: inventory.batchId,
386
+ palletId: inventory.palletId,
387
+ location: inventory.location?.name || '',
388
+ expirationDate: inventory.expirationDate || '',
389
+ sku: product.sku,
390
+ description: product.description,
391
+ type: product.type,
392
+ auxUnit1: product.auxUnit1 || '',
393
+ auxValue1: product.auxValue1 || '',
394
+ auxUnit2: product.auxUnit2 || '',
395
+ auxValue2: product.auxValue2 || '',
396
+ bizplaceId: arrivalNotice.bizplace.id
397
+ }
398
+
399
+ if (product.productDetails && product.productDetails.length) {
400
+ return inventory.product.productDetails.map(productDetail => {
401
+ return {
402
+ ...record,
403
+ gtin: productDetail.gtin,
404
+ productName: productDetail.name
405
+ }
406
+ })
407
+ } else {
408
+ return {
409
+ ...record,
410
+ gtin: '[N/A]',
411
+ productName: product.name
412
+ }
413
+ }
414
+ })
415
+ .flat()
383
416
  }
384
417
  } else {
385
418
  return {
386
- records: orderProducts.map(op => {
387
- const product = op.product
388
- return {
389
- batchId: op.batchId,
390
- palletId: '',
391
- location: '',
392
- expirationDate: '',
393
- productName: product.name,
394
- sku: product.sku,
395
- description: product.description,
396
- type: product.type,
397
- printQty: op.palletQty || null,
398
- auxUnit1: product.auxUnit1 || '',
399
- auxValue1: product.auxValue1 || '',
400
- auxUnit2: product.auxUnit2 || '',
401
- auxValue2: product.auxValue2 || '',
402
- productInfo: product.description ? `${product.name} (${product.description})` : `${product.name}`
403
- }
404
- })
419
+ total: 0,
420
+ records: orderProducts
421
+ .map(op => {
422
+ const product = op.product
423
+ const record = {
424
+ batchId: op.batchId,
425
+ palletId: '[N/A]',
426
+ location: '[N/A]',
427
+ expirationDate: '',
428
+ sku: product.sku,
429
+ description: product.description,
430
+ type: product.type,
431
+ printQty: op.actualPalletQty || op.palletQty || null,
432
+ auxUnit1: product.auxUnit1 || '',
433
+ auxValue1: product.auxValue1 || '',
434
+ auxUnit2: product.auxUnit2 || '',
435
+ auxValue2: product.auxValue2 || '',
436
+ bizplaceId: arrivalNotice.bizplace.id
437
+ }
438
+
439
+ if (product.productDetails && product.productDetails.length) {
440
+ return product.productDetails.map(productDetail => {
441
+ return {
442
+ ...record,
443
+ gtin: productDetail.gtin,
444
+ productName: productDetail.name
445
+ }
446
+ })
447
+ } else {
448
+ return {
449
+ ...record,
450
+ gtin: '[N/A]',
451
+ productName: product.name
452
+ }
453
+ }
454
+ })
455
+ .flat()
405
456
  }
406
457
  }
407
458
  } else
@@ -414,22 +465,39 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
414
465
  }
415
466
  }
416
467
 
417
- async _fetchOrderInventories(filters) {
468
+ async _fetchReleaseOrder(name) {
418
469
  try {
419
470
  const response = await client.query({
420
471
  query: gql`
421
- query {
422
- orderInventories(${gqlBuilder.buildArgs({
423
- filters
424
- })}) {
425
- items {
472
+ query releaseGood($name: String!) {
473
+ releaseGood(name: $name) {
474
+ orderInventories {
475
+ id
476
+ batchId
477
+ packingType
478
+ product {
479
+ name
480
+ sku
481
+ description
482
+ type
483
+ auxUnit1
484
+ auxValue1
485
+ auxUnit2
486
+ auxValue2
487
+ productDetails {
488
+ sku
489
+ name
490
+ description
491
+ gtin
492
+ }
493
+ }
426
494
  inventory {
427
495
  batchId
428
496
  palletId
497
+ expirationDate
429
498
  location {
430
499
  name
431
500
  }
432
- expirationDate
433
501
  product {
434
502
  name
435
503
  sku
@@ -439,41 +507,109 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
439
507
  auxValue1
440
508
  auxUnit2
441
509
  auxValue2
510
+ productDetails {
511
+ name
512
+ gtin
513
+ }
442
514
  }
443
515
  }
444
516
  }
445
- total
517
+ bizplace {
518
+ id
519
+ name
520
+ }
446
521
  }
447
522
  }
448
- `
523
+ `,
524
+ variables: { name }
449
525
  })
450
526
 
451
527
  if (!response.errors) {
452
- const orderInventories = response.data.orderInventories
528
+ const releaseGood = response.data.releaseGood
529
+ const orderInventories = releaseGood.orderInventories
453
530
 
454
- return {
455
- total: orderInventories.total,
456
- records: orderInventories.items.map(item => {
457
- const inventory = item.inventory
531
+ if (orderInventories && orderInventories.length) {
532
+ // in case order inventory has inventory
533
+ if (orderInventories.every(oi => oi.inventory)) {
534
+ return {
535
+ total: 0,
536
+ records: orderInventories
537
+ .map(oi => {
538
+ const inventory = oi.inventory
539
+ const product = inventory.product
540
+ const record = {
541
+ batchId: inventory.batchId,
542
+ palletId: inventory.palletId,
543
+ location: inventory.location?.name || '',
544
+ expirationDate: inventory.expirationDate || '',
545
+ sku: product.sku,
546
+ description: product.description,
547
+ type: product.type,
548
+ auxUnit1: product.auxUnit1 || '',
549
+ auxValue1: product.auxValue1 || '',
550
+ auxUnit2: product.auxUnit2 || '',
551
+ auxValue2: product.auxValue2 || '',
552
+ bizplaceId: releaseGood.bizplace.id
553
+ }
458
554
 
555
+ if (product.productDetails && product.productDetails.length) {
556
+ return product.productDetails.map(productDetail => {
557
+ return {
558
+ ...record,
559
+ gtin: productDetail.gtin,
560
+ productName: productDetail.name
561
+ }
562
+ })
563
+ } else {
564
+ return {
565
+ ...record,
566
+ gtin: '[N/A]',
567
+ productName: product.name
568
+ }
569
+ }
570
+ })
571
+ .flat()
572
+ }
573
+ } else {
459
574
  return {
460
- batchId: inventory.batchId,
461
- palletId: inventory.palletId,
462
- location: inventory.location?.name || '',
463
- expirationDate: inventory.expirationDate || '',
464
- productName: inventory.product.name,
465
- sku: inventory.product.sku,
466
- description: inventory.product.description,
467
- type: inventory.product.type,
468
- auxUnit1: inventory.product.auxUnit1 || '',
469
- auxValue1: inventory.product.auxValue1 || '',
470
- auxUnit2: inventory.product.auxUnit2 || '',
471
- auxValue2: inventory.product.auxValue2 || '',
472
- productInfo: inventory.product.description
473
- ? `${inventory.product.name} (${inventory.product.description})`
474
- : `${inventory.product.name}`
575
+ total: 0,
576
+ records: orderInventories
577
+ .map(oi => {
578
+ const product = oi.product
579
+ const record = {
580
+ batchId: oi.batchId,
581
+ palletId: '[N/A]',
582
+ location: '[N/A]',
583
+ expirationDate: '',
584
+ sku: product.sku,
585
+ description: product.description,
586
+ type: product.type,
587
+ auxUnit1: product.auxUnit1 || '',
588
+ auxValue1: product.auxValue1 || '',
589
+ auxUnit2: product.auxUnit2 || '',
590
+ auxValue2: product.auxValue2 || '',
591
+ bizplaceId: releaseGood.bizplace.id
592
+ }
593
+
594
+ if (product.productDetails && product.productDetails.length) {
595
+ return product.productDetails.map(productDetail => {
596
+ return {
597
+ ...record,
598
+ gtin: productDetail.gtin,
599
+ productName: productDetail.name
600
+ }
601
+ })
602
+ } else {
603
+ return {
604
+ ...record,
605
+ gtin: '[N/A]',
606
+ productName: product.name
607
+ }
608
+ }
609
+ })
610
+ .flat()
475
611
  }
476
- })
612
+ }
477
613
  }
478
614
  } else
479
615
  return {
@@ -505,6 +641,13 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
505
641
  auxValue1
506
642
  auxUnit2
507
643
  auxValue2
644
+ productDetails {
645
+ name
646
+ gtin
647
+ }
648
+ }
649
+ bizplace {
650
+ id
508
651
  }
509
652
  expirationDate
510
653
  }
@@ -524,25 +667,42 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
524
667
 
525
668
  return {
526
669
  total: inventories.total,
527
- records: inventories.items.map(item => {
528
- return {
529
- batchId: item.batchId,
530
- palletId: item.palletId,
531
- location: item.location?.name || '',
532
- expirationDate: item.expirationDate || '',
533
- productName: item.product.name,
534
- sku: item.product.sku,
535
- description: item.product.description,
536
- type: item.product.type,
537
- auxUnit1: item.product.auxUnit1 || '',
538
- auxValue1: item.product.auxValue1 || '',
539
- auxUnit2: item.product.auxUnit2 || '',
540
- auxValue2: item.product.auxValue2 || '',
541
- productInfo: item.product.description
542
- ? `${item.product.name} (${item.product.description})`
543
- : `${item.product.name}`
544
- }
545
- })
670
+ records: inventories.items
671
+ .map(inventory => {
672
+ const product = inventory.product
673
+ const record = {
674
+ batchId: inventory.batchId,
675
+ palletId: inventory.palletId,
676
+ location: inventory.location?.name || '',
677
+ expirationDate: inventory.expirationDate || '',
678
+ sku: product.sku,
679
+ description: product.description,
680
+ type: product.type,
681
+ auxUnit1: product.auxUnit1 || '',
682
+ auxValue1: product.auxValue1 || '',
683
+ auxUnit2: product.auxUnit2 || '',
684
+ auxValue2: product.auxValue2 || '',
685
+ productInfo: product.description ? `${product.name} (${product.description})` : `${product.name}`,
686
+ bizplaceId: inventory.bizplace.id
687
+ }
688
+
689
+ if (product.productDetails && product.productDetails.length) {
690
+ return product.productDetails.map(productDetail => {
691
+ return {
692
+ ...record,
693
+ gtin: productDetail.gtin,
694
+ productName: productDetail.name
695
+ }
696
+ })
697
+ } else {
698
+ return {
699
+ ...record,
700
+ gtin: '[N/A]',
701
+ productName: product.name
702
+ }
703
+ }
704
+ })
705
+ .flat()
546
706
  }
547
707
  } else
548
708
  return {
@@ -551,7 +711,7 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
551
711
  }
552
712
  }
553
713
 
554
- async _printProductLabels() {
714
+ async _printProductLabel() {
555
715
  const labelId = this._productLabel && this._productLabel.id
556
716
 
557
717
  if (
@@ -567,7 +727,7 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
567
727
  if (!result.value) return
568
728
  }
569
729
 
570
- const records = this.targetData
730
+ const records = this._targetData
571
731
 
572
732
  if (!records?.length) {
573
733
  this._showToast({ message: `${i18next.t('text.please_select_the_product')}.` })
@@ -583,6 +743,10 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
583
743
  for (var record of records) {
584
744
  let searchParams = new URLSearchParams()
585
745
 
746
+ searchParams.append('gtin', record.gtin)
747
+ searchParams.append('sku', record.sku)
748
+ searchParams.append('product_name', record.productName)
749
+ searchParams.append('description', record.description)
586
750
  searchParams.append('pallet_id', record.palletId)
587
751
  searchParams.append('batch_id', record.batchId)
588
752
  searchParams.append('aux_unit_1', record.auxUnit1)
@@ -590,6 +754,7 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
590
754
  searchParams.append('aux_unit_2', record.auxUnit2)
591
755
  searchParams.append('aux_value_2', record.auxValue2)
592
756
  searchParams.append('expiration_date', record.expirationDate)
757
+ searchParams.append('location', record.location)
593
758
 
594
759
  let printCounter = 0
595
760
  try {
@@ -618,26 +783,27 @@ class PrintProductLabel extends connect(store)(localize(i18next)(PageView)) {
618
783
  break
619
784
  } finally {
620
785
  // we only need to update when the counter is more than 0
621
- if (printCounter > 0) await this._updatePrintedLabelSequence(record.type, printCounter)
786
+ if (printCounter > 0) await this._updatePrintedLabelSequence(record.type, printCounter, record.bizplaceId)
622
787
  }
623
788
  }
624
789
  }
625
790
  }
626
791
 
627
- async _updatePrintedLabelSequence(pattern, counter) {
792
+ async _updatePrintedLabelSequence(type, counter, bizplaceId) {
628
793
  try {
629
- const response = await client.mutate({
794
+ await client.mutate({
630
795
  mutation: gql`
631
- mutation upsertSequence($pattern: String!, $counter: Int) {
632
- upsertSequence(pattern: $pattern, counter: $counter) {
796
+ mutation updateInsertSequence($type: String!, $counter: Int, $bizplaceId: String!) {
797
+ updateInsertSequence(type: $type, counter: $counter, bizplaceId: $bizplaceId) {
633
798
  pattern
634
799
  seq
635
800
  }
636
801
  }
637
802
  `,
638
803
  variables: {
639
- pattern,
640
- counter
804
+ type,
805
+ counter,
806
+ bizplaceId
641
807
  }
642
808
  })
643
809
  } catch (e) {