@things-factory/operato-wms 4.3.593 → 4.3.596

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 (118) hide show
  1. package/client/pages/components/list-view/product-list-view.js +378 -0
  2. package/client/pages/constants/picking-standard.js +1 -0
  3. package/client/pages/constants/worksheet.js +12 -0
  4. package/client/pages/order/release-order/b2b/b2b-order-list.js +91 -39
  5. package/client/pages/outbound/generate-worksheet-popup.js +188 -25
  6. package/client/pages/outbound/loading-v2/delivery-order-info.js +205 -0
  7. package/client/pages/outbound/loading-v2/load-by-qty.js +151 -0
  8. package/client/pages/outbound/loading-v2/loading-execution-base.js +514 -0
  9. package/client/pages/outbound/loading-v2/loading-execution.js +392 -0
  10. package/client/pages/outbound/loading-v2/loading.js +419 -0
  11. package/client/pages/outbound/loading-v2/release-good-info.js +93 -0
  12. package/client/pages/outbound/loading-v2/show-my-loading-worksheet-list-popup.js +93 -0
  13. package/client/pages/outbound/loading-v2/warehouse-return-popup.js +194 -0
  14. package/client/pages/outbound/picking-v2/issue-details-popup.js +163 -0
  15. package/client/pages/outbound/picking-v2/picking-execution-base.js +482 -0
  16. package/client/pages/outbound/picking-v2/picking-execution.js +379 -0
  17. package/client/pages/outbound/picking-v2/picking.js +387 -0
  18. package/client/pages/outbound/picking-v2/report-issue-popup.js +139 -0
  19. package/client/pages/outbound/picking-v2/scan-bin-no-popup.js +126 -0
  20. package/client/pages/outbound/picking-v2/worksheet-info.js +200 -0
  21. package/client/pages/outbound/select-operator-popup.js +6 -3
  22. package/client/pages/outbound/show-my-worksheet-list-popup.js +6 -2
  23. package/client/pages/outbound/worksheet-zone-picking.js +507 -0
  24. package/client/pages/outbound/zone-worksheet.js +574 -0
  25. package/client/route.js +15 -0
  26. package/dist-server/graphql/resolvers/index.js +11 -2
  27. package/dist-server/graphql/resolvers/index.js.map +1 -1
  28. package/dist-server/graphql/resolvers/outbound/complete-load.js +96 -0
  29. package/dist-server/graphql/resolvers/outbound/complete-load.js.map +1 -0
  30. package/dist-server/graphql/resolvers/outbound/find-loadable-release-good.js +58 -0
  31. package/dist-server/graphql/resolvers/outbound/find-loadable-release-good.js.map +1 -0
  32. package/dist-server/graphql/resolvers/outbound/get-delivery-orders.js +29 -0
  33. package/dist-server/graphql/resolvers/outbound/get-delivery-orders.js.map +1 -0
  34. package/dist-server/graphql/resolvers/outbound/get-loading-task.js +86 -0
  35. package/dist-server/graphql/resolvers/outbound/get-loading-task.js.map +1 -0
  36. package/dist-server/graphql/resolvers/outbound/index.js +16 -0
  37. package/dist-server/graphql/resolvers/outbound/index.js.map +1 -0
  38. package/dist-server/graphql/resolvers/outbound/load-by-qty.js +112 -0
  39. package/dist-server/graphql/resolvers/outbound/load-by-qty.js.map +1 -0
  40. package/dist-server/graphql/resolvers/outbound/loading-worksheet-v2.js +122 -0
  41. package/dist-server/graphql/resolvers/outbound/loading-worksheet-v2.js.map +1 -0
  42. package/dist-server/graphql/resolvers/outbound/my-loading-assignment-status.js +32 -0
  43. package/dist-server/graphql/resolvers/outbound/my-loading-assignment-status.js.map +1 -0
  44. package/dist-server/graphql/resolvers/outbound/sort-item.js +65 -0
  45. package/dist-server/graphql/resolvers/outbound/sort-item.js.map +1 -0
  46. package/dist-server/graphql/resolvers/outbound/undo-load.js +72 -0
  47. package/dist-server/graphql/resolvers/outbound/undo-load.js.map +1 -0
  48. package/dist-server/graphql/resolvers/outbound/warehouse-return.js +101 -0
  49. package/dist-server/graphql/resolvers/outbound/warehouse-return.js.map +1 -0
  50. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js +53 -25
  51. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js.map +1 -1
  52. package/dist-server/graphql/resolvers/zone-worksheet/activate-zone-worksheet.js +91 -0
  53. package/dist-server/graphql/resolvers/zone-worksheet/activate-zone-worksheet.js.map +1 -0
  54. package/dist-server/graphql/resolvers/zone-worksheet/assign-sorter.js +36 -0
  55. package/dist-server/graphql/resolvers/zone-worksheet/assign-sorter.js.map +1 -0
  56. package/dist-server/graphql/resolvers/zone-worksheet/generate-zone-worksheet.js +103 -0
  57. package/dist-server/graphql/resolvers/zone-worksheet/generate-zone-worksheet.js.map +1 -0
  58. package/dist-server/graphql/resolvers/zone-worksheet/get-zone-picking-task.js +98 -0
  59. package/dist-server/graphql/resolvers/zone-worksheet/get-zone-picking-task.js.map +1 -0
  60. package/dist-server/graphql/resolvers/zone-worksheet/index.js +12 -0
  61. package/dist-server/graphql/resolvers/zone-worksheet/index.js.map +1 -0
  62. package/dist-server/graphql/resolvers/zone-worksheet/zone-picking.js +327 -0
  63. package/dist-server/graphql/resolvers/zone-worksheet/zone-picking.js.map +1 -0
  64. package/dist-server/graphql/resolvers/zone-worksheet/zone-worksheet.js +146 -0
  65. package/dist-server/graphql/resolvers/zone-worksheet/zone-worksheet.js.map +1 -0
  66. package/dist-server/graphql/types/index.js +11 -3
  67. package/dist-server/graphql/types/index.js.map +1 -1
  68. package/dist-server/graphql/types/outbound/delivery-order-info-list.js +14 -0
  69. package/dist-server/graphql/types/outbound/delivery-order-info-list.js.map +1 -0
  70. package/dist-server/graphql/types/outbound/index.js +23 -0
  71. package/dist-server/graphql/types/outbound/index.js.map +1 -0
  72. package/dist-server/graphql/types/outbound/loading-assignment.js +15 -0
  73. package/dist-server/graphql/types/outbound/loading-assignment.js.map +1 -0
  74. package/dist-server/graphql/types/outbound/loading-worksheet-type.js +25 -0
  75. package/dist-server/graphql/types/outbound/loading-worksheet-type.js.map +1 -0
  76. package/dist-server/graphql/types/zone-worksheet/index.js +22 -0
  77. package/dist-server/graphql/types/zone-worksheet/index.js.map +1 -0
  78. package/dist-server/graphql/types/zone-worksheet/zone-picking-worksheet.js +18 -0
  79. package/dist-server/graphql/types/zone-worksheet/zone-picking-worksheet.js.map +1 -0
  80. package/dist-server/graphql/types/zone-worksheet/zone-worksheet-overview-list.js +13 -0
  81. package/dist-server/graphql/types/zone-worksheet/zone-worksheet-overview-list.js.map +1 -0
  82. package/dist-server/graphql/types/zone-worksheet/zone-worksheet-overview.js +16 -0
  83. package/dist-server/graphql/types/zone-worksheet/zone-worksheet-overview.js.map +1 -0
  84. package/package.json +8 -8
  85. package/server/graphql/resolvers/index.ts +11 -2
  86. package/server/graphql/resolvers/outbound/complete-load.ts +126 -0
  87. package/server/graphql/resolvers/outbound/find-loadable-release-good.ts +61 -0
  88. package/server/graphql/resolvers/outbound/get-delivery-orders.ts +32 -0
  89. package/server/graphql/resolvers/outbound/get-loading-task.ts +105 -0
  90. package/server/graphql/resolvers/outbound/index.ts +26 -0
  91. package/server/graphql/resolvers/outbound/load-by-qty.ts +176 -0
  92. package/server/graphql/resolvers/outbound/loading-worksheet-v2.ts +131 -0
  93. package/server/graphql/resolvers/outbound/my-loading-assignment-status.ts +35 -0
  94. package/server/graphql/resolvers/outbound/sort-item.ts +81 -0
  95. package/server/graphql/resolvers/outbound/undo-load.ts +83 -0
  96. package/server/graphql/resolvers/outbound/warehouse-return.ts +129 -0
  97. package/server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts +77 -35
  98. package/server/graphql/resolvers/zone-worksheet/activate-zone-worksheet.ts +124 -0
  99. package/server/graphql/resolvers/zone-worksheet/assign-sorter.ts +49 -0
  100. package/server/graphql/resolvers/zone-worksheet/generate-zone-worksheet.ts +133 -0
  101. package/server/graphql/resolvers/zone-worksheet/get-zone-picking-task.ts +118 -0
  102. package/server/graphql/resolvers/zone-worksheet/index.ts +20 -0
  103. package/server/graphql/resolvers/zone-worksheet/zone-picking.ts +458 -0
  104. package/server/graphql/resolvers/zone-worksheet/zone-worksheet.ts +183 -0
  105. package/server/graphql/types/index.ts +11 -3
  106. package/server/graphql/types/outbound/delivery-order-info-list.ts +8 -0
  107. package/server/graphql/types/outbound/index.ts +22 -0
  108. package/server/graphql/types/outbound/loading-assignment.ts +9 -0
  109. package/server/graphql/types/outbound/loading-worksheet-type.ts +20 -0
  110. package/server/graphql/types/zone-worksheet/index.ts +21 -0
  111. package/server/graphql/types/zone-worksheet/zone-picking-worksheet.ts +12 -0
  112. package/server/graphql/types/zone-worksheet/zone-worksheet-overview-list.ts +7 -0
  113. package/server/graphql/types/zone-worksheet/zone-worksheet-overview.ts +10 -0
  114. package/things-factory.config.js +16 -0
  115. package/translations/en.json +30 -1
  116. package/translations/ko.json +27 -0
  117. package/translations/ms.json +29 -2
  118. package/translations/zh.json +27 -0
