@things-factory/operato-wms 4.0.30 → 4.0.34

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 (33) hide show
  1. package/client/pages/bulk-operation/bulk-operation.js +25 -14
  2. package/client/pages/bulk-operation/validate-gan-popup.js +5 -4
  3. package/client/pages/bulk-operation/validate-ro-popup.js +7 -39
  4. package/client/pages/components/popup-reusable-pallet.js +145 -0
  5. package/client/pages/components/worksheet-information-popup.js +4 -1
  6. package/client/pages/inbound/unload-product.js +119 -103
  7. package/client/pages/inventory/onhand-inventory.js +1 -0
  8. package/client/pages/order/arrival-notice/arrival-notice-detail.js +16 -0
  9. package/client/pages/order/release-order/batch-picking-popup.js +1 -1
  10. package/client/pages/order/release-order/create-release-order.js +1 -1
  11. package/client/pages/order/release-order/release-extra-product-popup.js +3 -0
  12. package/client/pages/order/release-order/release-order-detail.js +4 -4
  13. package/client/pages/order/return-order/create-return-order.js +41 -52
  14. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-detail.js +2 -2
  15. package/client/pages/order/transport-order/create-delivery-order.js +4 -2
  16. package/client/pages/outbound/picking-product.js +3 -2
  17. package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +5 -1
  18. package/client/pages/report/inbound-order-details-report.js +3 -5
  19. package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +3 -3
  20. package/client/pages/vas/reverse-kitting/popup-combination-sets.js +3 -3
  21. package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +1 -1
  22. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +2 -4
  23. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js.map +1 -1
  24. package/dist-server/graphql/types/reports/inbound-order-details-report.js +2 -1
  25. package/dist-server/graphql/types/reports/inbound-order-details-report.js.map +1 -1
  26. package/package.json +65 -65
  27. package/server/graphql/resolvers/reports/inbound-order-details-report.ts +2 -4
  28. package/server/graphql/types/reports/inbound-order-details-report.ts +2 -1
  29. package/translations/en.json +14 -1
  30. package/translations/ko.json +19 -7
  31. package/translations/ms.json +20 -8
  32. package/translations/zh.json +20 -8
  33. package/client/pages/components/popup-unloading.js +0 -610
@@ -1,7 +1,7 @@
1
1
  import '@things-factory/barcode-ui'
2
2
  import '@things-factory/grist-ui'
3
3
  import '../components/popup-note'
4
- import '../components/popup-unloading'
4
+ import '../components/popup-reusable-pallet'
5
5
  import './palletizing-pallets-popup'
6
6
  import '../components/worksheet-information-popup'
7
7
  import './unloaded-inventories-popup'
@@ -21,12 +21,14 @@ import { CommonButtonStyles } from '@things-factory/styles'
21
21
  import { isMobileDevice } from '@things-factory/utils'
22
22
 
23
23
  import { fetchSettingRule } from '../../fetch-setting-value'
24
- import { ARRIVAL_NOTICE, PALLET_STATUS, RETURN_ORDER, VAS_TYPE } from '../constants'
24
+ import { ARRIVAL_NOTICE, RETURN_ORDER, VAS_TYPE } from '../constants'
25
25
 
26
26
  const AVAIL_ORDER_TYPES = { ARRIVAL_NOTICE, RETURN_ORDER }
27
27
  class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
