@things-factory/operato-wms 4.1.36 → 4.1.40

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 (37) hide show
  1. package/client/pages/inventory/non-loaded-inventory.js +83 -15
  2. package/client/pages/order/release-order/b2c/b2c-order-requests.js +67 -13
  3. package/client/pages/outbound/picking-product.js +54 -16
  4. package/client/pages/outbound/select-operator-popup.js +3 -3
  5. package/client/pages/outbound/single-outbound-worksheet.js +86 -4
  6. package/client/pages/outbound/worksheet-batch-picking.js +2 -2
  7. package/client/pages/outbound/worksheet-picking.js +2 -2
  8. package/dist-server/graphql/resolvers/dashboard/index.js +3 -1
  9. package/dist-server/graphql/resolvers/dashboard/index.js.map +1 -1
  10. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js +51 -0
  11. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js.map +1 -0
  12. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +55 -0
  13. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js.map +1 -0
  14. package/dist-server/graphql/resolvers/extra/add-release-good-products.js +5 -1
  15. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
  16. package/dist-server/graphql/types/dashboard/index.js +5 -1
  17. package/dist-server/graphql/types/dashboard/index.js.map +1 -1
  18. package/dist-server/graphql/types/dashboard/inventory-expiry-counter.js +16 -0
  19. package/dist-server/graphql/types/dashboard/inventory-expiry-counter.js.map +1 -0
  20. package/dist-server/graphql/types/dashboard/inventory-expiry-status.js +14 -0
  21. package/dist-server/graphql/types/dashboard/inventory-expiry-status.js.map +1 -0
  22. package/helps/release-note.ko.md +37 -2
  23. package/helps/release-note.md +12 -41
  24. package/helps/release-note.ms.md +36 -1
  25. package/helps/release-note.zh.md +36 -1
  26. package/package.json +50 -50
  27. package/server/graphql/resolvers/dashboard/index.ts +5 -1
  28. package/server/graphql/resolvers/dashboard/inventory-expiry-monitor.ts +49 -0
  29. package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +62 -0
  30. package/server/graphql/resolvers/extra/add-release-good-products.ts +7 -2
  31. package/server/graphql/types/dashboard/index.ts +5 -1
  32. package/server/graphql/types/dashboard/inventory-expiry-counter.ts +10 -0
  33. package/server/graphql/types/dashboard/inventory-expiry-status.ts +8 -0
  34. package/translations/en.json +3 -0
  35. package/translations/ko.json +1 -0
  36. package/translations/ms.json +1 -0
  37. package/translations/zh.json +1 -0
@@ -65,7 +65,11 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
65
65
 
66
66
  get context() {
67
67
  return {
68
- title: i18next.t('title.non_loaded_inventory')
68
+ title: i18next.t('title.non_loaded_inventory'),
69
+ exportable: {
70
+ name: i18next.t('title.non_loaded_inventory'),
71
+ data: this._exportableData.bind(this)
72
+ }
69
73
  }
70
74
  }
71
75
 
@@ -73,24 +77,22 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
73
77
  this.config = {
74
78
  list: {
75
79
  fields: [
76
- 'roNo',
80
+ 'releaseOrderNo',
77
81
  'palletId',
78
82
  'cartonId',
79
83
  'batchId',
80
84
  'productSku',
81
- 'productInformation',
82
- 'product_brand',
85
+ 'productName',
86
+ 'productBrand',
83
87
  'packingType',
84
- 'qty',
85
- 'uomValue',
88
+ 'pickedQty',
89
+ 'pickedUomValue',
86
90
  'uom',
87
91
  'binLocation'
88
92
  ]
89
93
  },
90
- pagination: { pages: [20, 50, 100, 500, 999] },
91
- rows: {
92
- appendable: false
93
- },
94
+ pagination: { pages: [50, 100, 200, 500] },
95
+ rows: { appendable: false },
94
96
  columns: [
95
97
  { type: 'gutter', gutterName: 'sequence' },
96
98
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
@@ -98,20 +100,28 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
98
100
  type: 'string',
99
101
  name: 'releaseOrderNo',
100
102
  header: i18next.t('field.ro_no'),
101
- sortable: true,
103
+ label: true,
104
+ width: 150
105
+ },
106
+ {
107
+ type: 'string',
108
+ name: 'refNo',
109
+ header: i18next.t('field.ref_no'),
110
+ label: true,
102
111
  width: 150
103
112
  },
104
113
  {
105
114
  type: 'string',
106
115
  name: 'palletId',
107
116
  header: i18next.t('field.lot_id'),
108
- sortable: true,
117
+ label: true,
109
118
  width: 150
110
119
  },
111
120
  {
112
121
  type: 'string',
113
122
  name: 'cartonId',
114
123
  header: i18next.t('field.carton_id'),
124
+ label: true,
115
125
  sortable: true,
116
126
  width: 120
117
127
  },
@@ -119,14 +129,14 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
119
129
  type: 'string',
120
130
  name: 'batchId',
121
131
  header: i18next.t('field.batch_id'),
122
- imex: { header: i18next.t('field.batch_id'), key: 'batchId', width: 30, type: 'string' },
123
- sortable: true,
132
+ label: true,
124
133
  width: 120
125
134
  },