@@ -0,0 +1,378 @@
1
+ import { i18next, localize } from '@things-factory/i18n-base'
2
+ import { css, html, LitElement } from 'lit-element'
3
+ import { flattenObject } from '@things-factory/utils'
4
+
5
+ class ProductListView extends localize(i18next)(LitElement) {
6
+ static get styles() {
7
+ return [
8
+ css`
9
+ .flex-col {
10
+ display: flex;
11
+ flex-direction: column;
12
+ }
13
+ .flex-row {
14
+ display: flex;
15
+ flex-direction: row;
16
+ }
17
+ .flex-50 {
18
+ flex: 50%;
19
+ }
20
+ .mt-5px {
21
+ margin-top: 5px;
22
+ }
23
+ .font-bold {
24
+ font-weight: bold !important;
25
+ }
26
+ .text-14 {
27
+ font-size: 14px !important;
28
+ line-height: 1.5 !important;
29
+ }
30
+ .text-center {
31
+ display: flex;
32
+ align-items: center;
33
+ }
34
+ .product-item {
35
+ padding: 8px;
36
+ display: grid;
37
+ grid-template-columns: repeat(12, 1fr);
38
+ grid-gap: 3px;
39
+ color: #3a5877;
40
+ border-bottom: solid 0.5px #3a5877;
41
+ }
42
+ .product-item-info {
43
+ grid-column: span 8;
44
+ font-size: 12px;
45
+ }
46
+ .product-item-info-title {
47
+ font-weight: bold;
48
+ }
49
+ .product-item-info-details {
50
+ display: -webkit-box;
51
+ -webkit-line-clamp: 1;
52
+ -webkit-box-orient: vertical;
53
+ overflow: hidden;
54
+ }
55
+ .product-item-action {
56
+ grid-column: span 4;
57
+ text-align: center;
58
+ font-size: 14px;
59
+ }
60
+
61
+ .qty-box {
62
+ margin: 0 15px;
63
+ border: solid 0.5px #3a5877;
64
+ border-radius: 4px;
65
+ padding: 4px;
66
+ color: #3a5877;
67
+ font-size: 16px;
68
+ font-weight: bold;
69
+ }
70
+ .qty-box > hr {
71
+ margin: 0;
72
+ border: none;
73
+ background-color: #3a5877;
74
+ height: 0.5px;
75
+ }
76
+
77
+ .action-box {
78
+ flex-grow: 1;
79
+ align-content: center;
80
+ }
81
+
82
+ .btn {
83
+ border: none;
84
+ padding: 5px 10px;
85
+ border-radius: 3px;
86
+ cursor: pointer;
87
+ min-width: 70px;
88
+ height: 35px;
89
+ }
90
+
91
+ .btn-issue {
92
+ background-color: #cd4946;
93
+ color: #f3f2f7;
94
+ }
95
+
96
+ .btn-success {
97
+ background-color: #007e7f;
98
+ color: #f3f2f7;
99
+ }
100
+
101
+ .btn-common {
102
+ background-color: white;
103
+ color: #007e7f;
104
+ border: 1px solid #007e7f;
105
+ }
106
+
107
+ .checkbox-wrapper {
108
+ display: flex;
109
+ align-items: center;
110
+ justify-content: center;
111
+ height: 100%;
112
+ }
113
+
114
+ .checkbox-wrapper input[type='checkbox'] {
115
+ accent-color: #007e7f;
116
+ width: 16px;
117
+ height: 16px;
118
+ cursor: pointer;
119
+ }
120
+
121
+ .select-all-header {
122
+ display: flex;
123
+ align-items: center;
124
+ padding: 8px;
125
+ color: #007e7f;
126
+ font-weight: 700;
127
+ border-bottom: 1px solid #d9d9d9;
128
+ }
129
+
130
+ .select-all-header span {
131
+ cursor: pointer;
132
+ margin-left: 4px;
133
+ }
134
+
135
+ .select-all-header input[type='checkbox'] {
136
+ accent-color: #007e7f;
137
+ width: 16px;
138
+ height: 16px;
139
+ cursor: pointer;
140
+ }
141
+
142
+ .input-field {
143
+ width: 80%;
144
+ height: 80%;
145
+ border: none;
146
+ font-size: 14px;
147
+ color: #3a5877;
148
+ background-color: #f4f7fb;
149
+ text-align: center;
150
+ }
151
+ `
152
+ ]
153
+ }
154
+
155
+ static get properties() {
156
+ return {
157
+ data: Object,
158
+ config: Object,
159
+ callback: Object,
160
+ _show: Boolean,
161
+ selectedItems: { type: Array },
162
+ selectAll: { type: Boolean }
163
+ }
164
+ }
165
+
166
+ constructor() {
167
+ super()
168
+ this.selectedItems = []
169
+ this.selectAll = false
170
+ }
171
+
172
+ render() {
173
+ return html`
174
+ ${this.config?.selectable
175
+ ? html`
176
+ <div class="select-all-header">
177
+ <input type="checkbox" .checked=${this.selectAll} @change=${this._handleSelectAll} />
178
+ <span @click=${this._handleSelectAllClick}>Select All</span>
179
+ </div>
180
+ `
181
+ : ''}
182
+ ${this?.data.map((itm, index) => {
183
+ try {
184
+ itm = flattenObject(itm, '.')
185
+
186
+ return html`
187
+ <div
188
+ class="product-item"
189
+ style="grid-template-columns: repeat(${
190
+ this.config.columnLeft.size + this.config.columnRight.size + (this.config?.selectable ? 1 : 0)
191
+ }, 1fr) !important;"
192
+ >
193
+ ${
194
+ this.config?.selectable
195
+ ? html`
196
+ <div class="checkbox-wrapper">
197
+ <input
198
+ type="checkbox"
199
+ .checked=${this.selectedItems.includes(itm.id)}
200
+ @change=${e => this._handleSelect(e, itm)}
201
+ />
202
+ </div>
203
+ `
204
+ : ''
205
+ }
206
+ <div class="product-item-info" style="grid-column: span ${this.config.columnLeft.size} !important;">
207
+ ${this.config.columnLeft.fields.map(cfg => {
208
+ const field = cfg.content
209
+ const fieldSize = field.length
210
+
211
+ switch (cfg.type) {
212
+ case 'row':
213
+ return html`<div class="flex-row">
214
+ ${field.map(f => {
215
+ return rowType(fieldSize, f.header, itm[f.field], f.style)
216
+ })}
217
+ </div>`
218
+ break
219
+ case 'valueBox':
220
+ return valueBoxType(f.header, itm[f.field], itm[f.field2])
221
+ default:
222
+ break
223
+ }
224
+ })}
225
+ </div>
226
+
227
+ <div
228
+ class="flex-col product-item-action"
229
+ style="grid-column: span ${this.config.columnRight.size} !important;"
230
+ >
231
+ ${this.config.columnRight.fields.map(cfg => {
232
+ const field = cfg.content
233
+ const fieldSize = field.length
234
+
235
+ switch (cfg.type) {
236
+ case 'row':
237
+ return field.map(f => {
238
+ return rowType(fieldSize, f.header, itm[f.field], f.style)
239
+ })
240
+ break
241
+ case 'valueBox':
242
+ return valueBoxType(field.header, itm[field.field], itm[field.field2])
243
+ case 'editableValueBox':
244
+ const data = itm[field.field]
245
+ const header = field.header
246
+ return html`
247
+ <div class="flex-col mt-5px">
248
+ ${header != null || header != undefined ? html` <label class="product-item-info-title">${header}</label> ` : ``}
249
+ <div class="qty-box">
250
+ <input
251
+ class="input-field"
252
+ value="${data ? data : 0}"
253
+ @change=${e => this._handleValueChange(field.field, parseInt(e.target.value), index)}
254
+ />
255
+ </div>
256
+ </div>`
257
+ case 'actionBox':
258
+ return field.map(f => {
259
+ return actionBoxType(
260
+ f.header,
261
+ typeof f.callback === 'function' ? e => f.callback(itm, e) : null, // This captures itm in the closure
262
+ // f.callback, // Directly pass the callback
263
+ f?.btnClass,
264
+ typeof f.condition === 'function' ? () => f.condition(itm) : () => true // This captures itm in the closure
265
+ // f.condition // Pass the condition directly
266
+ )
267
+ })
268
+ default:
269
+ break
270
+ }
271
+ })}
272
+ </div>
273
+ </div>
274
+ </div>
275
+ `
276
+ } catch (e) {
277
+ console.log(e)
278
+ return html``
279
+ }
280
+ })}
281
+ `
282
+ }
283
+
284
+ _handleSelectAll(e) {
285
+ this.selectAll = e.target.checked
286
+ if (this.selectAll) {
287
+ this.selectedItems = this.data.map(item => item.id)
288
+ } else {
289
+ this.selectedItems = []
290
+ }
291
+ this.dispatchEvent(
292
+ new CustomEvent('selection-changed', {
293
+ detail: { selectedItems: this.selectedItems }
294
+ })
295
+ )
296
+ }
297
+
298
+ _handleSelect(e, item) {
299
+ if (e.target.checked) {
300
+ this.selectedItems = [...this.selectedItems, item.id]
301
+ } else {
302
+ this.selectedItems = this.selectedItems.filter(id => id !== item.id)
303
+ }
304
+ this.selectAll = this.selectedItems.length === this.data.length
305
+ this.dispatchEvent(
306
+ new CustomEvent('selection-changed', {
307
+ detail: { selectedItems: this.selectedItems }
308
+ })
309
+ )
310
+ }
311
+
312
+ _handleSelectAllClick(e) {
313
+ this._handleSelectAll({ target: { checked: !this.selectAll } })
314
+ }
315
+
316
+ _handleValueChange(field, newValue, index) {
317
+ this.data = this.data.map((item, i) => {
318
+ if (i === index) {
319
+ return {
320
+ ...item,
321
+ [field]: newValue
322
+ }
323
+ }
324
+ return item
325
+ })
326
+ }
327
+ }
328
+
329
+ window.customElements.define('product-list-view', ProductListView)
330
+
331
+ function rowType(fieldSize, header, data, style = '') {
332
+ return html`
333
+ <div class="flex-col ${fieldSize > 1 ? 'flex-50' : ''} mt-5px">
334
+ ${header != null || header != undefined ? html` <label class="product-item-info-title">${header}</label> ` : ``}
335
+ <label class="product-item-info-details" style="${style}"> ${data ? data : '-'} </label>
336
+ </div>
337
+ `
338
+ }
339
+
340
+ function valueBoxType(header, data, data2) {
341
+ return html`
342
+ <div class="flex-col mt-5px">
343
+ ${header != null || header != undefined ? html` <label class="product-item-info-title">${header}</label> ` : ``}
344
+ <div class="qty-box">
345
+ <label class="product-item-info-details">${data ? data : 0}</label>
346
+ ${data2 != null || data2 != undefined
347
+ ? html` <hr />
348
+ <label class="product-item-info-details">${data2 ? data2 : 0}</label>`
349
+ : ``}
350
+ </div>
351
+ </div>
352
+ `
353
+ }
354
+
355
+ function actionBoxType(header, callback, btnClass = 'btn-issue', condition = null) {
356
+ // Check if condition is a function and evaluate it
357
+ const showButton = typeof condition === 'function' ? condition() : true // Call the condition function
358
+
359
+ // Only render the button if the condition allows
360
+ if (!showButton) {
361
+ return html`` // Don't render if the condition is not met
362
+ }
363
+
364
+ return html`
365
+ <div class="action-box mt-5px">
366
+ <button
367
+ class="btn ${btnClass}"
368
+ @click=${e => {
369
+ if (typeof callback === 'function') {
370
+ callback(e) // Pass the event to the callback if it exists
371
+ }
372
+ }}
373
+ >
374
+ ${header}
375
+ </button>
376
+ </div>
377
+ `
378
+ }
@@ -11,3 +11,4 @@ export const PICKING_STANDARD = {
11
11
 
12
12
  export const PICKING = { name: 'picking', value: 'PICKING' }
13
13
  export const BATCH_PICKING = { name: 'batch_picking', value: 'BATCH_PICKING' }
14
+ export const ZONE_PICKING = { name: 'zone_picking', value: 'ZONE_PICKING' }
@@ -64,6 +64,10 @@ export const WORKSHEET_TYPE = {
64
64
  PUTAWAY_REPLENISHMENT: {
65
65
  name: i18next.t('label.putaway_replenishment'),
66
66
  value: 'PUTAWAY_REPLENISHMENT'
67
+ },
68
+ ZONE_PICKING: {
69
+ name: i18next.t('label.zone_picking'),
70
+ value: 'ZONE_PICKING'
67
71
  }
68
72
  }
69
73
 
@@ -103,6 +107,14 @@ export const WORKSHEET_STATUS = {
103
107
  CANCELLED: {
104
108
  name: i18next.t('label.cancel'),
105
109
  value: 'CANCELLED'
110
+ },
111
+ PARTIAL_PENDING_APPROVAL: {
112
+ name: i18next.t('label.partial_pending_approval'),
113
+ value: 'PARTIAL_PENDING_APPROVAL'
114
+ },
115
+ PARTIAL_PROCESSING: {
116
+ name: i18next.t('label.partial_processing'),
117
+ value: 'PARTIAL_PROCESSING'
106
118
  }
107
119
  }
108
120
 
@@ -2,37 +2,20 @@ import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
3
  import '../batch-picking-popup'
4
4
  import '../../../outbound/generate-worksheet-popup'
5
+ import '../../../outbound/select-operator-popup'
5
6
 
6
7
  import gql from 'graphql-tag'
7
- import {
8
- css,
9
- html
10
- } from 'lit-element'
8
+ import { css, html } from 'lit-element'
11
9
 
12
10
  import { getCodeByName } from '@things-factory/code-base'
13
- import {
14
- i18next,
15
- localize
16
- } from '@things-factory/i18n-base'
11
+ import { i18next, localize } from '@things-factory/i18n-base'
17
12
  import { openPopup } from '@things-factory/layout-base'
18
- import {
19
- client,
20
- navigate,
21
- PageView
22
- } from '@things-factory/shell'
23
- import {
24
- CommonButtonStyles,
25
- ScrollbarStyles
26
- } from '@things-factory/styles'
27
- import {
28
- isMobileDevice,
29
- sleep
30
- } from '@things-factory/utils'
31
-
32
- import {
33
- ORDER_STATUS,
34
- ORDER_VAS_STATUS
35
- } from '../../../constants'
13
+ import { client, navigate, PageView } from '@things-factory/shell'
14
+ import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
15
+ import { isMobileDevice, sleep } from '@things-factory/utils'
16
+
17
+ import { ORDER_STATUS, ORDER_VAS_STATUS } from '../../../constants'
18
+ import { fetchSettingRule } from '../../../../fetch-setting-value'
36
19
 
37
20
  class B2bOrderList extends localize(i18next)(PageView) {
38
21
  static get styles() {
@@ -66,7 +49,8 @@ class B2bOrderList extends localize(i18next)(PageView) {
66
49
  _exportOption: Boolean,
67
50
  _routeId: Boolean,
68
51
  vasStatus: String,
69
- isUserBelongsDomain: Boolean
52
+ isUserBelongsDomain: Boolean,
53
+ _enableZonePicking: Boolean
70
54
  }
71
55
  }
72
56
 
@@ -92,6 +76,14 @@ class B2bOrderList extends localize(i18next)(PageView) {
92
76
  ...CommonButtonStyles.activate
93
77
  })
94
78
  }
