@things-factory/operato-wms 4.0.10 → 4.0.14

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 (160) hide show
  1. package/client/pages/adjustment/transfer-inventory.js +368 -165
  2. package/client/pages/billing/claim-chit/claim-chit-list.js +7 -6
  3. package/client/pages/bulk-operation/bulk-operation.js +316 -0
  4. package/client/pages/bulk-operation/validate-ro-popup.js +445 -0
  5. package/client/pages/components/select-product-popup.js +15 -2
  6. package/client/pages/constants/inventory.js +1 -0
  7. package/client/pages/constants/location.js +33 -6
  8. package/client/pages/constants/order.js +10 -0
  9. package/client/pages/constants/worksheet.js +2 -2
  10. package/client/pages/inbound/inbound-worksheet.js +78 -9
  11. package/client/pages/inbound/putaway-product.js +214 -139
  12. package/client/pages/inbound/putaway-worksheet-generate-popup.js +24 -2
  13. package/client/pages/inbound/unload-product.js +149 -76
  14. package/client/pages/inbound/worksheet-putaway-return.js +22 -5
  15. package/client/pages/inbound/worksheet-putaway.js +21 -8
  16. package/client/pages/inbound/worksheet-unloading-return.js +22 -5
  17. package/client/pages/inbound/worksheet-unloading.js +8 -0
  18. package/client/pages/inventory/inventory-adjustment-approval.js +11 -19
  19. package/client/pages/inventory/inventory-adjustment.js +136 -101
  20. package/client/pages/inventory/inventory-by-product-detail.js +3 -5
  21. package/client/pages/inventory/inventory-by-product.js +8 -0
  22. package/client/pages/inventory/inventory-history-by-pallet.js +12 -5
  23. package/client/pages/inventory/inventory-history.js +14 -5
  24. package/client/pages/inventory/onhand-inventory.js +11 -2
  25. package/client/pages/inventory-check/create-cycle-count.js +12 -6
  26. package/client/pages/inventory-check/cycle-count-report.js +8 -0
  27. package/client/pages/inventory-check/inspecting-product.js +146 -80
  28. package/client/pages/inventory-check/worksheet-cycle-count.js +14 -0
  29. package/client/pages/manifest/create-loading-manifest.js +314 -0
  30. package/client/pages/manifest/dispatcher-verification-popup.js +86 -0
  31. package/client/pages/manifest/loading-manifest-detail.js +345 -0
  32. package/client/pages/manifest/loading-manifest-list.js +305 -0
  33. package/client/pages/master/location-list.js +58 -17
  34. package/client/pages/master/product/product-detail-bizplace-setting-popup.js +2 -2
  35. package/client/pages/master/product/product-details-popup.js +2 -2
  36. package/client/pages/master/product/product-list.js +5 -5
  37. package/client/pages/order/arrival-notice/arrival-notice-detail.js +134 -115
  38. package/client/pages/order/arrival-notice/arrival-notice-list.js +87 -6
  39. package/client/pages/order/arrival-notice/arrival-notice-requests.js +83 -6
  40. package/client/pages/order/arrival-notice/assign-buffer-location.js +8 -1
  41. package/client/pages/order/arrival-notice/check-arrived-notice.js +9 -1
  42. package/client/pages/order/arrival-notice/create-arrival-notice.js +38 -3
  43. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +290 -25
  44. package/client/pages/order/arrival-notice/edit-product-popup.js +36 -5
  45. package/client/pages/order/arrival-notice/receive-arrival-notice.js +8 -1
  46. package/client/pages/order/goods-received-note/received-note-list.js +138 -6
  47. package/client/pages/order/release-order/b2b/b2b-order-list.js +45 -5
  48. package/client/pages/order/release-order/b2b/b2b-order-requests.js +52 -12
  49. package/client/pages/order/release-order/b2c/b2c-order-requests.js +244 -24
  50. package/client/pages/order/release-order/bulk-print-packing-list.js +23 -0
  51. package/client/pages/order/release-order/create-release-order.js +55 -8
  52. package/client/pages/order/release-order/receive-release-order-request.js +35 -24
  53. package/client/pages/order/release-order/release-extra-product-popup.js +204 -63
  54. package/client/pages/order/release-order/release-order-detail.js +301 -74
  55. package/client/pages/order/return-order/check-return-order.js +9 -1
  56. package/client/pages/order/return-order/create-return-order.js +14 -2
  57. package/client/pages/order/return-order/receive-return-order-requests.js +9 -1
  58. package/client/pages/order/return-order/return-order-detail.js +15 -6
  59. package/client/pages/order/return-order/return-order-inventory-popup.js +7 -0
  60. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-detail.js +124 -59
  61. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-list.js +1 -6
  62. package/client/pages/order/reverse-kitting-order/reverse-kitting-pallet-label-popup.js +239 -0
  63. package/client/pages/order/transport-order/delivery-order-list.js +102 -59
  64. package/client/pages/outbound/inventory-assign-popup.js +23 -6
  65. package/client/pages/outbound/inventory-auto-assign-popup.js +22 -6
  66. package/client/pages/outbound/loading-product.js +4 -1
  67. package/client/pages/outbound/merged-outbound-worksheet.js +43 -1
  68. package/client/pages/outbound/packing-product.js +4 -1
  69. package/client/pages/outbound/packing-worksheet-list.js +39 -1
  70. package/client/pages/outbound/picking-product.js +803 -431
  71. package/client/pages/outbound/picking-replacement-popup.js +1 -1
  72. package/client/pages/outbound/serial-number-popup.js +280 -0
  73. package/client/pages/outbound/single-outbound-worksheet.js +47 -1
  74. package/client/pages/outbound/worksheet-batch-picking.js +22 -8
  75. package/client/pages/outbound/worksheet-loading.js +22 -5
  76. package/client/pages/outbound/worksheet-packing.js +8 -0
  77. package/client/pages/outbound/worksheet-picking.js +62 -8
  78. package/client/pages/outbound/worksheet-return.js +9 -1
  79. package/client/pages/outbound/worksheet-sorting.js +9 -1
  80. package/client/pages/report/custom-elccl/elccl-inventory-report.js +31 -30
  81. package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +23 -26
  82. package/client/pages/report/inventory-pallet-storage-report.js +11 -10
  83. package/client/pages/report/inventory-report.js +41 -43
  84. package/client/pages/report/inventory-summary-report.js +25 -28
  85. package/client/pages/report/product-label-report.js +401 -0
  86. package/client/pages/support/inventory-comparison.js +296 -0
  87. package/client/pages/vas/print-product-label.js +298 -132
  88. package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +38 -23
  89. package/client/pages/vas/reverse-kitting/popup-combination-sets.js +98 -15
  90. package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +129 -21
  91. package/client/pages/vas/vas-pallet-label-popup.js +5 -8
  92. package/client/route.js +28 -0
  93. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +1 -1
  94. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  95. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +64 -54
  96. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js.map +1 -1
  97. package/dist-server/graphql/resolvers/extra/add-release-good-products.js +34 -9
  98. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
  99. package/dist-server/graphql/resolvers/index.js +5 -1
  100. package/dist-server/graphql/resolvers/index.js.map +1 -1
  101. package/dist-server/graphql/resolvers/inventory-comparison/index.js +6 -0
  102. package/dist-server/graphql/resolvers/inventory-comparison/index.js.map +1 -0
  103. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js +78 -0
  104. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js.map +1 -0
  105. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  106. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  107. package/dist-server/graphql/resolvers/reports/product-label-report.js +56 -0
  108. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -0
  109. package/dist-server/graphql/resolvers/shipping-provider/index.js +6 -0
  110. package/dist-server/graphql/resolvers/shipping-provider/index.js.map +1 -0
  111. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +20 -0
  112. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +1 -0
  113. package/dist-server/graphql/types/custom/elccl/elccl-inventory-report.js +1 -1
  114. package/dist-server/graphql/types/index.js +8 -2
  115. package/dist-server/graphql/types/index.js.map +1 -1
  116. package/dist-server/graphql/types/inventory-comparison/index.js +13 -0
  117. package/dist-server/graphql/types/inventory-comparison/index.js.map +1 -0
  118. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js +14 -0
  119. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js.map +1 -0
  120. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js +18 -0
  121. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js.map +1 -0
  122. package/dist-server/graphql/types/reports/index.js +6 -1
  123. package/dist-server/graphql/types/reports/index.js.map +1 -1
  124. package/dist-server/graphql/types/reports/product-label-report-list.js +14 -0
  125. package/dist-server/graphql/types/reports/product-label-report-list.js.map +1 -0
  126. package/dist-server/graphql/types/reports/product-label-report.js +16 -0
  127. package/dist-server/graphql/types/reports/product-label-report.js.map +1 -0
  128. package/dist-server/graphql/types/shipping-provider/index.js +10 -0
  129. package/dist-server/graphql/types/shipping-provider/index.js.map +1 -0
  130. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js +13 -0
  131. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js.map +1 -0
  132. package/dist-server/graphql/types/shipping-provider/shipping-provider.js +13 -0
  133. package/dist-server/graphql/types/shipping-provider/shipping-provider.js.map +1 -0
  134. package/package.json +65 -65
  135. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +4 -2
  136. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +75 -65
  137. package/server/graphql/resolvers/extra/add-release-good-products.ts +57 -15
  138. package/server/graphql/resolvers/index.ts +5 -1
  139. package/server/graphql/resolvers/inventory-comparison/index.ts +5 -0
  140. package/server/graphql/resolvers/inventory-comparison/inventory-comparison-list.ts +99 -0
  141. package/server/graphql/resolvers/reports/index.ts +3 -1
  142. package/server/graphql/resolvers/reports/product-label-report.ts +56 -0
  143. package/server/graphql/resolvers/shipping-provider/index.ts +5 -0
  144. package/server/graphql/resolvers/shipping-provider/shipping-providers.ts +20 -0
  145. package/server/graphql/types/custom/elccl/elccl-inventory-report.ts +1 -1
  146. package/server/graphql/types/index.ts +8 -2
  147. package/server/graphql/types/inventory-comparison/index.ts +11 -0
  148. package/server/graphql/types/inventory-comparison/inventory-comparison-list.ts +8 -0
  149. package/server/graphql/types/inventory-comparison/inventory-comparison.ts +12 -0
  150. package/server/graphql/types/reports/index.ts +6 -1
  151. package/server/graphql/types/reports/product-label-report-list.ts +8 -0
  152. package/server/graphql/types/reports/product-label-report.ts +10 -0
  153. package/server/graphql/types/shipping-provider/index.ts +8 -0
  154. package/server/graphql/types/shipping-provider/shipping-provider-list.ts +7 -0
  155. package/server/graphql/types/shipping-provider/shipping-provider.ts +7 -0
  156. package/things-factory.config.js +30 -0
  157. package/translations/en.json +91 -11
  158. package/translations/ko.json +109 -11
  159. package/translations/ms.json +111 -12
  160. package/translations/zh.json +123 -26