126
135
  {
127
136
  type: 'string',
128
137
  name: 'productSku',
129
138
  header: i18next.t('field.sku'),
139
+ label: true,
130
140
  sortable: true,
131
141
  width: 150
132
142
  },
@@ -134,6 +144,7 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
134
144
  type: 'string',
135
145
  name: 'productName',
136
146
  header: i18next.t('field.product'),
147
+ label: true,
137
148
  sortable: true,
138
149
  width: 250
139
150
  },
@@ -141,6 +152,7 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
141
152
  type: 'string',
142
153
  name: 'productBrand',
143
154
  header: i18next.t('field.brand'),
155
+ label: true,
144
156
  sortable: true,
145
157
  width: 150
146
158
  },
@@ -148,6 +160,7 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
148
160
  type: 'string',
149
161
  name: 'packingType',
150
162
  header: i18next.t('field.packing_type'),
163
+ label: true,
151
164
  sortable: true,
152
165
  width: 150
153
166
  },
@@ -155,18 +168,21 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
155
168
  type: 'number',
156
169
  name: 'pickedQty',
157
170
  header: i18next.t('field.qty'),
171
+ label: true,
158
172
  width: 80
159
173
  },
160
174
  {
161
175
  type: 'float',
162
176
  name: 'pickedUomValue',
163
177
  header: i18next.t('field.total_uom_value'),
178
+ label: true,
164
179
  width: 110
165
180
  },
166
181
  {
167
182
  type: 'string',
168
183
  name: 'uom',
169
184
  header: i18next.t('field.uom'),
185
+ label: true,
170
186
  sortable: true,
171
187
  width: 80
172
188
  },
@@ -174,6 +190,7 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
174
190
  type: 'string',
175
191
  name: 'binLocation',
176
192
  header: i18next.t('field.bin_location'),
193
+ label: true,
177
194
  sortable: true,
178
195
  width: 120
179
196
  }
@@ -211,6 +228,12 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
211
228
  type: 'text',
212
229
  props: { searchOper: 'i_like' }
213
230
  },
231
+ {
232
+ label: i18next.t('field.ref_no'),
233
+ name: 'refNo',
234
+ type: 'text',
235
+ props: { searchOper: 'i_like' }
236
+ },
214
237
  {
215
238
  label: i18next.t('field.bin_location'),
216
239
  name: 'binLocation',
@@ -243,6 +266,7 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
243
266
  items {
244
267
  releaseGood {
245
268
  name
269
+ refNo
246
270
  }
247
271
  inventory {
248
272
  palletId
@@ -287,11 +311,55 @@ class NonLoadedInventory extends connect(store)(localize(i18next)(PageView)) {
287
311
  binLocation: item.binLocation.name,
288
312
  palletId: item.inventory.palletId,
289
313
  cartonId: item.inventory.cartonId,
290
- releaseOrderNo: item.releaseGood.name
314
+ releaseOrderNo: item.releaseGood.name,
315
+ refNo: item.releaseGood.refNo
291
316
  }
292
317
  }) || []
293
318
  }
