@things-factory/operato-wms 4.3.446 → 4.3.448

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.
@@ -1,15 +1,31 @@
1
1
  import '@things-factory/grist-ui'
2
2
 
3
3
  import gql from 'graphql-tag'
4
- import { css, html, LitElement } from 'lit-element'
4
+ import {
5
+ css,
6
+ html,
7
+ LitElement
8
+ } from 'lit-element'
5
9
  import { connect } from 'pwa-helpers/connect-mixin'
6
10
 
7
11
  import { SingleColumnFormStyles } from '@things-factory/form-ui'
8
- import { i18next, localize } from '@things-factory/i18n-base'
9
- import { client, store, CustomAlert } from '@things-factory/shell'
12
+ import {
13
+ i18next,
14
+ localize
15
+ } from '@things-factory/i18n-base'
16
+ import {
17
+ client,
18
+ CustomAlert,
19
+ store
20
+ } from '@things-factory/shell'
10
21
  import { isMobileDevice } from '@things-factory/utils'
11
22
 
12
- import { ARRIVAL_NOTICE, CUSTOMER_RETURN, WAREHOUSE_RETURN, REPLENISHMENT } from '../constants'
23
+ import {
24
+ ARRIVAL_NOTICE,
25
+ CUSTOMER_RETURN,
26
+ REPLENISHMENT,
27
+ WAREHOUSE_RETURN
28
+ } from '../constants'
13
29
 
14
30
  const AVAIL_ORDER_TYPES = { ARRIVAL_NOTICE, CUSTOMER_RETURN, WAREHOUSE_RETURN, REPLENISHMENT }
15
31
 
@@ -97,15 +113,34 @@ class UndoPutawayPopup extends connect(store)(localize(i18next)(LitElement)) {
97
113
  return this.shadowRoot.querySelector('barcode-scanable-input[name=lotId]').shadowRoot.querySelector('input')
98
114
  }
99
115
 
