@things-factory/operato-wms 4.0.10 → 4.0.14

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
@@ -1,29 +1,28 @@
1
1
  import '@things-factory/barcode-ui'
2
- import '@things-factory/grist-ui'
3
- import '../inbound/select-location-popup'
4
-
5
- import gql from 'graphql-tag'
6
- import { css, html } from 'lit-element'
7
- import { connect } from 'pwa-helpers/connect-mixin.js'
8
-
9
2
  import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
3
+ import '@things-factory/grist-ui'
10
4
  import { i18next, localize } from '@things-factory/i18n-base'
11
5
  import { openPopup } from '@things-factory/layout-base'
12
6
  import { client, CustomAlert, PageView, store } from '@things-factory/shell'
13
7
  import { CommonButtonStyles } from '@things-factory/styles'
14
8
  import { isMobileDevice } from '@things-factory/utils'
9
+ import gql from 'graphql-tag'
10
+ import { css, html } from 'lit-element'
11
+ import { connect } from 'pwa-helpers/connect-mixin.js'
12
+ import { CARTON, LOT } from '../constants'
13
+ import '../inbound/select-location-popup'
15
14
 
16
- import { CARTON, PALLET } from '../constants'
17
-
18
- const INVENTORY_TYPES = { PALLET, CARTON }
15
+ const INVENTORY_TYPES = { LOT, CARTON }
19
16
  class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
20
17
  static get properties() {
21
18
  return {
22
19
  _palletId: String,
23
20
  _cartonId: String,
21
+ _requireNewId: Boolean,
22
+ _selectedInventory: Object,
24
23
  refInventoryType: String,
25
- config: Object,
26
- data: Object
24
+ _data: Object,
25
+ _gristConfig: Object
27
26
  }
28
27
  }
29
28
 
@@ -35,14 +34,28 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
35
34
  :host {
36
35
  display: flex;
37
36
  flex-direction: column;
38
- overflow: hidden;
37
+ overflow: auto;
39
38
  }
40
39
 
