@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
@@ -0,0 +1,282 @@
1
+ import { MultiColumnFormStyles } from '@things-factory/form-ui'
2
+ import { i18next, localize } from '@things-factory/i18n-base'
3
+ import { client, CustomAlert, gqlContext } from '@things-factory/shell'
4
+ import { isMobileDevice } from '@things-factory/utils'
5
+ import gql from 'graphql-tag'
6
+ import { css, html, LitElement } from 'lit-element'
7
+ import { ScrollbarStyles } from '@things-factory/styles'
8
+
9
+ class CycleCountInventoryDetailsPopup extends localize(i18next)(LitElement) {
10
+ static get styles() {
11
+ return [
12
+ ScrollbarStyles,
13
+ css`
14
+ :host {
15
+ display: flex;
16
+ flex-direction: column;
17
+ overflow: hidden;
18
+ background-color: white;
19
+
20
+ --grid-record-emphasized-background-color: #ffdbdb;
21
+ --grid-record-emphasized-color: #703f3f;
22
+ }
23
+ search-form {
24
+ overflow: visible;
25
+ }
26
+ data-grist {
27
+ overflow-y: auto;
28
+ flex: 1;
29
+ }
30
+ .gtinGrist {
31
+ display: flex;
32
+ flex-direction: column;
33
+ overflow-y: auto;
34
+ padding-left: 5px;
35
+ padding-right: 5px;
36
+ }
37
+ .grist-container {
38
+ overflow-y: hidden;
39
+ display: flex;
40
+ flex: 1;
41
+ }
42
+ .button-container {
43
+ padding: 10px 0 12px 0;
44
+ text-align: center;
45
+ }
46
+ [danger] {
47
+ --mdc-theme-primary: var(--mdc-danger-button-primary-color);
48
+ }
49
+ .header {
50
+ display: grid;
51
+ grid-template-columns: repeat(24, 1fr);
52
+ grid-gap: var(--form-grid-gap);
53
+ grid-auto-rows: minmax(24px, auto);
54
+ max-width: var(--form-multi-column-max-width);
55
+ margin-top: var(--form-margin);
56
+ margin-left: var(--form-margin);
57
+ margin-right: var(--form-margin);
58
+ }
59
+ .header legend {
60
+ grid-column: span 24;
61
+ text-transform: capitalize;
62
+
63
+ padding: var(--legend-padding);
64
+ font: var(--legend-font);
65
+ color: var(--legend-text-color);
66
+ border-bottom: var(--legend-border-bottom);
67
+ }
68
+ `
69
+ ]
70
+ }
71
+
72
+ static get properties() {
73
+ return {
74
+ cycleCountNo: String,
75
+ inventoryId: String,
76
+ cartonId: String,
77
+ palletId: String,
78
+ enableCartonLabel: { type: Boolean },
79
+ config: Object,
80
+ data: Object
81
+ }
82
+ }
83
+
84
+ constructor() {
85
+ super()
86
+ this.data = {}
87
+ }
88
+
89
+ get grist() {
90
+ return this.renderRoot.querySelector('data-grist')
91
+ }
92
+
93
+ render() {
94
+ return html`
95
+ <div class="grist">
96
+ <data-grist
97
+ .mode="${isMobileDevice() ? 'LIST' : 'GRID'}"
98
+ .config="${this.config}"
99
+ .data="${this.data}"
100
+ .fetchHandler="${this.fetchHandler.bind(this)}"
101
+ ></data-grist>
102
+ </div>
103
+
104
+ <div class="button-container">
105
+ <mwc-button
106
+ raised
107
+ danger
108
+ @click=${() => {
109
+ history.back()
110
+ }}
111
+ label="${i18next.t('button.back')}"
112
+ ></mwc-button>
113
+ </div>
114
+ `
115
+ }
116
+
117
+ async firstUpdated() {
118
+ this.config = {
119
+ rows: { appendable: false },
120
+ list: {
121
+ fields: [
122
+ 'originBatchNo',
123
+ 'inspectedBatchNo',
124
+ 'originLocation',
125
+ 'inspectedLocation',
126
+ 'originUomValue',
127
+ 'inspectedUomValue'
128
+ ]
129
+ },
130
+ pagination: { infinite: true },
131
+ columns: [
132
+ { type: 'gutter', gutterName: 'sequence' },
133
+ {
134
+ type: 'string',
135
+ name: 'countNo',
136
+ header: i18next.t('field.count_no'),
137
+ width: 150
138
+ },
139
+ {
140
+ type: 'string',
141
+ name: 'originBatchNo',
142
+ header: i18next.t('field.system_batch_no'),
143
+ width: 150
144
+ },
145
+ {
146
+ type: 'string',
147
+ name: 'inspectedBatchNo',
148
+ header: i18next.t('field.inspected_batch_no'),
149
+ width: 350
150
+ },
151
+ {
152
+ type: 'string',
153
+ name: 'originLocationName',
154
+ header: i18next.t('field.system_location'),
155
+ width: 120
156
+ },
157
+ {
158
+ type: 'string',
159
+ name: 'inspectedLocationName',
160
+ header: i18next.t('field.inspected_location'),
161
+ width: 120
162
+ },
163
+ {
164
+ type: 'string',
165
+ name: 'originUomValue',
166
+ header: i18next.t('field.system_uom_value'),
167
+ width: 120
168
+ },
169
+ {
170
+ type: 'string',
171
+ name: 'inspectedUomValue',
172
+ header: i18next.t('field.inspected_uom_value'),
173
+ width: 120
174
+ }
175
+ ]
176
+ }
177
+ if (this.cartonId && this.enableCartonLabel) {
178
+ this.config.columns = this.config.columns.map(column => {
179
+ if (column.name === 'originUomValue' || column.name === 'inspectedUomValue') {
180
+ return { ...column, hidden: true }
181
+ }
182
+ return column
183
+ })
184
+ }
185
+ }
186
+
187
+ async fetchHandler({ page, limit, sorters = [] }) {
188
+ try {
189
+ if (!this.inventoryId && !this.cycleCountNo) return
190
+
191
+ const pagination = { page, limit }
192
+ const sortings = sorters
193
+
194
+ const filters = [
195
+ { name: 'inventoryId', operator: 'eq', value: this.inventoryId },
196
+ { name: 'cycleCountNo', operator: 'eq', value: this.cycleCountNo }
197
+ ]
198
+
199
+ const response = await client.query({
200
+ query: gql`
201
+ query inventoryCheckItems($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
202
+ inventoryCheckItems(filters: $filters, pagination: $pagination, sortings: $sortings) {
203
+ items {
204
+ id
205
+ name
206
+ countNo
207
+ originBatchNo
208
+ inspectedBatchNo
209
+ originLocation {
210
+ id
211
+ name
212
+ }
213
+ inspectedLocation {
214
+ id
215
+ name
216
+ description
217
+ }
218
+ originUomValue
219
+ inspectedUomValue
220
+ bizplace {
221
+ id
222
+ name
223
+ description
224
+ }
225
+ updater {
226
+ name
227
+ description
228
+ }
229
+ }
230
+ total
231
+ }
232
+ }
233
+ `,
234
+ variables: {
235
+ filters,
236
+ pagination,
237
+ sortings
238
+ },
239
+ context: gqlContext()
240
+ })
241
+
242
+ if (!response.errors) {
243
+ this.data = {
244
+ total: response.data.inventoryCheckItems.total || 0,
245
+ records:
246
+ response.data.inventoryCheckItems.items.map(itm => {
247
+ return {
248
+ ...itm,
249
+ countNo: itm.countNo,
250
+ inspectedBatchNo: itm.inspectedBatchNo,
251
+ originLocationName: itm.originLocation ? itm.originLocation.name : null,
252
+ inspectedLocationName: itm.inspectedLocation ? itm.inspectedLocation.name : null,
253
+ originUomValue: itm.originUomValue,
254
+ inspectedUomValue: itm.inspectedUomValue
255
+ }
256
+ }) || []
257
+ }
258
+ }
259
+ } catch (e) {
260
+ this._showToast(e)
261
+ }
262
+ }
263
+
264
+ _getStdDate() {
265
+ let date = new Date()
266
+ date.setDate(date.getDate())
267
+ return date.toISOString().split('T')[0]
268
+ }
269
+
270
+ _showToast({ type, message }) {
271
+ document.dispatchEvent(
272
+ new CustomEvent('notify', {
273
+ detail: {
274
+ type,
275
+ message
276
+ }
277
+ })
278
+ )
279
+ }
280
+ }
281
+
282
+ window.customElements.define('cycle-count-inventory-details-popup', CycleCountInventoryDetailsPopup)
@@ -8,6 +8,7 @@ import { css, html, LitElement } from 'lit-element'
8
8
  class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
