@things-factory/operato-wms 4.3.355 → 4.3.357

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 (40) hide show
  1. package/client/pages/components/select-cc-product-popup.js +321 -0
  2. package/client/pages/constants/order.js +15 -0
  3. package/client/pages/inventory-check/add-extra-inventory-popup.js +306 -0
  4. package/client/pages/inventory-check/check-inventory-popup.js +183 -167
  5. package/client/pages/inventory-check/create-cycle-count.js +292 -141
  6. package/client/pages/inventory-check/cycle-count-inventory-details-popup.js +282 -0
  7. package/client/pages/inventory-check/cycle-count-recheck-popup.js +129 -31
  8. package/client/pages/inventory-check/cycle-count-report.js +425 -306
  9. package/client/pages/inventory-check/cycle-count-review.js +742 -0
  10. package/client/pages/inventory-check/cycle-count-worksheet-list.js +476 -0
  11. package/client/pages/inventory-check/inspecting-product.js +954 -1029
  12. package/client/pages/inventory-check/inventory-check-detail.js +378 -0
  13. package/client/pages/inventory-check/inventory-check-list.js +35 -109
  14. package/client/pages/inventory-check/relocate-inventory-popup.js +222 -0
  15. package/client/pages/inventory-check/search-popup.js +1 -1
  16. package/client/pages/inventory-check/select-cc-location-popup.js +230 -0
  17. package/client/pages/inventory-check/worksheet-cycle-count.js +112 -90
  18. package/client/pages/outbound/route-label-popup.js +16 -0
  19. package/client/route.js +8 -0
  20. package/dist-server/graphql/resolvers/reports/cycle-count-report.js +244 -0
  21. package/dist-server/graphql/resolvers/reports/cycle-count-report.js.map +1 -0
  22. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  23. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  24. package/dist-server/graphql/types/reports/cycle-count-report-list.js +14 -0
  25. package/dist-server/graphql/types/reports/cycle-count-report-list.js.map +1 -0
  26. package/dist-server/graphql/types/reports/cycle-count-report.js +25 -0
  27. package/dist-server/graphql/types/reports/cycle-count-report.js.map +1 -0
  28. package/dist-server/graphql/types/reports/index.js +5 -0
  29. package/dist-server/graphql/types/reports/index.js.map +1 -1
  30. package/package.json +6 -6
  31. package/server/graphql/resolvers/reports/cycle-count-report.ts +267 -0
  32. package/server/graphql/resolvers/reports/index.ts +3 -4
  33. package/server/graphql/types/reports/cycle-count-report-list.ts +8 -0
  34. package/server/graphql/types/reports/cycle-count-report.ts +19 -0
  35. package/server/graphql/types/reports/index.ts +7 -8
  36. package/things-factory.config.js +8 -0
  37. package/translations/en.json +34 -0
  38. package/translations/ko.json +34 -0
  39. package/translations/ms.json +35 -1
  40. package/translations/zh.json +37 -3
@@ -4,14 +4,14 @@ import { client } from '@things-factory/shell'
4
4
  import gql from 'graphql-tag'
5
5
  import { i18next, localize } from '@things-factory/i18n-base'
6
6
  import { css, html, LitElement } from 'lit-element'
7
+ import { isMobileDevice } from '@things-factory/utils'
8
+ import { ScrollbarStyles } from '@things-factory/styles'
7
9
 
