@things-factory/operato-wms 4.3.76 → 4.3.79-alpha.0

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 (42) hide show
  1. package/client/pages/inventory/inventory-adjustment.js +259 -238
  2. package/client/pages/inventory/serial-number-list-popup.js +24 -7
  3. package/client/pages/order/release-order/release-order-detail.js +3 -3
  4. package/client/pages/outbound/generate-worksheet-popup.js +21 -7
  5. package/client/pages/outbound/packing-product.js +94 -30
  6. package/client/util/index.js +1 -0
  7. package/client/util/page-settings.js +43 -0
  8. package/dist-server/graphql/resolvers/index.js +5 -4
  9. package/dist-server/graphql/resolvers/index.js.map +1 -1
  10. package/dist-server/graphql/resolvers/{extra → other}/add-release-good-products.js +0 -0
  11. package/dist-server/graphql/resolvers/{extra → other}/add-release-good-products.js.map +1 -1
  12. package/dist-server/graphql/resolvers/{extra → other}/index.js +3 -1
  13. package/dist-server/graphql/resolvers/other/index.js.map +1 -0
  14. package/dist-server/graphql/resolvers/other/page-settings.js +87 -0
  15. package/dist-server/graphql/resolvers/other/page-settings.js.map +1 -0
  16. package/dist-server/graphql/types/index.js +7 -2
  17. package/dist-server/graphql/types/index.js.map +1 -1
  18. package/dist-server/graphql/types/other/index.js +19 -0
  19. package/dist-server/graphql/types/other/index.js.map +1 -0
  20. package/dist-server/graphql/types/other/page-setting.js +36 -0
  21. package/dist-server/graphql/types/other/page-setting.js.map +1 -0
  22. package/helps/release-note.ko.md +6 -19
  23. package/helps/release-note.md +6 -19
  24. package/helps/release-note.ms.md +6 -19
  25. package/helps/release-note.zh.md +6 -19
  26. package/package.json +50 -50
  27. package/server/graphql/resolvers/index.ts +5 -4
  28. package/server/graphql/resolvers/{extra → other}/add-release-good-products.ts +0 -0
  29. package/server/graphql/resolvers/other/index.ts +10 -0
  30. package/server/graphql/resolvers/other/page-settings.ts +105 -0
  31. package/server/graphql/types/index.ts +8 -2
  32. package/server/graphql/types/other/index.ts +19 -0
  33. package/server/graphql/types/other/page-setting.ts +33 -0
  34. package/translations/en.json +10 -2
  35. package/translations/ko.json +8 -0
  36. package/translations/ms.json +8 -0
  37. package/translations/zh.json +8 -0
  38. package/dist-server/graphql/resolvers/extra/index.js.map +0 -1
  39. package/dist-server/graphql/types/extra/index.js +0 -11
  40. package/dist-server/graphql/types/extra/index.js.map +0 -1
  41. package/server/graphql/resolvers/extra/index.ts +0 -5
  42. package/server/graphql/types/extra/index.ts +0 -7
@@ -17,6 +17,8 @@ import { client, CustomAlert, PageView, store } from '@things-factory/shell'
17
17
  import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
18
18
  import { isMobileDevice } from '@things-factory/utils'
19
19
 
20
+ import { fetchPageSettings } from '../../util/index'
21
+
20
22
  import { CARTON_LABEL_SETTING_KEY, INVENTORY_ITEM_CHANGE_TYPE, PALLET_LABEL_SETTING_KEY } from '../constants'
21
23
 
22
24
  class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
@@ -61,6 +63,10 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
61
63
  return this.shadowRoot.querySelector('search-form')
62
64
  }
63
65
 
66
+ get columns() {
67
+ return this.config.columns
68
+ }
69
+
64
70
  get context() {
65
71
  return {
66
72
  title: i18next.t('title.inventory_adjustment'),
@@ -101,6 +107,13 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
101
107
  }
102
108
  }
103
109
 