@@ -3,6 +3,7 @@ import '@things-factory/grist-ui'
3
3
  import './outbound-reusable-pallet'
4
4
  import './picking-replacement-popup'
5
5
  import './show-my-worksheet-list-popup'
6
+ import './serial-number-popup'
6
7
 
7
8
  import gql from 'graphql-tag'
8
9
  import { css, html } from 'lit-element'
@@ -11,13 +12,13 @@ import { connect } from 'pwa-helpers/connect-mixin.js'
11
12
  import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
12
13
  import { i18next, localize } from '@things-factory/i18n-base'
13
14
  import { openPopup } from '@things-factory/layout-base'
14
- import { client, CustomAlert, navigate, PageView, store } from '@things-factory/shell'
15
+ import { client, CustomAlert, gqlContext, PageView, store } from '@things-factory/shell'
15
16
  import { CommonButtonStyles } from '@things-factory/styles'
16
17
  import { isMobileDevice } from '@things-factory/utils'
17
18
 
18
19
  import { fetchLocationSortingRule } from '../../fetch-location-sorting-rule'
19
20
  import { fetchSettingRule } from '../../fetch-setting-value'
20
- import { BATCH_PICKING, LOCATION_SORTING_RULE, PICKING, WORKSHEET_STATUS } from '../constants'
21
+ import { BATCH_PICKING, LOCATION_SORTING_RULE, PICKING } from '../constants'
21
22
 
22
23
  const PICKING_TYPES = { PICKING, BATCH_PICKING }
23
24
  class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
@@ -27,22 +28,24 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
27
28
  worksheetNo: String,
28
29
  config: Object,
29
30
  data: Object,
31
+ isWholePicking: Boolean,
32
+ refPickingType: String,
33
+ locationNameSplit: Array,
34
+ locations: Array,
35
+ orderNo: String,
30
36
  _productName: String,
31
37
  _productSku: String,
32
- _selectedTaskStatus: String,
38
+ _isRequireSerialNumberScanning: Boolean,
39
+ // _selectedTaskStatus: String,
33
40
  _reusablePalletList: Object,
34
41
  _hasBinPicking: Boolean,
35
42
  _isCartonLabel: Boolean,
36
43
  _enableProductScanning: Boolean,
37
- isWholePicking: Boolean,
38
- isReplacement: Boolean,
39
- refPickingType: String,
40
- crossDocking: Boolean,
41
- incompleteLocationName: Boolean,
42
- locationNameSplit: Array,
43
- locations: Array,
44
- orderNo: String,
45
- _isExecuting: Boolean
44
+ _isReplacement: Boolean,
45
+ _crossDocking: Boolean,
46
+ _incompleteLocationName: Boolean,
47
+ _isExecuting: Boolean,
48
+ _currentBinLocation: String
46
49
  }
47
50
  }
48
51
 
@@ -105,7 +108,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
105
108
  padding-top: var(--grist-title-with-grid-padding);
106
109
  }
107
110
 
108
- div.reusable_pallet {
111
+ div.full_width {
109
112
  grid-column: span 12 / auto;
110
113
  display: inline-flex;
111
114
  align-items: center;
@@ -119,41 +122,23 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
119
122
  :host {
120
123
  display: block;
121
124
  }
122
- }
123
- `
124
- ]
125
- }
126
125
 
127
- get context() {
128
- var actions = []
126
+ ////// For Small Mobile View temporarily disabled
127
+ // .grist {
128
+ // display: block;
129
+ // flex: none;
130
+ // }
129
131
 
130
- actions.push({
131
- title: i18next.t('button.my_worksheet_list'),
132
- action: this.showWorksheetList.bind(this),
133
- ...CommonButtonStyles.inspect
134
- })
132
+ // data-grist {
133
+ // max-width: 90%;
134
+ // }
135
135
 
136
- if ((this.releaseGoodNo && this.completed) || (this.taskNo && this.completed)) {
137
- actions.push({
138
- title: i18next.t('button.complete'),
139
- action: this._complete.bind(this),
140
- ...CommonButtonStyles.submit
141
- })
142
- }
143
-
144
- return {
145
- title: i18next.t('title.picking'),
146
- help: 'operato-wms/outbound/picking-product',
147
- actions
148
- }
149
- }
150
-
151
- get releaseGoodNoInput() {
152
- return this.shadowRoot.querySelector('barcode-scanable-input[name=releaseGoodNo]').shadowRoot.querySelector('input')
153
- }
154
-
155
- get taskNoInput() {
156
- return this.shadowRoot.querySelector('barcode-scanable-input[name=taskNo]').shadowRoot.querySelector('input')
136
+ // .left-column {
137
+ // max-height: 200px;
138
+ // }
139
+ }
140
+ `
141
+ ]
157
142
  }
158
143
 
159
144
  get infoForm() {
@@ -168,26 +153,40 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
168
153
  return this.shadowRoot.querySelector('data-grist')
169
154
  }
170
155
 
156
+ get releaseGoodNoInput() {
157
+ return this.shadowRoot
158
+ .querySelector('barcode-scanable-input[name=releaseGoodNo]')
159
+ ?.shadowRoot?.querySelector('input')
160
+ }
161
+
162
+ get taskNoInput() {
163
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=taskNo]')?.shadowRoot.querySelector('input')
164
+ }
165
+
166
+ get binLocationInput() {
167
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=binLocation]')?.shadowRoot.querySelector('input')
168
+ }
169
+
171
170
  get palletInput() {
172
- return this.shadowRoot.querySelector('barcode-scanable-input[name=palletId]').shadowRoot.querySelector('input')
171
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=palletId]')?.shadowRoot.querySelector('input')
173
172
  }
174
173
 
175
174
  get cartonInput() {
176
- return this.shadowRoot.querySelector('barcode-scanable-input[name=cartonId]').shadowRoot.querySelector('input')
175
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=cartonId]')?.shadowRoot.querySelector('input')
177
176
  }
178
177
 
179
178
  get locationInput() {
180
- return this.shadowRoot.querySelector('barcode-scanable-input[name=locationName]').shadowRoot.querySelector('input')
179
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=locationName]')?.shadowRoot.querySelector('input')
181
180
  }
182
181
 
183
182
  get productBarcodeInput() {
184
183
  return this.shadowRoot
185
- .querySelector('barcode-scanable-input[name=productBarcode]')
186
- .shadowRoot.querySelector('input')
184
+ ?.querySelector('barcode-scanable-input[name=productBarcode]')
185
+ ?.shadowRoot.querySelector('input')
187
186
  }
188
187
 
189
- get binLocationInput() {
190
- return this.shadowRoot.querySelector('barcode-scanable-input[name=binLocation]').shadowRoot.querySelector('input')
188
+ get serialInput() {
189
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=serialNumber]')?.shadowRoot.querySelector('input')
191
190
  }
192
191
 
193
192
  get newLocationInput() {
@@ -202,51 +201,123 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
202
201
  return this.shadowRoot.querySelector('input[name=releaseProgress]')
203
202
  }
204
203
 
205
- get scannable() {
206
- if (this.refPickingType === PICKING_TYPES.PICKING.value) {
207
- return this._selectedTaskStatus && this._selectedTaskStatus === WORKSHEET_STATUS.EXECUTING.value
208
- } else {
209
- return (
210
- this._selectedOrderInventory &&
211
- this._selectedOrderInventory.pickedQty != this._selectedOrderInventory.releaseQty
212
- )
213
- }
214
- }
215
-
216
- get completed() {
217
- return this.data.records.every(record => record.completed)
218
- }
219
-
220
204
  _focusOnNewLocationInput() {
221
- setTimeout(() => this.newLocationInput.focus(), 100)
205
+ setTimeout(() => this.newLocationInput.focus(), 50)
222
206
  }
223
207
 
224
208
  _focusOnLocationNameInput() {
225
- setTimeout(() => this.locationInput.focus(), 100)
209
+ setTimeout(() => this.locationInput.focus(), 50)
226
210
  }
227
211
 
228
212
  _focusOnReleaseGoodNoInput() {
229
- setTimeout(() => this.releaseGoodNoInput.focus(), 100)
213
+ setTimeout(() => this.releaseGoodNoInput.focus(), 50)
230
214
  }
231
215
 
232
216
  _focusOnTaskNoInput() {
233
- setTimeout(() => this.taskNoInput.focus(), 100)
217
+ setTimeout(() => this.taskNoInput.focus(), 50)
218
+ }
219
+
220
+ _focusOnBinLocationInput() {
221
+ setTimeout(() => this.binLocationInput.focus(), 50)
234
222
  }
235
223
 
236
224
  _focusOnLotNoInput() {
237
- setTimeout(() => this.palletInput.focus(), 100)
225
+ if (this.palletInput) {
226
+ setTimeout(() => this.palletInput.focus(), 50)
227
+ }
238
228
  }
239
229
 
240
230
  _focusOnCartonNoInput() {
241
- setTimeout(() => this.cartonInput.focus(), 100)
231
+ if (this.cartonInput) {
232
+ setTimeout(() => this.cartonInput.focus(), 50)
233
+ }
242
234
  }
243
235
 