9
9
  static get properties() {
10
10
  return {
11
+ enableCartonLabel: Boolean,
11
12
  cycleCountNo: String,
12
13
  inventories: Array,
13
14
  customerId: String,
@@ -130,17 +131,23 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
130
131
  columns: [
131
132
  { type: 'gutter', gutterName: 'sequence' },
132
133
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
134
+ {
135
+ type: 'string',
136
+ name: 'cartonId',
137
+ header: i18next.t('field.carton_id'),
138
+ width: 120
139
+ },
133
140
  {
134
141
  type: 'string',
135
142
  name: 'palletId',
136
143
  header: i18next.t('field.lot_id'),
137
- width: 150
144
+ width: 120
138
145
  },
139
146
  {
140
147
  type: 'object',
141
148
  name: 'product',
142
149
  header: i18next.t('field.product'),
143
- width: 350
150
+ width: 320
144
151
  },
145
152
  {
146
153
  type: 'string',
@@ -206,10 +213,21 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
206
213
  type: 'string',
207
214
  name: 'status',
208
215
  header: i18next.t('field.status'),
209
- width: 100
216
+ width: 150
210
217
  }
211
218
  ]
212
219
  }
220
+ this._updateConfig()
221
+ }
222
+
223
+ _updateConfig() {
224
+ this.config.columns = this.config.columns.filter(column => {
225
+ if (this.enableCartonLabel) {
226
+ return column.name !== 'palletId'
227
+ } else {
228
+ return column.name !== 'cartonId'
229
+ }
230
+ })
213
231
  }
