@things-factory/operato-wms 4.3.159 → 4.3.161

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 (29) hide show
  1. package/client/pages/bulk-operation/bulk-operation.js +1 -1
  2. package/client/pages/bulk-operation/validate-gan-popup.js +11 -2
  3. package/client/pages/components/select-inventory-popup.js +2 -2
  4. package/client/pages/components/select-product-popup.js +19 -4
  5. package/client/pages/constants/adjustment-code.js +30 -0
  6. package/client/pages/constants/index.js +1 -0
  7. package/client/pages/constants/order.js +6 -4
  8. package/client/pages/inventory/inventory-adjustment-approval.js +73 -0
  9. package/client/pages/inventory/inventory-adjustment.js +149 -22
  10. package/client/pages/manifest/loading-manifest-detail.js +22 -13
  11. package/client/pages/order/arrival-notice/arrival-notice-detail.js +1 -0
  12. package/client/pages/order/arrival-notice/create-arrival-notice.js +25 -4
  13. package/client/pages/order/arrival-notice/edit-product-popup.js +4 -1
  14. package/client/pages/order/arrival-notice/proceed-edit-product-popup.js +5 -1
  15. package/client/pages/order/arrival-notice/view-product-changes-popup.js +3 -0
  16. package/client/pages/outbound/inventory-reassign-popup.js +30 -11
  17. package/client/pages/outbound/picking-product.js +26 -18
  18. package/client/pages/outbound/worksheet-batch-picking.js +24 -2
  19. package/client/pages/outbound/worksheet-picking.js +23 -3
  20. package/config.development.js +15 -15
  21. package/helps/release-note.ko.md +1 -1
  22. package/helps/release-note.md +1 -1
  23. package/helps/release-note.ms.md +1 -1
  24. package/helps/release-note.zh.md +1 -1
  25. package/package.json +6 -6
  26. package/translations/en.json +8 -0
  27. package/translations/ko.json +9 -1
  28. package/translations/ms.json +9 -1
  29. package/translations/zh.json +9 -1
@@ -4,22 +4,40 @@ import '@things-factory/import-ui'
4
4
  import '../components/popup-note'
5
5
  import './inventory-history-by-pallet'
6
6
  import '../inventory/serial-number-list-popup'
7
+ import '../components/select-product-popup'
7
8
 
8
9
  import gql from 'graphql-tag'
9
- import { css, html } from 'lit-element'
10
+ import {
11
+ css,
12
+ html
13
+ } from 'lit-element'
10
14
  import { connect } from 'pwa-helpers/connect-mixin'
11
15
 
12
16
  import { DirectPrinter } from '@things-factory/barcode-base'
13
- import { getCodeByName } from '@things-factory/code-base'
14
- import { i18next, localize } from '@things-factory/i18n-base'
17
+ import {
18
+ i18next,
19
+ localize
20
+ } from '@things-factory/i18n-base'
15
21
  import { openPopup } from '@things-factory/layout-base'
16
- import { client, CustomAlert, PageView, store } from '@things-factory/shell'
17
- import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
22
+ import {
23
+ client,
24
+ CustomAlert,
25
+ PageView,
26
+ store
27
+ } from '@things-factory/shell'
28
+ import {
29
+ CommonButtonStyles,
30
+ ScrollbarStyles
31
+ } from '@things-factory/styles'
18
32
  import { isMobileDevice } from '@things-factory/utils'
19
33
 
20
34
  import { fetchPageSettings } from '../../util/index'
21
-
22
- import { CARTON_LABEL_SETTING_KEY, INVENTORY_ITEM_CHANGE_TYPE, PALLET_LABEL_SETTING_KEY } from '../constants'
35
+ import {
36
+ ADJUSTMENT_CODE,
37
+ CARTON_LABEL_SETTING_KEY,
38
+ INVENTORY_ITEM_CHANGE_TYPE,
39
+ PALLET_LABEL_SETTING_KEY
40
+ } from '../constants'
23
41
 
24
42
  class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
25
43
  static get styles() {
@@ -323,6 +341,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
323
341
  { name: 'packingType', header: i18next.t('field.packing_type'), width: 200 },
324
342
  { name: 'packingSize', header: i18next.t('field.packing_size'), width: 150 },
325
343
  { name: 'uom', header: i18next.t('field.uom'), width: 150 },
344
+ { name: 'costPrice', header: i18next.t('field.unit_cost'), width: 150 },
326
345
  {
327
346
  name: 'isRequireSerialNumberScanningInbound',
328
347
  header: i18next.t('field.require_serial_number_scanning_inbound'),
@@ -479,6 +498,13 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
479
498
  sortable: true,
480
499
  width: 120
481
500
  },
501
+ {
502
+ type: 'boolean',
503
+ name: 'obsolete',
504
+ header: i18next.t('field.obsolete'),
505
+ record: { editable: false },
506
+ width: 80
507
+ },
482
508
  {
483
509
  type: 'date',
484
510
  name: 'expirationDate',
@@ -530,6 +556,42 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
530
556
  },
531
557
  width: 80
532
558
  },
559
+ {
560
+ type: 'select',
561
+ name: 'adjustmentCode',
562
+ header: i18next.t('field.adjustment_code'),
563
+ record: {
564
+ editable: true,
565
+ options: [
566
+ '',
567
+ ...Object.values(ADJUSTMENT_CODE)
568
+ .map(ac => ac.value)
569
+ .sort()
570
+ ]
571
+ },
572
+ imex: {
573
+ header: i18next.t('field.adjustment_code'),
574
+ key: 'adjustmentCode',
575
+ width: 30,
576
+ type: 'array',
577
+ arrData: Object.values(ADJUSTMENT_CODE).map(ac => {
578
+ return {
579
+ name: ac.name
580
+ }
581
+ })
582
+ },
583
+ sortable: true,
584
+ width: 200
585
+ },
586
+ {
587
+ type: 'string',
588
+ name: 'adjustmentNote',
589
+ header: i18next.t('field.adjustment_note'),
590
+ imex: { header: i18next.t('field.adjustment_note'), key: 'adjustmentNote', width: 30, type: 'string' },
591
+ record: { editable: true },
592
+ sortable: true,
593
+ width: 200
594
+ },
533
595
  {
534
596
  type: 'datetime',
535
597
  name: 'updatedAt',
@@ -574,6 +636,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
574
636
  uomValue
575
637
  manufactureDate
576
638
  serialNumbers
639
+ obsolete
577
640
  bizplace {
578
641
  id
579
642
  name
@@ -591,9 +654,11 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
591
654
  type
592
655
  isRequireSerialNumberScanningOutbound
593
656
  isRequireSerialNumberScanningInbound
657
+ costPrice
594
658
  }
595
659
  productDetail {
596
660
  id
661
+ costPrice
597
662
  }
598
663
  qty
599
664
  lockedQty
@@ -622,6 +687,8 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
622
687
  orderProductRemark
623
688
  arrivalNoticeRefNo
624
689
  arrivalNoticeNo
690
+ adjustmentCode
691
+ adjustmentNote
625
692
  }
626
693
  total
627
694
  }
@@ -649,7 +716,10 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
649
716
  expirationDate
650
717
  manufactureDate
651
718
  unitCost
719
+ adjustmentCode
720
+ adjustmentNote
652
721
  serialNumbers
722
+ obsolete
653
723
  bizplace {
654
724
  id
655
725
  name
@@ -662,9 +732,11 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
662
732
  name
663
733
  description
664
734
  productInformation
735
+ costPrice
665
736
  }
666
737
  productDetail {
667
738
  id
739
+ costPrice
668
740
  }
669
741
  qty
670
742
  lockedQty
@@ -701,6 +773,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
701
773
  ...item,
702
774
  sku: item.product.sku,
703
775
  brand: item.product.brand,
776
+ unitCost: parseFloat(item.unitCost == null ? 0: item.unitCost).toFixed(2),
704
777
  lockedQty: item.lockedQty || 0,
705
778
  remainQty: item.qty - (item.lockedQty || 0)
706
779
  }
@@ -762,7 +835,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
762
835
 