41
- data-grist {
40
+ .grist {
41
+ min-height: 180px;
42
+ background-color: var(--main-section-background-color);
43
+ display: flex;
44
+ flex: 1;
42
45
  overflow: auto;
46
+ }
47
+
48
+ data-grist {
43
49
  flex: 1;
44
50
  }
45
51
 
52
+ h2 {
53
+ padding: var(--subtitle-padding);
54
+ font: var(--subtitle-font);
55
+ color: var(--subtitle-text-color);
56
+ border-bottom: var(--subtitle-border-bottom);
57
+ }
58
+
46
59
  .grist h2 {
47
60
  margin: var(--grist-title-margin);
48
61
  border: var(--grist-title-border);
@@ -60,6 +73,50 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
60
73
  h2 + data-grist {
61
74
  padding-top: var(--grist-title-with-grid-padding);
62
75
  }
76
+
77
+ .button-container {
78
+ grid-column: span 12 / auto;
79
+ text-align: center;
80
+ }
81
+
82
+ .button-container > button {
83
+ background-color: var(--button-background-color);
84
+ border: var(--button-border);
85
+ border-radius: var(--button-border-radius);
86
+ padding: var(--button-padding);
87
+ color: var(--button-color);
88
+ font: var(--button-font);
89
+ text-transform: var(--button-text-transform);
90
+ }
91
+
92
+ .input-section {
93
+ flex: 1;
94
+ display: flex;
95
+ }
96
+
97
+ .left-column {
98
+ flex: 1;
99
+ display: flex;
100
+ flex-direction: column;
101
+ }
102
+
103
+ .right-column {
104
+ flex: 1;
105
+ display: flex;
106
+ flex-direction: column;
107
+ }
108
+
109
+ .content-title {
110
+ font-size: var(--fontsize-medium) !important;
111
+ color: var(--title-text-color) !important;
112
+ }
113
+
114
+ .content {
115
+ font-size: 14px !important;
116
+ font-weight: bold !important;
117
+ color: var(--primary-color) !important;
118
+ margin-botton: 5px;
119
+ }
63
120
  `
64
121
  ]
65
122
  }
@@ -68,11 +125,13 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
68
125
  var actions = []
69
126
 
70
127
  if (this._palletId || this._cartonId) {
71
- actions.push({
72
- title: i18next.t('button.transfer'),
73
- action: this._transferInventory.bind(this),
74
- ...CommonButtonStyles.transfer
75
- })
128
+ actions = [
129
+ ...actions,
130
+ {
131
+ title: i18next.t('button.done'),
132
+ action: this.done.bind(this)
133
+ }
134
+ ]
76
135
  }
77
136
 
78
137
  return {
@@ -90,22 +149,54 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
90
149
  return this.shadowRoot.querySelector('form#input-form')
91
150
  }
92
151
 
152
+ get qtyInput() {
153
+ return this.shadowRoot.querySelector('input[name=qty]')
154
+ }
155
+
93
156
  get palletInput() {
94
- return this.shadowRoot.querySelector('barcode-scanable-input[name=palletId]').shadowRoot.querySelector('input')
157
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=palletId]')?.shadowRoot.querySelector('input')
95
158
  }
96
159
 
97
160
  get cartonInput() {
98
- return this.shadowRoot.querySelector('barcode-scanable-input[name=cartonId]').shadowRoot.querySelector('input')
161
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=cartonId]')?.shadowRoot.querySelector('input')
162
+ }
163
+
164
+ get newLotInput() {
165
+ return this.shadowRoot?.querySelector('barcode-scanable-input[name=newLotId]')?.shadowRoot.querySelector('input')
99
166
  }
100
167
 
101
- get fromLocationNameInput() {
102
- return this.shadowRoot.querySelector('input[name=fromLocationName]')
168
+ get newCartonInput() {
169
+ return this.shadowRoot?.querySelector('barcode-scanable-input[name=newCartonId]')?.shadowRoot.querySelector('input')
103
170
  }
104
171
 
172
+ // get fromLocationNameInput() {
173
+ // return this.shadowRoot.querySelector('input[name=fromLocationName]')
174
+ // }
175
+
105
176
  get toLocationNameInput() {
106
177
  return this.shadowRoot
107
178
  .querySelector('barcode-scanable-input[name=toLocationName]')
108
- .shadowRoot.querySelector('input')
179
+ ?.shadowRoot.querySelector('input')
180
+ }
181
+
182
+ focusOnPalletInput() {
183
+ setTimeout(() => this.palletInput.focus(), 100)
184
+ }
185
+
186
+ focusOnCartonInput() {
187
+ setTimeout(() => this.cartonInput.focus(), 100)
188
+ }
189
+
190
+ focusOnToLocationInput() {
191
+ setTimeout(() => this.toLocationNameInput.focus(), 100)
192
+ }
193
+
194
+ focusOnNewLotInput() {
195
+ if (this.newLotInput) setTimeout(() => this.newLotInput.focus(), 100)
196
+ }
197
+
198
+ focusOnNewCartonInput() {
199
+ if (this.newCartonInput) setTimeout(() => this.newCartonInput.focus(), 100)
109
200
  }
110
201
 
111
202
  render() {
@@ -129,9 +220,8 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
129
220
  )}
130
221
  </select>
131
222
 
132
- ${this.refInventoryType === INVENTORY_TYPES.PALLET.value
223
+ ${this.refInventoryType === INVENTORY_TYPES.LOT.value
133
224
  ? html`
134
- <label>${i18next.t('label.lot_id')}</label>
135
225
  <barcode-scanable-input
136
226
  name="palletId"
137
227
  custom-input
@@ -140,107 +230,206 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
140
230
  e.preventDefault()
141
231
  if (this.palletInput.value) {
142
232
  this._palletId = this.palletInput.value
143
- this._fetchInventory(this.palletInput.value)
233
+ this.fetchInventory(this.palletInput.value)
144
234
  }
145
235
  }
146
236
  }}"
147
237
  ></barcode-scanable-input>
148
238
  `
149
- : html` <label>${i18next.t('label.carton_id')}</label>
150
- <barcode-scanable-input
151
- name="cartonId"
152
- custom-input
153
- @keypress="${e => {
154
- if (e.keyCode === 13) {
155
- e.preventDefault()
156
- if (this.cartonInput.value) {
157
- this._cartonId = this.cartonInput.value
158
- this._fetchInventory(this.cartonInput.value)
159
- }
239
+ : html` <barcode-scanable-input
240
+ name="cartonId"
241
+ custom-input
242
+ @keypress="${e => {
243
+ if (e.keyCode === 13) {
244
+ e.preventDefault()
245
+ if (this.cartonInput.value) {
246
+ this._cartonId = this.cartonInput.value
247
+ this.fetchInventory(this.cartonInput.value)
160
248
  }
161
- }}"
162
- ></barcode-scanable-input>`}
163
- </fieldset>
164
- </form>
165
-
166
- <form id="input-form" class="multi-column-form">
167
- <fieldset>
168
- <label>${i18next.t('label.from_location')}</label>
169
- <input
170
- name="fromLocationName"
171
- @keypress="${e => {
172
- if (e.keyCode === 13) {
173
- e.preventDefault()
174
- if (this.fromLocationNameInput.value) {
175
- this._transferInventory()
176
- }
177
- }
178
- }}"
179
- readonly
180
- />
181
-
182
- <label>${i18next.t('label.to_location')}</label>
183
- <barcode-scanable-input
184
- name="toLocationName"
185
- custom-input
186
- @keypress="${e => {
187
- if (e.keyCode === 13) {
188
- e.preventDefault()
189
- if (this.toLocationNameInput.value) {
190
- this._transferInventory()
191
- }
192
- }
193
- }}"
194
- ></barcode-scanable-input>
249
+ }
250
+ }}"
251
+ ></barcode-scanable-input>`}
195
252
  </fieldset>
196
253
  </form>
197
254
 
198
255
  <div class="grist">
199
- <h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.inventory')}</h2>
200
- <data-grist .mode=${isMobileDevice() ? 'LIST' : 'GRID'} .config=${this.config} .data=${this.data}></data-grist>
256
+ <data-grist
257
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
258
+ .config=${this._gristConfig}
259
+ .data=${this._data}
260
+ ></data-grist>
201
261
  </div>
202
- `
203
- }
204
262
 
