@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.
- package/client/pages/components/select-cc-product-popup.js +321 -0
- package/client/pages/constants/order.js +15 -0
- package/client/pages/inventory-check/add-extra-inventory-popup.js +306 -0
- package/client/pages/inventory-check/check-inventory-popup.js +183 -167
- package/client/pages/inventory-check/create-cycle-count.js +292 -141
- package/client/pages/inventory-check/cycle-count-inventory-details-popup.js +282 -0
- package/client/pages/inventory-check/cycle-count-recheck-popup.js +129 -31
- package/client/pages/inventory-check/cycle-count-report.js +425 -306
- package/client/pages/inventory-check/cycle-count-review.js +742 -0
- package/client/pages/inventory-check/cycle-count-worksheet-list.js +476 -0
- package/client/pages/inventory-check/inspecting-product.js +954 -1029
- package/client/pages/inventory-check/inventory-check-detail.js +378 -0
- package/client/pages/inventory-check/inventory-check-list.js +35 -109
- package/client/pages/inventory-check/relocate-inventory-popup.js +222 -0
- package/client/pages/inventory-check/search-popup.js +1 -1
- package/client/pages/inventory-check/select-cc-location-popup.js +230 -0
- package/client/pages/inventory-check/worksheet-cycle-count.js +112 -90
- package/client/pages/outbound/route-label-popup.js +16 -0
- package/client/route.js +8 -0
- package/dist-server/graphql/resolvers/reports/cycle-count-report.js +244 -0
- package/dist-server/graphql/resolvers/reports/cycle-count-report.js.map +1 -0
- package/dist-server/graphql/resolvers/reports/index.js +2 -1
- package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/cycle-count-report-list.js +14 -0
- package/dist-server/graphql/types/reports/cycle-count-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/cycle-count-report.js +25 -0
- package/dist-server/graphql/types/reports/cycle-count-report.js.map +1 -0
- package/dist-server/graphql/types/reports/index.js +5 -0
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/package.json +6 -6
- package/server/graphql/resolvers/reports/cycle-count-report.ts +267 -0
- package/server/graphql/resolvers/reports/index.ts +3 -4
- package/server/graphql/types/reports/cycle-count-report-list.ts +8 -0
- package/server/graphql/types/reports/cycle-count-report.ts +19 -0
- package/server/graphql/types/reports/index.ts +7 -8
- package/things-factory.config.js +8 -0
- package/translations/en.json +34 -0
- package/translations/ko.json +34 -0
- package/translations/ms.json +35 -1
- package/translations/zh.json +37 -3
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import '@things-factory/form-ui'
|
|
2
|
+
import '@things-factory/grist-ui'
|
|
3
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
4
|
+
import { openPopup } from '@things-factory/layout-base'
|
|
5
|
+
import { client, navigate, PageView } from '@things-factory/shell'
|
|
6
|
+
import { ScrollbarStyles } from '@things-factory/styles'
|
|
7
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
8
|
+
import gql from 'graphql-tag'
|
|
9
|
+
import { css, html } from 'lit-element'
|
|
10
|
+
import {
|
|
11
|
+
getOrderStatusCandidates,
|
|
12
|
+
getWorksheetStatusCandidates,
|
|
13
|
+
ORDER_STATUS,
|
|
14
|
+
ORDER_TYPES,
|
|
15
|
+
WORKSHEET_STATUS,
|
|
16
|
+
WORKSHEET_TYPE
|
|
17
|
+
} from '../constants'
|
|
18
|
+
import './search-popup'
|
|
19
|
+
class CycleCountWorksheetList extends localize(i18next)(PageView) {
|
|
20
|
+
static get styles() {
|
|
21
|
+
return [
|
|
22
|
+
ScrollbarStyles,
|
|
23
|
+
css`
|
|
24
|
+
:host {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
search-form {
|
|
30
|
+
overflow: visible;
|
|
31
|
+
}
|
|
32
|
+
data-grist {
|
|
33
|
+
overflow-y: auto;
|
|
34
|
+
flex: 1;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static get properties() {
|
|
41
|
+
return {
|
|
42
|
+
_searchFields: Array,
|
|
43
|
+
config: Object,
|
|
44
|
+
data: Object
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
render() {
|
|
49
|
+
return html`
|
|
50
|
+
<search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
|
|
51
|
+
<data-grist
|
|
52
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
53
|
+
.config=${this.config}
|
|
54
|
+
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
55
|
+
></data-grist>
|
|
56
|
+
`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get context() {
|
|
60
|
+
return {
|
|
61
|
+
title: i18next.t('title.cycle_count_worksheet_list'),
|
|
62
|
+
exportable: {
|
|
63
|
+
name: i18next.t('title.cycle_count_worksheet_list'),
|
|
64
|
+
data: this._exportableData.bind(this)
|
|
65
|
+
},
|
|
66
|
+
help: 'operato-wms/inventory-check/cycle-count-worksheet-list'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
pageUpdated(changes, lifecycle) {
|
|
71
|
+
if (this.active) {
|
|
72
|
+
this.dataGrist.fetch()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async pageInitialized() {
|
|
77
|
+
const _worksheetStatus = getWorksheetStatusCandidates(WORKSHEET_TYPE.CYCLE_COUNT)
|
|
78
|
+
const _orderStatus = getOrderStatusCandidates(ORDER_TYPES.CYCLE_COUNT)
|
|
79
|
+
|
|
80
|
+
this._bizplaces = [...(await this._fetchBizplaceList())]
|
|
81
|
+
|
|
82
|
+
this._searchFields = [
|
|
83
|
+
{
|
|
84
|
+
name: 'bizplace',
|
|
85
|
+
label: i18next.t(`field.company`),
|
|
86
|
+
type: 'object',
|
|
87
|
+
queryName: 'bizplaces',
|
|
88
|
+
field: 'name',
|
|
89
|
+
handlers: {
|
|
90
|
+
click: this._showSearchCustomer.bind(this)
|
|
91
|
+
},
|
|
92
|
+
props: { searchOper: 'eq', readonly: true }
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'inventoryCheckNo',
|
|
96
|
+
label: i18next.t('field.inventory_check_no'),
|
|
97
|
+
type: 'text',
|
|
98
|
+
props: { searchOper: 'i_like' }
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'executionDate',
|
|
102
|
+
label: i18next.t('field.execution_date'),
|
|
103
|
+
type: 'date',
|
|
104
|
+
props: { searchOper: 'eq' }
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'inventoryCheckStatus',
|
|
108
|
+
label: i18next.t('field.order_status'),
|
|
109
|
+
type: 'select',
|
|
110
|
+
options: [
|
|
111
|
+
{ value: '' },
|
|
112
|
+
..._orderStatus.map(status => {
|
|
113
|
+
return { name: i18next.t(`label.${status.name}`), value: status.value }
|
|
114
|
+
})
|
|
115
|
+
],
|
|
116
|
+
props: { searchOper: 'eq' }
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'status',
|
|
120
|
+
label: i18next.t('field.task_status'),
|
|
121
|
+
type: 'select',
|
|
122
|
+
options: [{ value: '' }, ..._worksheetStatus],
|
|
123
|
+
props: { searchOper: 'eq' }
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
this.config = {
|
|
128
|
+
list: {
|
|
129
|
+
fields: [
|
|
130
|
+
'inventoryCheck',
|
|
131
|
+
'checkCount',
|
|
132
|
+
'type',
|
|
133
|
+
'Customer',
|
|
134
|
+
'executionDate',
|
|
135
|
+
'inventoryCheckStatus',
|
|
136
|
+
'status',
|
|
137
|
+
'startedAt',
|
|
138
|
+
'endedAt'
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
rows: { appendable: false },
|
|
142
|
+
columns: [
|
|
143
|
+
{ type: 'gutter', gutterName: 'dirty' },
|
|
144
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
145
|
+
{
|
|
146
|
+
type: 'gutter',
|
|
147
|
+
gutterName: 'button',
|
|
148
|
+
icon: 'reorder',
|
|
149
|
+
handlers: {
|
|
150
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
151
|
+
if (!record.id) return
|
|
152
|
+
const type = record.type
|
|
153
|
+
const worksheetStatus = record.status
|
|
154
|
+
|
|
155
|
+
// Handle PICKING
|
|
156
|
+
if (
|
|
157
|
+
(type === WORKSHEET_TYPE.CYCLE_COUNT.value && worksheetStatus === WORKSHEET_STATUS.EXECUTING.value) ||
|
|
158
|
+
worksheetStatus === WORKSHEET_STATUS.DONE.value ||
|
|
159
|
+
worksheetStatus === WORKSHEET_STATUS.DEACTIVATED.value
|
|
160
|
+
) {
|
|
161
|
+
navigate(`worksheet_cycle_count/${record.name}`)
|
|
162
|
+
} else {
|
|
163
|
+
navigate(`cycle_count_review/${record.name}`)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
type: 'object',
|
|
170
|
+
name: 'inventoryCheck',
|
|
171
|
+
header: i18next.t('field.inventory_check_no'),
|
|
172
|
+
sortable: true,
|
|
173
|
+
width: 170,
|
|
174
|
+
imex: {
|
|
175
|
+
header: i18next.t('field.inventory_check_no'),
|
|
176
|
+
key: 'inventoryCheck.name',
|
|
177
|
+
width: 50,
|
|
178
|
+
type: 'string'
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
type: 'string',
|
|
183
|
+
name: 'checkCount',
|
|
184
|
+
header: i18next.t('field.cycle_count_task_no'),
|
|
185
|
+
sortable: true,
|
|
186
|
+
width: 170,
|
|
187
|
+
imex: {
|
|
188
|
+
header: i18next.t('field.cycle_count_task_no'),
|
|
189
|
+
key: 'checkCount',
|
|
190
|
+
width: 50,
|
|
191
|
+
type: 'string'
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
type: 'object',
|
|
196
|
+
name: 'bizplace',
|
|
197
|
+
header: i18next.t('field.company'),
|
|
198
|
+
sortable: true,
|
|
199
|
+
width: 250,
|
|
200
|
+
imex: {
|
|
201
|
+
header: i18next.t('field.company'),
|
|
202
|
+
key: 'bizplace.name',
|
|
203
|
+
width: 30,
|
|
204
|
+
type: 'array',
|
|
205
|
+
arrData: []
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
type: 'date',
|
|
210
|
+
name: 'executionDate',
|
|
211
|
+
header: i18next.t('field.execution_date'),
|
|
212
|
+
sortable: true,
|
|
213
|
+
width: 120,
|
|
214
|
+
imex: {
|
|
215
|
+
header: i18next.t('field.execution_date'),
|
|
216
|
+
key: 'executionDate',
|
|
217
|
+
width: 30,
|
|
218
|
+
type: 'string'
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
type: 'string',
|
|
223
|
+
name: 'inventoryCheckStatus',
|
|
224
|
+
header: i18next.t('field.order_status'),
|
|
225
|
+
sortable: true,
|
|
226
|
+
width: 150,
|
|
227
|
+
imex: {
|
|
228
|
+
header: i18next.t('field.order_status'),
|
|
229
|
+
key: 'inventoryCheckStatus',
|
|
230
|
+
width: 20,
|
|
231
|
+
type: 'string'
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
type: 'string',
|
|
236
|
+
name: 'status',
|
|
237
|
+
header: i18next.t('field.task_status'),
|
|
238
|
+
sortable: true,
|
|
239
|
+
width: 120,
|
|
240
|
+
imex: {
|
|
241
|
+
header: i18next.t('field.task_status'),
|
|
242
|
+
key: 'status',
|
|
243
|
+
width: 20,
|
|
244
|
+
type: 'string'
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: 'datetime',
|
|
249
|
+
name: 'startedAt',
|
|
250
|
+
header: i18next.t('field.started_at'),
|
|
251
|
+
sortable: true,
|
|
252
|
+
width: 160,
|
|
253
|
+
imex: {
|
|
254
|
+
header: i18next.t('field.started_at'),
|
|
255
|
+
key: 'startedAt',
|
|
256
|
+
width: 30,
|
|
257
|
+
type: 'datetime'
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
type: 'datetime',
|
|
262
|
+
name: 'endedAt',
|
|
263
|
+
header: i18next.t('field.ended_at'),
|
|
264
|
+
sortable: true,
|
|
265
|
+
width: 160,
|
|
266
|
+
imex: {
|
|
267
|
+
header: i18next.t('field.ended_at'),
|
|
268
|
+
key: 'endedAt',
|
|
269
|
+
width: 30,
|
|
270
|
+
type: 'datetime'
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
type: 'object',
|
|
275
|
+
name: 'updater',
|
|
276
|
+
header: i18next.t('field.updater'),
|
|
277
|
+
sortable: true,
|
|
278
|
+
width: 150,
|
|
279
|
+
imex: {
|
|
280
|
+
header: i18next.t('field.updater'),
|
|
281
|
+
key: 'updater.name',
|
|
282
|
+
width: 30,
|
|
283
|
+
type: 'object'
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
get searchForm() {
|
|
291
|
+
return this.shadowRoot.querySelector('search-form')
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
get dataGrist() {
|
|
295
|
+
return this.shadowRoot.querySelector('data-grist')
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
get bizplace() {
|
|
299
|
+
return this.searchForm.shadowRoot.querySelector('input[name=bizplace]')
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async fetchHandler({ page, limit, sorters = [] }) {
|
|
303
|
+
const filters = await this.searchForm.getQueryFilters()
|
|
304
|
+
filters.push({
|
|
305
|
+
name: 'type',
|
|
306
|
+
operator: 'in',
|
|
307
|
+
value: [
|
|
308
|
+
WORKSHEET_TYPE.CYCLE_COUNT.value,
|
|
309
|
+
WORKSHEET_TYPE.CYCLE_COUNT_RECHECK.value,
|
|
310
|
+
WORKSHEET_TYPE.STOCK_TAKE.value
|
|
311
|
+
]
|
|
312
|
+
})
|
|
313
|
+
const pagination = { page, limit }
|
|
314
|
+
const sortings = sorters
|
|
315
|
+
|
|
316
|
+
const response = await client.query({
|
|
317
|
+
query: gql`
|
|
318
|
+
query worksheets($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
319
|
+
worksheets(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
320
|
+
items {
|
|
321
|
+
id
|
|
322
|
+
name
|
|
323
|
+
checkCount
|
|
324
|
+
inventoryCheck {
|
|
325
|
+
id
|
|
326
|
+
name
|
|
327
|
+
description
|
|
328
|
+
executionDate
|
|
329
|
+
status
|
|
330
|
+
}
|
|
331
|
+
bizplace {
|
|
332
|
+
id
|
|
333
|
+
name
|
|
334
|
+
description
|
|
335
|
+
}
|
|
336
|
+
type
|
|
337
|
+
status
|
|
338
|
+
startedAt
|
|
339
|
+
createdAt
|
|
340
|
+
endedAt
|
|
341
|
+
updater {
|
|
342
|
+
name
|
|
343
|
+
description
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
total
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
`,
|
|
350
|
+
variables: {
|
|
351
|
+
filters,
|
|
352
|
+
pagination,
|
|
353
|
+
sortings
|
|
354
|
+
}
|
|
355
|
+
})
|
|
356
|
+
|
|
357
|
+
if (!response.errors) {
|
|
358
|
+
return {
|
|
359
|
+
total: response.data.worksheets.total || 0,
|
|
360
|
+
records:
|
|
361
|
+
response.data.worksheets.items.map(item => {
|
|
362
|
+
return {
|
|
363
|
+
...item,
|
|
364
|
+
executionDate: item.inventoryCheck && item.inventoryCheck.executionDate,
|
|
365
|
+
status: item.status,
|
|
366
|
+
inventoryCheckStatus: item.inventoryCheck && item.inventoryCheck.status
|
|
367
|
+
}
|
|
368
|
+
}) || {}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
async _fetchBizplaceList() {
|
|
374
|
+
const response = await client.query({
|
|
375
|
+
query: gql`
|
|
376
|
+
query bizplaces($filters: [Filter!]) {
|
|
377
|
+
bizplaces(filters: $filters) {
|
|
378
|
+
items {
|
|
379
|
+
id
|
|
380
|
+
name
|
|
381
|
+
description
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
`,
|
|
386
|
+
variables: {
|
|
387
|
+
filters: []
|
|
388
|
+
}
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
if (!response.errors) {
|
|
392
|
+
return response.data.bizplaces.items
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
_showSearchCustomer() {
|
|
397
|
+
openPopup(
|
|
398
|
+
html`
|
|
399
|
+
<search-popup
|
|
400
|
+
.complete="${async data => {
|
|
401
|
+
this.bizplace.value = data.name
|
|
402
|
+
}}"
|
|
403
|
+
></search-popup>
|
|
404
|
+
`,
|
|
405
|
+
{
|
|
406
|
+
backdrop: true,
|
|
407
|
+
size: 'large',
|
|
408
|
+
title: i18next.t('field.company')
|
|
409
|
+
}
|
|
410
|
+
)
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
_compareValues(key, order = 'asc') {
|
|
414
|
+
return function innerSort(a, b) {
|
|
415
|
+
if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
|
|
416
|
+
return 0
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const varA = typeof a[key] === 'string' ? a[key].toUpperCase() : a[key]
|
|
420
|
+
const varB = typeof b[key] === 'string' ? b[key].toUpperCase() : b[key]
|
|
421
|
+
|
|
422
|
+
let comparison = 0
|
|
423
|
+
if (varA > varB) {
|
|
424
|
+
comparison = 1
|
|
425
|
+
} else if (varA < varB) {
|
|
426
|
+
comparison = -1
|
|
427
|
+
}
|
|
428
|
+
return order === 'desc' ? comparison * -1 : comparison
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
get _columns() {
|
|
433
|
+
return this.config.columns
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
async _exportableData() {
|
|
437
|
+
let records = []
|
|
438
|
+
records = this.dataGrist.data.records
|
|
439
|
+
|
|
440
|
+
const fetchBizplaces = await this._fetchBizplaceList()
|
|
441
|
+
|
|
442
|
+
var headerSetting = this.dataGrist._config.columns
|
|
443
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
|
444
|
+
.map(column => {
|
|
445
|
+
if (column.imex.key == 'bizplace.name') {
|
|
446
|
+
column.imex.arrData = fetchBizplaces.map(item => {
|
|
447
|
+
return {
|
|
448
|
+
id: item.id,
|
|
449
|
+
name: item.name
|
|
450
|
+
}
|
|
451
|
+
})
|
|
452
|
+
}
|
|
453
|
+
return column.imex
|
|
454
|
+
})
|
|
455
|
+
|
|
456
|
+
var data = records.map(item => {
|
|
457
|
+
return {
|
|
458
|
+
id: item.id,
|
|
459
|
+
...this.config.columns
|
|
460
|
+
.filter(column => column.type !== 'gutter' /* && column.record !== undefined */ && column.imex !== undefined)
|
|
461
|
+
.reduce((record, column) => {
|
|
462
|
+
record[column.imex.key] = column.imex.key
|
|
463
|
+
.split('.')
|
|
464
|
+
.reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)
|
|
465
|
+
if (column.type === 'datetime' && record[column.imex.key] !== '' && record[column.imex.key] !== null) {
|
|
466
|
+
record[column.imex.key] = new Date(parseInt(record[column.imex.key])).toLocaleString()
|
|
467
|
+
}
|
|
468
|
+
return record
|
|
469
|
+
}, {})
|
|
470
|
+
}
|
|
471
|
+
})
|
|
472
|
+
return { header: headerSetting, data: data }
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
window.customElements.define('cycle-count-worksheet-list', CycleCountWorksheetList)
|