763
836
  switch (e.detail.column.name) {
764
837
  case 'batchId':
765
- if(e.detail.after == '' || e.detail.after == null || e.detail.after.toString() == NaN.toString()){
838
+ if (e.detail.after == '' || e.detail.after == null || e.detail.after.toString() == NaN.toString()) {
766
839
  item._data.records[e.detail.row].batchId = e.detail.before
767
840
  this.showToast({ level: 'error', message: i18next.t('text.invalid_batch_no') })
768
841
  }
@@ -791,7 +864,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
791
864
  }
792
865
  break
793
866
  case 'unitCost':
794
- if (e.detail.after < 0) {
867
+ if (e.detail.after < 0 || isNaN(e.detail.after)) {
795
868
  item._data.records[e.detail.row].unitCost = e.detail.before
796
869
  this.showToast({ level: 'error', message: i18next.t('text.invalid_unit_cost') })
797
870
  }
@@ -802,13 +875,30 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
802
875
  this.showToast({ message: i18next.t('text.invalid_manufacture_date') })
803
876
  }
804
877
  break
878
+ case 'adjustmentCode':
879
+ if (e.detail.after == '' || e.detail.after == null || e.detail.after.toString() == NaN.toString()) {
880
+ item._data.records[e.detail.row].adjustmentCode = e.detail.before
881
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_adjustment_code') })
882
+ }
883
+ break
884
+ case 'adjustmentNote':
885
+ if (e.detail.after == '' || e.detail.after == null || e.detail.after.toString() == NaN.toString()) {
886
+ item._data.records[e.detail.row].adjustmentNote = e.detail.before
887
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_adjustment_note') })
888
+ }
889
+ break
805
890
  case 'product':
806
891
  item._data.records[e.detail.row].uom = e.detail.after?.uom ? e.detail.after.uom : ''
807
892
  item._data.records[e.detail.row].packingType = e.detail.after?.packingType ? e.detail.after.packingType : ''
808
893
  item._data.records[e.detail.row].packingSize = e.detail.after?.packingSize ? e.detail.after.packingSize : 1
809
894
  item._data.records[e.detail.row].brand = e.detail.after?.brand ? e.detail.after.brand : ''
810
895
  item._data.records[e.detail.row].sku = e.detail.after?.sku ? e.detail.after.sku : ''
896
+
897
+ if (e.detail.before == undefined) {
898
+ item._data.records[e.detail.row].unitCost = e.detail.after?.costPrice >= 0 ? e.detail.after.costPrice : undefined
899
+ }
811
900
  break
901
+
812
902
  case 'bizplace':
813
903
  item._data.records[e.detail.row].uom = ''
814
904
  item._data.records[e.detail.row].packingType = ''
@@ -886,7 +976,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
886
976
  delete row.productUomValue
887
977
  delete row.inventoryItemCount
888
978
 
889
- if (new Date(row.expirationDate) < new Date()){
979
+ if (new Date(row.expirationDate) < new Date()) {
890
980
  throw new Error(i18next.t('text.invalid_expiration_date'))
891
981
  }
892
982
 
@@ -898,6 +988,8 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
898
988
  !row.batchId ||
899
989
  !row.qty ||
900
990
  !row.uomValue ||
991
+ !row.adjustmentCode ||
992
+ !row.adjustmentNote ||
901
993
  !row.uom ||
902
994
  row?.uom.trim() == ''
903
995
  ) {
@@ -911,7 +1003,9 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
911
1003
  (row.hasOwnProperty('uom') && row.uom?.trim() == '') ||
912
1004
  (row.hasOwnProperty('packingType') && row.packingType?.trim() == '') ||
913
1005
  (row.hasOwnProperty('unitCost') && (row.unitCost == null || row.unitCost < 0)) ||
914
- (row.hasOwnProperty('packingSize') && (row.packingSize == null || row.packingSize < 0))
1006
+ (row.hasOwnProperty('packingSize') && (row.packingSize == null || row.packingSize < 0)) ||
1007
+ (row.hasOwnProperty('adjustmentCode') && row.adjustmentCode?.trim() == '') ||
1008
+ (row.hasOwnProperty('adjustmentNote') && row.adjustmentNote?.trim() == '')
915
1009
  ) {
916
1010
  throw new Error(i18next.t('text.empty_value_in_list'))
917
1011
  }
@@ -932,7 +1026,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
932
1026
  return row
933
1027
  })
934
1028
 