205
- constructor() {
206
- super()
207
- this._palletId = ''
208
- this._cartonId = ''
209
- this.refInventoryType = INVENTORY_TYPES.PALLET.value
263
+ <div class="input-section">
264
+ <div class="left-column">
265
+ <div class="single-column-form">
266
+ <fieldset>
267
+ <label class="content-title">${i18next.t('label.lot_id')}</label>
268
+ <label class="content">${this?._selectedInventory?.palletId || '-'}</label>
269
+
270
+ <label class="content-title">${i18next.t('label.from_location')}</label>
271
+ <label class="content">${this?._selectedInventory?.location?.name || '-'}</label>
272
+
273
+ <label class="content-title">${i18next.t('label.product')}</label>
274
+ <label class="content"
275
+ >${this?._selectedInventory?.product
276
+ ? '(' + this._selectedInventory.product.sku + ') ' + this?._selectedInventory?.product?.name
277
+ : '-'}</label
278
+ >
279
+ <label class="content-title">${i18next.t('label.packing_type')}</label>
280
+ <label class="content">${this?._selectedInventory?.packingType || '-'}</label>
281
+
282
+ <label class="content-title">${i18next.t('label.qty')}</label>
283
+ <label class="content">${this?._selectedInventory?.qty || '-'}</label>
284
+
285
+ <!-- <input name="fromLocationName" readonly /> -->
286
+ </fieldset>
287
+ </div>
288
+ </div>
289
+ <div class="right-column">
290
+ <form id="input-form" class="single-column-form">
291
+ <fieldset>
292
+ <label class="content-title">${i18next.t('label.transfer_qty')}</label>
293
+ <input
294
+ type="number"
295
+ name="qty"
296
+ min="0"
297
+ @change="${e => {
298
+ if (parseInt(this.qtyInput.value) < 0) {
299
+ this.qtyInput.value = 0
300
+ }
301
+ if (this._selectedInventory) {
302
+ if (this._selectedInventory.qty > parseInt(this.qtyInput.value)) {
303
+ this._requireNewId = true
304
+ } else {
305
+ if (parseInt(this.qtyInput.value) > this._selectedInventory.qty) {
306
+ this.qtyInput.value = this._selectedInventory.qty
307
+ }
308
+ this._requireNewId = false
309
+ }
310
+ }
311
+ }}"
312
+ @keypress="${e => {
313
+ if (e.keyCode === 13) {
314
+ e.preventDefault()
315
+ if (parseInt(this.qtyInput.value) < 0) {
316
+ this.qtyInput.value = 0
317
+ } else if (this.qtyInput.value && this.toLocationNameInput.value === '') {
318
+ this.focusOnToLocationInput()
319
+ }
320
+ }
321
+ }}"
322
+ />
323
+
324
+ <label class="content-title">${i18next.t('label.to_location')}</label>
325
+ <barcode-scanable-input
326
+ name="toLocationName"
327
+ custom-input
328
+ @keypress="${e => {
329
+ if (e.keyCode === 13) {
330
+ e.preventDefault()
331
+ if (this.toLocationNameInput.value) {
332
+ if (this.refInventoryType === INVENTORY_TYPES.LOT.value) {
333
+ if (this._requireNewId) {
334
+ this.focusOnNewLotInput()
335
+ } else {
336
+ this.transferInventory(e)
337
+ }
338
+ } else {
339
+ this.focusOnNewCartonInput()
340
+ }
341
+ // this.transferInventory(e)
342
+ }
343
+ }
344
+ }}"
345
+ ></barcode-scanable-input>
346
+
347
+ ${this.refInventoryType === INVENTORY_TYPES.LOT.value
348
+ ? this._requireNewId
349
+ ? html` <label class="content-title">${i18next.t('label.new_lot_id')}</label>
350
+ <barcode-scanable-input
351
+ name="newLotId"
352
+ custom-input
353
+ @keypress="${e => {
354
+ if (e.keyCode === 13) {
355
+ e.preventDefault()
356
+ this.transferInventory(e)
357
+ }
358
+ }}"
359
+ ></barcode-scanable-input>`
360
+ : ``
361
+ : html`
362
+ <label class="content-title">${i18next.t('label.carton_id')}</label>
363
+ <barcode-scanable-input
364
+ name="newCartonId"
365
+ custom-input
366
+ @keypress="${e => {
367
+ if (e.keyCode === 13) {
368
+ e.preventDefault()
369
+ this.transferInventory(e)
370
+ }
371
+ }}"
372
+ ></barcode-scanable-input>
373
+ `}
374
+
375
+ <div class="button-container">
376
+ <button @click=${this.transferInventory.bind(this)}>${i18next.t('button.transfer')}</button>
377
+ </div>
378
+ </fieldset>
379
+ </form>
380
+ </div>
381
+ </div>
382
+ `
210
383
  }
211
384
 
212
385
  pageInitialized() {
213
- this.config = {
214
- rows: { appendable: false },
215
- pagination: { infinite: true },
386
+ this.refInventoryType = INVENTORY_TYPES.LOT.value
387
+ this._gristConfig = {
216
388
  list: {
217
389
  fields: [
218
- 'batchId',
219
- 'palletId',
220
- 'cartonId',
221
390
  'sku',
222
391
  'product',
392
+ 'cartonId',
393
+ 'palletId',
394
+ 'location',
395
+ 'batchId',
223
396
  'packingType',
224
397
  'packingSize',
225
398
  'qty',
226
399
  'expirationDate'
227
400
  ]
228
401
  },
402
+ pagination: { infinite: true },
403
+ rows: {
404
+ appendable: false,
405
+ handlers: {
406
+ click: async (columns, data, column, record, rowIndex) => {
407
+ try {
408
+ if (this.refInventoryType !== INVENTORY_TYPES.LOT.value) {
409
+ this._selectedInventory = record
410
+ }
411
+ } catch (ex) {
412
+ console.log(ex)
413
+ } finally {
414
+ }
415
+ }
416
+ }
417
+ },
229
418
  columns: [
230
419
  { type: 'gutter', gutterName: 'sequence' },
231
420
  {
232
421
  type: 'string',
233
- name: 'batchId',
422
+ name: 'sku',
234
423
  label: true,
235
- header: i18next.t('field.batch_id'),
424
+ header: i18next.t('field.sku'),
236
425
  width: 150
237
426
  },
238
427
  {
239
- type: 'string',
240
- name: 'palletId',
428
+ type: 'object',
429
+ name: 'product',
241
430
  label: true,
242
- header: i18next.t('field.lot_id'),
243
- width: 150
431
+ header: i18next.t('field.product'),
432
+ width: 200
244
433
  },
245
434
  {
246
435
  type: 'string',
@@ -251,30 +440,37 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
251
440
  },
252
441
  {
253
442
  type: 'string',
254
- name: 'sku',
443
+ name: 'palletId',
255
444
  label: true,
256
- header: i18next.t('field.sku'),
445
+ header: i18next.t('field.lot_id'),
257
446
  width: 150
258
447
  },
259
448
  {
260
449
  type: 'object',
261
- name: 'product',
450
+ name: 'location',
262
451
  label: true,
263
- header: i18next.t('field.product'),
452
+ header: i18next.t('field.location'),
264
453
  width: 200
265
454
  },
455
+ {
456
+ type: 'string',
457
+ name: 'batchId',
458
+ label: true,
459
+ header: i18next.t('field.batch_id'),
460
+ width: 150
461
+ },
266
462
  {
267
463
  type: 'string',
268
464
  name: 'packingType',
269
465
  label: true,
270
- header: i18next.t('field.packing_type'),
466
+ header: i18next.t('field.packing'),
271
467
  width: 150
272
468
  },
273
469
  {
274
470
  type: 'number',
275
471
  name: 'packingSize',
276
472
  label: true,
277
- header: i18next.t('field.packing_size'),
473
+ header: i18next.t('field.size'),
278
474
  width: 80
279
475
  },
280
476
  {
@@ -293,19 +489,23 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
293
489
  }
294
490
  ]
295
491
  }
492
+
493
+ this.clearView()
296
494
  }
297
495
 
298
496
  inventoryTypeChangeHandler(currentType) {
497
+ this.clearView()
498
+
299
499
  this.refInventoryType = currentType
300
500
 
301
- if (this.refInventoryType === INVENTORY_TYPES.PALLET.value) this._focusOnPalletInput()
302
- else this._focusOnCartonInput()
501
+ if (this.refInventoryType === INVENTORY_TYPES.LOT.value) this.focusOnPalletInput()
502
+ else this.focusOnCartonInput()
303
503
  }
304
504
 
305
- async _fetchInventory(inventoryRefId) {
505
+ async fetchInventory(inventoryRefId) {
306
506
  try {
307
507
  let filters = []
308
- if (this.refInventoryType === INVENTORY_TYPES.PALLET.value) {
508
+ if (this.refInventoryType === INVENTORY_TYPES.LOT.value) {
309
509
  filters.push({
310
510
  name: 'palletId',
311
511
  operator: 'eq',
@@ -338,6 +538,7 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
338
538
  description
339
539
  }
340
540
  qty
541
+ lockedQty
341
542
  location {
342
543
  id
343
544
  name
@@ -357,55 +558,41 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
357
558
 
358
559
  if (!response.errors) {
359
560
  if (response.data.inventories.total == 0) {
360
- if (this.refInventoryType === INVENTORY_TYPES.PALLET.value) this._focusOnPalletInput()
361
- else this._focusOnCartonInput()
561
+ if (this.refInventoryType === INVENTORY_TYPES.LOT.value) this.focusOnPalletInput()
562
+ else this.focusOnCartonInput()
362
563
  throw new Error(i18next.t('text.wrong_lot_id'))
363
564
  }
364
565
 
365
- this.data = {
566
+ this._data = {
366
567
  records: response.data.inventories.items.map(record => {
367
568
  return {
368
569
  ...record,
369
- sku: record.product.sku
570
+ sku: record.product.sku,
571
+ qty: record.qty - record.lockedQty > 0 ? record.qty - record.lockedQty : 0
370
572
  }
371
573
  })
372
574
  }
373
- const locations = [...new Set(this.data.records.map(record => record.location.name))]
374
- if (locations.length > 1) this._selectLocationPopup(this.data.records.map(record => record.location))
375
- else this.fromLocationNameInput.value = locations[0]
376
575
 
377
- this._focusOnToLocationInput()
576
+ if (this.refInventoryType === INVENTORY_TYPES.LOT.value) {
577
+ this._selectedInventory = this._data.records[0]
578
+ }
579
+
378
580
  this.updateContext()
379
581
  }
380
582
  } catch (e) {
381
- this._clearView()
382
- if (this.refInventoryType === INVENTORY_TYPES.PALLET.value) this._focusOnPalletInput()
383
- else this._focusOnCartonInput()
384
- this._showToast(e)
583
+ this.clearView()
584
+ if (this.refInventoryType === INVENTORY_TYPES.LOT.value) this.focusOnPalletInput()
585
+ else this.focusOnCartonInput()
586
+ this.showToast(e)
385
587
  }
386
588
  }
387
589
 
388
- _selectLocationPopup(locations) {
389
- openPopup(
390
- html`
391
- <select-location-popup
392
- .locations="${locations}"
393
- @location-selected="${e => {
394
- this.fromLocationNameInput.value = e.detail.location.name
395
- }}"
396
- ></select-location-popup>
397
- `,
398
- {
399
- backdrop: true,
400
- size: 'medium',
401
- title: i18next.t('title.select_location')
402
- }
403
- )
404
- }
590
+ async transferInventory(e) {
591
+ e.stopPropagation()
592
+ e.preventDefault()
405
593
 
406
- async _transferInventory() {
407
594
  try {
408
- this._validateLocation()
595
+ this._validate()
409
596
 
410
597
  const result = await CustomAlert({
411
598
  title: i18next.t('title.are_you_sure'),
@@ -418,80 +605,96 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
418
605
  return
419
606
  }
420
607
 
608
+ let variables = {
609
+ originPalletId: this._selectedInventory.palletId,
610
+ palletId: this.refInventoryType === INVENTORY_TYPES.LOT.value ? this.newLotInput?.value : null,
611
+ cartonId: this.refInventoryType === INVENTORY_TYPES.CARTON.value ? this.newCartonInput?.value : null,
612
+ fromLocationName: this._selectedInventory.location.name,
613
+ toLocationName: this.toLocationNameInput.value,
614
+ qty: parseInt(this.qtyInput.value)
615
+ }
616
+
421
617
  const response = await client.mutate({
422
618
  mutation: gql`
