@things-factory/operato-wms 4.1.24 → 4.1.27

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 (26) hide show
  1. package/client/pages/adjustment/transfer-inventory.js +8 -4
  2. package/client/pages/bulk-operation/bulk-operation.js +12 -5
  3. package/client/pages/bulk-operation/validate-gan-popup.js +6 -6
  4. package/client/pages/inventory/inventory-adjustment-approval.js +21 -7
  5. package/client/pages/inventory/inventory-adjustment.js +99 -54
  6. package/client/pages/order/arrival-notice/arrival-notice-detail.js +16 -11
  7. package/client/pages/order/arrival-notice/create-arrival-notice.js +25 -24
  8. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +31 -30
  9. package/client/pages/order/arrival-notice/edit-product-popup.js +20 -32
  10. package/client/pages/order/arrival-notice/proceed-edit-product-popup.js +4 -4
  11. package/client/pages/order/arrival-notice/view-product-changes-popup.js +4 -4
  12. package/client/pages/report/inbound-order-details-report.js +9 -8
  13. package/client/pages/report/outbound-order-details-report.js +9 -8
  14. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +2 -2
  15. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +2 -2
  16. package/dist-server/graphql/types/reports/inbound-order-details-report.js +1 -1
  17. package/dist-server/graphql/types/reports/outbound-order-details-report.js +1 -1
  18. package/package.json +38 -38
  19. package/server/graphql/resolvers/reports/inbound-order-details-report.ts +2 -2
  20. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +2 -2
  21. package/server/graphql/types/reports/inbound-order-details-report.ts +1 -1
  22. package/server/graphql/types/reports/outbound-order-details-report.ts +1 -1
  23. package/translations/en.json +5 -2
  24. package/translations/ko.json +5 -1
  25. package/translations/ms.json +5 -1
  26. package/translations/zh.json +5 -1
@@ -365,7 +365,7 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
365
365
  ></barcode-scanable-input>`
366
366
  : ``
367
367
  : html`
368
- <label class="content-title">${i18next.t('label.carton_id')}</label>
368
+ <label class="content-title">${i18next.t('label.new_carton_id')}</label>
369
369
  <barcode-scanable-input
370
370
  name="newCartonId"
371
371
  custom-input
@@ -580,9 +580,13 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
580
580
 