935
- if (patches.length == 0){
1029
+ if (patches.length == 0) {
936
1030
  this.showToast({ message: i18next.t('text.nothing_updated') })
937
1031
  }
938
1032
 
@@ -993,11 +1087,26 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
993
1087
  if (new Date(itm?.manufactureDate) > new Date()) {
994
1088
  throw new Error(i18next.t('text.invalid_manufacture_date'))
995
1089
  }
996
- if (itm.expirationDate != null){
997
- if (new Date(itm.expirationDate) < new Date()){
998
- throw new Error(i18next.t('text.invalid_expiration_date'))
1090
+ if (itm.expirationDate != null) {
1091
+ if (new Date(itm.expirationDate) < new Date()) {
1092
+ throw new Error(i18next.t('text.invalid_expiration_date'))
999
1093
  }
1000
1094
  }
1095
+ if (
1096
+ itm?.adjustmentCode?.trim() == '' ||
1097
+ (itm?.adjustmentCode?.trim() != ADJUSTMENT_CODE.AC01.value &&
1098
+ itm?.adjustmentCode?.trim() != ADJUSTMENT_CODE.AC02.value &&
1099
+ itm?.adjustmentCode?.trim() != ADJUSTMENT_CODE.AC03.value &&
1100
+ itm?.adjustmentCode?.trim() != ADJUSTMENT_CODE.AC04.value &&
1101
+ itm?.adjustmentCode?.trim() != ADJUSTMENT_CODE.AC05.value &&
1102
+ itm?.adjustmentCode?.trim() != ADJUSTMENT_CODE.AC06.value &&
1103
+ itm?.adjustmentCode?.trim() != ADJUSTMENT_CODE.AC07.value)
1104
+ ) {
1105
+ throw new Error(i18next.t('text.invalid_adjustment_code'))
1106
+ }
1107
+ if (itm?.adjustmentNote?.trim() == '') {
1108
+ throw new Error(i18next.t('text.invalid_adjustment_note'))
1109
+ }
1001
1110
 
1002
1111
  if (itm.cuFlag == '+') {
1003
1112
  if (
@@ -1008,7 +1117,9 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1008
1117
  !itm.qty ||
1009
1118
  !itm.uomValue ||
1010
1119
  !itm.uom ||
1011
- !itm.packingType
1120
+ !itm.packingType ||
1121
+ !itm.adjustmentCode ||
1122
+ !itm.adjustmentNote
1012
1123
  ) {
1013
1124
  throw new Error(i18next.t('text.empty_value_in_list'))
1014
1125
  }
@@ -1027,14 +1138,24 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1027
1138
  itm.qty = parseInt(itm.qty)
1028
1139
  itm.packingSize = parseFloat(itm.packingSize)
1029
1140
  itm.uomValue = parseFloat(itm.uomValue)
1030
- itm.unitCost = parseFloat(itm.unitCost)
1031
1141
 
1032
- //if user repic location after import
1033
- if (itm.location.zone || itm.location.row || itm.location.column) {
1034
- delete itm.location.zone
1035
- delete itm.location.row
1036
- delete itm.location.column
1142
+ if (itm.unitCost == null && itm.unitCost != 0) {
1143
+ itm.unitCost = null
1144
+ }
1145
+ if (itm.unitCost != null) {
1146
+ itm.unitCost = parseFloat(itm.unitCost)
1147
+ if (isNaN(itm.unitCost)) {
1148
+ throw new Error(i18next.t('text.invalid_unit_cost'))
1149
+ }
1037
1150
  }
1151
+
1152
+ if (itm.unit)
1153
+ if (itm.location.zone || itm.location.row || itm.location.column) {
1154
+ //if user repic location after import
1155
+ delete itm.location.zone
1156
+ delete itm.location.row
1157
+ delete itm.location.column
1158
+ }
1038
1159
 
1039
1160
  //if user repick product after import
1040
1161
  if (itm.product.productId) {
@@ -1088,6 +1209,12 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1088
1209
  }
1089
1210
 
1090
1211
  importableData(records) {
1212
+ records.map(record => {
1213
+ if (typeof record.unitCost == 'object') {
1214
+ record.unitCost = 0
1215
+ }
1216
+ })
1217
+
1091
1218
  let columns = this.config.columns
1092
1219
  .filter(column => column.imex !== undefined)
1093
1220
  .map(column => {
@@ -9,7 +9,7 @@ import { GhostPrint } from '@operato/ghost-print'
9
9
  import { MultiColumnFormStyles } from '@things-factory/form-ui'
10
10
  import { i18next, localize } from '@things-factory/i18n-base'
11
11
  import { openPopup } from '@things-factory/layout-base'
12
- import { client, navigate, PageView, CustomAlert } from '@things-factory/shell'
12
+ import { client, CustomAlert, navigate, PageView } from '@things-factory/shell'
13
13
  import { CommonButtonStyles } from '@things-factory/styles'
14
14
  import { isMobileDevice } from '@things-factory/utils'
15
15
 
@@ -90,7 +90,7 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
90
90
  shippingGristConfig: Object,
91
91
  _manifestNo: String,
92
92
  _status: String,
93
- _removeOrders: Array,
93
+ _removePackages: Array,
94
94
  _selectedStatus: String,
95
95
  _addExpanded: Boolean
96
96
  }
@@ -248,7 +248,7 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
248
248
 
249
249
  constructor() {
250
250
  super()
251
- this._removeOrders = []
251
+ this._removePackages = []
252
252
  this._addExpanded = false
253
253
  }
254
254
 
@@ -270,7 +270,7 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
270
270
  if (this._status && this._status == MANIFEST_STATUS.CLOSED.value) return
271
271
  const newData = data.records.filter((_, idx) => idx !== rowIndex)
272
272
  this.shippingData = { ...this.shippingData, records: newData }
273
- this._removeOrders.push(record.refNo)
273
+ this._removePackages.push(record.packageName)
274
274
  this._showReset = true
275
275
  } catch (e) {}
276
276
  }
@@ -366,6 +366,7 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
366
366
  phone
367
367
  postalCode
368
368
  city
369
+ packageName
369
370
  refNo
370
371
  dispatchmentStatus
371
372
  orderStatus
@@ -387,14 +388,14 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
387
388
  shippingProvider: manifest.shippingProvider,
388
389
  records: manifest.trackingNos
389
390
  }
390
- this._removeOrders = []
391
+ this._removePackages = []
391
392
  this._showReset = false
392
393
  this.updateContext()
393
394
  }
394
395
  }
395
396
 
396
397
  async _updateManifestDetails() {
397
- if ((!this._selectedStatus || this._selectedStatus == this._status) && this._removeOrders?.length == 0) {
398
+ if ((!this._selectedStatus || this._selectedStatus == this._status) && this._removePackages?.length == 0) {
398
399
  return
399
400
  }
400
401
  const response = await client.mutate({
@@ -403,13 +404,13 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
403
404
  $manifestId: String
404
405
  $status: String
405
406
  $shippingProvider: String
406
- $removeOrders: [String!]
407
+ $removePackages: [String!]
407
408
  ) {
408
409
  updateManifest(
409
410
  manifestId: $manifestId
410
411
  status: $status
411
412
  shippingProvider: $shippingProvider
412
- removeOrders: $removeOrders
413
+ removePackages: $removePackages
413
414
  )
414
415
  }
415
416
  `,
@@ -417,7 +418,7 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
417
418
  manifestId: this.shippingData.manifestId,
418
419
  status: this._selectedStatus,
419
420
  shippingProvider: this.shippingData.shippingProvider,
420
- removeOrders: this._removeOrders
421
+ removePackages: this._removePackages
421
422
  }
422
423
  })
423
424
  if (!response.errors) {
@@ -529,11 +530,18 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
529
530
  async _checkReleaseOrderStatus() {
530
531
  const response = await client.query({
531
532
  query: gql`
532
- query releaseGood($trackingNo: String) {
533
- releaseGood(trackingNo: $trackingNo) {
533
+ query orderPackage($trackingNo: String) {
534
+ orderPackage(trackingNo: $trackingNo) {
534
535
  id
535
536
  name
536
- status
537
+ trackingNo
538
+ transporter
539
+ releaseGood {
540
+ id
541
+ name
542
+ refNo
543
+ status
544
+ }
537
545
  }
538
546
  }
539
547
  `,
@@ -541,7 +549,8 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
541
549
  })
542
550
 
543
551
  if (!response.error) {
544
- let releaseGood = response.data.releaseGood
552
+ let orderPackage = response.data.orderPackage
553
+ let releaseGood = orderPackage.releaseGood
545
554
 
546
555
  if (
547
556
  releaseGood?.status === ORDER_STATUS.CANCELLED.value ||
@@ -1016,6 +1016,7 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
1016
1016
  this.setProductGristConfig()
1017
1017
  this.productData = {
1018
1018
  records: orderProducts.map(record => {
1019
+ record.unitPrice = record.unitPrice.toFixed(2)
1019
1020
  return {
1020
1021
  ...record,
1021
1022
  productSku: record.product.sku,
@@ -719,7 +719,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
719
719
  type: 'float',
720
720
  name: 'unitPrice',
721
721
  header: i18next.t('field.unit_price'),
722
- imex: { header: i18next.t('field.unit_price'), key: 'unitPrice', width: 25, type: 'float' },
722
+ imex: { header: i18next.t('field.unit_price'), key: 'unitPrice', width: 25, type: 'string' },
723
723
  record: { editable: editable },
724
724
  sortable: true,
725
725
  width: 80
@@ -871,6 +871,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
871
871
  }
872
872
 
873
873
  if (changedColumn === 'unitPrice') {
874
+ changeRecord.unitPrice = changeRecord.unitPrice.toFixed(2)
874
875
  let unitPrice = changeRecord.unitPrice
875
876
  if (typeof unitPrice === undefined || unitPrice < 0 || isNaN(unitPrice)) {
876
877
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
@@ -1194,6 +1195,10 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1194
1195
  throw new Error(i18next.t('text.empty_value_in_list'))
1195
1196
  }
1196
1197
 
1198
+ if (records.some(({ unitPrice }) => isNaN(unitPrice))) {
1199
+ throw new Error(i18next.t('text.invalid_unit_price_not_a_number'))
1200
+ }
1201
+
1197
1202
  if (records.some(({ unitPrice }) => unitPrice < 0)) {
1198
1203
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
1199
1204
  }
@@ -1313,6 +1318,9 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1313
1318
 
1314
1319
  _getOrderProducts() {
1315
1320
  return this.productGrist.dirtyData.records.map(record => {
1321
+ if (record.unitPrice) {
1322
+ record.unitPrice = parseFloat(record.unitPrice)
1323
+ }
1316
1324
  let orderProduct = {
1317
1325
  batchId: record.batchId,
1318
1326
  batchIdRef: record?.batchIdRef ? record.batchIdRef : null,
@@ -1663,9 +1671,11 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1663
1671
  brand
1664
1672
  primaryUnit
1665
1673
  primaryValue
1674
+ costPrice
1666
1675
  }
1667
1676
  productDetail {
1668
1677
  id
1678
+ costPrice
1669
1679
  }
1670
1680
  }
1671
1681
  }
@@ -1679,10 +1689,16 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1679
1689
  if (!foundErrors) {
1680
1690
  if (!response.errors) {
1681
1691
  const data = response.data.bulkUploadValidateOrderProducts.map(item => {
1692
+ item.unitPrice =
1693
+ item.unitPrice || item.unitPrice == 0
1694
+ ? item.unitPrice
1695
+ : item.productDetail.costPrice != null
1696
+ ? item.productDetail.costPrice
1697
+ : null
1682
1698
  return {
1683
1699
  ...item,
1684
1700
  productName: item?.productName,
1685
- unitPrice: parseFloat(item.unitPrice) || '',
1701
+ unitPrice: item.unitPrice.toFixed(2) || 0,
1686
1702
  packQty: parseFloat(item.packQty) || '',
1687
1703
  palletQty: parseFloat(item.palletQty) || ''
1688
1704
  }
@@ -1708,7 +1724,6 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1708
1724
  async importHandler(patches) {
1709
1725
  try {
1710
1726
  patches.map(itm => {
1711
- itm.unitPrice = parseFloat(itm.unitPrice) || ''
1712
1727
  if (itm.manufactureDate) {
1713
1728
  let mdt = new Date(itm.manufactureDate)
1714
1729
  itm.manufactureDate =
@@ -1725,7 +1740,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1725
1740
  delete patch.cuFlag
1726
1741
  return {
1727
1742
  ...patch,
1728
- unitPrice: parseFloat(patch.unitPrice) || 0,
1743
+ unitPrice: patch.unitPrice ? parseFloat(patch.unitPrice) : null,
1729
1744
  uomValue: parseFloat(patch.uomValue) || 0,
1730
1745
  packQty: parseInt(patch.packQty) || 0,
1731
1746
  palletQty: parseInt(patch.palletQty) || 0
@@ -1749,6 +1764,12 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1749
1764
  records = records
1750
1765
  .filter(record => record.productSKU)
1751
1766
  .map(record => {
1767
+ record.unitPrice =
1768
+ record.unitPrice == null && record.unitPrice !== undefined
1769
+ ? '0.00'
1770
+ : record.unitPrice === undefined
1771
+ ? null
1772
+ : parseFloat(record.unitPrice).toFixed(2)
1752
1773
  return {
1753
1774
  ...record
1754
1775
  }
@@ -431,6 +431,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
431
431
 
432
432
  if (changedColumn === 'unitPrice') {
433
433
  let unitPrice = changeRecord.unitPrice
434
+ changeRecord.unitPrice = changeRecord.unitPrice.toFixed(2)
434
435
  if (typeof unitPrice === undefined || unitPrice < 0 || isNaN(unitPrice)) {
435
436
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
436
437
  }
@@ -644,6 +645,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
644
645
 
645
646
  _getNewOrderProducts() {
646
647
  return this.addProductGrist.dirtyData.records.map(record => {
648
+ record.unitPrice = parseFloat(record.unitPrice)
647
649
  return {
648
650
  batchId: `N/A`,
649
651
  adjustedBatchId: record.batchId,
@@ -677,6 +679,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
677
679
  let editedOrderProducts = []
678
680
  if (this.editProductGrist.dirtyData.records.some(record => record.__dirty__)) {
679
681
  this.editProductGrist.dirtyData.records.map(record => {
682
+ record.unitPrice = parseFloat(record.unitPrice)
680
683
  editedOrderProducts.push({
681
684
  id: record.id,
682
685
  adjustedBatchId: record.batchId === record.__origin__.batchId ? null : record.batchId,
@@ -690,7 +693,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
690
693
  adjustedPackQty: record.packQty == record.__origin__.packQty ? null : record.packQty,
691
694
  adjustedTotalUomValue: record.totalUomValue == record.__origin__.totalUomValue ? null : record.totalUomValue,
692
695
  manufactureDate: record?.manufactureDate ? record.manufactureDate : null,
693
- adjustedUnitPrice: record?.unitPrice ? record.__origin__.unitPrice : null,
696
+ adjustedUnitPrice: record?.unitPrice ? record.unitPrice : null,
694
697
  remark: record?.remark ? record.remark : null
695
698
  })
696
699
  })
@@ -135,6 +135,9 @@ export class ProceedEditProductPopup extends localize(i18next)(LitElement) {
135
135
  if (changedProps.has('data')) {
136
136
  this.approvedData = {
137
137
  ...this.data,
138
+ records: this.data.records.map(item => {
139
+ item.adjustedUnitPrice = item.adjustedUnitPrice.toFixed(2)
140
+ }),
138
141
  records: this.data.records.filter(
139
142
  item => item.status === ORDER_PRODUCT_STATUS.ADDED.value || item.status === ORDER_PRODUCT_STATUS.EDITED.value
140
143
  )
@@ -162,7 +165,8 @@ export class ProceedEditProductPopup extends localize(i18next)(LitElement) {
162
165
  'adjustedTotalUomValue',
163
166
  'batchIdRef',
164
167
  'adjustedBatchIdRef',
165
- 'unitPrice'
168
+ 'unitPrice',
169
+ 'adjustedUnitPrice'
166
170
  ]
167
171
  },
168
172
  pagination: { infinite: true },
@@ -100,6 +100,9 @@ export class ViewProductChangesPopup extends localize(i18next)(LitElement) {
100
100
  if (changedProps.has('data')) {
101
101
  this.productData = {
102
102
  ...this.data,
103
+ records: this.data.records.map(item => {
104
+ item.adjustedUnitPrice = item.adjustedUnitPrice.toFixed(2)
105
+ }),
103
106
  records: this.data.records.filter(
104
107
  item => item.status === ORDER_PRODUCT_STATUS.ADDED.value || item.status === ORDER_PRODUCT_STATUS.EDITED.value
105
108
  )