@things-factory/operato-wms 4.1.41 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/.eslintrc.json +11 -0
  2. package/client/pages/constants/index.js +1 -0
  3. package/client/pages/constants/inventory-item-change.js +10 -0
  4. package/client/pages/constants/order.js +5 -0
  5. package/client/pages/constants/picking-strategy.js +4 -0
  6. package/client/pages/constants/setting.js +1 -0
  7. package/client/pages/inbound/serial-number-list-popup.js +0 -1
  8. package/client/pages/inventory/inventory-adjustment-approval.js +34 -3
  9. package/client/pages/inventory/inventory-adjustment.js +144 -5
  10. package/client/pages/inventory/serial-number-list-popup.js +468 -0
  11. package/client/pages/master/pallet-list.js +24 -0
  12. package/client/pages/order/arrival-notice/edit-product-popup.js +13 -0
  13. package/client/pages/order/release-order/b2b/b2b-order-list.js +24 -1
  14. package/client/pages/order/release-order/batch-picking-popup.js +8 -0
  15. package/client/pages/outbound/inventory-assign-popup.js +3 -24
  16. package/client/pages/outbound/inventory-auto-assign-popup.js +25 -50
  17. package/client/pages/outbound/loading-product.js +3 -3
  18. package/client/pages/outbound/merged-outbound-worksheet.js +83 -16
  19. package/client/pages/outbound/packing-product.js +109 -9
  20. package/client/pages/outbound/picking-product.js +21 -8
  21. package/client/pages/outbound/picking-replacement-popup.js +5 -0
  22. package/client/pages/outbound/return-pallet-check-popup.js +7 -1
  23. package/client/pages/outbound/route-label-popup.js +464 -0
  24. package/client/pages/outbound/serial-number-popup.js +55 -26
  25. package/client/pages/outbound/single-outbound-worksheet.js +78 -11
  26. package/client/pages/outbound/sorting-product.js +125 -34
  27. package/client/pages/outbound/worksheet-batch-picking.js +3 -15
  28. package/client/pages/outbound/worksheet-picking.js +2 -6
  29. package/cypress/fixtures/globals.json +3 -0
  30. package/cypress/fixtures/master-data/location.json +31 -0
  31. package/cypress/fixtures/master-data/pallet.json +129 -0
  32. package/cypress/fixtures/master-data/palletImport.xlsx +0 -0
  33. package/cypress/fixtures/master-data/transport-driver.json +22 -0
  34. package/cypress/fixtures/master-data/transport-vehicle.json +24 -0
  35. package/cypress/fixtures/master-data/transportDriverDeletedImport.xlsx +0 -0
  36. package/cypress/fixtures/master-data/transportDriverImport.xlsx +0 -0
  37. package/cypress/fixtures/master-data/transportVehicleDeletedImport.xlsx +0 -0
  38. package/cypress/fixtures/master-data/transportVehicleImport.xlsx +0 -0
  39. package/cypress/fixtures/master-data/transportVehicleNameSizeImport.xlsx +0 -0
  40. package/cypress/fixtures/master-data/transportVehicleNameStatusImport.xlsx +0 -0
  41. package/cypress/fixtures/master-data/warehouse.json +20 -0
  42. package/cypress/fixtures/master-data/warehouseImport.xlsx +0 -0
  43. package/cypress/integration/master-data/location.spec.js +31 -0
  44. package/cypress/integration/master-data/pallet.spec.js +176 -0
  45. package/cypress/integration/master-data/transport-driver.spec.js +131 -0
  46. package/cypress/integration/master-data/transport-vehicle.spec.js +165 -0
  47. package/cypress/integration/master-data/warehouse.spec.js +135 -0
  48. package/cypress/plugins/index.js +22 -0
  49. package/cypress/support/commands.js +425 -0
  50. package/cypress/support/index.js +31 -0
  51. package/cypress.json +9 -0
  52. package/dist-server/graphql/resolvers/board-setting/board-settings.js +2 -1
  53. package/dist-server/graphql/resolvers/board-setting/board-settings.js.map +1 -1
  54. package/dist-server/opa-app-setting-constants.js +2 -1
  55. package/dist-server/opa-app-setting-constants.js.map +1 -1
  56. package/package.json +20 -10
  57. package/server/graphql/resolvers/board-setting/board-settings.ts +4 -2
  58. package/server/opa-app-setting-constants.ts +2 -1
  59. package/translations/en.json +13 -4
  60. package/translations/ko.json +12 -2
  61. package/translations/ms.json +11 -2
  62. package/translations/zh.json +11 -2
@@ -9,6 +9,8 @@ import { i18next, localize } from '@things-factory/i18n-base'
9
9
  import { client } from '@things-factory/shell'
10
10
  import { isMobileDevice } from '@things-factory/utils'
11
11
 
12
+ import { ORDER_SOURCES } from '../constants'
13
+
12
14
  class SerialNumberPopup extends localize(i18next)(LitElement) {
13
15
  static get styles() {
14
16
  return [
@@ -59,8 +61,11 @@ class SerialNumberPopup extends localize(i18next)(LitElement) {
59
61
  data: Object,
60
62
  orderId: String,
61
63
  orderType: String,
64
+ orderSource: String,
62
65
  _inventoryItems: Object,
63
- _selectedSerialNumber: Object
66
+ _selectedSerialNumber: Object,
67
+ enableRemove: Boolean,
68
+ enableUpdateBtn: Boolean
64
69
  }
65
70
  }
66
71
 
@@ -87,6 +92,8 @@ class SerialNumberPopup extends localize(i18next)(LitElement) {
87
92
  constructor() {
88
93
  super()
89
94
  this.clearView()
95
+ this.enableRemove = true
96
+ this.enableUpdateBtn = true
90
97
  }
91
98
 
92
99
  render() {
@@ -102,7 +109,7 @@ class SerialNumberPopup extends localize(i18next)(LitElement) {
102
109
  <input name="palletId" ${this?.data.palletId} disabled />
103
110
 
104
111
  <label>${i18next.t('label.location')}</label>
105
- <input name="locationName" ${this?.data.locationName} disabled />
112
+ <input name="locationName" ${this?.data.locationName ? this.data.locationName : ''} disabled />
106
113
  </fieldset>
107
114
  </form>
108
115
 
@@ -124,15 +131,20 @@ class SerialNumberPopup extends localize(i18next)(LitElement) {
124
131
  value="${this._selectedSerialNumber.serialNumber}"
125
132
  />
126
133
 
127
- <barcode-scanable-input name="serialNumber" class="mobile-full-width" custom-input></barcode-scanable-input>
128
-
129
- <mwc-button
130
- name="setSerialNumber"
131
- class="mobile-full-width"
132
- raised
133
- @click=${this.updateSerialNumber.bind(this)}
134
- label="${i18next.t('button.update')}"
135
- ></mwc-button>
134
+ ${this.enableUpdateBtn
135
+ ? html`<barcode-scanable-input
136
+ name="serialNumber"
137
+ class="mobile-full-width"
138
+ custom-input
139
+ ></barcode-scanable-input>
140
+ <mwc-button
141
+ name="setSerialNumber"
142
+ class="mobile-full-width"
143
+ raised
144
+ @click=${this.updateSerialNumber.bind(this)}
145
+ label="${i18next.t('button.update')}"
146
+ ></mwc-button>`
147
+ : ''}
136
148
  </form>
137
149
 
138
150
  <div class="button-container">
@@ -189,11 +201,13 @@ class SerialNumberPopup extends localize(i18next)(LitElement) {
189
201
  icon: 'close',
190
202
  handlers: {
191
203
  click: (columns, data, column, record, rowIndex) => {
192
- try {
193
- const newData = data.records.filter((_, idx) => idx !== rowIndex)
194
- this._inventoryItems = { ...this._inventoryItems, records: newData }
195
- this.undoSerialNumberPicking(record.id)
196
- } catch (e) {}
204
+ if (this.enableRemove) {
205
+ try {
206
+ const newData = data.records.filter((_, idx) => idx !== rowIndex)
207
+ this._inventoryItems = { ...this._inventoryItems, records: newData }
208
+ this.undoSerialNumberPicking(record.id)
209
+ } catch (e) {}
210
+ }
197
211
  }
198
212
  }
199
213
  },
@@ -304,17 +318,32 @@ class SerialNumberPopup extends localize(i18next)(LitElement) {
304
318
 
305
319
  async undoSerialNumberPicking(id) {
306
320
  try {
307
- const response = await client.mutate({
308
- mutation: gql`
309
- mutation undoSerialNumberPicking($worksheetDetailName: String!, $inventoryItemId: String!) {
310
- undoSerialNumberPicking(worksheetDetailName: $worksheetDetailName, inventoryItemId: $inventoryItemId)
321
+ let response
322
+ if (this.orderSource == ORDER_SOURCES.PICKING.value) {
323
+ response = await client.mutate({
324
+ mutation: gql`
325
+ mutation undoSerialNumberPicking($worksheetDetailName: String!, $inventoryItemId: String!) {
326
+ undoSerialNumberPicking(worksheetDetailName: $worksheetDetailName, inventoryItemId: $inventoryItemId)
327
+ }
328
+ `,
329
+ variables: {
330
+ worksheetDetailName: this.data.name,
331
+ inventoryItemId: id
311
332
  }
312
- `,
313
- variables: {
314
- worksheetDetailName: this.data.name,
315
- inventoryItemId: id
316
- }
317
- })
333
+ })
334
+ } else if (this.orderSource == ORDER_SOURCES.PACKING.value) {
335
+ response = await client.mutate({
336
+ mutation: gql`
337
+ mutation undoSerialNumberPacking($worksheetDetailName: String!, $inventoryItemId: String!) {
338
+ undoSerialNumberPacking(worksheetDetailName: $worksheetDetailName, inventoryItemId: $inventoryItemId)
339
+ }
340
+ `,
341
+ variables: {
342
+ worksheetDetailName: this.data.name,
343
+ inventoryItemId: id
344
+ }
345
+ })
346
+ }
318
347
 
319
348
  if (!response.errors) {
320
349
  this.dataGrist.fetch()
@@ -1,9 +1,9 @@
1
1
  import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
+ import './route-label-popup'
3
4
 
4
5
  import gql from 'graphql-tag'
5
6
  import { css, html } from 'lit-element'
6
- import { openPopup } from '@things-factory/layout-base'
7
7
 
8
8
  import './select-operator-popup'
9
9
  import { getCodeByName } from '@things-factory/code-base'
@@ -11,6 +11,9 @@ import { i18next, localize } from '@things-factory/i18n-base'
11
11
  import { client, navigate, PageView } from '@things-factory/shell'
12
12
  import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
13
13
  import { isMobileDevice } from '@things-factory/utils'
14
+ import { openPopup } from '@things-factory/layout-base'
15
+
16
+ import { fetchSettingRule } from '../../fetch-setting-value'
14
17
 
15
18
  import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../constants'
16
19
 
@@ -38,7 +41,10 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
38
41
 
39
42
  static get properties() {
40
43
  return {
44
+ _partnersList: Array,
41
45
  _searchFields: Array,
46
+ _routeLabelSetting: Boolean,
47
+ assignee: String,
42
48
  config: Object,
43
49
  data: Object,
44
50
  targetBizplace: Object,
@@ -60,6 +66,16 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
60
66
  }
61
67
 
62
68
  get context() {
69
+ var actions = []
70
+
71
+ if (this._routeLabelSetting) {
72
+ actions.push({
73
+ title: i18next.t('button.print_route_label'),
74
+ action: this._openPrintLabelPopup.bind(this),
75
+ ...CommonButtonStyles.label
76
+ })
77
+ }
78
+
63
79
  return {
64
80
  title: i18next.t('title.outbound_worksheet'),
65
81
  actions: [
@@ -73,8 +89,8 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
73
89
  name: i18next.t('title.outbound_worksheet'),
74
90
  data: this._exportableData.bind(this)
75
91
  },
76
-
77
- help: 'operato-wms/outbound/single-outbound-worksheet'
92
+ help: 'operato-wms/outbound/single-outbound-worksheet',
93
+ actions
78
94
  }
79
95
  }
80
96
 
@@ -370,7 +386,7 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
370
386
  items {
371
387
  id
372
388
  name
373
- assignee{
389
+ assignee {
374
390
  id
375
391
  name
376
392
  }
@@ -398,6 +414,10 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
398
414
  name
399
415
  description
400
416
  }
417
+ domain {
418
+ id
419
+ name
420
+ }
401
421
  }
402
422
  total
403
423
  }
@@ -411,6 +431,9 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
411
431
  })
412
432
 
413
433
  if (!response.errors) {
434
+ let domain = response.data.worksheets.items[0].domain
435
+ this._routeLabelSetting = await fetchSettingRule('enable-print-route-label', domain.id)
436
+ this.updateContext()
414
437
  return {
415
438
  total: response.data.worksheets.total || 0,
416
439
  records:
@@ -441,6 +464,10 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
441
464
  id
442
465
  name
443
466
  description
467
+ domain {
468
+ id
469
+ name
470
+ }
444
471
  }
445
472
  }
446
473
  }
@@ -449,18 +476,18 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
449
476
  })
450
477
  this.targetBizplace = response.data.partnersBizplaces || {}
451
478
  if (!response.errors) {
479
+ this._partnersList = response.data.partnersBizplaces
452
480
  return response.data.partnersBizplaces.items
453
481
  }
454
482
  }
455
-
456
-
457
483
 
458
484
  _assignPicker() {
459
485
  try {
460
-
461
- let selectedData = this.dataGrist.selected.filter((item)=>{return item.status =="DEACTIVATED"})
462
-
463
- if(selectedData.length <= 0) throw new Error('No available worksheet selected')
486
+ let selectedData = this.dataGrist.selected.filter(item => {
487
+ return item.status == 'DEACTIVATED'
488
+ })
489
+
490
+ if (selectedData.length <= 0) throw new Error('No available worksheet selected')
464
491
 
465
492
  openPopup(
466
493
  html`
@@ -495,7 +522,7 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
495
522
  size: 'medium',
496
523
  title: 'select operator'
497
524
  }
498
- )
525
+ )
499
526
  } catch (error) {
500
527
  return this._showToast(error)
501
528
  }
@@ -534,6 +561,35 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
534
561
  }
535
562
  }
536
563
 
564
+ async _openPrintLabelPopup() {
565
+ try {
566
+ const bizplaceFilters = (await this.searchForm.getQueryFilters()).find(x => x.name === 'bizplaceId')
567
+ if (!bizplaceFilters) {
568
+ throw new Error(`Please select a customer to print route label.`)
569
+ } else {
570
+ let selectedPartnerDomain = this._partnersList.items.find(itm => itm.id == bizplaceFilters.value)
571
+ let partnerRouteLabelSetting = await fetchSettingRule(
572
+ 'enable-print-route-label',
573
+ selectedPartnerDomain.domain.id
574
+ )
575
+ if (partnerRouteLabelSetting == false) throw new Error(`Partner setting not found`)
576
+ }
577
+
578
+ openPopup(
579
+ html`
580
+ <route-label-popup .partnerId="${bizplaceFilters.value}" .worksheetType="${'single'}"></route-label-popup>
581
+ `,
582
+ {
583
+ backdrop: true,
584
+ size: 'large',
585
+ title: i18next.t('title.print_route_label')
586
+ }
587
+ )
588
+ } catch (e) {
589
+ this._showToast(e)
590
+ }
591
+ }
592
+
537
593
  _exportableData() {
538
594
  let records = []
539
595
  if (this.dataGrist.selected && this.dataGrist.selected.length > 0) {
@@ -591,6 +647,17 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
591
647
  navigate(`worksheet_picking/${record.name}`)
592
648
  }
593
649
  }
650
+
651
+ _showToast({ type, message }) {
652
+ document.dispatchEvent(
653
+ new CustomEvent('notify', {
654
+ detail: {
655
+ type,
656
+ message
657
+ }
658
+ })
659
+ )
660
+ }
594
661
  }
595
662
 
596
663
  window.customElements.define('single-outbound-worksheet', SingleOutboundWorksheet)
@@ -20,7 +20,6 @@ import { WORKSHEET_STATUS } from '../constants'
20
20
  class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
21
21
  static get properties() {
22
22
  return {
23
- _bizplaceName: String,
24
23
  _enableProductScanning: Boolean,
25
24
  _selectedOrderInventory: Object,
26
25
  _selectedTaskStatus: String,
@@ -129,6 +128,10 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
129
128
  return this.shadowRoot.querySelector('barcode-scanable-input[name=taskNo]').shadowRoot.querySelector('input')
130
129
  }
131
130
 
131
+ get serialInput() {
132
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=serialNumber]')?.shadowRoot.querySelector('input')
133
+ }
134
+
132
135
  _focusOnTaskNoInput() {
133
136
  setTimeout(() => this.taskNoInput.focus(), 100)
134
137
  }
@@ -141,6 +144,12 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
141
144
  setTimeout(() => this.sortingQtyInput.focus(), 100)
142
145
  }
143
146
 
147
+ _focusOnSerialInput() {
148
+ if (this.serialInput) {
149
+ setTimeout(() => this.serialInput.focus(), 50)
150
+ }
151
+ }
152
+
144
153
  render() {
145
154
  return html`
146
155
  <form class="multi-column-form">
@@ -169,9 +178,19 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
169
178
  <barcode-scanable-input name="productBarcode" custom-input></barcode-scanable-input>
170
179
  `
171
180
  : html`
172
- <label>${i18next.t('label.enter_picked_qty')}</label>
173
- <input type="number" min="1" name="sortingQty" />
181
+ ${this._isRequireSerialNumberScanningOutbound
182
+ ? ''
183
+ : html`
184
+ <label>${i18next.t('label.enter_picked_qty')}</label>
185
+ <input type="number" min="1" name="sortingQty" />
186
+ `}
174
187
  `}
188
+ ${this._isRequireSerialNumberScanningOutbound
189
+ ? html`
190
+ <label>${i18next.t('label.serial_number')}</label>
191
+ <barcode-scanable-input name="serialNumber" custom-input></barcode-scanable-input>
192
+ `
193
+ : ``}
175
194
  </fieldset>
176
195
  </form>
177
196
 
@@ -182,7 +201,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
182
201
  <legend>
183
202
  ${i18next.t('title.order_no')}: ${this.taskNo}
184
203
  ${this.taskNo
185
- ? html`(${this._bizplaceName})
204
+ ? html`(${this._selectedReleaseGood?.name})
186
205
  <mwc-icon @click="${this._openWorksheetInformation.bind(this)}">info</mwc-icon>`
187
206
  : ''}
188
207
  </legend>
@@ -197,6 +216,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
197
216
  super()
198
217
  this.data = { records: [] }
199
218
  this.taskNo = ''
219
+ this._isRequireSerialNumberScanningOutbound = false
200
220
  this._enableProductScanning = false
201
221
  this._selectedOrderInventory = null
202
222
  this._selectedTaskStatus = null
@@ -223,17 +243,30 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
223
243
  if (data.records.length && record) {
224
244
  this._selectedOrderInventory = record
225
245
  this._selectedTaskStatus = record.status
246
+ this._isRequireSerialNumberScanningOutbound = record.isRequireSerialNumberScanningOutbound
226
247
 
227
248
  if (this.scannable) {
228
249
  if (this._enableProductScanning) this._focusOnProductBarcodeInput()
229
250
  }
251
+
252
+ this.updateContext()
230
253
  }
231
254
  }
232
255
  }
233
256
  },