581
581
  if (!response.errors) {
582
582
  if (response.data.inventories.total == 0) {
583
- if (this.refInventoryType === INVENTORY_TYPES.LOT.value) this.focusOnPalletInput()
584
- else this.focusOnCartonInput()
585
- throw new Error(i18next.t('text.wrong_lot_id'))
583
+ if (this.refInventoryType === INVENTORY_TYPES.LOT.value) {
584
+ this.focusOnPalletInput()
585
+ throw new Error(i18next.t('text.lot_id_not_found'))
586
+ } else {
587
+ this.focusOnCartonInput()
588
+ throw new Error(i18next.t('text.carton_id_not_found'))
589
+ }
586
590
  }
587
591
 
588
592
  this._data = {
@@ -167,7 +167,7 @@ class BulkOperation extends localize(i18next)(PageView) {
167
167
  refNo: '',
168
168
  refNo2: '',
169
169
  refNo3: '',
170
- etaDate: '',
170
+ etaDate: new Date(),
171
171
  truckNo: '',
172
172
  containerNo: '',
173
173
  containerSize: '',
@@ -181,7 +181,7 @@ class BulkOperation extends localize(i18next)(PageView) {
181
181
  uom: '',
182
182
  packQty: 0,
183
183
  palletQty: 0,
184
- manufactureYear: 0,
184
+ manufactureDate: new Date(),
185
185
  unitPrice: ''
186
186
  }
187
187
  ]
@@ -348,7 +348,8 @@ class BulkOperation extends localize(i18next)(PageView) {
348
348
  html`
349
349
  <validate-gan-popup
350
350
  .records=${records.map(raw => {
351
- let etaDate = new Date(String(raw.etaDate || ''))
351
+ let etaDate = new Date((raw.etaDate - (25567 + 1)) * 86400 * 1000 || NULL)
352
+ let mfgDate = new Date((raw.manufactureDate - (25567 + 1)) * 86400 * 1000 || NULL)
352
353
 
353
354
  return {
354
355
  refNo: String(raw.refNo || ''),
@@ -369,8 +370,14 @@ class BulkOperation extends localize(i18next)(PageView) {
369
370
  packQty: parseInt(raw.packQty || 0),
370
371
  palletQty: parseInt(raw.palletQty || 0),
371
372
  unitPrice: Number(raw.unitPrice || 0),
372
- manufactureYear: Math.round(Number(raw.manufactureYear || 0)),
373
- etaDate: this._getStdDateStr(etaDate)
373
+ manufactureDate: `${mfgDate.getFullYear()}-${(mfgDate.getMonth() + 1).toString().padStart(2, 0)}-${mfgDate
374
+ .getDate()
375
+ .toString()
376
+ .padStart(2, 0)}`,
377
+ etaDate: `${etaDate.getFullYear()}-${(etaDate.getMonth() + 1).toString().padStart(2, 0)}-${etaDate
378
+ .getDate()
379
+ .toString()
380
+ .padStart(2, 0)}`
374
381
  }
375
382
  })}
376
383
  .bizplaceId=${this._ganBizplaceId}
@@ -109,7 +109,7 @@ class ValidateGanPopup extends localize(i18next)(LitElement) {
109
109
  width: 150
110
110
  },
111
111
  {
112
- type: 'string',
112
+ type: 'date',
113
113
  name: 'etaDate',
114
114
  header: i18next.t('field.eta_date'),
115
115
  width: 150
@@ -205,9 +205,9 @@ class ValidateGanPopup extends localize(i18next)(LitElement) {
205
205
  width: 100
206
206
  },
207
207
  {
208
- type: 'integer',
209
- name: 'manufactureYear',
210
- header: i18next.t('field.manufacture_year'),
208
+ type: 'date',
209
+ name: 'manufactureDate',
210
+ header: i18next.t('field.manufacture_date'),
211
211
  width: 100
212
212
  },
213
213
  {
@@ -291,7 +291,7 @@ class ValidateGanPopup extends localize(i18next)(LitElement) {
291
291
  totalUomValue
292
292
  palletQty
293
293
  unitPrice
294
- manufactureYear
294
+ manufactureDate
295
295
  errorMsg
296
296
  }
297
297
  }
@@ -346,7 +346,7 @@ class ValidateGanPopup extends localize(i18next)(LitElement) {
346
346
  packQty: raw.packQty,
347
347
  palletQty: raw.palletQty,
348
348
  unitPrice: raw.unitPrice,
349
- manufactureYear: raw.manufactureYear
349
+ manufactureDate: new Date(parseInt(raw.manufactureDate))
350
350
  }
351
351
  }),
352
352
  bizplaceId
@@ -135,7 +135,7 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
135
135
  { column: 'uom', name: 'Uom' },
136
136
  { column: 'uomValue', name: 'UomValue' },
137
137
  { column: 'expirationDate', name: 'Exp. Date' },
138
- { column: 'manufactureYear', name: 'Mfg. Date' },
138
+ { column: 'manufactureDate', name: 'Mfg. Date' },
139
139
  { column: 'unitCost', name: 'Unit Cost' }
140
140
  ]
141
141
 
@@ -368,7 +368,7 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
368
368
  status
369
369
  transactionType
370
370
  expirationDate
371
- manufactureYear
371
+ manufactureDate
372
372
  unitCost
373
373
  bizplace {
374
374
  id
@@ -412,7 +412,7 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
412
412
  uom
413
413
  uomValue
414
414
  expirationDate
415
- manufactureYear
415
+ manufactureDate
416
416
  unitCost
417
417
  }
418
418
  lastInventoryHistory {
@@ -442,7 +442,7 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
442
442
  uom
443
443
  uomValue
444
444
  expirationDate
445
- manufactureYear
445
+ manufactureDate
446
446
  unitCost
447
447
  }
448
448
  createdAt
@@ -474,19 +474,33 @@ class InventoryAdjustmentApproval extends connect(store)(localize(i18next)(PageV
474
474
  ? this._convertUnixTimestampToDate(item?.inventory?.expirationDate)
475
475
  : null
476
476
 
477
+ let inventoryChangesMfgDate = item?.manufactureDate
478
+ ? this._convertUnixTimestampToDate(item?.manufactureDate)
479
+ : null
480
+ let lastInventoryChangesMfgDate = item?.lastInventoryHistory?.manufactureDate
481
+ ? this._convertUnixTimestampToDate(item?.lastInventoryHistory?.manufactureDate)
482
+ : null
483
+
484
+ let inventoryMfgDate = item?.inventory?.manufactureDate
485
+ ? this._convertUnixTimestampToDate(item?.inventory?.manufactureDate)
486
+ : null
487
+
477
488
  return {
478
489
  ...item,
479
490
  cartonId: item.inventory?.cartonId,
480
491
  inventory: {
481
492
  ...item.inventory,
482
- expirationDate: inventoryExpDate ? inventoryExpDate : null
493
+ expirationDate: inventoryExpDate ? inventoryExpDate : null,
494
+ manufactureDate: inventoryMfgDate ? inventoryMfgDate : null
483
495
  },
484
496
  lastInventoryHistory: {
485
497
  ...item.lastInventoryHistory,
486
- expirationDate: lastInventoryChangesExpDate ? lastInventoryChangesExpDate : null
498
+ expirationDate: lastInventoryChangesExpDate ? lastInventoryChangesExpDate : null,
499
+ manufactureDate: lastInventoryChangesMfgDate ? lastInventoryChangesMfgDate : null
487
500
  },
488
501
  customerName: item?.inventory?.bizplace?.name || item.bizplace.name,
489
- expirationDate: inventoryChangesExpDate ? inventoryChangesExpDate : null
502
+ expirationDate: inventoryChangesExpDate ? inventoryChangesExpDate : null,
503
+ manufactureDate: inventoryChangesMfgDate ? inventoryChangesMfgDate : null
490
504
  }
491
505
  }) || []
492
506
  }
@@ -425,11 +425,11 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
425
425
  width: 150
426
426
  },
427
427
  {
428
- type: 'number',
429
- name: 'manufactureYear',
430
- header: i18next.t('field.manufacture_year'),
431
- imex: { header: i18next.t('field.manufacture_year'), key: 'manufactureYear', width: 40, type: 'number' },
432
- record: { editable: true, options: { min: 1500, max: 2200 } },
428
+ type: 'date',
429
+ name: 'manufactureDate',
430
+ header: i18next.t('field.manufacture_date'),
431
+ imex: { header: i18next.t('field.manufacture_date'), key: 'manufactureDate', width: 40, type: 'date' },
432
+ record: { editable: true },
433
433
  sortable: true,
434
434
  width: 120
435
435
  },
@@ -437,7 +437,6 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
437
437
  type: 'string',
438
438
  name: 'remark',
439
439
  header: i18next.t('field.remark'),
440
- imex: { header: i18next.t('field.remark'), key: 'remark', width: 40, type: 'string' },
441
440
  sortable: true,
442
441
  width: 200,
443
442
  handlers: {
@@ -501,7 +500,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
501
500
  packingSize
502
501
  uom
503
502
  uomValue
504
- manufactureYear
503
+ manufactureDate
505
504
  bizplace {
506
505
  id
507
506
  name
@@ -586,7 +585,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
586
585
  uomValue
587
586
  remark
588
587
  expirationDate
589
- manufactureYear
588
+ manufactureDate
590
589
  unitCost
591
590
  bizplace {
592
591
  id
@@ -679,46 +678,34 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
679
678
  }
680
679
 
681
680
  fieldChange(e) {
681
+ let popUpDataGrist = e.target?.shadowRoot.querySelector('data-grist')
682
+
683
+ let item = e.target.localName == 'import-pop-up' ? popUpDataGrist : this.dataGrist
684
+
682
685
  switch (e.detail.column.name) {
683
686
  case 'uomValue':
684
- if (e.detail.after < 0) this.dataGrist._data.records[e.detail.row].uomValue = 0
687
+ if (e.detail.after < 0) item._data.records[e.detail.row].uomValue = 0
685
688
  break
686
689
  case 'qty':
687
690
  if (e.detail.after < 0 || !Number.isInteger(e.detail.after))
688
- this.dataGrist._data.records[e.detail.row].qty = e.detail.before
691
+ item._data.records[e.detail.row].qty = e.detail.before
689
692
  break
690
693
  case 'unitCost':
691
- if (e.detail.after < 0) this.dataGrist._data.records[e.detail.row].unitCost = e.detail.before
694
+ if (e.detail.after < 0) item._data.records[e.detail.row].unitCost = e.detail.before
692
695
  break
693
- case 'manufactureYear':
694
- if (
695
- e.detail.after != 0 &&
696
- (e.detail.after < 0 ||
697
- !Number.isInteger(e.detail.after) ||
698
- e.detail.after.toString().length < 4 ||
699
- e.detail.after.toString().length > 4)
700
- ) {
701
- this.dataGrist._data.records[e.detail.row].manufactureYear = e.detail.before == 0 ? null : e.detail.before
702
- this._showToast({ type: 'error', message: 'Invalid Manufacture Year.' })
703
- } else if (e.detail.after == 0) {
704
- this.dataGrist._data.records[e.detail.row].manufactureYear = null
705
- }
706
-
696
+ case 'manufactureDate':
697
+ if (new Date(e.detail.after) > new Date()) item._data.records[e.detail.row].manufactureDate = e.detail.before
707
698
  break
708
699
  case 'product':
709
- this.dataGrist._data.records[e.detail.row].uom = e.detail.after?.uom ? e.detail.after.uom : ''
700
+ item._data.records[e.detail.row].uom = e.detail.after?.uom ? e.detail.after.uom : ''
710
701
 
711
- this.dataGrist._data.records[e.detail.row].packingType = e.detail.after?.packingType
712
- ? e.detail.after.packingType
713
- : ''
702
+ item._data.records[e.detail.row].packingType = e.detail.after?.packingType ? e.detail.after.packingType : ''
714
703
 
715
- this.dataGrist._data.records[e.detail.row].packingSize = e.detail.after?.packingSize
716
- ? e.detail.after.packingSize
717
- : 1
704
+ item._data.records[e.detail.row].packingSize = e.detail.after?.packingSize ? e.detail.after.packingSize : 1
718
705
 
719
- this.dataGrist._data.records[e.detail.row].brand = e.detail.after?.brand ? e.detail.after.brand : ''
706
+ item._data.records[e.detail.row].brand = e.detail.after?.brand ? e.detail.after.brand : ''
720
707
 
721
- this.dataGrist._data.records[e.detail.row].sku = e.detail.after?.sku ? e.detail.after.sku : ''
708
+ item._data.records[e.detail.row].sku = e.detail.after?.sku ? e.detail.after.sku : ''
722
709
  break
723
710
  default:
724
711
  break
@@ -775,28 +762,81 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
775
762
  }
776
763
 
777
764
  async importHandler(patches) {
778
- patches.map(itm => {
779
- itm.qty = parseFloat(itm.qty)
780
- itm.packingSize = parseFloat(itm.packingSize)
781
- itm.uomValue = parseFloat(itm.uomValue)
782
- itm.manufactureYear = parseFloat(itm.manufactureYear)
783
- let dt = new Date(itm.expirationDate)
784
- itm.expirationDate = `${dt.getFullYear()}-${dt.getMonth() + 1}-${dt.getDate()}`
785
- })
765
+ try {
766
+ patches.map(itm => {
767
+ if (itm.cuFlag == '+') {
768
+ if (
769
+ !itm.bizplace?.id ||
770
+ !itm.location?.id ||
771
+ !itm.product?.id ||
772
+ !itm.batchId ||
773
+ !itm.qty ||
774
+ !itm.uomValue ||
775
+ !itm.uom ||
776
+ !itm.packingType
777
+ ) {
778
+ throw new Error(i18next.t('text.empty_value_in_list'))
779
+ }
786
780
 
787
- const response = await client.mutate({
788
- mutation: gql`
789
- mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
790
- submitInventoryChanges(patches: $patches)
781
+ if (itm.qty < 1 || itm.unitCost < 0 || itm.packingSize < 1 || itm.uomValue < 1) {
782
+ throw new Error(i18next.t('text.invalid_value_in_list'))
783
+ }
784
+
785
+ if (itm.manufactureYear && itm.manufactureYear < 1000) {
786
+ throw new Error(i18next.t('text.invalid_value_in_list'))
787
+ }
788
+ }
789
+ itm.qty = parseInt(itm.qty)
790
+ itm.packingSize = parseFloat(itm.packingSize)
791
+ itm.uomValue = parseFloat(itm.uomValue)
792
+ itm.unitCost = parseFloat(itm.unitCost)
793
+
794
+ //if user repic location after import
795
+ if (itm.location.zone || itm.location.row || itm.location.column) {
796
+ delete itm.location.zone
797
+ delete itm.location.row
798
+ delete itm.location.column
791
799
  }
792
- `,
793
- variables: { patches }
794
- })
795
800
 
796
- if (!response.errors) {
797
- history.back()
798
- this.dataGrist.fetch()
799
- this._showToast({ message: i18next.t('text.data_submitted_for_approval') })
801
+ //if user repick product after import
802
+ if (itm.product.productId) {
803
+ itm.product.id = itm.product.productId
804
+ delete itm.product.productId
805
+ delete itm.product.brand
806
+ delete itm.product.packingType
807
+ delete itm.product.packingSize
808
+ delete itm.product.sku
809
+ delete itm.product.type
810
+ delete itm.product.uom
811
+ }
812
+
813
+ if (itm.expirationDate) {
814
+ let dt = new Date(itm.expirationDate)
815
+ itm.expirationDate = `${dt.getFullYear()}-${dt.getMonth() + 1}-${dt.getDate()}`
816
+ }
817
+
818
+ if (itm.manufactureDate) {
819
+ let mdt = new Date(itm.manufactureDate)
820
+ itm.manufactureDate = `${mdt.getFullYear()}-${mdt.getMonth() + 1}-${mdt.getDate()}`
821
+ }
822
+ })
823
+
824
+ const response = await client.mutate({
825
+ mutation: gql`
826
+ mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
827
+ submitInventoryChanges(patches: $patches)
828
+ }
829
+ `,
830
+ variables: { patches }
831
+ })
832
+
833
+ if (!response.errors) {
834
+ history.back()
835
+ this.dataGrist.fetch()
836
+ this._showToast({ message: i18next.t('text.data_submitted_for_approval') })
837
+ }
838
+ } catch (e) {
839
+ this._showToast(e)
800
840
  }
801
841
  }
802
842
 
@@ -811,6 +851,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
811
851
  columns: [...this.config.columns.filter(column => column.imex !== undefined)]
812
852
  }}
813
853
  .importHandler="${this.importHandler.bind(this)}"
854
+ @field-change="${this.fieldChange.bind(this)}"
814
855
  ></import-pop-up>
815
856
  `,
816
857
  {
@@ -870,10 +911,14 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
870
911
  })