110
+ stateChanged(state) {
111
+ let palletLabelSetting = state.dashboard[PALLET_LABEL_SETTING_KEY]
112
+ let cartonLabelSetting = state.dashboard[CARTON_LABEL_SETTING_KEY]
113
+ this._palletLabel = (palletLabelSetting && palletLabelSetting.board) || {}
114
+ this._cartonLabel = (cartonLabelSetting && cartonLabelSetting.board) || {}
115
+ }
116
+
104
117
  render() {
105
118
  return html`
106
119
  <search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
@@ -116,11 +129,16 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
116
129
  }
117
130
 
118
131
  async pageInitialized() {
119
- let [partners, packingType, uom] = await Promise.all([
120
- this._fetchPartners(),
121
- getCodeByName('PACKING_TYPES'),
122
- getCodeByName('UOM')
123
- ])
132
+ //fetch all page setting in 1 action
133
+ let pageSettings = await fetchPageSettings({
134
+ codes: [{ name: 'name', operator: 'in', value: ['PACKING_TYPES', 'UOM'] }],
135
+ partners: []
136
+ })
137
+ let [partners, packingType, uom] = [
138
+ pageSettings.partners || [],
139
+ (packingType = pageSettings.codes?.find(x => (x.name = 'PACKING_TYPES')).settingDetails || []),
140
+ (uom = pageSettings.codes?.find(x => (x.name = 'UOM')).settingDetails || [])
141
+ ]
124
142
 
125
143
  this._searchFields = [
126
144
  {
@@ -147,7 +165,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
147
165
  },
148
166
  {
149
167
  label: i18next.t('field.product_info'),
150
- name: 'product_info',
168
+ name: 'productInfo',
151
169
  type: 'text',
152
170
  props: { searchOper: 'eq' }
153
171
  },
@@ -217,6 +235,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
217
235
  handlers: { click: this.setProductRefCondition.bind(this) },
218
236
  selectable: { multiple: true }
219
237
  },
238
+ pagination: { limit: 50, pages: [50, 100, 200, 500] },
220
239
  columns: [
221
240
  { type: 'gutter', gutterName: 'sequence' },
222
241
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
@@ -383,7 +402,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
383
402
  sortable: false,
384
403
  handlers: {
385
404
  click: (columns, data, column, record, rowIndex) => {
386
- if (record.qty > 0) this._openSerialNumberPopup(record, rowIndex, data.records)
405
+ if (record.qty > 0) this.openSerialNumberPopup(record, rowIndex, data.records)
387
406
  }
388
407
  },
389
408
  width: 80
@@ -397,7 +416,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
397
416
  },
398
417
  {
399
418
  type: 'number',
400
- name: 'remainingQty',
419
+ name: 'remainQty',
401
420
  header: i18next.t('field.remain_qty'),
402
421
  sortable: false,
403
422
  width: 80
@@ -523,78 +542,142 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
523
542
  }
524
543
  }
525
544
 
526
- async fetchHandler({ page, limit, sorters = [] }) {
545
+ // Combined export and grist fetch in single function
546
+ async fetchHandler({ page, limit, sorters = [] }, exportItem = false) {
527
547
  const filters = await this.searchForm.getQueryFilters()
528
- const response = await client.query({
529
- query: gql`
530
- query inventories($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
531
- inventories(filters: $filters, pagination: $pagination, sortings: $sortings) {
532
- items {
533
- id
534
- palletId
535
- cartonId
536
- batchId
537
- batchIdRef
538
- packingType
539
- packingSize
540
- uom
541
- uomValue
542
- manufactureDate
543
- serialNumbers
544
- bizplace {
545
- id
546
- name
547
- description
548
- }
549
- product {
550
- id
551
- name
552
- sku
553
- productInformation
554
- brand
555
- auxUnit1
556
- auxValue1
557
- description
558
- type
559
- isRequireSerialNumberScanningOutbound
560
- isRequireSerialNumberScanningInbound
561
- }
562
- qty
563
- remainQty
564
- warehouse {
565
- id
566
- name
567
- description
568
- }
569
- zone
570
- location {
571
- id
572
- name
573
- description
548
+
549
+ const query =
550
+ exportItem == false
551
+ ? gql`
552
+ query inventories(
553
+ $filters: [Filter!]
554
+ $pagination: Pagination
555
+ $sortings: [Sorting!]
556
+ $exportItem: Boolean
557
+ ) {
558
+ inventories(filters: $filters, pagination: $pagination, sortings: $sortings, exportItem: $exportItem) {
559
+ items {
560
+ id
561
+ palletId
562
+ cartonId
563
+ batchId
564
+ batchIdRef
565
+ packingType
566
+ packingSize
567
+ uom
568
+ uomValue
569
+ manufactureDate
570
+ serialNumbers
571
+ bizplace {
572
+ id
573
+ name
574
+ description
575
+ }
576
+ product {
577
+ id
578
+ name
579
+ sku
580
+ productInformation
581
+ brand
582
+ auxUnit1
583
+ auxValue1
584
+ description
585
+ type
586
+ isRequireSerialNumberScanningOutbound
587
+ isRequireSerialNumberScanningInbound
588
+ }
589
+ qty
590
+ lockedQty
591
+ warehouse {
592
+ id
593
+ name
594
+ description
595
+ }
596
+ zone
597
+ location {
598
+ id
599
+ name
600
+ description
601
+ }
602
+ createdAt
603
+ updatedAt
604
+ updater {
605
+ name
606
+ description
607
+ }
608
+ remark
609
+ expirationDate
610
+ unitCost
611
+ inventoryItemCount
612
+ purchaseOrderNo
613
+ }
614
+ total
574
615
  }
575
- createdAt
576
- updatedAt
577
- updater {
578
- name
579
- description
616
+ }
617
+ `
618
+ : gql`
619
+ query inventories(
620
+ $filters: [Filter!]!
621
+ $pagination: Pagination
622
+ $sortings: [Sorting!]!
623
+ $exportItem: Boolean
624
+ ) {
625
+ inventories(filters: $filters, pagination: $pagination, sortings: $sortings, exportItem: $exportItem) {
626
+ items {
627
+ id
628
+ palletId
629
+ cartonId
630
+ batchId
631
+ batchIdRef
632
+ packingType
633
+ packingSize
634
+ uom
635
+ uomValue
636
+ remark
637
+ expirationDate
638
+ manufactureDate
639
+ unitCost
640
+ serialNumbers
641
+ bizplace {
642
+ id
643
+ name
644
+ description
645
+ }
646
+ product {
647
+ id
648
+ sku
649
+ brand
650
+ name
651
+ description
652
+ productInformation
653
+ }
654
+ qty
655
+ lockedQty
656
+ warehouse {
657
+ id
658
+ name
659
+ description
660
+ }
661
+ zone
662
+ location {
663
+ id
664
+ name
665
+ description
666
+ }
667
+ updatedAt
668
+ }
669
+ total
580
670
  }
581
- remark
582
- expirationDate
583
- unitCost
584
- inventoryItemCount
585
- purchaseOrderNo
586
- orderProductRemark
587
- arrivalNoticeRefNo
588
- arrivalNoticeNo
589
671
  }
590
- total
591
- }
592
- }
593
- `,
672
+ `
673
+
674
+ const response = await client.query({
675
+ query,
594
676
  variables: {
595
677
  filters: [...filters, { name: 'status', operator: 'eq', value: 'STORED' }],
596
678
  pagination: { page, limit },
597
- sortings: sorters
679
+ sortings: sorters,
680
+ exportItem: exportItem
598
681
  }
599
682
  })
600
683
 
@@ -603,97 +686,18 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
603
686
  ...item,
604
687
  sku: item.product.sku,
605
688
  brand: item.product.brand,
606
- lockedQty: item.qty - item.remainQty,
607
- remainingQty: item.remainQty
689
+ lockedQty: item.lockedQty || 0,
690
+ remainQty: item.qty - (item.lockedQty || 0)
608
691
  }
609
692
  })
610
693
 
611
- return {
612
- total: response.data.inventories.total || 0,
613
- records: response.data.inventories.items || []
614
- }
615
- }
616
-
617
- async fetchInventoriesForExport() {
618
- const filters = await this.searchForm.getQueryFilters()
619
- const response = await client.query({
620
- query: gql`
621
- query inventoriesForExport($filters: [Filter!]!, $pagination: Pagination, $sortings: [Sorting!]!) {
622
- inventoriesForExport(filters: $filters, pagination: $pagination, sortings: $sortings) {
623
- items {
624
- id
625
- palletId
626
- cartonId
627
- batchId
628
- batchIdRef
629
- packingType
630
- packingSize
631
- uom
632
- uomValue
633
- remark
634
- expirationDate
635
- manufactureDate
636
- unitCost
637
- serialNumbers
638
- bizplace {
639
- id
640
- name
641
- description
642
- }
643
- product {
644
- id
645
- sku
646
- brand
647
- name
648
- description
649
- productInformation
650
- }
651
- qty
652
- warehouse {
653
- id
654
- name
655
- description
656
- }
657
- zone
658
- location {
659
- id
660
- name
661
- description
662
- }
663
- updatedAt
664
- }
665
- total
666
- }
667
- }
668
- `,
669
- variables: {
670
- filters: [...filters, { name: 'status', operator: 'eq', value: 'STORED' }],
671
- pagination: { page: 1, limit: 9999999 },
672
- sortings: []
694
+ if (exportItem == false) {
695
+ return {
696
+ total: response.data.inventories.total || 0,
697
+ records: response.data.inventories.items || []
673
698
  }
674
- })
675
-
676
- return response.data.inventoriesForExport.items || []
677
- }
678
-
679
- async _fetchPartners(filters = []) {
680
- const response = await client.query({
681
- query: gql`
682
- query partnersBizplaces($filters: [Filter!]) {
683
- partnersBizplaces(filters: $filters) {
684
- items {
685
- id
686
- name
687
- description
688
- }
689
- }
690
- }
691
- `,
692
- variables: { filters }
693
- })
694
-
695
- if (!response.errors) {
696
- return response.data.partnersBizplaces.items
699
+ } else {
700
+ return response.data.inventories.items || []
697
701
  }
698
702
  }
699
703
 
@@ -736,7 +740,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
736
740
  item._data.records[e.detail.row].lockedQty > 0 &&
737
741
  (e.detail.column.name == 'batchId' || e.detail.column.name == 'product' || e.detail.column.name == 'bizplace')
738
742
  ) {
739
- this._showToast({ level: 'error', message: i18next.t('text.there_is_release_qty_no_amendment_is_allowed') })
743
+ this.showToast({ level: 'error', message: i18next.t('text.there_is_release_qty_no_amendment_is_allowed') })
740
744
  item._data.records[e.detail.row][e.detail.column.name] = e.detail.before
741
745
  return
742
746
  }
@@ -744,45 +748,54 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
744
748
  switch (e.detail.column.name) {
745
749
  case 'uomValue':
746
750
  if (e.detail.after < 0 || e.detail.after.toString() == NaN.toString()) {
747
- item._data.records[e.detail.row].uomValue = 0
748
- this._showToast({ level: 'error', message: i18next.t('text.invalid_uom_value') })
751
+ item._data.records[e.detail.row].uomValue = e.detail.before
752
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_uom_value') })
749
753
  }
750
754
  break
751
755
  case 'qty':
752
756
  if (e.detail.after < 0 || !Number.isInteger(e.detail.after)) {
753
- this._showToast({ level: 'error', message: i18next.t('text.invalid_qty') })
757
+ item._data.records[e.detail.row].qty = e.detail.before
758
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_qty') })
759
+ }
760
+ break
761
+ case 'packingType':
762
+ if (e.detail.after.trim() == '') {
763
+ item._data.records[e.detail.row].packingType = e.detail.before
764
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_packing_type') })
765
+ }
766
+ break
767
+ case 'packingSize':
768
+ if (e.detail.after < 0 || !Number.isInteger(e.detail.after)) {
769
+ item._data.records[e.detail.row].packingSize = e.detail.before
770
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_packing_size') })
754
771
  }
755
772
  break
756
773
  case 'unitCost':
757
- if (e.detail.after < 0) item._data.records[e.detail.row].unitCost = e.detail.before
774
+ if (e.detail.after < 0) {
775
+ item._data.records[e.detail.row].unitCost = e.detail.before
776
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_unit_cost') })
777
+ }
758
778
  break
759
779
  case 'manufactureDate':
760
- if (new Date(e.detail.after) > new Date()) item._data.records[e.detail.row].manufactureDate = e.detail.before
780
+ if (new Date(e.detail.after) > new Date()) {
781
+ item._data.records[e.detail.row].manufactureDate = e.detail.before
782
+ this.showToast({ message: i18next.t('text.invalid_manufacture_date') })
783
+ }
761
784
  break
762
785
  case 'product':
763
786
  item._data.records[e.detail.row].uom = e.detail.after?.uom ? e.detail.after.uom : ''
764
-
765
787
  item._data.records[e.detail.row].packingType = e.detail.after?.packingType ? e.detail.after.packingType : ''
766
-
767
788
  item._data.records[e.detail.row].packingSize = e.detail.after?.packingSize ? e.detail.after.packingSize : 1
768
-
769
789
  item._data.records[e.detail.row].brand = e.detail.after?.brand ? e.detail.after.brand : ''
770
-
771
790
  item._data.records[e.detail.row].sku = e.detail.after?.sku ? e.detail.after.sku : ''
772
791
  break
773
792
  case 'bizplace':
774
793
  item._data.records[e.detail.row].uom = ''
775
-
776
794
  item._data.records[e.detail.row].packingType = ''
777
-
778
795
  item._data.records[e.detail.row].packingSize = 1
779
-
780
796
  item._data.records[e.detail.row].brand = ''
781
-
782
797
  item._data.records[e.detail.row].sku = ''
783
-
784
798
  item._data.records[e.detail.row].qty = e.detail.record.qty
785
-
786
799
  item._data.records[e.detail.row].uomValue = e.detail.record.uomValue
787
800
  break
788
801
  default:
@@ -803,24 +816,30 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
803
816
  async missingStock() {
804
817
  const selectOrderInventory = this.dataGrist.selected
805
818
 
806
- const patchesArr = [...selectOrderInventory]
807
-
808
- const patches = patchesArr.map(p => {
809
- return {
810
- palletId: p.palletId,
811
- transactionType: 'MISSING'
819
+ try {
820
+ if (selectOrderInventory.length <= 0) {
821
+ this.showToast({
822
+ type: 'error',
823
+ message: `${i18next.t('text.no_record_selected')}`
824
+ })
825
+ throw new Error(`${i18next.t('text.no_record_selected')}`)
812
826
  }
813
- })
814
827
 
815
- const result = await CustomAlert({
816
- title: i18next.t('title.are_you_sure'),
817
- text: i18next.t('text.do_you_want_to_mark_it_as_missing'),
818
- confirmButton: { text: i18next.t('button.confirm') },
819
- cancelButton: { text: i18next.t('button.cancel') }
820
- })
828
+ const patches = selectOrderInventory.map(p => {
829
+ return {
830
+ palletId: p.palletId,
831
+ transactionType: 'MISSING'
832
+ }
833
+ })
834
+
835
+ const result = await CustomAlert({
836
+ title: i18next.t('title.are_you_sure'),
837
+ text: i18next.t('text.do_you_want_to_mark_it_as_missing'),
838
+ confirmButton: { text: i18next.t('button.confirm') },
839
+ cancelButton: { text: i18next.t('button.cancel') }
840
+ })
821
841
 
822
- if (result.isConfirmed) {
823
- try {
842
+ if (result.isConfirmed) {
824
843
  const response = await client.mutate({
825
844
  mutation: gql`
826
845
  mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
@@ -831,12 +850,12 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
831
850
  })
832
851
 
833
852
  if (!response.error) {
834
- this._showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
853
+ this.showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
835
854
  this.updateContext()
836
855
  }
837
- } catch (error) {
838
- throw new Error(error)
839
856
  }
857
+ } catch (error) {
858
+ throw new Error(error)
840
859
  }
841
860
  }
