@things-factory/operato-wms 4.3.247 → 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.
Files changed (38) hide show
  1. package/client/pages/bulk-operation/bulk-operation.js +6 -1
  2. package/client/pages/components/select-inventory-popup.js +4 -1
  3. package/client/pages/constants/location.js +4 -0
  4. package/client/pages/inbound/putaway-product.js +43 -10
  5. package/client/pages/inbound/putaway-same-carton-popup.js +9 -7
  6. package/client/pages/inbound/unload-product.js +65 -67
  7. package/client/pages/inbound/worksheet-putaway-return.js +1 -1
  8. package/client/pages/inbound/worksheet-putaway.js +1 -1
  9. package/client/pages/inbound/worksheet-unloading-return.js +3 -3
  10. package/client/pages/inbound/worksheet-unloading.js +1 -1
  11. package/client/pages/inventory/inventory-by-product.js +11 -0
  12. package/client/pages/inventory/onhand-inventory.js +64 -3
  13. package/client/pages/master/product/product-list.js +5 -5
  14. package/client/pages/order/release-order/create-release-order.js +5 -0
  15. package/client/pages/outbound/inventory-reassign-popup.js +3 -2
  16. package/client/pages/outbound/loading-product.js +14 -4
  17. package/client/pages/outbound/sorting-product.js +1 -1
  18. package/client/pages/outbound/worksheet-batch-picking.js +214 -144
  19. package/client/pages/outbound/worksheet-loading.js +1 -1
  20. package/client/pages/outbound/worksheet-packing.js +1 -1
  21. package/client/pages/outbound/worksheet-picking.js +357 -250
  22. package/client/pages/outbound/worksheet-return.js +1 -1
  23. package/client/pages/outbound/worksheet-sorting.js +1 -1
  24. package/config.development.js +15 -15
  25. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +37 -2
  26. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  27. package/dist-server/migrations/1687413760311-UpdateProductDetailStockQty.js +36 -0
  28. package/dist-server/migrations/1687413760311-UpdateProductDetailStockQty.js.map +1 -0
  29. package/dist-server/migrations/1687415141200-InsertNewProductDetailStock.js +32 -0
  30. package/dist-server/migrations/1687415141200-InsertNewProductDetailStock.js.map +1 -0
  31. package/package.json +23 -23
  32. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +37 -2
  33. package/server/migrations/1687413760311-UpdateProductDetailStockQty.ts +34 -0
  34. package/server/migrations/1687415141200-InsertNewProductDetailStock.ts +30 -0
  35. package/translations/en.json +7 -0
  36. package/translations/ko.json +7 -0
  37. package/translations/ms.json +7 -0
  38. package/translations/zh.json +7 -0
@@ -379,9 +379,9 @@ class ProductList extends localize(i18next)(PageView) {
379
379
  },
