@things-factory/operato-wms 4.1.30 → 5.0.0-alpha.3

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 (31) hide show
  1. package/client/pages/inbound/unload-product.js +1 -1
  2. package/client/pages/inventory-check/create-cycle-count.js +0 -2
  3. package/client/pages/master/product/product-detail-bizplace-setting-popup.js +0 -2
  4. package/client/pages/master/product/product-details-popup.js +10 -9
  5. package/client/pages/master/product/product-list.js +10 -9
  6. package/client/pages/order/release-order/b2b/b2b-order-list.js +18 -41
  7. package/client/pages/order/release-order/b2c/b2c-order-requests.js +18 -40
  8. package/client/pages/outbound/packing-product.js +40 -82
  9. package/client/pages/outbound/worksheet-batch-picking.js +1 -1
  10. package/client/pages/report/outbound-order-details-report.js +9 -64
  11. package/dist-server/graphql/index.js +5 -1
  12. package/dist-server/graphql/index.js.map +1 -1
  13. package/dist-server/graphql/resolvers/index.js +5 -1
  14. package/dist-server/graphql/resolvers/index.js.map +1 -1
  15. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +48 -53
  16. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  17. package/dist-server/graphql/types/index.js +5 -1
  18. package/dist-server/graphql/types/index.js.map +1 -1
  19. package/dist-server/graphql/types/reports/outbound-order-details-report.js +0 -3
  20. package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
  21. package/dist-server/index.js +5 -1
  22. package/dist-server/index.js.map +1 -1
  23. package/dist-server/utils/index.js +5 -1
  24. package/dist-server/utils/index.js.map +1 -1
  25. package/package.json +51 -51
  26. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +48 -54
  27. package/server/graphql/types/reports/outbound-order-details-report.ts +0 -3
  28. package/translations/en.json +5 -10
  29. package/translations/ko.json +1 -7
  30. package/translations/ms.json +1 -7
  31. package/translations/zh.json +1 -7
@@ -10,7 +10,7 @@ import './select-product-batch'
10
10
 
11
11
  import gql from 'graphql-tag'
12
12
  import { css, html } from 'lit-element'
13
- import orderBy from 'lodash/orderBy'
13
+ import orderBy from 'lodash-es/orderBy'
14
14
  import { connect } from 'pwa-helpers/connect-mixin.js'
15
15
 
16
16
  import { MultiColumnFormStyles } from '@things-factory/form-ui'
@@ -16,8 +16,6 @@ import { isMobileDevice } from '@things-factory/utils'
16
16
  import { fetchLocationSortingRule } from '../../fetch-location-sorting-rule'
17
17
  import { LOCATION_SORTING_RULE } from '../constants'
18
18
 
