@things-factory/operato-wms 4.0.9 → 4.0.13

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 (160) hide show
  1. package/client/pages/adjustment/transfer-inventory.js +368 -165
  2. package/client/pages/billing/claim-chit/claim-chit-list.js +7 -6
  3. package/client/pages/bulk-operation/bulk-operation.js +316 -0
  4. package/client/pages/bulk-operation/validate-ro-popup.js +445 -0
  5. package/client/pages/components/select-product-popup.js +15 -2
  6. package/client/pages/constants/inventory.js +1 -0
  7. package/client/pages/constants/location.js +33 -6
  8. package/client/pages/constants/order.js +10 -0
  9. package/client/pages/constants/worksheet.js +2 -2
  10. package/client/pages/inbound/inbound-worksheet.js +78 -9
  11. package/client/pages/inbound/putaway-product.js +214 -139
  12. package/client/pages/inbound/putaway-worksheet-generate-popup.js +24 -2
  13. package/client/pages/inbound/unload-product.js +149 -76
  14. package/client/pages/inbound/worksheet-putaway-return.js +22 -5
  15. package/client/pages/inbound/worksheet-putaway.js +21 -8
  16. package/client/pages/inbound/worksheet-unloading-return.js +22 -5
  17. package/client/pages/inbound/worksheet-unloading.js +8 -0
  18. package/client/pages/inventory/inventory-adjustment-approval.js +11 -19
  19. package/client/pages/inventory/inventory-adjustment.js +136 -101
  20. package/client/pages/inventory/inventory-by-product-detail.js +3 -5
  21. package/client/pages/inventory/inventory-by-product.js +8 -0
  22. package/client/pages/inventory/inventory-history-by-pallet.js +12 -5
  23. package/client/pages/inventory/inventory-history.js +14 -5
  24. package/client/pages/inventory/onhand-inventory.js +11 -2
  25. package/client/pages/inventory-check/create-cycle-count.js +12 -6
  26. package/client/pages/inventory-check/cycle-count-report.js +8 -0
  27. package/client/pages/inventory-check/inspecting-product.js +146 -80
  28. package/client/pages/inventory-check/worksheet-cycle-count.js +14 -0
  29. package/client/pages/manifest/create-loading-manifest.js +314 -0
  30. package/client/pages/manifest/dispatcher-verification-popup.js +86 -0
  31. package/client/pages/manifest/loading-manifest-detail.js +345 -0
  32. package/client/pages/manifest/loading-manifest-list.js +305 -0
  33. package/client/pages/master/location-list.js +58 -17
  34. package/client/pages/master/product/product-detail-bizplace-setting-popup.js +2 -2
  35. package/client/pages/master/product/product-details-popup.js +2 -2
  36. package/client/pages/master/product/product-list.js +5 -5
  37. package/client/pages/order/arrival-notice/arrival-notice-detail.js +134 -115
  38. package/client/pages/order/arrival-notice/arrival-notice-list.js +87 -6
  39. package/client/pages/order/arrival-notice/arrival-notice-requests.js +83 -6
  40. package/client/pages/order/arrival-notice/assign-buffer-location.js +8 -1
  41. package/client/pages/order/arrival-notice/check-arrived-notice.js +9 -1
  42. package/client/pages/order/arrival-notice/create-arrival-notice.js +38 -3
  43. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +290 -25
  44. package/client/pages/order/arrival-notice/edit-product-popup.js +36 -5
  45. package/client/pages/order/arrival-notice/receive-arrival-notice.js +8 -1
  46. package/client/pages/order/goods-received-note/received-note-list.js +138 -6
  47. package/client/pages/order/release-order/b2b/b2b-order-list.js +45 -5
  48. package/client/pages/order/release-order/b2b/b2b-order-requests.js +52 -12
  49. package/client/pages/order/release-order/b2c/b2c-order-requests.js +244 -24
  50. package/client/pages/order/release-order/bulk-print-packing-list.js +23 -0
  51. package/client/pages/order/release-order/create-release-order.js +55 -8
  52. package/client/pages/order/release-order/receive-release-order-request.js +35 -24
  53. package/client/pages/order/release-order/release-extra-product-popup.js +204 -63
  54. package/client/pages/order/release-order/release-order-detail.js +301 -74
  55. package/client/pages/order/return-order/check-return-order.js +9 -1
  56. package/client/pages/order/return-order/create-return-order.js +14 -2
  57. package/client/pages/order/return-order/receive-return-order-requests.js +9 -1
  58. package/client/pages/order/return-order/return-order-detail.js +15 -6
  59. package/client/pages/order/return-order/return-order-inventory-popup.js +7 -0
  60. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-detail.js +124 -59
  61. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-list.js +1 -6
  62. package/client/pages/order/reverse-kitting-order/reverse-kitting-pallet-label-popup.js +239 -0
  63. package/client/pages/order/transport-order/delivery-order-list.js +102 -59
  64. package/client/pages/outbound/inventory-assign-popup.js +23 -6
  65. package/client/pages/outbound/inventory-auto-assign-popup.js +22 -6
  66. package/client/pages/outbound/loading-product.js +4 -1
  67. package/client/pages/outbound/merged-outbound-worksheet.js +43 -1
  68. package/client/pages/outbound/packing-product.js +4 -1
  69. package/client/pages/outbound/packing-worksheet-list.js +39 -1
  70. package/client/pages/outbound/picking-product.js +803 -431
  71. package/client/pages/outbound/picking-replacement-popup.js +1 -1
  72. package/client/pages/outbound/serial-number-popup.js +280 -0
  73. package/client/pages/outbound/single-outbound-worksheet.js +47 -1
  74. package/client/pages/outbound/worksheet-batch-picking.js +22 -8
  75. package/client/pages/outbound/worksheet-loading.js +22 -5
  76. package/client/pages/outbound/worksheet-packing.js +8 -0
  77. package/client/pages/outbound/worksheet-picking.js +62 -8
  78. package/client/pages/outbound/worksheet-return.js +9 -1
  79. package/client/pages/outbound/worksheet-sorting.js +9 -1
  80. package/client/pages/report/custom-elccl/elccl-inventory-report.js +31 -30
  81. package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +23 -26
  82. package/client/pages/report/inventory-pallet-storage-report.js +11 -10
  83. package/client/pages/report/inventory-report.js +41 -43
  84. package/client/pages/report/inventory-summary-report.js +25 -28
  85. package/client/pages/report/product-label-report.js +401 -0
  86. package/client/pages/support/inventory-comparison.js +296 -0
  87. package/client/pages/vas/print-product-label.js +298 -132
  88. package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +38 -23
  89. package/client/pages/vas/reverse-kitting/popup-combination-sets.js +98 -15
  90. package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +129 -21
  91. package/client/pages/vas/vas-pallet-label-popup.js +5 -8
  92. package/client/route.js +28 -0
  93. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +1 -1
  94. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  95. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +64 -54
  96. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js.map +1 -1
  97. package/dist-server/graphql/resolvers/extra/add-release-good-products.js +34 -9
  98. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
  99. package/dist-server/graphql/resolvers/index.js +5 -1
  100. package/dist-server/graphql/resolvers/index.js.map +1 -1
  101. package/dist-server/graphql/resolvers/inventory-comparison/index.js +6 -0
  102. package/dist-server/graphql/resolvers/inventory-comparison/index.js.map +1 -0
  103. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js +78 -0
  104. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js.map +1 -0
  105. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  106. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  107. package/dist-server/graphql/resolvers/reports/product-label-report.js +56 -0
  108. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -0
  109. package/dist-server/graphql/resolvers/shipping-provider/index.js +6 -0
  110. package/dist-server/graphql/resolvers/shipping-provider/index.js.map +1 -0
  111. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +20 -0
  112. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +1 -0
  113. package/dist-server/graphql/types/custom/elccl/elccl-inventory-report.js +1 -1
  114. package/dist-server/graphql/types/index.js +8 -2
  115. package/dist-server/graphql/types/index.js.map +1 -1
  116. package/dist-server/graphql/types/inventory-comparison/index.js +13 -0
  117. package/dist-server/graphql/types/inventory-comparison/index.js.map +1 -0
  118. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js +14 -0
  119. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js.map +1 -0
  120. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js +18 -0
  121. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js.map +1 -0
  122. package/dist-server/graphql/types/reports/index.js +6 -1
  123. package/dist-server/graphql/types/reports/index.js.map +1 -1
  124. package/dist-server/graphql/types/reports/product-label-report-list.js +14 -0
  125. package/dist-server/graphql/types/reports/product-label-report-list.js.map +1 -0
  126. package/dist-server/graphql/types/reports/product-label-report.js +16 -0
  127. package/dist-server/graphql/types/reports/product-label-report.js.map +1 -0
  128. package/dist-server/graphql/types/shipping-provider/index.js +10 -0
  129. package/dist-server/graphql/types/shipping-provider/index.js.map +1 -0
  130. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js +13 -0
  131. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js.map +1 -0
  132. package/dist-server/graphql/types/shipping-provider/shipping-provider.js +13 -0
  133. package/dist-server/graphql/types/shipping-provider/shipping-provider.js.map +1 -0
  134. package/package.json +65 -65
  135. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +4 -2
  136. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +75 -65
  137. package/server/graphql/resolvers/extra/add-release-good-products.ts +57 -15
  138. package/server/graphql/resolvers/index.ts +5 -1
  139. package/server/graphql/resolvers/inventory-comparison/index.ts +5 -0
  140. package/server/graphql/resolvers/inventory-comparison/inventory-comparison-list.ts +99 -0
  141. package/server/graphql/resolvers/reports/index.ts +3 -1
  142. package/server/graphql/resolvers/reports/product-label-report.ts +56 -0
  143. package/server/graphql/resolvers/shipping-provider/index.ts +5 -0
  144. package/server/graphql/resolvers/shipping-provider/shipping-providers.ts +20 -0
  145. package/server/graphql/types/custom/elccl/elccl-inventory-report.ts +1 -1
  146. package/server/graphql/types/index.ts +8 -2
  147. package/server/graphql/types/inventory-comparison/index.ts +11 -0
  148. package/server/graphql/types/inventory-comparison/inventory-comparison-list.ts +8 -0
  149. package/server/graphql/types/inventory-comparison/inventory-comparison.ts +12 -0
  150. package/server/graphql/types/reports/index.ts +6 -1
  151. package/server/graphql/types/reports/product-label-report-list.ts +8 -0
  152. package/server/graphql/types/reports/product-label-report.ts +10 -0
  153. package/server/graphql/types/shipping-provider/index.ts +8 -0
  154. package/server/graphql/types/shipping-provider/shipping-provider-list.ts +7 -0
  155. package/server/graphql/types/shipping-provider/shipping-provider.ts +7 -0
  156. package/things-factory.config.js +30 -0
  157. package/translations/en.json +91 -11
  158. package/translations/ko.json +109 -11
  159. package/translations/ms.json +111 -12
  160. package/translations/zh.json +123 -26