380
380
  {
381
381
  type: 'integer',
382
- name: 'expirationPeriod',
382
+ name: 'minInboundShelfLife',
383
383
  record: { editable: true },
384
- imex: { header: i18next.t('field.expiration_period'), key: 'expirationPeriod', width: 30, type: 'integer' },
384
+ imex: { header: i18next.t('field.expiration_period'), key: 'minInboundShelfLife', width: 30, type: 'integer' },
385
385
  header: i18next.t('field.expiration_period'),
386
386
  sortable: true,
387
387
  width: 140
@@ -676,7 +676,7 @@ class ProductList extends localize(i18next)(PageView) {
676
676
  type
677
677
  inventoryAccountCode
678
678
  cogsAccountCode
679
- expirationPeriod
679
+ minInboundShelfLife
680
680
  weightUnit
681
681
  nettWeight
682
682
  grossWeight
@@ -833,7 +833,7 @@ class ProductList extends localize(i18next)(PageView) {
833
833
  patches = patches.map(patch => {
834
834
  return {
835
835
  ...patch,
836
- expirationPeriod: patch?.expirationPeriod ? parseInt(patch.expirationPeriod) : undefined,
836
+ minInboundShelfLife: patch?.minInboundShelfLife ? parseInt(patch.minInboundShelfLife) : undefined,
837
837
  productRef: patch.productRef?.id ? { id: patch.productRef?.id } : undefined,
838
838
  parentProductRef: patch.parentProductRef?.id ? { id: patch.parentProductRef?.id } : undefined,
839
839
  bizplace: { id: this._bizplaceInput.value }
@@ -872,7 +872,7 @@ class ProductList extends localize(i18next)(PageView) {
872
872
  patches = patches.map(patch => {
873
873
  return {
874
874
  ...patch,
875
- expirationPeriod: patch?.expirationPeriod ? parseInt(patch.expirationPeriod) : undefined,
875
+ minInboundShelfLife: patch?.minInboundShelfLife ? parseInt(patch.minInboundShelfLife) : undefined,
876
876
  productRef: patch.productRef?.id ? { id: patch.productRef?.id } : undefined,
877
877
  bizplace: { id: this._bizplaceInput.value }
878
878
  }
@@ -2515,6 +2515,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2515
2515
 
2516
2516
  _validateInventories() {
2517
2517
  const inventories = this.inventoryGrist?.dirtyData?.records
2518
+ let recall = this._recallInput.checked
2518
2519
  if (!inventories?.length) throw new Error(i18next.t('text.no_products'))
2519
2520
  // required field (batchId, packingType, uomValue, unit, packQty)
2520
2521
  if (!inventories.every(record => record.releaseQty && record.batchId && record.packingType)) {
@@ -2540,6 +2541,10 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2540
2541
  throw new Error(i18next.t('text.lot_id_is_duplicated'))
2541
2542
  }
2542
2543
  }
2544
+
2545
+ if (inventories.some(record => record.locationType == 'DAMAGE') && recall == false) {
2546
+ throw new Error(i18next.t('text.there_are_damaged_inventories'))
2547
+ }
2543
2548
  }
2544
2549
 
2545
2550
  _validateVas() {
@@ -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 {
@@ -340,7 +340,7 @@ class LoadingProduct extends connect(store)(localize(i18next)(PageView)) {
340
340
  width: 140
341
341
  })
342
342
 
343
- fields = [
343
+ fields = this._hasVas ? [
344
344
  'hasVas',
345
345
  'palletId',
346
346
  'productSku',
@@ -352,6 +352,16 @@ class LoadingProduct extends connect(store)(localize(i18next)(PageView)) {
352
352
  'releaseQty',
353
353
  'pickedQty',
354
354
  'loadedQty'
355
+ ] : [
356
+ 'palletId',
357
+ 'productSku',
358
+ 'product',
359
+ 'packingType',
360
+ 'packingSize',
361
+ 'batchId',
362
+ 'batchIdRef',
363
+ 'pickedQty',
364
+ 'loadedQty'
355
365
  ]
356
366
  }
357
367
 
@@ -666,10 +676,10 @@ class LoadingProduct extends connect(store)(localize(i18next)(PageView)) {
666
676
 
667
677
  this._hasVas = this.pickedProductData.records.find(data => data.hasVas == true) ? true : false
668
678
 
669
- this.pickedProductData = { records: this.sortByNameField(this.pickedProductData) }
670
-
671
679
  // causes grist unable to display data
672
- this.pageInitialized()
680
+ await this.pageInitialized()
681
+ this.pickedProductData = { records: this.sortByNameField(this.pickedProductData) }
682
+ //this.updateContext()
673
683
  // causes grist unable to display data
674
684
  } else {
675
685
  throw new Error(response.errors[0])
@@ -909,7 +909,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
909
909
  sku
910
910
  isRequiredCheckExpiry
911
911
  isRequireSerialNumberScanningInbound
912
- expirationPeriod
912
+ minInboundShelfLife
913
913
  }
914
914
  }
915
915
  total
@@ -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),
@@ -206,7 +214,7 @@ class WorksheetBatchPicking extends localize(i18next)(PageView) {
206
214
  </fieldset>
207
215
  </form>
208
216
 
209
- <barcode-tag bcid="qrcode" .value=${this._taskNo}></barcode-tag>
217
+ <barcode-tag bcid="qrcode" .value=${this._taskNo} showLogo="true"></barcode-tag>
210
218
  </div>
211
219
 
212
220
  <div class="grist">
@@ -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
 
@@ -150,7 +150,7 @@ class WorksheetLoading extends localize(i18next)(PageView) {
150
150
  </fieldset>
151
151
  </form>
152
152
 
153
- <barcode-tag bcid="qrcode" .value=${this._roNo}></barcode-tag>
153
+ <barcode-tag bcid="qrcode" .value=${this._roNo} showLogo="true"></barcode-tag>
154
154
  </div>
155
155
 
156
156
  <div class="grist">
@@ -192,7 +192,7 @@ class WorksheetPacking extends localize(i18next)(PageView) {
192
192
  </fieldset>
193
193
  </form>
194
194
 
195
- <barcode-tag bcid="qrcode" .value=${this._roNo}></barcode-tag>
195
+ <barcode-tag bcid="qrcode" .value=${this._roNo} showLogo="true"></barcode-tag>
196
196
  </div>
197
197
 
198
198
  <div class="grist">