@things-factory/operato-wms 4.3.300 → 4.3.302

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 (36) hide show
  1. package/client/pages/inventory/onhand-inventory.js +23 -19
  2. package/client/pages/outbound/route-label-popup.js +56 -3
  3. package/client/pages/report/analysis-picking-packing-report.js +490 -0
  4. package/client/pages/report/outbound-order-details-report.js +1 -0
  5. package/client/pages/report/shortage-report.js +475 -0
  6. package/client/route.js +8 -0
  7. package/dist-server/graphql/resolvers/reports/analysis-picking-packing-report.js +128 -0
  8. package/dist-server/graphql/resolvers/reports/analysis-picking-packing-report.js.map +1 -0
  9. package/dist-server/graphql/resolvers/reports/index.js +5 -3
  10. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  11. package/dist-server/graphql/resolvers/reports/shortage-report.js +115 -0
  12. package/dist-server/graphql/resolvers/reports/shortage-report.js.map +1 -0
  13. package/dist-server/graphql/types/reports/analysis-picking-packing-report-list.js +14 -0
  14. package/dist-server/graphql/types/reports/analysis-picking-packing-report-list.js.map +1 -0
  15. package/dist-server/graphql/types/reports/analysis-picking-packing-report.js +18 -0
  16. package/dist-server/graphql/types/reports/analysis-picking-packing-report.js.map +1 -0
  17. package/dist-server/graphql/types/reports/index.js +19 -9
  18. package/dist-server/graphql/types/reports/index.js.map +1 -1
  19. package/dist-server/graphql/types/reports/shortage-report-list.js +14 -0
  20. package/dist-server/graphql/types/reports/shortage-report-list.js.map +1 -0
  21. package/dist-server/graphql/types/reports/shortage-report-type.js +25 -0
  22. package/dist-server/graphql/types/reports/shortage-report-type.js.map +1 -0
  23. package/package.json +8 -8
  24. package/server/graphql/resolvers/reports/analysis-picking-packing-report.ts +146 -0
  25. package/server/graphql/resolvers/reports/index.ts +11 -5
  26. package/server/graphql/resolvers/reports/shortage-report.ts +132 -0
  27. package/server/graphql/types/reports/analysis-picking-packing-report-list.ts +8 -0
  28. package/server/graphql/types/reports/analysis-picking-packing-report.ts +12 -0
  29. package/server/graphql/types/reports/index.ts +27 -14
  30. package/server/graphql/types/reports/shortage-report-list.ts +8 -0
  31. package/server/graphql/types/reports/shortage-report-type.ts +19 -0
  32. package/things-factory.config.js +10 -0
  33. package/translations/en.json +7 -0
  34. package/translations/ko.json +7 -0
  35. package/translations/ms.json +7 -0
  36. package/translations/zh.json +7 -0
@@ -2,14 +2,27 @@ import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
3
 
4
4
  import gql from 'graphql-tag'
5
- import { css, html } from 'lit-element'
5
+ import {
6
+ css,
7
+ html
8
+ } from 'lit-element'
6
9
  import { connect } from 'pwa-helpers/connect-mixin'
7
10
 
8
11
  import { getCodeByName } from '@things-factory/code-base'
9
- import { i18next, localize } from '@things-factory/i18n-base'
10
- import { client, PageView, store } from '@things-factory/shell'
12
+ import {
13
+ i18next,
14
+ localize
15
+ } from '@things-factory/i18n-base'
16
+ import {
17
+ client,
18
+ PageView,
19
+ store
20
+ } from '@things-factory/shell'
11
21
  import { ScrollbarStyles } from '@things-factory/styles'
12
- import { flattenObject, isMobileDevice } from '@things-factory/utils'
22
+ import {
23
+ flattenObject,
24
+ isMobileDevice
25
+ } from '@things-factory/utils'
13
26
 
14
27
  class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
15
28
  static get styles() {
@@ -423,6 +436,7 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
423
436
  packingType
424
437
  uom
425
438
  uomValue
439
+ expiry
426
440
  bizplace {
427
441
  id
428
442
  name
@@ -435,6 +449,8 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
435
449
  brand
436
450
  description
437
451
  volume
452
+ outboundAlert
453
+ minOutboundShelfLife
438
454
  }
439
455
  qty
440
456
  remainQty
@@ -481,6 +497,9 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
481
497
  }
482
498
  })
483
499
 
