@things-factory/operato-wms 4.3.248 → 4.3.249

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.
@@ -189,7 +189,12 @@ class BulkOperation extends localize(i18next)(PageView) {
189
189
  refNo: '',
190
190
  refNo2: '',
191
191
  refNo3: '',
192
- releaseDate: '',
192
+ releaseDate:
193
+ (new Date().getMonth() + 1).toString() +
194
+ '-' +
195
+ new Date().getDate().toString() +
196
+ '-' +
197
+ new Date().getFullYear(),
193
198
  attentionTo: '',
194
199
  attentionCompany: '',
195
200
  deliveryAddress1: '',
@@ -28,7 +28,8 @@ class InventoryReassignPopup extends localize(i18next)(LitElement) {
28
28
  bizplaceId: String,
29
29
  recallOption: Boolean,
30
30
  _itemNotReassignable: Boolean,
31
- _strictProductSelection: Boolean
31
+ _strictProductSelection: Boolean,
32
+ worksheetPickingAssignment: Boolean
32
33
  }
33
34
  }
34
35
 
@@ -626,7 +627,7 @@ class InventoryReassignPopup extends localize(i18next)(LitElement) {
626
627
  if (!response.errors) {
627
628
  let isObsolete
628
629
  const data = response.data.orderInventories.items.map(item => {
629
- if (item.inventory.obsolete) {
630
+ if (item?.inventory?.obsolete) {
630
631
  isObsolete = true
631
632
  }
632
633
  return {
@@ -15,6 +15,7 @@ import { openPopup } from '@things-factory/layout-base'
15
15
  import { client, CustomAlert, navigate, PageView } from '@things-factory/shell'
16
16
  import { CommonButtonStyles } from '@things-factory/styles'
17
17
  import { isMobileDevice } from '@things-factory/utils'
18
+ import { fetchSettingRule } from '../../fetch-setting-value'
18
19
 
19
20
  import { ORDER_INVENTORY_STATUS, WORKSHEET_STATUS } from '../constants'
20
21
 
@@ -33,7 +34,9 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
33
34
  productGristData: Object,
34
35
  worksheetDetailData: Object,
35
36
  releaseGoodNoRows: Number,
36
- isRecall: Boolean
37
+ isRecall: Boolean,
38
+ isAssignedInventory: Boolean,
39
+ _worksheetPickingAssignment: Boolean
37
40
  }
38
41
  }
39
42
 
@@ -135,21 +138,26 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
135
138
  }
136
139
 
137
140
  if (this.activatable) {
138
- actions.push(
139
- {
141
+ if (this.isAssignedInventory) {
142
+ actions.push({
140
143
  title: i18next.t('button.reassign'),
141
144
  action: this._openReassignInventoryPopup.bind(this),
142
145
  ...CommonButtonStyles.assignment
143
- },
144
- {
145
- title: i18next.t('button.activate'),
146
- action: this._activateWorksheet.bind(this),
147
- ...CommonButtonStyles.activate
148
- }
149
- )
146
+ })
147
+ }
148
+
149
+ actions.push({
150
+ title: i18next.t('button.activate'),
151
+ action: this._activateWorksheet.bind(this),
152
+ ...CommonButtonStyles.activate
153
+ })
150
154
  }
151
155
 
152
- if (!this.activatable && this.worksheetDetailData?.records.find(itm => itm.obsolete == true)) {
156
+ if (
157
+ !this.activatable &&
158
+ (this.worksheetDetailData?.records.find(itm => itm.obsolete == true) ||
159
+ (this._worksheetPickingAssignment && this.worksheetDetailData?.records.find(itm => itm.status == 'PICKING')))
160
+ ) {
153
161
  actions.push({
154
162
  title: i18next.t('button.reassign'),
155
163
  action: this._openReassignInventoryPopup.bind(this),
@@ -157,7 +165,7 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
157
165
  })
158
166
  }
159
167
 
160
- if (this.assignable) {
168
+ if (this.assignable && !this._worksheetPickingAssignment) {
161
169
  actions.push({
162
170
  title: i18next.t('button.auto_assign'),
163
171
  action: this._showAutoAssignPopup.bind(this),
@@ -224,16 +232,21 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
224
232
  </div>
225
233
  `
226
234
  : ''}
227
-
228
- <div class="grist-column">
229
- <h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.worksheet_detail')}</h2>
230
- <data-grist
231
- id="wsd-grist"
232
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
233
- .config=${this.wsdGristConfig}
234
- .data="${this.worksheetDetailData}"
235
- ></data-grist>
236
- </div>
235
+ ${this._worksheetStatus == WORKSHEET_STATUS.DEACTIVATED.value &&
236
+ this._worksheetPickingAssignment &&
237
+ this.worksheetDetailData.records.length == 0
238
+ ? ''
239
+ : html`
240
+ <div class="grist-column">
241
+ <h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.worksheet_detail')}</h2>
242
+ <data-grist
243
+ id="wsd-grist"
244
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
245
+ .config=${this.wsdGristConfig}
246
+ .data="${this.worksheetDetailData}"
247
+ ></data-grist>
248
+ </div>
249
+ `}
237
250
  </div>
238
251
  `
239
252
  }
@@ -252,7 +265,9 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
252
265
  }
253
266
  }
254
267
 
255
- pageInitialized() {
268
+ async pageInitialized() {
269
+ this._worksheetPickingAssignment = await fetchSettingRule('enable-worksheet-picking-activation-assignment')
270
+
256
271
  this.productGristConfig = {
257
272
  pagination: { infinite: true },
258
273
  rows: {
@@ -305,6 +320,7 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
305
320
  handlers: {
306
321
  click: (columns, data, column, record, rowIndex) => {
307
322
  if (record.completed) return
323
+ if (this._worksheetPickingAssignment) return
308
324
 
309
325
  this._selectedProduct = {
310
326
  batchId: record.batchId,
@@ -479,13 +495,15 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
479
495
  }
480
496
 
481
497
  get undoable() {
482
- return this.productGristData?.records.some(record => record.completed) && this._selectedProduct?.completed
498
+ return this.productGristData?.records.some(record => record?.completed) && this._selectedProduct?.completed
483
499
  }
484
500
 
485
501
  get activatable() {
486
502
  if (this.productGristData?.records.every(record => record.completed)) {
487
503
  let foundObsoleteItems = this.worksheetDetailData?.records.find(itm => itm.obsolete == true)
488
504
  return this._worksheetStatus === WORKSHEET_STATUS.DEACTIVATED.value && (!foundObsoleteItems || this.isRecall)
505
+ } else {
506
+ return this._worksheetStatus === WORKSHEET_STATUS.DEACTIVATED.value && this._worksheetPickingAssignment
489
507
  }
490
508
  }
491
509
 
@@ -582,6 +600,25 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
582
600
  }
583
601
  }
584
602
  }
603
+ targetProduct {
604
+ batchId
605
+ product {
606
+ id
607
+ name
608
+ sku
609
+ description
610
+ pickingStrategy
611
+ }
612
+ releaseGood {
613
+ id
614
+ name
615
+ }
616
+ packingType
617
+ packingSize
618
+ releaseQty
619
+ releaseUomValue
620
+ status
621
+ }
585
622
  }
586
623
  }
587
624
  }
@@ -598,145 +635,174 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
598
635
  this._worksheetType = worksheet.type
599
636
  this.assignee = worksheet.assignee || {}
600
637
 
601
- const { tempOrderInvs, completedOrderInvs, uniqueReleaseGoods } = worksheet.orderInventories.reduce(
602
- (result, ordInv) => {
603
- if (!result.uniqueReleaseGoods.find(name => name == ordInv.releaseGood.name))
604
- result.uniqueReleaseGoods.push(ordInv.releaseGood.name)
638
+ if (worksheet.orderInventories.length > 0) {
639
+ const { tempOrderInvs, completedOrderInvs, uniqueReleaseGoods } = worksheet.orderInventories.reduce(
640
+ (result, ordInv) => {
641
+ if (!result.uniqueReleaseGoods.find(name => name == ordInv.releaseGood.name))
642
+ result.uniqueReleaseGoods.push(ordInv.releaseGood.name)
605
643
 
606
- if (
607
- ordInv.status === ORDER_INVENTORY_STATUS.PENDING_SPLIT.value ||
608
- ordInv.status === ORDER_INVENTORY_STATUS.COMPLETE_SPLIT.value
609
- ) {
610
- ordInv.productSku = ordInv.product.sku
611
- result.tempOrderInvs.push(ordInv)
612
- } else {
613
- ordInv.productSku = ordInv.product.sku
614
- ordInv.releaseUomValueWithUom = Math.round(ordInv.releaseUomValue).toFixed(2) + ' ' + ordInv.inventory.uom
615
- let existingCompOrderInvsIndex = result.completedOrderInvs.findIndex(
616
- oinv => oinv.inventory.palletId == ordInv.inventory.palletId
617
- )
618
-
619
- if (existingCompOrderInvsIndex < 0) {
620
- result.completedOrderInvs.push({
621
- ...ordInv,
622
- releaseGood: [ordInv.releaseGood],
623
- qty: ordInv.inventory.qty
624
- })
644
+ if (
645
+ ordInv.status === ORDER_INVENTORY_STATUS.PENDING_SPLIT.value ||
646
+ ordInv.status === ORDER_INVENTORY_STATUS.COMPLETE_SPLIT.value
647
+ ) {
648
+ ordInv.productSku = ordInv.product.sku
649
+ result.tempOrderInvs.push(ordInv)
625
650
  } else {
626
- let existingCompOrderInvs = result.completedOrderInvs[existingCompOrderInvsIndex]
627
- result.completedOrderInvs[existingCompOrderInvsIndex] = {
628
- ...existingCompOrderInvs,
629
- releaseGood: [...existingCompOrderInvs.releaseGood, ordInv.releaseGood],
630
- releaseQty: existingCompOrderInvs.releaseQty + ordInv.releaseQty,
631
- releaseUomValue: existingCompOrderInvs.releaseUomValue + ordInv.releaseUomValue,
632
- releaseUomValueWithUom: `${Math.round(
633
- existingCompOrderInvs.releaseUomValue + ordInv.releaseUomValue
634
- ).toFixed(2)} ${ordInv.inventory.uom}`
651
+ ordInv.productSku = ordInv.product.sku
652
+ ordInv.releaseUomValueWithUom =
653
+ Math.round(ordInv.releaseUomValue).toFixed(2) + ' ' + ordInv.inventory.uom
654
+ let existingCompOrderInvsIndex = result.completedOrderInvs.findIndex(
655
+ oinv => oinv.inventory.palletId == ordInv.inventory.palletId
656
+ )
657
+
658
+ if (existingCompOrderInvsIndex < 0) {
659
+ result.completedOrderInvs.push({
660
+ ...ordInv,
661
+ releaseGood: [ordInv.releaseGood],
662
+ qty: ordInv.inventory.qty
663
+ })
664
+ } else {
665
+ let existingCompOrderInvs = result.completedOrderInvs[existingCompOrderInvsIndex]
666
+ result.completedOrderInvs[existingCompOrderInvsIndex] = {
667
+ ...existingCompOrderInvs,
668
+ releaseGood: [...existingCompOrderInvs.releaseGood, ordInv.releaseGood],
669
+ releaseQty: existingCompOrderInvs.releaseQty + ordInv.releaseQty,
670
+ releaseUomValue: existingCompOrderInvs.releaseUomValue + ordInv.releaseUomValue,
671
+ releaseUomValueWithUom: `${Math.round(
672
+ existingCompOrderInvs.releaseUomValue + ordInv.releaseUomValue
673
+ ).toFixed(2)} ${ordInv.inventory.uom}`
674
+ }
635
675
  }
636
676
  }
637
- }
638
677
 
639
- return result
640
- },
641
- {
642
- tempOrderInvs: [],
643
- completedOrderInvs: [],
644
- uniqueReleaseGoods: []
645
- }
646
- )
647
-
648
- this.releaseGoodNoRows = uniqueReleaseGoods.length
649
- worksheet.releaseGoodNo = uniqueReleaseGoods.join(',\n')
678
+ return result
679
+ },
680
+ {
681
+ tempOrderInvs: [],
682
+ completedOrderInvs: [],
683
+ uniqueReleaseGoods: []
684
+ }
685
+ )
650
686
 
651
- this.isRecall = uniqueReleaseGoods.map(itm => itm.recall == true)
687
+ this.releaseGoodNoRows = uniqueReleaseGoods.length
688
+ worksheet.releaseGoodNo = uniqueReleaseGoods.join(',\n')
652
689
 
653
- this._fillupForm({ ...worksheet, bizplace: worksheet.bizplace.name, assignee: worksheet.assignee?.name || '' })
690
+ this.isRecall = uniqueReleaseGoods.map(itm => itm.recall == true)
654
691
 
655
- // if (this._worksheetStatus !== WORKSHEET_STATUS.DEACTIVATED.value) this.fetchWorksheetDetails()
692
+ // if (this._worksheetStatus !== WORKSHEET_STATUS.DEACTIVATED.value) this.fetchWorksheetDetails()
656
693
 
657
- this.isPalletPickingOrder = Boolean(!tempOrderInvs || !tempOrderInvs.length)
694
+ this.isPalletPickingOrder = Boolean(!tempOrderInvs || !tempOrderInvs.length)
658
695
 
659
- let groupedOI = tempOrderInvs.reduce((ordInv, compOrdInv) => {
660
- var foundOrdInv = ordInv.find(
661
- ordInv =>
662
- ordInv.batchId === compOrdInv.batchId &&
663
- ordInv.product.id === compOrdInv.product.id &&
664
- ordInv.packingType === compOrdInv.packingType
665
- )
696
+ let groupedOI = tempOrderInvs.reduce((ordInv, compOrdInv) => {
697
+ var foundOrdInv = ordInv.find(
698
+ ordInv =>
699
+ ordInv.batchId === compOrdInv.batchId &&
700
+ ordInv.product.id === compOrdInv.product.id &&
701
+ ordInv.packingType === compOrdInv.packingType
702
+ )
666
703
 
667
- if (!foundOrdInv) {
668
- foundOrdInv = {
669
- ...compOrdInv,
670
- extraJsonData: [compOrdInv]
671
- }
672
- ordInv.push(foundOrdInv)
673
- return ordInv
674
- } else {
675
- return ordInv.map(oi => {
676
- if (
677
- oi.batchId === compOrdInv.batchId &&
678
- oi.product.id === compOrdInv.product.id &&
679
- oi.packingType === compOrdInv.packingType
680
- ) {
681
- return {
682
- ...oi,
683
- releaseQty: oi.releaseQty + compOrdInv.releaseQty,
684
- releaseUomValue: oi.releaseUomValue + compOrdInv.releaseUomValue,
685
- extraJsonData: [...oi.extraJsonData, compOrdInv]
686
- }
687
- } else {
688
- return oi
704
+ if (!foundOrdInv) {
705
+ foundOrdInv = {
706
+ ...compOrdInv,
707
+ extraJsonData: [compOrdInv]
689
708
  }
690
- })
691
- }
692
- }, [])
693
-
694
- this.productGristData = {
695
- records: orderBy(
696
- groupedOI.map(ordInv => {
697
- const { compQty, compUomValue, unassignedQty, unassignedUomValue } = completedOrderInvs.reduce(
698
- (result, compOrdInv) => {
699
- if (this._checkSameOrderInv(ordInv, compOrdInv)) {
700
- result.unassignedQty = compOrdInv.releaseQty - ordInv.releaseQty
701
- result.unassignedUomValue = compOrdInv.releaseUomValue - ordInv.releaseUomValue
702
- result.compQty = compOrdInv.releaseQty - result.unassignedQty
703
- result.compUomValue = compOrdInv.releaseUomValue - result.unassignedUomValue
709
+ ordInv.push(foundOrdInv)
710
+ return ordInv
711
+ } else {
712
+ return ordInv.map(oi => {
713
+ if (
714
+ oi.batchId === compOrdInv.batchId &&
715
+ oi.product.id === compOrdInv.product.id &&
716
+ oi.packingType === compOrdInv.packingType
717
+ ) {
718
+ return {
719
+ ...oi,
720
+ releaseQty: oi.releaseQty + compOrdInv.releaseQty,
721
+ releaseUomValue: oi.releaseUomValue + compOrdInv.releaseUomValue,
722
+ extraJsonData: [...oi.extraJsonData, compOrdInv]
704
723
  }
724
+ } else {
725
+ return oi
726
+ }
727
+ })
728
+ }
729
+ }, [])
730
+
731
+ this.productGristData = {
732
+ records: orderBy(
733
+ groupedOI.map(ordInv => {
734
+ const { compQty, compUomValue, unassignedQty, unassignedUomValue } = completedOrderInvs.reduce(
735
+ (result, compOrdInv) => {
736
+ if (this._checkSameOrderInv(ordInv, compOrdInv)) {
737
+ result.unassignedQty = compOrdInv.releaseQty - ordInv.releaseQty
738
+ result.unassignedUomValue = compOrdInv.releaseUomValue - ordInv.releaseUomValue
739
+ result.compQty = compOrdInv.releaseQty - result.unassignedQty
740
+ result.compUomValue = compOrdInv.releaseUomValue - result.unassignedUomValue
741
+ }
705
742
 
706
- // need to round off the completed uomValue to bypass the validation
707
- result.compUomValue = Math.round(result.compUomValue * 100) / 100
743
+ // need to round off the completed uomValue to bypass the validation
744
+ result.compUomValue = Math.round(result.compUomValue * 100) / 100
708
745
 
709
- return result
710
- },
711
- { compQty: 0, compUomValue: 0, unassignedQty: 0, unassignedUomValue: 0 }
712
- )
746
+ return result
747
+ },
748
+ { compQty: 0, compUomValue: 0, unassignedQty: 0, unassignedUomValue: 0 }
749
+ )
713
750
 
714
- return {
715
- ...ordInv,
716
- ...ordInv.product,
717
- completed: compQty === ordInv.releaseQty && compUomValue === ordInv.releaseUomValue
718
- }
719
- }),
720
- ['completed', 'sku'],
721
- ['asc', 'asc']
722
- )
723
- }
751
+ return {
752
+ ...ordInv,
753
+ ...ordInv.product,
754
+ completed: compQty === ordInv.releaseQty && compUomValue === ordInv.releaseUomValue
755
+ }
756
+ }),
757
+ ['completed', 'sku'],
758
+ ['asc', 'asc']
759
+ )
760
+ }
724
761
 
725
- if (completedOrderInvs && completedOrderInvs.length) {
726
- this.worksheetDetailData = {
727
- records: completedOrderInvs.map(item =>
728
- Object.assign(
729
- { description: item.description },
730
- { sku: item.product.sku },
731
- item,
732
- item?.inventory,
733
- { availableQty: item.inventory.qty - item.inventory.lockedQty + item.releaseQty },
734
- item?.inventory?.location
762
+ if (completedOrderInvs && completedOrderInvs.length) {
763
+ this.worksheetDetailData = {
764
+ records: completedOrderInvs.map(item =>
765
+ Object.assign(
766
+ { description: item.description },
767
+ { sku: item.product.sku },
768
+ item,
769
+ item?.inventory,
770
+ { availableQty: item.inventory.qty - item.inventory.lockedQty + item.releaseQty },
771
+ item?.inventory?.location
772
+ )
735
773
  )
774
+ }
775
+ }
776
+ } else {
777
+ this.productGristData = {
778
+ records: orderBy(
779
+ worksheet.worksheetDetails.map(wsd => wsd.targetProduct),
780
+ ['completed', 'sku'],
781
+ ['asc', 'asc']
736
782
  )
737
783
  }
784
+ const { uniqueReleaseGoods } = worksheet.worksheetDetails.reduce(
785
+ (result, wsd) => {
786
+ if (!result?.uniqueReleaseGoods.find(name => name == wsd.targetProduct.releaseGood.name))
787
+ result?.uniqueReleaseGoods.push(wsd.targetProduct.releaseGood.name)
788
+
789
+ return result
790
+ },
791
+ {
792
+ uniqueReleaseGoods: []
793
+ }
794
+ )
795
+ this.releaseGoodNoRows = uniqueReleaseGoods.length
796
+ worksheet.releaseGoodNo = uniqueReleaseGoods.join(',\n')
797
+
798
+ this.isRecall = uniqueReleaseGoods.map(itm => itm.recall == true)
738
799
  }
739
800
 
801
+ this._fillupForm({
802
+ ...worksheet,
803
+ bizplace: worksheet.bizplace.name,
804
+ assignee: worksheet.assignee?.name || ''
805
+ })
740
806
  this.updateContext()
741
807
  }
742
808
  } catch (e) {
@@ -1089,13 +1155,17 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
1089
1155
  if (this?.productGrist) {
1090
1156
  this.productGrist.showSpinner()
1091
1157
  }
1092
- this.wsdGrist.showSpinner()
1158
+ if (this?.wsdGrist) {
1159
+ this.wsdGrist.showSpinner()
1160
+ }
1093
1161
  } else {
1094
1162
  this._loading = false
1095
1163
  if (this?.productGrist) {
1096
1164
  this.productGrist.hideSpinner()
1097
1165
  }
1098
- this.wsdGrist.hideSpinner()
1166
+ if (this?.wsdGrist) {
1167
+ this.wsdGrist.hideSpinner()
1168
+ }
1099
1169
  }
1100
1170
  }
1101
1171