@things-factory/operato-wms 5.0.13 → 6.0.0-alpha.1

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 (206) hide show
  1. package/client/pages/bulk-operation/bulk-operation.js +96 -8
  2. package/client/pages/bulk-operation/validate-gan-popup.js +37 -27
  3. package/client/pages/bulk-operation/validate-ro-popup.js +40 -0
  4. package/client/pages/components/select-inventory-popup.js +633 -0
  5. package/client/pages/constants/order.js +2 -1
  6. package/client/pages/inbound/pallet-label-popup.js +2 -0
  7. package/client/pages/inbound/select-product-batch.js +7 -1
  8. package/client/pages/inbound/undo-unload-popup.js +37 -21
  9. package/client/pages/inbound/unload-product.js +147 -59
  10. package/client/pages/inbound/worksheet-putaway.js +1 -1
  11. package/client/pages/inbound/worksheet-unloading.js +11 -7
  12. package/client/pages/inventory/inventory-adjustment.js +261 -238
  13. package/client/pages/inventory/inventory-by-product-detail.js +99 -92
  14. package/client/pages/inventory/inventory-by-product.js +170 -68
  15. package/client/pages/inventory/onhand-inventory.js +10 -12
  16. package/client/pages/inventory/serial-number-list-popup.js +36 -5
  17. package/client/pages/inventory-check/inspecting-product.js +1 -1
  18. package/client/pages/manifest/create-loading-manifest.js +47 -22
  19. package/client/pages/manifest/dispatcher-verification-popup.js +24 -13
  20. package/client/pages/manifest/loading-manifest-detail.js +311 -46
  21. package/client/pages/manifest/loading-manifest-list.js +86 -13
  22. package/client/pages/order/arrival-notice/arrival-notice-detail.js +305 -52
  23. package/client/pages/order/arrival-notice/arrival-notice-list.js +20 -1
  24. package/client/pages/order/arrival-notice/create-arrival-notice.js +2 -2
  25. package/client/pages/order/goods-received-note/received-note-detail.js +187 -15
  26. package/client/pages/order/release-order/b2b/b2b-order-list.js +76 -80
  27. package/client/pages/order/release-order/b2c/b2c-order-requests.js +148 -123
  28. package/client/pages/order/release-order/batch-picking-popup.js +11 -0
  29. package/client/pages/order/release-order/create-release-order.js +762 -250
  30. package/client/pages/order/release-order/release-extra-product-popup.js +10 -3
  31. package/client/pages/order/release-order/release-order-detail.js +897 -215
  32. package/client/pages/order/transport-order/delivery-note-popup.js +1050 -107
  33. package/client/pages/order/transport-order/print-delivery-note.js +214 -33
  34. package/client/pages/order/transport-order/upload-delivery-note.js +6 -4
  35. package/client/pages/order/transport-order/view-delivery-note.js +0 -1
  36. package/client/pages/outbound/generate-worksheet-popup.js +374 -0
  37. package/client/pages/outbound/inventory-reassign-popup.js +1097 -0
  38. package/client/pages/outbound/loading-product.js +88 -78
  39. package/client/pages/outbound/merged-outbound-worksheet.js +1 -1
  40. package/client/pages/outbound/packing-product.js +193 -82
  41. package/client/pages/outbound/packing-worksheet-list.js +10 -9
  42. package/client/pages/outbound/picking-product.js +979 -905
  43. package/client/pages/outbound/route-label-popup.js +283 -191
  44. package/client/pages/outbound/serial-number-popup.js +1 -0
  45. package/client/pages/outbound/sorting-product.js +12 -12
  46. package/client/pages/outbound/worksheet-batch-picking.js +39 -5
  47. package/client/pages/outbound/worksheet-packing.js +17 -4
  48. package/client/pages/outbound/worksheet-picking.js +45 -6
  49. package/client/pages/report/inbound-serial-number-report.js +86 -9
  50. package/client/pages/report/inventory-report.js +10 -0
  51. package/client/pages/report/inventory-summary-report.js +28 -19
  52. package/client/pages/report/outbound-order-details-report.js +204 -43
  53. package/client/pages/report/outbound-serial-number-report.js +87 -9
  54. package/client/pages/report/release-inventory-report.js +503 -0
  55. package/client/route.js +5 -0
  56. package/client/util/index.js +2 -0
  57. package/client/util/page-settings.js +43 -0
  58. package/client/util/toast.js +10 -0
  59. package/dist-server/graphql/resolvers/board-setting/board-settings.js +3 -3
  60. package/dist-server/graphql/resolvers/board-setting/board-settings.js.map +1 -1
  61. package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-collection-report.js +2 -2
  62. package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-collection-report.js.map +1 -1
  63. package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-order-inventory-report.js +1 -1
  64. package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-order-inventory-report.js.map +1 -1
  65. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-pallet-detail-report.js +2 -2
  66. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-pallet-detail-report.js.map +1 -1
  67. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +9 -10
  68. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  69. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +2 -2
  70. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js.map +1 -1
  71. package/dist-server/graphql/resolvers/custom/elccl/elccl-onhand-inventory-counter.js +6 -4
  72. package/dist-server/graphql/resolvers/custom/elccl/elccl-onhand-inventory-counter.js.map +1 -1
  73. package/dist-server/graphql/resolvers/custom/kimeda/kimeda-onhand-inventory-counter.js +6 -4
  74. package/dist-server/graphql/resolvers/custom/kimeda/kimeda-onhand-inventory-counter.js.map +1 -1
  75. package/dist-server/graphql/resolvers/dashboard/arrival-notices-by-status.js +21 -10
  76. package/dist-server/graphql/resolvers/dashboard/arrival-notices-by-status.js.map +1 -1
  77. package/dist-server/graphql/resolvers/dashboard/collection-orders-by-status.js +1 -2
  78. package/dist-server/graphql/resolvers/dashboard/collection-orders-by-status.js.map +1 -1
  79. package/dist-server/graphql/resolvers/dashboard/delivery-orders-by-status.js +1 -2
  80. package/dist-server/graphql/resolvers/dashboard/delivery-orders-by-status.js.map +1 -1
  81. package/dist-server/graphql/resolvers/dashboard/index.js +2 -1
  82. package/dist-server/graphql/resolvers/dashboard/index.js.map +1 -1
  83. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js +17 -1
  84. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js.map +1 -1
  85. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +113 -75
  86. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js.map +1 -1
  87. package/dist-server/graphql/resolvers/dashboard/release-goods-by-status.js +21 -10
  88. package/dist-server/graphql/resolvers/dashboard/release-goods-by-status.js.map +1 -1
  89. package/dist-server/graphql/resolvers/dashboard/unit-inbounded-outbounded.js +56 -0
  90. package/dist-server/graphql/resolvers/dashboard/unit-inbounded-outbounded.js.map +1 -0
  91. package/dist-server/graphql/resolvers/index.js +5 -4
  92. package/dist-server/graphql/resolvers/index.js.map +1 -1
  93. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js.map +1 -1
  94. package/dist-server/graphql/resolvers/opa-menu/opa-menus.js +8 -7
  95. package/dist-server/graphql/resolvers/opa-menu/opa-menus.js.map +1 -1
  96. package/dist-server/graphql/resolvers/{extra → other}/add-release-good-products.js +59 -8
  97. package/dist-server/graphql/resolvers/other/add-release-good-products.js.map +1 -0
  98. package/dist-server/graphql/resolvers/{extra → other}/index.js +3 -1
  99. package/dist-server/graphql/resolvers/other/index.js.map +1 -0
  100. package/dist-server/graphql/resolvers/other/page-settings.js +87 -0
  101. package/dist-server/graphql/resolvers/other/page-settings.js.map +1 -0
  102. package/dist-server/graphql/resolvers/reports/costing-report.js +4 -4
  103. package/dist-server/graphql/resolvers/reports/costing-report.js.map +1 -1
  104. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +3 -3
  105. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js.map +1 -1
  106. package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js +36 -7
  107. package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js.map +1 -1
  108. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  109. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  110. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +69 -30
  111. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  112. package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js +36 -11
  113. package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js.map +1 -1
  114. package/dist-server/graphql/resolvers/reports/product-label-report.js +3 -3
  115. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -1
  116. package/dist-server/graphql/resolvers/reports/release-inventory-report.js +180 -0
  117. package/dist-server/graphql/resolvers/reports/release-inventory-report.js.map +1 -0
  118. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +2 -2
  119. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +1 -1
  120. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js +1 -1
  121. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js.map +1 -1
  122. package/dist-server/graphql/types/dashboard/index.js +1 -0
  123. package/dist-server/graphql/types/dashboard/index.js.map +1 -1
  124. package/dist-server/graphql/types/index.js +7 -2
  125. package/dist-server/graphql/types/index.js.map +1 -1
  126. package/dist-server/graphql/types/other/index.js +19 -0
  127. package/dist-server/graphql/types/other/index.js.map +1 -0
  128. package/dist-server/graphql/types/other/page-setting.js +34 -0
  129. package/dist-server/graphql/types/other/page-setting.js.map +1 -0
  130. package/dist-server/graphql/types/reports/index.js +6 -1
  131. package/dist-server/graphql/types/reports/index.js.map +1 -1
  132. package/dist-server/graphql/types/reports/outbound-order-details-report.js +17 -1
  133. package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
  134. package/dist-server/graphql/types/reports/release-inventory-report-list.js +12 -0
  135. package/dist-server/graphql/types/reports/release-inventory-report-list.js.map +1 -0
  136. package/dist-server/graphql/types/reports/release-inventory-report.js +27 -0
  137. package/dist-server/graphql/types/reports/release-inventory-report.js.map +1 -0
  138. package/dist-server/migrations/1568858861188-SeedSetting.js +5 -6
  139. package/dist-server/migrations/1568858861188-SeedSetting.js.map +1 -1
  140. package/dist-server/migrations/1623308919899-SeedLocationRecommendSetting.js +1 -1
  141. package/dist-server/migrations/1623308919899-SeedLocationRecommendSetting.js.map +1 -1
  142. package/dist-server/migrations/1623381200659-SeedStoringRule.js +1 -1
  143. package/dist-server/migrations/1623381200659-SeedStoringRule.js.map +1 -1
  144. package/dist-server/tsconfig.tsbuildinfo +1 -1
  145. package/dist-server/utils/report-query-util.js +5 -2
  146. package/dist-server/utils/report-query-util.js.map +1 -1
  147. package/helps/release-note.ko.md +8 -20
  148. package/helps/release-note.md +8 -20
  149. package/helps/release-note.ms.md +8 -20
  150. package/helps/release-note.zh.md +8 -20
  151. package/package.json +42 -42
  152. package/server/graphql/resolvers/board-setting/board-settings.ts +4 -6
  153. package/server/graphql/resolvers/custom/elccl/elccl-daily-collection-report.ts +4 -5
  154. package/server/graphql/resolvers/custom/elccl/elccl-daily-order-inventory-report.ts +9 -10
  155. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-pallet-detail-report.ts +4 -5
  156. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +17 -19
  157. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +10 -8
  158. package/server/graphql/resolvers/custom/elccl/elccl-onhand-inventory-counter.ts +9 -9
  159. package/server/graphql/resolvers/custom/kimeda/kimeda-onhand-inventory-counter.ts +9 -9
  160. package/server/graphql/resolvers/dashboard/arrival-notices-by-status.ts +23 -14
  161. package/server/graphql/resolvers/dashboard/collection-orders-by-status.ts +4 -5
  162. package/server/graphql/resolvers/dashboard/delivery-orders-by-status.ts +4 -5
  163. package/server/graphql/resolvers/dashboard/index.ts +3 -1
  164. package/server/graphql/resolvers/dashboard/inventory-expiry-monitor.ts +18 -6
  165. package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +114 -81
  166. package/server/graphql/resolvers/dashboard/release-goods-by-status.ts +23 -14
  167. package/server/graphql/resolvers/dashboard/unit-inbounded-outbounded.ts +61 -0
  168. package/server/graphql/resolvers/index.ts +5 -4
  169. package/server/graphql/resolvers/inventory-comparison/inventory-comparison-list.ts +11 -9
  170. package/server/graphql/resolvers/opa-menu/opa-menus.ts +7 -6
  171. package/server/graphql/resolvers/{extra → other}/add-release-good-products.ts +73 -12
  172. package/server/graphql/resolvers/other/index.ts +10 -0
  173. package/server/graphql/resolvers/other/page-settings.ts +105 -0
  174. package/server/graphql/resolvers/reports/costing-report.ts +8 -10
  175. package/server/graphql/resolvers/reports/inbound-order-details-report.ts +7 -9
  176. package/server/graphql/resolvers/reports/inbound-serial-number-report.ts +41 -13
  177. package/server/graphql/resolvers/reports/index.ts +3 -1
  178. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +76 -38
  179. package/server/graphql/resolvers/reports/outbound-serial-number-report.ts +42 -18
  180. package/server/graphql/resolvers/reports/product-label-report.ts +4 -6
  181. package/server/graphql/resolvers/reports/release-inventory-report.ts +201 -0
  182. package/server/graphql/resolvers/shipping-provider/shipping-providers.ts +3 -5
  183. package/server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts +10 -10
  184. package/server/graphql/types/dashboard/index.ts +1 -0
  185. package/server/graphql/types/index.ts +8 -2
  186. package/server/graphql/types/other/index.ts +19 -0
  187. package/server/graphql/types/other/page-setting.ts +33 -0
  188. package/server/graphql/types/reports/index.ts +6 -1
  189. package/server/graphql/types/reports/outbound-order-details-report.ts +17 -1
  190. package/server/graphql/types/reports/release-inventory-report-list.ts +8 -0
  191. package/server/graphql/types/reports/release-inventory-report.ts +23 -0
  192. package/server/migrations/1568858861188-SeedSetting.ts +4 -4
  193. package/server/migrations/1623308919899-SeedLocationRecommendSetting.ts +3 -2
  194. package/server/migrations/1623381200659-SeedStoringRule.ts +3 -2
  195. package/server/utils/report-query-util.ts +5 -2
  196. package/things-factory.config.js +4 -0
  197. package/translations/en.json +148 -27
  198. package/translations/ko.json +185 -105
  199. package/translations/ms.json +183 -98
  200. package/translations/zh.json +197 -112
  201. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +0 -1
  202. package/dist-server/graphql/resolvers/extra/index.js.map +0 -1
  203. package/dist-server/graphql/types/extra/index.js +0 -11
  204. package/dist-server/graphql/types/extra/index.js.map +0 -1
  205. package/server/graphql/resolvers/extra/index.ts +0 -5
  206. package/server/graphql/types/extra/index.ts +0 -7