214
232
 
215
233
  updated(changedProps) {
@@ -225,6 +243,7 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
225
243
  notTallyTargetInventories(cycleCountNo: $cycleCountNo) {
226
244
  id
227
245
  inventory {
246
+ cartonId
228
247
  palletId
229
248
  uom
230
249
  product {
@@ -248,6 +267,16 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
248
267
  originUomValue
249
268
  inspectedUomValue
250
269
  status
270
+ product {
271
+ sku
272
+ name
273
+ description
274
+ }
275
+ productDetail {
276
+ id
277
+ packingType
278
+ uom
279
+ }
251
280
  }
252
281
  }
253
282
  `,
@@ -257,26 +286,54 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
257
286
  })
258
287
 
259
288
  if (!response.errors) {
260
- this.data = {
261
- records: response.data.notTallyTargetInventories.map(targetInv => {
262
- return {
263
- id: targetInv.id,
264
- batchId: targetInv.originBatchNo,
265
- inspectedBatchNo: targetInv.inspectedBatchNo,
266
- palletId: targetInv.inventory.palletId,
267
- product: targetInv.inventory.product,
268
- packingType: targetInv.inventory.packingType,
269
- location: targetInv.originLocation,
270
- inspectedLocation: targetInv.inspectedLocation,
271
- qty: targetInv.originQty,
272
- inspectedQty: targetInv.inspectedQty,
273
- uomValue: targetInv.originUomValue,
274
- uom: targetInv.inventory && targetInv.inventory.uom,
275
- inspectedUomValue: targetInv.inspectedUomValue,
276
- status: targetInv.status
289
+ let records = response.data.notTallyTargetInventories.map(targetInv => {
290
+ return {
291
+ id: targetInv.id,
292
+ batchId: targetInv.originBatchNo,
293
+ inspectedBatchNo: targetInv?.inspectedBatchNo,
294
+ cartonId: targetInv.inventory?.cartonId,
295
+ palletId: targetInv.inventory?.palletId,
296
+ product: targetInv.inventory?.product ? targetInv.inventory.product : targetInv.product,
297
+ productDetail: targetInv.productDetail,
298
+ packingType: targetInv.inventory?.packingType
299
+ ? targetInv.inventory.packingType
300
+ : targetInv.productDetail.packingType,
301
+ location: targetInv.originLocation || '',
302
+ inspectedLocation: targetInv.inspectedLocation || '',
303
+ qty: targetInv?.originQty,
304
+ inspectedQty: targetInv?.inspectedQty,
305
+ uomValue: targetInv.originUomValue,
306
+ uom: targetInv?.inventory && targetInv.inventory?.uom,
307
+ inspectedUomValue: targetInv.inspectedUomValue,
308
+ status: targetInv.status
309
+ }
310
+ })
311
+
312
+ let groupedTotal = 0
313
+
314
+ if (this.enableCartonLabel) {
315
+ const groupedRecords = {}
316
+
317
+ records.forEach(record => {
318
+ const groupKey = `${record.cartonId || ''}-${record.batchId || ''}-${record.productDetail.id || ''}-${
319
+ record.location.name || ''
320
+ }`
321
+
322
+ if (!groupedRecords[groupKey]) {
323
+ groupedRecords[groupKey] = { ...record, count: 1 }
324
+ groupedTotal++
325
+ } else {
326
+ groupedRecords[groupKey].qty += record.qty || 0
327
+ groupedRecords[groupKey].inspectedQty += Number(record.inspectedQty) || 0
328
+ groupedRecords[groupKey].uomValue += record.uomValue || 0
329
+ groupedRecords[groupKey].inspectedUomValue += record.inspectedUomValue || 0
330
+ groupedRecords[groupKey].count += 1
277
331
  }
278
332
  })
333
+
334
+ records = Object.values(groupedRecords)
279
335
  }
336
+ this.data = { records, total: groupedTotal || records.length }
280
337
  }
281
338
  }
282
339
 
@@ -295,33 +352,74 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
295
352
  return
296
353
  }
297
354
 
298
- const orderInventoryIds = this.grist.selected.map(record => record.id)
299
- const response = await client.mutate({
300
- mutation: gql`
355
+ // Variables for the mutation, structured based on the condition
356
+ let variables = {
357
+ executionDate: this.executionDateInput.value,
358
+ customerId: this.customerId,
359
+ cycleCountNo: this.cycleCountNo
360
+ }
361
+
362
+ let mutation
363
+ if (this.enableCartonLabel) {
364
+ variables.cartonIds = this.grist.selected.map(record => record.cartonId)
365
+ variables.batchIds = this.grist.selected.map(record => record.batchId)
366
+ variables.productDetailIds = this.grist.selected.map(record => record.productDetail.id)
367
+ variables.locationNames = this.grist.selected.map(record => record.location.name)
368
+
369
+ mutation = gql`
370
+ mutation generateCycleCountWorksheetCarton(
371
+ $executionDate: String!
372
+ $customerId: String!
373
+ $cycleCountNo: String
374
+ $cartonIds: [String]
375
+ $batchIds: [String]
376
+ $productDetailIds: [String]
377
+ $locationNames: [String]
378
+ ) {
379
+ generateCycleCountWorksheetCarton(
380
+ executionDate: $executionDate
381
+ customerId: $customerId
382
+ cycleCountNo: $cycleCountNo
383
+ cartonIds: $cartonIds
384
+ batchIds: $batchIds
385
+ productDetailIds: $productDetailIds
386
+ locationNames: $locationNames
387
+ ) {
388
+ name
389
+ }
390
+ }
391
+ `
392
+ } else {
393
+ variables.inventoryCheckItemIds = this.grist.selected.map(record => record.id)
394
+
395
+ mutation = gql`
301
396
  mutation generateCycleCountWorksheet(
302
397
  $executionDate: String!
303
398
  $customerId: String!
304
- $orderInventoryIds: [String]
399
+ $inventoryCheckItemIds: [String]
400
+ $cycleCountNo: String
305
401
  ) {
306
402
  generateCycleCountWorksheet(
307
403
  executionDate: $executionDate
308
404
  customerId: $customerId
309
- orderInventoryIds: $orderInventoryIds
405
+ inventoryCheckItemIds: $inventoryCheckItemIds
406
+ cycleCountNo: $cycleCountNo
310
407
  ) {
311
408
  name
312
409
  }
313
410
  }
314
- `,
315
- variables: {
316
- executionDate: this.executionDateInput.value,
317
- customerId: this.customerId,
318
- orderInventoryIds
319
- }
411
+ `
412
+ }
413
+
414
+ const response = await client.mutate({
415
+ mutation: mutation,
416
+ variables: variables
320
417
  })
321
418
 
322
419
  if (!response.errors) {
323
420
  this.dispatchEvent(new CustomEvent('completed'))
324
421
  history.back()
422
+ this.showToast({ message: i18next.t('text.cycle_count_worksheet_created') })
325
423
  }
326
424
  } catch (e) {
327
425
  this.showToast(e)