234
257
  pagination: { infinite: true },
235
258
  list: {
236
- fields: ['completed', 'sku', 'product', 'batchId', 'packingType', 'packingSize', 'expirationDate', 'progress']
259
+ fields: [
260
+ 'completed',
261
+ 'sku',
262
+ 'product',
263
+ 'batchId',
264
+ 'packingType',
265
+ 'packingSize',
266
+ 'expirationDate',
267
+ 'progress',
268
+ 'binRemarks'
269
+ ]
237
270
  },
238
271
  columns: [
239
272
  { type: 'gutter', gutterName: 'sequence' },
@@ -291,6 +324,13 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
291
324
  header: i18next.t('field.progress'),
292
325
  label: true,
293
326
  width: 120
327
+ },
328
+ {
329
+ type: 'string',
330
+ name: 'binRemarks',
331
+ header: i18next.t('field.bin_location'),
332
+ label: true,
333
+ width: 400
294
334
  }
295
335
  ]
296
336
  }
@@ -302,9 +342,12 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
302
342
  query: gql`
303
343
  query findReleaseOrdersByTaskNo($taskNo: String!) {
304
344
  findReleaseOrdersByTaskNo(taskNo: $taskNo) {
305
- id
306
- name
307
- status
345
+ releaseGoods {
346
+ id
347
+ name
348
+ status
349
+ }
350
+ taskNo
308
351
  }
309
352
  }
310
353
  `,