294
319
  }
320
+
321
+ async _exportableData() {
322
+ try {
323
+ let data = []
324
+
325
+ var headerSetting = [
326
+ { header: i18next.t('field.ro_no'), key: 'releaseOrderNo', width: 50, type: 'string' },
327
+ { header: i18next.t('field.ref_no'), key: 'refNo', width: 50, type: 'string' },
328
+ { header: i18next.t('field.lot_id'), key: 'palletId', width: 50, type: 'string' },
329
+ { header: i18next.t('field.carton_id'), key: 'cartonId', width: 50, type: 'string' },
330
+ { header: i18next.t('field.batch_id'), key: 'batchId', width: 25, type: 'string' },
331
+ { header: i18next.t('field.sku'), key: 'productSku', width: 25, type: 'string' },
332
+ { header: i18next.t('field.product'), key: 'productName', width: 25, type: 'string' },
333
+ { header: i18next.t('field.brand'), key: 'productBrand', width: 25, type: 'string' },
334
+ { header: i18next.t('field.packing_type'), key: 'packingType', width: 25, type: 'string' },
335
+ { header: i18next.t('field.qty'), key: 'pickedQty', width: 25, type: 'string' },
336
+ { header: i18next.t('field.total_uom_value'), key: 'pickedUomValue', width: 25, type: 'float' },
337
+ { header: i18next.t('field.uom'), key: 'uom', width: 25, type: 'string' },
338
+ { header: i18next.t('field.bin_location'), key: 'binLocation', width: 25, type: 'string' }
339
+ ]
340
+
341
+ if (this.dataGrist.selected && this.dataGrist.selected.length > 0) {
342
+ data = this.dataGrist.selected
343
+ } else {
344
+ data = (await this.fetchHandler({ page: 1, limit: 9999999 })).records
345
+ }
346
+
347
+ return { header: headerSetting, data }
348
+ } catch (e) {
349
+ this._showToast(e)
350
+ }
351
+ }
352
+
353
+ _showToast({ type, message }) {
354
+ document.dispatchEvent(
355
+ new CustomEvent('notify', {
356
+ detail: {
357
+ type,
358
+ message
359
+ }
360
+ })
361
+ )
362
+ }
295
363
  }
296
364
 
297
365
  window.customElements.define('non-loaded-inventory', NonLoadedInventory)
@@ -3,19 +3,38 @@ import '@things-factory/grist-ui'
3
3
  import '../batch-picking-popup'
4
4
 
5
5
  import gql from 'graphql-tag'
6
- import { css, html } from 'lit-element'
6
+ import {
7
+ css,
8
+ html
9
+ } from 'lit-element'
7
10
  import { connect } from 'pwa-helpers/connect-mixin'
8
11
 
9
- import { DirectPrinter } from '@things-factory/barcode-base'
10
12
  import { GhostPrint } from '@operato/ghost-print'
13
+ import { DirectPrinter } from '@things-factory/barcode-base'
11
14
  import { getCodeByName } from '@things-factory/code-base'
12
- import { i18next, localize } from '@things-factory/i18n-base'
15
+ import {
16
+ i18next,
17
+ localize
18
+ } from '@things-factory/i18n-base'
13
19
  import { openPopup } from '@things-factory/layout-base'
14
- import { client, navigate, PageView, store, CustomAlert } from '@things-factory/shell'
15
- import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
20
+ import {
21
+ client,
22
+ CustomAlert,
23
+ navigate,
24
+ PageView,
25
+ store
26
+ } from '@things-factory/shell'
27
+ import {
28
+ CommonButtonStyles,
29
+ ScrollbarStyles
30
+ } from '@things-factory/styles'
16
31
  import { isMobileDevice } from '@things-factory/utils'
17
32
 
18
- import { INTENALIZED_AWB_SETTING_KEY, ORDER_STATUS } from '../../../constants'
33
+ import { fetchSettingRule } from '../../../../fetch-setting-value'
34
+ import {
35
+ INTENALIZED_AWB_SETTING_KEY,
36
+ ORDER_STATUS
37
+ } from '../../../constants'
19
38
 