871
912
 
872
913
  data = data.map(item => {
873
- if (item?.expirationDate != '') {
914
+ if (item?.expirationDate !== null && item?.expirationDate !== '') {
874
915
  item.expirationDate = new Date(item.expirationDate).getTime()
875
916
  }
876
917
 
918
+ if (item?.manufactureDate !== null && item?.manufactureDate !== '') {
919
+ item.manufactureDate = new Date(item.manufactureDate).getTime()
920
+ }
921
+
877
922
  item.product.name = item.product.productInformation
878
923
  return {
879
924
  id: item.id,
@@ -45,19 +45,20 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
45
45
  _importCargo: Boolean,
46
46
  _hasContainer: Boolean,
47
47
  _looseItem: Boolean,
48
- isUserBelongsDomain: Boolean,
49
48
  _status: String,
50
49
  _bizplaceName: String,
51
50
  _attachments: Array,
51
+ _template: Object,
52
+ _showAssignWarehouse: Boolean,
53
+ _vasExpanded: Boolean,
54
+ _enableCartonLabel: Boolean,
55
+ _strictProductSelection: Boolean,
56
+ isUserBelongsDomain: Boolean,
52
57
  data: Object,
53
58
  productGristConfig: Object,
54
59
  vasGristConfig: Object,
55
60
  productData: Object,
56
61
  vasData: Object,
57
- _template: Object,
58
- _showAssignWarehouse: Boolean,
59
- _vasExpanded: Boolean,
60
- _enableCartonLabel: Boolean,
61
62
  arrivalNoticeId: String
62
63
  }
63
64
  }
@@ -462,6 +463,7 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
462
463
  this.vasData = { records: [] }
463
464
  this._showAssignWarehouse = false
464
465
  this._vasExpanded = false
466
+ this._strictProductSelection = false
465
467
  }
466
468
 
467
469
  get arrivalNoticeForm() {
@@ -676,10 +678,10 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
676
678
  width: 80
677
679
  },
678
680
  {
679
- type: 'string',
680
- name: 'manufactureYear',
681
- header: i18next.t('field.manufacture_year'),
682
- width: 100
681
+ type: 'date',
682
+ name: 'manufactureDate',
683
+ header: i18next.t('field.manufacture_date'),
684
+ width: 120
683
685
  },
684
686
  {
685
687
  type: 'string',
@@ -720,7 +722,7 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
720
722
  'packQty',
721
723
  'totalUomValue',
722
724
  'palletQty',
723
- 'manufactureYear',
725
+ 'manufactureDate',
724
726
  'batchIdRef',
725
727
  'unitPrice',
726
728
  'remark'
@@ -809,7 +811,7 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
809
811
  adjustedTotalUomValue
810
812
  palletQty
811
813
  adjustedPalletQty
812
- manufactureYear
814
+ manufactureDate
813
815
  releaseQty
814
816
  releaseUomValue
815
817
  }
@@ -894,6 +896,8 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
894
896
  })
