@things-factory/operato-wms 4.3.642 → 4.3.644

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 (64) hide show
  1. package/client/pages/outbound/loading-v2/loading-execution-base.js +625 -153
  2. package/client/pages/outbound/loading-v2/loading-execution.js +239 -139
  3. package/client/pages/outbound/loading-v2/loading.js +297 -179
  4. package/client/pages/outbound/loading-v2/release-good-info.js +8 -8
  5. package/client/pages/outbound/picking-v2/picking.js +4 -0
  6. package/client/pages/outbound/show-ro-list-popup.js +17 -3
  7. package/client/pages/report/billing-module-report.js +421 -0
  8. package/client/route.js +4 -0
  9. package/dist-server/graphql/resolvers/outbound/complete-load.js +6 -1
  10. package/dist-server/graphql/resolvers/outbound/complete-load.js.map +1 -1
  11. package/dist-server/graphql/resolvers/outbound/find-loadable-release-good-by-bin.js +148 -0
  12. package/dist-server/graphql/resolvers/outbound/find-loadable-release-good-by-bin.js.map +1 -0
  13. package/dist-server/graphql/resolvers/outbound/find-loadable-release-good.js +67 -13
  14. package/dist-server/graphql/resolvers/outbound/find-loadable-release-good.js.map +1 -1
  15. package/dist-server/graphql/resolvers/outbound/get-delivery-orders.js +20 -3
  16. package/dist-server/graphql/resolvers/outbound/get-delivery-orders.js.map +1 -1
  17. package/dist-server/graphql/resolvers/outbound/index.js +2 -1
  18. package/dist-server/graphql/resolvers/outbound/index.js.map +1 -1
  19. package/dist-server/graphql/resolvers/outbound/load-by-qty.js +15 -3
  20. package/dist-server/graphql/resolvers/outbound/load-by-qty.js.map +1 -1
  21. package/dist-server/graphql/resolvers/outbound/loading-worksheet-v2.js +36 -15
  22. package/dist-server/graphql/resolvers/outbound/loading-worksheet-v2.js.map +1 -1
  23. package/dist-server/graphql/resolvers/outbound/sort-item.js +53 -52
  24. package/dist-server/graphql/resolvers/outbound/sort-item.js.map +1 -1
  25. package/dist-server/graphql/resolvers/reports/billing-module-report.js +355 -0
  26. package/dist-server/graphql/resolvers/reports/billing-module-report.js.map +1 -0
  27. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  28. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  29. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +3 -0
  30. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  31. package/dist-server/graphql/resolvers/reports/pg-udf-query.js +5 -3
  32. package/dist-server/graphql/resolvers/reports/pg-udf-query.js.map +1 -1
  33. package/dist-server/graphql/resolvers/zone-worksheet/zone-picking.js +3 -3
  34. package/dist-server/graphql/types/outbound/index.js +2 -1
  35. package/dist-server/graphql/types/outbound/index.js.map +1 -1
  36. package/dist-server/graphql/types/reports/billing-module-report-list.js +14 -0
  37. package/dist-server/graphql/types/reports/billing-module-report-list.js.map +1 -0
  38. package/dist-server/graphql/types/reports/billing-module-report.js +15 -0
  39. package/dist-server/graphql/types/reports/billing-module-report.js.map +1 -0
  40. package/dist-server/graphql/types/reports/index.js +5 -0
  41. package/dist-server/graphql/types/reports/index.js.map +1 -1
  42. package/package.json +4 -4
  43. package/server/graphql/resolvers/outbound/complete-load.ts +6 -1
  44. package/server/graphql/resolvers/outbound/find-loadable-release-good-by-bin.ts +154 -0
  45. package/server/graphql/resolvers/outbound/find-loadable-release-good.ts +82 -16
  46. package/server/graphql/resolvers/outbound/get-delivery-orders.ts +27 -3
  47. package/server/graphql/resolvers/outbound/index.ts +2 -0
  48. package/server/graphql/resolvers/outbound/load-by-qty.ts +19 -7
  49. package/server/graphql/resolvers/outbound/loading-worksheet-v2.ts +116 -22
  50. package/server/graphql/resolvers/outbound/sort-item.ts +56 -58
  51. package/server/graphql/resolvers/reports/billing-module-report.ts +372 -0
  52. package/server/graphql/resolvers/reports/index.ts +2 -0
  53. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +5 -8
  54. package/server/graphql/resolvers/reports/pg-udf-query.ts +15 -13
  55. package/server/graphql/resolvers/zone-worksheet/zone-picking.ts +3 -3
  56. package/server/graphql/types/outbound/index.ts +2 -1
  57. package/server/graphql/types/reports/billing-module-report-list.ts +8 -0
  58. package/server/graphql/types/reports/billing-module-report.ts +9 -0
  59. package/server/graphql/types/reports/index.ts +6 -0
  60. package/things-factory.config.js +4 -0
  61. package/translations/en.json +7 -0
  62. package/translations/ko.json +2 -0
  63. package/translations/ms.json +2 -0
  64. package/translations/zh.json +2 -0
