@things-factory/operato-wms 4.3.120 → 4.3.123

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 (28) hide show
  1. package/client/pages/inventory/inventory-by-product.js +12 -0
  2. package/client/pages/outbound/packing-product.js +1 -1
  3. package/client/pages/outbound/show-ro-list-popup.js +35 -5
  4. package/client/pages/outbound/sorting-product.js +198 -44
  5. package/client/pages/report/tote-loading-qc-report.js +372 -0
  6. package/client/route.js +4 -0
  7. package/config.development.js +28 -35
  8. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  9. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  10. package/dist-server/graphql/resolvers/reports/tote-loading-qc-report.js +82 -0
  11. package/dist-server/graphql/resolvers/reports/tote-loading-qc-report.js.map +1 -0
  12. package/dist-server/graphql/types/reports/index.js +6 -1
  13. package/dist-server/graphql/types/reports/index.js.map +1 -1
  14. package/dist-server/graphql/types/reports/loading-qc-report-list.js +14 -0
  15. package/dist-server/graphql/types/reports/loading-qc-report-list.js.map +1 -0
  16. package/dist-server/graphql/types/reports/loading-qc-report.js +22 -0
  17. package/dist-server/graphql/types/reports/loading-qc-report.js.map +1 -0
  18. package/package.json +50 -50
  19. package/server/graphql/resolvers/reports/index.ts +3 -1
  20. package/server/graphql/resolvers/reports/tote-loading-qc-report.ts +100 -0
  21. package/server/graphql/types/reports/index.ts +6 -1
  22. package/server/graphql/types/reports/loading-qc-report-list.ts +8 -0
  23. package/server/graphql/types/reports/loading-qc-report.ts +16 -0
  24. package/things-factory.config.js +4 -0
  25. package/translations/en.json +11 -2
  26. package/translations/ko.json +10 -1
  27. package/translations/ms.json +10 -1
  28. package/translations/zh.json +10 -1
@@ -291,6 +291,15 @@ class InventoryByProduct extends localize(i18next)(PageView) {
291
291
  sortable: true,
292
292
  width: 80
293
293
  },
294
+ {
295
+ type: 'integer',
296
+ name: 'draftQty',
297
+ imex: { header: i18next.t('field.draft_qty'), key: 'draftQty', width: 20, type: 'integer' },
298
+ header: i18next.t('field.draft_qty'),
299
+ label: true,
300
+ sortable: true,
301
+ width: 80
302
+ },
294
303
  {
295
304
  type: 'integer',
296
305
  name: 'warehouseQty',
@@ -328,6 +337,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
328
337
  releaseQty
329
338
  quarantineQty
330
339
  reserveQty
340
+ draftQty
331
341
  warehouseQty
332
342
  }
333
343
  total
@@ -350,6 +360,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
350
360
  record.quarantineQty = item.quarantineQty
351
361
  record.reserveQty = item.reserveQty
352
362
  record.warehouseQty = item.warehouseQty
363
+ record.draftQty = item.draftQty
353
364
  record.bizplace = item.bizplace
354
365
 
355
366
  return record
@@ -486,6 +497,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
486
497
  releaseQty: item.releaseQty,
487
498
  quarantineQty: item.quarantineQty,
488
499
  reserveQty: item.reserveQty,
500
+ draftQty: item.draftQty,
489
501
  warehouseQty: item.warehouseQty
490
502
  // averageUnitCost: item.averageUnitCost
491
503
  }
@@ -133,7 +133,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
133
133
  ) {
134
134
  actions.push({
135
135
  title: i18next.t('button.ready_to_ship'),
136
- action: this._setOrderToRTS.bind(this),
136
+ action: this.setOrderToRTS.bind(this),
137
137
  ...CommonButtonStyles.logistics
138
138
  })
139
139
  }
@@ -1,9 +1,11 @@
1
1
  import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
+
4
+ import { css, html, LitElement } from 'lit-element'
5
+
3
6
  import { i18next, localize } from '@things-factory/i18n-base'
4
7
  import { ScrollbarStyles } from '@things-factory/styles'
5
8
  import { isMobileDevice } from '@things-factory/utils'
6
- import { css, html, LitElement } from 'lit-element'
7
9
 