895
897
  }
896
898
  this._enableCartonLabel = await fetchSettingRule('enable-carton-label', partnerDomainId)
899
+ this._strictProductSelection = await fetchSettingRule('strict-product-selection', partnerDomainId)
900
+ let a = this._strictProductSelection
897
901
  this.updateContext()
898
902
  }
899
903
  }
@@ -1336,6 +1340,7 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
1336
1340
  .ganNo="${this._ganNo}"
1337
1341
  .productData="${this.productData}"
1338
1342
  .bizplace="${this.orderBizplace}"
1343
+ .strictEditable="${this._strictProductSelection}"
1339
1344
  @completed="${this._fetchGAN.bind(this)}"
1340
1345
  ></edit-product-popup>
1341
1346
  `,
@@ -700,12 +700,12 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
700
700
  width: 80
701
701
  },
702
702
  {
703
- type: 'number',
704
- name: 'manufactureYear',
705
- header: i18next.t('field.manufacture_year'),
706
- imex: { header: i18next.t('field.manufacture_year'), key: 'manufactureYear', width: 25, type: 'float' },
703
+ type: 'date',
704
+ name: 'manufactureDate',
705
+ header: i18next.t('field.manufacture_date'),
706
+ imex: { header: i18next.t('field.manufacture_date'), key: 'manufactureDate', width: 25, type: 'string' },
707
707
  record: { editable: editable },
708
- width: 100
708
+ width: 150
709
709
  },
710
710
  {
711
711
  type: 'string',
@@ -860,16 +860,13 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
860
860
  }
861
861
  }
862
862
 
863
- if (changedColumn === 'manufactureYear') {
864
- let manufactureYear = changeRecord.manufactureYear
865
- const regExp = /^(181[2-9]|18[2-9]\d|19\d\d|2\d{3}|30[0-3]\d|304[0-8])$/
863
+ if (changedColumn === 'manufactureDate') {
864
+ let manufactureDate = new Date(changeRecord.manufactureDate)
865
+ let today = new Date()
866
866
 
867
- if (typeof manufactureYear === undefined || !regExp.test(manufactureYear)) {
868
- if (manufactureYear === 0) {
869
- delete event.detail.after[event.detail.column.name]
870
- } else {
871
- throw new Error(i18next.t('text.invalid_x', { state: { x: i18next.t('label.manufacture_year') } }))
872
- }
867
+ if (manufactureDate > today) {
868
+ delete event.detail.after[event.detail.column.name]
869
+ throw Error(i18next.t('text.manufacture-date-cannot-be-later-than-today'))
873
870
  }
874
871
  }
875
872
 
@@ -1363,7 +1360,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1363
1360
  totalUomValue: record?.totalUomValue ? record?.totalUomValue : 0,
1364
1361
  unitPrice: record?.unitPrice ? record.unitPrice : 0,
1365
1362
  remark: record?.remark ? record.remark : null,
1366
- manufactureYear: record?.manufactureYear ? record.manufactureYear : null
1363
+ manufactureDate: record?.manufactureDate ? record.manufactureDate : null
1367
1364
  }
1368
1365
 
1369
1366
  if (record.palletQty) orderProduct.palletQty = record.palletQty
@@ -1621,11 +1618,11 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1621
1618
  width: 100
1622
1619
  },
1623
1620
  {
1624
- type: 'integer',
1625
- name: 'manufactureYear',
1626
- header: i18next.t('field.manufacture_year'),
1627
- imex: { header: i18next.t('field.manufacture_year'), key: 'manufactureYear', width: 25, type: 'float' },
1628
- width: 100
1621
+ type: 'date',
1622
+ name: 'manufactureDate',
1623
+ header: i18next.t('field.manufacture_date'),
1624
+ imex: { header: i18next.t('field.manufacture_date'), key: 'manufactureDate', width: 25, type: 'string' },
1625
+ width: 120
1629
1626
  },
1630
1627
  {
1631
1628
  type: 'string',
@@ -1682,7 +1679,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1682
1679
  totalUomValue
1683
1680
  packQty
1684
1681
  palletQty
1685
- manufactureYear
1682
+ manufactureDate
1686
1683
  batchId
1687
1684
  batchIdRef
1688
1685
  unitPrice
@@ -1713,7 +1710,6 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1713
1710
  ...item,
1714
1711
  productName: item?.productName,
1715
1712
  unitPrice: parseFloat(item.unitPrice) || '',
1716
- manufactureYear: parseFloat(item.manufactureYear) || '',
1717
1713
  packQty: parseFloat(item.packQty) || '',
1718
1714
  palletQty: parseFloat(item.palletQty) || ''
1719
1715
  }
@@ -1737,8 +1733,14 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1737
1733
  async importHandler(patches) {
1738
1734
  patches.map(itm => {
1739
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
+ }
1740
1743
  itm.uomValue = parseFloat(itm.uomValue) || ''
1741
- itm.manufactureYear = parseFloat(itm.manufactureYear) || ''
1742
1744
  itm.packQty = parseFloat(itm.packQty) || ''
1743
1745
  itm.palletQty = parseFloat(itm.palletQty) || ''
1744
1746
  })
@@ -1753,7 +1755,6 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1753
1755
  ...patch,
1754
1756
  unitPrice: parseFloat(patch.unitPrice) || 0,
1755
1757
  uomValue: parseFloat(patch.uomValue) || 0,
1756
- manufactureYear: parseFloat(patch.manufactureYear) || 0,
1757
1758
  packQty: parseFloat(patch.packQty) || 0,
1758
1759
  palletQty: parseFloat(patch.palletQty) || 0
1759
1760
  }