@things-factory/operato-wms 4.3.200 → 4.3.201

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.
@@ -3,16 +3,28 @@ import '@things-factory/grist-ui'
3
3
  import './show-ro-list-popup'
4
4
  import '../components/worksheet-information-popup'
5
5
  import './tote-popup'
6
+ import './sorting-same-gtin-popup'
6
7
 
7
8
  import gql from 'graphql-tag'
8
- import { css, html } from 'lit-element'
9
+ import {
10
+ css,
11
+ html
12
+ } from 'lit-element'
9
13
  import { connect } from 'pwa-helpers/connect-mixin.js'
10
14
 
11
15
  import { sleep } from '@operato/utils'
12
16
  import { MultiColumnFormStyles } from '@things-factory/form-ui'
13
- import { i18next, localize } from '@things-factory/i18n-base'
17
+ import {
18
+ i18next,
19
+ localize
20
+ } from '@things-factory/i18n-base'
14
21
  import { openPopup } from '@things-factory/layout-base'
15
- import { client, CustomAlert, PageView, store } from '@things-factory/shell'
22
+ import {
23
+ client,
24
+ CustomAlert,
25
+ PageView,
26
+ store
27
+ } from '@things-factory/shell'
16
28
  import { CommonButtonStyles } from '@things-factory/styles'
17
29
  import { isMobileDevice } from '@things-factory/utils'
18
30
 
@@ -400,6 +412,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
400
412
  if (this.sortingQtyInput) this.sortingQtyInput.value = ''
401
413
  if (this.serialInput) this.serialInput.value = ''
402
414
  this.toteNo = ''
415
+ this._lastScannedProductId = ''
403
416
  }}
404
417
  ></show-ro-list-popup>
405
418
  `,
@@ -472,6 +485,10 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
472
485
  productSku
473
486
  productName
474
487
  productDescription
488
+ productBarcodes {
489
+ id
490
+ gtin
491
+ }
475
492
  isRequireSerialNumberScanningOutbound
476
493
  expirationDate
477
494
  releaseQty
@@ -501,45 +518,87 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
501
518
  this._selectedOrderInventory = worksheetDetailInfos[0]
502
519
  this._isRequireSerialNumberScanningOutbound = worksheetDetailInfos[0].isRequireSerialNumberScanningOutbound
503
520
  }
521
+
504
522
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
505
523
  this._enableToteScanning = await fetchSettingRule('enable-tote-scanning', worksheetInfo.partnerDomainId)
524
+
506
525
  if (this._enableProductScanning)
507
526
  this._enableSortingQty = await fetchSettingRule('enable-sorting-qty', worksheetInfo.partnerDomainId)
508
527
 
509
528
  this.updateContext()
510
529
  this._completeHandler()
511
530
 
512
- if (this._isRequireSerialNumberScanningOutbound && !this._enableProductScanning) {
513
- this._focusOnSerialInput()
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
- }
531
+ this.focusPage(worksheetDetailInfos)
532
+ }
533
+ }
534
+
535
+ focusPage(worksheetDetailInfos) {
536
+ this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
537
+ if (!this._selectedOrderInventory) {
538
+ this._selectedOrderInventory = worksheetDetailInfos[0]
539
+ this._isRequireSerialNumberScanningOutbound = worksheetDetailInfos[0].isRequireSerialNumberScanningOutbound
540
+ }
541
+
542
+ if (this._isRequireSerialNumberScanningOutbound && !this._enableProductScanning) {
543
+ this._focusOnSerialInput()
544
+ } else if (this._enableProductScanning) {
545
+ if (this.productBarcodeInput.value) {
546
+ if (this._isRequireSerialNumberScanningOutbound) {
547
+ this._focusOnSerialInput()
548
+ } else if (this._enableSortingQty) {
549
+ this._focusOnSortingQtyInput()
523
550
  } else {
524
551
  this._focusOnProductBarcodeInput()
525
552
  }
526
553
  } else {
527
- this._focusOnSortingQtyInput()
554
+ this._focusOnProductBarcodeInput()
528
555
  }
556
+ } else {
557
+ this._focusOnSortingQtyInput()
529
558
  }
530
559
  }
531
560
 
561
+ async _openSortingSameGtinPopup(records) {
562
+ await sleep(1010)
563
+ openPopup(
564
+ html`
565
+ <sorting-same-gtin-popup
566
+ .sortingInventories="${records}"
567
+ @selections="${async e => {
568
+ await this.scanProductSorting(e.detail[0].productId, true)
569
+ }}"
570
+ ></sorting-same-gtin-popup>
571
+ `,
572
+ {
573
+ backdrop: true,
574
+ size: 'medium',
575
+ title: i18next.t('title.select_product_batch')
576
+ }
577
+ )
578
+ }
579
+
532
580
  async _sorting(e) {
533
581
  if (e.keyCode !== 13) return
534
582
  e.preventDefault()
535
583
  try {
536
584
  let answer = await this._validateSorting()
537
-
538
585
  if (!answer) return
539
586
 
540
587
  let response
541
588
  if (this._enableProductScanning) {
542
- response = await this.scanProductSorting()
589
+ const records = this.data.records.filter(
590
+ record =>
591
+ record.productBarcodes.find(pb => pb.gtin === this.productBarcodeInput.value) && record.status !== 'SORTED'
592
+ )
593
+
594
+ if (records.length > 1 && !this?._lastScannedProductId) {
595
+ this._openSortingSameGtinPopup(records)
596
+ return
597
+ } else {
598
+ let scannedProductId = records[0].productId
599
+ this._productId = scannedProductId
600
+ response = await this.scanProductSorting(scannedProductId)
601
+ }
543
602
  } else {
544
603
  response = await this.commonSorting()
545
604
  }
@@ -558,7 +617,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
558
617
  this.sortingQtyInput.value = ''
559
618
  }
560
619
 
561
- if (!response.errors) {
620
+ if (!response?.errors || (this._enableProductScanning && records.length > 1)) {
562
621
  this._fetchItemList(this._selectedReleaseGood?.name)
563
622
  }
564
623
  } catch (e) {
@@ -598,8 +657,21 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
598
657
  })
599
658
  }
600
659
 
601
- async scanProductSorting() {
602
- return await client.mutate({
660
+ async scanProductSorting(productId) {
661
+ const variables = {
662
+ releaseGoodNo: this._selectedReleaseGood?.name,
663
+ taskNo: this.taskNo,
664
+ productBarcode: this.productBarcodeInput.value.trim(),
665
+ serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value.trim() : null,
666
+ toteNo: this._enableToteScanning && this.toteNo !== '' ? this.toteNo : null,
667
+ sortingQty:
668
+ this._enableSortingQty && !this._isRequireSerialNumberScanningOutbound
669
+ ? parseInt(this.sortingQtyInput.value)
670
+ : null,
671
+ productId
672
+ }
673
+
674
+ const response = await client.mutate({
603
675
  mutation: gql`