@@ -17,6 +17,8 @@ import { client, CustomAlert, PageView, store } from '@things-factory/shell'
17
17
  import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
18
18
  import { isMobileDevice } from '@things-factory/utils'
19
19
 
20
+ import { fetchPageSettings } from '../../util/index'
21
+
20
22
  import { CARTON_LABEL_SETTING_KEY, INVENTORY_ITEM_CHANGE_TYPE, PALLET_LABEL_SETTING_KEY } from '../constants'
21
23
 
22
24
  class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
@@ -61,6 +63,10 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
61
63
  return this.shadowRoot.querySelector('search-form')
62
64
  }
63
65
 
66
+ get columns() {
67
+ return this.config.columns
68
+ }
69
+
64
70
  get context() {
65
71
  return {
66
72
  title: i18next.t('title.inventory_adjustment'),
@@ -101,6 +107,13 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
101
107
  }
102
108
  }
103
109
 
110
+ stateChanged(state) {
111
+ let palletLabelSetting = state.dashboard[PALLET_LABEL_SETTING_KEY]
112
+ let cartonLabelSetting = state.dashboard[CARTON_LABEL_SETTING_KEY]
113
+ this._palletLabel = (palletLabelSetting && palletLabelSetting.board) || {}
114
+ this._cartonLabel = (cartonLabelSetting && cartonLabelSetting.board) || {}
115
+ }
116
+
104
117
  render() {
105
118
  return html`
106
119
  <search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
@@ -116,11 +129,16 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
116
129
  }
117
130
 
118
131
  async pageInitialized() {
119
- let [partners, packingType, uom] = await Promise.all([
120
- this._fetchPartners(),
121
- getCodeByName('PACKING_TYPES'),
122
- getCodeByName('UOM')
123
- ])
132
+ //fetch all page setting in 1 action
133
+ let pageSettings = await fetchPageSettings({
134
+ codes: [{ name: 'name', operator: 'in', value: ['PACKING_TYPES', 'UOM'] }],
135
+ partners: []
136
+ })
137
+ let [partners, packingType, uom] = [
138
+ pageSettings.partners || [],
139
+ (packingType = pageSettings.codes?.find(x => (x.name = 'PACKING_TYPES')).settingDetails || []),
140
+ (uom = pageSettings.codes?.find(x => (x.name = 'UOM')).settingDetails || [])
141
+ ]
124
142
 
125
143
  this._searchFields = [
126
144
  {
@@ -147,7 +165,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
147
165
  },
148
166
  {
149
167
  label: i18next.t('field.product_info'),
150
- name: 'product_info',
168
+ name: 'productInfo',
151
169
  type: 'text',
152
170
  props: { searchOper: 'eq' }
153
171
  },
@@ -217,6 +235,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
217
235
  handlers: { click: this.setProductRefCondition.bind(this) },
218
236
  selectable: { multiple: true }
219
237
  },
238
+ pagination: { limit: 50, pages: [50, 100, 200, 500] },
220
239
  columns: [
221
240
  { type: 'gutter', gutterName: 'sequence' },
222
241
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
@@ -383,7 +402,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
383
402
  sortable: false,
384
403
  handlers: {
385
404
  click: (columns, data, column, record, rowIndex) => {
386
- if (record.qty > 0) this._openSerialNumberPopup(record, rowIndex, data.records)
405
+ if (record.qty > 0) this.openSerialNumberPopup(record, rowIndex, data.records)
387
406
  }
388
407
  },
389
408
  width: 80
@@ -397,7 +416,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
397
416
  },
398
417
  {
399
418
  type: 'number',
400
- name: 'remainingQty',
419
+ name: 'remainQty',
401
420
  header: i18next.t('field.remain_qty'),
402
421
  sortable: false,
403
422
  width: 80
@@ -420,7 +439,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
420
439
  type: 'code',
421
440
  name: 'uom',
422
441
  header: i18next.t('field.uom'),
423
- record: { editable: true, codeName: 'WEIGHT_UNITS' },
442
+ record: { editable: true, codeName: 'UOM' },
424
443
  imex: { header: i18next.t('field.uom'), key: 'uom', width: 25, type: 'array', arrData: uom },
425
444
  sortable: true,
426
445
  width: 80
@@ -523,77 +542,142 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
523
542
  }
524
543
  }
525
544
 
526
- async fetchHandler({ page, limit, sorters = [] }) {
545
+ // Combined export and grist fetch in single function
546
+ async fetchHandler({ page, limit, sorters = [] }, exportItem = false) {
527
547
  const filters = await this.searchForm.getQueryFilters()
528
- const response = await client.query({
529
- query: gql`
530
- query inventories($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
531
- inventories(filters: $filters, pagination: $pagination, sortings: $sortings) {
532
- items {
533
- id
534
- palletId
535
- cartonId
536
- batchId
537
- batchIdRef
538
- packingType
539
- packingSize
540
- uom
541
- uomValue
542
- manufactureDate
543
- serialNumbers
544
- bizplace {
545
- id
546
- name
547
- description
548
- }
549
- product {
550
- id
551
- name
552
- sku
553
- productInformation
554
- brand
555
- auxUnit1
556
- auxValue1
557
- description
558
- type
559
- isRequireSerialNumberScanningOutbound
560
- isRequireSerialNumberScanningInbound
561
- }
562
- qty
563
- remainQty
564
- warehouse {
565
- id
566
- name
567
- description
568
- }
569
- zone
570
- location {
571
- id
572
- name
573
- description
548
+
549
+ const query =
550
+ exportItem == false
551
+ ? gql`
552
+ query inventories(
553
+ $filters: [Filter!]
554
+ $pagination: Pagination
555
+ $sortings: [Sorting!]
556
+ $exportItem: Boolean
557
+ ) {
558
+ inventories(filters: $filters, pagination: $pagination, sortings: $sortings, exportItem: $exportItem) {
559
+ items {
560
+ id
561
+ palletId
562
+ cartonId
563
+ batchId
564
+ batchIdRef
565
+ packingType
566
+ packingSize
567
+ uom
568
+ uomValue
569
+ manufactureDate
570
+ serialNumbers
571
+ bizplace {
572
+ id
573
+ name
574
+ description
575
+ }
576
+ product {
577
+ id
578
+ name
579
+ sku
580
+ productInformation
581
+ brand
582
+ auxUnit1
583
+ auxValue1
584
+ description
585
+ type
586
+ isRequireSerialNumberScanningOutbound
587
+ isRequireSerialNumberScanningInbound
588
+ }
589
+ qty
590
+ lockedQty
591
+ warehouse {
592
+ id
593
+ name
594
+ description
595
+ }
596
+ zone
597
+ location {
598
+ id
599
+ name
600
+ description
601
+ }
602
+ createdAt
603
+ updatedAt
604
+ updater {
605
+ name
606
+ description
607
+ }
608
+ remark
609
+ expirationDate
610
+ unitCost
611
+ inventoryItemCount
612
+ purchaseOrderNo
613
+ }
614
+ total
574
615
  }
575
- createdAt
576
- updatedAt
577
- updater {
578
- name
579
- description
616
+ }
617
+ `
618
+ : gql`
619
+ query inventories(
620
+ $filters: [Filter!]!
621
+ $pagination: Pagination
622
+ $sortings: [Sorting!]!
623
+ $exportItem: Boolean
624
+ ) {
625
+ inventories(filters: $filters, pagination: $pagination, sortings: $sortings, exportItem: $exportItem) {
626
+ items {
627
+ id
628
+ palletId
629
+ cartonId
630
+ batchId
631
+ batchIdRef
632
+ packingType
633
+ packingSize
634
+ uom
635
+ uomValue
636
+ remark
637
+ expirationDate
638
+ manufactureDate
639
+ unitCost
640
+ serialNumbers
641
+ bizplace {
642
+ id
643
+ name
644
+ description
645
+ }
646
+ product {
647
+ id
648
+ sku
649
+ brand
650
+ name
651
+ description
652
+ productInformation
653
+ }
654
+ qty
655
+ lockedQty
656
+ warehouse {
657
+ id
658
+ name
659
+ description
660
+ }
661
+ zone
662
+ location {
663
+ id
664
+ name
665
+ description
666
+ }
667
+ updatedAt
668
+ }
669
+ total
580
670
  }
581
- remark
582
- expirationDate
583
- unitCost
584
- inventoryItemCount
585
- purchaseOrderNo
586
- orderProductRemark
587
- arrivalNoticeRefNo
588
671
  }
589
- total
590
- }
591
- }
592
- `,
672
+ `
673
+
674
+ const response = await client.query({
675
+ query,
593
676
  variables: {
594
677
  filters: [...filters, { name: 'status', operator: 'eq', value: 'STORED' }],
595
678
  pagination: { page, limit },
596
- sortings: sorters
679
+ sortings: sorters,
680
+ exportItem: exportItem
597
681
  }
598
682
  })
599
683
 
@@ -602,97 +686,18 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
602
686
  ...item,
603
687
  sku: item.product.sku,
604
688
  brand: item.product.brand,
605
- lockedQty: item.qty - item.remainQty,
606
- remainingQty: item.remainQty
689
+ lockedQty: item.lockedQty || 0,
690
+ remainQty: item.qty - (item.lockedQty || 0)
607
691
  }
608
692
  })
609
693
 
610
- return {
611
- total: response.data.inventories.total || 0,
612
- records: response.data.inventories.items || []
613
- }
614
- }
615
-
616
- async fetchInventoriesForExport() {
617
- const filters = await this.searchForm.getQueryFilters()
618
- const response = await client.query({
619
- query: gql`
620
- query inventoriesForExport($filters: [Filter!]!, $pagination: Pagination, $sortings: [Sorting!]!) {
621
- inventoriesForExport(filters: $filters, pagination: $pagination, sortings: $sortings) {
622
- items {
623
- id
624
- palletId
625
- cartonId
626
- batchId
627
- batchIdRef
628
- packingType
629
- packingSize
630
- uom
631
- uomValue
632
- remark
633
- expirationDate
634
- manufactureDate
635
- unitCost
636
- serialNumbers
637
- bizplace {
638
- id
639
- name
640
- description
641
- }
642
- product {
643
- id
644
- sku
645
- brand
646
- name
647
- description
648
- productInformation
649
- }
650
- qty
651
- warehouse {
652
- id
653
- name
654
- description
655
- }
656
- zone
657
- location {
658
- id
659
- name
660
- description
661
- }
662
- updatedAt
663
- }
664
- total
665
- }
666
- }
667
- `,
668
- variables: {
669
- filters: [...filters, { name: 'status', operator: 'eq', value: 'STORED' }],
670
- pagination: { page: 1, limit: 9999999 },
671
- sortings: []
694
+ if (exportItem == false) {
695
+ return {
696
+ total: response.data.inventories.total || 0,
697
+ records: response.data.inventories.items || []
672
698
  }
673
- })
674
-
675
- return response.data.inventoriesForExport.items || []
676
- }
677
-
678
- async _fetchPartners(filters = []) {
679
- const response = await client.query({
680
- query: gql`
681
- query partnersBizplaces($filters: [Filter!]) {
682
- partnersBizplaces(filters: $filters) {
683
- items {
684
- id
685
- name
686
- description
687
- }
688
- }
689
- }
690
- `,
691
- variables: { filters }
692
- })
693
-
694
- if (!response.errors) {
695
- return response.data.partnersBizplaces.items
699
+ } else {
700
+ return response.data.inventories.items || []
696
701
  }
697
702
  }
698
703
 
@@ -735,7 +740,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
735
740
  item._data.records[e.detail.row].lockedQty > 0 &&
736
741
  (e.detail.column.name == 'batchId' || e.detail.column.name == 'product' || e.detail.column.name == 'bizplace')
737
742
  ) {
738
- this._showToast({ level: 'error', message: i18next.t('text.there_is_release_qty_no_amendment_is_allowed') })
743
+ this.showToast({ level: 'error', message: i18next.t('text.there_is_release_qty_no_amendment_is_allowed') })
739
744
  item._data.records[e.detail.row][e.detail.column.name] = e.detail.before
740
745
  return
741
746
  }
@@ -743,45 +748,54 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
743
748
  switch (e.detail.column.name) {
744
749
  case 'uomValue':
745
750
  if (e.detail.after < 0 || e.detail.after.toString() == NaN.toString()) {
746
- item._data.records[e.detail.row].uomValue = 0
747
- this._showToast({ level: 'error', message: i18next.t('text.invalid_uom_value') })
751
+ item._data.records[e.detail.row].uomValue = e.detail.before
752
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_uom_value') })
748
753
  }
749
754
  break
750
755
  case 'qty':
751
756
  if (e.detail.after < 0 || !Number.isInteger(e.detail.after)) {
752
- this._showToast({ level: 'error', message: i18next.t('text.invalid_qty') })
757
+ item._data.records[e.detail.row].qty = e.detail.before
758
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_qty') })
759
+ }
760
+ break
761
+ case 'packingType':
762
+ if (e.detail.after.trim() == '') {
763
+ item._data.records[e.detail.row].packingType = e.detail.before
764
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_packing_type') })
765
+ }
766
+ break
767
+ case 'packingSize':
768
+ if (e.detail.after < 0 || !Number.isInteger(e.detail.after)) {
769
+ item._data.records[e.detail.row].packingSize = e.detail.before
770
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_packing_size') })
753
771
  }
754
772
  break
755
773
  case 'unitCost':
756
- if (e.detail.after < 0) item._data.records[e.detail.row].unitCost = e.detail.before
774
+ if (e.detail.after < 0) {
775
+ item._data.records[e.detail.row].unitCost = e.detail.before
776
+ this.showToast({ level: 'error', message: i18next.t('text.invalid_unit_cost') })
777
+ }
757
778
  break
758
779
  case 'manufactureDate':
759
- if (new Date(e.detail.after) > new Date()) item._data.records[e.detail.row].manufactureDate = e.detail.before
780
+ if (new Date(e.detail.after) > new Date()) {
781
+ item._data.records[e.detail.row].manufactureDate = e.detail.before
782
+ this.showToast({ message: i18next.t('text.invalid_manufacture_date') })
783
+ }
760
784
  break
761
785
  case 'product':
762
786
  item._data.records[e.detail.row].uom = e.detail.after?.uom ? e.detail.after.uom : ''
763
-
764
787
  item._data.records[e.detail.row].packingType = e.detail.after?.packingType ? e.detail.after.packingType : ''
765
-
766
788
  item._data.records[e.detail.row].packingSize = e.detail.after?.packingSize ? e.detail.after.packingSize : 1
767
-
768
789
  item._data.records[e.detail.row].brand = e.detail.after?.brand ? e.detail.after.brand : ''
769
-
770
790
  item._data.records[e.detail.row].sku = e.detail.after?.sku ? e.detail.after.sku : ''
771
791
  break
772
792
  case 'bizplace':
773
793
  item._data.records[e.detail.row].uom = ''
774
-
775
794
  item._data.records[e.detail.row].packingType = ''
776
-
777
795
  item._data.records[e.detail.row].packingSize = 1
778
-
779
796
  item._data.records[e.detail.row].brand = ''
780
-
781
797
  item._data.records[e.detail.row].sku = ''
782
-
783
798
  item._data.records[e.detail.row].qty = e.detail.record.qty
784
-
785
799
  item._data.records[e.detail.row].uomValue = e.detail.record.uomValue
786
800
  break
787
801
  default:
@@ -802,24 +816,30 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
802
816
  async missingStock() {
803
817
  const selectOrderInventory = this.dataGrist.selected
804
818
 
805
- const patchesArr = [...selectOrderInventory]
806
-
807
- const patches = patchesArr.map(p => {
808
- return {
809
- palletId: p.palletId,
810
- transactionType: 'MISSING'
819
+ try {
820
+ if (selectOrderInventory.length <= 0) {
821
+ this.showToast({
822
+ type: 'error',
823
+ message: `${i18next.t('text.no_record_selected')}`
824
+ })
825
+ throw new Error(`${i18next.t('text.no_record_selected')}`)
811
826
  }
812
- })
813
827
 
814
- const result = await CustomAlert({
815
- title: i18next.t('title.are_you_sure'),
816
- text: i18next.t('text.do_you_want_to_mark_it_as_missing'),
817
- confirmButton: { text: i18next.t('button.confirm') },
818
- cancelButton: { text: i18next.t('button.cancel') }
819
- })
828
+ const patches = selectOrderInventory.map(p => {
829
+ return {
830
+ palletId: p.palletId,
831
+ transactionType: 'MISSING'
832
+ }
833
+ })
834
+
835
+ const result = await CustomAlert({
836
+ title: i18next.t('title.are_you_sure'),
837
+ text: i18next.t('text.do_you_want_to_mark_it_as_missing'),
838
+ confirmButton: { text: i18next.t('button.confirm') },
839
+ cancelButton: { text: i18next.t('button.cancel') }
840
+ })
820
841
 
821
- if (result.isConfirmed) {
822
- try {
842
+ if (result.isConfirmed) {
823
843
  const response = await client.mutate({
824
844
  mutation: gql`
825
845
  mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
@@ -830,12 +850,12 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
830
850
  })
831
851
 
832
852
  if (!response.error) {
833
- this._showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
853
+ this.showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
834
854
  this.updateContext()
835
855
  }
836
- } catch (error) {
837
- throw new Error(error)
838
856
  }
857
+ } catch (error) {
858
+ throw new Error(error)
839
859
  }
840
860
  }
