@things-factory/operato-wms 4.3.103 → 4.3.105-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/client/pages/bulk-operation/bulk-operation.js +8 -10
  2. package/client/pages/components/select-inventory-popup.js +7 -1
  3. package/client/pages/components/select-product-popup.js +31 -2
  4. package/client/pages/inbound/undo-putaway-popup.js +5 -9
  5. package/client/pages/inbound/undo-unload-popup.js +15 -2
  6. package/client/pages/inbound/unload-product.js +71 -67
  7. package/client/pages/inventory/inventory-adjustment-approval.js +4 -5
  8. package/client/pages/inventory/inventory-adjustment.js +7 -0
  9. package/client/pages/inventory-check/create-cycle-count.js +2 -3
  10. package/client/pages/inventory-check/inventory-check-list.js +94 -10
  11. package/client/pages/manifest/loading-manifest-detail.js +7 -4
  12. package/client/pages/master/generate-location-list.js +30 -22
  13. package/client/pages/master/location-list.js +114 -73
  14. package/client/pages/master/pallet-list.js +88 -58
  15. package/client/pages/master/product/product-details-popup.js +3 -3
  16. package/client/pages/master/tote-list.js +35 -27
  17. package/client/pages/master/transport-driver.js +50 -41
  18. package/client/pages/master/transport-vehicle.js +45 -41
  19. package/client/pages/master/warehouse-list.js +56 -34
  20. package/client/pages/order/arrival-notice/arrival-notice-detail.js +36 -25
  21. package/client/pages/order/arrival-notice/create-arrival-notice.js +53 -32
  22. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +2 -0
  23. package/client/pages/order/arrival-notice/edit-product-popup.js +9 -7
  24. package/client/pages/order/draft-release-good/draft-release-good-detail.js +7 -1
  25. package/client/pages/order/release-order/create-release-order.js +24 -5
  26. package/client/pages/order/release-order/release-extra-product-popup.js +4 -1
  27. package/client/pages/order/release-order/release-order-detail.js +4 -0
  28. package/client/pages/order/return-order/create-return-order.js +1 -0
  29. package/client/pages/order/return-order/return-order-inventory-popup.js +1 -0
  30. package/client/pages/outbound/inventory-reassign-popup.js +6 -0
  31. package/client/pages/outbound/packing-product.js +115 -13
  32. package/client/pages/outbound/picking-product.js +44 -32
  33. package/config.development.js +27 -33
  34. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +4 -5
  35. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  36. package/dist-server/graphql/resolvers/other/add-release-good-products.js +7 -11
  37. package/dist-server/graphql/resolvers/other/add-release-good-products.js.map +1 -1
  38. package/dist-server/graphql/resolvers/reports/costing-report.js +18 -24
  39. package/dist-server/graphql/resolvers/reports/costing-report.js.map +1 -1
  40. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +6 -6
  41. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +5 -6
  42. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  43. package/package.json +50 -50
  44. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +4 -5
  45. package/server/graphql/resolvers/other/add-release-good-products.ts +8 -12
  46. package/server/graphql/resolvers/reports/costing-report.ts +18 -24
  47. package/server/graphql/resolvers/reports/inbound-order-details-report.ts +6 -6
  48. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +5 -6
  49. package/translations/en.json +11 -10
  50. package/translations/ko.json +11 -10
  51. package/translations/ms.json +11 -10
  52. package/translations/zh.json +4 -3
@@ -872,7 +872,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
872
872
 