244
236
  _focusOnProductBarcodeInput() {
245
- setTimeout(() => this.productBarcodeInput.focus(), 100)
237
+ if (this._enableProductScanning && this?.productBarcodeInput) {
238
+ setTimeout(() => this.productBarcodeInput.focus(), 50)
239
+ }
240
+ }
241
+
242
+ _focusOnSerialInput() {
243
+ if (this.serialInput) {
244
+ setTimeout(() => this.serialInput.focus(), 50)
245
+ }
246
246
  }
247
247
 
248
248
  _focusOnReleaseQtyInput() {
249
- setTimeout(() => this.releaseQtyInput.focus(), 100)
249
+ if (this.releaseQtyInput) {
250
+ setTimeout(() => this.releaseQtyInput.focus(), 50)
251
+ }
252
+ }
253
+
254
+ get context() {
255
+ var actions = []
256
+ if (this._hasBinPicking) {
257
+ actions.push({
258
+ title: i18next.t('button.get_task'),
259
+ action: this.getTask.bind(this),
260
+ ...CommonButtonStyles.assignment
261
+ })
262
+ }
263
+
264
+ actions.push({
265
+ title: i18next.t('button.my_worksheet_list'),
266
+ action: this.showWorksheetList.bind(this),
267
+ ...CommonButtonStyles.inspect
268
+ })
269
+
270
+ if ((this.releaseGoodNo && this.completed) || (this.taskNo && this.completed)) {
271
+ actions.push({
272
+ title: i18next.t('button.complete'),
273
+ action: this.complete.bind(this),
274
+ ...CommonButtonStyles.submit
275
+ })
276
+ }
277
+
278
+ return {
279
+ title: i18next.t('title.picking'),
280
+ help: 'operato-wms/outbound/picking-product',
281
+ actions
282
+ }
283
+ }
284
+
285
+ get scannable() {
286
+ let result =
287
+ this._selectedOrderInventory && this._selectedOrderInventory.pickedQty != this._selectedOrderInventory.releaseQty
288
+ return result
289
+ }
290
+
291
+ get completed() {
292
+ return this.data.records.every(record => record.completed)
293
+ }
294
+
295
+ constructor() {
296
+ super()
297
+
298
+ this.data = { records: [] }
299
+ this._reusablePalletList = { records: [] }
300
+
301
+ this.taskNo = ''
302
+ this.releaseGoodNo = ''
303
+ this._selectedOrderInventory = null
304
+ this.locationSortingRules = []
305
+ this.locationNameSplit = []
306
+
307
+ this._productName = ''
308
+
309
+ this.refPickingType = PICKING_TYPES.PICKING.value
310
+
311
+ this._crossDocking = false
312
+ this._isReplacement = false
313
+ this._hasBinPicking = false
314
+ this._isCartonLabel = false
315
+ this._enableProductScanning = false
316
+ this._isRequireSerialNumberScanning = false
317
+ this._incompleteLocationName = false
318
+
319
+ /* A flag to indicate either PICKING process is executing */
320
+ this._isExecuting = false
250
321
  }
251
322
 
252
323
  render() {
@@ -256,52 +327,40 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
256
327
  <legend>${i18next.t('title.scan_area')}</legend>
257
328
  <label>${i18next.t('label.picking_type')}</label>
258
329
  <select name="pickingType" @change="${e => this.pickingTypeChangeHandler(e.currentTarget.value)}">
259
- ${Object.keys(PICKING_TYPES).map(key =>
260
- this.refPickingType === PICKING_TYPES[key].value
261
- ? html`
262
- <option value="${PICKING_TYPES[key].value}" selected>
263
- ${i18next.t(`label.${PICKING_TYPES[key].name}`)}
264
- </option>
265
- `
266
- : html`
267
- <option value="${PICKING_TYPES[key].value}">
268
- ${i18next.t(`label.${PICKING_TYPES[key].name}`)}
269
- </option>
270
- `
330
+ ${Object.keys(PICKING_TYPES).map(
331
+ key =>
332
+ html`
333
+ <option
334
+ value="${PICKING_TYPES[key].value}"
335
+ ?selected=${this.refPickingType === PICKING_TYPES[key].value}
336
+ >
337
+ ${i18next.t(`label.${PICKING_TYPES[key].name}`)}
338
+ </option>
339
+ `
271
340
  )}
272
341
  </select>
273
342
 
274
- ${this.refPickingType === PICKING_TYPES.PICKING.value
275
- ? html`
276
- <label>${i18next.t('label.release_good_no')}</label>
277
- <barcode-scanable-input
278
- name="releaseGoodNo"
279
- custom-input
280
- @keypress="${async e => {
281
- if (e.keyCode === 13) {
282
- e.preventDefault()
283
- if (this.releaseGoodNoInput.value) {
284
- this._fetchInventories(this.releaseGoodNoInput.value)
285
- this._fetchPalletsHandler(this.releaseGoodNoInput.value)
286
- }
287
- }
288
- }}"
289
- ></barcode-scanable-input>
290
- `
291
- : html` <label>${i18next.t('label.task_no')}</label>
292
- <barcode-scanable-input
293
- name="taskNo"
294
- custom-input
295
- @keypress="${async e => {
296
- if (e.keyCode === 13) {
297
- e.preventDefault()
298
- if (this.taskNoInput.value) {
299
- this._fetchInventories(this.taskNoInput.value)
300
- this._fetchPalletsHandler(this.taskNoInput.value)
301
- }
302
- }
303
- }}"
304
- ></barcode-scanable-input>`}
343
+ <label>
344
+ ${this.refPickingType === PICKING_TYPES.PICKING.value
345
+ ? i18next.t('label.release_good_no')
346
+ : i18next.t('label.task_no')}
347
+ </label>
348
+ <barcode-scanable-input
349
+ name=${this.refPickingType === PICKING_TYPES.PICKING.value ? 'releaseGoodNo' : 'taskNo'}
350
+ custom-input
351
+ @keypress="${async e => {
352
+ if (e.keyCode === 13) {
353
+ e.preventDefault()
354
+ this._currentBinLocation = null
355
+ if (this.releaseGoodNoInput.value) {
356
+ this.releaseGoodNo = this.releaseGoodNoInput.value
357
+ await this.fetchAll(this.releaseGoodNo)
358
+ this.completeHandler()
359
+ }
360
+ }
361
+ }}"
362
+ >
363
+ </barcode-scanable-input>
305
364
  </fieldset>
306
365
 
307
366
  <fieldset>
@@ -313,7 +372,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
313
372
 
314
373
  <label>${i18next.t('label.ref_no_2')}</label>
315
374
  <input name="refNo2" readonly />`
316
- : html`<legend>${`${i18next.t('title.task_no')}: ${this.taskNo}`}</legend>`}
375
+ : html` <legend>${`${i18next.t('title.task_no')}: ${this.taskNo}`}</legend>`}
317
376
 
318
377
  <label>${i18next.t('label.company')}</label>
319
378
  <input name="bizplaceName" readonly />
@@ -321,9 +380,9 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
321
380
  <label>${i18next.t('label.started_at')}</label>
322
381
  <input name="startedAt" type="datetime-local" readonly />
323
382
 
324
- ${this.crossDocking
383
+ ${this._crossDocking
325
384
  ? html`
326
- <input name="crossDocking" type="checkbox" .checked="${this.crossDocking}" disabled />
385
+ <input name="_crossDocking" type="checkbox" .checked="${this._crossDocking}" disabled />
327
386
  <label>${i18next.t('label.cross_docking')}</label>
328
387
  `
329
388
  : ''}
@@ -341,7 +400,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
341
400
  </div>
342
401
 
343
402
  <div class="right-column">
344
- <form id="input-form" class="single-column-form" @keypress="${this._picking.bind(this)}">
403
+ <form id="input-form" class="single-column-form" @keypress="${this.picking.bind(this)}">
345
404
  <fieldset>
346
405
  <legend>${i18next.t('label.product')}: ${this._productName}</legend>
347
406
 
@@ -368,11 +427,11 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
368
427
  <input name="releaseProgress" readonly />
369
428
  </fieldset>
370
429
 
371
- ${this.releaseGoodNo
430
+ ${this.releaseGoodNo || ''
372
431
  ? html`
373
432
  <fieldset>
374
433
  <legend>${i18next.t('title.reusable_pallet')}</legend>
375
- <div class="reusable_pallet" @click="${this._openPalletOutbound.bind(this)}">
434
+ <div class="full_width" @click="${this.openPalletOutbound.bind(this)}">
376
435
  <mwc-icon>apps</mwc-icon>Plastic Pallets
377
436
  </div>
378
437
  </fieldset>
@@ -382,6 +441,21 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
382
441
  ? html`
383
442
  <fieldset>
384
443
  <legend>${i18next.t('title.input_section')}</legend>
444
+ ${this._hasBinPicking
445
+ ? html`
446
+ <label>${i18next.t('label.bin_location')}</label>
447
+ <barcode-scanable-input
448
+ name="binLocation"
449
+ custom-input
450
+ @keypress="${e => {
451
+ if (e.keyCode === 13) {
452
+ e.preventDefault()
453
+ this._currentBinLocation = this.binLocationInput.value
454
+ }
455
+ }}"
456
+ ></barcode-scanable-input>
457
+ `
458
+ : ''}
385
459
  ${this._isCartonLabel
386
460
  ? html`
387
461
  <label>${i18next.t('label.carton_id')}</label>
@@ -397,26 +471,28 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
397
471
  <barcode-scanable-input name="productBarcode" custom-input></barcode-scanable-input>
398
472
  `
399
473
  : html`
400
- <label>${i18next.t('label.picked_qty')}</label>
401
- <input type="number" min="1" name="confirmedQty" />
474
+ ${this._isRequireSerialNumberScanning
475
+ ? ''
476
+ : html`
477
+ <label>${i18next.t('label.picked_qty')}</label>
478
+ <input type="number" min="1" name="confirmedQty" />
479
+ `}
402
480
  `}
403
- ${this._hasBinPicking
404
- ? html`
405
- <label>${i18next.t('label.bin_location')}</label>
406
- <barcode-scanable-input name="binLocation" custom-input></barcode-scanable-input>
407
- `
408
- : ''}
409
- ${this.isWholePicking || this.crossDocking || this._isCartonLabel || this._enableProductScanning
481
+ ${this.isWholePicking ||
482
+ this._crossDocking ||
483
+ this._isCartonLabel ||
484
+ this._enableProductScanning ||
485
+ this._isRequireSerialNumberScanning
410
486
  ? ''
411
487
  : html`
412
- ${this.incompleteLocationName
488
+ ${this._incompleteLocationName
413
489
  ? ''
414
490
  : html`
415
491
  <label>${i18next.t('label.return_location')}</label>
416
492
  <barcode-scanable-input name="locationName" custom-input></barcode-scanable-input>
417
493
  `}
418
494
  <select
419
- ?hidden="${!this.incompleteLocationName}"
495
+ ?hidden="${!this._incompleteLocationName}"
420
496
  name="newLocationCode"
421
497
  @change="${e => (this.locationInput.value = e.currentTarget.value)}"
422
498
  >
@@ -432,44 +508,32 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
432
508
  )}
433
509
  </select>
434
510
  `}
511
+ ${this._isRequireSerialNumberScanning
512
+ ? html`
513
+ <label>${i18next.t('label.serial_number')}</label>
514
+ <barcode-scanable-input name="serialNumber" custom-input></barcode-scanable-input>
515
+ `
516
+ : ``}
435
517
  </fieldset>
436
518
  `
437
519
  : ''}
520
+ ${this._selectedOrderInventory && this._isRequireSerialNumberScanning
521
+ ? html`
522
+ <fieldset>
523
+ <fieldset>
524
+ <div class="full_width" @click="${this.openSerialNumberPopup.bind(this)}">
525
+ <mwc-icon>list</mwc-icon>${i18next.t('label.serial_number_list')}
526
+ </div>
527
+ </fieldset>
528
+ </fieldset>
529
+ `
530
+ : ``}
438
531
  </form>
439
532
  </div>
440
533
  </div>
441
534
  `
442
535
  }
443
536
 
444
- constructor() {
445
- super()
446
- this.data = { records: [] }
447
- this._productName = ''
448
- this.releaseGoodNo = ''
449
- this.taskNo = ''
450
- this._selectedOrderInventory = null
451
- this._selectedTaskStatus = null
452
- this._reusablePalletList = { records: [] }
453
- this.locationSortingRules = []
454
- this.refPickingType = PICKING_TYPES.PICKING.value
455
- this.crossDocking = false
456
- this.isReplacement = false
457
- this._hasBinPicking = false
458
- this._isCartonLabel = false
459
- this._enableProductScanning = false
460
- this.incompleteLocationName = false
461
- this.locationNameSplit = []
462
-
463
- /* A flag to indicate either PICKING process is executing */
464
- this._isExecuting = false
465
- }
466
-
467
- updated(changedProps) {
468
- if (changedProps.has('_selectedTaskStatus') && this._selectedTaskStatus) {
469
- this.updateContext()
470
- }
471
- }
472
-
473
537
  pageUpdated(changes, lifecycle) {
474
538
  if (this.active) {
475
539
  this.orderNo = lifecycle.params?.orderNo || null
@@ -479,35 +543,55 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
479
543
  }
480
544
 
481
545
  async pageInitialized() {
546
+ const [enableBinPickingTask, locationSortingTask] = [
547
+ fetchSettingRule('enable-bin-picking'),
548
+ fetchLocationSortingRule(LOCATION_SORTING_RULE.PICKING_PRODUCT.value)
549
+ ]
550
+
482
551
  this.config = {
483
552
  rows: {
484
553
  appendable: false,
554
+ classifier: (record, rowIndex) => {
555
+ return {
556
+ emphasized: record.completed == true
557
+ }
558
+ },
485
559
  handlers: {
486
560
  click: async (columns, data, column, record, rowIndex) => {
487
- if (data.records.length && record) {
488
- this._isExecuting = false
489
- this._selectedOrderInventory = record
490
- if (this.refPickingType === PICKING_TYPES.PICKING.value) {
491
- this._selectedTaskStatus = record.status
492
- }
493
- this._isCartonLabel = record.hasCartonLabel
494
- this._productName = record.product?.name
495
- ? `${record.product.sku + ' - ' + record.product.name} ${
496
- record.product?.description ? `(${record.product.description})` : ''
497
- }`
498
- : ''
499
- this.isWholePicking = this._selectedOrderInventory.releaseQty === this._selectedOrderInventory.qty
500
- this.isReplacement = false
501
-
502
- this._fillUpForm(this.inputForm, record)
503
- await this.updateComplete
504
- if (this.scannable) {
505
- if (this._enableProductScanning) this.productBarcodeInput.value = ''
506
- if (this._isCartonLabel) {
507
- this.cartonInput.value = ''
508
- this._focusOnCartonNoInput()
509
- } else this._focusOnLotNoInput()
561
+ try {
562
+ this.grist.showSpinner()
563
+ if (data.records.length && record) {
564
+ this.inputForm.reset()
565
+ this._isReplacement = false
566
+
567
+ if (this.binLocationInput) this.binLocationInput.value = ''
568
+ if (this.productBarcodeInput) this.productBarcodeInput.value = ''
569
+ if (this.cartonInput) this.cartonInput.value = ''
570
+ if (this.palletInput) this.palletInput.value = ''
571
+ if (this.serialInput) this.serialInput.value = ''
572
+
573
+ this._selectedOrderInventory = record
574
+ await this.fetchInventories(this.releaseGoodNo)
575
+ let updatedRecords = this._selectedOrderInventory
576
+ if (updatedRecords.releaseQty === updatedRecords.pickedQty) {
577
+ updatedRecords.status = 'DONE'
578
+ } else {
579
+ updatedRecords.status = 'PICKING'
580
+ }
581
+
582
+ // this._isCartonLabel = updatedRecords.hasCartonLabel
583
+ // this._productName = updatedRecords.product?.name
584
+ // ? `${updatedRecords.product.sku + ' - ' + updatedRecords.product.name} ${
585
+ // updatedRecords.product?.description ? `(${updatedRecords.product.description})` : ''
586
+ // }`
587
+ // : ''
588
+ // this._isRequireSerialNumberScanning = updatedRecords?.product?.isRequireSerialNumberScanning
589
+ // this.isWholePicking = updatedRecords.releaseQty === updatedRecords.qty
510
590
  }
591
+ } catch (ex) {
592
+ console.log(ex)
593
+ } finally {
594
+ this.grist.hideSpinner()
511
595
  }
512
596
  }
513
597
  }
@@ -563,16 +647,18 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
563
647
  ]
564
648
  }
565
649
 
566
- this.locationSortingRules = await fetchLocationSortingRule(LOCATION_SORTING_RULE.PICKING_PRODUCT.value)
650
+ let data = [await locationSortingTask, await enableBinPickingTask]
651
+
652
+ this.locationSortingRules = await locationSortingTask
653
+ this._hasBinPicking = await enableBinPickingTask
567
654
  }
568
655
 
569
656
  autoFetchPickingTasks(orderNo) {
570
657
  this.releaseGoodNoInput.value = orderNo
571
- this._fetchInventories(this.releaseGoodNoInput.value)
572
- this._fetchPalletsHandler(this.releaseGoodNoInput.value)
658
+ this.fetchAll(this.releaseGoodNoInput.value)
573
659
  }
574
660
 
575
- async _fetchInventories(pickingRefNo) {
661
+ async fetchInventories(pickingRefNo) {
576
662
  if (!pickingRefNo) return
577
663
 
578
664
  let response
@@ -583,6 +669,9 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
583
669
  query pickingWorksheet($releaseGoodNo: String!, $locationSortingRules: [Sorting!]) {
584
670
  pickingWorksheet(releaseGoodNo: $releaseGoodNo, locationSortingRules: $locationSortingRules) {
585
671
  worksheetInfo {
672
+ releaseGood {
673
+ name
674
+ }
586
675
  bizplaceName
587
676
  partnerDomainId
588
677
  refNo
@@ -602,6 +691,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
602
691
  sku
603
692
  name
604
693
  description
694
+ isRequireSerialNumberScanning
605
695
  }
606
696
  qty
607
697
  releaseQty
@@ -616,14 +706,24 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
616
706
  name
617
707
  description
618
708
  }
709
+ binLocation {
710
+ name
711
+ description
712
+ }
619
713
  relatedOrderInv {
714
+ id
620
715
  batchId
621
716
  batchIdRef
622
717
  packingType
718
+ binLocation {
719
+ id
720
+ name
721
+ }
623
722
  product {
624
723
  sku
625
724
  name
626
725
  description
726
+ isRequireSerialNumberScanning
627
727
  }
628
728
  }
629
729
  }
@@ -634,34 +734,42 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
634
734
  })
635
735
 
