@things-factory/operato-wms 4.3.752 → 4.3.753

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.
@@ -744,22 +744,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
744
744
  }
745
745
  }
746
746
 
747
- _formatManufactureDate(date) {
748
- if (!date) return date
749
-
750
- if (!isNaN(Number(date))) {
751
- date = Number(date)
752
- }
753
-
754
- const DATE_OPTIONS = {
755
- year: 'numeric',
756
- month: 'numeric',
757
- day: 'numeric'
758
- }
759
- const formatter = new Intl.DateTimeFormat(navigator.language, DATE_OPTIONS)
760
- return formatter.format(new Date(date))
761
- }
762
-
747
+ //===== FORMAT TIMESTAMP VALUE TO DATE STRING (YYYY-MM-DD) =====
763
748
  _formatDateForInput(date) {
764
749
  if (!date) return ''
765
750
 
@@ -781,6 +766,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
781
766
  return `${year}-${month}-${day}`
782
767
  }
783
768
 
769
+ //==== GET THE VALID MANUFACTURING DATE FROM THE MANUFACTURING DATE INPUT =====
784
770
  _getValidManufactureDate() {
785
771
  const value = this.manufactureDateInput?.value
786
772
  if (!value || value.trim() === '') return null
@@ -795,19 +781,24 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
795
781
  }
796
782
 
797
783
  _getManufactureDateValue() {
784
+ //===== IF MANUFACTURING DATE CHECK SETTING IS SET =====
798
785
  if (this._isRequiredCheckManufactureDate) {
799
786
  return this._getValidManufactureDate()
800
787
  }
801
788
 
789
+ //===== ELSE, GET THE MANUFACTURING DATE FROM THE SELECTED ORDER PRODUCT =====
790
+ let manufactureDate = null
791
+
802
792
  if (this.refOrderType === AVAIL_ORDER_TYPES.ARRIVAL_NOTICE.value) {
803
- return this._selectedOrderProduct?.manufactureDate || null
793
+ manufactureDate = this._selectedOrderProduct?.manufactureDate || null
794
+ } else if (this.refOrderType === AVAIL_ORDER_TYPES.RETURN_ORDER.value) {
795
+ manufactureDate = this._selectedOrderProduct?.inventory?.manufactureDate || null
804
796
  }
805
797
 
806
- if (this.refOrderType === AVAIL_ORDER_TYPES.RETURN_ORDER.value) {
807
- return this._selectedOrderProduct?.inventory?.manufactureDate || null
808
- }
798
+ if (!manufactureDate) return null
809
799
 
810
- return null
800
+ const formattedDate = this._formatDateForInput(manufactureDate)
801
+ return formattedDate || null
811
802
  }
812
803
 
813
804
  async _fetchProducts(orderNo, response) {
@@ -1122,17 +1113,18 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1122
1113
  inventory.packingSize == orderProduct.packingSize
1123
1114
  )
1124
1115
 
1125
- if (matchingInventories.length > 0) {
1126
- const manufactureDates = matchingInventories
1127
- .map(inv => inv.manufactureDate)
1128
- .filter(date => date != null && date !== '')
1129
- .map(date => this._formatManufactureDate(date))
1130
- .filter((date, index, self) => self.indexOf(date) === index)
1131
- .sort()
1132
-
1133
- orderProduct.displayManufactureDate = manufactureDates.length > 0 ? manufactureDates.join(', ') : (orderProduct.manufactureDate ? this._formatManufactureDate(orderProduct.manufactureDate) : null)
1134
- } else if (orderProduct.manufactureDate) {
1135
- orderProduct.displayManufactureDate = this._formatManufactureDate(orderProduct.manufactureDate)
1116
+ if (matchingInventories.length > 0) { // FOR ARRIVAL NOTICE AND RETURN ORDER WHERE ORDER PRODUCT IS UNLOADED
1117
+ const manufactureDates = [...new Set(
1118
+ matchingInventories
1119
+ .map(inv => this._formatDateForInput(inv.manufactureDate))
1120
+ .filter(date => date)
1121
+ )].sort()
1122
+
1123
+ orderProduct.displayManufactureDate = manufactureDates.length > 0 ? manufactureDates.join(', ') : (orderProduct.manufactureDate ? this._formatDateForInput(orderProduct.manufactureDate) : null)
1124
+ } else if (orderProduct.manufactureDate) { // FOR ARRIVAL NOTICE
1125
+ orderProduct.displayManufactureDate = this._formatDateForInput(orderProduct.manufactureDate)
1126
+ } else if (orderProduct?.inventory?.manufactureDate) { // FOR RETURN ORDER
1127
+ orderProduct.displayManufactureDate = this._formatDateForInput(orderProduct.inventory.manufactureDate)
1136
1128
  }
1137
1129
 
1138
1130
  return orderProduct
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-wms",
3
- "version": "4.3.752",
3
+ "version": "4.3.753",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -108,7 +108,7 @@
108
108
  "@things-factory/transport-base": "^4.3.752",
109
109
  "@things-factory/tutorial-ui": "^4.3.752",
110
110
  "@things-factory/warehouse-base": "^4.3.752",
111
- "@things-factory/worksheet-base": "^4.3.752"
111
+ "@things-factory/worksheet-base": "^4.3.753"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@things-factory/builder": "^4.3.752",
@@ -117,5 +117,5 @@
117
117
  "cypress-localstorage-commands": "^1.6.1",
118
118
  "eslint-plugin-cypress": "^2.12.1"
119
119
  },
120
- "gitHead": "cc2f8abfd00055dfbd1737e3016fe4a464af2548"
120
+ "gitHead": "b8d997d26b2b149d46ee6ba33c0db6f57fa13fa7"
121
121
  }