873
873
  if (changedColumn === 'unitPrice') {
874
874
  let unitPrice = changeRecord.unitPrice
875
- if (typeof unitPrice === undefined || unitPrice < 0) {
875
+ if (typeof unitPrice === undefined || unitPrice < 0 || isNaN(unitPrice)) {
876
876
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
877
877
  }
878
878
  }
@@ -1210,7 +1210,12 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1210
1210
  _validateForm() {
1211
1211
  if (!this.arrivalNoticeForm.checkValidity()) throw new Error(i18next.t('text.arrival_notice_form_invalid'))
1212
1212
 
1213
- if (this._hasContainer) if (!this.containerNo.value) throw new Error(i18next.t('text.container_no_is_empty'))
1213
+ if (this._hasContainer) {
1214
+ if (!this.containerNo.value) throw new Error(i18next.t('text.container_no_is_empty'))
1215
+
1216
+ if (!this.arrivalNoticeForm?.containerSize?.value || this.arrivalNoticeForm?.containerSize?.value == '')
1217
+ throw new Error(i18next.t('text.please_select_container_size'))
1218
+ }
1214
1219
 
1215
1220
  if (this._ownTransport && this._warehouseTransport)
1216
1221
  throw new Error(i18next.t('text.you_can_only_select_one_transport_type'))
@@ -1218,9 +1223,9 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1218
1223
  throw new Error(i18next.t('text.please_select_transport_type'))
1219
1224
  }
1220
1225
 
1221
- _validateProducts() {
1226
+ _validateProducts(records = []) {
1222
1227
  // no records
1223
- const records = this.productGrist.dirtyData.records
1228
+ if (!records?.length) records = this.productGrist.dirtyData.records
1224
1229
  if (!records?.length) throw new Error(i18next.t('text.no_products'))
1225
1230
 
1226
1231
  this._checkProductDuplication()
@@ -1233,6 +1238,10 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1233
1238
  throw new Error(i18next.t('text.empty_value_in_list'))
1234
1239
  }
1235
1240
 
1241
+ if (records.some(({ unitPrice }) => unitPrice < 0)) {
1242
+ throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
1243
+ }
1244
+
1236
1245
  if (records.some(({ packQty }) => packQty < 0)) {
1237
1246
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.pack_qty') } }))
1238
1247
  }
@@ -1352,6 +1361,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1352
1361
  batchId: record.batchId,
1353
1362
  batchIdRef: record?.batchIdRef ? record.batchIdRef : null,
1354
1363
  product: { id: record.product.id },
1364
+ productDetail: record?.productDetail?.id ? record.productDetail : { id: record.productDetailId },
1355
1365
  packingType: record.packingType,
1356
1366
  packingSize: record.packingSize || record.product.packingSize,
1357
1367
  uomValue: record?.uomValue ? record.uomValue : 0,
@@ -1698,6 +1708,9 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1698
1708
  primaryUnit
1699
1709
  primaryValue
1700
1710
  }
1711
+ productDetail {
1712
+ id
1713
+ }
1701
1714
  }
1702
1715
  }
1703
1716
  `,
@@ -1727,40 +1740,46 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1727
1740
  }
1728
1741
 
1729
1742
  this.productGrist.fetch()
1743
+ } else {
1744
+ throw response.errors
1730
1745
  }
1731
1746
  }
1732
1747
 
1733
1748
  async importHandler(patches) {
1734
- patches.map(itm => {
1735
- itm.unitPrice = parseFloat(itm.unitPrice) || ''
1736
- if (itm.manufactureDate) {
1737
- let mdt = new Date(itm.manufactureDate)
1738
- itm.manufactureDate =
1739
- mdt < new Date() ? `${mdt.getFullYear()}-${mdt.getMonth() + 1}-${mdt.getDate()}` || '' : ''
1740
- } else {
1741
- delete itm.manufactureDate
1742
- }
1743
- itm.uomValue = parseFloat(itm.uomValue) || ''
1744
- itm.packQty = parseFloat(itm.packQty) || ''
1745
- itm.palletQty = parseFloat(itm.palletQty) || ''
1746
- })
1747
-
1748
- this.productData = {
1749
- records: [...patches]
1750
- }
1749
+ try {
1750
+ patches.map(itm => {
1751
+ itm.unitPrice = parseFloat(itm.unitPrice) || ''
1752
+ if (itm.manufactureDate) {
1753
+ let mdt = new Date(itm.manufactureDate)
1754
+ itm.manufactureDate =
1755
+ mdt < new Date() ? `${mdt.getFullYear()}-${mdt.getMonth() + 1}-${mdt.getDate()}` || '' : ''
1756
+ } else {
1757
+ delete itm.manufactureDate
1758
+ }
1759
+ itm.uomValue = parseFloat(itm.uomValue) || ''
1760
+ itm.packQty = parseInt(itm.packQty) || ''
1761
+ itm.palletQty = parseInt(itm.palletQty) || ''
1762
+ })
1751
1763
 
1752
- const orderProducts = patches.map(patch => {
1753
- delete patch.cuFlag
1754
- return {
1755
- ...patch,
1756
- unitPrice: parseFloat(patch.unitPrice) || 0,
1757
- uomValue: parseFloat(patch.uomValue) || 0,
1758
- packQty: parseFloat(patch.packQty) || 0,
1759
- palletQty: parseFloat(patch.palletQty) || 0
1764
+ const orderProducts = patches.map(patch => {
1765
+ delete patch.cuFlag
1766
+ return {
1767
+ ...patch,
1768
+ unitPrice: parseFloat(patch.unitPrice) || 0,
1769
+ uomValue: parseFloat(patch.uomValue) || 0,
1770
+ packQty: parseInt(patch.packQty) || 0,
1771
+ palletQty: parseInt(patch.palletQty) || 0
1772
+ }
1773
+ })
1774
+ this.productData = {
1775
+ records: [...patches]
1760
1776
  }
1761
- })
1762
- await this.bulkUploadValidateOrderProducts(orderProducts)
1763
- history.back()
1777
+ await this.bulkUploadValidateOrderProducts(orderProducts)
1778
+ history.back()
1779
+ } catch (e) {
1780
+ history.back()
1781
+ return
1782
+ }
1764
1783
  }
1765
1784
 
1766
1785
  async _importableData(records) {
@@ -1774,6 +1793,8 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1774
1793
  }
1775
1794
  })
1776
1795
 
1796
+ this._validateProducts(records)
1797
+
1777
1798
  openPopup(
1778
1799
  html`
1779
1800
  <import-pop-up
@@ -1425,6 +1425,7 @@ class DuplicateArrivalNotice extends localize(i18next)(PageView) {
1425
1425
  batchId: record.batchId,
1426
1426
  batchIdRef: record?.batchIdRef ? record.batchIdRef : null,
1427
1427
  product: { id: record.product.id },
1428
+ productDetail: { id: record.productDetailId },
1428
1429
  packingType: record.packingType,
1429
1430
  packingSize: record?.product?.packingSize ? record.product.packingSize : record.packingSize,
1430
1431
  uomValue: record?.uomValue ? record.uomValue : 0,
@@ -1480,6 +1481,7 @@ class DuplicateArrivalNotice extends localize(i18next)(PageView) {
1480
1481
  } else if (record.targetType === VAS_BATCH_AND_PRODUCT_TYPE) {
1481
1482
  result.targetBatchId = record.target.batchId
1482
1483
  result.targetProduct = { id: record.target.productId }
1484
+ result.targetProductDetail = { id: record.target.productDetailId }
1483
1485
  result.packingType = record.packingType
1484
1486
  result.qty = record.qty
1485
1487
  result.uomValue = record.uomValue
@@ -406,7 +406,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
406
406
  return this.shadowRoot.querySelector('data-grist#addProduct')
407
407
  }
408
408
 
409
- _onProductChangeHandler(event) {
409
+ async _onProductChangeHandler(event) {
410
410
  try {
411
411
  this._checkProductDuplication()
412
412
  let changeRecord = event.detail.after
@@ -423,9 +423,9 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
423
423
 
424
424
  const amountRelatedColumns = ['uomValue', 'uom', 'packQty']
425
425
  if (amountRelatedColumns.indexOf(changedColumn) >= 0) {
426
- const calcedAmount = this._calcAmount(changedColumn, changeRecord)
426
+ const calcedAmount = await this._calcAmount(changedColumn, changeRecord)
427
427
  for (let key in calcedAmount) {
428
- changeRecord[key] = calcedAmount[key]
428
+ changeRecord[key] = key == 'packQty' ? Math.ceil(calcedAmount[key]) : calcedAmount[key]
429
429
  }
430
430
  }
431
431
 
@@ -596,8 +596,8 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
596
596
  let existingOrderProducts = []
597
597
  let newOrderProducts = []
598
598
 
599
- existingOrderProducts = this._getExistingOrderProducts()
600
- newOrderProducts = this._getNewOrderProducts()
599
+ existingOrderProducts = await this._getExistingOrderProducts()
600
+ newOrderProducts = await this._getNewOrderProducts()
601
601
 
602
602
  if (existingOrderProducts?.length || newOrderProducts?.length) {
603
603
  const result = await CustomAlert({
@@ -624,8 +624,8 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
624
624
  `,
625
625
  variables: {
626
626
  ganNo: this.ganNo,
627
- newOrderProducts: this._getNewOrderProducts(),
628
- existingOrderProducts: this._getExistingOrderProducts()
627
+ newOrderProducts,
628
+ existingOrderProducts
629
629
  }
630
630
  })
631
631
 
@@ -650,6 +650,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
650
650
  palletQty: 0,
651
651
  adjustedPalletQty: record?.palletQty ? record.palletQty : null,
652
652
  product: { id: record.product.id },
653
+ productDetail: { id: record.productDetailId },
653
654
  packingType: 'N/A',
654
655
  adjustedPackingType: record.packingType,
655
656
  uomValue: 0,
@@ -682,6 +683,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
682
683
  adjustedBatchIdRef: record.batchIdRef === record.__origin__.batchIdRef ? null : record.batchIdRef,
683
684
  adjustedPalletQty: record.palletQty == record.__origin__.palletQty ? null : record.palletQty,
684
685
  product: { id: record.product.id },
686
+ productDetail: { id: record.productDetail.id },
685
687
  adjustedPackingType: record.packingType === record.__origin__.packingType ? null : record.packingType,
686
688
  adjustedUomValue: record.uomValue == record.__origin__.uomValue ? null : record.uomValue,
687
689
  adjustedUom: record.uom === record.__origin__.uom ? null : record.uom,
@@ -543,7 +543,8 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
543
543
  let returnObj = {
544
544
  ...record,
545
545
  ...record.product,
546
- product: { ...record.product, id: record.product.id || record.product.productId },
546
+ product: { ...record.product, id: record.product?.id || record.product.productId },
547
+ productDetail: { id: record.productDetail?.id || record.product.productDetailId },
547
548
  name: record.name ? record.name : idx,
548
549
  releaseQty: record.releaseQty < 0 ? 0 : record.releaseQty,
549
550
  id: record.id
@@ -597,6 +598,7 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
597
598
  select: [
598
599
  { name: 'id', hidden: true },
599
600
  { name: 'productId', hidden: true },
601
+ { name: 'productDetailId', hidden: true },
600
602
  { name: 'remainUomValue', hidden: true },
601
603
  {
602
604
  name: 'groupType',
@@ -816,6 +818,9 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
816
818
  sku
817
819
  description
818
820
  }
821
+ productDetail {
822
+ id
823
+ }
819
824
  packingType
820
825
  packingSize
821
826
  uomValue
@@ -1042,6 +1047,7 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
1042
1047
  id: record.id ? record.id.toString() : null,
1043
1048
  name: record.name ? record.name.toString() : null,
1044
1049
  product: { id: record.product.id },
1050
+ productDetail: { id: record.productDetail.id },
1045
1051
  packingType: record.packingType,
1046
1052
  uomValue: record?.uomValue ? record.uomValue : 0,
1047
1053
  uom: record.uom,
@@ -1202,14 +1202,10 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
1202
1202
  this.matchDeliveryAddressInput.checked = false
1203
1203
  this.quickFindContent.currentTabKey = i18next.t('label.order')
1204
1204
 
1205
- this.initProperties()
1205
+ // this.initProperties()
1206
1206
  this._clearGristConditions()
1207
1207
  this._validateTransport()
1208
1208
  this._getAllPostCode()
1209
-
1210
- if (this._exportOptionInput.checked === true && this._recallInput.checked === false) {
1211
- this._exportOption = true
1212
- }
1213
1209
  }
1214
1210
 
1215
1211
  async switchPickingType() {
@@ -1554,6 +1550,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
1554
1550
  product: {
1555
1551
  id: record?.inventory?.productId,
1556
1552
  name: record?.inventory?.productName
1553
+ },
1554
+ productDetail: {
1555
+ id: record?.inventory?.productDetailId
1557
1556
  }
1558
1557
  }
1559
1558
  }
@@ -1786,6 +1785,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
1786
1785
  bundleId
1787
1786
  bundleQty
1788
1787
  productId
1788
+ productDetailId
1789
1789
  productSku
1790
1790
  productName
1791
1791
  productDescription
@@ -2116,6 +2116,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2116
2116
  packingType: record?.inventory?.packingType,
2117
2117
  packingSize: record?.inventory?.packingSize,
2118
2118
  productId: record?.inventory?.productId,
2119
+ productDetailId: record?.inventory?.productDetailId,
2119
2120
  groupType: record?.inventory?.groupType,
2120
2121
  releaseQty: record.releaseQty || 0,
2121
2122
  releaseUomValue: record.releaseUomValue || 0
@@ -2290,6 +2291,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2290
2291
  bundleReleaseDetail = bundleReleaseDetail.records.map(item => {
2291
2292
  return {
2292
2293
  product: { id: item.productId, name: item.productName },
2294
+ productDetail: { id: item.productDetailId },
2293
2295
  batchId: item.batchId,
2294
2296
  packingType: item.packingType,
2295
2297
  packingSize: item.packingSize,
@@ -2326,11 +2328,17 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2326
2328
  id: record.inventory.productId,
2327
2329
  name: record.inventory.productName
2328
2330
  }
2331
+ newRecord.productDetail = {
2332
+ id: record.inventory.productDetailId
2333
+ }
2329
2334
  } else {
2330
2335
  newRecord.product = {
2331
2336
  id: record.inventory.productId || record.inventory.product.id,
2332
2337
  name: record.inventory.productName || record.inventory.product.name
2333
2338
  }
2339
+ newRecord.productDetail = {
2340
+ id: record.inventory.productDetailId || record.inventory.productDetail.id
2341
+ }
2334
2342
  newRecord.inventory = { id: record.id }
2335
2343
  }
2336
2344
 
@@ -2625,6 +2633,10 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2625
2633
  name
2626
2634
  description
2627
2635
  }
2636
+ productDetail {
2637
+ id
2638
+ name
2639
+ }
2628
2640
  }
2629
2641
  }
2630
2642
  }
@@ -2644,6 +2656,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2644
2656
  op.inventory = {
2645
2657
  batchId: op.batchId,
2646
2658
  productId: op.product.id,
2659
+ productDetailId: op.productDetail.id,
2647
2660
  product: op.product,
2648
2661
  productName: op.product.name,
2649
2662
  palletId: i18next.t('label.cross_docking'),
@@ -2728,6 +2741,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2728
2741
  batchId
2729
2742
  batchIdRef
2730
2743
  productId
2744
+ productDetailId
2731
2745
  productSKU
2732
2746
  productName
2733
2747
  remainQty
@@ -2744,6 +2758,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2744
2758
  batchId
2745
2759
  batchIdRef
2746
2760
  productId
2761
+ productDetailId
2747
2762
  productSKU
2748
2763
  productName
2749
2764
  remainQty
@@ -2758,6 +2773,10 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2758
2773
  name
2759
2774
  sku
2760
2775
  }
2776
+ productDetail {
2777
+ id
2778
+ name
2779
+ }
2761
2780
  }
2762
2781
  }
2763
2782
  `,
@@ -356,6 +356,7 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
356
356
  { name: 'palletId', header: i18next.t('field.lot_id') },
357
357
  { name: 'cartonId', header: i18next.t('field.carton_id') },
358
358
  { name: 'product', type: 'object', queryName: 'products' },
359
+ { name: 'productDetail', type: 'object', queryName: 'products', hidden: true },
359
360
  { name: 'batchId', header: i18next.t('field.batch_id') },
360
361
  {
361
362
  name: 'location',
@@ -846,6 +847,7 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
846
847
  } else {
847
848
  newRecord.product = { id: record.inventory.product.id, name: record.inventory.product.name }
848
849
  newRecord.inventory = { id: record.id }
850
+ newRecord.productDetail = { id: record.inventory.productDetail.id }
849
851
  }
850
852
 
851
853
  return newRecord
@@ -865,13 +867,14 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
865
867
  status: ORDER_INVENTORY_STATUS.PENDING.value
866
868
  }
867
869
 
868
- if (record.isCrossDocking) newRecord.crossDocking = true
870
+ if (record.isCrossDocking) existRecord.crossDocking = true
869
871
 
870
872
  if (this._pickingStd === PICKING_STANDARD.SELECT_BY_PRODUCT.value) {
871
873
  existRecord.product = { id: record.inventory.productId, name: record.inventory.productName }
872
874
  } else {
873
875
  existRecord.product = { id: record.inventory.product.id, name: record.inventory.product.name }
874
876
  existRecord.inventory = { id: record.id }
877
+ existRecord.productDetail = { id: record.inventory.productDetail.id }
875
878
  }
876
879
 
877
880
  return existRecord
@@ -1270,6 +1270,9 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1270
1270
  name
1271
1271
  description
1272
1272
  }
1273
+ productDetail {
1274
+ id
1275
+ }
1273
1276
  productName
1274
1277
  packingType
1275
1278
  packingSize
@@ -1356,6 +1359,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1356
1359
  name: inventoryInfo.name,
1357
1360
  palletId: inventoryInfo.palletId,
1358
1361
  product: inventoryInfo.product,
1362
+ productDetail: inventoryInfo.productDetail,
1359
1363
  batchId: inventoryInfo.batchId,
1360
1364
  batchIdRef: inventoryInfo.batchIdRef,
1361
1365
  location: inventoryInfo.location,
@@ -792,6 +792,7 @@ class CreateReturnOrder extends localize(i18next)(PageView) {
792
792
  status: ORDER_INVENTORY_STATUS.PENDING.value
793
793
  }
794
794
  newRecord.product = { id: record?.productId, name: record?.productName }
795
+ newRecord.productDetail = { id: record?.productDetailId }
795
796
  newRecord.inventory = { id: record.id }
796
797
  return newRecord
797
798
  })
@@ -247,6 +247,7 @@ class ReturnOrderInventoryPopup extends localize(i18next)(LitElement) {
247
247
  releaseUomValue
248
248
  palletId
249
249
  productId
250
+ productDetailId
250
251
  releaseGoodName
251
252
  }
252
253
  total
@@ -502,6 +502,9 @@ class InventoryReassignPopup extends localize(i18next)(LitElement) {
502
502
  description
503
503
  sku
504
504
  }
505
+ productDetail {
506
+ id
507
+ }
505
508
  releaseGood {
506
509
  id
507
510
  name
@@ -1025,6 +1028,7 @@ class InventoryReassignPopup extends localize(i18next)(LitElement) {
1025
1028
  $worksheetNo: String!
1026
1029
  $batchId: String!
1027
1030
  $productId: String!
1031
+ $productDetailId: String!
1028
1032
  $packingType: String!
1029
1033
  $packingSize: Float!
1030
1034
  $orderProductId: String!
@@ -1034,6 +1038,7 @@ class InventoryReassignPopup extends localize(i18next)(LitElement) {
1034
1038
  worksheetNo: $worksheetNo
1035
1039
  batchId: $batchId
1036
1040
  productId: $productId
1041
+ productDetailId: $productDetailId
1037
1042
  packingType: $packingType
1038
1043
  packingSize: $packingSize
1039
1044
  orderProductId: $orderProductId
@@ -1045,6 +1050,7 @@ class InventoryReassignPopup extends localize(i18next)(LitElement) {
1045
1050
  worksheetNo: this.worksheetNo,
1046
1051
  batchId: this._selectedOrderProduct?.batchId,
1047
1052
  productId: this._selectedOrderProduct?.product?.id,
1053
+ productDetailId: this._selectedOrderProduct?.productDetail?.id,
1048
1054
  packingType: this._selectedOrderProduct?.packingType,
1049
1055
  packingSize: this._selectedOrderProduct?.packingSize,
1050
1056
  orderProductId: this._selectedOrderProduct?.id,
@@ -434,6 +434,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
434
434
  platform
435
435
  }
436
436
  worksheetDetailInfos {
437
+ id
437
438
  name
438
439
  palletId
439
440
  cartonId
@@ -484,14 +485,14 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
484
485
  })
485
486
 
486
487
  if (!response.errors) {
487
- // @oscar a more efficient writing of this line of code would be defining a const for the response of accessing releaseGood, kindly improve this.
488
- if (response.data.packingWorksheet.worksheetInfo.releaseGood.isOrderInventoryBin) {
489
- this.totalBinRO = response.data.packingWorksheet.worksheetInfo.releaseGood.totalInventoriesByBin
488
+ let releaseGood = response.data.packingWorksheet.worksheetInfo?.releaseGood
489
+ if (releaseGood?.isOrderInventoryBin) {
490
+ this.totalBinRO = releaseGood?.totalInventoriesByBin
490
491
  this.binRo = releaseGoodNo
491
492
  }
492
493
 
493
- this.releaseGoodNo = response.data.packingWorksheet.worksheetInfo.releaseGood.name
494
- this.releaseGoodId = response.data.packingWorksheet.worksheetInfo.releaseGood.id
494
+ this.releaseGoodNo = releaseGood?.name
495
+ this.releaseGoodId = releaseGood?.id
495
496
  if (!response.data?.packingWorksheet) return
496
497
 
497
498
  const { worksheetInfo, worksheetDetailInfos } = response.data.packingWorksheet
@@ -769,12 +770,14 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
769
770
  this.serialInput.value = ''
770
771
  }
771
772
 
772
- this.fetchInventories(this.releaseGoodNo)
773
+ if (!this._enableProductScanning) {
774
+ this.fetchInventories(this.releaseGoodNo)
775
+ }
773
776
  }
774
777
  } catch (e) {
775
778
  if (this._isRequireSerialNumberScanningOutbound && this._isBatchPicking) this.serialInput.value = ''
776
779
  else if (this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound) {
777
- this._focusOnProductBarcodeInput()
780
+ this.focusOnProductBarcodeInput()
778
781
  } else {
779
782
  this._focusOnReleaseQtyInput()
780
783
  this._selectedTaskStatus = null
@@ -782,9 +785,11 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
782
785
  this._selectedOrderInventory = null
783
786
  this.showToast(e)
784
787
  } finally {
785
- this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound
786
- ? (this.productBarcodeInput.value = '')
787
- : (this.releaseQtyInput.value = '')
788
+ if (!this._isRequireSerialNumberScanningOutbound) {
789
+ this._enableProductScanning ? (this.productBarcodeInput.value = '') : (this.releaseQtyInput.value = '')
790
+ } else {
791
+ if (this._isBatchPicking) this.serialInput.value = ''
792
+ }
788
793
  this._scanning = false
789
794
  // time execution for product barcode scanning (without scanning machines): 308.0390625 ms
790
795
  console.timeEnd('time execution for product barcode scanning')
@@ -802,17 +807,114 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
802
807
  worksheetDetailName: $worksheetDetailName
803
808
  productBarcode: $productBarcode
804
809
  serialNumber: $serialNumber
805
- )
810
+ ) {
811
+ worksheetDetailInfos {
812
+ id
813
+ name
814
+ palletId
815
+ cartonId
816
+ batchId
817
+ batchIdRef
818
+ sku
819
+ product {
820
+ id
821
+ name
822
+ description
823
+ gtin
824
+ isRequireSerialNumberScanningOutbound
825
+ productDetails {
826
+ id
827
+ packingType
828
+ packingSize
829
+ gtin
830
+ }
831
+ }
832
+ qty
833
+ releaseQty
834
+ packedQty
835
+ status
836
+ targetName
837
+ packingType
838
+ packingSize
839
+ binLocation {
840
+ name
841
+ }
842
+ relatedOrderInv {
843
+ batchId
844
+ batchIdRef
845
+ packingType
846
+ refWorksheetId
847
+ product {
848
+ id
849
+ sku
850
+ name
851
+ description
852
+ isRequireSerialNumberScanningOutbound
853
+ }
854
+ }
855
+ }
856
+ }
806
857
  }
807
858
  `,
808
859
  variables: {
809
- worksheetDetailName: this._selectedOrderInventory.name,
860
+ worksheetDetailName: this._selectedOrderInventory.id,
810
861
  productBarcode: this.productBarcodeInput.value.trim(),
811
862
  serialNumber:
812
863
  this._isRequireSerialNumberScanningOutbound && this._isBatchPicking ? this.serialInput.value.trim() : null
813
864
  }
814
865
  })
815
866
 
867
+ if (!response.errors) {
868
+ const { worksheetDetailInfos } = response.data.scanProductPacking
869
+
870
+ let rec = this.data.records.map(data => {
871
+ let info = worksheetDetailInfos.find(wd => wd.id == data.id)
872
+ if (info) {
873
+ return {
874
+ ...data,
875
+ packingProgress: `${info?.packedQty} / ${info.releaseQty}`,
876
+ packedQty: info.packedQty,
877
+ status: info.status,
878
+ completed: info.status === WORKSHEET_STATUS.DONE.value
879
+ }
880
+ } else {
881
+ return data
882
+ }
883
+ })
884
+ this.data = { records: rec.sort((a, b) => a.completed - b.completed) }
885
+
886
+ this.toggleComplete = Boolean(this.releaseGood?.remark)
887
+ ? this.data.records.every(res => res.status === 'DONE') && worksheetInfo.releaseGood?.checkedRemarkAt !== null
888
+ : this.data.records.every(res => res.status === 'DONE')
889
+
890
+ if (this.toggleComplete) this.fetchInventories(this.releaseGoodNo)
891
+
892
+ if (this._selectedOrderInventory) {
893
+ const record = this.data.records.find(record => record.name === this._selectedOrderInventory.name)
894
+ if (record?.packedQty == record?.releaseQty) {
895
+ this._selectedOrderInventory = null
896
+ this._selectedTaskStatus = null
897
+ this.inputForm.reset()
898
+ }
899
+ } else {
900
+ this._selectedOrderInventory = this.data.records[0]
901
+ this._isRequireSerialNumberScanningOutbound =
902
+ this.data.records[0].product?.isRequireSerialNumberScanningOutbound
903
+ }
904
+
905
+ if (this.toggleComplete && this.airwayBill) {
906
+ this.printBill()
907
+ }
908
+
909
+ if (this._enableProductScanning) {
910
+ this.focusOnProductBarcodeInput()
911
+ } else {
912
+ this.focusOnReleaseQtyInput()
913
+ }
914
+
915
+ this.updateContext()
916
+ }
917
+
816
918
  return response
817
919
  }
818
920
 
@@ -860,7 +962,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
860
962
  throw new Error(i18next.t('text.scanned_product_status_is_done'))
861
963
  }
862
964
  } else {
863
- this._focusOnProductBarcodeInput()
965
+ this.focusOnProductBarcodeInput()
864
966
  throw new Error(i18next.t('text.incorrect_product_barcode'))
865
967
  }
866
968
  } else {