8
10
  class ShowRoListPopup extends localize(i18next)(LitElement) {
9
11
  static get properties() {
@@ -61,6 +63,7 @@ class ShowRoListPopup extends localize(i18next)(LitElement) {
61
63
  height: var(--button-container-button-height);
62
64
  border: var(--button-container-button-border);
63
65
  margin: var(--button-container-button-margin);
66
+
64
67
  padding: var(--button-padding);
65
68
  color: var(--theme-white-color);
66
69
  font: var(--button-font);
@@ -89,6 +92,7 @@ class ShowRoListPopup extends localize(i18next)(LitElement) {
89
92
  ></data-grist>
90
93
  </div>
91
94
  </div>
95
+
92
96
  <div class="button-container">
93
97
  <mwc-button raised @click=${this._selectReleaseOrder.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
94
98
  </div>
@@ -117,11 +121,29 @@ class ShowRoListPopup extends localize(i18next)(LitElement) {
117
121
  header: i18next.t('field.name'),
118
122
  width: 180
119
123
  },
124
+ {
125
+ type: 'string',
126
+ name: 'refNo',
127
+ header: i18next.t('field.ref_no'),
128
+ width: 120
129
+ },
130
+ {
131
+ type: 'string',
132
+ name: 'refNo2',
133
+ header: i18next.t('field.ref_no_2'),
134
+ width: 120
135
+ },
120
136
  {
121
137
  type: 'string',
122
138
  name: 'status',
123
139
  header: i18next.t('field.status'),
124
140
  width: 120
141
+ },
142
+ {
143
+ type: 'string',
144
+ name: 'sortedByUser',
145
+ header: i18next.t('field.sorted_by'),
146
+ width: 120
125
147
  }
126
148
  ]
127
149
  }
@@ -129,13 +151,21 @@ class ShowRoListPopup extends localize(i18next)(LitElement) {
129
151
 
130
152
  _selectReleaseOrder() {
131
153
  const selectedRO = this.grist.selected[0]
132
- if (selectedRO) {
154
+ if (selectedRO && selectedRO.status !== 'LOADING') {
133
155
  this.dispatchEvent(new CustomEvent('ro-selected', { detail: { ro: selectedRO } }))
134
156
  history.back()
135
157
  } else {
136
- document.dispatchEvent(
137
- new CustomEvent('notify', { detail: { message: i18next.t('text.order_is_not_selected') } })
138
- )
158
+ if (selectedRO && selectedRO.status == 'LOADING') {
159
+ document.dispatchEvent(
160
+ new CustomEvent('notify', { detail: { message: i18next.t('text.sorting_is_completed') } })
161
+ )
162
+ } else {
163
+ document.dispatchEvent(
164
+ new CustomEvent('notify', {
165
+ detail: { message: i18next.t('text.current_release_order_sorting_completed') }
166
+ })
167
+ )
168
+ }
139
169
  }
140
170
  }
141
171
  }
@@ -28,7 +28,9 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
28
28
  _worksheetInfo: Object,
29
29
  _selectedReleaseGood: Object,
30
30
  _enableToteScanning: Boolean,
31
+ _enableSortingQty: Boolean,
31
32
  bizplaceName: String,
33
+ customerCompanyDomainId: String,
32
34
  config: Object,
33
35
  data: Object,
34
36
  releaseOrders: Array,
@@ -192,14 +194,13 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
192
194
  <label>${i18next.t('label.scan_product_barcode')}</label>
193
195
  <barcode-scanable-input name="productBarcode" custom-input></barcode-scanable-input>
194
196
  `
195
- : html`
196
- ${this._isRequireSerialNumberScanningOutbound
197
- ? ''
198
- : html`
199
- <label>${i18next.t('label.enter_picked_qty')}</label>
200
- <input type="number" min="1" name="sortingQty" />
201
- `}
202
- `}
197
+ : ''}
198
+ ${(this._enableSortingQty && !this._isRequireSerialNumberScanningOutbound) || !this._enableProductScanning
199
+ ? html`
200
+ <label>${i18next.t('label.enter_picked_qty')}</label>
201
+ <input type="number" min="1" name="sortingQty" />
202
+ `
203
+ : ''}
203
204
  ${this._isRequireSerialNumberScanningOutbound
204
205
  ? html`
205
206
  <label>${i18next.t('label.serial_number')}</label>
@@ -234,6 +235,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
234
235
  this._enableProductScanning = false
235
236
  this._selectedOrderInventory = null
236
237
  this._selectedTaskStatus = null
238
+ this._enableSortingQty = false
237
239
  }
238
240
 
239
241
  updated(changedProps) {
@@ -359,7 +361,10 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
359
361
  releaseGoods {
360
362
  id
361
363
  name
364
+ refNo
365
+ refNo2
362
366
  status
367
+ sortedByUser
363
368
  }
364
369
  taskNo
365
370
  }
@@ -371,7 +376,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
371
376
  if (!response.errors) {
372
377
  this.releaseOrders = response.data.findSortingReleaseOrdersByTaskNo.releaseGoods
373
378
  this.taskNo = response.data.findSortingReleaseOrdersByTaskNo.taskNo
374
- if (this.releaseOrders?.length) {
379
+ if (this.releaseOrders?.find(itm => itm.status == 'SORTING')) {
375
380
  await this._openSelectReleaseOrderPopup()
376
381
  } else {
377
382
  await this._completeSortingWorksheet()
@@ -391,6 +396,9 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
391
396
  @ro-selected=${e => {
392
397
  this._selectedReleaseGood = e.detail.ro
393
398
  this._fetchItemList(this._selectedReleaseGood?.name)
399
+ if (this._enableProductScanning) this.productBarcodeInput.value = ''
400
+ if (this.sortingQtyInput) this.sortingQtyInput.value = ''
401
+ if (this.serialInput) this.serialInput.value = ''
394
402
  this.toteNo = ''
395
403
  }}
396
404
  ></show-ro-list-popup>
@@ -447,6 +455,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
447
455
  worksheetInfo {
448
456
  bizplaceName
449
457
  partnerDomainId
458
+ customerCompanyDomainId
450
459
  refNo
451
460
  refNo2
452
461
  refNo3
@@ -485,6 +494,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
485
494
  const { worksheetInfo, worksheetDetailInfos } = response.data.sortingWorksheet
486
495
  this._worksheetInfo = worksheetInfo
487
496
  this.bizplaceName = worksheetInfo.bizplaceName
497
+ this.customerCompanyDomainId = worksheetInfo.customerCompanyDomainId
488
498
 
489
499
  this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
490
500
  if (!this._selectedOrderInventory) {
@@ -493,14 +503,26 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
493
503
  }
494
504
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
495
505
  this._enableToteScanning = await fetchSettingRule('enable-tote-scanning', worksheetInfo.partnerDomainId)
506
+ if (this._enableProductScanning)
507
+ this._enableSortingQty = await fetchSettingRule('enable-sorting-qty', worksheetInfo.partnerDomainId)
496
508
 
497
509
  this.updateContext()
498
510
  this._completeHandler()
499
511
 
500
- if (this._isRequireSerialNumberScanningOutbound) {
512
+ if (this._isRequireSerialNumberScanningOutbound && !this._enableProductScanning) {
501
513
  this._focusOnSerialInput()
502
- } else if (this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound) {
503
- this._focusOnProductBarcodeInput()
514
+ } else if (this._enableProductScanning) {
515
+ if (this.productBarcodeInput.value) {
516
+ if (this._isRequireSerialNumberScanningOutbound) {
517
+ this._focusOnSerialInput()
518
+ } else if (this._enableSortingQty) {
519
+ this._focusOnSortingQtyInput()
520
+ } else {
521
+ this._focusOnProductBarcodeInput()
522
+ }
523
+ } else {
524
+ this._focusOnProductBarcodeInput()
525
+ }
504
526
  } else {
505
527
  this._focusOnSortingQtyInput()
506
528
  }
@@ -511,7 +533,9 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
511
533
  if (e.keyCode !== 13) return
512
534
  e.preventDefault()
513
535
  try {
514
- this._validateSorting()
536
+ let answer = await this._validateSorting()
537
+
538
+ if (!answer) return
515
539
 
516
540
  let response
517
541
  if (this._enableProductScanning) {
@@ -525,7 +549,11 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
525
549
  }
526
550
 
527
551
  if (this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound) {
528
- this.productBarcodeInput.value = ''
552
+ if (this._enableSortingQty) {
553
+ this.sortingQtyInput.value = ''
554
+ } else {
555
+ this.productBarcodeInput.value = ''
556
+ }
529
557
  } else if (!this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound) {
530
558
  this.sortingQtyInput.value = ''
531
559
  }
@@ -574,27 +602,33 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
574
602
  return await client.mutate({
575
603
  mutation: gql`
576
604
  mutation scanProductSorting(
577
- $taskNo: String!
578
605
  $releaseGoodNo: String!
606
+ $taskNo: String!
579
607
  $productBarcode: String!
580
608
  $serialNumber: String
581
609
  $toteNo: String
610
+ $sortingQty: Int
582
611
  ) {
583
612
  scanProductSorting(
584
- taskNo: $taskNo
585
613
  releaseGoodNo: $releaseGoodNo
614
+ taskNo: $taskNo
586
615
  productBarcode: $productBarcode
587
616
  serialNumber: $serialNumber
588
617
  toteNo: $toteNo
618
+ sortingQty: $sortingQty
589
619
  )
590
620
  }
591
621
  `,
592
622
  variables: {
593
- taskNo: this.taskNo,
594
623
  releaseGoodNo: this._selectedReleaseGood?.name,
624
+ taskNo: this.taskNo,
595
625
  productBarcode: this.productBarcodeInput.value.trim(),
596
626
  serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value.trim() : null,
597
- toteNo: this._enableToteScanning && this.toteNo !== '' ? this.toteNo : null
627
+ toteNo: this._enableToteScanning && this.toteNo !== '' ? this.toteNo : null,
628
+ sortingQty:
629
+ this._enableSortingQty && !this._isRequireSerialNumberScanningOutbound
630
+ ? parseInt(this.sortingQtyInput.value)
631
+ : null
598
632
  }
599
633
  })
600
634
  }
@@ -664,44 +698,164 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
664
698
  }
665
699
  }
666
700
 
667
- _validateSorting() {
668
- if (this._enableProductScanning) {
669
- if (!this.productBarcodeInput.value) {
670
- this._focusOnProductBarcodeInput()
671
- throw new Error(i18next.t('text.product_barcode_is_empty'))
672
- }
701
+ async _validateSorting() {
702
+ try {
703
+ if (this._enableProductScanning) {
704
+ if (!this.productBarcodeInput.value) {
705
+ this._focusOnProductBarcodeInput()
706
+ throw new Error(i18next.t('text.product_barcode_is_empty'))
707
+ }
673
708
 
674
- if (this._isRequireSerialNumberScanningOutbound) {
675
- if (!this.serialInput?.value) {
676
- this._focusOnSerialInput()
677
- throw new Error(i18next.t('text.empty_serial_number'))
709
+ let answer = await this._checkedScannedProduct()
710
+ if (!answer) return false
711
+
712
+ if (this._isRequireSerialNumberScanningOutbound) {
713
+ if (!this.serialInput?.value) {
714
+ this._focusOnSerialInput()
715
+ throw new Error(i18next.t('text.empty_serial_number'))
716
+ }
678
717
  }
679
- }
680
- } else {
681
- // validate for order selection
682
- if (!this._selectedOrderInventory) throw new Error(i18next.t('text.target_is_not_selected'))
683
718
 
684
- if (this._isRequireSerialNumberScanningOutbound) {
685
- if (!this.serialInput?.value) {
686
- this._focusOnSerialInput()
687
- throw new Error(i18next.t('text.empty_serial_number'))
719
+ if (this._enableSortingQty && !this._isRequireSerialNumberScanningOutbound) {
720
+ if (!parseInt(this.sortingQtyInput.value)) {
721
+ this.sortingQtyInput.value = ''
722
+ this._focusOnSortingQtyInput()
723
+ throw new Error(i18next.t('text.release_qty_is_empty'))
724
+ }
725
+
726
+ if (!(parseInt(this.sortingQtyInput.value) > 0)) {
727
+ this.sortingQtyInput.value = ''
728
+ this._focusOnSortingQtyInput()
729
+ throw new Error(i18next.t('text.qty_should_be_positive'))
730
+ }
731
+
732
+ if (this.sortingQtyInput.value % 1 != 0) {
733
+ this.sortingQtyInput.value = ''
734
+ this._focusOnSortingQtyInput()
735
+ throw new Error(i18next.t('text.qty_should_not_have_decimal'))
736
+ }
688
737
  }
689
738
  } else {
690
- if (!this.sortingQtyInput.checkValidity()) throw new Error(i18next.t('text.release_qty_invalid'))
739
+ // validate for order selection
740
+ if (!this._selectedOrderInventory) throw new Error(i18next.t('text.target_is_not_selected'))
741
+
742
+ if (this._isRequireSerialNumberScanningOutbound) {
743
+ if (!this.serialInput?.value) {
744
+ this._focusOnSerialInput()
745
+ throw new Error(i18next.t('text.empty_serial_number'))
746
+ }
747
+ } else {
748
+ if (!this.sortingQtyInput.checkValidity()) throw new Error(i18next.t('text.release_qty_invalid'))
749
+
750
+ if (!parseInt(this.sortingQtyInput.value)) {
751
+ this._focusOnSortingQtyInput()
752
+ throw new Error(i18next.t('text.release_qty_is_empty'))
753
+ }
691
754
 
692
- if (!parseInt(this.sortingQtyInput.value)) {
693
- this._focusOnSortingQtyInput()
694
- throw new Error(i18next.t('text.release_qty_is_empty'))
755
+ if (parseInt(this.sortingQtyInput.value) != this._selectedOrderInventory.releaseQty) {
756
+ this._focusOnSortingQtyInput()
757
+ throw new Error(i18next.t('text.wrong_sorting_qty'))
758
+ }
695
759
  }
760
+ }
761
+
762
+ return true
763
+ } catch (e) {
764
+ this._showToast(e)
765
+ return false
766
+ }
767
+ }
768
+
769
+ async _checkedScannedProduct() {
770
+ //fetch any product details with entered gtin
771
+ const response = await this.fetchProductDetails(this.productBarcodeInput?.value || '', '')
772
+
773
+ if (!response.errors) {
774
+ let worksheetDetails = this.data.records
775
+ let checkedProductDetails = response.data.checkGtin.items
776
+
777
+ //check from grist if any is matched
778
+ const foundProducts = worksheetDetails.filter(wd => {
779
+ return checkedProductDetails.some(
780
+ itm =>
781
+ itm.product.id == wd.product.id && itm.packingType == wd.packingType && itm.packingSize == wd.packingSize
782
+ )
783
+ })
696
784
 
697
- if (parseInt(this.sortingQtyInput.value) != this._selectedOrderInventory.releaseQty) {
698
- this._focusOnSortingQtyInput()
699
- throw new Error(i18next.t('text.wrong_sorting_qty'))
785
+ const foundParentProducts = worksheetDetails.filter(wd => {
786
+ return checkedProductDetails.some(itm => itm.product.id == wd.product.id)
787
+ })
788
+
789
+ if (!foundProducts?.length) {
790
+ if (!foundParentProducts?.length) {
791
+ if (this._enableSortingQty && !this._isRequireSerialNumberScanningInbound) {
792
+ if (this.sortingQtyInput?.value) this.sortingQtyInput.value = ''
793
+ }
794
+
795
+ if (this._isRequireSerialNumberScanningInbound) {
796
+ if (this.serialNumberInput?.value) this.serialNumberInput.value = ''
797
+ }
798
+
799
+ this.productBarcodeInput.value = ''
800
+ this._focusOnProductBarcodeInput()
801
+ throw new Error(i18next.t('text.no_matching_product_found'))
700
802
  }
701
803
  }
804
+
805
+ const product =
806
+ foundProducts?.length == 1
807
+ ? foundProducts[0].product
808
+ : foundProducts?.length == 0 && foundParentProducts?.length > 0
809
+ ? foundParentProducts[0].product
810
+ : null
811
+
812
+ if (foundProducts?.length == 1) {
813
+ this._isRequireSerialNumberScanningOutbound = foundProducts[0].isRequireSerialNumberScanningOutbound
814
+ this._selectedOrderInventory = foundProducts[0]
815
+ } else if (foundProducts?.length == 0 && foundParentProducts?.length > 0) {
816
+ this._isRequireSerialNumberScanningOutbound = foundParentProducts[0].isRequireSerialNumberScanningOutbound
817
+ this._selectedOrderInventory = foundParentProducts[0]
818
+ }
819
+
820
+ return true
821
+ } else {
822
+ this.productBarcodeInput.value = ''
823
+ this._focusOnProductBarcodeInput()
824
+ return false
702
825
  }
703
826
  }
704
827
 
828
+ async fetchProductDetails(gtin) {
829
+ return await client.query({
830
+ query: gql`
831
+ query checkGtin($gtin: String!, $customerCompanyDomainId: String!) {
832
+ checkGtin(gtin: $gtin, customerCompanyDomainId: $customerCompanyDomainId) {
833
+ items {
834
+ id
835
+ name
836
+ packingType
837
+ packingSize
838
+ gtin
839
+ product {
840
+ id
841
+ name
842
+ sku
843
+ isRequiredCheckExpiry
844
+ isRequireSerialNumberScanningInbound
845
+ expirationPeriod
846
+ }
847
+ }
848
+ total
849
+ }
850
+ }
851
+ `,
852
+ variables: {
853
+ gtin,
854
+ customerCompanyDomainId: this.customerCompanyDomainId
855
+ }
856
+ })
857
+ }
858
+
705
859
  formatWorksheetDetailInfos(wsdInfos) {
706
860
  return wsdInfos
707
861
  .map(record => {
@@ -722,7 +876,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
722
876
  this.taskNo = ''
723
877
  this.taskNoInput.value = ''
724
878
  if (this._enableProductScanning) this.productBarcodeInput.value = ''
725
- else this.sortingQtyInput.value = ''
879
+ if (this._enableSortingQty) this.sortingQtyInput.value = ''
726
880
  this._selectedOrderInventory = null
727
881
  this._selectedTaskStatus = null
728
882
  this.serialInput.value = ''