79
+
80
+ if (this._enableZonePicking) {
81
+ actions.push({
82
+ title: i18next.t('button.assign_sorter'),
83
+ action: this._openSelectSorterPopup.bind(this),
84
+ ...CommonButtonStyles.add
85
+ })
86
+ }
95
87
  return {
96
88
  title: i18next.t('title.release_orders'),
97
89
  actions,
@@ -127,10 +119,10 @@ class B2bOrderList extends localize(i18next)(PageView) {
127
119
  const _orderStatus = _orderStatusReq.status == 'fulfilled' ? _orderStatusReq.value : []
128
120
  const _bizplaces = _bizplacesReq.status == 'fulfilled' ? _bizplacesReq.value : []
129
121
  const _excludedVasStatus = ['DONE', 'CHANGES', 'NEW', 'REMOVED']
130
- const _orderVasStatus = Object.values(ORDER_VAS_STATUS)
131
- .filter(status => !_excludedVasStatus.includes(status.value))
132
-
133
- this._searchFields = [
122
+ const _orderVasStatus = Object.values(ORDER_VAS_STATUS).filter(status => !_excludedVasStatus.includes(status.value))
123
+ this._enableZonePicking = await fetchSettingRule('enable-zone-picking')
124
+
125
+ this._searchFields = [
134
126
  {
135
127
  label: i18next.t('field.order_info'),
136
128
  name: 'name',
@@ -251,7 +243,7 @@ class B2bOrderList extends localize(i18next)(PageView) {
251
243
  type: 'checkbox',
252
244
  props: { searchOper: 'eq' },
253
245
  attrs: ['indeterminate']
254
- },
246
+ },
255
247
  {
256
248
  label: i18next.t('field.vas'),
257
249
  name: 'hasVas',
@@ -400,7 +392,7 @@ class B2bOrderList extends localize(i18next)(PageView) {
400
392
  type: 'string',
401
393
  name: 'vasStatus',
402
394
  header: i18next.t('field.vas_status'),
403
- imex: { header: i18next.t('field.vas'), key: 'vas', width: 20, type: 'string'},
395
+ imex: { header: i18next.t('field.vas'), key: 'vas', width: 20, type: 'string' },
404
396
  sortable: true,
405
397
  width: 120
406
398
  },
@@ -412,6 +404,14 @@ class B2bOrderList extends localize(i18next)(PageView) {
412
404
  sortable: true,
413
405
  width: 120
414
406
  },
407
+ {
408
+ type: 'object',
409
+ name: 'sortedBy',
410
+ header: i18next.t('field.sorter'),
411
+ imex: { header: i18next.t('field.sorter'), key: 'sortedBy', width: 30, type: 'object' },
412
+ sortable: true,
413
+ width: 160
414
+ },
415
415
  {
416
416
  type: 'datetime',
417
417
  name: 'createdAt',
@@ -488,7 +488,7 @@ class B2bOrderList extends localize(i18next)(PageView) {
488
488
  let toDt = new Date(filter.value)
489
489
  toDt.setHours(23, 59, 59)
490
490
  filter.value = toDt.toISOString()
491
- break
491
+ break
492
492
  default:
493
493
  break
494
494
  }
@@ -530,6 +530,9 @@ class B2bOrderList extends localize(i18next)(PageView) {
530
530
  id
531
531
  status
532
532
  }
533
+ sortedBy {
534
+ name
535
+ }
533
536
  creator {
534
537
  id
535
538
  name
@@ -569,11 +572,12 @@ class B2bOrderList extends localize(i18next)(PageView) {
569
572
  return {
570
573
  ...itm,
571
574
  routeId: itm.routeId ? true : false,
572
- vasStatus: itm.orderVass?.length > 0
573
- ? itm.orderVass.some(ov => ov.status === ORDER_VAS_STATUS.PENDING_APPROVE.value)
574
- ? ORDER_VAS_STATUS.PENDING_APPROVE.value
575
- : itm.orderVass[0].status
576
- : null
575
+ vasStatus:
576
+ itm.orderVass?.length > 0
577
+ ? itm.orderVass.some(ov => ov.status === ORDER_VAS_STATUS.PENDING_APPROVE.value)
578
+ ? ORDER_VAS_STATUS.PENDING_APPROVE.value
579
+ : itm.orderVass[0].status
580
+ : null
577
581
  }
578
582
  }) || []
579
583
  }
@@ -644,6 +648,54 @@ class B2bOrderList extends localize(i18next)(PageView) {
644
648
  }
645
649
  }
646
650
 
651
+ _openSelectSorterPopup() {
652
+ try {
653
+ let selectedData = this.dataGrist.selected.filter(
654
+ item => item.status != ORDER_STATUS.DONE.value && item.status != ORDER_STATUS.CANCELLED.value
655
+ )
656
+
657
+ if (selectedData.length <= 0) throw new Error('Please select at least one valid order')
658
+
659
+ openPopup(
660
+ html`
661
+ <select-operator-popup
662
+ .selectSorter = "${true}"
663
+ @updateOperator="${async e => {
664
+ let assignee = e.detail
665
+
666
+ const response = await client.mutate({
667
+ mutation: gql`
668
+ mutation assignSorter($releaseGoodId: [String]!, $userId: String!) {
669
+ assignSorter(releaseGoodId: $releaseGoodId, userId: $userId)
670
+ }
671
+ `,
672
+ variables: { releaseGoodId: selectedData.map(itm => itm.id), userId: assignee.id }
673
+ })
674
+
675
+ if (!response.errors) {
676
+ this.dataGrist.fetch()
677
+ return this._showToast({ message: i18next.t('text.updated_successfully') })
678
+ }
679
+
680
+ if (this.activatable) {
681
+ if (this.orderNo) {
682
+ history.back()
683
+ }
684
+ }
685
+ }}"
686
+ ></select-operator-popup>
687
+ `,
688
+ {
689
+ backdrop: true,
690
+ size: 'medium',
691
+ title: 'select operator'
692
+ }
693
+ )
694
+ } catch (error) {
695
+ return this._showToast(error)
696
+ }
697
+ }
698
+
647
699
  _compareValues(key, order = 'asc') {
648
700
  return function innerSort(a, b) {
649
701
  if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {