@things-factory/operato-wms 4.3.793 → 4.3.795

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.
@@ -710,14 +710,14 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
710
710
  header: i18next.t('field.total_uom_value'),
711
711
  width: 120
712
712
  },
713
- {
713
+ ...(!this.enableDirectInbound ? [{
714
714
  type: 'integer',
715
715
  name: 'palletQty',
716
716
  header: i18next.t('field.pallet_qty'),
717
717
  imex: { header: i18next.t('field.pallet_qty'), key: 'palletQty', width: 25, type: 'float' },
718
718
  record: { editable: editable, options: { min: 0 } },
719
719
  width: 80
720
- },
720
+ }] : []),
721
721
  ...(this._enableLotIdInput
722
722
  ? [
723
723
  {
@@ -808,7 +808,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
808
808
  }
809
809
 
810
810
  if (this.enableDirectInbound) {
811
- const anchor = this._enableLotIdInput ? 'palletId' : 'palletQty'
811
+ const anchor = this._enableLotIdInput ? 'palletId' : 'totalUomValue'
812
812
  insertAfter(productGristColumns, anchor, [expDateColumn])
813
813
 
814
814
  insertAfter(productGristColumns, 'batchIdRef', [warehouseColumn, locationColumn])
@@ -1234,7 +1234,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1234
1234
  arrivalNotice.orderProducts = this._getOrderProducts()
1235
1235
  const fileUploader = this._document?.files ? this._document.files : undefined
1236
1236
 
1237
- if (arrivalNotice.orderProducts.some(orderProduct => !orderProduct.palletQty)) {
1237
+ if (!this.enableDirectInbound && arrivalNotice.orderProducts.some(orderProduct => !orderProduct.palletQty)) {
1238
1238
  const result = await CustomAlert({
1239
1239
  title: i18next.t('title.are_you_sure'),
1240
1240
  text: i18next.t('text.there_is_no_pallet_qty'),
@@ -1439,11 +1439,11 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1439
1439
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.uom_value') } }))
1440
1440
  }
1441
1441
 
1442
- if (records.some(({ palletQty }) => palletQty < 0)) {
1442
+ if (!this.enableDirectInbound && records.some(({ palletQty }) => palletQty < 0)) {
1443
1443
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.pallet_qty') } }))
1444
1444
  }
1445
1445
 
1446
- if (records.some(({ palletQty, packQty }) => palletQty > packQty)) {
1446
+ if (!this.enableDirectInbound && records.some(({ palletQty, packQty }) => palletQty > packQty)) {
1447
1447
  throw new Error(
1448
1448
  i18next.t('text.a_cannot_exceed_b', {
1449
1449
  state: {
@@ -1476,7 +1476,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1476
1476
  )
1477
1477
  }
1478
1478
 
1479
- if (!record.location || !record.location.id) {
1479
+ if (!record.location || (!record.location.id && !record.location.name)) {
1480
1480
  throw new Error(
1481
1481
  i18next.t('text.location_required_for_product', {
1482
1482
  defaultValue: `Row ${index + 1}: Location is missing for product "${record.product?.name}"`,
@@ -1841,13 +1841,13 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1841
1841
  imex: { header: i18next.t('field.pack_qty'), key: 'packQty', width: 25, type: 'float' },
1842
1842
  width: 100
1843
1843
  },
1844
- {
1844
+ ...(!this.enableDirectInbound ? [{
1845
1845
  type: 'integer',
1846
1846
  name: 'palletQty',
1847
1847
  header: i18next.t('field.pallet_qty'),
1848
1848
  imex: { header: i18next.t('field.pallet_qty'), key: 'palletQty', width: 25, type: 'float' },
1849
1849
  width: 100
1850
- },
1850
+ }] : []),
1851
1851
  ...(this._enableLotIdInput
1852
1852
  ? [
1853
1853
  {
@@ -2087,6 +2087,34 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
2087
2087
 
2088
2088
  async _importableData(records) {
2089
2089
  try {
2090
+ // Remap raw Excel header text keys to imex.key values
2091
+ const headerToKey = {}
2092
+ this.excelColumns()
2093
+ .filter(col => col.imex)
2094
+ .forEach(col => {
2095
+ headerToKey[col.imex.header.toLowerCase()] = col.imex.key
2096
+ })
2097
+
2098
+ records = records.map(record => {
2099
+ const remapped = {}
2100
+ Object.entries(record).forEach(([rawKey, value]) => {
2101
+ if (!rawKey) return
2102
+ const mappedKey = headerToKey[rawKey.toLowerCase()]
2103
+ if (mappedKey) {
2104
+ const parts = mappedKey.split('.')
2105
+ if (parts.length === 2) {
2106
+ remapped[parts[0]] = remapped[parts[0]] || {}
2107
+ remapped[parts[0]][parts[1]] = value
2108
+ } else {
2109
+ remapped[mappedKey] = value
2110
+ }
2111
+ } else {
2112
+ remapped[rawKey] = value
2113
+ }
2114
+ })
2115
+ return remapped
2116
+ })
2117
+
2090
2118
  if (!this.enableDirectInbound && records.some(record => record.location)) {
2091
2119
  throw new Error(
2092
2120
  'Location-based assignment is not allowed. Please delete the' +
@@ -2100,11 +2128,17 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
2100
2128
  .map(record => {
2101
2129
  let warehouseName
2102
2130
  if (this.enableDirectInbound) {
2103
- const match = record.location.name.match(/(.*) \((.*)\)/)
2131
+ const locationItem = record.location?.name
2132
+ const locationName = typeof locationItem === 'object' ? locationItem?.name : locationItem
2133
+ const locationId = typeof locationItem === 'object' ? locationItem?.id : undefined
2134
+ const match = locationName?.match(/(.*) \((.*)\)/)
2104
2135
  if (match && match.length === 3) {
2105
- record.location.name = match[1].trim()
2106
2136
  warehouseName = match[2].trim()
2107
- record = { ...record, warehouseName: warehouseName }
2137
+ record = {
2138
+ ...record,
2139
+ location: { id: locationId, name: match[1].trim() },
2140
+ warehouseName
2141
+ }
2108
2142
  }
2109
2143
  }
2110
2144
  return {
@@ -2112,19 +2146,19 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
2112
2146
  unitPrice:
2113
2147
  record.unitPrice == null && record.unitPrice !== undefined
2114
2148
  ? '0.00'
2115
- : record.unitPrice === undefined
2149
+ : record.unitPrice === undefined || record.unitPrice == ""
2116
2150
  ? null
2117
2151
  : parseFloat(parseFloat(record.unitPrice).toFixed(2)),
2118
2152
  packQty:
2119
2153
  record.packQty == null && record.packQty !== undefined
2120
2154
  ? '0'
2121
- : record.packQty === undefined
2155
+ : record.packQty === undefined || record.packQty == ""
2122
2156
  ? null
2123
2157
  : parseFloat(parseFloat(record.packQty).toFixed(3)),
2124
2158
  palletQty:
2125
2159
  record.palletQty == null && record.palletQty !== undefined
2126
2160
  ? parseInt('0')
2127
- : record.palletQty === undefined
2161
+ : record.palletQty === undefined || record.palletQty == ""
2128
2162
  ? null
2129
2163
  : parseInt(record.palletQty),
2130
2164
  uomValue: record.uomValue !== null && record.uomValue !== undefined ? parseFloat(record.uomValue) : ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-wms",
3
- "version": "4.3.793",
3
+ "version": "4.3.795",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -91,7 +91,7 @@
91
91
  "@things-factory/print-ui": "^4.3.767",
92
92
  "@things-factory/product-base": "^4.3.791",
93
93
  "@things-factory/resource-ui": "^4.3.790",
94
- "@things-factory/sales-ui": "^4.3.793",
94
+ "@things-factory/sales-ui": "^4.3.795",
95
95
  "@things-factory/scene-data-transform": "^4.3.767",
96
96
  "@things-factory/scene-excel": "^4.3.767",
97
97
  "@things-factory/scene-firebase": "^4.3.767",
@@ -108,7 +108,7 @@
108
108
  "@things-factory/transport-base": "^4.3.767",
109
109
  "@things-factory/tutorial-ui": "^4.3.767",
110
110
  "@things-factory/warehouse-base": "^4.3.791",
111
- "@things-factory/worksheet-base": "^4.3.793"
111
+ "@things-factory/worksheet-base": "^4.3.795"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@things-factory/builder": "^4.3.767",
@@ -117,5 +117,5 @@
117
117
  "cypress-localstorage-commands": "^1.6.1",
118
118
  "eslint-plugin-cypress": "^2.12.1"
119
119
  },
120
- "gitHead": "3625782baac0631117d23db07792b5535f00b19a"
120
+ "gitHead": "8159de8fb17815c04d55e515316e41bb226f1450"
121
121
  }