@@ -41,8 +41,7 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
41
41
  _template: Object,
42
42
  _mimetype: String,
43
43
  _doPath: String,
44
- _bizplaceName: String,
45
- _type: String
44
+ _roType: String
46
45
  }
47
46
  }
48
47
 
@@ -247,7 +246,7 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
247
246
  </div>
248
247
 
249
248
  <label>${i18next.t('label.company')}</label>
250
- <input name="bizplaceName" value="${this._bizplaceName}" readonly />
249
+ <input name="bizplaceName" readonly />
251
250
 
252
251
  <label>${i18next.t('label.ref_no')}</label>
253
252
  <input name="refNo" readonly />
@@ -264,6 +263,15 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
264
263
  <label ?hidden="${!this._ownTransport}">${i18next.t('label.co_no')}</label>
265
264
  <input name="collectionOrderNo" ?hidden="${!this._ownTransport}" readonly />
266
265
 
266
+ <label ?hidden="${this._roType === 'b2b'}">${i18next.t('label.attention_to')}</label>
267
+ <input name="attentionTo" ?hidden="${this._roType === 'b2b'}" readonly />
268
+
269
+ <label ?hidden="${this._roType === 'b2b'}">${i18next.t('label.phone_no')}</label>
270
+ <input name="phone1" ?hidden="${this._roType === 'b2b'}" readonly />
271
+
272
+ <label ?hidden="${this._roType === 'b2b'}">${i18next.t('label.delivery_address')}</label>
273
+ <textarea name="deliveryAddress1" ?hidden="${this._roType === 'b2b'}" rows="5" readonly></textarea>
274
+
267
275
  ${this._crossDocking
268
276
  ? html`
269
277
  <label for="ganNo">${i18next.t('label.arrival_notice')}</label>
@@ -341,7 +349,6 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
341
349
  this._exportOption = false
342
350
  this._downloadable = true
343
351
  this._ownTransport = true
344
- this._bizplaceName = ''
345
352
  }
346
353
 
347
354
  get releaseOrderForm() {
@@ -393,18 +400,18 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
393
400
  header: i18next.t('field.product'),
394
401
  width: 150
395
402
  },
403
+ {
404
+ type: 'string',
405
+ name: 'productBrand',
406
+ header: i18next.t('field.brand'),
407
+ width: 100
408
+ },
396
409
  {
397
410
  type: 'string',
398
411
  name: 'packingType',
399
412
  header: i18next.t('field.packing_type'),
400
413
  width: 150
401
414
  },
402
- // {
403
- // type: 'integer',
404
- // name: 'qty',
405
- // header: i18next.t('field.available_qty'),
406
- // width: 100
407
- // },
408
415
  {
409
416
  type: 'integer',
410
417
  name: 'releaseQty',
@@ -412,12 +419,6 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
412
419
  record: { options: { min: 0 } },
413
420
  width: 100
414
421
  },
415
- // {
416
- // type: 'string',
417
- // name: 'remainUomValue',
418
- // header: i18next.t('field.available_uom_value'),
419
- // width: 100
420
- // },
421
422
  {
422
423
  type: 'string',
423
424
  name: 'releaseUomValue',
@@ -575,6 +576,9 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
575
576
  type
576
577
  ownTransport
577
578
  crossDocking
579
+ attentionTo
580
+ deliveryAddress1
581
+ phone1
578
582
  arrivalNotice {
579
583
  name
580
584
  }
@@ -597,6 +601,7 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
597
601
  product {
598
602
  id
599
603
  sku
604
+ brand
600
605
  name
601
606
  description
602
607
  }
@@ -654,6 +659,7 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
654
659
  return {
655
660
  ...inventoryInfo,
656
661
  productSKU: inventoryInfo?.product?.sku || '',
662
+ productBrand: inventoryInfo?.product?.brand || '',
657
663
  qty: inventoryInfo.qty + inventoryInfo.releaseQty,
658
664
  remainUomValue: `${inventoryInfo.uomValue + inventoryInfo.releaseUomValue} ${inventoryInfo.uom}`,
659
665
  releaseUomValue: inventoryInfo.releaseUomValue + ' ' + inventoryInfo.uom,
@@ -664,7 +670,6 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
664
670
  const orderVass = releaseOrder.orderVass
665
671
 
666
672
  this._exportOption = releaseOrder.exportOption
667
- this._bizplaceName = releaseOrder.bizplace.name
668
673
  if (this._exportOption) {
669
674
  this._ownTransport = true
670
675
  } else if (!this._exportOption) {
@@ -677,16 +682,22 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
677
682
 
678
683
  this._courierOption = releaseOrder.courierOption
679
684
  this._packingOption = releaseOrder.packingOption
685
+
686
+ await this.updateComplete
680
687
  this._status = releaseOrder.status
681
- this._type = releaseOrder?.type
688
+ this._roType = releaseOrder?.type
689
+
690
+ this._fillupRGForm({ ...releaseOrder, bizplaceName: releaseOrder.bizplace?.name })
691
+
692
+ if (shippingOrder) {
693
+ this._shippingOrder = shippingOrder
694
+ this._fillupSOForm(shippingOrder)
695
+ }
682
696
 
683
697
  if (releaseOrder && releaseOrder?.attachment) {
684
698
  this._attachments = releaseOrder && releaseOrder.attachment
685
699
  }
686
700
 
687
- this._fillupRGForm(releaseOrder)
688
- if (this._exportOption) this._fillupSOForm(shippingOrder)
689
-
690
701
  this.inventoryData = { records: orderInventories }
691
702
  this.vasData = {
692
703
  records: orderVass
@@ -798,7 +809,7 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
798
809
  })
799
810
 
800
811
  if (!response.errors) {
801
- if (this._type === 'b2b') {
812
+ if (this._roType === 'b2b') {
802
813
  navigate(`b2b_order_requests`)
803
814
  } else {
804
815
  navigate(`b2c_order_requests`)
@@ -867,7 +878,7 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
867
878
 
868
879
  if (!response.errors) {
869
880
  this._showToast({ message: i18next.t('text.release_order_has_been_cancelled') })
870
- if (this._type === 'b2b') {
881
+ if (this._roType === 'b2b') {
871
882
  navigate(`b2b_order_requests`)
872
883
  } else {
873
884
  navigate(`b2c_order_requests`)
@@ -900,7 +911,7 @@ class ReceiveReleaseOrderRequest extends connect(store)(localize(i18next)(PageVi
900
911
 
901
912
  if (!response.errors) {
902
913
  this._showToast({ message: i18next.t('text.cancellation_request_has_been_rejected') })
903
- if (this._type === 'b2b') {
914
+ if (this._roType === 'b2b') {
904
915
  navigate(`b2b_order_requests`)
905
916
  } else {
906
917
  navigate(`b2c_order_requests`)
@@ -1,11 +1,14 @@
1
- import { MultiColumnFormStyles } from '@things-factory/form-ui'
2
1
  import '@things-factory/grist-ui'
2
+
3
+ import gql from 'graphql-tag'
4
+ import { css, html, LitElement } from 'lit-element'
5
+
6
+ import { MultiColumnFormStyles } from '@things-factory/form-ui'
3
7
  import { i18next, localize } from '@things-factory/i18n-base'
4
8
  import { client, CustomAlert } from '@things-factory/shell'
5
9
  import { ScrollbarStyles } from '@things-factory/styles'
6
10
  import { isMobileDevice } from '@things-factory/utils'
7
- import gql from 'graphql-tag'
8
- import { css, html, LitElement } from 'lit-element'
11
+
9
12
  import { fetchLocationSortingRule } from '../../../fetch-location-sorting-rule'
10
13
  import {
11
14
  INVENTORY_STATUS,
@@ -118,7 +121,7 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
118
121
  .config="${this.existingInventoryGristConfig}"
119
122
  .data="${this.existingInventoryData}"
120
123
  @record-change="${this._onProductChangeHandler.bind(this)}"
121
- @field-change="${this._onInventoryFieldChanged.bind(this)}"
124
+ @field-change="${this._onExistingInventoryFieldChanged.bind(this)}"
122
125
  ></data-grist>
123
126
  </div>
124
127
 
@@ -271,8 +274,8 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
271
274
  },
272
275
  {
273
276
  type: 'integer',
274
- name: 'remainQty',
275
- header: i18next.t('field.available_qty'),
277
+ name: 'addableQty',
278
+ header: i18next.t('field.addable_qty'),
276
279
  width: 100
277
280
  },
278
281
  {
@@ -284,8 +287,8 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
284
287
  },
285
288
  {
286
289
  type: 'float',
287
- name: 'remainUomValue',
288
- header: i18next.t('field.available_uom_value'),
290
+ name: 'addableUomValue',
291
+ header: i18next.t('field.addable_uom_value'),
289
292
  width: 100
290
293
  },
291
294
  {
@@ -354,7 +357,7 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
354
357
  field: 'name'
355
358
  },
356
359
  { name: 'packingType', header: i18next.t('field.packing_type') },
357
- { name: 'remainQty', type: 'float' },
360
+ { name: 'remainQty', header: i18next.t('field.remain_qty'), type: 'float' },
358
361
  {
359
362
  name: 'remainUomValue',
360
363
  type: 'float',
@@ -362,7 +365,7 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
362
365
  },
363
366
  { name: 'batchIdRef', header: i18next.t('field.batch_no_ref') }
364
367
  ],
365
- list: { fields: ['palletId', 'product', 'batchId', 'location', 'remainUomValue', 'batchIdRef'] }
368
+ list: { fields: ['palletId', 'product', 'batchId', 'location', 'batchIdRef'] }
366
369
  }
367
370
  },
368
371
  width: 250
@@ -419,7 +422,6 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
419
422
  }
420
423
 
421
424
  resetPage() {
422
- this.initProperties()
423
425
  this._clearGristConditions()
424
426
  }
425
427
 
@@ -513,62 +515,174 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
513
515
  return date.toISOString().split('T')[0]
514
516
  }
515
517
 
518
+ _onExistingInventoryFieldChanged(e) {
519
+ let columnName = e.detail.column.name
520
+ let packageUomValue = 0
521
+
522
+ try {
523
+ if (e.details?.after && e.details?.after !== 0) {
524
+ throw new Error(i18next.t('text.invalid_form_value'))
525
+ }
526
+
527
+ const result = this._calculateQtyAndUom(
528
+ packageUomValue,
529
+ columnName,
530
+ e.detail.record.uomValue,
531
+ e.detail.record.qty,
532
+ e.detail.record.__origin__.releaseUomValue,
533
+ e.detail.record.__origin__.releaseQty,
534
+ e.detail.record.__origin__.addableUomValue,
535
+ e.detail.record.__origin__.addableQty,
536
+ e.detail.record.__origin__.remainUomValue,
537
+ e.detail.record.__origin__.remainQty,
538
+ e.detail.after
539
+ )
540
+
541
+ this.existingInventoryData = {
542
+ ...this.existingInventoryGrist.dirtyData,
543
+ records: this.existingInventoryGrist.dirtyData.records.map((record, idx) => {
544
+ if (result.releaseQty >= 0 && result.roundedUom >= 0) {
545
+ if ((columnName == 'releaseUomValue' || columnName == 'releaseQty') && idx === e.detail.row) {
546
+ if (columnName == 'releaseUomValue') {
547
+ record.releaseQty = result.releaseQty
548
+ }
549
+ record.releaseUomValue = result.roundedUom
550
+ record.addableQty = record.__origin__.releaseQty + record.__origin__.addableQty - result.releaseQty
551
+ if (record.addableQty <= 0) {
552
+ record.addableQty = 0
553
+ }
554
+ if (record.addableUomValue == 0) {
555
+ record.addableUomValue =
556
+ record.addableQty * (record.__origin__.releaseUomValue / record.__origin__.releaseQty)
557
+ } else {
558
+ if (record.addableQty == 0) {
559
+ record.addableUomValue = 0
560
+ } else {
561
+ if (e.detail.record.__origin__.releaseQty == 0 || e.detail.record.__origin__.releaseUomValue == 0) {
562
+ record.addableUomValue =
563
+ record.addableQty *
564
+ (e.detail.record.__origin__.addableUomValue / e.detail.record.__origin__.addableQty)
565
+ } else {
566
+ record.addableUomValue =
567
+ record.addableQty *
568
+ (e.detail.record.__origin__.releaseUomValue / e.detail.record.__origin__.releaseQty)
569
+ }
570
+ }
571
+ }
572
+ }
573
+ }
574
+
575
+ let returnObj = {
576
+ ...record
577
+ }
578
+
579
+ if (this._pickingStd === PICKING_STANDARD.SELECT_BY_PRODUCT.value) {
580
+ returnObj.product = {
581
+ id: record.inventory.productId,
582
+ name: record.inventory.productName
583
+ }
584
+ }
585
+
586
+ return returnObj
587
+ })
588
+ }
589
+ } catch (e) {
590
+ this._showToast(e)
591
+ }
592
+ }
593
+
594
+ _calculateQtyAndUom(
595
+ packageUom,
596
+ columnName,
597
+ detailUom,
598
+ detailQty,
599
+ originUom,
600
+ originQty,
601
+ originAddableUom,
602
+ originAddableQty,
603
+ originRemainUom,
604
+ originRemainQty,
605
+ afterValue
606
+ ) {
607
+ var releaseQty = 0
608
+ var roundedUom = 0
609
+
610
+ if (afterValue >= 0) {
611
+ if (columnName == 'releaseUomValue' || columnName == 'releaseQty') {
612
+ if (originQty) {
613
+ if (originQty == 0 || originUom == 0) {
614
+ packageUom = originAddableUom / originAddableQty
615
+ } else {
616
+ packageUom = originUom / originQty
617
+ }
618
+ } else {
619
+ packageUom = originRemainUom / originRemainQty
620
+ }
621
+
622
+ if (columnName === 'releaseQty') {
623
+ if (afterValue - originQty <= originAddableQty) {
624
+ releaseQty = afterValue || 0
625
+ } else {
626
+ releaseQty = originQty
627
+ }
628
+ } else if (columnName === 'releaseUomValue') {
629
+ if (afterValue - originUom <= originAddableUom) {
630
+ releaseQty = Math.round(afterValue / packageUom)
631
+ } else {
632
+ releaseQty = Math.round(originUom / packageUom)
633
+ }
634
+ }
635
+
636
+ roundedUom = releaseQty * packageUom
637
+ roundedUom = parseFloat(roundedUom.toFixed(2))
638
+ }
639
+ } else {
640
+ releaseQty = afterValue
641
+ roundedUom = afterValue
642
+ }
643
+
644
+ return { releaseQty, roundedUom }
645
+ }
516
646
  _onInventoryFieldChanged(e) {
517
647
  let columnName = e.detail.column.name
518
648
  let roundedUomValue = e.detail.record.roundedUomValue || 0
519
649
  let releaseQty = 0
650
+ let packageUomValue = 0
520
651
 
521
- if (columnName == 'releaseUomValue' || columnName == 'releaseQty') {
522
- let packageUomValue = e.detail.record.remainUomValue / e.detail.record.remainQty
523
- if (
524
- e.detail.record.remainUomValue &&
525
- e.detail.record.remainQty &&
526
- e.detail.record.remainUomValue > 0 &&
527
- e.detail.record.remainQty > 0
528
- ) {
529
- if (columnName === 'releaseQty') {
530
- releaseQty = e.detail.after || 0
531
- } else {
652
+ try {
653
+ if (e.detail.after == NaN) {
654
+ throw new Error(i18next.t('text.invalid_form_value'))
655
+ }
656
+ } catch (e) {
657
+ this._showToast(e)
658
+ }
659
+ if (e.detail.after >= 0) {
660
+ packageUomValue = e.detail.record.remainUomValue / e.detail.record.remainQty
661
+
662
+ if (columnName === 'releaseQty' && e.detail.after <= e.detail.record.remainQty) {
663
+ releaseQty = e.detail.after || 0
664
+ } else {
665
+ if (columnName === 'releaseUomValue' && e.detail.after <= e.detail.record.remainUomValue) {
532
666
  releaseQty = Math.round(e.detail.after / packageUomValue)
533
667
  }
534
-
535
- roundedUomValue = releaseQty * packageUomValue
536
- roundedUomValue = parseFloat(roundedUomValue.toFixed(2))
537
668
  }
669
+ roundedUomValue = releaseQty * packageUomValue
670
+ roundedUomValue = parseFloat(roundedUomValue.toFixed(2))
671
+ } else {
672
+ releaseQty = e.detail.after
673
+ roundedUomValue = e.detail.after
538
674
  }
539
675
 
540
676
  this.inventoryData = {
541
677
  ...this.inventoryGrist.dirtyData,
542
678
  records: this.inventoryGrist.dirtyData.records.map((record, idx) => {
543
- if ((columnName == 'releaseUomValue' || columnName == 'releaseQty') && idx === e.detail.row) {
544
- if (columnName == 'releaseUomValue') record.releaseQty = releaseQty
545
- record.releaseUomValue = roundedUomValue
546
- }
547
-
548
- let returnObj = {
549
- ...record,
550
- ...record.inventory
551
- }
552
-
553
- if (this._pickingStd === PICKING_STANDARD.SELECT_BY_PRODUCT.value) {
554
- returnObj.product = {
555
- id: record.inventory.productId,
556
- name: record.inventory.productName
679
+ if (releaseQty >= 0 && roundedUomValue >= 0) {
680
+ if ((columnName == 'releaseUomValue' || columnName == 'releaseQty') && idx === e.detail.row) {
681
+ record.releaseQty = releaseQty
682
+ record.releaseUomValue = roundedUomValue
557
683
  }
558
684
  }
559
685
 
560
- return returnObj
561
- })
562
- }
563
-
564
- this.existingInventoryData = {
565
- ...this.existingInventoryGrist.dirtyData,
566
- records: this.existingInventoryGrist.dirtyData.records.map((record, idx) => {
567
- if ((columnName == 'releaseUomValue' || columnName == 'releaseQty') && idx === e.detail.row) {
568
- if (columnName == 'releaseUomValue') record.releaseQty = releaseQty
569
- record.releaseUomValue = roundedUomValue
570
- }
571
-
572
686
  let returnObj = {
573
687
  ...record,
574
688
  ...record.inventory
@@ -589,12 +703,22 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
589
703
  _onProductChangeHandler(event) {
590
704
  const changeRecord = event.detail.after
591
705
  const changedColumn = event.detail.column.name
706
+ var totalAvailableQty = 0
707
+ var totalAvailableUomValue = 0
708
+
709
+ if (changeRecord.inventory.remainQty) {
710
+ totalAvailableQty = changeRecord.inventory.remainQty
711
+ totalAvailableUomValue = changeRecord.inventory.remainUomValue
712
+ } else if (event.detail.before) {
713
+ totalAvailableQty = event.detail.before.inventory.releaseQty + event.detail.before.addableQty
714
+ totalAvailableUomValue = event.detail.before.inventory.releaseUomValue + event.detail.before.addableUomValue
715
+ }
592
716
 
593
717
  try {
594
718
  if (changedColumn === 'releaseQty') {
595
- this._validateReleaseQty(changeRecord.releaseQty, changeRecord.remainQty)
719
+ this._validateReleaseQty(changeRecord.releaseQty, changeRecord.remainQty, totalAvailableQty)
596
720
  } else if (changedColumn === 'releaseUomValue') {
597
- this._validateReleaseUomValue(changeRecord.releaseUomValue, changeRecord.remainUomValue)
721
+ this._validateReleaseUomValue(changeRecord.releaseUomValue, changeRecord.remainUomValue, totalAvailableUomValue)
598
722
  }
599
723
  this._updateInventoryList()
600
724
  } catch (e) {
@@ -602,28 +726,45 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
602
726
  if (beforeValue) {
603
727
  event.detail.after[event.detail.column.name] = beforeValue
604
728
  } else {
605
- delete event.detail.after[event.detail.column.name]
729
+ event.detail.after[event.detail.column.name] = 0
606
730
  }
607
731
  this._showToast(e)
608
732
  }
609
733
  }
610
734
 
611
- _validateReleaseQty(releaseQty, remainQty) {
735
+ _validateReleaseQty(releaseQty, remainQty, totalAvailableQty) {
612
736
  if (remainQty === undefined) throw new Error(i18next.t('text.there_is_no_selected_items'))
613
- if (releaseQty > remainQty) {
614
- throw new Error(i18next.t('text.available_quantity_insufficient'))
737
+ if (totalAvailableQty) {
738
+ if (releaseQty < 0) {
739
+ throw new Error(i18next.t('text.invalid_quantity_input'))
740
+ } else if (releaseQty > totalAvailableQty) {
741
+ throw new Error(i18next.t('text.available_quantity_insufficient'))
742
+ }
743
+ } else {
744
+ if (releaseQty > remainQty) {
745
+ throw new Error(i18next.t('text.available_quantity_insufficient'))
746
+ }
615
747
  }
616
748
  }
617
749
 
618
- _validateReleaseUomValue(releaseUomValue, remainUomValue) {
750
+ _validateReleaseUomValue(releaseUomValue, remainUomValue, totalAvailableUomValue) {
619
751
  if (remainUomValue === undefined) throw new Error(i18next.t('text.there_is_no_selected_items'))
620
- if (releaseUomValue > remainUomValue) {
621
- throw new Error(i18next.t('text.available_uom_value_insufficient'))
752
+ if (totalAvailableUomValue) {
753
+ if (releaseUomValue < 0) {
754
+ throw new Error(i18next.t('text.invalid_quantity_input'))
755
+ } else if (releaseUomValue > totalAvailableUomValue) {
756
+ throw new Error(i18next.t('text.available_uom_value_insufficient'))
757
+ }
758
+ } else {
759
+ if (releaseUomValue > remainUomValue) {
760
+ throw new Error(i18next.t('text.available_uom_value_insufficient'))
761
+ }
622
762
  }
623
763
  }
624
764
 
625
765
  async _addExtraProducts() {
626
766
  try {
767
+ this._validateProducts()
627
768
  const result = await CustomAlert({
628
769
  title: i18next.t('title.are_you_sure'),
629
770
  text: i18next.t('text.add_extra_product'),
@@ -728,9 +869,9 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
728
869
  }
729
870
 
730
871
  _validateProducts() {
731
- // no records
732
- if (!this.inventoryGrist.dirtyData.records || !this.inventoryGrist.dirtyData.records.length)
733
- throw new Error(i18next.t('text.no_products'))
872
+ // // no records
873
+ // if (!this.inventoryGrist.dirtyData.records || !this.inventoryGrist.dirtyData.records.length)
874
+ // throw new Error(i18next.t('text.no_products'))
734
875
  // required field (batchId, packingType, uomValue, unit, packQty, palletQty)
735
876
  if (
736
877
  this.inventoryGrist.dirtyData.records.filter(