19
- const _ = require('lodash')
20
-
21
19
  class CreateCycleCount extends localize(i18next)(PageView) {
22
20
  static get properties() {
23
21
  return {
@@ -9,8 +9,6 @@ import { client, CustomAlert, gqlContext } from '@things-factory/shell'
9
9
  import { ScrollbarStyles } from '@things-factory/styles'
10
10
  import { flattenObject, isMobileDevice } from '@things-factory/utils'
11
11
 
12
- const _ = require('lodash')
13
-
14
12
  export class ProductDetailBizplaceSettingPopup extends localize(i18next)(LitElement) {
15
13
  static get styles() {
16
14
  return [
@@ -3,6 +3,9 @@ import '@things-factory/grist-ui'
3
3
 
4
4
  import gql from 'graphql-tag'
5
5
  import { css, html, LitElement } from 'lit-element'
6
+ import isEmpty from 'lodash-es/isEmpty'
7
+ import isNaN from 'lodash-es/isNaN'
8
+ import isNumber from 'lodash-es/isNumber'
6
9
 
7
10
  import { getCodeByName } from '@things-factory/code-base'
8
11
  import { i18next, localize } from '@things-factory/i18n-base'
@@ -10,8 +13,6 @@ import { client, CustomAlert, gqlContext } from '@things-factory/shell'
10
13
  import { ScrollbarStyles } from '@things-factory/styles'
11
14
  import { isMobileDevice } from '@things-factory/utils'
12
15
 
13
- const _ = require('lodash')
14
-
15
16
  export class ProductDetailsPopup extends localize(i18next)(LitElement) {
16
17
  static get styles() {
17
18
  return [
@@ -555,20 +556,20 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
555
556
  let data = this.dataGrist._data.records.map(itm => {
556
557
  itm.error = false
557
558
 
558
- if (_.isEmpty(itm.gtin) || '') {
559
+ if (isEmpty(itm.gtin) || '') {
559
560
  itm.error = true
560
561
  if (!errors.find(err => err.type == 'gtin')) errors.push({ type: 'gtin', value: 'GTIN is required' })
561
562
  }
562
- if (_.isEmpty(itm.packingType) || '') {
563
+ if (isEmpty(itm.packingType) || '') {
563
564
  itm.error = true
564
565
  if (!errors.find(err => err.type == 'packingType'))
565
566
  errors.push({ type: 'packingType', value: 'Packing type is required' })
566
567
  }
567
- if (_.isEmpty(itm.uom) || '') {
568
+ if (isEmpty(itm.uom) || '') {
568
569
  itm.error = true
569
570
  if (!errors.find(err => err.type == 'uom')) errors.push({ type: 'uom', value: 'UOM is required' })
570
571
  }
571
- if (!_.isNumber(itm.uomValue) || _.isNaN(itm.uomValue) || '') {
572
+ if (!isNumber(itm.uomValue) || isNaN(itm.uomValue) || '') {
572
573
  itm.error = true
573
574
  if (!errors.find(err => err.type == 'uomValue'))
574
575
  errors.push({ type: 'uomValue', value: 'UOM Value is required' })
@@ -626,7 +627,7 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
626
627
  ...this.dataGrist._data,
627
628
  records: this._updateRowOption(
628
629
  this.dataGrist._data.records.map((record, idx) => {
629
- if (!_.isEmpty(record.childProductDetail) && record.childProductDetail == before) {
630
+ if (!isEmpty(record.childProductDetail) && record.childProductDetail == before) {
630
631
  record.childProductDetail = after
631
632
  }
632
633
  return record
@@ -636,7 +637,7 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
636
637
 
637
638
  break
638
639
  case 'uomValue':
639
- if (_.isNaN(after)) {
640
+ if (isNaN(after)) {
640
641
  updatedRecords.records[row].uomValue = 1
641
642
  }
642
643
  break
@@ -691,7 +692,7 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
691
692
  value: ''
692
693
  },
693
694
  ...data
694
- .filter(child => child.gtin != itm.gtin && !_.isEmpty(child.gtin))
695
+ .filter(child => child.gtin != itm.gtin && !isEmpty(child.gtin))
695
696
  .map(x => {
696
697
  const rowOption = {
697
698
  display: x.gtin,
@@ -5,6 +5,9 @@ import './product-detail-bizplace-setting-popup'
5
5
 
6
6
  import gql from 'graphql-tag'
7
7
  import { css, html } from 'lit-element'
8
+ import isEmpty from 'lodash-es/isEmpty'
9
+ import isNaN from 'lodash-es/isNaN'
10
+ import isNumber from 'lodash-es/isNumber'
8
11
 
9
12
  import { getCodeByName } from '@things-factory/code-base'
10
13
  import { i18next, localize } from '@things-factory/i18n-base'
@@ -14,8 +17,6 @@ import { client, CustomAlert, gqlContext, PageView } from '@things-factory/shell
14
17
  import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
15
18
  import { isMobileDevice } from '@things-factory/utils'
16
19
 
17
- const _ = require('lodash')
18
-
19
20
  class ProductList extends localize(i18next)(PageView) {
20
21
  static get properties() {
21
22
  return {
@@ -821,7 +822,7 @@ class ProductList extends localize(i18next)(PageView) {
821
822
 
822
823
  async _saveProducts(patches) {
823
824
  try {
824
- if (_.isEmpty(this._bizplaceInput.value) || this._bizplaceInput?.value == undefined) {
825
+ if (isEmpty(this._bizplaceInput.value) || this._bizplaceInput?.value == undefined) {
825
826
  return this.showToast(i18next.t('text.no_company_selected'))
826
827
  }
827
828
 
@@ -944,23 +945,23 @@ class ProductList extends localize(i18next)(PageView) {
944
945
  _validate(data) {
945
946
  let errors = []
946
947
  data = data.map(itm => {
947
- if (_.isEmpty(itm.sku) || '') {
948
+ if (isEmpty(itm.sku) || '') {
948
949
  if (!errors.find(err => err.type == 'sku')) errors.push({ type: 'sku', value: 'Product SKU is required' })
949
950
  }
950
- if (_.isEmpty(itm.name) || '') {
951
+ if (isEmpty(itm.name) || '') {
951
952
  if (!errors.find(err => err.type == 'name')) errors.push({ type: 'name', value: 'Product name is required' })
952
953
  }
953
- if (_.isEmpty(itm.type) || '') {
954
+ if (isEmpty(itm.type) || '') {
954
955
  if (!errors.find(err => err.type == 'type')) errors.push({ type: 'name', value: 'Product type is required' })
955
956
  }
956
- if (_.isEmpty(itm.packingType) || '') {
957
+ if (isEmpty(itm.packingType) || '') {
957
958
  if (!errors.find(err => err.type == 'packingType'))
958
959
  errors.push({ type: 'packingType', value: 'Packing type is required' })
959
960
  }
960
- if (_.isEmpty(itm.uom) || '') {
961
+ if (isEmpty(itm.uom) || '') {
961
962
  if (!errors.find(err => err.type == 'uom')) errors.push({ type: 'uom', value: 'UOM is required' })
962
963
  }
963
- if (!_.isNumber(itm.uomValue) || _.isNaN(itm.uomValue) || '' || itm?.uomValue <= 0) {
964
+ if (!isNumber(itm.uomValue) || isNaN(itm.uomValue) || '' || itm?.uomValue <= 0) {
964
965
  if (!errors.find(err => err.type == 'uomValue'))
965
966
  errors.push({ type: 'uomValue', value: 'UOM Value is required' })
966
967
  }
@@ -1,13 +1,14 @@
1
1
  import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
3
  import '../batch-picking-popup'
4
+ import '../batch-generate-single-picking-worksheet-popup'
4
5
 
5
6
  import gql from 'graphql-tag'
6
7
  import { css, html } from 'lit-element'
7
8
 
8
9
  import { getCodeByName } from '@things-factory/code-base'
9
10
  import { i18next, localize } from '@things-factory/i18n-base'
10
- import { client, navigate, PageView, CustomAlert } from '@things-factory/shell'
11
+ import { client, navigate, PageView } from '@things-factory/shell'
11
12
  import { openPopup } from '@things-factory/layout-base'
12
13
  import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
13
14
  import { isMobileDevice } from '@things-factory/utils'
@@ -72,7 +73,7 @@ class B2bOrderList extends localize(i18next)(PageView) {
72
73
  },
73
74
  {
74
75
  title: i18next.t('button.generate_worksheet'),
75
- action: this._generatePickingWorksheet.bind(this),
76
+ action: this._openBatchGenerateSinglePickingWorksheetPopup.bind(this),
76
77
  ...CommonButtonStyles.activate
77
78
  }
78
79
  )
@@ -221,7 +222,6 @@ class B2bOrderList extends localize(i18next)(PageView) {
221
222
  pagination: { limit: 100, pages: [20, 50, 100, 200, 500] },
222
223
  columns: [
223
224
  { type: 'gutter', gutterName: 'sequence' },
224
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
225
225
  {
226
226
  type: 'gutter',
227
227
  gutterName: 'button',
@@ -502,45 +502,22 @@ class B2bOrderList extends localize(i18next)(PageView) {
502
502
  )
503
503
  }
504
504
 
505
- async _generatePickingWorksheet() {
506
- try {
507
- let releaseGoodNos = []
508
- if (this.dataGrist.selected.length <= 0)
509
- throw new Error(i18next.t('text.please_select_one_or_more_order_to_generate_worksheet'))
510
-
511
- let readyToPick = this.dataGrist.selected.filter(itm => itm.status === ORDER_STATUS.PENDING_WORKSHEET.value)
512
- releaseGoodNos = readyToPick.map(record => record.name)
513
-
514
- if (releaseGoodNos.length <= 0)
515
- throw new Error(i18next.t('text.selected_release_order(s)_has_existing_worksheet'))
516
-
517
- let result = await CustomAlert({
518
- title: i18next.t('title.are_you_sure'),
519
- text: i18next.t('text.generate_worksheet'),
520
- confirmButton: { text: i18next.t('button.submit') },
521
- cancelButton: { text: i18next.t('button.cancel') }
522
- })
523
-
524
- if (!result.value) return
525
-
526
- const response = await client.mutate({
527
- mutation: gql`
528
- mutation generateMultipleReleaseGoodWorksheet($releaseGoodNos: [String!]) {
529
- generateMultipleReleaseGoodWorksheet(releaseGoodNos: $releaseGoodNos)
530
- }
531
- `,
532
- variables: {
533
- releaseGoodNos
534
- }
535
- })
536
-
537
- if (!response.errors) {
538
- navigate('single_outbound_worksheets')
539
- this._showToast({ message: i18next.t('text.worksheet(s)_has_been_generated') })
505
+ _openBatchGenerateSinglePickingWorksheetPopup() {
506
+ openPopup(
507
+ html`
508
+ <batch-generate-single-picking-worksheet-popup
509
+ @generated="${() => {
510
+ this._showToast({ message: i18next.t('text.orders_has_been_activated') })
511
+ this.dataGrist.fetch()
512
+ }}"
513
+ ></batch-generate-single-picking-worksheet-popup>
514
+ `,
515
+ {
516
+ backdrop: true,
517
+ size: 'large',
518
+ title: i18next.t('title.generate_picking_worksheet')
540
519
  }
541
- } catch (e) {
542
- this._showToast(e)
543
- }
520
+ )
544
521
  }
545
522
 
546
523
  _compareValues(key, order = 'asc') {
@@ -1,6 +1,7 @@
1
1
  import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
3
  import '../batch-picking-popup'
4
+ import '../batch-generate-single-picking-worksheet-popup'
4
5
 
5
6
  import gql from 'graphql-tag'
6
7
  import { css, html } from 'lit-element'
@@ -11,7 +12,7 @@ import { GhostPrint } from '@operato/ghost-print'
11
12
  import { getCodeByName } from '@things-factory/code-base'
12
13
  import { i18next, localize } from '@things-factory/i18n-base'
13
14
  import { openPopup } from '@things-factory/layout-base'
14
- import { client, navigate, PageView, store, CustomAlert } from '@things-factory/shell'
15
+ import { client, navigate, PageView, store } from '@things-factory/shell'
15
16
  import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
16
17
  import { isMobileDevice } from '@things-factory/utils'
17
18
 
@@ -90,7 +91,7 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
90
91
  },
91
92
  {
92
93
  title: i18next.t('button.generate_worksheet'),
93
- action: this._generatePickingWorksheet.bind(this),
94
+ action: this._openBatchGenerateSinglePickingWorksheetPopup.bind(this),
94
95
  ...CommonButtonStyles.activate
95
96
  }
96
97
  ]
@@ -704,45 +705,22 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
704
705
  }
705
706
  }
706
707
 
707
- async _generatePickingWorksheet() {
708
- try {
709
- let releaseGoodNos = []
710
- if (this.dataGrist.selected.length <= 0)
711
- throw new Error(i18next.t('text.please_select_one_or_more_order_to_generate_worksheet'))
712
-
713
- let readyToPick = this.dataGrist.selected.filter(itm => itm.status === ORDER_STATUS.PENDING_WORKSHEET.value)
714
- releaseGoodNos = readyToPick.map(record => record.name)
715
-
716
- if (releaseGoodNos.length <= 0)
717
- throw new Error(i18next.t('text.selected_release_order(s)_has_existing_worksheet'))
718
-
719
- let result = await CustomAlert({
720
- title: i18next.t('title.are_you_sure'),
721
- text: i18next.t('text.generate_worksheet'),
722
- confirmButton: { text: i18next.t('button.submit') },
723
- cancelButton: { text: i18next.t('button.cancel') }
724
- })
725
-
726
- if (!result.value) return
727
-
728
- const response = await client.mutate({
729
- mutation: gql`
730
- mutation generateMultipleReleaseGoodWorksheet($releaseGoodNos: [String!]) {
731
- generateMultipleReleaseGoodWorksheet(releaseGoodNos: $releaseGoodNos)
732
- }
733
- `,
734
- variables: {
735
- releaseGoodNos
736
- }
737
- })
738
-
739
- if (!response.errors) {
740
- navigate('single_outbound_worksheets')
741
- this._showToast({ message: i18next.t('text.worksheet(s)_has_been_generated') })
708
+ _openBatchGenerateSinglePickingWorksheetPopup() {
709
+ openPopup(
710
+ html`
711
+ <batch-generate-single-picking-worksheet-popup
712
+ @generated="${() => {
713
+ this._showToast({ message: i18next.t('text.orders_has_been_activated') })
714
+ this.dataGrist.fetch()
715
+ }}"
716
+ ></batch-generate-single-picking-worksheet-popup>
717
+ `,
718
+ {
719
+ backdrop: true,
720
+ size: 'large',
721
+ title: i18next.t('title.generate_picking_worksheet')
742
722
  }
743
- } catch (e) {
744
- this._showToast(e)
745
- }
723
+ )
746
724
  }
747
725
 
748
726
  _compareValues(key, order = 'asc') {
@@ -35,8 +35,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
35
35
  _productName: String,
36
36
  _logisticsInitiated: Boolean,
37
37
  _selectedTaskStatus: String,
38
- _worksheetInfo: Object,
39
- _scanning: Boolean
38
+ _worksheetInfo: Object
40
39
  }
41
40
  }
42
41
 
@@ -216,15 +215,19 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
216
215
  </form>
217
216
 
218
217
  <form id="input-form" class="multi-column-form" @keypress="${this.packing.bind(this)}">
219
- <fieldset>
220
- ${this._enableProductScanning
221
- ? html` <label>${i18next.t('label.product_barcode')}</label>
222
- <barcode-scanable-input name="productBarcode" custom-input></barcode-scanable-input>`
223
- : html`
224
- <label>${i18next.t('label.packed_qty')}</label>
225
- <input type="number" min="1" name="packedQty" />
226
- `}
227
- </fieldset>
218
+ ${this.scannable
219
+ ? html`
220
+ <fieldset>
221
+ ${this._enableProductScanning
222
+ ? html` <label>${i18next.t('label.product_barcode')}</label>
223
+ <barcode-scanable-input name="productBarcode" custom-input></barcode-scanable-input>`
224
+ : html`
225
+ <label>${i18next.t('label.packed_qty')}</label>
226
+ <input type="number" min="1" name="packedQty" />
227
+ `}
228
+ </fieldset>
229
+ `
230
+ : ''}
228
231
  </form>
229
232
 
230
233
  <data-grist .mode=${isMobileDevice() ? 'LIST' : 'GRID'} .config=${this.config} .data=${this.data}>
@@ -253,7 +256,6 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
253
256
  this._productName = ''
254
257
  this._selectedOrderInventory = null
255
258
  this._selectedTaskStatus = null
256
- this._scanning = false
257
259
  }
258
260
 
259
261
  updated(changedProps) {
@@ -272,8 +274,10 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
272
274
  this._selectedOrderInventory = record
273
275
  this._selectedTaskStatus = record.status
274
276
 
275
- if (this._enableProductScanning) this._focusOnProductBarcodeInput()
276
- else this._focusOnReleaseQtyInput()
277
+ if (this.scannable) {
278
+ if (this._enableProductScanning) this._focusOnProductBarcodeInput()
279
+ else this._focusOnReleaseQtyInput()
280
+ }
277
281
  }
278
282
  }
279
283
  }
@@ -386,13 +390,6 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
386
390
  product {
387
391
  name
388
392
  description
389
- gtin
390
- productDetails {
391
- id
392
- packingType
393
- packingSize
394
- gtin
395
- }
396
393
  }
397
394
  qty
398
395
  releaseQty
@@ -426,10 +423,6 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
426
423
  if (!response.data?.packingWorksheet) return
427
424
 
428
425
  const { worksheetInfo, worksheetDetailInfos } = response.data.packingWorksheet
429
- this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
430
- if (this.data?.records?.length && !this.data.records.some(record => record.completed == false)) {
431
- return this._completeHandler()
432
- }
433
426
 
434
427
  this.trackingNo = worksheetInfo.trackingNo
435
428
  this.airwayBill = worksheetInfo.airwayBill
@@ -442,6 +435,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
442
435
  this._bizplaceName = worksheetInfo.bizplaceName
443
436
  this._worksheetInfo = worksheetInfo
444
437
 
438
+ this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
445
439
  if (this._selectedOrderInventory) {
446
440
  const record = this.data.records.find(record => record.name === this._selectedOrderInventory.name)
447
441
  if (record.packedQty == record.releaseQty) {
@@ -453,11 +447,6 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
453
447
 
454
448
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
455
449
 
456
- if (this._enableProductScanning) {
457
- this._focusOnProductBarcodeInput()
458
- } else {
459
- this._focusOnReleaseQtyInput()
460
- }
461
450
  this.updateContext()
462
451
  }
463
452
  }
@@ -620,7 +609,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
620
609
  if (e.keyCode === 13) {
621
610
  e.preventDefault()
622
611
  try {
623
- await this._validatePacking()
612
+ this._validatePacking()
624
613
 
625
614
  let response
626
615
  if (this._enableProductScanning) response = await this.productBarcodePacking()
@@ -629,9 +618,10 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
629
618
  if (!response.errors) {
630
619
  if (this._enableProductScanning) {
631
620
  this.productBarcodeInput.value = ''
632
- this._selectedOrderInventory = null
621
+ this._focusOnProductBarcodeInput()
633
622
  } else {
634
623
  this.releaseQtyInput.value = ''
624
+ this._focusOnReleaseQtyInput()
635
625
  this._selectedTaskStatus = null
636
626
  this._selectedOrderInventory = null
637
627
  }
@@ -639,25 +629,12 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
639
629
  this._fetchInventories(this.releaseGoodNo)
640
630
  }
641
631
  } catch (e) {
642
- if (this._enableProductScanning) {
643
- this.productBarcodeInput.value = ''
644
- this._focusOnProductBarcodeInput()
645
- } else {
646
- this.releaseQtyInput.value = ''
647
- this._focusOnReleaseQtyInput()
648
- this._selectedTaskStatus = null
649
- }
650
- this._selectedOrderInventory = null
651
632
  this._showToast(e)
652
- } finally {
653
- this._scanning = false
654
633
  }
655
634
  }
656
635
  }
657
636
 
658
637
  async productBarcodePacking() {
659
- if (this._scanning) return this._showToast({ message: i18next.t('text.previous_scan_is_executing') })
660
- this._scanning = true
661
638
  return await client.mutate({
662
639
  mutation: gql`
663
640
  mutation scanProductPacking($worksheetDetailName: String!, $productBarcode: String!) {
@@ -672,8 +649,6 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
672
649
  }
673
650
 
674
651
  async commonPacking() {
675
- if (this._scanning) return this._showToast({ message: i18next.t('text.previous_scan_is_executing') })
676
- this._scanning = true
677
652
  return await client.mutate({
678
653
  mutation: gql`
679
654
  mutation packing($worksheetDetailName: String!, $releaseQty: Int!) {
@@ -689,45 +664,28 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
689
664
 
690
665
  async _validatePacking() {
691
666
  // validate for order selection
692
- if (this._enableProductScanning) {
693
- //if no input
694
- if (!this.productBarcodeInput.value) {
695
- this._focusOnProductBarcodeInput()
696
- throw new Error(i18next.t('text.no_product_barcode_detected'))
697
- }
698
-
699
- //find product match with input barcode
700
- const foundOrderInventory = this.data.records.filter(itm =>
701
- itm.product.productDetails.filter(
702
- detail =>
703
- detail.gtin === this.productBarcodeInput.value.trim() &&
704
- detail.packingType == itm.product.packingType &&
705
- detail.packingSize == itm.product.packingSize
706
- )
707
- )
667
+ if (!this._selectedOrderInventory) throw new Error(i18next.t('text.target_is_not_selected'))
708
668
 
709
- if (foundOrderInventory?.length > 0 && foundOrderInventory[0]?.status === WORKSHEET_STATUS.EXECUTING.value) {
710
- this._selectedOrderInventory = foundOrderInventory[0]
711
- } else if (foundOrderInventory?.length == 1 && foundOrderInventory[0]?.status === WORKSHEET_STATUS.DONE.value) {
712
- throw new Error(i18next.t('text.scanned_product_status_is_done'))
669
+ if (this._selectedOrderInventory) {
670
+ if (this._enableProductScanning) {
671
+ if (!this.productBarcodeInput.value) {
672
+ this._focusOnProductBarcodeInput()
673
+ throw new Error(i18next.t('text.no_product_barcode_detected'))
674
+ }
713
675
  } else {
714
- throw new Error(i18next.t('text.incorrect_product_barcode'))
715
- }
716
- } else {
717
- if (!this._selectedOrderInventory) throw new Error(i18next.t('text.target_is_not_selected'))
718
-
719
- if (!this.releaseQtyInput.checkValidity()) throw new Error(i18next.t('text.release_qty_invalid'))
676
+ if (!this.releaseQtyInput.checkValidity()) throw new Error(i18next.t('text.release_qty_invalid'))
720
677
 
721
- // Release qty existing
722
- if (!parseInt(this.releaseQtyInput.value)) {
723
- this._focusOnReleaseQtyInput()
724
- throw new Error(i18next.t('text.release_qty_is_empty'))
725
- }
678
+ // Release qty existing
679
+ if (!parseInt(this.releaseQtyInput.value)) {
680
+ this._focusOnReleaseQtyInput()
681
+ throw new Error(i18next.t('text.release_qty_is_empty'))
682
+ }
726
683
 
727
- // typed qty should be matched with release qty.
728
- if (parseInt(this.releaseQtyInput.value) !== this._selectedOrderInventory.releaseQty) {
729
- this._focusOnReleaseQtyInput()
730
- throw new Error(i18next.t('text.wrong_release_qty'))
684
+ // typed qty should be matched with release qty.
685
+ if (parseInt(this.releaseQtyInput.value) !== this._selectedOrderInventory.releaseQty) {
686
+ this._focusOnReleaseQtyInput()
687
+ throw new Error(i18next.t('text.wrong_release_qty'))
688
+ }
731
689
  }
732
690
  }
733
691
  }
@@ -6,7 +6,7 @@ import './select-operator-popup'
6
6
 
7
7
  import gql from 'graphql-tag'
8
8
  import { css, html } from 'lit-element'
9
- import orderBy from 'lodash/orderBy'
9
+ import orderBy from 'lodash-es/orderBy'
10
10
 
11
11
  import { MultiColumnFormStyles } from '@things-factory/form-ui'
12
12
  import { i18next, localize } from '@things-factory/i18n-base'