@things-factory/operato-wms 4.3.2 → 4.4.0-alpha.0
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/constants/index.js +0 -1
- package/client/pages/constants/setting.js +0 -1
- package/client/pages/inbound/putaway-product.js +1 -3
- package/client/pages/inbound/unload-product.js +11 -21
- package/client/pages/inventory/inventory-adjustment-approval.js +9 -24
- package/client/pages/inventory/inventory-adjustment.js +13 -79
- package/client/pages/master/product/product-list.js +1 -1
- package/client/pages/order/arrival-notice/arrival-notice-detail.js +2 -0
- package/client/pages/order/arrival-notice/receive-arrival-notice.js +2 -0
- package/client/pages/order/goods-received-note/customer-received-note.js +0 -3
- package/client/pages/order/goods-received-note/received-note-detail.js +0 -3
- package/client/pages/order/release-order/b2c/b2c-order-requests.js +30 -21
- package/client/pages/order/release-order/bulk-print-packing-list.js +0 -4
- package/client/pages/order/release-order/receive-release-order-request.js +2 -0
- package/client/pages/order/release-order/release-order-detail.js +26 -44
- package/client/pages/order/return-order/receive-return-order-requests.js +2 -0
- package/client/pages/order/transfer-order/receive-transfer-order-request.js +1 -1
- package/client/pages/order/transport-order/print-delivery-note.js +1 -0
- package/client/pages/order/transport-order/view-delivery-note.js +1 -1
- package/client/pages/order/vas-order/receive-vas-order.js +2 -0
- package/client/pages/outbound/inventory-assign-popup.js +2 -7
- package/client/pages/outbound/inventory-auto-assign-popup.js +1 -2
- package/client/pages/outbound/loading-product.js +11 -49
- package/client/pages/outbound/packing-product.js +6 -42
- package/client/pages/outbound/packing-worksheet-list.js +0 -15
- package/client/pages/outbound/picking-product.js +13 -150
- package/client/pages/outbound/single-outbound-worksheet.js +22 -10
- package/client/pages/outbound/sorting-product.js +15 -78
- package/client/pages/outbound/worksheet-batch-picking.js +2 -9
- package/client/pages/outbound/worksheet-packing.js +2 -7
- package/client/pages/outbound/worksheet-picking.js +2 -9
- package/client/pages/report/inventory-summary-report.js +0 -8
- package/client/pages/report/outbound-order-details-report.js +0 -18
- package/client/pages/vas/abstract-execute-vas.js +7 -12
- package/client/pages/vas/print-product-label.js +6 -15
- package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +1 -3
- package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +1 -3
- package/client/route.js +0 -12
- package/dist-server/entities/index.js +1 -2
- package/dist-server/entities/index.js.map +1 -1
- package/dist-server/graphql/index.js +5 -1
- package/dist-server/graphql/index.js.map +1 -1
- package/dist-server/graphql/resolvers/board-setting/board-settings.js +1 -2
- package/dist-server/graphql/resolvers/board-setting/board-settings.js.map +1 -1
- package/dist-server/graphql/resolvers/index.js +7 -4
- package/dist-server/graphql/resolvers/index.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +1 -3
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/types/index.js +8 -5
- package/dist-server/graphql/types/index.js.map +1 -1
- package/dist-server/graphql/types/reports/outbound-order-details-report.js +0 -2
- package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/index.js +5 -2
- package/dist-server/index.js.map +1 -1
- package/dist-server/opa-app-setting-constants.js +1 -2
- package/dist-server/opa-app-setting-constants.js.map +1 -1
- package/dist-server/utils/index.js +5 -1
- package/dist-server/utils/index.js.map +1 -1
- package/helps/release-note.ko.md +9 -11
- package/helps/release-note.md +9 -11
- package/helps/release-note.ms.md +9 -11
- package/helps/release-note.zh.md +9 -11
- package/package.json +50 -50
- package/server/entities/index.ts +2 -2
- package/server/graphql/resolvers/board-setting/board-settings.ts +2 -4
- package/server/graphql/resolvers/index.ts +2 -3
- package/server/graphql/resolvers/reports/outbound-order-details-report.ts +2 -6
- package/server/graphql/types/index.ts +4 -4
- package/server/graphql/types/reports/outbound-order-details-report.ts +0 -2
- package/server/index.ts +1 -2
- package/server/opa-app-setting-constants.ts +0 -1
- package/things-factory.config.js +0 -13
- package/translations/en.json +8 -48
- package/translations/ko.json +1 -35
- package/translations/ms.json +1 -35
- package/translations/zh.json +1 -35
- package/client/constants/index.js +0 -1
- package/client/constants/order.js +0 -14
- package/client/pages/constants/tote.js +0 -14
- package/client/pages/master/tote-list.js +0 -740
- package/client/pages/order/draft-release-good/draft-release-good-detail.js +0 -1163
- package/client/pages/order/draft-release-good/draft-release-good-list.js +0 -546
- package/client/pages/outbound/order-remark-popup.js +0 -112
- package/client/pages/outbound/tote-popup.js +0 -461
- package/dist-server/entities/warehouse-bizplace-onhand-inventory.js +0 -168
- package/dist-server/entities/warehouse-bizplace-onhand-inventory.js.map +0 -1
- package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/index.js +0 -6
- package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/index.js.map +0 -1
- package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js +0 -58
- package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js.map +0 -1
- package/dist-server/graphql/types/warehouse-inventory-adjustment/index.js +0 -9
- package/dist-server/graphql/types/warehouse-inventory-adjustment/index.js.map +0 -1
- package/server/entities/warehouse-bizplace-onhand-inventory.ts +0 -141
- package/server/graphql/resolvers/warehouse-inventory-adjustment/index.ts +0 -5
- package/server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts +0 -68
- package/server/graphql/types/warehouse-inventory-adjustment/index.ts +0 -5
|
@@ -1,740 +0,0 @@
|
|
|
1
|
-
import '@things-factory/form-ui'
|
|
2
|
-
import '@things-factory/grist-ui'
|
|
3
|
-
import '@things-factory/import-ui'
|
|
4
|
-
|
|
5
|
-
import { client, CustomAlert, PageView, store, gqlContext } from '@things-factory/shell'
|
|
6
|
-
import { connect } from 'pwa-helpers/connect-mixin'
|
|
7
|
-
import { css, html } from 'lit-element'
|
|
8
|
-
import { getCodeByName } from '@things-factory/code-base'
|
|
9
|
-
import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
|
|
10
|
-
import { isMobileDevice } from '@things-factory/utils'
|
|
11
|
-
import { i18next, localize } from '@things-factory/i18n-base'
|
|
12
|
-
import { openPopup } from '@things-factory/layout-base'
|
|
13
|
-
import { TOTE_LABEL_SETTING_KEY } from '../constants'
|
|
14
|
-
import { DirectPrinter } from '@things-factory/barcode-base'
|
|
15
|
-
import gql from 'graphql-tag'
|
|
16
|
-
|
|
17
|
-
class ToteList extends connect(store)(localize(i18next)(PageView)) {
|
|
18
|
-
static get properties() {
|
|
19
|
-
return {
|
|
20
|
-
config: Object,
|
|
21
|
-
data: Object,
|
|
22
|
-
importHandler: Object,
|
|
23
|
-
_isDeletedRecord: Boolean,
|
|
24
|
-
_toteStatus: Object,
|
|
25
|
-
_toteLabel: Object
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static get styles() {
|
|
30
|
-
return [
|
|
31
|
-
ScrollbarStyles,
|
|
32
|
-
css`
|
|
33
|
-
:host {
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-direction: column;
|
|
36
|
-
overflow: hidden;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
search-form {
|
|
40
|
-
overflow: visible;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
data-grist {
|
|
44
|
-
overflow-y: auto;
|
|
45
|
-
flex: 1;
|
|
46
|
-
}
|
|
47
|
-
`
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
render() {
|
|
52
|
-
return html`
|
|
53
|
-
<search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
|
|
54
|
-
|
|
55
|
-
<data-grist
|
|
56
|
-
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
57
|
-
.config=${this.config}
|
|
58
|
-
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
59
|
-
></data-grist>
|
|
60
|
-
`
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
constructor() {
|
|
64
|
-
super()
|
|
65
|
-
this._isDeletedRecord = false
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
get context() {
|
|
69
|
-
let actions = []
|
|
70
|
-
|
|
71
|
-
actions.push(
|
|
72
|
-
{
|
|
73
|
-
title: i18next.t('button.print_label'),
|
|
74
|
-
action: this._printToteLabel.bind(this),
|
|
75
|
-
...CommonButtonStyles.label
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
title: i18next.t('button.bulk_update_status'),
|
|
79
|
-
action: this._bulkUpdateToteStatus.bind(this),
|
|
80
|
-
...CommonButtonStyles.label
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
title: i18next.t('button.save'),
|
|
84
|
-
action: this._saveTote.bind(this),
|
|
85
|
-
...CommonButtonStyles.save
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
if (this._isDeletedRecord) {
|
|
90
|
-
actions.push({
|
|
91
|
-
title: i18next.t('button.restore'),
|
|
92
|
-
action: this._undeleteTotes.bind(this),
|
|
93
|
-
...CommonButtonStyles.submit
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
actions.push({
|
|
98
|
-
title: i18next.t('button.delete'),
|
|
99
|
-
action: this._deleteTote.bind(this),
|
|
100
|
-
...CommonButtonStyles.delete
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
title: i18next.t('title.tote'),
|
|
105
|
-
actions,
|
|
106
|
-
exportable: {
|
|
107
|
-
name: i18next.t('title.tote'),
|
|
108
|
-
data: this._exportableData.bind(this)
|
|
109
|
-
},
|
|
110
|
-
importable: {
|
|
111
|
-
handler: this._importableData.bind(this)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
pageUpdated(changes, lifecycle) {
|
|
117
|
-
if (this.active) {
|
|
118
|
-
this.dataGrist.fetch()
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
async pageInitialized() {
|
|
123
|
-
this._toteStatus = await getCodeByName('TOTE_STATUS')
|
|
124
|
-
const partners = [...(await this._fetchPartners())]
|
|
125
|
-
|
|
126
|
-
this._searchFields = [
|
|
127
|
-
{
|
|
128
|
-
label: i18next.t('field.tote_no'),
|
|
129
|
-
name: 'name',
|
|
130
|
-
type: 'text',
|
|
131
|
-
props: { searchOper: 'i_like' }
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
label: i18next.t('field.company'),
|
|
135
|
-
name: 'bizplace',
|
|
136
|
-
type: 'select',
|
|
137
|
-
options: [
|
|
138
|
-
{ value: '' },
|
|
139
|
-
...partners
|
|
140
|
-
.map(partner => {
|
|
141
|
-
return {
|
|
142
|
-
name: `${partner.name} ${partner.description ? `(${partner.description})` : ''}`,
|
|
143
|
-
value: partner.id
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
.sort(this._compareValues('name', 'asc'))
|
|
147
|
-
],
|
|
148
|
-
props: { searchOper: 'eq' }
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
label: i18next.t('field.status'),
|
|
152
|
-
name: 'status',
|
|
153
|
-
type: 'select',
|
|
154
|
-
options: [
|
|
155
|
-
{ value: '' },
|
|
156
|
-
...this._toteStatus.map(status => {
|
|
157
|
-
return {
|
|
158
|
-
name: status.name,
|
|
159
|
-
value: status.name
|
|
160
|
-
}
|
|
161
|
-
})
|
|
162
|
-
],
|
|
163
|
-
props: { searchOper: 'eq' }
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
label: i18next.t('field.deleted'),
|
|
167
|
-
name: 'deleted',
|
|
168
|
-
type: 'checkbox',
|
|
169
|
-
props: { searchOper: 'eq' }
|
|
170
|
-
}
|
|
171
|
-
]
|
|
172
|
-
|
|
173
|
-
this.config = {
|
|
174
|
-
list: {
|
|
175
|
-
fields: ['toteNo', 'company', 'status']
|
|
176
|
-
},
|
|
177
|
-
rows: { selectable: { multiple: true } },
|
|
178
|
-
columns: [
|
|
179
|
-
{ type: 'gutter', gutterName: 'dirty' },
|
|
180
|
-
{ type: 'gutter', gutterName: 'sequence' },
|
|
181
|
-
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
182
|
-
{
|
|
183
|
-
type: 'string',
|
|
184
|
-
name: 'name',
|
|
185
|
-
header: i18next.t('field.tote_no'),
|
|
186
|
-
imex: { header: i18next.t('field.tote_no'), key: 'name', width: 50, type: 'string' },
|
|
187
|
-
record: {
|
|
188
|
-
editable: true
|
|
189
|
-
},
|
|
190
|
-
sortable: true,
|
|
191
|
-
width: 100
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
type: 'object',
|
|
195
|
-
name: 'bizplace',
|
|
196
|
-
header: i18next.t('field.company'),
|
|
197
|
-
imex: {
|
|
198
|
-
header: i18next.t('field.company'),
|
|
199
|
-
key: 'bizplace.name',
|
|
200
|
-
width: 50,
|
|
201
|
-
type: 'array',
|
|
202
|
-
arrData: partners.map(partner => {
|
|
203
|
-
return {
|
|
204
|
-
name: partner.name,
|
|
205
|
-
id: partner.id
|
|
206
|
-
}
|
|
207
|
-
})
|
|
208
|
-
},
|
|
209
|
-
record: {
|
|
210
|
-
editable: true,
|
|
211
|
-
options: {
|
|
212
|
-
queryName: 'partnersBizplaces'
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
sortable: true,
|
|
216
|
-
width: 250
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
type: 'code',
|
|
220
|
-
name: 'status',
|
|
221
|
-
header: i18next.t('field.status'),
|
|
222
|
-
imex: {
|
|
223
|
-
header: i18next.t('field.status'),
|
|
224
|
-
key: 'status',
|
|
225
|
-
width: 50,
|
|
226
|
-
type: 'array',
|
|
227
|
-
arrData: this._toteStatus.map(toteStatus => {
|
|
228
|
-
return {
|
|
229
|
-
name: toteStatus.name
|
|
230
|
-
}
|
|
231
|
-
})
|
|
232
|
-
},
|
|
233
|
-
record: {
|
|
234
|
-
editable: true,
|
|
235
|
-
codeName: 'TOTE_STATUS'
|
|
236
|
-
},
|
|
237
|
-
sortable: true,
|
|
238
|
-
width: 130
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
type: 'datetime',
|
|
242
|
-
name: 'updatedAt',
|
|
243
|
-
header: i18next.t('field.updated_at'),
|
|
244
|
-
sortable: true,
|
|
245
|
-
width: 150
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
type: 'object',
|
|
249
|
-
name: 'updater',
|
|
250
|
-
header: i18next.t('field.updater'),
|
|
251
|
-
sortable: true,
|
|
252
|
-
width: 150
|
|
253
|
-
}
|
|
254
|
-
]
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
get searchForm() {
|
|
259
|
-
return this.shadowRoot.querySelector('search-form')
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
get dataGrist() {
|
|
263
|
-
return this.shadowRoot.querySelector('data-grist')
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
_importableData(records) {
|
|
267
|
-
setTimeout(() => {
|
|
268
|
-
openPopup(
|
|
269
|
-
html`
|
|
270
|
-
<import-pop-up
|
|
271
|
-
.records=${records}
|
|
272
|
-
.config=${{
|
|
273
|
-
rows: this.config.rows,
|
|
274
|
-
columns: [...this.config.columns.filter(column => column.imex !== undefined)]
|
|
275
|
-
}}
|
|
276
|
-
.importHandler="${this.importHandler.bind(this)}"
|
|
277
|
-
></import-pop-up>
|
|
278
|
-
`,
|
|
279
|
-
{
|
|
280
|
-
backdrop: true,
|
|
281
|
-
size: 'large',
|
|
282
|
-
title: i18next.t('title.import')
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
}, 500)
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
async fetchHandler({ page, limit, sorters = [] }) {
|
|
289
|
-
const response = await client.query({
|
|
290
|
-
query: gql`
|
|
291
|
-
query totes($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
292
|
-
totes(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
293
|
-
items {
|
|
294
|
-
id
|
|
295
|
-
name
|
|
296
|
-
bizplace {
|
|
297
|
-
id
|
|
298
|
-
name
|
|
299
|
-
description
|
|
300
|
-
}
|
|
301
|
-
domain {
|
|
302
|
-
id
|
|
303
|
-
name
|
|
304
|
-
}
|
|
305
|
-
status
|
|
306
|
-
updatedAt
|
|
307
|
-
updater {
|
|
308
|
-
id
|
|
309
|
-
name
|
|
310
|
-
description
|
|
311
|
-
}
|
|
312
|
-
deletedAt
|
|
313
|
-
}
|
|
314
|
-
total
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
`,
|
|
318
|
-
variables: {
|
|
319
|
-
filters: [...this.searchForm.queryFilters],
|
|
320
|
-
pagination: { page, limit },
|
|
321
|
-
sortings: sorters
|
|
322
|
-
}
|
|
323
|
-
})
|
|
324
|
-
|
|
325
|
-
if (!response.error) {
|
|
326
|
-
this._isDeletedRecord = response.data.totes.items[0]?.deletedAt ? true : false
|
|
327
|
-
|
|
328
|
-
this.updateContext()
|
|
329
|
-
|
|
330
|
-
return {
|
|
331
|
-
total: response.data.totes.total || 0,
|
|
332
|
-
records: response.data.totes.items || []
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
async importHandler(patches) {
|
|
338
|
-
try {
|
|
339
|
-
patches.map(itm => {
|
|
340
|
-
if (itm.cuFlag == '+') {
|
|
341
|
-
if (!itm.bizplace?.id || !itm.status || !itm.name) {
|
|
342
|
-
throw new Error(i18next.t('text.empty_value_in_list'))
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
})
|
|
346
|
-
|
|
347
|
-
this.dataGrist.showSpinner()
|
|
348
|
-
const response = await client.query({
|
|
349
|
-
query: gql`
|
|
350
|
-
mutation updateMultipleTote($patches: [TotePatch!]!) {
|
|
351
|
-
updateMultipleTote(patches: $patches) {
|
|
352
|
-
name
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
`,
|
|
356
|
-
variables: {
|
|
357
|
-
patches
|
|
358
|
-
}
|
|
359
|
-
})
|
|
360
|
-
if (!response.errors) {
|
|
361
|
-
history.back()
|
|
362
|
-
this.dataGrist.fetch()
|
|
363
|
-
document.dispatchEvent(
|
|
364
|
-
new CustomEvent('notify', {
|
|
365
|
-
detail: {
|
|
366
|
-
message: i18next.t('text.data_imported_successfully')
|
|
367
|
-
}
|
|
368
|
-
})
|
|
369
|
-
)
|
|
370
|
-
}
|
|
371
|
-
this.dataGrist.hideSpinner()
|
|
372
|
-
} catch (e) {
|
|
373
|
-
this._showToast(e)
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
async _saveTote() {
|
|
378
|
-
let patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
|
|
379
|
-
this._validateTote(patches)
|
|
380
|
-
if (patches && patches.length) {
|
|
381
|
-
this.dataGrist.showSpinner()
|
|
382
|
-
const response = await client.mutate({
|
|
383
|
-
mutation: gql`
|
|
384
|
-
mutation updateMultipleTote($patches: [TotePatch!]!) {
|
|
385
|
-
updateMultipleTote(patches: $patches) {
|
|
386
|
-
name
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
`,
|
|
390
|
-
variables: {
|
|
391
|
-
patches
|
|
392
|
-
}
|
|
393
|
-
})
|
|
394
|
-
|
|
395
|
-
if (!response.errors) {
|
|
396
|
-
this.dataGrist.fetch()
|
|
397
|
-
document.dispatchEvent(
|
|
398
|
-
new CustomEvent('notify', {
|
|
399
|
-
detail: {
|
|
400
|
-
message: i18next.t('text.data_updated_successfully')
|
|
401
|
-
}
|
|
402
|
-
})
|
|
403
|
-
)
|
|
404
|
-
}
|
|
405
|
-
this.dataGrist.hideSpinner()
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
_validateTote(patches) {
|
|
410
|
-
for (const patch of patches) {
|
|
411
|
-
if (patch.cuFlag == '+') {
|
|
412
|
-
if (!patch.bizplace) {
|
|
413
|
-
throw document.dispatchEvent(
|
|
414
|
-
new CustomEvent('notify', {
|
|
415
|
-
detail: {
|
|
416
|
-
message: i18next.t('text.company_field_is_empty')
|
|
417
|
-
}
|
|
418
|
-
})
|
|
419
|
-
)
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
if (!patch.name) {
|
|
423
|
-
throw document.dispatchEvent(
|
|
424
|
-
new CustomEvent('notify', {
|
|
425
|
-
detail: {
|
|
426
|
-
message: i18next.t('text.tote_field_is_empty')
|
|
427
|
-
}
|
|
428
|
-
})
|
|
429
|
-
)
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
if (!patch.status) {
|
|
433
|
-
throw document.dispatchEvent(
|
|
434
|
-
new CustomEvent('notify', {
|
|
435
|
-
detail: {
|
|
436
|
-
message: i18next.t('text.status_field_is_empty')
|
|
437
|
-
}
|
|
438
|
-
})
|
|
439
|
-
)
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
async _deleteTote() {
|
|
446
|
-
CustomAlert({
|
|
447
|
-
title: i18next.t('text.are_you_sure'),
|
|
448
|
-
text: i18next.t('text.you_can_still_restore_after_deleting'),
|
|
449
|
-
type: 'warning',
|
|
450
|
-
confirmButton: { text: i18next.t('button.delete'), color: '#22a6a7' },
|
|
451
|
-
cancelButton: { text: 'cancel', color: '#cfcfcf' },
|
|
452
|
-
callback: async result => {
|
|
453
|
-
if (result.value) {
|
|
454
|
-
this.dataGrist.showSpinner()
|
|
455
|
-
const id = this.dataGrist.selected.map(record => record.id)
|
|
456
|
-
if (id && id.length > 0) {
|
|
457
|
-
const response = await client.query({
|
|
458
|
-
query: gql`
|
|
459
|
-
mutation deleteTotes($id: [String!]!) {
|
|
460
|
-
deleteTotes(ids: $id)
|
|
461
|
-
}
|
|
462
|
-
`,
|
|
463
|
-
variables: { id }
|
|
464
|
-
})
|
|
465
|
-
|
|
466
|
-
if (!response.errors) {
|
|
467
|
-
this.dataGrist.fetch()
|
|
468
|
-
document.dispatchEvent(
|
|
469
|
-
new CustomEvent('notify', {
|
|
470
|
-
detail: {
|
|
471
|
-
message: i18next.t('text.data_deleted_successfully')
|
|
472
|
-
}
|
|
473
|
-
})
|
|
474
|
-
)
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
this.dataGrist.hideSpinner()
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
})
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
async _undeleteTotes() {
|
|
484
|
-
const ids = this.dataGrist.selected.map(record => record.id)
|
|
485
|
-
|
|
486
|
-
if (!ids?.length) {
|
|
487
|
-
return this.showToast(i18next.t('text.there_is_nothing_to_restore'))
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
const answer = await CustomAlert({
|
|
491
|
-
type: 'warning',
|
|
492
|
-
title: i18next.t('button.restore'),
|
|
493
|
-
text: i18next.t('text.are_you_sure'),
|
|
494
|
-
confirmButton: { text: i18next.t('button.restore') },
|
|
495
|
-
cancelButton: { text: i18next.t('button.cancel') }
|
|
496
|
-
})
|
|
497
|
-
|
|
498
|
-
if (!answer.value) return
|
|
499
|
-
|
|
500
|
-
const response = await client.mutate({
|
|
501
|
-
mutation: gql`
|
|
502
|
-
mutation undeleteTotes($ids: [String!]!) {
|
|
503
|
-
undeleteTotes(ids: $ids)
|
|
504
|
-
}
|
|
505
|
-
`,
|
|
506
|
-
variables: { ids },
|
|
507
|
-
context: gqlContext()
|
|
508
|
-
})
|
|
509
|
-
|
|
510
|
-
if (!response.errors) {
|
|
511
|
-
CustomAlert({
|
|
512
|
-
type: 'success',
|
|
513
|
-
title: i18next.t('text.completed'),
|
|
514
|
-
text: i18next.t('text.data_restore_successfully'),
|
|
515
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
516
|
-
})
|
|
517
|
-
this.dataGrist.fetch()
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
async _bulkUpdateToteStatus() {
|
|
522
|
-
try {
|
|
523
|
-
let selectedIds
|
|
524
|
-
if (this.dataGrist.selected && this.dataGrist.selected.length > 0) {
|
|
525
|
-
selectedIds = this.dataGrist.selected.map(record => record.id)
|
|
526
|
-
} else {
|
|
527
|
-
throw new Error('Please select at least 1 record to update status')
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
const statusFilter = (await this.searchForm.getQueryFilters()).find(x => x.name === 'status')
|
|
531
|
-
|
|
532
|
-
if (!statusFilter) {
|
|
533
|
-
throw new Error('Please choose a status to update')
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
const result = await CustomAlert({
|
|
537
|
-
title: i18next.t('title.are_you_sure'),
|
|
538
|
-
text: i18next.t('text.bulk_update_status'),
|
|
539
|
-
confirmButton: { text: i18next.t('button.confirm') },
|
|
540
|
-
cancelButton: { text: i18next.t('button.cancel') }
|
|
541
|
-
})
|
|
542
|
-
|
|
543
|
-
if (!result.value) return
|
|
544
|
-
|
|
545
|
-
const response = await client.mutate({
|
|
546
|
-
mutation: gql`
|
|
547
|
-
mutation bulkUpdateToteStatus($ids: [String!]!, $status: String!) {
|
|
548
|
-
bulkUpdateToteStatus(ids: $ids, status: $status)
|
|
549
|
-
}
|
|
550
|
-
`,
|
|
551
|
-
variables: {
|
|
552
|
-
ids: selectedIds,
|
|
553
|
-
status: statusFilter.value
|
|
554
|
-
}
|
|
555
|
-
})
|
|
556
|
-
|
|
557
|
-
if (!response.errors) {
|
|
558
|
-
await CustomAlert({
|
|
559
|
-
title: i18next.t('title.bulk_update_status'),
|
|
560
|
-
text: i18next.t('text.status_update_completed'),
|
|
561
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
562
|
-
})
|
|
563
|
-
|
|
564
|
-
this.dataGrist.fetch()
|
|
565
|
-
}
|
|
566
|
-
} catch (e) {
|
|
567
|
-
this._showToast(e)
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
async _fetchPartners() {
|
|
572
|
-
const filters = []
|
|
573
|
-
const response = await client.query({
|
|
574
|
-
query: gql`
|
|
575
|
-
query partnersBizplaces($filters: [Filter!]) {
|
|
576
|
-
partnersBizplaces(filters: $filters) {
|
|
577
|
-
items {
|
|
578
|
-
id
|
|
579
|
-
name
|
|
580
|
-
description
|
|
581
|
-
domain {
|
|
582
|
-
id
|
|
583
|
-
name
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
`,
|
|
589
|
-
variables: { filters }
|
|
590
|
-
})
|
|
591
|
-
this.targetBizplace = response.data.partnersBizplaces || {}
|
|
592
|
-
if (!response.errors) {
|
|
593
|
-
this._partnersList = response.data.partnersBizplaces
|
|
594
|
-
return response.data.partnersBizplaces.items
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
_compareValues(key, order = 'asc') {
|
|
599
|
-
return function innerSort(a, b) {
|
|
600
|
-
if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
|
|
601
|
-
return 0
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
const varA = typeof a[key] === 'string' ? a[key].toUpperCase() : a[key]
|
|
605
|
-
const varB = typeof b[key] === 'string' ? b[key].toUpperCase() : b[key]
|
|
606
|
-
|
|
607
|
-
let comparison = 0
|
|
608
|
-
if (varA > varB) {
|
|
609
|
-
comparison = 1
|
|
610
|
-
} else if (varA < varB) {
|
|
611
|
-
comparison = -1
|
|
612
|
-
}
|
|
613
|
-
return order === 'desc' ? comparison * -1 : comparison
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
get _columns() {
|
|
618
|
-
return this.config.columns
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
_exportableData() {
|
|
622
|
-
let records = []
|
|
623
|
-
if (this.dataGrist.selected && this.dataGrist.selected.length > 0) {
|
|
624
|
-
records = this.dataGrist.selected
|
|
625
|
-
} else {
|
|
626
|
-
records = this.dataGrist.data.records
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
var headerSetting = this.dataGrist._config.columns
|
|
630
|
-
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
|
631
|
-
.map(column => {
|
|
632
|
-
return column.imex
|
|
633
|
-
})
|
|
634
|
-
|
|
635
|
-
var data = records.map(item => {
|
|
636
|
-
return {
|
|
637
|
-
id: item.id,
|
|
638
|
-
...this._columns
|
|
639
|
-
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
|
640
|
-
.reduce((record, column) => {
|
|
641
|
-
record[column.imex.key] = column.imex.key
|
|
642
|
-
.split('.')
|
|
643
|
-
.reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)
|
|
644
|
-
return record
|
|
645
|
-
}, {})
|
|
646
|
-
}
|
|
647
|
-
})
|
|
648
|
-
|
|
649
|
-
return { header: headerSetting, data: data }
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
async _printToteLabel() {
|
|
653
|
-
var labelId = this._toteLabel && this._toteLabel.id
|
|
654
|
-
let items = []
|
|
655
|
-
|
|
656
|
-
if (this.dataGrist.selected && this.dataGrist.selected.length > 0) {
|
|
657
|
-
items = this.dataGrist.selected
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
if (!labelId) {
|
|
661
|
-
document.dispatchEvent(
|
|
662
|
-
new CustomEvent('notify', {
|
|
663
|
-
detail: {
|
|
664
|
-
level: 'error',
|
|
665
|
-
message: `${i18next.t('text.no_label_setting_was_found')}. ${i18next.t('text.please_check_your_setting')}`
|
|
666
|
-
}
|
|
667
|
-
})
|
|
668
|
-
)
|
|
669
|
-
} else {
|
|
670
|
-
if (items.length <= 0) {
|
|
671
|
-
document.dispatchEvent(
|
|
672
|
-
new CustomEvent('notify', {
|
|
673
|
-
detail: {
|
|
674
|
-
level: 'error',
|
|
675
|
-
message: `${i18next.t('text.there_is_no_selected_items')}`
|
|
676
|
-
}
|
|
677
|
-
})
|
|
678
|
-
)
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
for (var item of items) {
|
|
682
|
-
var searchParams = new URLSearchParams()
|
|
683
|
-
|
|
684
|
-
/* for tote record mapping */
|
|
685
|
-
searchParams.append('name', item.name)
|
|
686
|
-
searchParams.append('bizplace', item.bizplace.name)
|
|
687
|
-
searchParams.append('warehouse', item.domain.name)
|
|
688
|
-
|
|
689
|
-
try {
|
|
690
|
-
const response = await fetch(`label-command/${labelId}?${searchParams.toString()}`, {
|
|
691
|
-
method: 'GET'
|
|
692
|
-
})
|
|
693
|
-
|
|
694
|
-
if (response.status !== 200) {
|
|
695
|
-
throw `Error: Can't get label command from server (response: ${response.status})`
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
var command = await response.text()
|
|
699
|
-
|
|
700
|
-
if (!this.printer) {
|
|
701
|
-
this.printer = new DirectPrinter()
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
await this.printer.print(command)
|
|
705
|
-
} catch (ex) {
|
|
706
|
-
document.dispatchEvent(
|
|
707
|
-
new CustomEvent('notify', {
|
|
708
|
-
detail: {
|
|
709
|
-
level: 'error',
|
|
710
|
-
message: ex,
|
|
711
|
-
ex
|
|
712
|
-
}
|
|
713
|
-
})
|
|
714
|
-
)
|
|
715
|
-
|
|
716
|
-
delete this.printer
|
|
717
|
-
break
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
stateChanged(state) {
|
|
724
|
-
var toteLabelSetting = state.dashboard[TOTE_LABEL_SETTING_KEY]
|
|
725
|
-
this._toteLabel = (toteLabelSetting && toteLabelSetting.board) || {}
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
_showToast({ type, message }) {
|
|
729
|
-
document.dispatchEvent(
|
|
730
|
-
new CustomEvent('notify', {
|
|
731
|
-
detail: {
|
|
732
|
-
type,
|
|
733
|
-
message
|
|
734
|
-
}
|
|
735
|
-
})
|
|
736
|
-
)
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
window.customElements.define('tote-list', ToteList)
|