423
619
  mutation inventoryTransfer(
620
+ $originPalletId: String!
424
621
  $palletId: String
425
622
  $cartonId: String
426
623
  $fromLocationName: String!
427
624
  $toLocationName: String!
625
+ $qty: Float!
428
626
  ) {
429
627
  inventoryTransfer(
628
+ originPalletId: $originPalletId
430
629
  palletId: $palletId
431
630
  cartonId: $cartonId
432
631
  fromLocationName: $fromLocationName
433
632
  toLocationName: $toLocationName
633
+ qty: $qty
434
634
  )
435
635
  }
436
636
  `,
437
- variables: {
438
- palletId: this.refInventoryType === INVENTORY_TYPES.PALLET.value ? this.palletInput.value : null,
439
- cartonId: this.refInventoryType === INVENTORY_TYPES.CARTON.value ? this.cartonInput.value : null,
440
- fromLocationName: this.fromLocationNameInput.value,
441
- toLocationName: this.toLocationNameInput.value
442
- }
637
+ variables
443
638
  })
444
639
 
445
640
  if (!response.errors) {
446
- this._showToast({ message: i18next.t('text.transfer_location_completed') })
447
- this._clearView()
448
- if (this.refInventoryType === INVENTORY_TYPES.PALLET) this._focusOnPalletInput()
449
- else this._focusOnCartonInput()
641
+ let id = this.refInventoryType === INVENTORY_TYPES.LOT.value ? this._palletId : this._cartonId
642
+ this.showToast({ message: i18next.t('text.transfer_location_completed') })
643
+ this.clearView()
644
+ this.fetchInventory(id)
450
645
  this.updateContext()
451
646
  }
452
647
  } catch (e) {
453
- this._showToast(e)
648
+ this.showToast(e)
454
649
  }
455
650
  }
456
651
 
457
- _validateLocation() {
652
+ _validate() {
653
+ if (!this._selectedInventory) {
654
+ throw new Error(i18next.t('text.please_select_an_inventory'))
655
+ }
656
+
657
+ if (!this.qtyInput.value > 0) {
658
+ throw new Error(i18next.t('text.please_enter_transfer_qty'))
659
+ }
660
+
458
661
  if (!this.toLocationNameInput.value) {
459
- this._focusOnToLocationInput()
662
+ this.focusOnToLocationInput()
460
663
  throw new Error(i18next.t('text.there_is_no_to_location'))
461
664
  }
462
665
 
463
- if (this.fromLocationNameInput.value == this.toLocationNameInput.value) {
666
+ if (this._selectedInventory?.location?.name == this.toLocationNameInput.value) {
464
667
  throw new Error(i18next.t('text.from_location_is_same_as_to_location'))
465
668
  }
466
- }
467
669
 
468
- _focusOnPalletInput() {
469
- setTimeout(() => this.palletInput.focus(), 100)
470
- }
471
-
472
- _focusOnCartonInput() {
473
- setTimeout(() => this.cartonInput.focus(), 100)
474
- }
475
-
476
- _focusOnToLocationInput() {
477
- setTimeout(() => this.toLocationNameInput.focus(), 100)
670
+ if (this.refInventoryType === INVENTORY_TYPES.CARTON.value && this?.cartonInput?.value.trim() == '') {
671
+ throw new Error(i18next.t('text.required_carton_id'))
672
+ }
478
673
  }
479
674
 
480
- _clearView() {
481
- this.inputForm.reset()
482
- this.data = { records: [] }
483
- this.toLocationNameInput.value = ''
484
- if (this.refInventoryType === INVENTORY_TYPES.PALLET.value) {
675
+ done() {
676
+ this.clearView()
677
+ if (this.refInventoryType === INVENTORY_TYPES.LOT.value) {
485
678
  this.palletInput.value = ''
486
679
  this._palletId = ''
487
680
  } else {
488
681
  this.cartonInput.value = ''
489
682
  this.cartonId = ''
490
683
  }
684
+ }
685
+
686
+ clearView() {
687
+ this.inputForm?.reset()
688
+ this._selectedInventory = null
689
+ this._requireNewId = false
690
+ this._data = { records: [] }
691
+ if (this?.toLocationNameInput) this.toLocationNameInput.value = ''
692
+ if (this?.newCartonInput) this.newCartonInput.value = ''
693
+ if (this?.newLotInput) this.newLotInput.value = ''
491
694
  this.updateContext()
492
695
  }
493
696
 
494
- _showToast({ type, message }) {
697
+ showToast({ type, message }) {
495
698
  document.dispatchEvent(
496
699
  new CustomEvent('notify', {
497
700
  detail: {