@things-factory/operato-wms 4.0.34 → 4.0.38

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.
package/Dockerfile CHANGED
@@ -1,49 +1,5 @@
1
1
  # Use an official ubuntu image
2
- FROM ubuntu:18.04
3
-
4
- # Use an official node image
5
- FROM node:14.18
6
-
7
- ARG DEBIAN_FRONTEND=noninteractive
8
-
9
- # Install the required packages
10
- RUN apt-get update -o Acquire::CompressionTypes::Order::=gz
11
- RUN apt-get upgrade -y
12
-
13
- RUN echo "deb http://ftp.de.debian.org/debian stable main" > /etc/apt/sources.list
14
-
15
- RUN apt-get update
16
-
17
- RUN apt-get install -y --no-install-recommends apt-utils
18
- RUN apt-get install -y chromium
19
- RUN apt-get install -y libcups2-dev
20
- RUN apt-get install -y libavahi-compat-libdnssd-dev
21
- RUN apt-get install -y gconf-service libasound2 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libxss1 fonts-liberation libnss3 lsb-release xdg-utils libaio1
22
-
23
- RUN apt update
24
- RUN apt-get install -y ghostscript
25
- RUN apt-get install -y curl
26
- RUN apt-get install -y git
27
-
28
- # install chrome
29
- RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
30
- RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
31
- RUN rm google-chrome-stable_current_amd64.deb
32
-
33
-
34
-
35
- # make oracle path
36
- RUN mkdir -p /opt/oracle
37
- WORKDIR /opt/oracle
38
-
39
- # download newest oracle cilent for connect to Oracle Database
40
- RUN wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip && \
41
- unzip instantclient-basiclite-linuxx64.zip && \
42
- rm -f instantclient-basiclite-linuxx64.zip && \
43
- cd /opt/oracle/instantclient* && \
44
- rm -f *jdbc* *occi* *mysql* *mql1* *ipc1* *jar uidrvci genezi adrci && \
45
- echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf &&\
46
- ldconfig
2
+ FROM hatiolab/operato-env:latest
47
3
 
48
4
  # Set the working directory to /app
49
5
  WORKDIR /app
@@ -411,8 +411,8 @@ class BulkOperation extends localize(i18next)(PageView) {
411
411
  packingSize: !isNaN(Number(record.packingSize || 'x')) ? Number(record.packingSize) : null,
412
412
  uom: record.uom && record.uom != '' ? String(record.uom) : null,
413
413
  releaseQty: Number(record.releaseQty),
414
- postalCode: String(record.postalCode),
415
- phone1: String(record.phone1),
414
+ postalCode: String(record.postalCode || ''),
415
+ phone1: String(record.phone1 || ''),
416
416
  exportOption: false
417
417
  }
418
418
  })}
@@ -84,6 +84,14 @@ class PopupReusablePallet extends localize(i18next)(LitElement) {
84
84
  @click="${async () => await this._verifyInput()}"
85
85
  label="${i18next.t('button.confirm')}"
86
86
  ></mwc-button>
87
+ <mwc-button
88
+ raised
89
+ @click="${async () => {
90
+ this.dispatchEvent(new CustomEvent('normalPallet'))
91
+ history.back()
92
+ }}"
93
+ label="${i18next.t('button.disable')}"
94
+ ></mwc-button>
87
95
  </div>
88
96
  }
89
97
  `
@@ -67,7 +67,7 @@ class WorksheetInformationPopup extends connect(store)(localize(i18next)(LitElem
67
67
  <label>${i18next.t('label.started_at')}</label>
68
68
  <input name="startedAt" type="datetime-local" readonly />
69
69
 
70
- <label>${i18next.t('label.plastic_pallet')}</label>
70
+ <label>${i18next.t('label.reusable_pallet_id')}</label>
71
71
  <input name="plasticPallet" readonly />
72
72
  </fieldset>
73
73
  </form>
@@ -206,7 +206,7 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
206
206
  <barcode-scanable-input name="cartonId" custom-input></barcode-scanable-input>
207
207
  `
208
208
  : html`
209
- <label>${i18next.t('label.lot_barcode')}</label>
209
+ <label>${i18next.t('label.lot_id')}</label>
210
210
  <barcode-scanable-input name="palletId" .value=${this._pallet} custom-input></barcode-scanable-input>
211
211
  `}
212
212
  ${this._operationType === OPERATION_TYPE.PUTAWAY
@@ -716,26 +716,22 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
716
716
  const locationDetails = await this._fetchLocation(this.locationInput.value.trim())
717
717
 
718
718
  if (this._enableCartonLabel) {
719
- let worksheetDetail = this._getSelectedOrderProducts(this.cartonInput.value)
720
- worksheetDetailNames.push(worksheetDetail[0].name)
721
- if (worksheetDetail[0].expirationDate) {
722
- await this._checkExpiry(
723
- worksheetDetail[0].expirationPeriod,
724
- new Date(worksheetDetail[0].expirationDate),
725
- locationDetails.type
726
- )
719
+ let worksheetDetails = this._getSelectedOrderProducts(this.cartonInput.value)
720
+ worksheetDetails.forEach(itm => {
721
+ worksheetDetailNames.push(itm.name)
722
+ })
723
+ if (worksheetDetails.find(itm => itm.expirationDate)) {
724
+ var answer = await this._checkExpiry(worksheetDetails, locationDetails.type)
727
725
  }
728
726
  } else {
729
727
  worksheetDetailNames.push(this._selectedOrderProduct.name)
730
728
  if (this._selectedOrderProduct.expirationDate) {
731
- await this._checkExpiry(
732
- this._selectedOrderProduct.expirationPeriod,
733
- new Date(this._selectedOrderProduct.expirationDate),
734
- locationDetails.type
735
- )
729
+ var answer = await this._checkExpiry(this._selectedOrderProduct, locationDetails.type)
736
730
  }
737
731
  }
738
732
 
733
+ if (!answer.value) return (this._scanning = false)
734
+
739
735
  const response = await client.mutate({
740
736
  mutation: gql`
741
737
  mutation putaway(
@@ -797,26 +793,22 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
797
793
  const locationDetails = await this._fetchLocation(this.locationInput.value.trim())
798
794
 
799
795
  if (this._enableCartonLabel) {
800
- let worksheetDetail = this._getSelectedOrderProducts(this.cartonInput.value)
801
- worksheetDetailNames.push(worksheetDetail[0].name)
802
- if (worksheetDetail[0].expirationDate) {
803
- await this._checkExpiry(
804
- worksheetDetail[0].expirationPeriod,
805
- new Date(worksheetDetail[0].expirationDate),
806
- locationDetails.type
807
- )
796
+ let worksheetDetails = this._getSelectedOrderProducts(this.cartonInput.value)
797
+ worksheetDetails.forEach(itm => {
798
+ worksheetDetailNames.push(itm.name)
799
+ })
800
+ if (worksheetDetails.find(itm => itm.expirationDate)) {
801
+ var answer = await this._checkExpiry(worksheetDetails, locationDetails.type)
808
802
  }
809
803
  } else {
810
804
  worksheetDetailNames.push(this._selectedOrderProduct.name)
811
805
  if (this._selectedOrderProduct.expirationDate) {
812
- await this._checkExpiry(
813
- this._selectedOrderProduct.expirationPeriod,
814
- new Date(this._selectedOrderProduct.expirationDate),
815
- locationDetails.type
816
- )
806
+ var answer = await this._checkExpiry(this._selectedOrderProduct, locationDetails.type)
817
807
  }
818
808
  }
819
809
 
810
+ if (!answer.value) return (this._scanning = false)
811
+
820
812
  const response = await client.mutate({
821
813
  mutation: gql`
822
814
  mutation putawayReturn(
@@ -977,11 +969,15 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
977
969
  }
978
970
  }
979
971
 
980
- async _expiryAlert() {
981
- await CustomAlert({
972
+ async _expiryAlert(expiringProducts) {
973
+ const answer = await CustomAlert({
982
974
  title: i18next.t('title.location_scanned_is_not_a_quarantine_zone'),
983
- confirmButton: { text: i18next.t('button.confirm') }
975
+ text: i18next.t('text.x_is_expiring', { x: expiringProducts }),
976
+ confirmButton: { text: i18next.t('button.confirm') },
977
+ cancelButton: { text: i18next.t('button.cancel') }
984
978
  })
979
+
980
+ return answer
985
981
  }
986
982
 
987
983
  _getSelectedOrderProducts(scannedCartonId) {
@@ -991,7 +987,8 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
991
987
  return {
992
988
  name: record.name,
993
989
  expirationDate: record.expirationDate,
994
- expirationPeriod: record.product.expirationPeriod
990
+ expirationPeriod: record.product.expirationPeriod,
991
+ palletId: record.palletId
995
992
  }
996
993
  })
997
994
  }
@@ -1048,13 +1045,21 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
1048
1045
  }
1049
1046
  }
1050
1047
 
1051
- async _checkExpiry(expirationPeriod, expiryDate, locationType) {
1052
- let date = new Date()
1053
- let acceptBefore = new Date(date.setDate(date.getDate() + expirationPeriod))
1048
+ async _checkExpiry(worksheetDetails, locationType) {
1049
+ let expiringProducts = []
1050
+ for (let wsd of worksheetDetails) {
1051
+ new Date(wsd.expirationDate)
1052
+ let date = new Date()
1053
+ let acceptBefore = new Date(date.setDate(date.getDate() + wsd.expirationPeriod))
1054
1054
 
1055
- if (expirationPeriod > 0) {
1056
- if (expiryDate < acceptBefore && locationType !== 'QUARANTINE') await this._expiryAlert()
1055
+ if (wsd.expirationPeriod > 0 && wsd.expirationDate) {
1056
+ if (new Date(wsd.expirationDate) < acceptBefore && locationType !== 'QUARANTINE') {
1057
+ expiringProducts.push(wsd.palletId)
1058
+ }
1059
+ }
1057
1060
  }
1061
+
1062
+ return this._expiryAlert(expiringProducts.toString())
1058
1063
  }
1059
1064
 
1060
1065
  _validateTransfer() {
@@ -109,19 +109,11 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
109
109
  get context() {
110
110
  var actions = []
111
111
  if (this._worksheetLoaded && !this._enableCartonLabel) {
112
- if (this._usingReusablePallet) {
113
- actions.push({
114
- title: i18next.t('button.wooden_pallet'),
115
- action: this._woodenPalletMode.bind(this),
116
- ...CommonButtonStyles.activate
117
- })
118
- } else {
119
- actions.push({
120
- title: i18next.t('button.plastic_pallet'),
121
- action: this._reusablePalletMode.bind(this),
122
- ...CommonButtonStyles.activate
123
- })
124
- }
112
+ actions.push({
113
+ title: i18next.t('button.plastic_pallet'),
114
+ action: this._reusablePalletMode.bind(this),
115
+ ...CommonButtonStyles.activate
116
+ })
125
117
  }
126
118
 
127
119
  if (this._isLooseItem) {
@@ -667,6 +659,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
667
659
  if (!response.errors) {
668
660
  this._orderNo = orderNo
669
661
  const worksheetInfo = response.data.unloadingReturnWorksheet.worksheetInfo
662
+ this._worksheetInfo = worksheetInfo
670
663
 
671
664
  this.orderProductData = {
672
665
  records: orderBy(
@@ -797,45 +790,50 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
797
790
  }
798
791
 
799
792
  async _scanProductUnload() {
800
- if (this._scanning === false) {
801
- this._scanning = true
802
- try {
803
- const response = await client.mutate({
804
- mutation: gql`
805
- mutation scanProductUnload(
806
- $worksheetDetailName: String!
807
- $productBarcode: String!
808
- $inventory: InventoryPatch!
809
- ) {
810
- scanProductUnload(
811
- worksheetDetailName: $worksheetDetailName
812
- productBarcode: $productBarcode
813
- inventory: $inventory
814
- )
815
- }
816
- `,
817
- variables: {
818
- worksheetDetailName: this._selectedOrderProduct.name,
819
- productBarcode: this.productBarcodeInput.value.trim(),
820
- inventory: {
821
- palletId: this._enableCartonLabel ? null : this.lotInput.value.trim(),
822
- cartonId: this._enableCartonLabel ? this.cartonInput.value.trim() : null,
823
- expirationDate: this.expDateInput?.value ? this.expDateInput.value : null
824
- }
825
- }
826
- })
793
+ if (this._scanning) return this._showToast({ message: i18next.t('text.previous_scan_is_executing') })
794
+ this._scanning = true
827
795
 
828
- if (!response.errors) {
829
- await this._checkExpiry()
830
- await this._fetchProducts(this._orderNo)
796
+ const answer = await this._checkExpiry()
797
+
798
+ if (!answer.value) return (this._scanning = false)
799
+
800
+ try {
801
+ const response = await client.mutate({
802
+ mutation: gql`
803
+ mutation scanProductUnload(
804
+ $worksheetDetailName: String!
805
+ $productBarcode: String!
806
+ $inventory: InventoryPatch!
807
+ ) {
808
+ scanProductUnload(
809
+ worksheetDetailName: $worksheetDetailName
810
+ productBarcode: $productBarcode
811
+ inventory: $inventory
812
+ )
813
+ }
814
+ `,
815
+ variables: {
816
+ worksheetDetailName: this._selectedOrderProduct.name,
817
+ productBarcode: this.productBarcodeInput.value.trim(),
818
+ inventory: {
819
+ palletId: this._enableCartonLabel ? null : this.lotInput.value.trim(),
820
+ cartonId: this._enableCartonLabel ? this.cartonInput.value.trim() : null,
821
+ expirationDate: this.expDateInput?.value ? this.expDateInput.value : null
822
+ }
831
823
  }
832
- } catch (e) {
833
- this._showToast(e)
834
- }
824
+ })
835
825
 
826
+ if (!response.errors) {
827
+ await this._fetchProducts(this._orderNo)
828
+ }
829
+ } catch (e) {
830
+ // for cartonId + product scanning
831
+ // show custom toast for incorrect product barcodes
832
+ // full errors for everything else
833
+ if (!(e instanceof TypeError)) return this._showToast(e)
834
+ this._showToast({ message: i18next.t('text.incorrect_product_barcode') })
835
+ } finally {
836
836
  this._scanning = false
837
- } else {
838
- this._showToast({ message: i18next.t('text.previous_scan_is_executing') })
839
837
  }
840
838
  }
841
839
 
@@ -845,17 +843,25 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
845
843
  const acceptBefore = new Date(date.setDate(date.getDate() + this._expirationPeriod))
846
844
  let expiryDate = new Date(this.expDateInput.value)
847
845
  if (expiryDate < acceptBefore) {
848
- await CustomAlert({
846
+ var answer = await CustomAlert({
849
847
  title: i18next.t('title.item_unloading_is_expiring_soon'),
850
- confirmButton: { text: i18next.t('button.confirm') }
848
+ confirmButton: { text: i18next.t('button.confirm') },
849
+ cancelButton: { text: i18next.t('button.cancel') }
851
850
  })
852
851
  }
853
852
  }
853
+
854
+ return answer
854
855
  }
855
856
 
856
857
  async _qtyUnload() {
857
858
  if (this._scanning) return this._showToast({ message: i18next.t('text.previous_scan_is_executing') })
858
859
  this._scanning = true
860
+
861
+ const answer = await this._checkExpiry()
862
+
863
+ if (!answer.value) return (this._scanning = false)
864
+
859
865
  try {
860
866
  const response = await client.mutate({
861
867
  mutation: gql`
@@ -876,7 +882,6 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
876
882
  }
877
883
  })
878
884
  if (!response.errors) {
879
- await this._checkExpiry()
880
885
  await this._fetchProducts(this._orderNo)
881
886
  }
882
887
  } catch (e) {
@@ -1112,25 +1117,25 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1112
1117
  if (this.refOrderType === AVAIL_ORDER_TYPES.ARRIVAL_NOTICE.value) {
1113
1118
  response = await client.mutate({
1114
1119
  mutation: gql`
1115
- mutation completeUnloadingPartially($arrivalNoticeNo: String!, $worksheetDetail: WorksheetDetailPatch!) {
1120
+ mutation completeUnloadingPartially($arrivalNoticeNo: String!, $worksheetDetail: [WorksheetDetailPatch!]) {
1116
1121
  completeUnloadingPartially(arrivalNoticeNo: $arrivalNoticeNo, worksheetDetail: $worksheetDetail)
1117
1122
  }
1118
1123
  `,
1119
1124
  variables: {
1120
1125
  arrivalNoticeNo: this._orderNo,
1121
- worksheetDetail: this._getWorksheetDetails().find(wsd => wsd.name === this._selectedOrderProduct.name)
1126
+ worksheetDetail: this._getWorksheetDetails('partial').filter(wsd => wsd.actualPackQty > 0)
1122
1127
  }
1123
1128
  })
1124
1129
  } else {
1125
1130
  response = await client.mutate({
1126
1131
  mutation: gql`
1127
- mutation completeUnloadReturnPartially($returnOrderNo: String!, $worksheetDetail: WorksheetDetailPatch!) {
1132
+ mutation completeUnloadReturnPartially($returnOrderNo: String!, $worksheetDetail: [WorksheetDetailPatch!]) {
1128
1133
  completeUnloadReturnPartially(returnOrderNo: $returnOrderNo, worksheetDetail: $worksheetDetail)
1129
1134
  }
1130
1135
  `,
1131
1136
  variables: {
1132
1137
  returnOrderNo: this._orderNo,
1133
- worksheetDetail: this._getWorksheetDetails().find(wsd => wsd.name === this._selectedOrderProduct.name)
1138
+ worksheetDetail: this._getWorksheetDetails('partial').filter(wsd => wsd.actualPackQty > 0)
1134
1139
  }
1135
1140
  })
1136
1141
  }
@@ -1307,6 +1312,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1307
1312
  this._worksheetInfo.plasticPallet = this._reusablePallet.name
1308
1313
  this.updateContext()
1309
1314
  }}
1315
+ @normalPallet=${async () => this._normalPalletMode()}
1310
1316
  ></popup-reusable-pallet>
1311
1317
  `,
1312
1318
  {
@@ -1318,10 +1324,10 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1318
1324
  )
1319
1325
  }
1320
1326
 
1321
- async _woodenPalletMode() {
1327
+ async _normalPalletMode() {
1322
1328
  const result = await CustomAlert({
1323
1329
  title: i18next.t('title.are_you_sure'),
1324
- text: i18next.t('text.use_wooden_pallet'),
1330
+ text: i18next.t('text.use_normal_pallet'),
1325
1331
  confirmButton: { text: i18next.t('button.confirm') },
1326
1332
  cancelButton: { text: i18next.t('button.cancel') }
1327
1333
  })
@@ -1329,7 +1335,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1329
1335
  if (!result.value) return
1330
1336
  this._usingReusablePallet = false
1331
1337
  this._reusablePalletName = this._worksheetInfo.plasticPallet = ''
1332
- this._showToast({ message: i18next.t('text.now_using_wooden_pallet') })
1338
+ this._showToast({ message: i18next.t('text.now_using_normal_pallet') })
1333
1339
  this.updateContext()
1334
1340
  }
1335
1341
 
@@ -1355,9 +1361,11 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1355
1361
  }
1356
1362
  }
1357
1363
 
1358
- _getWorksheetDetails() {
1364
+ _getWorksheetDetails(unloadType) {
1359
1365
  return this.orderProductData.records.map(task => {
1360
- return { name: task.name, issue: task.issue ? task.issue : null }
1366
+ return unloadType == 'partial'
1367
+ ? { name: task.name, issue: task.issue ? task.issue : null, actualPackQty: task.actualPackQty }
1368
+ : { name: task.name, issue: task.issue ? task.issue : null }
1361
1369
  })
1362
1370
  }
1363
1371
 
@@ -347,7 +347,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
347
347
  <div class="button-div">
348
348
  <mwc-button
349
349
  id="button-add-products"
350
- label=${i18next.t('button.add_products')}
350
+ label=${i18next.t('button.bulk_select_products')}
351
351
  raised
352
352
  @click=${e => this._openBulkProductSelection()}
353
353
  ?disabled=${!this._showAddProducts}
@@ -140,7 +140,6 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
140
140
  .config=${this.inventoryGristConfig}
141
141
  .data=${this.inventoryData}
142
142
  @record-change="${this._onProductChangeHandler.bind(this)}"
143
- @field-change="${this._onInventoryFieldChanged.bind(this)}"
144
143
  ></data-grist>
145
144
  </div>
146
145
  </div>
@@ -223,7 +222,7 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
223
222
  if (this.active) {
224
223
  if (changes.resourceId) {
225
224
  this._reverseKittingNo = changes.resourceId
226
- } else {
225
+ } else if (!this._reverseKittingNo) {
227
226
  this._reverseKittingNo = 'new'
228
227
  }
229
228
 
@@ -379,8 +378,9 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
379
378
 
380
379
  try {
381
380
  if (changedColumn === 'qty') {
382
- this._validateQty(changeRecord.qty)
381
+ this._validateQty(changeRecord.qty, changeRecord.remainQty)
383
382
  }
383
+ this._updateQtyAndUomValue(event.detail.row, changedColumn, event.detail.before, changeRecord)
384
384
  } catch (e) {
385
385
  const beforeValue = event.detail.before && event.detail.before[event.detail.column.name]
386
386
  if (beforeValue) {
@@ -392,42 +392,18 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
392
392
  }
393
393
  }
394
394
 
395
- _onInventoryFieldChanged(e) {
396
- let columnName = e.detail.column.name
395
+ _updateQtyAndUomValue(rowIndex, columnName, initialRecord, newRecord) {
397
396
  let roundedUomValue = 0
398
397
  let qty = 0
399
398
 
400
- if (columnName == 'uomValue' || columnName == 'qty' || columnName == 'inventory') {
401
- if (columnName == 'inventory') {
402
- if (
403
- e.detail.after.remainUomValue &&
404
- e.detail.after.remainQty &&
405
- e.detail.after.remainUomValue > 0 &&
406
- e.detail.after.remainQty > 0
407
- ) {
408
- qty = e.detail.record.qty || 0
409
-
410
- roundedUomValue = qty * (e.detail.after.remainUomValue / e.detail.after.remainQty)
399
+ if (columnName == 'qty' || columnName == 'uomValue') {
400
+ if (initialRecord?.remainQty && initialRecord?.remainUomValue) {
401
+ let packageUomValue = initialRecord.remainUomValue / initialRecord.remainQty
411
402
 
412
- roundedUomValue = parseFloat(roundedUomValue.toFixed(2))
413
- }
414
- } else {
415
- let packageUomValue = e.detail.record.remainUomValue / e.detail.record.remainQty
416
- if (
417
- e.detail.record.remainUomValue &&
418
- e.detail.record.remainQty &&
419
- e.detail.record.remainUomValue > 0 &&
420
- e.detail.record.remainQty > 0
421
- ) {
422
- if (columnName === 'qty') {
423
- qty = e.detail.after || 0
424
- } else {
425
- qty = Math.round(e.detail.after / packageUomValue)
426
- }
403
+ if (columnName == 'qty') qty = newRecord.qty || 0
404
+ else qty = Math.round(newRecord.uomValue / packageUomValue)
427
405
 
428
- roundedUomValue = qty * packageUomValue
429
- roundedUomValue = parseFloat(roundedUomValue.toFixed(2))
430
- }
406
+ roundedUomValue = Math.round(qty * packageUomValue * 100) / 100
431
407
  }
432
408
  }
433
409
 
@@ -435,20 +411,16 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
435
411
  ...this.inventoryData,
436
412
  ...this.inventoryGrist.dirtyData,
437
413
  records: this.inventoryGrist.dirtyData.records.map((record, idx) => {
438
- // const factor = this._pickingStd === PICKING_STANDARD.SELECT_BY_PRODUCT.value ? e.detail.row : e.detail.record.id
439
-
440
- if ((columnName == 'uomValue' || columnName == 'qty' || columnName == 'inventory') && idx === e.detail.row) {
414
+ if (idx == rowIndex && (columnName == 'qty' || columnName == 'uomValue')) {
441
415
  if (columnName == 'uomValue') record.qty = qty
442
416
  record.uomValue = roundedUomValue
443
417
  }
444
418
 
445
- let returnObj = {
419
+ return {
446
420
  ...record,
447
421
  ...record.inventory,
448
422
  name: record.name ? record.name : idx
449
423
  }
450
-
451
- return returnObj
452
424
  })
453
425
  }
454
426
 
@@ -783,21 +755,25 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
783
755
  }
784
756
 
785
757
  checkInventoryValidity() {
786
- if (!this.inventoryGrist.dirtyData.records || !this.inventoryGrist.dirtyData.records.length) {
758
+ let records = this.inventoryGrist.dirtyData?.records
759
+
760
+ if (!records || !records.length) {
787
761
  throw new Error(i18next.t('text.there_is_no_inventory'))
788
762
  }
789
763
 
790
- if (this.inventoryGrist.dirtyData.records.some(record => !record.inventory && !record.inventory.id))
764
+ if (records.some(record => !record.inventory && !record.inventory.id))
791
765
  throw new Error(i18next.t('text.invalid_inventory'))
792
766
 
793
- if (this.inventoryGrist.dirtyData.records.some(record => !record.productCombination))
767
+ if (records.some(record => !record.productCombination))
794
768
  throw new Error(i18next.t('text.invalid_product_combination'))
795
769
 
770
+ records.forEach(record => this._validateQty(record.qty, record.remainQty))
771
+
796
772
  return true
797
773
  }
798
774
 
799
- _validateQty(qty) {
800
- if (qty <= 0) {
775
+ _validateQty(qty, remainQty) {
776
+ if (!qty || qty <= 0 || qty > remainQty) {
801
777
  throw new Error(i18next.t('text.invalid_quantity_input'))
802
778
  }
803
779
  }