20
39
  const HEADER_JSON = {
21
40
  'Content-Type': 'application/json',
@@ -123,6 +142,7 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
123
142
  }
124
143
 
125
144
  async pageInitialized() {
145
+ const _enablePrintSCAwb = await fetchSettingRule('enable-print-sellercraft-airway-bill')
126
146
  const _orderStatus = await getCodeByName('RO_REQUESTS_STATUS')
127
147
  const _partners = await this._fetchPartners()
128
148
  const _shippingProviders = await this._fetchShippingProviders()
@@ -260,6 +280,29 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
260
280
  }
261
281
  }
262
282
  },
283
+ {
284
+ type: 'gutter',
285
+ gutterName: 'button',
286
+ icon: 'receipt',
287
+ hidden: !_enablePrintSCAwb,
288
+ handlers: {
289
+ click: async (columns, data, column, record, rowIndex) => {
290
+ if (record.airwayBill) {
291
+ let convertedPdfUrl = ''
292
+ if (record.airwayBill.includes('partner.shopeemobile.com')) {
293
+ convertedPdfUrl = `/pdf/merge?urls=${record.airwayBill}`
294
+ } else {
295
+ let url = new URL(window.location)
296
+ convertedPdfUrl = `${url.origin}/proxy?url=${record.airwayBill}`
297
+ }
298
+
299
+ this._callPrintDialog(convertedPdfUrl, true)
300
+ } else {
301
+ this._showToast({ message: i18next.t('text.there_is_no_airway_bill_for_this_ro') })
302
+ }
303
+ }
304
+ }
305
+ },
263
306
  {
264
307
  type: 'string',
265
308
  name: 'name',
@@ -417,6 +460,8 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
417
460
  name
418
461
  description
419
462
  }
463
+ airwayBill
464
+ trackingNo
420
465
  }
421
466
  total
422
467
  }
@@ -621,13 +666,22 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
621
666
  }
622
667
  }
623
668
 
624
- async _callPrintDialog(contentSource) {
625
- GhostPrint.print({
626
- srcdoc: contentSource,
627
- onfinish: () => {
628
- this._showToast({ message: i18next.t('text.document_has_been_generated') })
629
- }
630
- })
669
+ async _callPrintDialog(contentSource, isSellerCraft = false) {
670
+ if (isSellerCraft) {
671
+ GhostPrint.print({
672
+ src: contentSource,
673
+ onfinish: () => {
674
+ this._showToast({ message: i18next.t('text.document_has_been_generated') })
675
+ }
676
+ })
677
+ } else {
678
+ GhostPrint.print({
679
+ srcdoc: contentSource,
680
+ onfinish: () => {
681
+ this._showToast({ message: i18next.t('text.document_has_been_generated') })
682
+ }
683
+ })
684
+ }
631
685
  }
632
686
 
633
687
  _compareValues(key, order = 'asc') {
@@ -38,6 +38,8 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
38
38
  _locationName: String,
39
39
  _reusablePalletList: Object,
40
40
  _worksheetInfo: Object,
41
+ _locationName: String,
42
+ _scannable: Boolean,
41
43
  config: Object,
42
44
  data: Object,
43
45
  isWholePicking: Boolean,
@@ -166,12 +168,6 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
166
168
  ?.shadowRoot?.querySelector('input')
167
169
  }
168
170
 
169
- get scannable() {
170
- let result =
171
- this._selectedOrderInventory && this._selectedOrderInventory.pickedQty != this._selectedOrderInventory.releaseQty
172
- return result
173
- }
174
-
175
171
  get taskNoInput() {
176
172
  return this.shadowRoot.querySelector('barcode-scanable-input[name=taskNo]')?.shadowRoot.querySelector('input')
177
173
  }
@@ -266,6 +262,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
266
262
  this._hasBinPicking = false
267
263
  this._reusablePalletList = { records: [] }
268
264
  this._selectedOrderInventory = null
265
+ this.scannable = false
269
266
  }
270
267
 