841
861
 
@@ -845,33 +865,43 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
845
865
  patches = patches.map(row => {
846
866
  delete row.productUomValue
847
867
  delete row.inventoryItemCount
868
+
848
869
  if (row.cuFlag == '+') {
849
- if (!row.bizplace || !row.location || !row.product || !row.batchId || !row.qty || !row.uomValue) {
870
+ if (
871
+ !row.bizplace ||
872
+ !row.location ||
873
+ !row.product ||
874
+ !row.batchId ||
875
+ !row.qty ||
876
+ !row.uomValue ||
877
+ !row.uom ||
878
+ row?.uom.trim() == ''
879
+ ) {
850
880
  throw new Error(i18next.t('text.empty_value_in_list'))
851
881
  }
852
882
  }
853
883
 
854
- if (row.cuFlag == 'M' && row.bizplace) {
855
- if (!row.product) {
884
+ if (row.cuFlag == 'M') {
885
+ if (
886
+ (row.hasOwnProperty('bizplace') && !row.product) ||
887
+ (row.hasOwnProperty('uom') && row.uom?.trim() == '') ||
888
+ (row.hasOwnProperty('packingType') && row.packingType?.trim() == '') ||
889
+ (row.hasOwnProperty('unitCost') && (row.unitCost == null || row.unitCost < 0)) ||
890
+ (row.hasOwnProperty('packingSize') && (row.packingSize == null || row.packingSize < 0))
891
+ ) {
856
892
  throw new Error(i18next.t('text.empty_value_in_list'))
857
893
  }
858
894
  }
859
895
 
860
- if (row.bizplace) {
861
- row.bizplace = { id: row.bizplace.id }
862
- }
863
- if (row.location) {
864
- row.location = { id: row.location.id }
865
- }
866
- if (row.product) {
867
- row.product = { id: row.product.productId }
868
- }
869
- if (row.uomValue) {
870
- row.uomValue = parseFloat(row.uomValue)
871
- }
896
+ row.bizplace = row.bizplace ? { id: row.bizplace.id } : undefined
897
+ row.location = row.location ? { id: row.location.id } : undefined
898
+ row.product = row.product ? { id: row.product.productId } : undefined
899
+ row.uomValue = row.uomValue ? parseFloat(row.uomValue) : undefined
900
+ row.unitCost = row.unitCost ? parseFloat(row.unitCost) : undefined
901
+ row.packingSize = row.packingSize ? parseInt(row.packingSize) : undefined
902
+
872
903
  if (row?.inventoryItemChanges) {
873
904
  row.inventoryItemChangesJson = row.inventoryItemChanges
874
-
875
905
  delete row.inventoryItemChanges
876
906
  }
877
907
  return row
@@ -899,24 +929,20 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
899
929
 
900
930
  if (!response.errors) {
901
931
  this.dataGrist.fetch()
902
- this._showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
932
+ this.showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
903
933
  }
904
934
  } else {
905
- this._showToast({
935
+ this.showToast({
906
936
  type: 'error',
907
937
  message: `${i18next.t('text.complete_the_picking_process_before_adjust_the_batch_number')}`
908
938
  })
909
939
  }
910
940
  }
911
941
  } catch (e) {
912
- this._showToast(e)
942
+ this.showToast(e)
913
943
  }
914
944
  }
915
945
 
916
- get columns() {
917
- return this.config.columns
918
- }
919
-
920
946
  async importHandler(patches) {
921
947
  try {
922
948
  patches.map(itm => {
@@ -938,7 +964,10 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
938
964
  throw new Error(i18next.t('text.invalid_value_in_list'))
939
965
  }
940
966
 
941
- if (itm.manufactureYear && itm.manufactureYear < 1000) {
967
+ if (
968
+ itm.manufactureDate &&
969
+ (itm.manufactureDate.getFullYear < 1000 || itm.manufactureDate.getTime > new Date().getTime)
970
+ ) {
942
971
  throw new Error(i18next.t('text.invalid_value_in_list'))
943
972
  }
944
973
  }
@@ -994,10 +1023,10 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
994
1023
  if (!response.errors) {
995
1024
  history.back()
996
1025
  this.dataGrist.fetch()
997
- this._showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
1026
+ this.showToast({ message: i18next.t('text.data_inventory_adjustment_has_been_submitted_for_approval') })
998
1027
  }
999
1028
  } catch (e) {
1000
- this._showToast(e)
1029
+ this.showToast(e)
1001
1030
  }
1002
1031
  }
1003
1032
 
@@ -1055,7 +1084,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1055
1084
  if (this.dataGrist.selected && this.dataGrist.selected.length > 0) {
1056
1085
  data = this.dataGrist.selected
1057
1086
  } else {
1058
- data = await this.fetchInventoriesForExport()
1087
+ data = await this.fetchHandler({}, true)
1059
1088
  }
1060
1089
 
1061
1090
  let [products, bizplaces, locations] = await Promise.all([
@@ -1107,17 +1136,10 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1107
1136
 
1108
1137
  return { header: headerSetting, data: data }
1109
1138
  } catch (e) {
1110
- this._showToast(e)
1139
+ this.showToast(e)
1111
1140
  }
1112
1141
  }
1113
1142
 
1114
- stateChanged(state) {
1115
- let palletLabelSetting = state.dashboard[PALLET_LABEL_SETTING_KEY]
1116
- let cartonLabelSetting = state.dashboard[CARTON_LABEL_SETTING_KEY]
1117
- this._palletLabel = (palletLabelSetting && palletLabelSetting.board) || {}
1118
- this._cartonLabel = (cartonLabelSetting && cartonLabelSetting.board) || {}
1119
- }
1120
-
1121
1143
  async fetchBizplaces(bizplace = []) {
1122
1144
  const response = await client.query({
1123
1145
  query: gql`
@@ -1152,8 +1174,8 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1152
1174
  `,
1153
1175
  variables: { filters: [...bizplace] }
1154
1176
  })
1155
- return response.data.pureProductsByBizplace.items.map(product => {
1156
- return { id: product.id, name: product.productInformation }
1177
+ return response.data.pureProductsByBizplace.items.map(itm => {
1178
+ return { id: itm.id, name: itm.productInformation }
1157
1179
  })
1158
1180
  } catch (ex) {
1159
1181
  throw ex
@@ -1191,7 +1213,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1191
1213
  variables: { id, remark }
1192
1214
  })
1193
1215
  if (!response.errors) {
1194
- this._showToast({ message: i18next.t('text.remark_updated') })
1216
+ this.showToast({ message: i18next.t('text.remark_updated') })
1195
1217
  }
1196
1218
  }
1197
1219
 
@@ -1229,7 +1251,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1229
1251
  )
1230
1252
  }
1231
1253
 
1232
- _openSerialNumberPopup(inventory, rowIndex, records) {
1254
+ openSerialNumberPopup(inventory, rowIndex, records) {
1233
1255
  const removable =
1234
1256
  inventory?.product?.isRequireSerialNumberScanningOutbound &&
1235
1257
  inventory?.product?.isRequireSerialNumberScanningInbound
@@ -1303,7 +1325,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1303
1325
  var labelId = this._palletLabel && this._palletLabel.id
1304
1326
 
1305
1327
  if (!labelId) {
1306
- this._showToast({
1328
+ this.showToast({
1307
1329
  type: 'error',
1308
1330
  message: `${i18next.t('text.no_label_setting_was_found')}. ${i18next.t('text.please_check_your_setting')}`
1309
1331
  })
@@ -1330,6 +1352,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1330
1352
  searchParams.append('purchaseOrderNo', record.purchaseOrderNo)
1331
1353
  searchParams.append('orderProductRemark', record.orderProductRemark)
1332
1354
  searchParams.append('refNo', record.arrivalNoticeRefNo)
1355
+ searchParams.append('ganNo', record.arrivalNoticeNo)
1333
1356
 
1334
1357
  try {
1335
1358
  const response = await fetch(`label-command/${labelId}?${searchParams.toString()}`, {
@@ -1348,7 +1371,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1348
1371
 
1349
1372
  await this.printer.print(command)
1350
1373
  } catch (e) {
1351
- this._showToast(e)
1374
+ this.showToast(e)
1352
1375
 
1353
1376
  delete this.printer
1354
1377
  break
@@ -1362,7 +1385,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1362
1385
  const labelId = this._cartonLabel && this._cartonLabel.id
1363
1386
 
1364
1387
  if (!labelId) {
1365
- this._showToast({
1388
+ this.showToast({
1366
1389
  type: 'error',
1367
1390
  message: `${i18next.t('text.no_label_setting_was_found')}. ${i18next.t('text.please_check_your_setting')}`
1368
1391
  })
@@ -1392,7 +1415,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1392
1415
 
1393
1416
  await this.printer.print(command)
1394
1417
  } catch (e) {
1395
- this._showToast(e)
1418
+ this.showToast(e)
1396
1419
 
1397
1420
  delete this.printer
1398
1421
  break
@@ -1431,7 +1454,7 @@ class InventoryAdjustment extends connect(store)(localize(i18next)(PageView)) {
1431
1454
  }
1432
1455
  }
1433
1456
 
1434
- _showToast({ level, type, message }) {
1457
+ showToast({ level, type, message }) {
1435
1458
  document.dispatchEvent(
1436
1459
  new CustomEvent('notify', {
1437
1460
  detail: {