28
28
  static get properties() {
29
29
  return {
30
+ _worksheetLoaded: Boolean,
31
+ _usingReusablePallet: Boolean,
30
32
  _bizplaceName: String,
31
33
  _cartonId: String,
32
34
  _enableProductScanning: Boolean,
@@ -36,11 +38,9 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
36
38
  _isLooseItem: Boolean,
37
39
  _isQtyChecked: Boolean,
38
40
  _isRequiredCheckExpiry: Boolean,
39
- _isReusablePallet: Boolean,
40
41
  _orderNo: String,
41
42
  _palletId: String,
42
- _reusablePalletId: Array,
43
- _reusablePalletIdData: Object,
43
+ _reusablePallet: Object,
44
44
  _scanning: Boolean,
45
45
  _selectedOrderProduct: Object,
46
46
  _selectedInventory: Object,
@@ -108,6 +108,22 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
108
108
 
109
109
  get context() {
110
110
  var actions = []
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
+ }
125
+ }
126
+
111
127
  if (this._isLooseItem) {
112
128
  actions.push({
113
129
  title: i18next.t('button.vas'),
@@ -290,6 +306,8 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
290
306
 
291
307
  constructor() {
292
308
  super()
309
+ this._worksheetLoaded = false
310
+ this._usingReusablePallet = false
293
311
  this._enableCartonLabel = false
294
312
  this._enableInputQty = true
295
313
  this._enableProductScanning = false
@@ -297,7 +315,6 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
297
315
  this._isLooseItem = false
298
316
  this._isQtyChecked = false
299
317
  this._isRequiredCheckExpiry = false
300
- this._isReusablePallet = false
301
318
  this._orderNo = ''
302
319
  this._scanning = false
303
320
  this.refOrderType = AVAIL_ORDER_TYPES.ARRIVAL_NOTICE.value
@@ -310,7 +327,8 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
310
327
  if (
311
328
  changedProps.has('_orderNo') ||
312
329
  changedProps.has('_selectedOrderProduct') ||
313
- changedProps.has('_unloadedInventories')
330
+ changedProps.has('_unloadedInventories') ||
331
+ changedProps.has('_usingReusablePallet')
314
332
  ) {
315
333
  this.updateContext()
316
334
  }
@@ -547,6 +565,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
547
565
  })
548
566
 
549
567
  if (!response.errors) {
568
+ this._worksheetLoaded = true
550
569
  const worksheetInfo = response.data.unloadingWorksheet.worksheetInfo
551
570
  const orderVasInfo = worksheetInfo.orderVas
552
571
 
@@ -648,7 +667,6 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
648
667
  if (!response.errors) {
649
668
  this._orderNo = orderNo
650
669
  const worksheetInfo = response.data.unloadingReturnWorksheet.worksheetInfo
651
- this._fillUpForm(this.infoForm, worksheetInfo)
652
670
 
653
671
  this.orderProductData = {
654
672
  records: orderBy(
@@ -766,22 +784,15 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
766
784
  }
767
785
 
768
786
  async _transactionHandler(e) {
769
- if (e.keyCode === 13) {
770
- e.preventDefault()
771
- try {
772
- if (this._enableCartonLabel) {
773
- await this._validateUnloading()
774
- if (this._enableProductScanning && !this._enableInputQty) {
775
- this._scanProductUnload()
776
- } else {
777
- this._qtyUnload()
778
- }
779
- } else {
780
- this._checkReusablePallet()
781
- }
782
- } catch (e) {
783
- this._showToast(e)
784
- }
787
+ if (e.keyCode !== 13) return
788
+ e.preventDefault()
789
+ try {
790
+ if (!this._enableCartonLabel) return this._unloadSelected()
791
+ await this._validateUnloading()
792
+ if (!(this._enableProductScanning && !this._enableInputQty)) return this._qtyUnload()
793
+ this._scanProductUnload()
794
+ } catch (e) {
795
+ this._showToast(e)
785
796
  }
786
797
  }
787
798
 
@@ -789,18 +800,6 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
789
800
  if (this._scanning === false) {
790
801
  this._scanning = true
791
802
  try {
792
- if (this._isRequiredCheckExpiry && this._expirationPeriod > 0) {
793
- let date = new Date()
794
- const acceptBefore = new Date(date.setDate(date.getDate() + this._expirationPeriod))
795
- let expiryDate = new Date(this.expDateInput.value)
796
- if (expiryDate < acceptBefore) {
797
- await CustomAlert({
798
- title: i18next.t('title.item_unloading_is_expiring_soon'),
799
- confirmButton: { text: i18next.t('button.confirm') }
800
- })
801
- }
802
- }
803
-
804
803
  const response = await client.mutate({
805
804
  mutation: gql`
806
805
  mutation scanProductUnload(
@@ -827,6 +826,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
827
826
  })
828
827
 
829
828
  if (!response.errors) {
829
+ await this._checkExpiry()
830
830
  await this._fetchProducts(this._orderNo)
831
831
  }
832
832
  } catch (e) {
@@ -839,50 +839,50 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
839
839
  }
840
840
  }
841
841
 
842
- async _qtyUnload() {
843
- if (this._scanning === false) {
844
- this._scanning = true
845
- try {
846
- if (this._isRequiredCheckExpiry && this._expirationPeriod > 0) {
847
- let date = new Date()
848
- const acceptBefore = new Date(date.setDate(date.getDate() + this._expirationPeriod))
849
- let expiryDate = new Date(this.expDateInput.value)
850
- if (expiryDate < acceptBefore) {
851
- await CustomAlert({
852
- title: i18next.t('title.item_unloading_is_expiring_soon'),
853
- confirmButton: { text: i18next.t('button.confirm') }
854
- })
855
- }
856
- }
842
+ async _checkExpiry() {
843
+ if (this._isRequiredCheckExpiry && this._expirationPeriod > 0) {
844
+ let date = new Date()
845
+ const acceptBefore = new Date(date.setDate(date.getDate() + this._expirationPeriod))
846
+ let expiryDate = new Date(this.expDateInput.value)
847
+ if (expiryDate < acceptBefore) {
848
+ await CustomAlert({
849
+ title: i18next.t('title.item_unloading_is_expiring_soon'),
850
+ confirmButton: { text: i18next.t('button.confirm') }
851
+ })
852
+ }
853
+ }
854
+ }
857
855
 
858
- const response = await client.mutate({
859
- mutation: gql`
860
- mutation unload($worksheetDetailName: String!, $inventory: InventoryPatch!, $productBarcode: String) {
861
- unload(worksheetDetailName: $worksheetDetailName, inventory: $inventory, productBarcode: $productBarcode)
862
- }
863
- `,
864
- variables: {
865
- worksheetDetailName: this._selectedOrderProduct.name,
866
- inventory: {
867
- palletId: this._enableCartonLabel ? null : this.lotInput.value.trim(),
868
- cartonId: this._enableCartonLabel ? this.cartonInput.value.trim() : null,
869
- qty: parseInt(this.actualQtyInput.value),
870
- expirationDate: this._isRequiredCheckExpiry ? this.expDateInput.value : null
871
- },
872
- productBarcode: this._enableProductScanning ? this.productBarcodeInput?.value : null
856
+ async _qtyUnload() {
857
+ if (this._scanning) return this._showToast({ message: i18next.t('text.previous_scan_is_executing') })
858
+ this._scanning = true
859
+ try {
860
+ const response = await client.mutate({
861
+ mutation: gql`
862
+ mutation unload($worksheetDetailName: String!, $inventory: InventoryPatch!, $productBarcode: String) {
863
+ unload(worksheetDetailName: $worksheetDetailName, inventory: $inventory, productBarcode: $productBarcode)
873
864
  }
874
- })
875
- if (!response.errors) {
876
- await this._fetchProducts(this._orderNo)
865
+ `,
866
+ variables: {
867
+ worksheetDetailName: this._selectedOrderProduct?.name || '',
868
+ inventory: {
869
+ palletId: this._enableCartonLabel ? null : this.lotInput.value.trim(),
870
+ cartonId: this._enableCartonLabel ? this.cartonInput.value.trim() : null,
871
+ qty: parseInt(this.actualQtyInput.value),
872
+ expirationDate: this._isRequiredCheckExpiry ? this.expDateInput.value : null,
873
+ reusablePallet: this._usingReusablePallet ? this._reusablePallet : null
874
+ },
875
+ productBarcode: this._enableProductScanning ? this.productBarcodeInput?.value : null
877
876
  }
878
- } catch (e) {
879
- this._showToast(e)
877
+ })
878
+ if (!response.errors) {
879
+ await this._checkExpiry()
880
+ await this._fetchProducts(this._orderNo)
880
881
  }
881
-
882
- this._scanning = false
883
- } else {
884
- this._showToast({ message: i18next.t('text.previous_scan_is_executing') })
882
+ } catch (e) {
883
+ this._showToast(e)
885
884
  }
885
+ this._scanning = false
886
886
  }
887
887
 
888
888
  async fetchProductDetail(gtin, productId) {
@@ -1017,7 +1017,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1017
1017
 
1018
1018
  if (this._isRequiredCheckExpiry) {
1019
1019
  if (!this.expDateInput.value) {
1020
- this._focusOnExipryDateInput()
1020
+ this._focusOnExpiryDateInput()
1021
1021
  throw new Error(i18next.t('text.expiry_date_is_empty'))
1022
1022
  }
1023
1023
  }
@@ -1045,7 +1045,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1045
1045
 
1046
1046
  if (this._isRequiredCheckExpiry) {
1047
1047
  if (!this.expDateInput.value) {
1048
- this._focusOnExipryDateInput()
1048
+ this._focusOnExpiryDateInput()
1049
1049
  throw new Error(i18next.t('text.expiry_date_is_empty'))
1050
1050
  }
1051
1051
  }
@@ -1169,7 +1169,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1169
1169
  }
1170
1170
  `,
1171
1171
  variables: {
1172
- worksheetDetailName: this._selectedOrderProduct.name,
1172
+ worksheetDetailName: this._selectedOrderProduct?.name || '',
1173
1173
  inventory: {
1174
1174
  palletId: this._enableCartonLabel ? null : this.lotInput.value.trim(),
1175
1175
  cartonId: this._enableCartonLabel ? this.cartonInput.value.trim() : null,
@@ -1248,33 +1248,13 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1248
1248
  }
1249
1249
  }
1250
1250
 
1251
- async _checkReusablePallet() {
1251
+ async _unloadSelected() {
1252
1252
  try {
1253
1253
  if (!this._selectedOrderProduct) throw new Error(i18next.t('text.target_is_not_selected'))
1254
1254
  if (!this.lotInput.value) return
1255
-
1256
- const response = await client.query({
1257
- query: gql`
1258
- query palletByStatus($name: String!, $status: String!) {
1259
- palletByStatus(name: $name, status: $status) {
1260
- id
1261
- name
1262
- }
1263
- }
1264
- `,
1265
- variables: { name: this.lotInput.value, status: PALLET_STATUS.ACTIVE.value }
1266
- })
1267
-
1268
- if (!response.errors) {
1269
- if (response.data.palletByStatus) {
1270
- this.reusablePalletIdData = response.data.palletByStatus
1271
- this._isReusablePallet = true
1272
- } else {
1273
- await this._validateUnloading()
1274
- await this._checkedLotScannedProduct()
1275
- this._qtyUnload()
1276
- }
1277
- }
1255
+ await this._validateUnloading()
1256
+ await this._checkedLotScannedProduct()
1257
+ this._qtyUnload()
1278
1258
  } catch (e) {
1279
1259
  this._showToast(e)
1280
1260
  }
@@ -1316,6 +1296,42 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1316
1296
  }
1317
1297
  )
1318
1298
  }
1299
+ _reusablePalletMode() {
1300
+ openPopup(
1301
+ html`
1302
+ <popup-reusable-pallet
1303
+ .label="${i18next.t('label.reusable_pallet_id')}"
1304
+ @submit=${async e => {
1305
+ this._usingReusablePallet = true
1306
+ this._reusablePallet = e.detail.reusablePallet
1307
+ this._worksheetInfo.plasticPallet = this._reusablePallet.name
1308
+ this.updateContext()
1309
+ }}
1310
+ ></popup-reusable-pallet>
1311
+ `,
1312
+ {
1313
+ backdrop: true,
1314
+ escapable: false,
1315
+ size: 'small',
1316
+ title: i18next.t('title.unloading_with_reusable_pallet')
1317
+ }
1318
+ )
1319
+ }
1320
+
1321
+ async _woodenPalletMode() {
1322
+ const result = await CustomAlert({
1323
+ title: i18next.t('title.are_you_sure'),
1324
+ text: i18next.t('text.use_wooden_pallet'),
1325
+ confirmButton: { text: i18next.t('button.confirm') },
1326
+ cancelButton: { text: i18next.t('button.cancel') }
1327
+ })
1328
+
1329
+ if (!result.value) return
1330
+ this._usingReusablePallet = false
1331
+ this._reusablePalletName = this._worksheetInfo.plasticPallet = ''
1332
+ this._showToast({ message: i18next.t('text.now_using_wooden_pallet') })
1333
+ this.updateContext()
1334
+ }
1319
1335
 
1320
1336
  _validateComplete() {
1321
1337
  if (this.refOrderType === AVAIL_ORDER_TYPES.ARRIVAL_NOTICE.value) {
@@ -1381,7 +1397,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1381
1397
  setTimeout(() => this.actualQtyInput.focus(), 100)
1382
1398
  }
1383
1399
 
1384
- _focusOnExipryDateInput() {
1400
+ _focusOnExpiryDateInput() {
1385
1401
  setTimeout(() => this.expDateInput.focus(), 100)
1386
1402
  }
1387
1403
 
@@ -479,6 +479,7 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
479
479
  { header: i18next.t('field.company'), key: 'bizplace_name', width: 30, type: 'string' },
480
480
  { header: i18next.t('field.sku_code'), key: 'product_sku', width: 25, type: 'string' },
481
481
  { header: i18next.t('field.product'), key: 'product_name', width: 40, type: 'string' },
482
+ { header: i18next.t('field.brand'), key: 'product_brand', width: 25, type: 'string' },
482
483
  { header: i18next.t('field.product_description'), key: 'product_description', width: 50, type: 'string' },
483
484
  { header: i18next.t('field.packing_type'), key: 'packingType', width: 20, type: 'string' },
484
485
  { header: i18next.t('field.qty'), key: 'remainQty', width: 15, type: 'string' },
@@ -836,6 +836,15 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
836
836
  status
837
837
  operationGuide
838
838
  }
839
+ purchaseOrder {
840
+ id
841
+ name
842
+ bufferLocation {
843
+ id
844
+ name
845
+ description
846
+ }
847
+ }
839
848
  }
840
849
  }
841
850
  `,
@@ -909,6 +918,13 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
909
918
 
910
919
  _fillupANForm(data) {
911
920
  this._fillupForm(this.arrivalNoticeForm, data)
921
+
922
+ if (data?.purchaseOrder?.bufferLocation) {
923
+ this.bufferLocationField.value = `${data.purchaseOrder.bufferLocation.name} ${
924
+ data.purchaseOrder.bufferLocation.description ? `(${data.purchaseOrder.bufferLocation.description})` : ''
925
+ }`
926
+ this.bufferLocationField.setAttribute('location-id', data.purchaseOrder.bufferLocation.id)
927
+ }
912
928
  }
913
929
 
914
930
  _fillupForm(form, data) {
@@ -341,7 +341,7 @@ class BatchPickingPopup extends localize(i18next)(LitElement) {
341
341
 
342
342
  const response = await client.query({
343
343
  query: gql`
344
- query mergedProductOrderInventories($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
344
+ query mergedProductOrderInventories($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
345
345
  mergedProductOrderInventories(filters: $filters, pagination: $pagination, sortings: $sortings) {
346
346
  items {
347
347
  productName
@@ -2258,7 +2258,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2258
2258
  const response = await client.query({
2259
2259
  query: gql`
2260
2260
  query bulkUploadValidateWarehousePartnersProductsQuantity(
2261
- $orderInventories: [NewOrderInventory]
2261
+ $orderInventories: [NewOrderInventory!]
2262
2262
  $partnerBizplaceId: String!
2263
2263
  ) {
2264
2264
  bulkUploadValidateWarehousePartnersProductsQuantity(
@@ -710,6 +710,9 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
710
710
  if (gristType == 'existing') {
711
711
  totalAvailableQty = beforeRecord.addableQty + beforeRecord.releaseQty
712
712
  totalAvailableUomValue = beforeRecord.addableUomValue + beforeRecord.releaseUomValue
713
+ } else {
714
+ totalAvailableQty = changeRecord.remainQty
715
+ totalAvailableUomValue = changeRecord.remainUomValue
713
716
  }
714
717
 
715
718
  try {
@@ -195,7 +195,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
195
195
  } else {
196
196
  this._warehouseTransportInput.checked = true
197
197
  this._warehouseTransport = true
198
- this._exportInput = false
198
+ this._exportInput.checked = false
199
199
  this._exportOption = false
200
200
  }
201
201
  this._validateTransport()
@@ -482,7 +482,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
482
482
  params.append('name', this._ganNo)
483
483
  actions.push({
484
484
  title: i18next.t('button.move_to_x', { state: { x: i18next.t('title.arrival_notice') } }),
485
- action: () => navigate(`arrival_notice_requests?${params.toString()}`)
485
+ action: () => navigate(`arrival_notices?${params.toString()}`)
486
486
  })
487
487
  }
488
488
 
@@ -922,8 +922,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
922
922
  status: inventoryInfo.status,
923
923
  existing: true,
924
924
  roundedUomValue: `${roundedUomValue} ${inventoryInfo.uom}`,
925
- addableQty: inventoryInfo.qty - inventoryInfo.lockedQty - inventoryInfo.releaseQty,
926
- addableUomValue: inventoryInfo.uomValue - inventoryInfo.lockedUomValue - inventoryInfo.releaseUomValue
925
+ addableQty: inventoryInfo.qty - inventoryInfo.lockedQty,
926
+ addableUomValue: inventoryInfo.uomValue - inventoryInfo.lockedUomValue
927
927
  }
928
928
  })
929
929
 
@@ -250,7 +250,6 @@ class CreateReturnOrder extends localize(i18next)(PageView) {
250
250
  .config=${this.inventoryGristConfig}
251
251
  .data=${this.inventoryData}
252
252
  @record-change="${this._onProductChangeHandler.bind(this)}"
253
- @field-change="${this._onInventoryFieldChanged.bind(this)}"
254
253
  ></data-grist>
255
254
  </div>
256
255
  </div>
@@ -575,23 +574,46 @@ class CreateReturnOrder extends localize(i18next)(PageView) {
575
574
  }
576
575
 
577
576
  //Fields Changed Handler
578
- _onInventoryFieldChanged(e) {
579
- let columnName = e.detail.column.name
580
- let roundedUomValue = e.detail.record.roundedUomValue || 0
577
+ _onProductChangeHandler(event) {
578
+ const changeRecord = event.detail.after
579
+ const changedColumn = event.detail.column.name
580
+
581
+ try {
582
+ if (changedColumn === 'returnQty') {
583
+ this._validateChangedValue(changeRecord.returnQty, changeRecord.releaseQty, 'field.qty')
584
+ } else if (changedColumn === 'returnUomValue') {
585
+ this._validateChangedValue(changeRecord.returnUomValue, changeRecord.releaseUomValue, 'field.uom_value')
586
+ }
587
+ this._updateReturnQtyAndUomValue(event.detail.row, changedColumn, event.detail.before, event.detail.after)
588
+ this._updateInventoryList()
589
+ } catch (e) {
590
+ const beforeValue = event.detail.before && event.detail.before[event.detail.column.name]
591
+ if (beforeValue) {
592
+ event.detail.after[event.detail.column.name] = beforeValue
593
+ } else {
594
+ delete event.detail.after[event.detail.column.name]
595
+ }
596
+ this._showToast(e)
597
+ }
598
+ }
599
+
600
+ _updateReturnQtyAndUomValue(rowIndex, columnName, initialRecord, newRecord) {
601
+ let roundedUomValue = 0
581
602
  let returnQty = 0
582
603
 
583
604
  if (columnName == 'returnUomValue' || columnName == 'returnQty') {
584
- let packageUomValue = e.detail.record.releaseUomValue / e.detail.record.releaseQty
585
605
  if (
586
- e.detail.record.releaseUomValue &&
587
- e.detail.record.releaseQty &&
588
- e.detail.record.releaseUomValue > 0 &&
589
- e.detail.record.releaseQty > 0
606
+ initialRecord.releaseUomValue &&
607
+ initialRecord.releaseQty &&
608
+ initialRecord.releaseUomValue > 0 &&
609
+ initialRecord.releaseQty > 0
590
610
  ) {
611
+ let packageUomValue = initialRecord.releaseUomValue / initialRecord.releaseQty
612
+
591
613
  if (columnName === 'returnQty') {
592
- returnQty = e.detail.after || 0
614
+ returnQty = newRecord.returnQty || 0
593
615
  } else {
594
- returnQty = Math.round(e.detail.after / packageUomValue)
616
+ returnQty = Math.round(newRecord.returnUomValue / packageUomValue)
595
617
  }
596
618
 
597
619
  roundedUomValue = returnQty * packageUomValue
@@ -602,59 +624,26 @@ class CreateReturnOrder extends localize(i18next)(PageView) {
602
624
  this.inventoryData = {
603
625
  ...this.inventoryGrist.dirtyData,
604
626
  records: this.inventoryGrist.dirtyData.records.map((record, idx) => {
605
- if ((columnName == 'returnUomValue' || columnName == 'returnQty') && idx === e.detail.row) {
627
+ if ((columnName == 'returnUomValue' || columnName == 'returnQty') && idx === rowIndex) {
606
628
  if (columnName == 'returnUomValue') record.returnQty = returnQty
607
629
  record.returnUomValue = roundedUomValue
608
630
  }
609
631
 
610
- let returnObj = {
632
+ return {
611
633
  ...record,
612
634
  ...record.inventory
613
635
  }
614
-
615
- return returnObj
616
636
  })
617
637
  }
618
638
  }
619
639
 
620
- _onProductChangeHandler(event) {
621
- const changeRecord = event.detail.after
622
- const changedColumn = event.detail.column.name
623
-
624
- try {
625
- if (changedColumn === 'returnQty') {
626
- this._validateReleaseQty(changeRecord.returnQty, changeRecord.releaseQty)
627
- } else if (changedColumn === 'returnUomValue') {
628
- this._validateReleaseUomValue(changeRecord.returnUomValue, changeRecord.releaseUomValue)
629
- }
630
- this._updateInventoryList()
631
- } catch (e) {
632
- const beforeValue = event.detail.before && event.detail.before[event.detail.column.name]
633
- if (beforeValue) {
634
- event.detail.after[event.detail.column.name] = beforeValue
635
- } else {
636
- delete event.detail.after[event.detail.column.name]
637
- }
638
- this._showToast(e)
639
- }
640
- }
641
-
642
640
  //Validation
643
- _validateReleaseQty(returnQty, releaseQty) {
644
- if (releaseQty === undefined) throw new Error(i18next.t('text.there_is_no_selected_items'))
645
- if (returnQty > releaseQty) {
646
- throw new Error(i18next.t('text.available_quantity_insufficient'))
647
- } else if (returnQty <= 0 || isNaN(returnQty)) {
648
- throw new Error(i18next.t('text.invalid_quantity_input'))
649
- }
650
- }
651
-
652
- _validateReleaseUomValue(returnUomValue, releaseUomValue) {
653
- if (releaseUomValue === undefined) throw new Error(i18next.t('text.there_is_no_selected_items'))
654
- if (returnUomValue > releaseUomValue) {
655
- throw new Error(i18next.t('text.available_uom_value_insufficient'))
656
- } else if (returnUomValue <= 0) {
657
- throw new Error(i18next.t('text.invalid_uom_value_input'))
641
+ _validateChangedValue(returnValue, releaseValue, fieldVariable) {
642
+ if (releaseValue === undefined) throw new Error(i18next.t('text.there_is_no_selected_items'))
643
+ if (returnValue > releaseValue) {
644
+ throw new Error(i18next.t('text.available_x_insufficient', { state: { x: i18next.t(fieldVariable) } }))
645
+ } else if (returnValue <= 0 || isNaN(returnValue)) {
646
+ throw new Error(i18next.t('text.invalid_x_input', { state: { x: i18next.t(fieldVariable) } }))
658
647
  }
659
648
  }
660
649
 
@@ -804,7 +804,7 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
804
804
 
805
805
  _getReverseKittingOrder() {
806
806
  return {
807
- orderReverseKittings: this._getReverseKittingOrderInventories(),
807
+ reverseKittingOrderInventories: this._getReverseKittingOrderInventories(),
808
808
  customerBizplaceId: this._bizplaceId
809
809
  }
810
810
  }
@@ -825,7 +825,7 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
825
825
  let result = {
826
826
  set: idx + 1,
827
827
  batchId: record.batchId,
828
- productName: record.productName,
828
+ name: record.productName,
829
829
  packingType: record.packingType,
830
830
  qty: record.qty,
831
831
  uomValue: record.uomValue
@@ -583,7 +583,7 @@ class CreateDeliveryOrder extends localize(i18next)(PageView) {
583
583
  })
584
584
  }
585
585
 
586
- const amountRelatedColumns = ['uomValue', 'uom', 'packQty']
586
+ const amountRelatedColumns = ['uomValue', 'uom', 'packQty', 'palletQty']
587
587
  if (amountRelatedColumns.indexOf(changedColumn) >= 0) {
588
588
  const calcedAmount = this._calcAmount(changedColumn, changeRecord)
589
589
  for (let key in calcedAmount) {
@@ -705,12 +705,14 @@ class CreateDeliveryOrder extends localize(i18next)(PageView) {
705
705
 
706
706
  _calcAmount(changedColumn, changeRecord) {
707
707
  let calcedRecord = {}
708
- let { uomValue, uom, packQty, releaseQty, releaseUomValue } = changeRecord
708
+ let { uomValue, uom, packQty, releaseQty, releaseUomValue, palletQty } = changeRecord
709
709
 
710
710
  if (changedColumn === 'uomValue' && (!uomValue || uomValue < 0))
711
711
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.uom_value') } }))
712
712
  if (changedColumn === 'packQty' && (!packQty || packQty < 0))
713
713
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.pack_qty') } }))
714
+ if (changedColumn === 'palletQty' && (!palletQty || palletQty < 0))
715
+ throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.pallet_qty') } }))
714
716
  if (changedColumn === 'uom' && !uom)
715
717
  throw new Error(i18next.t('text.x_is_empty', { state: { x: i18next.t('label.uom') } }))
716
718
 
@@ -1567,8 +1567,9 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1567
1567
  const { worksheetInfo, worksheetDetailInfos } = response.data.fetchAndAssignPickingTask
1568
1568
  this._bizplaceName = worksheetInfo.bizplaceName
1569
1569
  this._crossDocking = worksheetInfo.releaseGood?._crossDocking
1570
- this._orderNo = this.releaseGoodNo
1571
1570
  this.releaseGoodNo = worksheetInfo.releaseGood?.name
1571
+ this._orderNo = this.releaseGoodNo
1572
+ this._worksheetInfo = worksheetInfo
1572
1573
  this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
1573
1574
 
1574
1575
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
@@ -1653,7 +1654,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1653
1654
  }
1654
1655
 
1655
1656
  updateSelectedItemProp(selectedRecords) {
1656
- if (selectedRecords.releaseQty === selectedRecords.qty) {
1657
+ if (selectedRecords?.releaseQty === selectedRecords.qty) {
1657
1658
  this.isWholePicking = true
1658
1659
  this._selectedOrderInventory = selectedRecords
1659
1660
  } else {