842
861
 
@@ -846,33 +865,43 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
846
865
  patches = patches.map(row => {
847
866
  delete row.productUomValue
848
867
  delete row.inventoryItemCount
868
+
849
869
  if (row.cuFlag == '+') {
850
- if (!row.bizplace || !row.location || !row.product || !row.batchId || !row.qty || !row.uomValue) {
870
+ if (
871
+ !row.bizplace ||
872
+ !row.location ||
873
+ !row.product ||
874
+ !row.batchId ||
875
+ !row.qty ||
876
+ !row.uomValue ||
877
+ !row.uom ||
878
+ row?.uom.trim() == ''
879
+ ) {
851
880
  throw new Error(i18next.t('text.empty_value_in_list'))
852
881
  }
853
882
  }
854
883
 
855
- if (row.cuFlag == 'M' && row.bizplace) {
856
- if (!row.product) {
884
+ if (row.cuFlag == 'M') {
885
+ if (
886
+ (row.hasOwnProperty('bizplace') && !row.product) ||
887
+ (row.hasOwnProperty('uom') && row.uom?.trim() == '') ||
888
+ (row.hasOwnProperty('packingType') && row.packingType?.trim() == '') ||
889
+ (row.hasOwnProperty('unitCost') && (row.unitCost == null || row.unitCost < 0)) ||
890
+ (row.hasOwnProperty('packingSize') && (row.packingSize == null || row.packingSize < 0))
891
+ ) {
857
892
  throw new Error(i18next.t('text.empty_value_in_list'))
858
893
  }
859
894
  }
860
895
 
861
- if (row.bizplace) {
862
- row.bizplace = { id: row.bizplace.id }
863
- }
864
- if (row.location) {
865
- row.location = { id: row.location.id }
866
- }
867
- if (row.product) {
868
- row.product = { id: row.product.productId }
869
- }
870
- if (row.uomValue) {
871
- row.uomValue = parseFloat(row.uomValue)
872
- }
896
+ row.bizplace = row.bizplace ? { id: row.bizplace.id } : undefined
897
+ row.location = row.location ? { id: row.location.id } : undefined
898
+ row.product = row.product ? { id: row.product.productId } : undefined
899
+ row.uomValue = row.uomValue ? parseFloat(row.uomValue) : undefined
900
+ row.unitCost = row.unitCost ? parseFloat(row.unitCost) : undefined
901
+ row.packingSize = row.packingSize ? parseInt(row.packingSize) : undefined
902
+
873
903
  if (row?.inventoryItemChanges) {
874
904
  row.inventoryItemChangesJson = row.inventoryItemChanges
875
-
876
905
  delete row.inventoryItemChanges
877
906
  }
878
907
  return row
@@ -900,24 +929,20 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
900
929
 
901
930
  if (!response.errors) {
902
931
  this.dataGrist.fetch()
903
- this._showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
932
+ this.showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
904
933
  }
905
934
  } else {
906
- this._showToast({
935
+ this.showToast({
907
936
  type: 'error',
908
937
  message: `${i18next.t('text.complete_the_picking_process_before_adjust_the_batch_number')}`
909
938
  })
910
939
  }
911
940
  }
912
941
  } catch (e) {
913
- this._showToast(e)
942
+ this.showToast(e)
914
943
  }
915
944
  }
916
945
 
917
- get columns() {
918
- return this.config.columns
919
- }
920
-
921
946
  async importHandler(patches) {
922
947
  try {
923
948
  patches.map(itm => {
@@ -939,7 +964,10 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
939
964
  throw new Error(i18next.t('text.invalid_value_in_list'))
940
965
  }
941
966
 
942
- if (itm.manufactureYear && itm.manufactureYear < 1000) {
967
+ if (
968
+ itm.manufactureDate &&
969
+ (itm.manufactureDate.getFullYear < 1000 || itm.manufactureDate.getTime > new Date().getTime)
970
+ ) {
943
971
  throw new Error(i18next.t('text.invalid_value_in_list'))
944
972
  }
945
973
  }
@@ -995,10 +1023,10 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
995
1023
  if (!response.errors) {
996
1024
  history.back()
997
1025
  this.dataGrist.fetch()
998
- this._showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
1026
+ this.showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
999
1027
  }
1000
1028
  } catch (e) {
1001
- this._showToast(e)
1029
+ this.showToast(e)
1002
1030
  }
1003
1031
  }
1004
1032
 
@@ -1056,7 +1084,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1056
1084
  if (this.dataGrist.selected && this.dataGrist.selected.length > 0) {
1057
1085
  data = this.dataGrist.selected
1058
1086
  } else {
1059
- data = await this.fetchInventoriesForExport()
1087
+ data = await this.fetchHandler({}, true)
1060
1088
  }
1061
1089
 
1062
1090
  let [products, bizplaces, locations] = await Promise.all([
@@ -1108,17 +1136,10 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1108
1136
 
1109
1137
  return { header: headerSetting, data: data }
1110
1138
  } catch (e) {
1111
- this._showToast(e)
1139
+ this.showToast(e)
1112
1140
  }
1113
1141
  }
1114
1142
 
1115
- stateChanged(state) {
1116
- let palletLabelSetting = state.dashboard[PALLET_LABEL_SETTING_KEY]
1117
- let cartonLabelSetting = state.dashboard[CARTON_LABEL_SETTING_KEY]
1118
- this._palletLabel = (palletLabelSetting && palletLabelSetting.board) || {}
1119
- this._cartonLabel = (cartonLabelSetting && cartonLabelSetting.board) || {}
1120
- }
1121
-
1122
1143
  async fetchBizplaces(bizplace = []) {
1123
1144
  const response = await client.query({
1124
1145
  query: gql`
@@ -1153,8 +1174,8 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1153
1174
  `,
1154
1175
  variables: { filters: [...bizplace] }
1155
1176
  })
1156
- return response.data.pureProductsByBizplace.items.map(product => {
1157
- return { id: product.id, name: product.productInformation }
1177
+ return response.data.pureProductsByBizplace.items.map(itm => {
1178
+ return { id: itm.id, name: itm.productInformation }
1158
1179
  })
1159
1180
  } catch (ex) {
1160
1181
  throw ex
@@ -1192,7 +1213,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1192
1213
  variables: { id, remark }
1193
1214
  })
1194
1215
  if (!response.errors) {
1195
- this._showToast({ message: i18next.t('text.remark_updated') })
1216
+ this.showToast({ message: i18next.t('text.remark_updated') })
1196
1217
  }
1197
1218
  }
1198
1219
 
@@ -1230,7 +1251,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1230
1251
  )
1231
1252
  }
1232
1253
 
1233
- _openSerialNumberPopup(inventory, rowIndex, records) {
1254
+ openSerialNumberPopup(inventory, rowIndex, records) {
1234
1255
  const removable =
1235
1256
  inventory?.product?.isRequireSerialNumberScanningOutbound &&
1236
1257
  inventory?.product?.isRequireSerialNumberScanningInbound
@@ -1304,7 +1325,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1304
1325
  var labelId = this._palletLabel && this._palletLabel.id
1305
1326
 
1306
1327
  if (!labelId) {
1307
- this._showToast({
1328
+ this.showToast({
1308
1329
  type: 'error',
1309
1330
  message: `${i18next.t('text.no_label_setting_was_found')}. ${i18next.t('text.please_check_your_setting')}`
1310
1331
  })
@@ -1350,7 +1371,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1350
1371
 
1351
1372
  await this.printer.print(command)
1352
1373
  } catch (e) {
1353
- this._showToast(e)
1374
+ this.showToast(e)
1354
1375
 
1355
1376
  delete this.printer
1356
1377
  break
@@ -1364,7 +1385,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1364
1385
  const labelId = this._cartonLabel && this._cartonLabel.id
1365
1386
 
1366
1387
  if (!labelId) {
1367
- this._showToast({
1388
+ this.showToast({
1368
1389
  type: 'error',
1369
1390
  message: `${i18next.t('text.no_label_setting_was_found')}. ${i18next.t('text.please_check_your_setting')}`
1370
1391
  })
@@ -1394,7 +1415,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1394
1415
 
1395
1416
  await this.printer.print(command)
1396
1417
  } catch (e) {
1397
- this._showToast(e)
1418
+ this.showToast(e)
1398
1419
 
1399
1420
  delete this.printer
1400
1421
  break
@@ -1433,7 +1454,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1433
1454
  }
1434
1455
  }
1435
1456
 
1436
- _showToast({ level, type, message }) {
1457
+ showToast({ level, type, message }) {
1437
1458
  document.dispatchEvent(
1438
1459
  new CustomEvent('notify', {
1439
1460
  detail: {