636
736
  if (!response.errors) {
637
- if (!this._selectedOrderInventory) this._clearView()
638
- this.releaseGoodNo = pickingRefNo
737
+ if (!this._selectedOrderInventory) this.clearView()
738
+ this.releaseGoodNo = response.data.pickingWorksheet.worksheetInfo.releaseGood.name
639
739
  if (!response.data?.pickingWorksheet) return
640
740
 
641
741
  const { worksheetInfo, worksheetDetailInfos } = response.data.pickingWorksheet
642
- this.crossDocking = worksheetInfo.releaseGood?.crossDocking
643
- this._fillUpForm(this.infoForm, { ...worksheetInfo, crossDocking: this.crossDocking })
742
+ this._crossDocking = worksheetInfo.releaseGood?._crossDocking
743
+ this.fillUpForm(this.infoForm, { ...worksheetInfo, _crossDocking: this._crossDocking })
644
744
  this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
745
+
645
746
  if (this._selectedOrderInventory) {
646
747
  const record = this.data.records.find(record => record.name === this._selectedOrderInventory.name)
748
+ this.updateSelectedItemProp(record)
749
+ await this.updateComplete
750
+ this.fillUpForm(this.inputForm, {
751
+ ...record,
752
+ binLocation: record?.binLocation ? record.binLocation : ''
753
+ })
754
+
647
755
  if (record.pickedQty == record.releaseQty) {
648
- if (this._isCartonLabel && this.scannable) {
649
- this.cartonInput.value = ''
650
- this._focusOnCartonNoInput()
651
- }
652
- this._selectedOrderInventory = null
653
- this._selectedTaskStatus = null
654
- this.inputForm.reset()
756
+ if (this.cartonInput) this.cartonInput.value = ''
757
+ if (this.palletInput) this.palletInput.value = ''
758
+ // this.isWholePicking = true
655
759
  } else {
656
- if (this._enableProductScanning) this._focusOnProductBarcodeInput()
657
- this._fillUpForm(this.inputForm, record)
760
+ // pre-set bin location from last scan if none was set
761
+ if (
762
+ this._hasBinPicking &&
763
+ this.binLocationInput &&
764
+ (!this._currentBinLocation || this._currentBinLocation == '')
765
+ ) {
766
+ this._currentBinLocation = record?.binLocation ? record.binLocation : ''
767
+ }
768
+ this.focusOnInput()
658
769
  }
659
770
  }
660
- this._completeHandler()
661
771
 
662
772
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
663
-
664
- this._hasBinPicking = await fetchSettingRule('enable-bin-picking', worksheetInfo.partnerDomainId)
665
773
  }
666
774
  break
667
775
 
@@ -684,6 +792,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
684
792
  name
685
793
  description
686
794
  sku
795
+ isRequireSerialNumberScanning
687
796
  }
688
797
  qty
689
798
  releaseQty
@@ -716,49 +825,54 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
716
825
  })
717
826
 
718
827
  if (!response.errors) {
719
- if (!this._selectedOrderInventory) this._clearView()
828
+ if (!this._selectedOrderInventory) this.clearView()
720
829
  this.taskNo = pickingRefNo
721
830
  if (!response.data?.batchPickingWorksheet) return
722
831
 
723
832
  const { worksheetInfo, worksheetDetailInfos } = response.data.batchPickingWorksheet
724
- this._fillUpForm(this.infoForm, { ...worksheetInfo })
833
+ await this.updateComplete
834
+ this.fillUpForm(this.infoForm, { ...worksheetInfo })
725
835
  this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
836
+
837
+ this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
838
+
726
839
  if (this._selectedOrderInventory) {
727
840
  const record = this.data.records.find(
728
841
  record => record.product.sku === this._selectedOrderInventory.product.sku
729
842
  )
843
+
844
+ this.updateSelectedItemProp(record)
845
+
730
846
  if (record.pickedQty == record.releaseQty) {
731
847
  if (this._isCartonLabel) {
732
848
  this.cartonInput.value = ''
733
849
  this._focusOnCartonNoInput()
734
850
  }
735
- this._selectedOrderInventory = null
736
851
  this.inputForm.reset()
737
852
  } else {
738
- if (this._enableProductScanning) this._focusOnProductBarcodeInput()
739
- this._fillUpForm(this.inputForm, record)
853
+ this._focusOnProductBarcodeInput()
854
+ this.fillUpForm(this.inputForm, record)
740
855
  }
741
856
  }
742
- this._completeHandler()
743
-
744
- this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
745
-
746
- this._hasBinPicking = await fetchSettingRule('enable-bin-picking', worksheetInfo.partnerDomainId)
747
857
  }
748
858
  break
749
859
  }
860
+
861
+ this.updateContext()
750
862
  }
751
863
 