271
268
  render() {
@@ -298,6 +295,12 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
298
295
  @keypress="${async e => {
299
296
  if (e.keyCode === 13) {
300
297
  e.preventDefault()
298
+ if (this.binLocationInput) this.binLocationInput.value = ''
299
+ if (this.productBarcodeInput) this.productBarcodeInput.value = ''
300
+ if (this.cartonInput) this.cartonInput.value = ''
301
+ if (this.palletInput) this.palletInput.value = ''
302
+ if (this.serialInput) this.serialInput.value = ''
303
+ this._selectedOrderInventory = null
301
304
  this._currentBinLocation = null
302
305
  if (this.refPickingType === PICKING_TYPES.PICKING.value) {
303
306
  if (this.releaseGoodNoInput.value) {
@@ -664,7 +667,6 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
664
667
  })
665
668
 
666
669
  if (!response.errors) {
667
- if (!this._selectedOrderInventory) this.clearView()
668
670
  this.releaseGoodNo = response.data.pickingWorksheet.worksheetInfo.releaseGood.name
669
671
  this.releaseGoodId = response.data.pickingWorksheet.worksheetInfo.releaseGood.id
670
672
  if (!response.data?.pickingWorksheet) return
@@ -676,10 +678,23 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
676
678
  this._worksheetInfo = worksheetInfo
677
679
  this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
678
680
 
681
+ if (!this._selectedOrderInventory) {
682
+ this._selectedOrderInventory = this.data.records[0]
683
+ }
684
+
685
+ if (
686
+ this._selectedOrderInventory &&
687
+ this._selectedOrderInventory.pickedQty != this._selectedOrderInventory.releaseQty
688
+ ) {
689
+ this.scannable = true
690
+ }
691
+
679
692
  if (this._selectedOrderInventory) {
680
693
  const record = this.data.records.find(record => record.name === this._selectedOrderInventory.name)
694
+ this._selectedOrderInventory = record
681
695
  this.updateSelectedItemProp(record)
682
696
  await this.updateComplete
697
+ await this.grist.reset()
683
698
  this.fillUpForm(this.inputForm, {
684
699
  ...record,
685
700
  binLocation: record?.binLocation ? record.binLocation : ''
@@ -768,6 +783,17 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
768
783
  this._worksheetInfo = worksheetInfo
769
784
  this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
770
785
 
786
+ if (!this._selectedOrderInventory) {
787
+ this._selectedOrderInventory = this.data.records[0]
788
+ }
789
+
790
+ if (
791
+ this._selectedOrderInventory &&
792
+ this._selectedOrderInventory.pickedQty != this._selectedOrderInventory.releaseQty
793
+ ) {
794
+ this.scannable = true
795
+ }
796
+
771
797
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
772
798
 
773
799
  if (this._selectedOrderInventory) {
@@ -777,6 +803,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
777
803
  record.palletId === this._selectedOrderInventory.palletId
778
804
  )
779
805
 
806
+ this._selectedOrderInventory = record
780
807
  this.updateSelectedItemProp(record)
781
808
 
782
809
  if (record.pickedQty == record.releaseQty) {
@@ -933,17 +960,29 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
933
960
 
934
961
  if (!this._isCartonLabel && !this._isRequireSerialNumberScanningOutbound) {
935
962
  this.palletInput.value = ''
936
- // this._selectedTaskStatus = null
937
- this._selectedOrderInventory = null
938
963
  }
939
964
 
940
965
  if (!this.isWholePicking && !this._crossDocking && !this._isCartonLabel && this.locationInput)
941
966
  this.locationInput.value = ''
942
967
  if (this.refPickingType === PICKING_TYPES.PICKING.value) {
943
- this.fetchInventories(this.releaseGoodNo)
968
+ await this.fetchInventories(this.releaseGoodNo)
944
969
  } else {
945
- this.fetchInventories(this.taskNo)
970
+ await this.fetchInventories(this.taskNo)
971
+ }
972
+
973
+ if (
974
+ this._selectedOrderInventory &&
975
+ this._selectedOrderInventory.pickedQty == this._selectedOrderInventory.releaseQty
976
+ ) {
977
+ this._selectedOrderInventory = null
978
+ if (this.refPickingType === PICKING_TYPES.PICKING.value) {
979
+ await this.fetchInventories(this.releaseGoodNo)
980
+ } else {
981
+ await this.fetchInventories(this.taskNo)
982
+ }
946
983
  }
984
+
985
+ this.focusOnInput()
947
986
  }
948
987
 
949
988
  this.isReplacement = false
@@ -960,6 +999,8 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
960
999
  .refPickingType="${this.refPickingType}"
961
1000
  .replacePalletId="${this.palletInput.value}"
962
1001
  @completed="${() => {
1002
+ this._selectedOrderInventory = null
1003
+ let a = this._selectedOrderInventory
963
1004
  if (this.refPickingType === PICKING_TYPES.PICKING.value) {
964
1005
  this.fetchInventories(this.releaseGoodNoInput.value)
965
1006
  this.fetchPalletsHandler(this.releaseGoodNoInput.value)
@@ -968,8 +1009,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
968
1009
  this.fetchPalletsHandler(this.taskNoInput.value)
969
1010
  }
970
1011
  // this._selectedTaskStatus = null
971
- this._selectedOrderInventory = null
972
- this.isReplacement = false
1012
+ this._isReplacement = false
973
1013
  this._isExecuting = false
974
1014
  }}"
975
1015
  ></picking-replacement-popup>
@@ -1204,8 +1244,6 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1204
1244
 
1205
1245
  async validatePicking() {
1206
1246
  // validate for order selection
1207
- if (!this._selectedOrderInventory) throw new Error(i18next.t('text.target_is_not_selected'))
1208
-
1209
1247
  // pallet id existing
1210
1248
  if (!this._isCartonLabel) {
1211
1249
  if (!this.palletInput.value) {
@@ -1603,7 +1641,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1603
1641
  if (this._selectedOrderInventory) {
1604
1642
  const record = this.data.records.find(record => record.name === this._selectedOrderInventory.name)
1605
1643
  if (record.pickedQty == record.releaseQty) {
1606
- if (this._isCartonLabel && this.scannable) {
1644
+ if (this._isCartonLabel) {
1607
1645
  this.cartonInput.value = ''
1608
1646
  this._focusOnCartonNoInput()
1609
1647
  }
@@ -120,8 +120,8 @@ class SelectOperatorPopup extends localize(i18next)(LitElement) {
120
120
 
121
121
  const response = await client.query({
122
122
  query: gql`
123
- query($bizplaceId: String!, $name: String, $email: String) {
124
- pickingAssignmentStatusByUsers(bizplaceId: $bizplaceId, name: $name, email: $email) {
123
+ query( $name: String, $email: String) {
124
+ pickingAssignmentStatusByUsers(name: $name, email: $email) {
125
125
  user {
126
126
  id
127
127
  name
@@ -136,7 +136,7 @@ class SelectOperatorPopup extends localize(i18next)(LitElement) {
136
136
  }
137
137
  }
138
138
  `,
139
- variables: { bizplaceId: this.bizplace.id, name, email }
139
+ variables: { name, email }
140
140
  })
141
141
 
142
142
  if (!response.errors) {
@@ -3,11 +3,13 @@ import '@things-factory/grist-ui'
3
3
 
4
4
  import gql from 'graphql-tag'
5
5
  import { css, html } from 'lit-element'
6
+ import { openPopup } from '@things-factory/layout-base'
6
7
 
8
+ import './select-operator-popup'
7
9
  import { getCodeByName } from '@things-factory/code-base'
8
10
  import { i18next, localize } from '@things-factory/i18n-base'
9
11
  import { client, navigate, PageView } from '@things-factory/shell'
10
- import { ScrollbarStyles } from '@things-factory/styles'
12
+ import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
11
13
  import { isMobileDevice } from '@things-factory/utils'
12
14
 
13
15
  import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../constants'
@@ -39,7 +41,7 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
39
41
  _searchFields: Array,
40
42
  config: Object,
41
43
  data: Object,
42
-
44
+ targetBizplace: Object,
43
45
  assignee: String,
44
46
  status: String
45
47
  }
@@ -60,10 +62,18 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
60
62
  get context() {
61
63
  return {
62
64
  title: i18next.t('title.outbound_worksheet'),
65
+ actions: [
66
+ {
67
+ title: i18next.t('button.assign_picker'),
68
+ action: this._assignPicker.bind(this),
69
+ ...CommonButtonStyles.activate
70
+ }
71
+ ],
63
72
  exportable: {
64
73
  name: i18next.t('title.outbound_worksheet'),
65
74
  data: this._exportableData.bind(this)
66
75
  },
76
+
67
77
  help: 'operato-wms/outbound/single-outbound-worksheet'
68
78
  }
69
79
  }
@@ -186,10 +196,11 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
186
196
  list: {
187
197
  fields: ['releaseGood', 'bizplace', 'type', 'releaseRefNo', 'status', 'startedAt', 'endedAt']
188
198
  },
189
- rows: { appendable: false },
199
+ rows: { selectable: { multiple: true }, appendable: false },
190
200
  pagination: { limit: 100, pages: [20, 50, 100, 200, 500] },
191
201
  columns: [
192
202
  { type: 'gutter', gutterName: 'sequence' },
203
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
193
204
  {
194
205
  type: 'gutter',
195
206
  gutterName: 'button',
@@ -276,6 +287,14 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
276
287
  sortable: true,
277
288
  width: 100
278
289
  },
290
+ {
291
+ type: 'object',
292
+ name: 'assignee',
293
+ header: i18next.t('field.assigned_picker'),
294
+ imex: { header: i18next.t('field.assigned_picker'), key: 'assignee.name', width: 20, type: 'string' },
295
+ sortable: true,
296
+ width: 100
297
+ },
279
298
  {
280
299
  type: 'datetime',
281
300
  name: 'createdAt',
@@ -351,6 +370,10 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
351
370
  items {
352
371
  id
353
372
  name
373
+ assignee{
374
+ id
375
+ name
376
+ }
354
377
  releaseGood {
355
378
  id
356
379
  name
@@ -424,11 +447,59 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
424
447
  `,
425
448
  variables: { filters }
426
449
  })
427
-
450
+ this.targetBizplace = response.data.partnersBizplaces || {}
428
451
  if (!response.errors) {
429
452
  return response.data.partnersBizplaces.items
430
453
  }
431
454
  }
455
+
456
+
457
+
458
+ _assignPicker() {
459
+ 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')
464
+
465
+ openPopup(
466
+ html`
467
+ <select-operator-popup
468
+ @updateOperator="${async e => {
469
+ let assignee = e.detail
470
+
471
+ const response = await client.mutate({
472
+ mutation: gql`
473
+ mutation assignPickingWorker($worksheetId: [String]!, $userId: String!) {
474
+ assignPickingWorker(worksheetId: $worksheetId, userId: $userId)
475
+ }
476
+ `,
477
+ variables: { worksheetId: selectedData.map(itm => itm.id), userId: assignee.id }
478
+ })
479
+
480
+ if (!response.errors) {
481
+ this.dataGrist.fetch()
482
+ return this._showToast({ message: i18next.t('text.updated_successfully') })
483
+ }
484
+
485
+ if (this.activatable) {
486
+ if (this.orderNo) {
487
+ history.back()
488
+ }
489
+ }
490
+ }}"
491
+ ></select-operator-popup>
492
+ `,
493
+ {
494
+ backdrop: true,
495
+ size: 'medium',
496
+ title: 'select operator'
497
+ }
498
+ )
499
+ } catch (error) {
500
+ return this._showToast(error)
501
+ }
502
+ }
432
503
 
433
504
  _modifyDateRange(e) {
434
505
  const fromDate = e.currentTarget.value
@@ -496,6 +567,17 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
496
567
  return { header: headerSetting, data: data }
497
568
  }
498
569
 
570
+ _showToast({ type, message }) {
571
+ document.dispatchEvent(
572
+ new CustomEvent('notify', {
573
+ detail: {
574
+ type,
575
+ message
576
+ }
577
+ })
578
+ )
579
+ }
580
+
499
581
  navigatePickingRelatedPages(record) {
500
582
  if (this.assigneeId) {
501
583
  const searchParams = new URLSearchParams()