8
10
  class CheckInventoryPopup extends localize(i18next)(LitElement) {
9
11
  static get properties() {
10
12
  return {
11
13
  bizplaceName: String,
12
- cycleCountNo: String,
13
- selectedLocation: String,
14
- selectedInventory: String,
14
+ bizplaceId: String,
15
15
  missingInventory: Object,
16
16
  config: Object,
17
17
  data: Object
@@ -20,6 +20,7 @@ class CheckInventoryPopup extends localize(i18next)(LitElement) {
20
20
 
21
21
  static get styles() {
22
22
  return [
23
+ ScrollbarStyles,
23
24
  SingleColumnFormStyles,
24
25
  css`
25
26
  :host {
@@ -68,207 +69,229 @@ class CheckInventoryPopup extends localize(i18next)(LitElement) {
68
69
  .button-container > barcode-scanable-input {
69
70
  margin: auto;
70
71
  }
72
+ [field-2column] {
73
+ background-color: var(--theme-white-color);
74
+ margin: var(--margin-wide) 0;
75
+ padding: var(--padding-wide);
76
+ border-radius: var(--border-radius);
77
+ box-shadow: var(--box-shadow);
78
+ display: grid;
79
+ grid-template-columns: 1fr 1fr;
80
+ gap: 5px 15px;
81
+ clear: both;
82
+ max-width: var(--input-container-max-width);
83
+ }
84
+ [field] {
85
+ display: flex;
86
+ flex-direction: column;
87
+ padding-bottom: var(--padding-default);
88
+ }
89
+ [grid-span] {
90
+ grid-column: span 3;
91
+ }
92
+ label {
93
+ display: flex;
94
+ flex-direction: column;
95
+
96
+ font: var(--label-font);
97
+ color: var(--label-color);
98
+ text-transform: var(--label-text-transform);
99
+ }
100
+ input {
101
+ border: var(--border-dark-color);
102
+ border-radius: var(--border-radius);
103
+ margin: var(--input-margin);
104
+ padding: var(--input-padding);
105
+ background-color: var(--theme-white-color);
106
+ font: var(--input-font);
107
+
108
+ flex: 1;
109
+ }
110
+ legend mwc-icon {
111
+ vertical-align: middle;
112
+ margin: var(--grist-title-icon-margin);
113
+ font-size: var(--grist-title-icon-size);
114
+ color: var(--grist-title-icon-color);
115
+ cursor: pointer;
116
+ }
71
117
  `
72
118
  ]
73
119
  }
74
120
 
121
+ connectedCallback() {
122
+ super.connectedCallback()
123
+ }
124
+
75
125
  async firstUpdated() {
76
126
  await this.updateComplete
77
127
 
78
- if (this.selectedLocation) this.locationInput.value = this.selectedLocation
79
- else this.locationInput.value = ''
128
+ this.focusOnInput()
129
+ this.initConfig()
130
+ this.dataGrist.fetch()
131
+ }
132
+
133
+ focusOnInput() {
134
+ if (this.enableCartonLabel) {
135
+ this.cartonIdInput.value = ''
136
+ this.focusOnCartonInput()
137
+ } else {
138
+ this.palletIdInput.value = ''
139
+ this.focusOnPalletInput()
140
+ }
141
+ }
142
+ initConfig() {
143
+ this.config = {
144
+ list: {
145
+ fields: ['locationName', 'productSku']
146
+ },
147
+ pagination: { infinite: true },
148
+ rows: {
149
+ selectable: { multiple: false },
150
+ appendable: false
151
+ },
152
+ columns: [
153
+ { type: 'gutter', gutterName: 'sequence' },
154
+ {
155
+ type: 'string',
156
+ name: 'locationName',
157
+ header: i18next.t('field.location'),
158
+ sortable: true,
159
+ width: 150
160
+ },
161
+ {
162
+ type: 'string',
163
+ name: 'productSku',
164
+ header: i18next.t('field.sku'),
165
+ sortable: true,
166
+ width: 150
167
+ }
168
+ ]
169
+ }
170
+ this.dataGrist.fetch()
171
+ }
80
172
 
81
- if (this.selectedInventory) this.palletIdInput.value = this.selectedInventory
82
- else this.palletIdInput.value = ''
173
+ async pageUpdated(changes, lifecycle) {
174
+ if (this.active) {
175
+ await this.updateComplete
83
176
 
84
- this.focusOnPalletInput()
177
+ this.dataGrist.fetch()
178
+ }
179
+ }
180
+ get cartonIdInput() {
181
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=cartonId]').shadowRoot.querySelector('input')
85
182
  }
86
183
 
87
184
  get palletIdInput() {
88
185
  return this.shadowRoot.querySelector('barcode-scanable-input[name=palletId]').shadowRoot.querySelector('input')
89
186
  }
90
187
 
91
- get locationInput() {
92
- return this.shadowRoot.querySelector('barcode-scanable-input[name=location]').shadowRoot.querySelector('input')
188
+ get infoForm() {
189
+ return this.renderRoot.querySelector('form#info-form')
190
+ }
191
+
192
+ get dataGrist() {
193
+ return this.shadowRoot.querySelector('data-grist')
93
194
  }
94
195
 
95
196
  render() {
96
197
  return html`
97
- <form
98
- id="input-form"
99
- class="single-column-form"
100
- @keypress="${async e => {
101
- if (e.keyCode === 13) {
102
- e.preventDefault()
103
- this._checkPalletId()
104
- }
105
- }}"
106
- >
107
- <fieldset>
108
- <legend>${i18next.t('title.scan_area')}</legend>
109
- <label>${i18next.t('label.lot_id')}</label>
110
- <barcode-scanable-input name="palletId" custom-input></barcode-scanable-input>
111
- <label>${i18next.t('label.current_location')}</label>
112
- <barcode-scanable-input name="location" custom-input></barcode-scanable-input>
113
- </fieldset>
198
+ <form id="info-form" class="single-column-form">
199
+ <legend>${i18next.t('title.scan_area')}</legend>
200
+ ${this.enableCartonLabel
201
+ ? html` <label>${i18next.t('label.carton_id')}</label>
202
+ <barcode-scanable-input
203
+ name="cartonId"
204
+ custom-input
205
+ @keypress="${async e => {
206
+ if (e.keyCode === 13) {
207
+ e.preventDefault()
208
+ if (this.cartonIdInput.value) {
209
+ this.cartonId = this.cartonIdInput.value
210
+ this.fetchHandler(this.bizplaceId)
211
+ }
212
+ }
213
+ }}"
214
+ ></barcode-scanable-input>`
215
+ : html`
216
+ <label>${i18next.t('label.lot_id')}</label>
217
+ <barcode-scanable-input
218
+ name="palletId"
219
+ custom-input
220
+ @keypress="${async e => {
221
+ if (e.keyCode === 13) {
222
+ e.preventDefault()
223
+ if (this.palletIdInput.value) {
224
+ this.palletId = this.palletIdInput.value
225
+ this.fetchHandler(this.bizplaceId)
226
+ }
227
+ }
228
+ }}"
229
+ ></barcode-scanable-input>
230
+ `}
114
231
  </form>
115
- <div class="button-container">
116
- <mwc-button raised @click="${this._checkPalletId}" label="${i18next.t('button.check')}"></mwc-button>
117
- </div>
232
+ <data-grist .mode=${'GRID'} .config=${this.config} .data=${this.data}></data-grist>
118
233
  `
119
234
  }