500
+ // Logging response for debugging
501
+ console.log(response);
502
+
484
503
  return {
485
504
  total: response.data.onhandInventories.total || 0,
486
505
  records:
@@ -496,7 +515,6 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
496
515
  volume: parseFloat(item.product.volume * item.remainQty).toFixed(2),
497
516
  // Need to move to serverside processing and fetch with db query for consistent performance
498
517
  condition: this.getCondition(item.location.type),
499
- expiry: this.getStatus(item.expirationDate)
500
518
  // Need to move to serverside processing and fetch with db query for consistent performance
501
519
  },
502
520
  '_'
@@ -520,23 +538,9 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
520
538
  return 'Damage'
521
539
  case 'QUARANTINE':
522
540
  return 'Quarantine'
523
- default:
524
- return ''
525
541
  }
526
542
  }
527
543
 
528
- getStatus(exp_date, outbound_alert, min_outbound_shelf_life) {
529
- const now = new Date()
530
- if (exp_date < now) {
531
- return 'Expired'
532
- } else if (exp_date > outbound_alert) {
533
- return 'Expiring'
534
- } else if (exp_date >= outbound_alert && exp_date <= min_outbound_shelf_life) {
535
- return 'Risky'
536
- } else {
537
- return 'Normal'
538
- }
539
- }
540
544
  // Need to move to serverside processing and fetch with db query for consistent performance
541
545
 
542
546
  async _fetchPartners() {
@@ -178,6 +178,7 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
178
178
  .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
179
179
  .config=${this.config}
180
180
  .fetchHandler=${this.fetchHandler.bind(this)}
181
+ @field-change="${this._packingSizeChange.bind(this)}"
181
182
  ></data-grist>
182
183
  </div>
183
184
 
@@ -241,6 +242,38 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
241
242
  sortable: true,
242
243
  width: 150
243
244
  },
245
+ {
246
+ type: 'select',
247
+ name: 'packingType',
248
+ header: i18next.t('field.packing_type'),
249
+ record: {
250
+ options: [''],
251
+ editable: true
252
+ },
253
+ handlers: {
254
+ click: (columns, data, column, record, rowIndex) => {
255
+ if (
256
+ !record ||
257
+ JSON.stringify(this.dataGrist._config.columns.find(c => c.name === 'packingType').record.options) ===
258
+ JSON.stringify(record.productDetails.map(item => item.packingType))
259
+ ) {
260
+ return
261
+ }
262
+ this.dataGrist._config.columns
263
+ .filter(c => c.name === 'packingType')
264
+ .map(items => (items.record.options = record.productDetails.map(pd => pd.packingType)))
265
+ this.dataGrist.render()
266
+ }
267
+ },
268
+ sortable: true,
269
+ width: 150
270
+ },
271
+ {
272
+ type: 'integer',
273
+ name: 'packingSize',
274
+ header: i18next.t('field.packing_size'),
275
+ width: 150
276
+ },
244
277
  {
245
278
  type: 'integer',
246
279
  name: 'releaseQty',
@@ -322,6 +355,14 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
322
355
  productName
323
356
  releaseQty
324
357
  releaseGoodName
358
+ productDetails {
359
+ packingType
360
+ packingSize
361
+ }
362
+ productDetail {
363
+ packingType
364
+ packingSize
365
+ }
325
366
  routeId
326
367
  storeId
327
368
  storeName
@@ -354,7 +395,9 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
354
395
  ...itm,
355
396
  roName: itm.releaseGoodName,
356
397
  productSku: itm.productSKU,
357
- createdAt: createdAt
398
+ createdAt: createdAt,
399
+ packingType: itm.productDetail.packingType,
400
+ packingSize: itm.productDetail.packingSize
358
401
  }
359
402
  }) || {}
360
403
  })
@@ -364,6 +407,16 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
364
407
  }
365
408
  }
366
409
 