752
864
  formatWorksheetDetailInfos(wsdInfos) {
753
865
  return wsdInfos
754
866
  .map(record => {
755
- record.completed = Boolean(record?.status)
756
- ? record.status === WORKSHEET_STATUS.DONE.value
757
- : record.pickedQty == record.releaseQty
867
+ if (record.pickedQty == record.releaseQty) {
868
+ record.completed = true
869
+ } else {
870
+ record.completed = false
871
+ }
758
872
  record.locationName = record?.location?.name
759
873
  record.product = record?.relatedOrderInv && record?.relatedOrderInv?.product
760
874
 
761
- if (this.crossDocking) {
875
+ if (this._crossDocking) {
762
876
  record.batchId = record.relatedOrderInv.batchId
763
877
  record.packingType = record.relatedOrderInv.packingType
764
878
  }
@@ -779,10 +893,10 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
779
893
  .sort((a, b) => a.completed - b.completed)
780
894
  }
781
895
 
782
- async _fetchPalletsHandler(releaseGoodNo) {
896
+ async fetchPalletsHandler(releaseGoodNo) {
783
897
  const response = await client.query({
784
898
  query: gql`
785
- query pallets($filters: [Filter!], $pagination: Pagination) {
899
+ query pallets($filters: [Filter!]!, $pagination: Pagination) {
786
900
  pallets(filters: $filters, pagination: $pagination) {
787
901
  items {
788
902
  id
@@ -813,21 +927,23 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
813
927
  }
814
928
  }
815
929
 
816
- _clearView() {
930
+ clearView() {
817
931
  this.data = { records: [] }
818
932
  this.infoForm.reset()
819
933
  this.inputForm.reset()
820
934
  this._productName = ''
821
- this.releaseGoodNo = ''
822
- this.taskNo = ''
823
- this.crossDocking = false
935
+ this._isRequireSerialNumberScanning = false
936
+ this.releaseGoodNo = null
937
+ this.taskNo = null
938
+ this._crossDocking = false
824
939
  this._selectedOrderInventory = null
825
- this._selectedTaskStatus = null
826
- this.incompleteLocationName = false
940
+ // this._selectedTaskStatus = null
941
+ this._incompleteLocationName = false
942
+ this._isExecuting = false
827
943
  }
828
944
 
829
- _fillUpForm(form, data) {
830
- this.incompleteLocationName = false
945
+ fillUpForm(form, data) {
946
+ this._incompleteLocationName = false
831
947
  form.reset()
832
948
  for (let key in data) {
833
949
  Array.from(form.querySelectorAll('input')).forEach(field => {
@@ -849,40 +965,43 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
849
965
  }
850
966
  }
851
967
 
852
- async _picking(e) {
968
+ async picking(e) {
853
969
  if (e.keyCode === 13) {
854
970
  try {
855
- await this._validatePicking()
971
+ await this.validatePicking()
856
972
 
857
- let response
973
+ let response = {}
858
974
  if (this.crossDocking) {
859
975
  response = await this.pickCrossDocking()
860
976
  } else if (this._enableProductScanning || this._isCartonLabel) {
861
977
  response = await this.productBarcodePicking()
862
978
  } else {
863
- if (this.isReplacement) {
979
+ if (this._isReplacement) {
864
980
  this.openPalletReplacementPopup()
981
+ return
865
982
  } else {
866
983
  response = await this.pickCommonPicking()
867
984
  }
868
985
  }
869
986
 
870
987
  if (!response.errors) {
871
- this._isExecuting = false
872
- if (this._enableProductScanning) this.productBarcodeInput.value = ''
988
+ if (this._isRequireSerialNumberScanning) this.serialInput.value = ''
989
+ else if (this._enableProductScanning && !this._isRequireSerialNumberScanning)
990
+ this.productBarcodeInput.value = ''
873
991
  else this.releaseQtyInput.value = ''
874
992
 
875
- if (!this._isCartonLabel) {
993
+ if (!this._isCartonLabel && !this._isRequireSerialNumberScanning) {
876
994
  this.palletInput.value = ''
877
- this._selectedTaskStatus = null
995
+ // this._selectedTaskStatus = null
878
996
  this._selectedOrderInventory = null
879
997
  }
880
998
 
881
- if (!this.isWholePicking && !this.crossDocking && !this._isCartonLabel) this.locationInput.value = ''
999
+ if (!this.isWholePicking && !this._crossDocking && !this._isCartonLabel && this.locationInput)
1000
+ this.locationInput.value = ''
882
1001
  if (this.refPickingType === PICKING_TYPES.PICKING.value) {
883
- this._fetchInventories(this.releaseGoodNo)
1002
+ this.fetchInventories(this.releaseGoodNo)
884
1003
  } else {
885
- this._fetchInventories(this.taskNo)
1004
+ this.fetchInventories(this.taskNo)
886
1005
  }
887
1006
  }
888
1007
 
@@ -890,6 +1009,9 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
890
1009
  } catch (e) {
891
1010
  this._showToast(e)
892
1011
  }
1012
+ // finally {
1013
+ // this._isExecuting = false
1014
+ // }
893
1015
  }
894
1016
  }
895
1017
 
@@ -902,15 +1024,16 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
902
1024
  .replacePalletId="${this.palletInput.value}"
903
1025
  @completed="${() => {
904
1026
  if (this.refPickingType === PICKING_TYPES.PICKING.value) {
905
- this._fetchInventories(this.releaseGoodNoInput.value)
906
- this._fetchPalletsHandler(this.releaseGoodNoInput.value)
1027
+ this.fetchInventories(this.releaseGoodNoInput.value)
1028
+ this.fetchPalletsHandler(this.releaseGoodNoInput.value)
907
1029
  } else {
908
- this._fetchInventories(this.taskNoInput.value)
909
- this._fetchPalletsHandler(this.taskNoInput.value)
1030
+ this.fetchInventories(this.taskNoInput.value)
1031
+ this.fetchPalletsHandler(this.taskNoInput.value)
910
1032
  }
911
- this._selectedTaskStatus = null
1033
+ // this._selectedTaskStatus = null
912
1034
  this._selectedOrderInventory = null
913
1035
  this.isReplacement = false
1036
+ this._isExecuting = false
914
1037
  }}"
915
1038
  ></picking-replacement-popup>
916
1039
  `,
@@ -922,8 +1045,34 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
922
1045
  )
923
1046
  }
924
1047
 
925
- async pickCrossDocking() {
926
- this._isExecuting = true
1048
+ openSerialNumberPopup() {
1049
+ openPopup(
1050
+ html`
1051
+ <serial-number-popup
1052
+ .orderInventory="${this?._selectedOrderInventory?.relatedOrderInv}"
1053
+ @completed="${() => {
1054
+ // if (this.refPickingType === PICKING_TYPES.PICKING.value) {
1055
+ // this.fetchInventories(this.releaseGoodNoInput.value)
1056
+ // this.fetchPalletsHandler(this.releaseGoodNoInput.value)
1057
+ // } else {
1058
+ // this.fetchInventories(this.taskNoInput.value)
1059
+ // this.fetchPalletsHandler(this.taskNoInput.value)
1060
+ // }
1061
+ // // this._selectedTaskStatus = null
1062
+ // this._selectedOrderInventory = null
1063
+ // this._isReplacement = false
1064
+ }}"
1065
+ ></serial-number-popup>
1066
+ `,
1067
+ {
1068
+ backdrop: true,
1069
+ size: 'large',
1070
+ title: i18next.t('title.serial_number_list')
1071
+ }
1072
+ )
1073
+ }
1074
+
1075
+ async pick_crossDocking() {
927
1076
  return await client.mutate({
928
1077
  mutation: gql`
929
1078
  mutation crossDockPicking(
@@ -950,170 +1099,214 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
950
1099
  }
951
1100
 
952
1101
  async pickCommonPicking() {
953
- const locationName = this.isWholePicking ? this._selectedOrderInventory.location.name : this.locationInput.value
954
- // 1. Check whether location is changed
955
- if (this._selectedOrderInventory.location.name !== locationName) {
956
- this.locationNameSplit = this.locationInput.value.split('-')
957
- const zonePortions = this.locationNameSplit[0].match(/[a-zA-Z0-9]+/g)
958
- const rowPortions = this.locationNameSplit[1].match(/[a-zA-Z0-9]+/g)
959
- const columnPortions = this.locationNameSplit[2].match(/[a-zA-Z0-9]+/g)
960
-
961
- if (this.locationNameSplit.length === 3) {
962
- this.incompleteLocationName = true
963
- this.locations = await this._fetchLocations(zonePortions[0], rowPortions[0], columnPortions[0])
964
- this._focusOnNewLocationInput()
965
- throw new Error(i18next.t('text.please_select_the_location_again'))
966
- } else if (this.locationNameSplit.length === 4) {
967
- const result = await CustomAlert({
968
- title: i18next.t('title.relocate'),
969
- text: i18next.t('text.are_you_sure'),
970
- confirmButton: { text: i18next.t('button.relocate') },
971
- cancelButton: { text: i18next.t('button.cancel') }
972
- })
973
-
974
- if (!result.value) {
975
- this.incompleteLocationName = false
976
- this.locationNameSplit = []
977
- return
978
- }
979
- }
980
- }
1102
+ if (this._isExecuting === false) {
1103
+ this._isExecuting = true
981
1104
 
982
- this._isExecuting = true
983
- switch (this.refPickingType) {
984
- case PICKING_TYPES.PICKING.value:
985
- return await client.mutate({
986
- mutation: gql`
987
- mutation picking(
988
- $worksheetDetailName: String!
989
- $worksheetType: String!
990
- $palletId: String
991
- $locationName: String!
992
- $releaseQty: Int!
993
- ) {
994
- picking(
995
- worksheetDetailName: $worksheetDetailName
996
- worksheetType: $worksheetType
997
- palletId: $palletId
998
- locationName: $locationName
999
- releaseQty: $releaseQty
1000
- )
1105
+ try {
1106
+ const locationName =
1107
+ this.isWholePicking || !this.locationInput
1108
+ ? this._selectedOrderInventory.location.name
1109
+ : this.locationInput.value
1110
+ // 1. Check whether location is changed
1111
+ if (this._selectedOrderInventory.location.name !== locationName) {
1112
+ this.locationNameSplit = this.locationInput.value.split('-')
1113
+ const zonePortions = this.locationNameSplit[0].match(/[a-zA-Z0-9]+/g)
1114
+ const rowPortions = this.locationNameSplit[1].match(/[a-zA-Z0-9]+/g)
1115
+ const columnPortions = this.locationNameSplit[2].match(/[a-zA-Z0-9]+/g)
1116
+
1117
+ if (this.locationNameSplit.length === 3) {
1118
+ this._incompleteLocationName = true
1119
+ this.locations = await this.fetchLocations(zonePortions[0], rowPortions[0], columnPortions[0])
1120
+ this._focusOnNewLocationInput()
1121
+ throw new Error(i18next.t('text.please_select_the_location_again'))
1122
+ } else if (this.locationNameSplit.length === 4) {
1123
+ let relocateConfirmation = await CustomAlert({
1124
+ title: i18next.t('title.relocate'),
1125
+ text: i18next.t('text.are_you_sure'),
1126
+ confirmButton: { text: i18next.t('button.relocate') },
1127
+ cancelButton: { text: i18next.t('button.cancel') }
1128
+ })
1129
+
1130
+ if (!relocateConfirmation.isConfirmed) {
1131
+ this._incompleteLocationName = false
1132
+ this.locationNameSplit = []
1133
+ return false
1001
1134
  }
1002
- `,
1003
- variables: {
1004
- worksheetDetailName: this._selectedOrderInventory.name,
1005
- worksheetType: this.refPickingType,
1006
- palletId: this.palletInput.value.trim(),
1007
- locationName,
1008
- releaseQty: parseInt(this.releaseQtyInput.value)
1009
1135
  }
1010
- })
1136
+ }
1011
1137
 
1012
- case PICKING_TYPES.BATCH_PICKING.value:
1013
- return await client.mutate({
1014
- mutation: gql`
1015
- mutation batchPicking(
1016
- $taskNo: String!
1017
- $worksheetType: String!
1018
- $palletId: String!
1019
- $locationName: String
1020
- $binLocationName: String
1021
- $releaseQty: Int!
1022
- ) {
1023
- batchPicking(
1024
- taskNo: $taskNo
1025
- worksheetType: $worksheetType
1026
- palletId: $palletId
1027
- locationName: $locationName
1028
- binLocationName: $binLocationName
1029
- releaseQty: $releaseQty
1030
- )
1031
- }
1032
- `,
1033
- variables: {
1034
- taskNo: this.taskNo,
1035
- worksheetType: this.refPickingType,
1036
- palletId: this.palletInput.value.trim(),
1037
- locationName,
1038
- binLocationName: this._hasBinPicking ? this.binLocationInput.value : null,
1039
- releaseQty: parseInt(this.releaseQtyInput.value)
1040
- }
1041
- })
1138
+ switch (this.refPickingType) {
1139
+ case PICKING_TYPES.PICKING.value:
1140
+ return (
1141
+ await client.mutate({
1142
+ mutation: gql`
1143
+ mutation picking(
1144
+ $worksheetDetailName: String!
1145
+ $worksheetType: String!
1146
+ $palletId: String
1147
+ $locationName: String!
1148
+ $releaseQty: Int!
1149
+ $binLocation: String
1150
+ $serialNumber: String
1151
+ ) {
1152
+ picking(
1153
+ worksheetDetailName: $worksheetDetailName
1154
+ worksheetType: $worksheetType
1155
+ palletId: $palletId
1156
+ locationName: $locationName
1157
+ releaseQty: $releaseQty
1158
+ binLocation: $binLocation
1159
+ serialNumber: $serialNumber
1160
+ )
1161
+ }
1162
+ `,
1163
+ variables: {
1164
+ worksheetDetailName: this._selectedOrderInventory.name,
1165
+ worksheetType: this.refPickingType,
1166
+ palletId: this.palletInput.value.trim(),
1167
+ locationName,
1168
+ releaseQty: this._isRequireSerialNumberScanning ? 1 : parseInt(this.releaseQtyInput.value),
1169
+ binLocation: this._hasBinPicking ? this.binLocationInput.value : null,
1170
+ serialNumber: this._isRequireSerialNumberScanning ? this.serialInput.value : null
1171
+ }
1172
+ }),
1173
+ (this._isExecuting = false)
1174
+ )
1175
+
1176
+ case PICKING_TYPES.BATCH_PICKING.value:
1177
+ return (
1178
+ await client.mutate({
1179
+ mutation: gql`
1180
+ mutation batchPicking(
1181
+ $taskNo: String!
1182
+ $worksheetType: String!
1183
+ $palletId: String!
1184
+ $locationName: String
1185
+ $binLocationName: String
1186
+ $releaseQty: Int!
1187
+ ) {
1188
+ batchPicking(
1189
+ taskNo: $taskNo
1190
+ worksheetType: $worksheetType
1191
+ palletId: $palletId
1192
+ locationName: $locationName
1193
+ binLocationName: $binLocationName
1194
+ releaseQty: $releaseQty
1195
+ )
1196
+ }
1197
+ `,
1198
+ variables: {
1199
+ taskNo: this.taskNo,
1200
+ worksheetType: this.refPickingType,
1201
+ palletId: this.palletInput.value.trim(),
1202
+ locationName,
1203
+ binLocationName: this._hasBinPicking ? this.binLocationInput.value : null,
1204
+ releaseQty: parseInt(this.releaseQtyInput.value)
1205
+ }
1206
+ }),
1207
+ (this._isExecuting = false)
1208
+ )
1209
+ }
1210
+ } catch (e) {
1211
+ this._showToast(e)
1212
+ }
1213
+ } else {
1214
+ throw new Error(i18next.t('text.previous_picking_is_still_executing_please_wait'))
1042
1215
  }
1043
1216
  }
1044
1217
 
1045
1218
  async productBarcodePicking() {
1046
- this._isExecuting = true
1047
- switch (this.refPickingType) {
1048
- case PICKING_TYPES.PICKING.value:
1049
- return await client.mutate({
1050
- mutation: gql`
1051
- mutation scanProductPicking(
1052
- $worksheetDetailName: String!
1053
- $worksheetType: String!
1054
- $productBarcode: String!
1055
- $cartonId: String!
1056
- $binLocation: String
1057
- ) {
1058
- scanProductPicking(
1059
- worksheetDetailName: $worksheetDetailName
1060
- worksheetType: $worksheetType
1061
- productBarcode: $productBarcode
1062
- cartonId: $cartonId
1063
- binLocation: $binLocation
1064
- )
1065
- }
1066
- `,
1067
- variables: {
1068
- worksheetDetailName: this._selectedOrderInventory.name,
1069
- worksheetType: this.refPickingType,
1070
- productBarcode: this.productBarcodeInput.value.trim(),
1071
- cartonId: this.cartonInput.value.trim(),
1072
- binLocation: this._hasBinPicking ? this.binLocationInput.value : null
1073
- }
1074
- })
1219
+ if (this._isExecuting === false) {
1220
+ this._isExecuting = true
1075
1221
 
1076
- case PICKING_TYPES.BATCH_PICKING.value:
1077
- return await client.mutate({
1078
- mutation: gql`
1079
- mutation scanProductBatchPicking(
1080
- $taskNo: String!
1081
- $worksheetType: String!
1082
- $cartonId: String!
1083
- $inventory: InventoryPatch!
1084
- $productBarcode: String!
1085
- $binLocationName: String
1086
- ) {
1087
- scanProductBatchPicking(
1088
- taskNo: $taskNo
1089
- worksheetType: $worksheetType
1090
- cartonId: $cartonId
1091
- inventory: $inventory
1092
- productBarcode: $productBarcode
1093
- binLocationName: $binLocationName
1094
- )
1095
- }
1096
- `,
1097
- variables: {
1098
- taskNo: this.taskNo,
1099
- worksheetType: this.refPickingType,
1100
- cartonId: this.cartonInput.value.trim(),
1101
- productBarcode: this.productBarcodeInput.value.trim(),
1102
- inventory: {
1103
- batchId: this._selectedOrderInventory.batchId,
1104
- packingType: this._selectedOrderInventory.packingType,
1105
- packingSize: this._selectedOrderInventory.packingSize,
1106
- product: { id: this._selectedOrderInventory.product.id }
1107
- },
1108
- binLocationName: this._hasBinPicking ? this.binLocationInput.value : null
1109
- }
1110
- })
1222
+ try {
1223
+ switch (this.refPickingType) {
1224
+ case PICKING_TYPES.PICKING.value:
1225
+ return (
1226
+ await client.mutate({
1227
+ mutation: gql`
1228
+ mutation scanProductPicking(
1229
+ $worksheetDetailName: String!
1230
+ $worksheetType: String!
1231
+ $productBarcode: String!
1232
+ $cartonId: String!
1233
+ $binLocation: String
1234
+ $serialNumber: String
1235
+ ) {
1236
+ scanProductPicking(
1237
+ worksheetDetailName: $worksheetDetailName
1238
+ worksheetType: $worksheetType
1239
+ productBarcode: $productBarcode
1240
+ cartonId: $cartonId
1241
+ binLocation: $binLocation
1242
+ serialNumber: $serialNumber
1243
+ )
1244
+ }
1245
+ `,
1246
+ variables: {
1247
+ worksheetDetailName: this._selectedOrderInventory.name,
1248
+ worksheetType: this.refPickingType,
1249
+ productBarcode: this.productBarcodeInput.value.trim(),
1250
+ cartonId: this.cartonInput.value.trim(),
1251
+ serialNumber: this._isRequireSerialNumberScanning ? this.serialInput.value : null,
1252
+ binLocation: this._hasBinPicking ? this.binLocationInput.value : null
1253
+ }
1254
+ }),
1255
+ (this._isExecuting = false)
1256
+ )
1257
+
1258
+ case PICKING_TYPES.BATCH_PICKING.value:
1259
+ return (
1260
+ await client.mutate({
1261
+ mutation: gql`
1262
+ mutation scanProductBatchPicking(
1263
+ $taskNo: String!
1264
+ $worksheetType: String!
1265
+ $cartonId: String!
1266
+ $inventory: InventoryPatch!
1267
+ $productBarcode: String!
1268
+ $binLocationName: String
1269
+ ) {
1270
+ scanProductBatchPicking(
1271
+ taskNo: $taskNo
1272
+ worksheetType: $worksheetType
1273
+ cartonId: $cartonId
1274
+ inventory: $inventory
1275
+ productBarcode: $productBarcode
1276
+ binLocationName: $binLocationName
1277
+ )
1278
+ }
1279
+ `,
1280
+ variables: {
1281
+ taskNo: this.taskNo,
1282
+ worksheetType: this.refPickingType,
1283
+ cartonId: this.cartonInput.value.trim(),
1284
+ productBarcode: this.productBarcodeInput.value.trim(),
1285
+ inventory: {
1286
+ batchId: this._selectedOrderInventory.batchId,
1287
+ packingType: this._selectedOrderInventory.packingType,
1288
+ packingSize: this._selectedOrderInventory.packingSize,
1289
+ product: { id: this._selectedOrderInventory.product.id }
1290
+ },
1291
+ binLocationName: this._hasBinPicking ? this.binLocationInput.value : null
1292
+ }
1293
+ }),
1294
+ (this._isExecuting = false)
1295
+ )
1296
+ }
1297
+ } catch (e) {
1298
+ this._showToast(e)
1299
+ }
1300
+ } else {
1301
+ throw new Error(i18next.t('text.previous_picking_is_still_executing_please_wait'))
1111
1302
  }
1112
1303
  }
1113
1304
 
1114
- async _validatePicking() {
1305
+ async validatePicking() {
1115
1306
  // validate for previous picking execution (multiple picking scanning)
1116
- if (this._isExecuting) throw new Error(i18next.t('text.previous_picking_is_still_executing_please_wait'))
1307
+ // if (this._isExecuting) throw new Error(i18next.t('text.previous_picking_is_still_executing_please_wait'))
1308
+
1309
+ // this._isExecuting = true
1117
1310
 
1118
1311
  // validate for order selection
1119
1312
  if (!this._selectedOrderInventory) throw new Error(i18next.t('text.target_is_not_selected'))
@@ -1128,39 +1321,46 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1128
1321
  const isInProgressing = await this.checkProgressingPallet(this.palletInput.value)
1129
1322
  if (isInProgressing) throw new Error(i18next.t('text.pallet_is_in_progressing'))
1130
1323
 
1131
- this.isReplacement = await this.checkProductIdenticality(
1324
+ this._isReplacement = await this.checkProductIdenticality(
1132
1325
  this._selectedOrderInventory.palletId,
1133
1326
  this.palletInput.value
1134
1327
  )
1135
1328
 
1136
- if (!this.isReplacement) {
1329
+ if (!this._isReplacement) {
1137
1330
  this._focusOnLotNoInput()
1138
1331
  throw new Error(i18next.t('text.wrong_lot_id'))
1139
- } else {
1140
- this.openPalletReplacementPopup()
1141
1332
  }
1142
1333
  }
1143
1334
  }
1144
1335
 
1145
1336
  // Release qty existing
1146
- if (!this.isReplacement) {
1147
- if (!parseInt(this.releaseQtyInput?.value)) {
1148
- this._focusOnReleaseQtyInput()
1149
- throw new Error(i18next.t('text.release_qty_is_empty'))
1150
- }
1337
+ if (!this._isReplacement) {
1338
+ if (!this._isRequireSerialNumberScanning) {
1339
+ if (!parseInt(this.releaseQtyInput?.value)) {
1340
+ this._focusOnReleaseQtyInput()
1341
+ throw new Error(i18next.t('text.release_qty_is_empty'))
1342
+ }
1343
+
1344
+ if (!this.releaseQtyInput.checkValidity()) throw new Error(i18next.t('text.release_qty_invalid'))
1151
1345
 
1152
- if (!this.releaseQtyInput.checkValidity()) throw new Error(i18next.t('text.release_qty_invalid'))
1346
+ // typed qty should be matched with release qty.
1153
1347
 
1154
- // typed qty should be matched with release qty.
1155
- if (parseInt(this.releaseQtyInput.value) !== this._selectedOrderInventory.releaseQty) {
1156
- this._focusOnReleaseQtyInput()
1157
- throw new Error(i18next.t('text.wrong_release_qty'))
1348
+ if (
1349
+ parseInt(this.releaseQtyInput.value) !==
1350
+ this._selectedOrderInventory.releaseQty -
1351
+ (this._selectedOrderInventory.pickedQty ? this._selectedOrderInventory.pickedQty : 0)
1352
+ ) {
1353
+ this._focusOnReleaseQtyInput()
1354
+ throw new Error(i18next.t('text.wrong_release_qty'))
1355
+ }
1158
1356
  }
1159
1357
 
1160
1358
  // location id existing
1161
- if (!this.isWholePicking && !this.locationInput.value) {
1162
- this._focusOnLocationNameInput()
1163
- throw new Error(i18next.t('text.location_id_is_empty'))
1359
+ if (!this.isWholePicking && this.locationInput) {
1360
+ if (!this.locationInput.value) {
1361
+ this._focusOnLocationNameInput()
1362
+ throw new Error(i18next.t('text.location_id_is_empty'))
1363
+ }
1164
1364
  }
1165
1365
  }
1166
1366
  } else {
@@ -1171,13 +1371,13 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1171
1371
 
1172
1372
  if (this._selectedOrderInventory.cartonId) {
1173
1373
  if (this._selectedOrderInventory.cartonId !== this.cartonInput.value) {
1174
- this.isReplacement = await this.checkCartonIdenticality(
1374
+ this._isReplacement = await this.checkCartonIdenticality(
1175
1375
  this._selectedOrderInventory.cartonId,
1176
1376
  this._selectedOrderInventory.palletId,
1177
1377
  this.cartonInput.value
1178
1378
  )
1179
1379
 
1180
- if (!this.isReplacement) {
1380
+ if (!this._isReplacement) {
1181
1381
  this.cartonInput.value = ''
1182
1382
  this._focusOnCartonNoInput()
1183
1383
  throw new Error(i18next.t('text.wrong_carton_id'))
@@ -1193,7 +1393,14 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1193
1393
  }
1194
1394
  }
1195
1395
 
1196
- if (this.crossDocking) {
1396
+ if (this._isRequireSerialNumberScanning) {
1397
+ if (!this.serialInput?.value) {
1398
+ this._focusOnSerialInput()
1399
+ throw new Error(i18next.t('text.empty_serial_number'))
1400
+ }
1401
+ }
1402
+
1403
+ if (this._crossDocking) {
1197
1404
  // typed qty should be smaller than release qty.
1198
1405
  if (parseInt(this.releaseQtyInput.value) > this._selectedOrderInventory.releaseQty) {
1199
1406
  this._focusOnReleaseQtyInput()
@@ -1247,7 +1454,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1247
1454
  }
1248
1455
  }
1249
1456
 
1250
- async _fetchLocations(zone, row, column) {
1457
+ async fetchLocations(zone, row, column) {
1251
1458
  const sortings = [{ name: 'name', desc: false }]
1252
1459
  const filters = [
1253
1460
  { name: 'zone', operator: 'eq', value: zone },
@@ -1281,7 +1488,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1281
1488
  }
1282
1489
  }
1283
1490
 
1284
- async _completeHandler() {
1491
+ async completeHandler() {
1285
1492
  if (!this.data?.records?.length || this.data.records.some(record => !record.completed)) return
1286
1493
 
1287
1494
  this.updateContext()
@@ -1292,14 +1499,14 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1292
1499
  cancelButton: { text: i18next.t('button.cancel') }
1293
1500
  })
1294
1501
 
1295
- if (!result.value) {
1502
+ if (!result?.value) {
1296
1503
  return
1297
1504
  }
1298
1505
 
1299
- this._complete()
1506
+ this.complete()
1300
1507
  }
1301
1508
 
1302
- async _complete() {
1509
+ async complete() {
1303
1510
  let response
1304
1511
  switch (this.refPickingType) {
1305
1512
  case PICKING_TYPES.PICKING.value:
@@ -1326,27 +1533,29 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1326
1533
  }
1327
1534
 
1328
1535
  if (!response.errors) {
1329
- this._clearView()
1536
+ this.clearView()
1537
+ this._currentBinLocation = ''
1538
+ this._selectedOrderInventory = null
1330
1539
  await CustomAlert({
1331
1540
  title: i18next.t('title.picking'),
1332
1541
  text: i18next.t('text.picking_is_completed'),
1333
1542
  confirmButton: { text: i18next.t('button.confirm') }
1334
1543
  })
1335
1544
 
1336
- this._clearView()
1337
1545
  if (!this.orderNo) {
1338
1546
  if (this.refPickingType === PICKING_TYPES.PICKING.value) {
1339
1547
  this.releaseGoodNoInput.value = ''
1340
- navigate('single_outbound_worksheets')
1548
+ // navigate('single_outbound_worksheets')
1341
1549
  } else {
1342
1550
  this.taskNoInput.value = ''
1343
- navigate('merged_outbound_worksheets')
1551
+ // navigate('merged_outbound_worksheets')
1344
1552
  }
1345
1553
  }
1554
+ this.updateContext()
1346
1555
  }
1347
1556
  }
1348
1557
 
1349
- _openPalletOutbound() {
1558
+ openPalletOutbound() {
1350
1559
  openPopup(
1351
1560
  html`
1352
1561
  <outbound-reusable-pallet
@@ -1367,12 +1576,110 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1367
1576
 
1368
1577
  pickingTypeChangeHandler(currentType) {
1369
1578
  this.refPickingType = currentType
1370
- this._clearView()
1579
+ this.clearView()
1371
1580
 
1372
1581
  if (this.refPickingType === PICKING_TYPES.PICKING.value) this._focusOnReleaseGoodNoInput()
1373
1582
  else this._focusOnTaskNoInput()
1374
1583
  }
1375
1584
 
1585
+ async getTask() {
1586
+ try {
1587
+ const response = await client.mutate({
1588
+ mutation: gql`
1589
+ mutation fetchAndAssignPickingTask {
1590
+ fetchAndAssignPickingTask {
1591
+ worksheetInfo {
1592
+ bizplaceName
1593
+ partnerDomainId
1594
+ refNo
1595
+ refNo2
1596
+ startedAt
1597
+ releaseGood {
1598
+ name
1599
+ crossDocking
1600
+ }
1601
+ }
1602
+ worksheetDetailInfos {
1603
+ name
1604
+ palletId
1605
+ cartonId
1606
+ batchId
1607
+ batchIdRef
1608
+ product {
1609
+ sku
1610
+ name
1611
+ description
1612
+ }
1613
+ qty
1614
+ releaseQty
1615
+ pickedQty
1616
+ expirationDate
1617
+ status
1618
+ description
1619
+ targetName
1620
+ packingType
1621
+ packingSize
1622
+ location {
1623
+ name
1624
+ description
1625
+ }
1626
+ relatedOrderInv {
1627
+ batchId
1628
+ batchIdRef
1629
+ packingType
1630
+ product {
1631
+ sku
1632
+ name
1633
+ description
1634
+ }
1635
+ }
1636
+ }
1637
+ }
1638
+ }
1639
+ `,
1640
+ variables: {},
1641
+ context: gqlContext()
1642
+ })
1643
+
1644
+ if (!response.errors) {
1645
+ if (!this._selectedOrderInventory) this.clearView()
1646
+ // this.releaseGoodNo = pickingRefNo
1647
+ if (!response.data?.fetchAndAssignPickingTask) return
1648
+
1649
+ const { worksheetInfo, worksheetDetailInfos } = response.data.fetchAndAssignPickingTask
1650
+ this._crossDocking = worksheetInfo.releaseGood?._crossDocking
1651
+ this.releaseGoodNo = worksheetInfo.releaseGood?.name
1652
+ this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
1653
+
1654
+ this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
1655
+
1656
+ if (this._selectedOrderInventory) {
1657
+ const record = this.data.records.find(record => record.name === this._selectedOrderInventory.name)
1658
+ if (record.pickedQty == record.releaseQty) {
1659
+ if (this._isCartonLabel && this.scannable) {
1660
+ this.cartonInput.value = ''
1661
+ this._focusOnCartonNoInput()
1662
+ }
1663
+ this._selectedOrderInventory = null
1664
+ // this._selectedTaskStatus = null
1665
+ this.inputForm.reset()
1666
+ } else {
1667
+ this._focusOnProductBarcodeInput()
1668
+ this.fillUpForm(this.inputForm, record)
1669
+ }
1670
+ }
1671
+ this.fillUpForm(this.infoForm, { ...worksheetInfo, _crossDocking: this._crossDocking })
1672
+ }
1673
+ } catch (e) {
1674
+ this._showToast(e)
1675
+ }
1676
+ }
1677
+
1678
+ async fetchAll(orderNo) {
1679
+ await this.fetchInventories(orderNo)
1680
+ await this.fetchPalletsHandler(orderNo)
1681
+ }
1682
+
1376
1683
  showWorksheetList() {
1377
1684
  openPopup(html` <show-my-worksheet-list-popup></show-my-worksheet-list-popup> `, {
1378
1685
  backdrop: true,
@@ -1381,6 +1688,71 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1381
1688
  })
1382
1689
  }
1383
1690
 
1691
+ // Prioritized input focus
1692
+ focusOnInput() {
1693
+ if (this.scannable) {
1694
+ // set bin location value if already has value else focus on bin input if bin picking setting is active
1695
+ if (this._currentBinLocation) {
1696
+ this.binLocationInput.value = this._currentBinLocation
1697
+ }
1698
+
1699
+ if (this._hasBinPicking && this.binLocationInput && this.binLocationInput.value == '') {
1700
+ this._focusOnBinLocationInput()
1701
+ return true
1702
+ } else {
1703
+ if (this._isCartonLabel) {
1704
+ if (!this._enableProductScanning) this.cartonInput.value = ''
1705
+
1706
+ if (this.cartonInput.value == '') {
1707
+ this._focusOnCartonNoInput()
1708
+ return true
1709
+ }
1710
+ } else {
1711
+ if (!this._enableProductScanning && !this._isRequireSerialNumberScanning) this.palletInput.value = ''
1712
+
1713
+ if (this.palletInput.value == '') {
1714
+ this._focusOnLotNoInput()
1715
+ return true
1716
+ }
1717
+ }
1718
+ }
1719
+
1720
+ if (this._enableProductScanning && !this._isRequireSerialNumberScanning) {
1721
+ this.productBarcodeInput.value = ''
1722
+ this._focusOnProductBarcodeInput()
1723
+ return true
1724
+ }
1725
+
1726
+ if (this._isRequireSerialNumberScanning) {
1727
+ this.serialInput.value = ''
1728
+ this._focusOnSerialInput()
1729
+ return true
1730
+ }
1731
+
1732
+ return true
1733
+ }
1734
+ }
1735
+
1736
+ updateSelectedItemProp(selectedRecords) {
1737
+ if (selectedRecords.releaseQty === selectedRecords.qty) {
1738
+ this.isWholePicking = true
1739
+ this._selectedOrderInventory = selectedRecords
1740
+ } else {
1741
+ this.isWholePicking = false
1742
+ this._selectedOrderInventory = selectedRecords
1743
+ }
1744
+
1745
+ this._isCartonLabel = selectedRecords.hasCartonLabel
1746
+ this._productName = selectedRecords.product?.name
1747
+ ? `${selectedRecords.product.sku + ' - ' + selectedRecords.product.name} ${
1748
+ selectedRecords.product?.description ? `(${selectedRecords.product.description})` : ''
1749
+ }`
1750
+ : ''
1751
+ this._isRequireSerialNumberScanning = selectedRecords?.product?.isRequireSerialNumberScanning
1752
+
1753
+ // this.isWholePicking = selectedRecords.releaseQty === selectedRecords.qty
1754
+ }
1755
+
1384
1756
  _showToast({ type, message }) {
1385
1757
  document.dispatchEvent(
1386
1758
  new CustomEvent('notify', {