120
235
 
236
+ focusOnCartonInput() {
237
+ this.cartonIdInput.focus()
238
+ }
239
+
121
240
  focusOnPalletInput() {
122
241
  this.palletIdInput.focus()
123
242
  }
124
243
 
125
- async _checkPalletId() {
126
- try {
127
- await this._validateInput()
128
-
129
- const isInventoryOwner = await this._checkInventoryOwnership(this.palletIdInput.value, this.bizplaceName)
130
- if (!isInventoryOwner)
131
- throw new Error(i18next.t('text.inventory_not_belong_to_x', { state: { x: this.bizplaceName } }))
132
-
133
- const isUnderReleasing = await this._checkInventoryRelease(this.palletIdInput.value)
134
- if (isUnderReleasing) throw new Error(i18next.t('text.inventory_is_selected_for_releasing'))
135
-
136
- const hasFound = this._checkFromMissingList()
137
-
138
- if (hasFound) {
139
- this.dispatchEvent(
140
- new CustomEvent('relocate-missing-inventory', {
141
- detail: {
142
- missingRecord: this.missingInventory.records.find(item => item.palletId === this.palletIdInput.value),
143
- locationInput: this.locationInput.value
144
- }
145
- })
146
- )
147
- } else {
148
- const invInfo = await this._checkCurrentLocationinCC(this.palletIdInput.value, this.cycleCountNo)
149
-
150
- if (!invInfo) {
151
- this.dispatchEvent(
152
- new CustomEvent('not-in-cc', {
153
- detail: {
154
- palletId: this.palletIdInput.value,
155
- cycleCountNo: this.cycleCountNo
156
- }
157
- })
158
- )
159
- } else if (invInfo?.currentLocation !== this.locationInput.value) {
160
- this.dispatchEvent(
161
- new CustomEvent('relocate-inventory', {
162
- detail: {
163
- recordInformation: invInfo,
164
- locationInput: this.locationInput.value
165
- }
166
- })
167
- )
168
- } else {
169
- this.dispatchEvent(
170
- new CustomEvent('same-location', {
171
- detail: {
172
- recordInformation: invInfo,
173
- locationInput: this.locationInput.value
174
- }
175
- })
176
- )
177
- }
178
- }
179
- } catch (e) {
180
- this._showToast(e)
181
- }
244
+ constructor() {
245
+ super()
246
+ this.data = { records: [] }
182
247
  }
183
248
 
184
- async _checkInventoryOwnership(palletId, bizplaceName) {
249
+ async fetchHandler(bizplaceId) {
185
250
  try {
186
- const response = await client.query({
187
- query: gql`
188
- query checkInventoryOwner($palletId: String!, $bizplaceName: String!) {
189
- checkInventoryOwner(palletId: $palletId, bizplaceName: $bizplaceName)
190
- }
191
- `,
192
- variables: {
193
- palletId,
194
- bizplaceName
195
- }
196
- })
197
-
198
- if (!response.errors) {
199
- return response.data.checkInventoryOwner
251
+ const variables = {
252
+ cartonId: this.enableCartonLabel ? this.cartonId : null,
253
+ palletId: !this.enableCartonLabel ? this.palletId : null,
254
+ bizplaceId
200
255
  }
201
- } catch (e) {
202
- this.showToast(e)
203
- }
204
- }
205
256
 
206
- async _checkCurrentLocationinCC(palletId, cycleCountNo) {
207
- try {
208
257
  const response = await client.query({
209
258
  query: gql`
210
- query checkStockTakeCurrentLocation($palletId: String!, $cycleCountNo: String!) {
211
- checkStockTakeCurrentLocation(palletId: $palletId, cycleCountNo: $cycleCountNo) {
212
- currentLocation
213
- worksheetDetailName
214
- batchId
215
- palletId
216
- qty
217
- uom
218
- uomValue
219
- productName
220
- productDescription
259
+ query checkInventoryLocation($cartonId: String, $palletId: String, $bizplaceId: String!) {
260
+ checkInventoryLocation(cartonId: $cartonId, palletId: $palletId, bizplaceId: $bizplaceId) {
261
+ items {
262
+ location {
263
+ name
264
+ }
265
+ product {
266
+ sku
267
+ }
268
+ }
221
269
  }
222
270
  }
223
271
  `,
224
- variables: {
225
- palletId,
226
- cycleCountNo
227
- }
272
+ variables
228
273
  })
229
274
 
230
275
  if (!response.errors) {
231
- return response.data.checkStockTakeCurrentLocation
232
- } else {
233
- return response.errors
234
- }
235
- } catch (e) {
236
- this.showToast(e)
237
- }
238
- }
239
-
240
- async _checkInventoryRelease(palletId) {
241
- try {
242
- const response = await client.query({
243
- query: gql`
244
- query checkInventoryRelease($palletId: String!) {
245
- checkInventoryRelease(palletId: $palletId)
246
- }
247
- `,
248
- variables: {
249
- palletId
276
+ const { items } = response.data.checkInventoryLocation
277
+ this.data = {
278
+ records:
279
+ items && items.length
280
+ ? items.map(item => ({
281
+ locationName: item.location.name,
282
+ productSku: item.product.sku
283
+ }))
284
+ : []
250
285
  }
251
- })
252
286
 
253
- if (!response.errors) {
254
- return response.data.checkInventoryRelease
287
+ if (!items.length) {
288
+ this._showToast({ message: i18next.t('text.no_data_found') })
289
+ }
290
+ } else {
291
+ throw new Error(response.errors)
255
292
  }
256
293
  } catch (e) {
257
- this.showToast(e)
258
- }
259
- }
260
-
261
- _validateInput() {
262
- const palletId = this.palletIdInput.value
263
- if (!palletId) {
264
- this.selectOnInput(this.palletIdInput)
265
- throw new Error(i18next.t('text.invalid_x', { state: { x: i18next.t('label.lot_id') } }))
266
- }
267
-
268
- const locationName = this.locationInput.value
269
- if (!locationName) {
270
- this.selectOnInput(this.locationInput)
271
- throw new Error(i18next.t('text.invalid_x', { state: { x: i18next.t('label.location') } }))
294
+ this._showToast(e)
272
295
  }
273
296
  }
274
297
 
@@ -276,13 +299,6 @@ class CheckInventoryPopup extends localize(i18next)(LitElement) {
276
299
  setTimeout(() => input.select(), 100)
277
300
  }
278
301
 
279
- _checkFromMissingList() {
280
- const foundPalletId = this.palletIdInput.value
281
- const missingPalletId = this.missingInventory.records.map(item => item.palletId)
282
-
283
- return missingPalletId.includes(foundPalletId)
284
- }
285
-
286
302
  _showToast({ type, message }) {
287
303
  document.dispatchEvent(
288
304
  new CustomEvent('notify', {