@things-factory/operato-wms 4.3.185 → 4.3.187
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 +3 -0
- package/client/pages/constants/location.js +4 -0
- package/client/pages/constants/order.js +3 -1
- package/client/pages/constants/replenishment-config.js +161 -0
- package/client/pages/constants/replenishment.js +22 -0
- package/client/pages/constants/worksheet-replenishment-config.js +119 -0
- package/client/pages/constants/worksheet.js +8 -0
- package/client/pages/inbound/putaway-product.js +185 -11
- package/client/pages/inbound/undo-putaway-popup.js +39 -2
- package/client/pages/inbound/unload-product.js +126 -14
- package/client/pages/inventory/inventory-by-product.js +23 -1
- package/client/pages/order/draft-release-good/draft-release-good-detail.js +7 -0
- package/client/pages/outbound/picking-product.js +104 -32
- package/client/pages/replenishment/replenishment-detail.js +429 -0
- package/client/pages/replenishment/replenishment-worksheet-list.js +470 -0
- package/client/pages/replenishment/replenishment.js +510 -0
- package/client/pages/replenishment/worksheet-replenishment.js +414 -0
- package/client/route.js +17 -0
- package/config.development.js +28 -21
- package/helps/release-note.ko.md +4 -4
- package/helps/release-note.md +4 -4
- package/helps/release-note.ms.md +4 -4
- package/helps/release-note.zh.md +4 -4
- package/package.json +12 -12
- package/things-factory.config.js +18 -0
- package/translations/en.json +35 -9
- package/translations/ko.json +26 -1
- package/translations/ms.json +26 -1
- package/translations/zh.json +26 -1
- package/config.production.js +0 -104
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import '@things-factory/grist-ui'
|
|
2
|
+
import '@things-factory/barcode-ui'
|
|
3
|
+
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
import { css, html } from 'lit-element'
|
|
6
|
+
|
|
7
|
+
import { MultiColumnFormStyles } from '@things-factory/form-ui'
|
|
8
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
9
|
+
import { client, CustomAlert, navigate, PageView } from '@things-factory/shell'
|
|
10
|
+
import { CommonButtonStyles } from '@things-factory/styles'
|
|
11
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
12
|
+
import { REPLENISHMENT_CONFIG, ORDER_TYPES, ORDER_STATUS } from '../constants'
|
|
13
|
+
import { showToast } from '../../util/index'
|
|
14
|
+
import { getCodeByName } from '@things-factory/code-base'
|
|
15
|
+
|
|
16
|
+
class ReplenishmentDetail extends localize(i18next)(PageView) {
|
|
17
|
+
static get styles() {
|
|
18
|
+
return [
|
|
19
|
+
MultiColumnFormStyles,
|
|
20
|
+
css`
|
|
21
|
+
:host {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
overflow-x: auto;
|
|
25
|
+
}
|
|
26
|
+
.form-container {
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
.form-container > form {
|
|
30
|
+
flex: 1;
|
|
31
|
+
}
|
|
32
|
+
.container {
|
|
33
|
+
flex: 1;
|
|
34
|
+
display: flex;
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
min-height: 50vh;
|
|
37
|
+
}
|
|
38
|
+
.grist {
|
|
39
|
+
background-color: var(--main-section-background-color);
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
flex: 1;
|
|
43
|
+
overflow-y: auto;
|
|
44
|
+
}
|
|
45
|
+
data-grist {
|
|
46
|
+
overflow-y: hidden;
|
|
47
|
+
flex: 1;
|
|
48
|
+
}
|
|
49
|
+
barcode-tag {
|
|
50
|
+
width: 100px;
|
|
51
|
+
height: 100px;
|
|
52
|
+
margin: 10px;
|
|
53
|
+
}
|
|
54
|
+
h2 {
|
|
55
|
+
padding: var(--subtitle-padding);
|
|
56
|
+
font: var(--subtitle-font);
|
|
57
|
+
color: var(--subtitle-text-color);
|
|
58
|
+
border-bottom: var(--subtitle-border-bottom);
|
|
59
|
+
}
|
|
60
|
+
.grist h2 {
|
|
61
|
+
margin: var(--grist-title-margin);
|
|
62
|
+
border: var(--grist-title-border);
|
|
63
|
+
font: var(--grist-title-font);
|
|
64
|
+
color: var(--secondary-color);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.grist h2 mwc-icon {
|
|
68
|
+
vertical-align: middle;
|
|
69
|
+
margin: var(--grist-title-icon-margin);
|
|
70
|
+
font-size: var(--grist-title-icon-size);
|
|
71
|
+
color: var(--grist-title-icon-color);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
h2 + data-grist {
|
|
75
|
+
padding-top: var(--grist-title-with-grid-padding);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
search-form {
|
|
79
|
+
overflow: visible;
|
|
80
|
+
}
|
|
81
|
+
`
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static get properties() {
|
|
86
|
+
return {
|
|
87
|
+
searchFields: Array,
|
|
88
|
+
config: Object,
|
|
89
|
+
_pageType: String,
|
|
90
|
+
_status: String,
|
|
91
|
+
_orderNo: String
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
get context() {
|
|
96
|
+
let actions = [
|
|
97
|
+
{
|
|
98
|
+
title: i18next.t('button.back'),
|
|
99
|
+
action: () => history.back(),
|
|
100
|
+
...CommonButtonStyles.back
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
if (this._status == ORDER_STATUS.PENDING.value) {
|
|
104
|
+
actions.push({
|
|
105
|
+
title: i18next.t('button.confirm'),
|
|
106
|
+
action: this._confirmReplenishment.bind(this),
|
|
107
|
+
...CommonButtonStyles.add
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
if (this._status == ORDER_STATUS.PENDING_WORKSHEET.value) {
|
|
111
|
+
actions.push({
|
|
112
|
+
title: i18next.t('button.generate_worksheet'),
|
|
113
|
+
action: this._generateWorksheets.bind(this),
|
|
114
|
+
...CommonButtonStyles.add
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let cancelOrderStatus = [ORDER_STATUS.PICKING.value, ORDER_STATUS.PUTTING_AWAY.value]
|
|
119
|
+
|
|
120
|
+
if (cancelOrderStatus.indexOf(this._status) < 0) {
|
|
121
|
+
actions.push({
|
|
122
|
+
title: i18next.t('button.cancel_order'),
|
|
123
|
+
action: this._cancelReplenishment.bind(this),
|
|
124
|
+
...CommonButtonStyles.cancel
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
title: i18next.t('title.replenishment_detail'),
|
|
130
|
+
actions
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
get replenishmentForm() {
|
|
135
|
+
return this.shadowRoot.querySelector('form[name=replenishment]')
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
render() {
|
|
139
|
+
return html`
|
|
140
|
+
${html`
|
|
141
|
+
<div class="form-container">
|
|
142
|
+
<form name="replenishment" class="multi-column-form">
|
|
143
|
+
<fieldset>
|
|
144
|
+
<legend>${i18next.t('title.replenishment')}</legend>
|
|
145
|
+
|
|
146
|
+
<label>${i18next.t('label.order_no')}</label>
|
|
147
|
+
<input name="name" readonly disabled />
|
|
148
|
+
|
|
149
|
+
<label>${i18next.t('label.status')}</label>
|
|
150
|
+
<input name="status" readonly disabled />
|
|
151
|
+
</fieldset>
|
|
152
|
+
</form>
|
|
153
|
+
|
|
154
|
+
<barcode-tag bcid="qrcode" .value=${this._orderNo}></barcode-tag>
|
|
155
|
+
</div>
|
|
156
|
+
`}
|
|
157
|
+
|
|
158
|
+
<data-grist
|
|
159
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
160
|
+
.config=${this.config}
|
|
161
|
+
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
162
|
+
></data-grist>
|
|
163
|
+
</div>
|
|
164
|
+
`
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
constructor() {
|
|
168
|
+
super()
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
get searchForm() {
|
|
172
|
+
return this.shadowRoot.querySelector('search-form')
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
get dataGrist() {
|
|
176
|
+
return this.shadowRoot.querySelector('data-grist')
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async pageUpdated(changes, lifecycle, before) {
|
|
180
|
+
if (this.active) {
|
|
181
|
+
this._pageType = lifecycle.resourceId
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
this.config = REPLENISHMENT_CONFIG.DETAIL
|
|
185
|
+
|
|
186
|
+
this.dataGrist.fetch()
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async pageInitialized() {}
|
|
190
|
+
|
|
191
|
+
fetchHandler({ page, limit, sorters = [] }) {
|
|
192
|
+
this._clearView()
|
|
193
|
+
|
|
194
|
+
return this._fetchReplenimentDetails(this._pageType)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async _fetchReplenimentDetails(name) {
|
|
198
|
+
const response = await client.query({
|
|
199
|
+
query: gql`
|
|
200
|
+
query replenishmentDetail($name: String!) {
|
|
201
|
+
replenishmentDetail(name: $name) {
|
|
202
|
+
id
|
|
203
|
+
name
|
|
204
|
+
status
|
|
205
|
+
domain {
|
|
206
|
+
id
|
|
207
|
+
name
|
|
208
|
+
}
|
|
209
|
+
orderInventories {
|
|
210
|
+
packingType
|
|
211
|
+
packingSize
|
|
212
|
+
transferQty
|
|
213
|
+
productSKU
|
|
214
|
+
bizplace {
|
|
215
|
+
id
|
|
216
|
+
name
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
`,
|
|
222
|
+
variables: {
|
|
223
|
+
name
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
if (!response.errors) {
|
|
228
|
+
let record = response.data.replenishmentDetail
|
|
229
|
+
this._status = record.status
|
|
230
|
+
this.updateContext()
|
|
231
|
+
|
|
232
|
+
this._fillupForm(this.replenishmentForm, record)
|
|
233
|
+
this._orderNo = record.name
|
|
234
|
+
return {
|
|
235
|
+
records: record.orderInventories || []
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
async _generateWorksheets() {
|
|
241
|
+
try {
|
|
242
|
+
let replenishmentNos = []
|
|
243
|
+
if (this.dataGrist.selected.length <= 0 && this._pageType == 'list')
|
|
244
|
+
throw new Error(i18next.t('text.please_select_one_or_more_order_to_generate_worksheet'))
|
|
245
|
+
|
|
246
|
+
let availableReplenishments = this.dataGrist.selected.filter(
|
|
247
|
+
itm => itm.status === ORDER_STATUS.PENDING_WORKSHEET.value
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
if (availableReplenishments.length > 0) {
|
|
251
|
+
replenishmentNos = availableReplenishments.map(record => record.name)
|
|
252
|
+
} else {
|
|
253
|
+
if (this._status == ORDER_STATUS.PENDING_WORKSHEET.value) {
|
|
254
|
+
replenishmentNos.push(this._orderNo)
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (replenishmentNos.length <= 0)
|
|
259
|
+
throw new Error(i18next.t('text.selected_replenishment(s)_is_not_in_pending_worksheet_status'))
|
|
260
|
+
|
|
261
|
+
const response = await client.mutate({
|
|
262
|
+
mutation: gql`
|
|
263
|
+
mutation ($replenishmentNos: [String!]) {
|
|
264
|
+
generateReplenishmentWorksheets(replenishmentNos: $replenishmentNos)
|
|
265
|
+
}
|
|
266
|
+
`,
|
|
267
|
+
variables: {
|
|
268
|
+
replenishmentNos
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
if (!response.errors) {
|
|
273
|
+
navigate(`replenishment_worksheet_list`)
|
|
274
|
+
showToast({ message: i18next.t('text.worksheet(s)_has_been_generated') })
|
|
275
|
+
}
|
|
276
|
+
this._processing = false
|
|
277
|
+
} catch (e) {
|
|
278
|
+
showToast(e)
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
async _confirmReplenishment() {
|
|
283
|
+
try {
|
|
284
|
+
const response = await client.mutate({
|
|
285
|
+
mutation: gql`
|
|
286
|
+
mutation ($name: String!) {
|
|
287
|
+
confirmReplenishment(name: $name) {
|
|
288
|
+
id
|
|
289
|
+
name
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
`,
|
|
293
|
+
variables: {
|
|
294
|
+
name: this._orderNo
|
|
295
|
+
}
|
|
296
|
+
})
|
|
297
|
+
if (!response.errors) {
|
|
298
|
+
this.dataGrist.fetch()
|
|
299
|
+
this.updateContext()
|
|
300
|
+
showToast({ message: i18next.t('text.replenishment_worksheet_created') })
|
|
301
|
+
}
|
|
302
|
+
} catch (e) {
|
|
303
|
+
showToast(e)
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async _cancelReplenishment() {
|
|
308
|
+
try {
|
|
309
|
+
const result = await CustomAlert({
|
|
310
|
+
title: i18next.t('title.are_you_sure'),
|
|
311
|
+
text: i18next.t('text.you_wont_be_able_to_revert_this'),
|
|
312
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
313
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
if (!result.value) return
|
|
317
|
+
|
|
318
|
+
const response = await client.mutate({
|
|
319
|
+
mutation: gql`
|
|
320
|
+
mutation cancelReplenishment($name: String!) {
|
|
321
|
+
cancelReplenishment(name: $name)
|
|
322
|
+
}
|
|
323
|
+
`,
|
|
324
|
+
variables: { name: this._orderNo }
|
|
325
|
+
})
|
|
326
|
+
|
|
327
|
+
if (!response.errors) {
|
|
328
|
+
this.dataGrist.fetch()
|
|
329
|
+
this.updateContext()
|
|
330
|
+
showToast({ message: i18next.t('text.replenishment_is_cancelled') })
|
|
331
|
+
navigate(`replenishment/list`)
|
|
332
|
+
}
|
|
333
|
+
} catch (e) {
|
|
334
|
+
throw e
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
async _fetchPartners() {
|
|
339
|
+
const filters = []
|
|
340
|
+
const response = await client.query({
|
|
341
|
+
query: gql`
|
|
342
|
+
query partnersBizplaces($filters: [Filter!]) {
|
|
343
|
+
partnersBizplaces(filters: $filters) {
|
|
344
|
+
items {
|
|
345
|
+
id
|
|
346
|
+
name
|
|
347
|
+
description
|
|
348
|
+
domain {
|
|
349
|
+
id
|
|
350
|
+
name
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
`,
|
|
356
|
+
variables: { filters }
|
|
357
|
+
})
|
|
358
|
+
if (!response.errors) {
|
|
359
|
+
return response.data.partnersBizplaces.items
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
async _getOrderInventories() {
|
|
364
|
+
const orderInventories = this.dataGrist.selected.map(record => {
|
|
365
|
+
let newRecord = {
|
|
366
|
+
bizplaceId: record.bizplace.id,
|
|
367
|
+
releaseQty: record.transferQty,
|
|
368
|
+
packingType: record.packingType,
|
|
369
|
+
packingSize: record.packingSize,
|
|
370
|
+
type: ORDER_TYPES.REPLENISHMENT.value,
|
|
371
|
+
productDetailId: record.productDetailId
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return newRecord
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
return orderInventories
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
_fillupForm(form, data) {
|
|
381
|
+
if (form) {
|
|
382
|
+
form.reset()
|
|
383
|
+
for (let key in data) {
|
|
384
|
+
Array.from(form.querySelectorAll('input, textarea')).forEach(field => {
|
|
385
|
+
if (field.name === key && field.type === 'checkbox') {
|
|
386
|
+
field.checked = data[key]
|
|
387
|
+
} else if (field.name === key && field.type === 'datetime-local') {
|
|
388
|
+
const datetime = Number(data[key])
|
|
389
|
+
const timezoneOffset = new Date(datetime).getTimezoneOffset() * 60000
|
|
390
|
+
field.value = new Date(datetime - timezoneOffset).toISOString().slice(0, -1)
|
|
391
|
+
} else if (field.name === key) {
|
|
392
|
+
if (data[key] instanceof Object) {
|
|
393
|
+
const objectData = data[key]
|
|
394
|
+
field.value = `${objectData.name} ${objectData.description ? `(${objectData.description})` : ''}`
|
|
395
|
+
} else {
|
|
396
|
+
field.value = data[key]
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
})
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
_compareValues(key, order = 'asc') {
|
|
405
|
+
return function innerSort(a, b) {
|
|
406
|
+
if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
|
|
407
|
+
return 0
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const varA = typeof a[key] === 'string' ? a[key].toUpperCase() : a[key]
|
|
411
|
+
const varB = typeof b[key] === 'string' ? b[key].toUpperCase() : b[key]
|
|
412
|
+
|
|
413
|
+
let comparison = 0
|
|
414
|
+
if (varA > varB) {
|
|
415
|
+
comparison = 1
|
|
416
|
+
} else if (varA < varB) {
|
|
417
|
+
comparison = -1
|
|
418
|
+
}
|
|
419
|
+
return order === 'desc' ? comparison * -1 : comparison
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
_clearView() {
|
|
424
|
+
this._orderNo = ''
|
|
425
|
+
this._status = ''
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
window.customElements.define('replenishment-detail-page', ReplenishmentDetail)
|