116
+ _handleKeyPress(e) {
117
+ this._populateTargetedInventory(e);
118
+ setTimeout(() => this._clickButton(), 100);
119
+ }
120
+
121
+ _clickButton() {
122
+ this.shadowRoot.querySelector('mwc-button').click();
123
+ }
124
+
100
125
  render() {
101
126
  return html`
102
- <form id="input-form" class="single-column-form" @keypress="${this._populateTargetedInventory.bind(this)}">
127
+ <form id="input-form" class="single-column-form">
103
128
  <fieldset>
104
129
  ${this.enableCartonLabel
105
130
  ? html`<label>${i18next.t('label.carton_id')}</label>
106
- <barcode-scanable-input name="cartonId" without-enter custom-input></barcode-scanable-input>`
131
+ <barcode-scanable-input
132
+ name="cartonId"
133
+ custom-input
134
+ @keypress="${ e=> {
135
+ this._populateTargetedInventory(e)
136
+ }}"
137
+ ></barcode-scanable-input>`
107
138
  : html`<label>${i18next.t('label.lot_id')}</label>
108
- <barcode-scanable-input name="lotId" without-enter custom-input></barcode-scanable-input>`}
139
+ <barcode-scanable-input
140
+ name="lotId"
141
+ custom-input
142
+ @keypress="${this._handleKeyPress}"
143
+ ></barcode-scanable-input>`}
109
144
  </fieldset>
110
145
  </form>
111
146
 
@@ -12,26 +12,14 @@ import '../../order/vas-order/popup/vas-target-product-popup'
12
12
  import '../../order/vas-order/popup/select-vas-popup'
13
13
 
14
14
  import gql from 'graphql-tag'
15
- import {
16
- css,
17
- html
18
- } from 'lit-element'
15
+ import { css, html } from 'lit-element'
19
16
  import { connect } from 'pwa-helpers/connect-mixin'
20
17
 
21
18
  import { getCodeByName } from '@things-factory/code-base'
22
19
  import { MultiColumnFormStyles } from '@things-factory/form-ui'
23
- import {
24
- i18next,
25
- localize
26
- } from '@things-factory/i18n-base'
20
+ import { i18next, localize } from '@things-factory/i18n-base'
27
21
  import { openPopup } from '@things-factory/layout-base'
28
- import {
29
- client,
30
- CustomAlert,
31
- navigate,
32
- PageView,
33
- store
34
- } from '@things-factory/shell'
22
+ import { client, CustomAlert, navigate, PageView, store } from '@things-factory/shell'
35
23
  import { CommonButtonStyles } from '@things-factory/styles'
36
24
  import { isMobileDevice } from '@things-factory/utils'
37
25
 
@@ -1184,6 +1172,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1184
1172
  'newSku',
1185
1173
  'newPackingType',
1186
1174
  'newUom',
1175
+ 'newUnitUomValue',
1187
1176
  'newUomValue',
1188
1177
  'outputQty',
1189
1178
  'remark'
@@ -1329,18 +1318,25 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1329
1318
  width: 80
1330
1319
  },
1331
1320
  {
1332
- type: 'integer',
1321
+ type: 'float',
1322
+ name: 'newUnitUomValue',
1323
+ header: i18next.t('field.uom_value_sku', { sku: 'NEW SKU' }),
1324
+ record: { editable: !this._strictProductSelection },
1325
+ width: 150
1326
+ },
1327
+ {
1328
+ type: 'float',
1333
1329
  name: 'newUomValue',
1334
- header: i18next.t('field.uom_value_sku', { sku: 'N.SKU' }),
1335
- record: { editable: true, options: { min: 0 } },
1336
- width: 80
1330
+ header: i18next.t('field.total_uom_value_sku', { sku: 'N.SKU' }),
1331
+ record: { editable: !this._strictProductSelection, options: { min: 0 } },
1332
+ width: 150
1337
1333
  },
1338
1334
  {
1339
1335
  type: 'integer',
1340
1336
  name: 'outputQty',
1341
1337
  header: i18next.t('field.output_qty'),
1342
1338
  record: { editable: true, options: { min: 0 } },
1343
- width: 80
1339
+ width: 100
1344
1340
  },
1345
1341
  {
1346
1342
  type: 'string',
@@ -1557,9 +1553,12 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1557
1553
  let roundedUomValue = parseFloat(op.releaseUomValue.toFixed(2))
1558
1554
  return {
1559
1555
  ...op,
1560
- productSKU: op?.product?.sku || op?.productBundle?.sku ||'',
1561
- productName: op?.product?.name ? `${op?.product?.name} (${op?.product?.description})` :
1562
- op?.productBundle?.name ? `${op?.productBundle?.name} (${op?.productBundle?.description})` : '',
1556
+ productSKU: op?.product?.sku || op?.productBundle?.sku || '',
1557
+ productName: op?.product?.name
1558
+ ? `${op?.product?.name} (${op?.product?.description})`
1559
+ : op?.productBundle?.name
1560
+ ? `${op?.productBundle?.name} (${op?.productBundle?.description})`
1561
+ : '',
1563
1562
  productBrand: op?.product?.brand || '',
1564
1563
  roundedUomValue: `${roundedUomValue} ${op.uom}`,
1565
1564
  releaseUomValueWithUom: op.releaseUomValue + ' ' + op.uom
@@ -1679,6 +1678,15 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1679
1678
  records: orderInventories
1680
1679
  }
1681
1680
 
1681
+ /**
1682
+ * Calculate the unit UOM value based on the new UOM value and output quantity.
1683
+ *
1684
+ * @param {number} newUomValue - the total UOM value
1685
+ * @param {number} outputQty - the output quantity
1686
+ * @return {number} the calculated unit UOM value
1687
+ */
1688
+ const calUnitUomValue = (newUomValue, outputQty) => newUomValue / outputQty
1689
+
1682
1690
  this.deletedVas = []
1683
1691
  this.vasData = {
1684
1692
  records: orderVass
@@ -1691,6 +1699,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1691
1699
  uom: orderVas.productDetail?.uom,
1692
1700
  newSku: orderVas.newProduct?.sku,
1693
1701
  newPackingType: orderVas?.newPackingType,
1702
+ newUnitUomValue: calUnitUomValue(orderVas?.newUomValue, orderVas?.outputQty).toFixed(2),
1694
1703
  newUomValue: orderVas?.newUomValue,
1695
1704
  newUom: orderVas?.newUom,
1696
1705
  releaseQty: releaseQty
@@ -2589,6 +2598,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
2589
2598
  changedColumn === 'newPackingType' ||
2590
2599
  changedColumn === 'newUom' ||
2591
2600
  changedColumn === 'newUomValue' ||
2601
+ changedColumn === 'newUnitUomValue' ||
2592
2602
  changedColumn === 'outputQty' ||
2593
2603
  changedColumn === 'remark'
2594
2604
  )
@@ -2633,17 +2643,34 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
2633
2643
  } else if (changedColumn === 'outputQty' && !this._strictProductSelection) {
2634
2644
  if (changeRecord.outputQty <= 0 || isNaN(changeRecord.outputQty)) {
2635
2645
  throw new Error(i18next.t('text.invalid_quantity_input'))
2636
- } else if (initialRecord.outputQty == null) {
2637
- const totalUomValue = changeRecord.outputQty * (changeRecord.newUomValue / changeRecord.qty)
2638
- changeRecord.newUomValue = totalUomValue
2639
2646
  } else {
2640
- const totalUomValue = changeRecord.outputQty * (initialRecord.newUomValue / initialRecord.outputQty)
2641
- changeRecord.newUomValue = totalUomValue
2647
+ const totalUomValue = changeRecord.outputQty * initialRecord.newUnitUomValue
2648
+ changeRecord.newUomValue = totalUomValue.toFixed(2)
2642
2649
  }
2643
- } else if (changedColumn === 'newUomValue') {
2644
- if (isNaN(changeRecord.newUomValue) || changeRecord.newUomValue <= 0) {
2650
+ } else if (changedColumn === 'newUnitUomValue' && !this._strictProductSelection) {
2651
+ if (changeRecord.newUnitUomValue <= 0 || isNaN(changeRecord.newUnitUomValue)) {
2645
2652
  throw new Error(i18next.t('text.invalid_quantity_input'))
2646
2653
  }
2654
+
2655
+ const decimalPlaces = (changeRecord.newUnitUomValue.toString().split('.')[1] || '').length
2656
+
2657
+ if (decimalPlaces > 2) {
2658
+ throw new Error(i18next.t('text.cannot_add_more_than_2_decimal_places'))
2659
+ }
2660
+
2661
+ const totalUomValue = changeRecord.newUnitUomValue * initialRecord.outputQty
2662
+ changeRecord.newUomValue = totalUomValue.toFixed(2)
2663
+ } else if (changedColumn === 'newUomValue' && !this._strictProductSelection) {
2664
+ if (changeRecord.newUomValue <= 0 || isNaN(changeRecord.newUomValue)) {
2665
+ throw new Error(i18next.t('text.invalid_quantity_input'))
2666
+ }
2667
+ const decimalPlaces = (changeRecord.newUomValue.toString().split('.')[1] || '').length
2668
+
2669
+ if (decimalPlaces > 2) {
2670
+ throw new Error(i18next.t('text.cannot_add_more_than_2_decimal_places'))
2671
+ }
2672
+ const unitUomValue = changeRecord.newUomValue / initialRecord.outputQty
2673
+ changeRecord.newUnitUomValue = unitUomValue.toFixed(2)
2647
2674
  } else if (changedColumn === 'vasQty') {
2648
2675
  if (changeRecord.vasQty <= 0 || isNaN(changeRecord.vasQty)) {
2649
2676
  throw new Error(i18next.t('text.invalid_quantity_input'))
@@ -3145,7 +3172,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
3145
3172
  newProductDetail: ov.newProductDetailId,
3146
3173
  newPackingType: ov.newPackingType,
3147
3174
  newUom: ov.newUom,
3148
- newUomValue: ov.newUomValue,
3175
+ newUomValue: parseFloat(ov.newUomValue),
3149
3176
  outputQty: ov.outputQty ? ov.outputQty : ov.qty,
3150
3177
  remark: ov.remark,
3151
3178
  orderVasItemsPatch: this.vasGrist.dirtyData.records.reduce((acc, cur) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-wms",
3
- "version": "4.3.446",
3
+ "version": "4.3.448",
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.434",
92
92
  "@things-factory/product-base": "^4.3.443",
93
93
  "@things-factory/resource-ui": "^4.3.434",
94
- "@things-factory/sales-ui": "^4.3.443",
94
+ "@things-factory/sales-ui": "^4.3.448",
95
95
  "@things-factory/scene-data-transform": "^4.3.381",
96
96
  "@things-factory/scene-excel": "^4.3.381",
97
97
  "@things-factory/scene-firebase": "^4.3.381",
@@ -107,8 +107,8 @@
107
107
  "@things-factory/system-ui": "^4.3.434",
108
108
  "@things-factory/transport-base": "^4.3.434",
109
109
  "@things-factory/tutorial-ui": "^4.3.434",
110
- "@things-factory/warehouse-base": "^4.3.443",
111
- "@things-factory/worksheet-base": "^4.3.446"
110
+ "@things-factory/warehouse-base": "^4.3.448",
111
+ "@things-factory/worksheet-base": "^4.3.448"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@things-factory/builder": "^4.3.381",
@@ -117,5 +117,5 @@
117
117
  "cypress-localstorage-commands": "^1.6.1",
118
118
  "eslint-plugin-cypress": "^2.12.1"
119
119
  },
120
- "gitHead": "92d0c9667bb0da4e801da5c30159d566e62d962e"
120
+ "gitHead": "9d6ac53c80bdd7adf62a96cfe159bf68fa58a7b7"
121
121
  }