@@ -2,12 +2,135 @@ import '@things-factory/barcode-ui'
2
2
  import '@things-factory/grist-ui'
3
3
  import { css, html } from 'lit-element'
4
4
  import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
5
+ import { WORKSHEET_STATUS } from '../../constants'
5
6
  import { i18next } from '@things-factory/i18n-base'
6
7
  import { isMobileDevice } from '@things-factory/utils'
7
8
  import { LoadingExecutionBase } from './loading-execution-base'
8
9
  import '../../components/list-view/product-list-view'
10
+ import { fetchSettingRule } from '../../../fetch-setting-value'
11
+
12
+ // Constants
13
+ const SETTINGS = {
14
+ QC_SKU: 'qc-sku',
15
+ DISABLE_QC: 'disable-QC-in-loading'
16
+ }
17
+
18
+ const TAB_TYPES = {
19
+ QC: 'QC',
20
+ LOADING: 'LOADING',
21
+ LOADED: 'LOADED'
22
+ }
23
+
24
+ const DEFAULT_TABS = [TAB_TYPES.QC, TAB_TYPES.LOADING, TAB_TYPES.LOADED]
25
+ const LOADING_TABS = [TAB_TYPES.LOADING, TAB_TYPES.LOADED]
26
+
27
+ // List View Configurations
28
+ const QC_LIST_CONFIG = {
29
+ selectable: true,
30
+ columnLeft: {
31
+ size: 8,
32
+ fields: [
33
+ {
34
+ type: 'row',
35
+ content: [
36
+ {
37
+ header: 'Product Name',
38
+ field: 'relatedOrderInv.product.name',
39
+ type: 'string',
40
+ style: '-webkit-line-clamp: 2;'
41
+ }
42
+ ]
43
+ },
44
+ { type: 'row', content: [{ header: 'SKU No.', field: 'relatedOrderInv.product.sku', type: 'string' }] },
45
+ {
46
+ type: 'row',
47
+ content: [
48
+ { header: 'Exp Date', field: 'expirationDate', type: 'string' },
49
+ { header: 'Batch No', field: 'relatedOrderInv.batchId', type: 'string' }
50
+ ]
51
+ },
52
+ {
53
+ type: 'row',
54
+ content: [
55
+ { header: 'Packing Size', field: 'packingSize', type: 'string' },
56
+ { header: 'Packing Type', field: 'relatedOrderInv.packingType', type: 'string' }
57
+ ]
58
+ }
59
+ ]
60
+ },
61
+ columnRight: {
62
+ size: 4,
63
+ fields: [
64
+ {
65
+ type: 'row',
66
+ content: [{ header: 'Bin No.', field: 'binLocation.name', type: 'string', style: 'font-weight: bold;' }]
67
+ },
68
+ {
69
+ type: 'valueBox',
70
+ content: { header: 'QC Qty.', field: 'sortedQty', field2: 'pickedQty', type: 'string' }
71
+ }
72
+ ]
73
+ }
74
+ }
75
+
76
+ const LOADING_LIST_CONFIG = {
77
+ selectable: true,
78
+ columnLeft: {
79
+ size: 8,
80
+ fields: [
81
+ {
82
+ type: 'row',
83
+ content: [
84
+ {
85
+ header: 'Product Name',
86
+ field: 'relatedOrderInv.product.name',
87
+ type: 'string',
88
+ style: '-webkit-line-clamp: 2;'
89
+ }
90
+ ]
91
+ },
92
+ { type: 'row', content: [{ header: 'SKU No.', field: 'relatedOrderInv.product.sku', type: 'string' }] },
93
+ {
94
+ type: 'row',
95
+ content: [
96
+ { header: 'Exp Date', field: 'expirationDate', type: 'string' },
97
+ { header: 'Batch No', field: 'relatedOrderInv.batchId', type: 'string' }
98
+ ]
99
+ },
100
+ {
101
+ type: 'row',
102
+ content: [
103
+ { header: 'Packing Size', field: 'packingSize', type: 'string' },
104
+ { header: 'Packing Type', field: 'relatedOrderInv.packingType', type: 'string' }
105
+ ]
106
+ }
107
+ ]
108
+ },
109
+ columnRight: {
110
+ size: 4,
111
+ fields: [
112
+ {
113
+ type: 'row',
114
+ content: [{ header: 'Bin No.', field: 'binLocation.name', type: 'string', style: 'font-weight: bold;' }]
115
+ },
116
+ {
117
+ type: 'valueBox',
118
+ content: { header: 'Ready Qty.', field: 'sortedQty', field2: 'pickedQty', type: 'string' }
119
+ }
120
+ ]
121
+ }
122
+ }
123
+
9
124
 