604
676
  mutation scanProductSorting(
605
677
  $releaseGoodNo: String!
@@ -608,6 +680,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
608
680
  $serialNumber: String
609
681
  $toteNo: String
610
682
  $sortingQty: Int
683
+ $productId: String
611
684
  ) {
612
685
  scanProductSorting(
613
686
  releaseGoodNo: $releaseGoodNo
@@ -616,21 +689,15 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
616
689
  serialNumber: $serialNumber
617
690
  toteNo: $toteNo
618
691
  sortingQty: $sortingQty
692
+ productId: $productId
619
693
  )
620
694
  }
621
695
  `,
622
- variables: {
623
- releaseGoodNo: this._selectedReleaseGood?.name,
624
- taskNo: this.taskNo,
625
- productBarcode: this.productBarcodeInput.value.trim(),
626
- serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value.trim() : null,
627
- toteNo: this._enableToteScanning && this.toteNo !== '' ? this.toteNo : null,
628
- sortingQty:
629
- this._enableSortingQty && !this._isRequireSerialNumberScanningOutbound
630
- ? parseInt(this.sortingQtyInput.value)
631
- : null
632
- }
696
+ variables
633
697
  })
698
+
699
+ this._lastScannedProductId = productId
700
+ this._fetchItemList(this._selectedReleaseGood?.name)
634
701
  }
635
702
 
636
703
  async _completeHandler() {
@@ -643,7 +710,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
643
710
  confirmButton: { text: i18next.t('button.okay') }
644
711
  })
645
712
 
646
- if (!result.value) {
713
+ if (!result?.value) {
647
714
  return
648
715
  }
649
716
 
@@ -0,0 +1,205 @@
1
+ import '@things-factory/grist-ui'
2
+
3
+ import {
4
+ css,
5
+ html,
6
+ LitElement
7
+ } from 'lit-element'
8
+ import { connect } from 'pwa-helpers/connect-mixin'
9
+
10
+ import { SingleColumnFormStyles } from '@things-factory/form-ui'
11
+ import {
12
+ i18next,
13
+ localize
14
+ } from '@things-factory/i18n-base'
15
+ import { store } from '@things-factory/shell'
16
+ import { isMobileDevice } from '@things-factory/utils'
17
+
18
+ class SortingSameGtinPopup extends connect(store)(localize(i18next)(LitElement)) {
19
+ static get properties() {
20
+ return {
21
+ config: Object,
22
+ data: Object,
23
+ sortingInventories: Array
24
+ }
25
+ }
26
+
27
+ constructor() {
28
+ super()
29
+ this._selectedInventoryIds = []
30
+ }
31
+
32
+ static get styles() {
33
+ return [
34
+ SingleColumnFormStyles,
35
+ css`
36
+ .button-container {
37
+ padding: var(--button-container-padding);
38
+ margin: var(--button-container-margin);
39
+ text-align: var(--button-container-align);
40
+ background-color: var(--button-container-background);
41
+ height: var(--button-container-height);
42
+ }
43
+ .button-container button {
44
+ background-color: var(--button-container-button-background-color);
45
+ border-radius: var(--button-container-button-border-radius);
46
+ height: var(--button-container-button-height);
47
+ border: var(--button-container-button-border);
48
+ margin: var(--button-container-button-margin);
49
+
50
+ padding: var(--button-padding);
51
+ color: var(--theme-white-color);
52
+ font: var(--button-font);
53
+ text-transform: var(--button-text-transform);
54
+ }
55
+ .button-container button:hover,
56
+ .button-container button:active {
57
+ background-color: var(--button-background-focus-color);
58
+ }
59
+ data-grist {
60
+ overflow-y: hidden;
61
+ flex: 1;
62
+ }
63
+ .grist {
64
+ display: flex;
65
+ flex-direction: column;
66
+ flex: 1;
67
+ overflow-y: auto;
68
+ }
69
+ :host {
70
+ padding: 10px;
71
+ display: flex;
72
+ flex-direction: column;
73
+ overflow: hidden;
74
+ background-color: white;
75
+ }
76
+ `
77
+ ]
78
+ }
79
+
80
+ get dataGrist() {
81
+ return this.shadowRoot.querySelector('data-grist')
82
+ }
83
+
84
+ updated(changeProps) {
85
+ if (changeProps.has('sortingInventories')) {
86
+ if (this.sortingInventories && this.sortingInventories.length) {
87
+ this.data = { records: this.sortingInventories }
88
+ }
89
+ }
90
+ }
91
+
92
+ render() {
93
+ return html`
94
+ <div class="grist">
95
+ <data-grist
96
+ id="grist"
97
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
98
+ .config=${this.config}
99
+ .data="${this.data}"
100
+ ></data-grist>
101
+ </div>
102
+
103
+ <div class="button-container">
104
+ <mwc-button
105
+ raised
106
+ @click="${this._selectSortingInventories.bind(this)}"
107
+ label="${i18next.t('button.select')}"
108
+ ></mwc-button>
109
+ </div>
110
+ `
111
+ }
112
+
113
+ firstUpdated() {
114
+ this.config = {
115
+ pagination: { infinite: true },
116
+ rows: { selectable: { multiple: true }, appendable: false },
117
+ list: { fields: ['sku', 'product', 'batchId', 'packingType', 'packingSize', 'progress', 'binRemarks'] },
118
+ columns: [
119
+ { type: 'gutter', gutterName: 'sequence' },
120
+ { type: 'gutter', gutterName: 'row-selector', multiple: false },
121
+ { name: 'id', hidden: true },
122
+ {
123
+ type: 'string',
124
+ name: 'sku',
125
+ label: true,
126
+ header: i18next.t('field.sku'),
127
+ width: 250
128
+ },
129
+ {
130
+ type: 'object',
131
+ name: 'product',
132
+ label: true,
133
+ header: i18next.t('field.product'),
134
+ width: 250
135
+ },
136
+ {
137
+ type: 'string',
138
+ name: 'batchId',
139
+ label: true,
140
+ header: i18next.t('field.batch_id'),
141
+ width: 150
142
+ },
143
+ {
144
+ type: 'string',
145
+ name: 'packingType',
146
+ label: true,
147
+ header: i18next.t('field.packing_type'),
148
+ width: 120
149
+ },
150
+ {
151
+ type: 'integer',
152
+ name: 'packingSize',
153
+ label: true,
154
+ header: i18next.t('field.packing_size'),
155
+ width: 100
156
+ },
157
+ {
158
+ type: 'integer',
159
+ name: 'progress',
160
+ label: true,
161
+ header: i18next.t('field.qty'),
162
+ width: 100
163
+ },
164
+ {
165
+ type: 'string',
166
+ name: 'binRemarks',
167
+ header: i18next.t('field.bin_location'),
168
+ label: true,
169
+ width: 120
170
+ }
171
+ ]
172
+ }
173
+ }
174
+
175
+ async _selectSortingInventories() {
176
+ try {
177
+ let selectedInventories = []
178
+ selectedInventories = this.dataGrist.selected.map(({ productId, batchId, productName, productSku }) => ({
179
+ productId,
180
+ batchId,
181
+ productName,
182
+ productSku
183
+ }))
184
+ if (!selectedInventories?.length) throw new Error(i18next.t('text.select_at_least_one_inventory_to_sort'))
185
+
186
+ this.dispatchEvent(new CustomEvent('selections', { detail: selectedInventories }))
187
+ history.back()
188
+ } catch (e) {
189
+ this._showToast(e)
190
+ }
191
+ }
192
+
193
+ _showToast({ type, message }) {
194
+ document.dispatchEvent(
195
+ new CustomEvent('notify', {
196
+ detail: {
197
+ type,
198
+ message
199
+ }
200
+ })
201
+ )
202
+ }
203
+ }
204
+
205
+ window.customElements.define('sorting-same-gtin-popup', SortingSameGtinPopup)
@@ -6,28 +6,28 @@ module.exports = {
6
6
  subdomainOffset: 2,
7
7
  port: 1100,
8
8
  inspect: '9430',
9
- // ormconfig: {
10
- // name: 'default',
11
- // type: 'postgres',
12
- // database: 'dev2',
13
- // username: 'postgres',
14
- // password: 'hatio',
15
- // host: '192.168.0.161',
16
- // port: 15432,
17
- // synchronize: false,
18
- // logging: false
19
- // },
20
9
  ormconfig: {
21
10
  name: 'default',
22
11
  type: 'postgres',
23
- database: 'postgres',
12
+ database: 'dev2',
24
13
  username: 'postgres',
25
- password: 'abcd1234',
26
- host: 'operatov3.cluster-cijhm4n1hbst.ap-southeast-1.rds.amazonaws.com',
27
- port: 55432,
14
+ password: 'hatio',
15
+ host: '192.168.0.161',
16
+ port: 15432,
28
17
  synchronize: false,
29
- logging: true
18
+ logging: false
30
19
  },
20
+ // ormconfig: {
21
+ // name: 'default',
22
+ // type: 'postgres',
23
+ // database: 'postgres',
24
+ // username: 'postgres',
25
+ // password: 'abcd1234',
26
+ // host: 'operatov3.cluster-cijhm4n1hbst.ap-southeast-1.rds.amazonaws.com',
27
+ // port: 55432,
28
+ // synchronize: false,
29
+ // logging: true
30
+ // },
31
31
  sellercraftIntegrationConfig: {
32
32
  apiKey: 'Et0KqtLvA6e92bDvOywy9eCCud4hpAal8akpqI90'
33
33
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-wms",
3
- "version": "4.3.200",
3
+ "version": "4.3.201",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -91,7 +91,7 @@
91
91
  "@things-factory/print-ui": "^4.3.179",
92
92
  "@things-factory/product-base": "^4.3.186",
93
93
  "@things-factory/resource-ui": "^4.3.179",
94
- "@things-factory/sales-ui": "^4.3.199",
94
+ "@things-factory/sales-ui": "^4.3.201",
95
95
  "@things-factory/scene-data-transform": "^4.3.159",
96
96
  "@things-factory/scene-excel": "^4.3.159",
97
97
  "@things-factory/scene-firebase": "^4.3.159",
@@ -107,8 +107,8 @@
107
107
  "@things-factory/system-ui": "^4.3.179",
108
108
  "@things-factory/transport-base": "^4.3.179",
109
109
  "@things-factory/tutorial-ui": "^4.3.179",
110
- "@things-factory/warehouse-base": "^4.3.198",
111
- "@things-factory/worksheet-base": "^4.3.200"
110
+ "@things-factory/warehouse-base": "^4.3.201",
111
+ "@things-factory/worksheet-base": "^4.3.201"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@things-factory/builder": "^4.3.179",
@@ -117,5 +117,5 @@
117
117
  "cypress-localstorage-commands": "^1.6.1",
118
118
  "eslint-plugin-cypress": "^2.12.1"
119
119
  },
120
- "gitHead": "091a9a15da2b4294e4d63729c46546ee60707458"
120
+ "gitHead": "30a106970669db98dfd6ffe7b75d152866b9fa2e"
121
121
  }