410
+ async _packingSizeChange(e) {
411
+ const selectedColumn = e.detail.column.name
412
+
413
+ if (selectedColumn === 'packingType') {
414
+ this.dataGrist._data.records[e.detail.row].packingSize = e.detail.record.productDetails.find(
415
+ item => item.packingType == e.detail.after
416
+ ).packingSize
417
+ }
418
+ }
419
+
367
420
  async _printRouteLabel() {
368
421
  const records = this.dataGrist.selected
369
422
  let labelId = this._routeLabel && this._routeLabel.id
@@ -379,7 +432,7 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
379
432
  } else {
380
433
  let index = 1
381
434
  for (var record of records) {
382
- let max = record.releaseQty ? record.releaseQty : 1
435
+ let max = record.releaseQty ? record.releaseQty / record.packingSize : 1
383
436
  for (let qty = 1; qty <= max; qty++) {
384
437
  var searchParams = new URLSearchParams()
385
438
 
@@ -391,7 +444,7 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
391
444
  if (!record?.toteNumber) {
392
445
  searchParams.append('qty', record.qty)
393
446
  searchParams.append('releaseQty', record.releaseQty)
394
- searchParams.append('counter', `${qty} of ${record.releaseQty}`)
447
+ searchParams.append('counter', `${qty} of ${max}`)
395
448
  searchParams.append('productSku', record.productSku)
396
449
  searchParams.append('productName', record.productName)
397
450
  } else {
@@ -0,0 +1,490 @@
1
+ import '@things-factory/form-ui'
2
+ import '@things-factory/grist-ui'
3
+
4
+ import gql from 'graphql-tag'
5
+ import {
6
+ css,
7
+ html
8
+ } from 'lit-element'
9
+ import { connect } from 'pwa-helpers/connect-mixin'
10
+
11
+ import {
12
+ i18next,
13
+ localize
14
+ } from '@things-factory/i18n-base'
15
+ import {
16
+ client,
17
+ gqlContext,
18
+ PageView,
19
+ store
20
+ } from '@things-factory/shell'
21
+ import { isMobileDevice } from '@things-factory/utils'
22
+
23
+ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(PageView)) {
24
+ static get styles() {
25
+ return css`
26
+ :host {
27
+ display: flex;
28
+ flex-direction: column;
29
+ width: 100%;
30
+ }
31
+
32
+ data-grist {
33
+ overflow-y: auto;
34
+ flex: 1;
35
+ }
36
+ `
37
+ }
38
+
39
+ static get properties() {
40
+ return {
41
+ _searchFields: Object,
42
+ _config: Object,
43
+ _gristData: Object,
44
+ data: Object
45
+ }
46
+ }
47
+
48
+ get context() {
49
+ return {
50
+ title: i18next.t('title.analytics_report'),
51
+ exportable: {
52
+ name: i18next.t('title.analytics_report'),
53
+ data: this._exportableData.bind(this)
54
+ },
55
+ help: ''
56
+ }
57
+ }
58
+
59
+ get dataGrist() {
60
+ return this.shadowRoot.querySelector('data-grist')
61
+ }
62
+
63
+ get searchForm() {
64
+ return this.shadowRoot.querySelector('search-form')
65
+ }
66
+
67
+ get _bizplaceSelector() {
68
+ return this.searchForm.shadowRoot.querySelector('select[name=bizplace]')
69
+ }
70
+
71
+ get _fromDateInput() {
72
+ return this.searchForm.shadowRoot.querySelector('input[name=fromDate]')
73
+ }
74
+
75
+ get _toDateInput() {
76
+ return this.searchForm.shadowRoot.querySelector('input[name=toDate]')
77
+ }
78
+
79
+ render() {
80
+ return html`
81
+ <search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
82
+
83
+ <data-grist
84
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
85
+ .config=${this._config}
86
+ .fetchHandler="${this.fetchHandler.bind(this)}"
87
+ ></data-grist>
88
+ `
89
+ }
90
+
91
+ get searchFields() {
92
+ const sortingOptions = [
93
+ { name: i18next.t('label.desc'), value: 'desc' },
94
+ { name: i18next.t('label.asc'), value: 'asc' }
95
+ ]
96
+
97
+ const sortingTypes = [
98
+ { name: i18next.t('label.packing'), value: 'packing' },
99
+ { name: i18next.t('label.picking'), value: 'picking' }
100
+ ]
101
+
102
+ return [
103
+ {
104
+ label: i18next.t('field.company'),
105
+ name: 'bizplace',
106
+ type: 'select',
107
+ options: [
108
+ { value: '' },
109
+ ...this._partners
110
+ .map(partner => {
111
+ return {
112
+ name: `${partner.name} ${partner.description ? `(${partner.description})` : ''}`,
113
+ value: partner.id
114
+ }
115
+ })
116
+ .sort(this._compareValues('name', 'asc'))
117
+ ],
118
+ props: { searchOper: 'eq' }
119
+ },
120
+ {
121
+ label: i18next.t('field.from_date'),
122
+ name: 'fromDate',
123
+ type: 'date',
124
+ props: {
125
+ searchOper: 'eq',
126
+ max: new Date().toISOString().split('T')[0]
127
+ },
128
+ value: (() => {
129
+ let date = new Date()
130
+ date.setMonth(date.getMonth() - 1)
131
+ return date.toISOString().split('T')[0]
132
+ })(),
133
+ handlers: { change: this._modifyDateRange.bind(this) }
134
+ },
135
+ {
136
+ label: i18next.t('field.to_date'),
137
+ name: 'toDate',
138
+ type: 'date',
139
+ props: {
140
+ searchOper: 'eq',
141
+ min: (() => {
142
+ let date = new Date()
143
+ date.setMonth(date.getMonth() - 1)
144
+ return date.toISOString().split('T')[0]
145
+ })(),
146
+ max: new Date().toISOString().split('T')[0]
147
+ },
148
+ value: new Date().toISOString().split('T')[0],
149
+ handlers: { change: this._submit.bind(this) }
150
+ },
151
+ {
152
+ label: i18next.t('field.name'),
153
+ name: 'name',
154
+ type: 'string',
155
+ props: { searchOper: 'custom' }
156
+ },
157
+ {
158
+ label: i18next.t('field.rate'),
159
+ name: 'rate',
160
+ type: 'select',
161
+ options: sortingOptions,
162
+ props: { searchOper: 'eq' }
163
+ },
164
+ {
165
+ label: i18next.t('field.type'),
166
+ name: 'type',
167
+ type: 'select',
168
+ options: sortingTypes,
169
+ props: { searchOper: 'eq' }
170
+ }
171
+ ]
172
+ }
173
+
174
+ get reportConfig() {
175
+ const getTimeRangeHeader = hour => {
176
+ const now = new Date()
177
+ now.setHours(hour)
178
+ const next = new Date(now)
179
+ next.setHours(now.getHours() + 1)
180
+ return `${now.toLocaleString('en-US', { hour: 'numeric', hour12: true })} - ${next.toLocaleString('en-US', {
181
+ hour: 'numeric',
182
+ hour12: true
183
+ })}`
184
+ }
185
+
186
+ const timeRangeColumns = Array.from({ length: 12 }, (_, i) => {
187
+ const startHour = i + 7
188
+ const header = getTimeRangeHeader(startHour)
189
+ return {
190
+ type: 'string',
191
+ name: `${startHour}`,
192
+ header: header,
193
+ record: { editable: false, align: 'center' },
194
+ width: 120
195
+ }
196
+ })
197
+
198
+ let columns = [
199
+ { type: 'gutter', gutterName: 'sequence' },
200
+ {
201
+ type: 'string',
202
+ name: 'name',
203
+ header: i18next.t('field.name'),
204
+ width: 200
205
+ },
206
+ ...timeRangeColumns, // Using the time range columns array directly
207
+ {
208
+ type: 'float',
209
+ name: 'totalDaysWorked',
210
+ header: i18next.t('field.total_days_worked'),
211
+ width: 160
212
+ },
213
+ {
214
+ type: 'float',
215
+ name: 'totalPacks',
216
+ header: i18next.t('field.total_pack'),
217
+ width: 110,
218
+ align: 'center'
219
+ },
220
+ {
221
+ type: 'float',
222
+ name: 'totalHoursWorked',
223
+ header: i18next.t('field.total_hours_worked'),
224
+ width: 170
225
+ },
226
+ {
227
+ type: 'float',
228
+ name: 'packingRate',
229
+ header: i18next.t('field.packing_rate'),
230
+ width: 150
231
+ }
232
+ ]
233
+
234
+ let list = {
235
+ fields: [
236
+ 'name',
237
+ '7AM-8AM',
238
+ '8AM-9AM',
239
+ '9AM-10AM',
240
+ '10AM-11AM',
241
+ '11AM-12PM',
242
+ '12PM-1PM',
243
+ '1PM-2PM',
244
+ '2PM-3PM',
245
+ '3PM-4PM',
246
+ '4PM-5PM',
247
+ '5PM-6PM',
248
+ '6PM-7PM',
249
+ 'totalDaysWorked',
250
+ 'totalPacks',
251
+ 'totalHoursWorked',
252
+ 'packingRate'
253
+ ]
254
+ }
255
+
256
+ return {
257
+ columns: columns,
258
+ list,
259
+ pagination: { limit: 50, pages: [100, 200, 500, 1000] },
260
+ rows: {
261
+ selectable: false,
262
+ insertable: false,
263
+ appendable: false
264
+ }
265
+ }
266
+ }
267
+
268
+ async pageInitialized() {
269
+ this._gristData = { total: 0, records: [] }
270
+ const [_partnersReq] = await Promise.allSettled([this._fetchPartners()])
271
+
272
+ this._partners = _partnersReq.status == 'fulfilled' ? _partnersReq.value : []
273
+
274
+ this._searchFields = this.searchFields
275
+ this._config = this.reportConfig
276
+ }
277
+
278
+ async fetchHandler({ page, limit, sorters = [] }) {
279
+ try {
280
+ this._validate()
281
+ let filters = this.searchForm.queryFilters.map(filter => {
282
+ switch (filter.name) {
283
+ case 'fromDate':
284
+ let fromDt = new Date(filter.value)
285
+ fromDt.setHours(0)
286
+ filter.value = fromDt.toISOString()
287
+ break
288
+ case 'toDate':
289
+ let toDt = new Date(filter.value)
290
+ toDt.setHours(23, 59, 59)
291
+ filter.value = toDt.toISOString()
292
+ break
293
+ default:
294
+ break
295
+ }
296
+ return filter
297
+ })
298
+
299
+ const pagination = { page, limit }
300
+ const sortings = sorters
301
+
302
+ const response = await client.query({
303
+ query: gql`
304
+ query analysisPickingPackingReport($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
305
+ analysisPickingPackingReport(filters: $filters, pagination: $pagination, sortings: $sortings) {
306
+ items {
307
+ name
308
+ hourlyData
309
+ totalDaysWorked
310
+ totalPacks
311
+ totalHoursWorked
312
+ packingRate
313
+ }
314
+ total
315
+ }
316
+ }
317
+ `,
318
+ variables: { filters, pagination, sortings },
319
+ context: gqlContext()
320
+ })
321
+
322
+ const data = {
323
+ total: response.data.analysisPickingPackingReport.total,
324
+ records:
325
+ response.data.analysisPickingPackingReport.items.map(i=> {
326
+ let hourlyData = JSON.parse(i.hourlyData)
327
+ return {
328
+ ...i,
329
+ ...hourlyData
330
+ }
331
+ }) || []
332
+ }
333
+
334
+ this._gristData = {
335
+ ...data
336
+ }
337
+
338
+ return data
339
+ } catch (e) {
340
+ this._showToast(e)
341
+ }
342
+
343
+ }
344
+
345
+ async _fetchPartners() {
346
+ const filters = []
347
+ const response = await client.query({
348
+ query: gql`
349
+ query partnersBizplaces($filters: [Filter!]) {
350
+ partnersBizplaces(filters: $filters) {
351
+ items {
352
+ id
353
+ name
354
+ description
355
+ }
356
+ }
357
+ }
358
+ `,
359
+ variables: { filters }
360
+ })
361
+
362
+ if (!response.errors) {
363
+ return response.data.partnersBizplaces.items
364
+ }
365
+ }
366
+
367
+ _validate() {
368
+ if (!this.searchForm.shadowRoot.querySelector('form').checkValidity())
369
+ throw new Error(i18next.t('text.invalid_form_value'))
370
+ if (!this._bizplaceSelector.value) throw new Error(i18next.t('text.no_company_selected'))
371
+ if (!this._fromDateInput.value) throw new Error(i18next.t('text.from_date_is_empty'))
372
+ if (!this._toDateInput.value) throw new Error(i18next.t('text.to_date_is_empty'))
373
+ }
374
+
375
+ _compareValues(key, order = 'asc') {
376
+ return function innerSort(a, b) {
377
+ if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
378
+ return 0
379
+ }
380
+
381
+ const varA = typeof a[key] === 'string' ? a[key].toUpperCase() : a[key]
382
+ const varB = typeof b[key] === 'string' ? b[key].toUpperCase() : b[key]
383
+
384
+ let comparison = 0
385
+ if (varA > varB) {
386
+ comparison = 1
387
+ } else if (varA < varB) {
388
+ comparison = -1
389
+ }
390
+ return order === 'desc' ? comparison * -1 : comparison
391
+ }
392
+ }
393
+
394
+ _modifyDateRange(e) {
395
+ const fromDate = e.currentTarget.value
396
+
397
+ if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
398
+
399
+ let min = new Date(fromDate).toISOString().split('T')[0]
400
+ this._toDateInput.min = min
401
+ this._submit()
402
+ }
403
+
404
+ _submit(e) {
405
+ this._config = { ...this.reportConfig }
406
+ this.searchForm.submit()
407
+ }
408
+
409
+ async _exportableData() {
410
+ try {
411
+ const getTimeRangeHeader = hour => {
412
+ const now = new Date();
413
+ now.setHours(hour);
414
+ const next = new Date(now);
415
+ next.setHours(now.getHours() + 1);
416
+ return `${now.toLocaleString('en-US', { hour: 'numeric', hour12: true })} - ${next.toLocaleString('en-US', {
417
+ hour: 'numeric',
418
+ hour12: true
419
+ })}`;
420
+ };
421
+
422
+ const timeRangeColumns = Array.from({ length: 12 }, (_, i) => {
423
+ const startHour = i + 7;
424
+ const header = getTimeRangeHeader(startHour);
425
+ const key = `${startHour}`;
426
+ return {
427
+ type: 'number',
428
+ name: `${startHour}`,
429
+ header: header,
430
+ key: key,
431
+ record: { editable: false, align: 'center' },
432
+ width: 20
433
+ };
434
+ });
435
+
436
+ const headerSetting = [
437
+ { header: i18next.t('field.name'), key: 'name', width: 30, type: 'string' },
438
+ ...timeRangeColumns,
439
+ { header: i18next.t('field.total_days_worked'), key: 'totalDaysWorked', width: 30, type: 'float' },
440
+ { header: i18next.t('field.total_pack'), key: 'totalPacks', width: 30, type: 'float' },
441
+ { header: i18next.t('field.total_hours_worked'), key: 'totalHoursWorked', width: 30, type: 'float' },
442
+ { header: i18next.t('field.packing_rate'), key: 'packingRate', width: 30, type: 'float' }
443
+ ];
444
+
445
+ let data = (await this.fetchHandler({ page: 1, limit: 9999999 })).records.map(itm => {
446
+ const hourlyData = JSON.parse(itm.hourlyData); // Parse the hourly data from JSON
447
+ const timeRangeData = Array.from({ length: 12 }, (_, i) => {
448
+ const startHour = i + 7;
449
+ const key = `${startHour}`;
450
+ const value = parseFloat(hourlyData[startHour.toString()]) || 0; // Convert to number
451
+ return {
452
+ [key]: value
453
+ };
454
+ }).reduce((obj, item) => ({ ...obj, ...item }), {});
455
+
456
+ return {
457
+ ...timeRangeData,
458
+ name: itm.name,
459
+ totalDaysWorked: itm.totalDaysWorked,
460
+ totalPacks: itm.totalPacks,
461
+ totalHoursWorked: itm.totalHoursWorked,
462
+ packingRate: itm.packingRate
463
+ };
464
+ });
465
+
466
+ var exportData = {
467
+ header: [...headerSetting],
468
+ data
469
+ };
470
+
471
+ return exportData;
472
+
473
+ } catch (e) {
474
+ this._showToast(e);
475
+ }
476
+ }
477
+
478
+ _showToast({ type, message }) {
479
+ document.dispatchEvent(
480
+ new CustomEvent('notify', {
481
+ detail: {
482
+ type,
483
+ message
484
+ }
485
+ })
486
+ )
487
+ }
488
+ }
489
+
490
+ window.customElements.define('analysis-picking-packing-report', AnalysisPickingPackingReport)
@@ -963,6 +963,7 @@ class OutboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVi
963
963
  { header: i18next.t('field.remark_checked_at'), key: 'checkedRemarkAt', width: 15, type: 'string' },
964
964
  { header: i18next.t('field.loaded_by'), key: 'loadedBy', width: 15, type: 'string' },
965
965
  { header: i18next.t('field.loaded_at'), key: 'loadedAt', width: 15, type: 'string' },
966
+ { header: i18next.t('field.picking_bin'), key: 'binLocation', width: 15, type: 'string' },
966
967
  { header: i18next.t('field.manifested_by'), key: 'manifestedBy', width: 15, type: 'string' },
967
968
  { header: i18next.t('field.manifested_at'), key: 'manifestedAt', width: 15, type: 'string' },
968
969
  { header: i18next.t('field.dispatched_at'), key: 'dispatchedAt', width: 15, type: 'string' }