10
125
  export class LoadingExecution extends LoadingExecutionBase {
126
+ static get properties() {
127
+ return {
128
+ ...super.properties,
129
+ _useQcSku: { type: Boolean },
130
+ _currentReleaseGood: { type: Object }
131
+ }
132
+ }
133
+
11
134
  static get styles() {
12
135
  return [
13
136
  MultiColumnFormStyles,
@@ -108,13 +231,13 @@ export class LoadingExecution extends LoadingExecutionBase {
108
231
  }
109
232
  .tab-button.active {
110
233
  color: #f3f2f7;
111
- background-color: #007e7f; /* Darker shade for active tab */
234
+ background-color: #007e7f;
112
235
  }
113
236
  .tab-content {
114
- display: none; /* Hide all tab content by default */
237
+ display: none;
115
238
  }
116
239
  .tab-content.active {
117
- display: block; /* Show active tab content */
240
+ display: block;
118
241
  flex: 1;
119
242
  overflow-y: auto;
120
243
  }
@@ -127,10 +250,10 @@ export class LoadingExecution extends LoadingExecutionBase {
127
250
  .order-info {
128
251
  border: none;
129
252
  background: none;
130
- display: flex; /* Use flexbox */
131
- justify-content: space-between; /* Space between items */
132
- align-items: center; /* Center items vertically */
133
- padding: 0 12px 8px; /* Optional: Add some padding */
253
+ display: flex;
254
+ justify-content: space-between;
255
+ align-items: center;
256
+ padding: 0 12px 8px;
134
257
  }
135
258
  `
136
259
  ]
@@ -139,110 +262,9 @@ export class LoadingExecution extends LoadingExecutionBase {
139
262
  constructor() {
140
263
  super()
141
264
  this._executionData = { ...this._executionData, ownCollection: false }
142
- }
143
-
144
- get qcListItemConfig() {
145
- return {
146
- selectable: true,
147
- columnLeft: {
148
- size: 8,
149
- fields: [
150
- {
151
- type: 'row',
152
- content: [
153
- {
154
- header: 'Product Name',
155
- field: 'relatedOrderInv.product.name',
156
- type: 'string',
157
- style: '-webkit-line-clamp: 2;'
158
- }
159
- ]
160
- },
161
- { type: 'row', content: [{ header: 'SKU No.', field: 'relatedOrderInv.product.sku', type: 'string' }] },
162
- {
163
- type: 'row',
164
- content: [
165
- { header: 'Exp Date', field: 'expirationDate', type: 'string' },
166
- { header: 'Batch No', field: 'relatedOrderInv.batchId', type: 'string' }
167
- ]
168
- },
169
- {
170
- type: 'row',
171
- content: [
172
- { header: 'Packing Size', field: 'packingSize', type: 'string' },
173
- { header: 'Packing Type', field: 'relatedOrderInv.packingType', type: 'string' }
174
- ]
175
- }
176
- ]
177
- },
178
- columnRight: {
179
- size: 4,
180
- fields: [
181
- {
182
- type: 'row',
183
- content: [{ header: 'Bin No.', field: 'binLocation.name', type: 'string', style: 'font-weight: bold;' }]
184
- },
185
- {
186
- type: 'valueBox',
187
- content: { header: 'QC Qty.', field: 'sortedQty', field2: 'pickedQty', type: 'string' }
188
- }
189
- ]
190
- }
191
- }
192
- }
193
-
194
- get loadingListItemConfig() {
195
- return {
196
- selectable: true,
197
- columnLeft: {
198
- size: 8,
199
- fields: [
200
- {
201
- type: 'row',
202
- content: [
203
- {
204
- header: 'Product Name',
205
- field: 'relatedOrderInv.product.name',
206
- type: 'string',
207
- style: '-webkit-line-clamp: 2;'
208
- }
209
- ]
210
- },
211
- { type: 'row', content: [{ header: 'SKU No.', field: 'relatedOrderInv.product.sku', type: 'string' }] },
212
- {
213
- type: 'row',
214
- content: [
215
- { header: 'Exp Date', field: 'expirationDate', type: 'string' },
216
- { header: 'Batch No', field: 'relatedOrderInv.batchId', type: 'string' }
217
- ]
218
- },
219
- {
220
- type: 'row',
221
- content: [
222
- { header: 'Packing Size', field: 'packingSize', type: 'string' },
223
- { header: 'Packing Type', field: 'relatedOrderInv.packingType', type: 'string' }
224
- ]
225
- }
226
- ]
227
- },
228
- columnRight: {
229
- size: 4,
230
- fields: [
231
- {
232
- type: 'row',
233
- content: [{ header: 'Bin No.', field: 'binLocation.name', type: 'string', style: 'font-weight: bold;' }]
234
- },
235
- {
236
- type: 'valueBox',
237
- content: { header: 'Ready Qty.', field: 'sortedQty', field2: 'pickedQty', type: 'string' }
238
- }
239
- ]
240
- }
241
- }
242
- }
243
-
244
- get deliveryOrderConfig() {
245
- return {
265
+ this._useQcSku = false
266
+ this._currentReleaseGood = null
267
+ this._deliveryOrderConfig = {
246
268
  columnLeft: {
247
269
  size: 8,
248
270
  fields: [
@@ -276,14 +298,86 @@ export class LoadingExecution extends LoadingExecutionBase {
276
298
  }
277
299
  }
278
300
 
301
+ updated(changedProperties) {
302
+ if (changedProperties.has('worksheet')) {
303
+ this._currentReleaseGood = {
304
+ releaseGood: this.worksheet?.releaseGood,
305
+ bizplaceName: this.worksheet?.bizplaceName,
306
+ startedAt: this.worksheet?.startedAt
307
+ }
308
+ }
309
+ }
310
+
311
+ combineSameProducts(data) {
312
+ const combinedMap = new Map()
313
+
314
+ data.forEach(item => {
315
+ const key = `${item.relatedOrderInv?.product?.sku}_${item.batchId}_${item.expirationDate}`
316
+
317
+ if (combinedMap.has(key)) {
318
+ const existing = combinedMap.get(key)
319
+ existing.releaseQty += item.releaseQty
320
+ existing.pickedQty += item.pickedQty
321
+ existing.sortedQty += item.sortedQty
322
+ } else {
323
+ combinedMap.set(key, { ...item })
324
+ }
325
+ })
326
+
327
+ return Array.from(combinedMap.values())
328
+ }
329
+
330
+ async resetView() {
331
+ const disableQCSetting = await fetchSettingRule(SETTINGS.DISABLE_QC)
332
+ this._disableQC = disableQCSetting === true || disableQCSetting === 'true'
333
+ this._useQcSku = await fetchSettingRule(SETTINGS.QC_SKU)
334
+
335
+ // Set initial active tab based on settings
336
+ const activeTab = !this._disableQC ? TAB_TYPES.QC : TAB_TYPES.LOADING
337
+ this.state = { ...this.state, activeTab }
338
+
339
+ // Process worksheet details
340
+ const processedDetails = this._useQcSku ? this.combineSameProducts(this.worksheetDetails) : this.worksheetDetails
341
+
342
+ // Filter data for different tabs
343
+ this.qcData = processedDetails.filter(data => data?.sortedQty != data?.pickedQty && data.status !== 'LOADED') || []
344
+ this.loadingData =
345
+ processedDetails.filter(data => data?.sortedQty > 0 && data.status != WORKSHEET_STATUS.DONE.value) || []
346
+ this.loadedData = this.deliveryOrdersInfo || []
347
+
348
+ // Update execution data
349
+ this._executionData = {
350
+ ...this._executionData,
351
+ orderId: this.worksheet?.releaseGood?.id,
352
+ worksheetId: this.worksheet?.worksheet?.id
353
+ }
354
+
355
+ this.getButton()
356
+ }
357
+
358
+ get qcListItemConfig() {
359
+ return QC_LIST_CONFIG
360
+ }
361
+
362
+ get loadingListItemConfig() {
363
+ return LOADING_LIST_CONFIG
364
+ }
365
+
366
+ get deliveryOrderConfig() {
367
+ return this._deliveryOrderConfig
368
+ }
369
+
279
370
  render() {
280
- if (!this.state) this.resetView()
281
-
282
- let tabs = []
283
- if (this.worksheet.releaseGood?.status === 'LOADING' && this._disableQC) {
284
- tabs = ['LOADING', 'LOADED']
285
- } else {
286
- tabs = ['QC', 'LOADING', 'LOADED']
371
+ if (!this.state) {
372
+ this.resetView()
373
+ }
374
+
375
+ const tabs = !this._disableQC ? DEFAULT_TABS : LOADING_TABS
376
+
377
+ // Set initial active tab if not set or if current tab is not in available tabs
378
+ if (!this.state?.activeTab || !tabs.includes(this.state.activeTab)) {
379
+ const initialTab = !this._disableQC ? TAB_TYPES.QC : TAB_TYPES.LOADING
380
+ this.state = { ...this.state, activeTab: initialTab }
287
381
  }
288
382
 
289
383
  return html`
@@ -291,7 +385,7 @@ export class LoadingExecution extends LoadingExecutionBase {
291
385
  <div class="side-padding-10">
292
386
  <form class="${isMobileDevice() ? 'single-column-form' : 'multi-column-form'}">
293
387
  <fieldset>
294
- ${this.state?.activeTab === 'QC'
388
+ ${this.state?.activeTab === TAB_TYPES.QC
295
389
  ? html`
296
390
  <!-- QC Tab Inputs -->
297
391
  <label class="font-bold">${i18next.t('label.product_barcode')}</label>
@@ -312,7 +406,7 @@ export class LoadingExecution extends LoadingExecutionBase {
312
406
  }}"
313
407
  />
314
408
  `
315
- : this.state?.activeTab === 'LOADING'
409
+ : this.state?.activeTab === TAB_TYPES.LOADING
316
410
  ? html`
317
411
  <!-- LOADING Tab Inputs -->
318
412
  <label class="font-bold">${i18next.t('label.vehicle_no')}</label>
@@ -342,15 +436,19 @@ export class LoadingExecution extends LoadingExecutionBase {
342
436
  </fieldset>
343
437
  </form>
344
438
  </div>
345
- <!-- Header Form Section End -->
346
439
 
347
440
  <button
348
441
  class="order-info text-center"
442
+ ?disabled=${!Boolean(this._currentReleaseGood?.releaseGood?.name)}
349
443
  @click=${e => {
350
- this.showOrderInfo()
444
+ if (this._currentReleaseGood?.releaseGood?.name) {
445
+ this.showOrderInfo()
446
+ }
351
447
  }}
352
448
  >
353
- <label class="text-14 font-bold order-no">Order No.: ${this.worksheet.releaseGood.name}</label>
449
+ <label class="text-14 font-bold order-no"
450
+ >Order No.: ${this._currentReleaseGood?.releaseGood?.name || this.worksheet?.binLocationName || ''}</label
451
+ >
354
452
  <mwc-icon style="color:#007E7F;">info</mwc-icon>
355
453
  </button>
356
454
 
@@ -359,8 +457,8 @@ export class LoadingExecution extends LoadingExecutionBase {
359
457
  tab => html`
360
458
  <button
361
459
  class="font-bold tab-button ${this.state?.activeTab === tab ? 'active' : ''}"
362
- @click=${e => {
363
- this.openTab(e, tab)
460
+ @click=${async e => {
461
+ await this.openTab(e, tab)
364
462
  }}
365
463
  >
366
464
  ${tab}
@@ -369,29 +467,31 @@ export class LoadingExecution extends LoadingExecutionBase {
369
467
  )}
370
468
  </div>
371
469
 
372
- <!-- Tab Info Section -->
373
470
  <div class="tab-info text-center">
374
- <label class="text-14 font-bold"> ${this.state?.activeTab === 'LOADED' ? `Total DO: ` : `Total SKU: `} ${this._getTotalItem()}</label>
471
+ <label class="text-14 font-bold">
472
+ ${this.state?.activeTab === TAB_TYPES.LOADED ? `Total DO: ` : `Total SKU: `} ${this._getTotalItem()}</label
473
+ >
375
474
  </div>
376
- <!-- Tab Info Section End -->
377
475
 
378
- <!-- QC Item Section -->
379
- <div id="qc" class="tab-content ${this.state?.activeTab == 'QC' ? 'active' : ''}">
476
+ <div id="qc" class="tab-content ${this.state?.activeTab === TAB_TYPES.QC ? 'active' : ''}">
380
477
  <product-list-view id="qc" .config=${this.qcListItemConfig} .data=${this.qcData || []}></product-list-view>
381
478
  </div>
382
- <!-- QC Item Section End -->
383
479
 
384
- <!-- Loading Item Section -->
385
- <div id="loading" class="tab-content ${this.state?.activeTab == 'LOADING' ? 'active' : ''}">
386
- <product-list-view id="loading" .config=${this.loadingListItemConfig} .data=${this.loadingData || []}></product-list-view>
480
+ <div id="loading" class="tab-content ${this.state?.activeTab === TAB_TYPES.LOADING ? 'active' : ''}">
481
+ <product-list-view
482
+ id="loading"
483
+ .config=${this.loadingListItemConfig}
484
+ .data=${this.loadingData || []}
485
+ ></product-list-view>
387
486
  </div>
388
- <!-- Loading Item Section End -->
389
487
 
390
- <!-- Loaded Item Section -->
391
- <div id="loaded" class="tab-content ${this.state?.activeTab == 'LOADED' ? 'active' : ''}">
392
- <product-list-view id="loaded" .config=${this.deliveryOrderConfig} .data=${this?.loadedData?.deliveryOrders || []}></product-list-view>
488
+ <div id="loaded" class="tab-content ${this.state?.activeTab === TAB_TYPES.LOADED ? 'active' : ''}">
489
+ <product-list-view
490
+ id="loaded"
491
+ .config=${this.deliveryOrderConfig}
492
+ .data=${this?.loadedData?.deliveryOrders || []}
493
+ ></product-list-view>
393
494
  </div>
394
- <!-- Loaded Item Section End -->
395
495
  `
396
496
  }
397
497
  }