@things-factory/operato-wms 4.3.136 → 4.3.138

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 (77) hide show
  1. package/client/pages/adjustment/transfer-inventory.js +14 -6
  2. package/client/pages/bulk-operation/bulk-operation.js +3 -1
  3. package/client/pages/components/select-inventory-popup.js +7 -1
  4. package/client/pages/components/select-product-popup.js +33 -3
  5. package/client/pages/constants/order.js +3 -1
  6. package/client/pages/inbound/external-return-worksheet.js +39 -2
  7. package/client/pages/inbound/undo-putaway-popup.js +5 -9
  8. package/client/pages/inbound/undo-unload-popup.js +42 -35
  9. package/client/pages/inbound/unload-product.js +79 -69
  10. package/client/pages/inventory/inventory-adjustment-approval.js +4 -5
  11. package/client/pages/inventory/inventory-adjustment.js +56 -2
  12. package/client/pages/inventory/inventory-by-product-detail.js +23 -17
  13. package/client/pages/inventory/inventory-by-product.js +7 -0
  14. package/client/pages/inventory/inventory-history-by-pallet.js +14 -5
  15. package/client/pages/inventory/inventory-history.js +10 -0
  16. package/client/pages/inventory-check/check-inventory-popup.js +1 -1
  17. package/client/pages/inventory-check/create-cycle-count.js +2 -3
  18. package/client/pages/inventory-check/inspecting-product.js +7 -3
  19. package/client/pages/manifest/create-loading-manifest.js +8 -1
  20. package/client/pages/manifest/loading-manifest-detail.js +7 -4
  21. package/client/pages/master/generate-location-list.js +30 -22
  22. package/client/pages/master/location-list.js +134 -71
  23. package/client/pages/master/pallet-list.js +137 -58
  24. package/client/pages/master/product/product-details-popup.js +3 -3
  25. package/client/pages/master/tote-list.js +40 -27
  26. package/client/pages/master/transport-driver.js +48 -41
  27. package/client/pages/master/transport-vehicle.js +45 -41
  28. package/client/pages/master/warehouse-list.js +56 -34
  29. package/client/pages/order/arrival-notice/arrival-notice-detail.js +36 -25
  30. package/client/pages/order/arrival-notice/create-arrival-notice.js +78 -95
  31. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +2 -0
  32. package/client/pages/order/arrival-notice/edit-product-popup.js +10 -8
  33. package/client/pages/order/draft-release-good/draft-release-good-detail.js +88 -4
  34. package/client/pages/order/draft-release-good/draft-release-good-list.js +1 -1
  35. package/client/pages/order/release-order/create-release-order.js +34 -9
  36. package/client/pages/order/release-order/release-extra-product-popup.js +4 -1
  37. package/client/pages/order/release-order/release-order-detail.js +40 -3
  38. package/client/pages/order/return-order/create-return-order.js +5 -0
  39. package/client/pages/order/return-order/return-order-inventory-popup.js +1 -0
  40. package/client/pages/order/return-order/return-order-requests.js +37 -2
  41. package/client/pages/order/transport-order/delivery-note-popup.js +30 -24
  42. package/client/pages/order/transport-order/delivery-order-list.js +27 -1
  43. package/client/pages/outbound/inventory-reassign-popup.js +7 -3
  44. package/client/pages/outbound/packing-product.js +7 -7
  45. package/client/pages/outbound/packing-worksheet-list.js +3 -1
  46. package/client/pages/outbound/picking-product.js +18 -6
  47. package/client/pages/outbound/serial-number-popup.js +1 -1
  48. package/client/pages/outbound/show-my-worksheet-list-popup.js +12 -3
  49. package/client/pages/report/custom-elccl/elccl-daily-collection-report.js +5 -2
  50. package/client/pages/report/custom-elccl/elccl-daily-order-inventory-report.js +2 -2
  51. package/client/pages/report/custom-elccl/elccl-delivery-order-summary.js +34 -8
  52. package/client/pages/report/custom-elccl/elccl-inventory-pallet-detail-report.js +42 -4
  53. package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +46 -4
  54. package/client/pages/report/volume-summary-report.js +8 -3
  55. package/config.development.js +28 -21
  56. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +6 -5
  57. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  58. package/dist-server/graphql/resolvers/other/add-release-good-products.js +7 -11
  59. package/dist-server/graphql/resolvers/other/add-release-good-products.js.map +1 -1
  60. package/dist-server/graphql/resolvers/reports/costing-report.js +18 -24
  61. package/dist-server/graphql/resolvers/reports/costing-report.js.map +1 -1
  62. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +6 -6
  63. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +8 -9
  64. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  65. package/dist-server/graphql/resolvers/reports/release-inventory-report.js +3 -3
  66. package/dist-server/graphql/resolvers/reports/release-inventory-report.js.map +1 -1
  67. package/package.json +24 -24
  68. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +6 -5
  69. package/server/graphql/resolvers/other/add-release-good-products.ts +8 -12
  70. package/server/graphql/resolvers/reports/costing-report.ts +18 -24
  71. package/server/graphql/resolvers/reports/inbound-order-details-report.ts +6 -6
  72. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +8 -9
  73. package/server/graphql/resolvers/reports/release-inventory-report.ts +6 -4
  74. package/translations/en.json +28 -3
  75. package/translations/ko.json +26 -2
  76. package/translations/ms.json +26 -2
  77. package/translations/zh.json +26 -2
@@ -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
  }
@@ -1004,49 +1004,6 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1004
1004
  }
1005
1005
  }
1006
1006
 
1007
- async fetchProducts(bizplace = []) {
1008
- const filters = [...bizplace]
1009
-
1010
- const response = await client.query({
1011
- query: gql`
1012
- query productDetails($filters: [Filter!]!) {
1013
- productDetails(filters: $filters) {
1014
- items {
1015
- id
1016
- packingType
1017
- packingSize
1018
- uom
1019
- uomValue
1020
- isDefault
1021
- product {
1022
- id
1023
- name
1024
- sku
1025
- description
1026
- type
1027
- }
1028
- }
1029
- }
1030
- }
1031
- `,
1032
- variables: { filters }
1033
- })
1034
-
1035
- if (!response.errors) {
1036
- return (
1037
- response.data.productDetails.items.map(item => {
1038
- return {
1039
- ...item,
1040
- productId: item.product.id,
1041
- sku: item.product.sku,
1042
- name: item.product.name,
1043
- description: item.product.description
1044
- }
1045
- }) || []
1046
- )
1047
- }
1048
- }
1049
-
1050
1007
  async _generateArrivalNotice() {
1051
1008
  try {
1052
1009
  this._validateForm()
@@ -1210,7 +1167,12 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1210
1167
  _validateForm() {
1211
1168
  if (!this.arrivalNoticeForm.checkValidity()) throw new Error(i18next.t('text.arrival_notice_form_invalid'))
1212
1169
 
1213
- if (this._hasContainer) if (!this.containerNo.value) throw new Error(i18next.t('text.container_no_is_empty'))
1170
+ if (this._hasContainer) {
1171
+ if (!this.containerNo.value) throw new Error(i18next.t('text.container_no_is_empty'))
1172
+
1173
+ if (!this.arrivalNoticeForm?.containerSize?.value || this.arrivalNoticeForm?.containerSize?.value == '')
1174
+ throw new Error(i18next.t('text.please_select_container_size'))
1175
+ }
1214
1176
 
1215
1177
  if (this._ownTransport && this._warehouseTransport)
1216
1178
  throw new Error(i18next.t('text.you_can_only_select_one_transport_type'))
@@ -1218,9 +1180,9 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1218
1180
  throw new Error(i18next.t('text.please_select_transport_type'))
1219
1181
  }
1220
1182
 
1221
- _validateProducts() {
1183
+ _validateProducts(records = []) {
1222
1184
  // no records
1223
- const records = this.productGrist.dirtyData.records
1185
+ if (!records?.length) records = this.productGrist.dirtyData.records
1224
1186
  if (!records?.length) throw new Error(i18next.t('text.no_products'))
1225
1187
 
1226
1188
  this._checkProductDuplication()
@@ -1233,6 +1195,10 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1233
1195
  throw new Error(i18next.t('text.empty_value_in_list'))
1234
1196
  }
1235
1197
 
1198
+ if (records.some(({ unitPrice }) => unitPrice < 0)) {
1199
+ throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
1200
+ }
1201
+
1236
1202
  if (records.some(({ packQty }) => packQty < 0)) {
1237
1203
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.pack_qty') } }))
1238
1204
  }
@@ -1352,6 +1318,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1352
1318
  batchId: record.batchId,
1353
1319
  batchIdRef: record?.batchIdRef ? record.batchIdRef : null,
1354
1320
  product: { id: record.product.id },
1321
+ productDetail: record?.productDetail?.id ? record.productDetail : { id: record.productDetailId },
1355
1322
  packingType: record.packingType,
1356
1323
  packingSize: record.packingSize || record.product.packingSize,
1357
1324
  uomValue: record?.uomValue ? record.uomValue : 0,
@@ -1698,69 +1665,83 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1698
1665
  primaryUnit
1699
1666
  primaryValue
1700
1667
  }
1668
+ productDetail {
1669
+ id
1670
+ }
1701
1671
  }
1702
1672
  }
1703
1673
  `,
1704
1674
  variables: { orderProducts: patches, partnerBizplaceId: this._bizplaceId }
1705
1675
  })
1706
-
1707
- if (!response.errors) {
1708
- const data = response.data.bulkUploadValidateOrderProducts.map(item => {
1709
- return {
1710
- ...item,
1711
- productName: item?.productName,
1712
- unitPrice: parseFloat(item.unitPrice) || '',
1713
- packQty: parseFloat(item.packQty) || '',
1714
- palletQty: parseFloat(item.palletQty) || ''
1715
- }
1716
- })
1717
- this.productData = {
1718
- ...this.productData,
1719
- records: data.map((dt, idx) => {
1676
+ let foundErrors = response.data.bulkUploadValidateOrderProducts .find(item=>item.isError != 0)
1677
+ if (foundErrors){
1678
+ return this._showToast({ message: i18next.t('text.invalid_product_sku') })
1679
+ }
1680
+ if (!foundErrors){
1681
+ if (!response.errors) {
1682
+ const data = response.data.bulkUploadValidateOrderProducts.map(item => {
1720
1683
  return {
1721
- ...dt,
1722
- id: idx,
1723
- name: idx,
1724
- __dirty__: '+'
1684
+ ...item,
1685
+ productName: item?.productName,
1686
+ unitPrice: parseFloat(item.unitPrice) || '',
1687
+ packQty: parseFloat(item.packQty) || '',
1688
+ palletQty: parseFloat(item.palletQty) || ''
1725
1689
  }
1726
1690
  })
1691
+ this.productData = {
1692
+ ...this.productData,
1693
+ records: data.map((dt, idx) => {
1694
+ return {
1695
+ ...dt,
1696
+ id: idx,
1697
+ name: idx,
1698
+ __dirty__: '+'
1699
+ }
1700
+ })
1701
+ }
1702
+ this.productGrist.fetch()
1703
+ } else {
1704
+ throw response.errors
1727
1705
  }
1728
-
1729
- this.productGrist.fetch()
1730
1706
  }
1731
1707
  }
1732
1708
 
1733
1709
  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
- })
1710
+ try {
1711
+ patches.map(itm => {
1712
+ itm.unitPrice = parseFloat(itm.unitPrice) || ''
1713
+ if (itm.manufactureDate) {
1714
+ let mdt = new Date(itm.manufactureDate)
1715
+ itm.manufactureDate =
1716
+ mdt < new Date() ? `${mdt.getFullYear()}-${mdt.getMonth() + 1}-${mdt.getDate()}` || '' : ''
1717
+ } else {
1718
+ delete itm.manufactureDate
1719
+ }
1720
+ itm.uomValue = parseFloat(itm.uomValue) || ''
1721
+ itm.packQty = parseInt(itm.packQty) || ''
1722
+ itm.palletQty = parseInt(itm.palletQty) || ''
1723
+ })
1747
1724
 
1748
- this.productData = {
1749
- records: [...patches]
1725
+ const orderProducts = patches.map(patch => {
1726
+ delete patch.cuFlag
1727
+ return {
1728
+ ...patch,
1729
+ unitPrice: parseFloat(patch.unitPrice) || 0,
1730
+ uomValue: parseFloat(patch.uomValue) || 0,
1731
+ packQty: parseInt(patch.packQty) || 0,
1732
+ palletQty: parseInt(patch.palletQty) || 0
1733
+ }
1734
+ })
1735
+ // redundant as records also patched during bulkUploadValidateOrderProducts and we don't need it to write on grist before validation
1736
+ // this.productData = {
1737
+ // records: [...patches]
1738
+ // }
1739
+ await this.bulkUploadValidateOrderProducts(orderProducts)
1740
+ history.back()
1741
+ } catch (e) {
1742
+ history.back()
1743
+ return
1750
1744
  }
1751
-
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
1760
- }
1761
- })
1762
- await this.bulkUploadValidateOrderProducts(orderProducts)
1763
- history.back()
1764
1745
  }
1765
1746
 
1766
1747
  async _importableData(records) {
@@ -1774,6 +1755,8 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1774
1755
  }
1775
1756
  })
1776
1757
 
1758
+ this._validateProducts(records)
1759
+
1777
1760
  openPopup(
1778
1761
  html`
1779
1762
  <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,15 +423,15 @@ 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
 
432
432
  if (changedColumn === 'unitPrice') {
433
433
  let unitPrice = changeRecord.unitPrice
434
- if (typeof unitPrice === undefined || unitPrice < 0) {
434
+ if (typeof unitPrice === undefined || unitPrice < 0 || isNaN(unitPrice)) {
435
435
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
436
436
  }
437
437
  }
@@ -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,
@@ -14,6 +14,7 @@ import { fetchSettingRule } from '@things-factory/setting-ui'
14
14
  import { client, CustomAlert, navigate, PageView, store } from '@things-factory/shell'
15
15
  import { CommonButtonStyles } from '@things-factory/styles'
16
16
  import { flattenObject, isMobileDevice } from '@things-factory/utils'
17
+ import isEmpty from 'lodash-es/isEmpty'
17
18
 
18
19
  import { DRAFT_RELEASE_ORDER_STATUS, PRODUCT_GROUP_TYPES } from '../../../constants'
19
20
 
@@ -223,6 +224,7 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
223
224
  get context() {
224
225
  let actions = []
225
226
 
227
+ // first time getting the draft order data
226
228
  if (this._draftOrderData) {
227
229
  actions = [
228
230
  {
@@ -480,6 +482,7 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
480
482
 
481
483
  if (!this._packingTypes) this._packingTypes = await getCodeByName('PACKING_TYPES')
482
484
 
485
+ // getting orderNo and see whether it's enw or existing draft order
483
486
  let orderNo = changes.resourceId || this._orderNo
484
487
  this._orderNo = orderNo == 'new' ? '' : orderNo
485
488
  await this._fetchOrder()
@@ -543,7 +546,8 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
543
546
  let returnObj = {
544
547
  ...record,
545
548
  ...record.product,
546
- product: { ...record.product, id: record.product.id || record.product.productId },
549
+ product: { ...record.product, id: record.product?.id || record.product.productId },
550
+ productDetail: { id: record.productDetail?.id || record.product.productDetailId },
547
551
  name: record.name ? record.name : idx,
548
552
  releaseQty: record.releaseQty < 0 ? 0 : record.releaseQty,
549
553
  id: record.id
@@ -597,6 +601,7 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
597
601
  select: [
598
602
  { name: 'id', hidden: true },
599
603
  { name: 'productId', hidden: true },
604
+ { name: 'productDetailId', hidden: true },
600
605
  { name: 'remainUomValue', hidden: true },
601
606
  {
602
607
  name: 'groupType',
@@ -816,6 +821,9 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
816
821
  sku
817
822
  description
818
823
  }
824
+ productDetail {
825
+ id
826
+ }
819
827
  packingType
820
828
  packingSize
821
829
  uomValue
@@ -855,10 +863,10 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
855
863
 
856
864
  if (!response.errors) {
857
865
  this._draftOrderData = {
866
+ // this is where data is
858
867
  ...response.data.draftReleaseGoodByName
859
868
  // shippingOrder: this._exportOption ? this._serializeForm(this._shippingOrderForm) : null
860
869
  }
861
-
862
870
  this._productData = {
863
871
  records: response.data.draftReleaseGoodByName.orderProducts.map(itm => {
864
872
  return {
@@ -906,6 +914,10 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
906
914
  this._validateForm()
907
915
  this._validateProducts()
908
916
 
917
+ if (this._draftOrderData.bizplace.id != null) {
918
+ this._validateChanges()
919
+ }
920
+
909
921
  const result = await CustomAlert({
910
922
  title: i18next.t('title.are_you_sure'),
911
923
  text: i18next.t('text.update_draft_release_order'),
@@ -1003,8 +1015,30 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
1003
1015
  _validateForm() {
1004
1016
  if (!this._draftReleaseOrderForm.checkValidity()) throw new Error(i18next.t('text.draft_order_form_invalid'))
1005
1017
 
1006
- if (this._draftOrderData?.container && !this.containerNo.value)
1007
- throw new Error(i18next.t('text.container_no_is_empty'))
1018
+ // if (this._draftOrderData?.container && !this.containerNo.value)
1019
+ // throw new Error(i18next.t('text.container_no_is_empty'))
1020
+
1021
+ if (this._exportOption == true) {
1022
+ let e = ''
1023
+ if (
1024
+ isEmpty(this._shippingOrderForm.containerNo.value) ||
1025
+ isEmpty(this._shippingOrderForm.shipName.value) ||
1026
+ isEmpty(this._shippingOrderForm.containerArrivalDate.value) ||
1027
+ isEmpty(this._shippingOrderForm.containerLeavingDate.value)
1028
+ ) {
1029
+ if (isEmpty(this._shippingOrderForm.containerNo.value)) e = i18next.t('text.container_no_is_empty')
1030
+
1031
+ if (isEmpty(this._shippingOrderForm.shipName.value)) e = i18next.t('text.ship_name_is_empty')
1032
+
1033
+ if (isEmpty(this._shippingOrderForm.containerArrivalDate.value))
1034
+ e = i18next.t('text.container_arrival_date_is_empty')
1035
+
1036
+ if (isEmpty(this._shippingOrderForm.containerLeavingDate.value))
1037
+ e = i18next.t('text.container_leaving_date_is_empty')
1038
+ }
1039
+
1040
+ if (e != '') throw new Error(e)
1041
+ }
1008
1042
  }
1009
1043
 
1010
1044
  _validateProducts() {
@@ -1028,6 +1062,15 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
1028
1062
  if (this._productGrist.dirtyData.records.some(record => !record.releaseQty))
1029
1063
  throw new Error(i18next.t('text.invalid_release_qty'))
1030
1064
 
1065
+ // data changes validator
1066
+ if (this._draftOrderData.bizplace.id != null) {
1067
+ // // check changes in form info
1068
+ // let checkFormInfoChange = this._serializeForm(this._draftReleaseOrderForm).refNo == this._draftOrderData.refNo && this._serializeForm(this._draftReleaseOrderForm).refNo2 == this._draftOrderData.refNo2 && this._serializeForm(this._draftReleaseOrderForm).refNo3 == this._draftOrderData.refNo3 && this._serializeForm(this._draftReleaseOrderForm).releaseDate == this._draftOrderData.releaseDate && this._serializeForm(this._draftReleaseOrderForm).collectionOrderNo == this._draftOrderData.collectionOrderNo
1069
+ // // check changes in product
1070
+ // let checkProductDataChange = this._compareArray(this._productGrist.dirtyData.records, this.___draftOrderData.orderProducts)
1071
+ // if (checkFormInfoChange == true && checkProductDataChange != true)
1072
+ // throw new Error(i18next.t('text.nothing_changed'))
1073
+ }
1031
1074
  return true
1032
1075
  }
1033
1076
 
@@ -1036,12 +1079,30 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
1036
1079
  return formData
1037
1080
  }
1038
1081
 
1082
+ _compareArray(a, b) {
1083
+ // Comparing the length of each array
1084
+ if (a.length != b.length) return true
1085
+ else {
1086
+ for (var i = 0; i < a.length; i++) {
1087
+ // compare releaseQty of both array
1088
+ if (a[i].releaseQty != b[i].releaseQty) {
1089
+ return true
1090
+ }
1091
+ // compare product of both array
1092
+ if (a[i].product.id != b[i].product.id) {
1093
+ return true
1094
+ }
1095
+ }
1096
+ }
1097
+ }
1098
+
1039
1099
  _getOrderProducts() {
1040
1100
  return this._productGrist.dirtyData.records.map(record => {
1041
1101
  let orderProduct = {
1042
1102
  id: record.id ? record.id.toString() : null,
1043
1103
  name: record.name ? record.name.toString() : null,
1044
1104
  product: { id: record.product.id },
1105
+ productDetail: { id: record.productDetail.id },
1045
1106
  packingType: record.packingType,
1046
1107
  uomValue: record?.uomValue ? record.uomValue : 0,
1047
1108
  uom: record.uom,
@@ -1071,6 +1132,29 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
1071
1132
  return inputDate
1072
1133
  }
1073
1134
 
1135
+ _validateChanges() {
1136
+ // check changes in form info
1137
+ let checkFormInfoChange =
1138
+ this._serializeForm(this._draftReleaseOrderForm).refNo == this._draftOrderData.refNo &&
1139
+ this._serializeForm(this._draftReleaseOrderForm).refNo2 == this._draftOrderData.refNo2 &&
1140
+ this._serializeForm(this._draftReleaseOrderForm).refNo3 == this._draftOrderData.refNo3 &&
1141
+ this._serializeForm(this._draftReleaseOrderForm).releaseDate == this._draftOrderData.releaseDate &&
1142
+ this._serializeForm(this._draftReleaseOrderForm).collectionOrderNo == this._draftOrderData.collectionOrderNo
1143
+ // check changes in shipping form info
1144
+ let checkShippingFormInfo =
1145
+ this._draftOrderData.shippingOrder.containerNo == this._shippingOrderForm.containerNo.value &&
1146
+ this._draftOrderData.shippingOrder.containerArrivalDate == this._shippingOrderForm.containerArrivalDate.value &&
1147
+ this._draftOrderData.shippingOrder.containerLeavingDate == this._shippingOrderForm.containerLeavingDate.value &&
1148
+ this._draftOrderData.shippingOrder.shipName == this._shippingOrderForm.shipName.value
1149
+ // check changes in product
1150
+ let checkProductDataChange = this._compareArray(
1151
+ this._productGrist.dirtyData.records,
1152
+ this.___draftOrderData.orderProducts
1153
+ )
1154
+ if (checkFormInfoChange == true && checkProductDataChange != true && checkShippingFormInfo == true)
1155
+ throw new Error(i18next.t('text.nothing_changed'))
1156
+ }
1157
+
1074
1158
  _clearView() {
1075
1159
  this.refNo = ''
1076
1160
  this.refNo2 = ''
@@ -197,7 +197,7 @@ class DraftReleaseGoodList extends localize(i18next)(PageView) {
197
197
  this.config = {
198
198
  rows: { selectable: { multiple: true }, appendable: false },
199
199
  list: { fields: ['name', 'releaseDate', 'status', 'updatedAt'] },
200
- pagination: { limit: 50, pages: [50, 100, 200, 500] },
200
+ pagination: { limit: 50, pages: [50, 100, 200, 500, 1000] },
201
201
  columns: [
202
202
  { type: 'gutter', gutterName: 'sequence' },
203
203
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
@@ -1204,14 +1204,10 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
1204
1204
  this.matchDeliveryAddressInput.checked = false
1205
1205
  this.quickFindContent.currentTabKey = i18next.t('label.order')
1206
1206
 
1207
- this.initProperties()
1207
+ // this.initProperties()
1208
1208
  this._clearGristConditions()
1209
1209
  this._validateTransport()
1210
1210
  this._getAllPostCode()
1211
-
1212
- if (this._exportOptionInput.checked === true && this._recallInput.checked === false) {
1213
- this._exportOption = true
1214
- }
1215
1211
  }
1216
1212
 
1217
1213
  async switchPickingType() {
@@ -1556,6 +1552,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
1556
1552
  product: {
1557
1553
  id: record?.inventory?.productId,
1558
1554
  name: record?.inventory?.productName
1555
+ },
1556
+ productDetail: {
1557
+ id: record?.inventory?.productDetailId
1559
1558
  }
1560
1559
  }
1561
1560
  }
@@ -1788,6 +1787,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
1788
1787
  bundleId
1789
1788
  bundleQty
1790
1789
  productId
1790
+ productDetailId
1791
1791
  productSku
1792
1792
  productName
1793
1793
  productDescription
@@ -2118,6 +2118,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2118
2118
  packingType: record?.inventory?.packingType,
2119
2119
  packingSize: record?.inventory?.packingSize,
2120
2120
  productId: record?.inventory?.productId,
2121
+ productDetailId: record?.inventory?.productDetailId,
2121
2122
  groupType: record?.inventory?.groupType,
2122
2123
  releaseQty: record.releaseQty || 0,
2123
2124
  releaseUomValue: record.releaseUomValue || 0
@@ -2292,6 +2293,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2292
2293
  bundleReleaseDetail = bundleReleaseDetail.records.map(item => {
2293
2294
  return {
2294
2295
  product: { id: item.productId, name: item.productName },
2296
+ productDetail: { id: item.productDetailId },
2295
2297
  batchId: item.batchId,
2296
2298
  packingType: item.packingType,
2297
2299
  packingSize: item.packingSize,
@@ -2328,11 +2330,17 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2328
2330
  id: record.inventory.productId,
2329
2331
  name: record.inventory.productName
2330
2332
  }
2333
+ newRecord.productDetail = {
2334
+ id: record.inventory.productDetailId
2335
+ }
2331
2336
  } else {
2332
2337
  newRecord.product = {
2333
2338
  id: record.inventory.productId || record.inventory.product.id,
2334
2339
  name: record.inventory.productName || record.inventory.product.name
2335
2340
  }
2341
+ newRecord.productDetail = {
2342
+ id: record.inventory.productDetailId || record.inventory.productDetail.id
2343
+ }
2336
2344
  newRecord.inventory = { id: record.id }
2337
2345
  }
2338
2346
 
@@ -2627,6 +2635,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2627
2635
  name
2628
2636
  description
2629
2637
  }
2638
+ productDetail {
2639
+ id
2640
+ }
2630
2641
  }
2631
2642
  }
2632
2643
  }
@@ -2646,6 +2657,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2646
2657
  op.inventory = {
2647
2658
  batchId: op.batchId,
2648
2659
  productId: op.product.id,
2660
+ productDetailId: op.productDetail.id,
2649
2661
  product: op.product,
2650
2662
  productName: op.product.name,
2651
2663
  palletId: i18next.t('label.cross_docking'),
@@ -2730,6 +2742,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2730
2742
  batchId
2731
2743
  batchIdRef
2732
2744
  productId
2745
+ productDetailId
2733
2746
  productSKU
2734
2747
  productName
2735
2748
  remainQty
@@ -2746,6 +2759,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2746
2759
  batchId
2747
2760
  batchIdRef
2748
2761
  productId
2762
+ productDetailId
2749
2763
  productSKU
2750
2764
  productName
2751
2765
  remainQty
@@ -2760,6 +2774,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2760
2774
  name
2761
2775
  sku
2762
2776
  }
2777
+ productDetail {
2778
+ id
2779
+ }
2763
2780
  }
2764
2781
  }
2765
2782
  `,
@@ -2835,10 +2852,6 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2835
2852
 
2836
2853
  async importHandler(patches) {
2837
2854
  try {
2838
- this.inventoryData = {
2839
- records: [...patches]
2840
- }
2841
-
2842
2855
  const orderInventories = patches.map(patch => {
2843
2856
  delete patch.cuFlag
2844
2857
  return {
@@ -2846,6 +2859,18 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2846
2859
  }
2847
2860
  })
2848
2861
 
2862
+ // validate releaseQty
2863
+ // only positive integers permitted
2864
+ for (const orderInventory of orderInventories) {
2865
+ const rQty = orderInventory.releaseQty
2866
+ if (!Number.isInteger(rQty)) throw new Error(`${rQty} ${i18next.t('text.is_not_an_integer')}`)
2867
+ if (rQty <= 0) throw new Error(i18next.t('text.release_qty_must_be_at_least_1'))
2868
+ }
2869
+
2870
+ this.inventoryData = {
2871
+ records: [...patches]
2872
+ }
2873
+
2849
2874
  await this.bulkUploadValidateWarehousePartnersProductsQuantity(orderInventories)
2850
2875
 
2851
2876
  history.back()