@@ -312,8 +355,8 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
312
355
  })
313
356
 
314
357
  if (!response.errors) {
315
- this.releaseOrders = response.data.findReleaseOrdersByTaskNo
316
- this.taskNo = taskNo
358
+ this.releaseOrders = response.data.findReleaseOrdersByTaskNo.releaseGoods
359
+ this.taskNo = response.data.findReleaseOrdersByTaskNo.taskNo
317
360
  if (this.releaseOrders?.length) {
318
361
  this._openSelectReleaseOrderPopup()
319
362
  } else {
@@ -332,7 +375,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
332
375
  .releaseOrders=${this.releaseOrders}
333
376
  @ro-selected=${e => {
334
377
  this._selectedReleaseGood = e.detail.ro
335
- this._fetchItemList(this._selectedReleaseGood.name)
378
+ this._fetchItemList(this._selectedReleaseGood?.name)
336
379
  }}
337
380
  ></show-ro-list-popup>
338
381
  `,
@@ -376,12 +419,12 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
376
419
  }
377
420
  }
378
421
  worksheetDetailInfos {
379
- name
380
422
  batchId
381
423
  productId
382
424
  productSku
383
425
  productName
384
426
  productDescription
427
+ isRequireSerialNumberScanningOutbound
385
428
  expirationDate
386
429
  releaseQty
387
430
  sortedQty
@@ -392,6 +435,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
392
435
  id
393
436
  name
394
437
  }
438
+ binRemarks
395
439
  }
396
440
  }
397
441
  }
@@ -403,12 +447,18 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
403
447
  this._worksheetInfo = worksheetInfo
404
448
 
405
449
  this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
450
+ if (!this._selectedOrderInventory) {
451
+ this._selectedOrderInventory = worksheetDetailInfos[0]
452
+ this._isRequireSerialNumberScanningOutbound = worksheetDetailInfos[0].isRequireSerialNumberScanningOutbound
453
+ }
406
454
  this.updateContext()
407
455
  this._completeHandler()
408
456
 
409
457
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
410
458
 
411
- if (this._enableProductScanning) this._focusOnProductBarcodeInput()
459
+ if (this._isRequireSerialNumberScanningOutbound) this._focusOnSerialInput()
460
+ else if (this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound)
461
+ this._focusOnProductBarcodeInput()
412
462
  else this._focusOnSortingQtyInput()
413
463
  }
414
464
  }
@@ -426,11 +476,12 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
426
476
  response = await this.commonSorting()
427
477
  }
428
478
 
429
- if (!response.errors) {
430
- if (this._enableProductScanning) this.productBarcodeInput.value = ''
431
- else this.sortingQtyInput.value = ''
479
+ if (this._isRequireSerialNumberScanningOutbound) {
480
+ this.serialInput.value = ''
481
+ }
432
482
 
433
- this._fetchItemList(this._selectedReleaseGood.name)
483
+ if (!response.errors) {
484
+ this._fetchItemList(this._selectedReleaseGood?.name)
434
485
  }
435
486
  } catch (e) {
436
487
  this._showToast(e)
@@ -440,15 +491,28 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
440
491
  async commonSorting() {
441
492
  return await client.mutate({
442
493
  mutation: gql`
443
- mutation sortingProduct($taskNo: String!, $releaseGoodNo: String!, $productId: String!, $sortingQty: Float!) {
444
- sortingProduct(taskNo: $taskNo, releaseGoodNo: $releaseGoodNo, productId: $productId, sortingQty: $sortingQty)
494
+ mutation sortingProduct(
495
+ $taskNo: String!
496
+ $releaseGoodNo: String!
497
+ $productId: String!
498
+ $sortingQty: Float!
499
+ $serialNumber: String
500
+ ) {
501
+ sortingProduct(
502
+ taskNo: $taskNo
503
+ releaseGoodNo: $releaseGoodNo
504
+ productId: $productId
505
+ sortingQty: $sortingQty
506
+ serialNumber: $serialNumber
507
+ )
445
508
  }
446
509
  `,
447
510
  variables: {
448
511
  taskNo: this.taskNo,
449
- releaseGoodNo: this._selectedReleaseGood.name,
512
+ releaseGoodNo: this._selectedReleaseGood?.name,
450
513
  productId: this._selectedOrderInventory?.product.id,
451
- sortingQty: parseFloat(this.sortingQtyInput.value)
514
+ sortingQty: this._isRequireSerialNumberScanningOutbound ? 1 : parseFloat(this.sortingQtyInput.value),
515
+ serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value.trim() : null
452
516
  }
453
517
  })
454
518
  }
@@ -456,14 +520,25 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
456
520
  async scanProductSorting() {
457
521
  return await client.mutate({
458
522
  mutation: gql`
459
- mutation scanProductSorting($taskNo: String!, $releaseGoodNo: String!, $productBarcode: String!) {
460
- scanProductSorting(taskNo: $taskNo, releaseGoodNo: $releaseGoodNo, productBarcode: $productBarcode)
523
+ mutation scanProductSorting(
524
+ $taskNo: String!
525
+ $releaseGoodNo: String!
526
+ $productBarcode: String!
527
+ $serialNumber: String
528
+ ) {
529
+ scanProductSorting(
530
+ taskNo: $taskNo
531
+ releaseGoodNo: $releaseGoodNo
532
+ productBarcode: $productBarcode
533
+ serialNumber: $serialNumber
534
+ )
461
535
  }
462
536
  `,
463
537
  variables: {
464
538
  taskNo: this.taskNo,
465
- releaseGoodNo: this._selectedReleaseGood.name,
466
- productBarcode: this.productBarcodeInput.value.trim()
539
+ releaseGoodNo: this._selectedReleaseGood?.name,
540
+ productBarcode: this.productBarcodeInput.value.trim(),
541
+ serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value.trim() : null
467
542
  }
468
543
  })
469
544
  }
@@ -494,11 +569,12 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
494
569
  }
495
570
  `,
496
571
  variables: {
497
- releaseGoodNo: this._selectedReleaseGood.name
572
+ releaseGoodNo: this._selectedReleaseGood?.name
498
573
  }
499
574
  })
500
575
  if (!response.errors) {
501
576
  this._showToast({ message: i18next.t('text.current_release_order_sorting_completed') })
577
+ this._selectedOrderInventory = null
502
578
  await this._fetchReleaseOrderList(this.taskNo)
503
579
  }
504
580
  } catch (e) {
@@ -538,20 +614,34 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
538
614
  this._focusOnProductBarcodeInput()
539
615
  throw new Error(i18next.t('text.product_barcode_is_empty'))
540
616
  }
617
+
618
+ if (this._isRequireSerialNumberScanningOutbound) {
619
+ if (!this.serialInput?.value) {
620
+ this._focusOnSerialInput()
621
+ throw new Error(i18next.t('text.empty_serial_number'))
622
+ }
623
+ }
541
624
  } else {
542
625
  // validate for order selection
543
626
  if (!this._selectedOrderInventory) throw new Error(i18next.t('text.target_is_not_selected'))
544
627
 
545
- if (!this.sortingQtyInput.checkValidity()) throw new Error(i18next.t('text.release_qty_invalid'))
628
+ if (this._isRequireSerialNumberScanningOutbound) {
629
+ if (!this.serialInput?.value) {
630
+ this._focusOnSerialInput()
631
+ throw new Error(i18next.t('text.empty_serial_number'))
632
+ }
633
+ } else {
634
+ if (!this.sortingQtyInput.checkValidity()) throw new Error(i18next.t('text.release_qty_invalid'))
546
635
 
547
- if (!parseInt(this.sortingQtyInput.value)) {
548
- this._focusOnSortingQtyInput()
549
- throw new Error(i18next.t('text.release_qty_is_empty'))
550
- }
636
+ if (!parseInt(this.sortingQtyInput.value)) {
637
+ this._focusOnSortingQtyInput()
638
+ throw new Error(i18next.t('text.release_qty_is_empty'))
639
+ }
551
640
 
552
- if (parseInt(this.sortingQtyInput.value) != this._selectedOrderInventory.releaseQty) {
553
- this._focusOnSortingQtyInput()
554
- throw new Error(i18next.t('text.wrong_sorting_qty'))
641
+ if (parseInt(this.sortingQtyInput.value) != this._selectedOrderInventory.releaseQty) {
642
+ this._focusOnSortingQtyInput()
643
+ throw new Error(i18next.t('text.wrong_sorting_qty'))
644
+ }
555
645
  }
556
646
  }
557
647
  }
@@ -579,6 +669,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
579
669
  else this.sortingQtyInput.value = ''
580
670
  this._selectedOrderInventory = null
581
671
  this._selectedTaskStatus = null
672
+ this.serialInput.value = ''
582
673
  }
583
674
 
584
675
  _showToast({ type, message }) {