@things-factory/operato-wms 4.0.29 → 4.0.33
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/fetch-setting-value.js +10 -2
- package/client/pages/bulk-operation/bulk-operation.js +44 -10
- package/client/pages/bulk-operation/validate-gan-popup.js +5 -4
- package/client/pages/bulk-operation/validate-ro-popup.js +7 -39
- package/client/pages/components/popup-reusable-pallet.js +145 -0
- package/client/pages/components/vas-templates/vas-pallet-add-popup.js +12 -11
- package/client/pages/components/vas-templates/vas-relabel.js +57 -34
- package/client/pages/components/vas-templates/vas-repack-relabel.js +56 -36
- package/client/pages/components/vas-templates/vas-repack.js +45 -31
- package/client/pages/components/vas-templates/vas-repalletizing.js +58 -39
- package/client/pages/components/vas-templates/vas-unpack.js +38 -24
- package/client/pages/components/worksheet-information-popup.js +4 -1
- package/client/pages/inbound/unload-product.js +119 -103
- package/client/pages/inventory/onhand-inventory.js +1 -0
- package/client/pages/order/arrival-notice/arrival-notice-detail.js +52 -44
- package/client/pages/order/arrival-notice/arrival-notice-list.js +2 -5
- package/client/pages/order/release-order/b2b/b2b-order-list.js +1 -5
- package/client/pages/order/release-order/batch-picking-popup.js +4 -3
- package/client/pages/order/release-order/create-release-order.js +1 -1
- package/client/pages/order/release-order/release-extra-product-popup.js +10 -5
- package/client/pages/order/release-order/release-order-detail.js +31 -14
- package/client/pages/order/return-order/create-return-order.js +41 -52
- package/client/pages/order/reverse-kitting-order/reverse-kitting-order-detail.js +2 -2
- package/client/pages/order/transport-order/create-delivery-order.js +4 -2
- package/client/pages/order/transport-order/delivery-note-popup.js +2 -2
- package/client/pages/outbound/packing-worksheet-list.js +64 -4
- package/client/pages/outbound/picking-product.js +12 -7
- package/client/pages/outbound/worksheet-batch-picking.js +1 -1
- package/client/pages/outbound/worksheet-picking.js +2 -2
- package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +5 -1
- package/client/pages/report/inbound-order-details-report.js +3 -5
- package/client/pages/vas/abstract-execute-vas.js +4 -1
- package/client/pages/vas/execute-pure-vas.js +3 -8
- package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +3 -3
- package/client/pages/vas/reverse-kitting/popup-combination-sets.js +3 -3
- package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +1 -1
- package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +2 -4
- package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/types/reports/inbound-order-details-report.js +2 -1
- package/dist-server/graphql/types/reports/inbound-order-details-report.js.map +1 -1
- package/package.json +65 -65
- package/server/graphql/resolvers/reports/inbound-order-details-report.ts +2 -4
- package/server/graphql/types/reports/inbound-order-details-report.ts +2 -1
- package/translations/en.json +15 -1
- package/translations/ko.json +20 -7
- package/translations/ms.json +21 -8
- package/translations/zh.json +21 -8
- package/client/pages/components/popup-unloading.js +0 -610
|
@@ -1,610 +0,0 @@
|
|
|
1
|
-
import '@things-factory/barcode-ui'
|
|
2
|
-
import { i18next, localize } from '@things-factory/i18n-base'
|
|
3
|
-
import { css, html, LitElement } from 'lit-element'
|
|
4
|
-
import '@things-factory/grist-ui'
|
|
5
|
-
import { isMobileDevice } from '@things-factory/utils'
|
|
6
|
-
import { client, CustomAlert, store, UPDATE_CONTEXT } from '@things-factory/shell'
|
|
7
|
-
import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
|
|
8
|
-
import gql from 'graphql-tag'
|
|
9
|
-
|
|
10
|
-
class PopupUnloading extends localize(i18next)(LitElement) {
|
|
11
|
-
static get properties() {
|
|
12
|
-
return {
|
|
13
|
-
title: String,
|
|
14
|
-
ganNo: String,
|
|
15
|
-
orderType: String,
|
|
16
|
-
orderNo: String,
|
|
17
|
-
reusablePallet: String,
|
|
18
|
-
_productName: String,
|
|
19
|
-
_productSku: String,
|
|
20
|
-
_selectedOrderProduct: Object,
|
|
21
|
-
_selectedInventory: Object,
|
|
22
|
-
unloadingGristConfig: Object,
|
|
23
|
-
unloadingGristData: Object,
|
|
24
|
-
_unloadedInventories: Array,
|
|
25
|
-
unloadedGristConfig: Object,
|
|
26
|
-
unloadedGristData: Object,
|
|
27
|
-
reusablePalletData: Object
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
static get styles() {
|
|
32
|
-
return [
|
|
33
|
-
MultiColumnFormStyles,
|
|
34
|
-
SingleColumnFormStyles,
|
|
35
|
-
css`
|
|
36
|
-
:host {
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-direction: column;
|
|
39
|
-
overflow-x: overlay;
|
|
40
|
-
background-color: var(--main-section-background-color);
|
|
41
|
-
}
|
|
42
|
-
h2 {
|
|
43
|
-
padding: var(--subtitle-padding);
|
|
44
|
-
font: var(--subtitle-font);
|
|
45
|
-
color: var(--subtitle-text-color);
|
|
46
|
-
border-bottom: var(--subtitle-border-bottom);
|
|
47
|
-
}
|
|
48
|
-
.grist h2 {
|
|
49
|
-
margin: var(--grist-title-margin);
|
|
50
|
-
border: var(--grist-title-border);
|
|
51
|
-
font: var(--grist-title-font);
|
|
52
|
-
color: var(--secondary-color);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.grist h2 mwc-icon {
|
|
56
|
-
vertical-align: middle;
|
|
57
|
-
margin: var(--grist-title-icon-margin);
|
|
58
|
-
font-size: var(--grist-title-icon-size);
|
|
59
|
-
color: var(--grist-title-icon-color);
|
|
60
|
-
}
|
|
61
|
-
.grist {
|
|
62
|
-
background-color: var(--main-section-background-color);
|
|
63
|
-
display: flex;
|
|
64
|
-
overflow: hidden;
|
|
65
|
-
flex: 1;
|
|
66
|
-
}
|
|
67
|
-
.left-column {
|
|
68
|
-
overflow: hidden;
|
|
69
|
-
display: flex;
|
|
70
|
-
flex: 1;
|
|
71
|
-
flex-direction: column;
|
|
72
|
-
}
|
|
73
|
-
.right-column {
|
|
74
|
-
overflow: auto;
|
|
75
|
-
display: flex;
|
|
76
|
-
flex: 1;
|
|
77
|
-
flex-direction: column;
|
|
78
|
-
}
|
|
79
|
-
.button-container {
|
|
80
|
-
padding: var(--button-container-padding);
|
|
81
|
-
margin: var(--button-container-margin);
|
|
82
|
-
text-align: var(--button-container-align);
|
|
83
|
-
background-color: var(--button-container-background);
|
|
84
|
-
height: var(--button-container-height);
|
|
85
|
-
}
|
|
86
|
-
.button-container button {
|
|
87
|
-
background-color: var(--button-container-button-background-color);
|
|
88
|
-
border-radius: var(--button-container-button-border-radius);
|
|
89
|
-
height: var(--button-container-button-height);
|
|
90
|
-
border: var(--button-container-button-border);
|
|
91
|
-
margin: var(--button-container-button-margin);
|
|
92
|
-
|
|
93
|
-
padding: var(--button-padding);
|
|
94
|
-
color: var(--theme-white-color);
|
|
95
|
-
font: var(--button-container-button-font);
|
|
96
|
-
text-transform: var(--button-text-transform);
|
|
97
|
-
}
|
|
98
|
-
.button-container button:hover,
|
|
99
|
-
.button-container button:active {
|
|
100
|
-
background-color: var(--button-background-focus-color);
|
|
101
|
-
}
|
|
102
|
-
`
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
get context() {
|
|
107
|
-
const popupUnloadingButtons = document.querySelector('my-buttons')
|
|
108
|
-
popupUnloadingButtons.addEventListener('popup-unloading-buttons', e => {
|
|
109
|
-
return {
|
|
110
|
-
title: i18next.t('title.unloading_with_reusable_pallet')
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
get inputForm() {
|
|
116
|
-
return this.shadowRoot.querySelector('form#input-form')
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
get unloadingGrist() {
|
|
120
|
-
return this.shadowRoot.querySelector('#unloading-grist')
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
get unloadedGrist() {
|
|
124
|
-
return this.shadowRoot.querySelector('#unloaded-grist')
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
get reusablePalletInput() {
|
|
128
|
-
return this.shadowRoot.querySelector('input[name=reusablePalletID]')
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
get palletInput() {
|
|
132
|
-
return this.shadowRoot.querySelector('barcode-scanable-input[name=palletId]').shadowRoot.querySelector('input')
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
get actualQtyInput() {
|
|
136
|
-
return this.shadowRoot.querySelector('input[name=qty]')
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
get expDateInput() {
|
|
140
|
-
return this.shadowRoot.querySelector('input[name=expDate]')
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
render() {
|
|
144
|
-
return html`
|
|
145
|
-
<form id="info-form" class="multi-column-form">
|
|
146
|
-
<fieldset>
|
|
147
|
-
<label>${i18next.t('label.reusable_pallet')}</label>
|
|
148
|
-
<input name="reusablePalletID" type="text" readonly />
|
|
149
|
-
</fieldset>
|
|
150
|
-
</form>
|
|
151
|
-
|
|
152
|
-
<div class="grist">
|
|
153
|
-
<div class="left-column">
|
|
154
|
-
<h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.unloading')}</h2>
|
|
155
|
-
<data-grist
|
|
156
|
-
id="unloading-grist"
|
|
157
|
-
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
158
|
-
.config=${this.unloadingGristConfig}
|
|
159
|
-
.data=${this.unloadingGristData}
|
|
160
|
-
></data-grist>
|
|
161
|
-
|
|
162
|
-
<h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.unloaded')}</h2>
|
|
163
|
-
<data-grist
|
|
164
|
-
id="unloaded-grist"
|
|
165
|
-
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
166
|
-
.config=${this.unloadedGristConfig}
|
|
167
|
-
.data=${this.unloadedGristData}
|
|
168
|
-
></data-grist>
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<div class="right-column">
|
|
172
|
-
<form id="input-form" class="single-column-form">
|
|
173
|
-
<fieldset>
|
|
174
|
-
<legend>${i18next.t('title.product')}: ${this._productSku + ' - ' + this._productName}</legend>
|
|
175
|
-
|
|
176
|
-
<label>${i18next.t('label.batch_no')}</label>
|
|
177
|
-
<input name="batchId" readonly />
|
|
178
|
-
|
|
179
|
-
<label>${i18next.t('label.description')}</label>
|
|
180
|
-
<input name="description" readonly />
|
|
181
|
-
|
|
182
|
-
<label>${i18next.t('label.packing_type')}</label>
|
|
183
|
-
<input name="packingType" readonly />
|
|
184
|
-
|
|
185
|
-
<label>${i18next.t('label.total_pallet_qty')}</label>
|
|
186
|
-
<input name="palletQty" type="number" readonly />
|
|
187
|
-
|
|
188
|
-
<label>${i18next.t('label.total_pack_qty')}</label>
|
|
189
|
-
<input name="packQty" type="number" readonly />
|
|
190
|
-
</fieldset>
|
|
191
|
-
|
|
192
|
-
<fieldset>
|
|
193
|
-
<legend>${i18next.t('title.input_section')}</legend>
|
|
194
|
-
|
|
195
|
-
<label>${i18next.t('label.lot_id')}</label>
|
|
196
|
-
<barcode-scanable-input
|
|
197
|
-
name="palletId"
|
|
198
|
-
.value=${this._palletId}
|
|
199
|
-
without-enter
|
|
200
|
-
custom-input
|
|
201
|
-
@keypress="${this._unload.bind(this)}"
|
|
202
|
-
></barcode-scanable-input>
|
|
203
|
-
|
|
204
|
-
<label>${i18next.t('label.exp_date_opt')}</label>
|
|
205
|
-
<input name="expDate" type="date" />
|
|
206
|
-
|
|
207
|
-
<label>${i18next.t('label.actual_qty')}</label>
|
|
208
|
-
<input name="qty" type="number" min="1" @keypress="${this._unload.bind(this)}" required />
|
|
209
|
-
</fieldset>
|
|
210
|
-
</form>
|
|
211
|
-
</div>
|
|
212
|
-
</div>
|
|
213
|
-
|
|
214
|
-
<div class="button-container">
|
|
215
|
-
<button ?hidden="${!this._selectedInventory}" @click="${this._undoUnloading.bind(this)}">
|
|
216
|
-
${i18next.t('button.undo')}
|
|
217
|
-
</button>
|
|
218
|
-
<button
|
|
219
|
-
@click="${() => {
|
|
220
|
-
this.dispatchEvent(new CustomEvent('unloading-pallet', { detail: this.unloadingGristData }))
|
|
221
|
-
this.dispatchEvent(new CustomEvent('unloaded-pallet', { detail: this.unloadedGristData }))
|
|
222
|
-
history.back()
|
|
223
|
-
}}"
|
|
224
|
-
>
|
|
225
|
-
${i18next.t('button.confirm')}
|
|
226
|
-
</button>
|
|
227
|
-
</div>
|
|
228
|
-
`
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
async firstUpdated() {
|
|
232
|
-
this.unloadingGristConfig = {
|
|
233
|
-
rows: {
|
|
234
|
-
appendable: false,
|
|
235
|
-
handlers: {
|
|
236
|
-
click: (columns, data, column, record, rowIndex) => {
|
|
237
|
-
if (record && record.batchId) {
|
|
238
|
-
this._selectedOrderProduct = record
|
|
239
|
-
this._selectedInventory = null
|
|
240
|
-
this._productName = `${record.product.name} ${
|
|
241
|
-
record.product.description ? `(${record.product.description})` : ''
|
|
242
|
-
}`
|
|
243
|
-
this._productSku = `${record.product.sku}`
|
|
244
|
-
|
|
245
|
-
this.palletInput.value = ''
|
|
246
|
-
this._fillUpInputForm(record)
|
|
247
|
-
this._fetchInventoriesByReusablePallet()
|
|
248
|
-
this._focusOnPalletInput()
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
pagination: {
|
|
254
|
-
infinite: true
|
|
255
|
-
},
|
|
256
|
-
list: { fields: ['batchId', 'palletQty', 'actualPalletQty', 'packQty', 'actualPackQty'] },
|
|
257
|
-
columns: [
|
|
258
|
-
{ type: 'gutter', gutterName: 'sequence' },
|
|
259
|
-
{
|
|
260
|
-
type: 'boolean',
|
|
261
|
-
name: 'validity',
|
|
262
|
-
header: i18next.t('field.validity'),
|
|
263
|
-
width: 40
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
type: 'string',
|
|
267
|
-
name: 'batchId',
|
|
268
|
-
header: i18next.t('field.batch_id'),
|
|
269
|
-
width: 150
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
type: 'object',
|
|
273
|
-
name: 'product',
|
|
274
|
-
header: i18next.t('field.product'),
|
|
275
|
-
width: 200
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
type: 'integer',
|
|
279
|
-
name: 'palletQty',
|
|
280
|
-
header: i18next.t('field.pallet_qty'),
|
|
281
|
-
width: 60
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
type: 'integer',
|
|
285
|
-
name: 'actualPalletQty',
|
|
286
|
-
header: i18next.t('field.actual_pallet_qty'),
|
|
287
|
-
width: 60
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
type: 'integer',
|
|
291
|
-
name: 'packQty',
|
|
292
|
-
header: i18next.t('field.total_pack_qty'),
|
|
293
|
-
width: 60
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
type: 'integer',
|
|
297
|
-
name: 'actualPackQty',
|
|
298
|
-
header: i18next.t('field.actual_pack_qty'),
|
|
299
|
-
width: 60
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
type: 'string',
|
|
303
|
-
name: 'issue',
|
|
304
|
-
header: i18next.t('field.issue'),
|
|
305
|
-
width: 100
|
|
306
|
-
}
|
|
307
|
-
]
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
this.unloadedGristConfig = {
|
|
311
|
-
rows: {
|
|
312
|
-
appendable: false,
|
|
313
|
-
handlers: {
|
|
314
|
-
click: (columns, data, column, record, rowIndex) => {
|
|
315
|
-
if (record && record.palletId && this._selectedOrderProduct) {
|
|
316
|
-
this._selectedInventory = record
|
|
317
|
-
this.palletInput.value = record.palletId
|
|
318
|
-
this.actualQtyInput.value = record.qty
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
list: { fields: ['palletId', 'product', 'qty'] },
|
|
324
|
-
pagination: {
|
|
325
|
-
infinite: true
|
|
326
|
-
},
|
|
327
|
-
columns: [
|
|
328
|
-
{ type: 'gutter', gutterName: 'sequence' },
|
|
329
|
-
{
|
|
330
|
-
type: 'string',
|
|
331
|
-
name: 'palletId',
|
|
332
|
-
header: i18next.t('field.lot_id'),
|
|
333
|
-
width: 150
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
type: 'object',
|
|
337
|
-
name: 'product',
|
|
338
|
-
header: i18next.t('field.product'),
|
|
339
|
-
width: 200
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
type: 'integer',
|
|
343
|
-
name: 'qty',
|
|
344
|
-
header: i18next.t('field.actual_pack_qty'),
|
|
345
|
-
width: 80
|
|
346
|
-
}
|
|
347
|
-
]
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
if (this._selectedOrderProduct) {
|
|
351
|
-
this._fillUpInputForm(this._selectedOrderProduct)
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
if (this.reusablePallet) {
|
|
355
|
-
await this._fetchInventoriesByReusablePallet()
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
updated(changedProps) {
|
|
360
|
-
if (changedProps.has('reusablePallet')) {
|
|
361
|
-
this.reusablePalletInput.value = this.reusablePallet
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
async _fetchProducts(arrivalNoticeNo) {
|
|
366
|
-
const response = await client.query({
|
|
367
|
-
query: gql`
|
|
368
|
-
query unloadingWorksheet($arrivalNoticeNo: String!) {
|
|
369
|
-
unloadingWorksheet(arrivalNoticeNo: $arrivalNoticeNo) {
|
|
370
|
-
worksheetInfo {
|
|
371
|
-
bizplaceName
|
|
372
|
-
containerNo
|
|
373
|
-
refNo
|
|
374
|
-
bufferLocation
|
|
375
|
-
startedAt
|
|
376
|
-
}
|
|
377
|
-
worksheetDetailInfos {
|
|
378
|
-
batchId
|
|
379
|
-
product {
|
|
380
|
-
id
|
|
381
|
-
sku
|
|
382
|
-
name
|
|
383
|
-
description
|
|
384
|
-
}
|
|
385
|
-
name
|
|
386
|
-
targetName
|
|
387
|
-
description
|
|
388
|
-
packingType
|
|
389
|
-
palletQty
|
|
390
|
-
actualPalletQty
|
|
391
|
-
packQty
|
|
392
|
-
actualPackQty
|
|
393
|
-
issue
|
|
394
|
-
remark
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
`,
|
|
399
|
-
variables: { arrivalNoticeNo }
|
|
400
|
-
})
|
|
401
|
-
|
|
402
|
-
if (!response.errors) {
|
|
403
|
-
this.unloadingGristData = {
|
|
404
|
-
records: response.data.unloadingWorksheet.worksheetDetailInfos.map(worksheetDetailInfo => {
|
|
405
|
-
return {
|
|
406
|
-
...worksheetDetailInfo,
|
|
407
|
-
validity:
|
|
408
|
-
worksheetDetailInfo.actualPackQty === worksheetDetailInfo.packQty &&
|
|
409
|
-
worksheetDetailInfo.actualPalletQty === worksheetDetailInfo.palletQty
|
|
410
|
-
}
|
|
411
|
-
})
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
async _fetchInventoriesByReusablePallet() {
|
|
417
|
-
if (!this._selectedOrderProduct.name) return
|
|
418
|
-
|
|
419
|
-
const response = await client.query({
|
|
420
|
-
query: gql`
|
|
421
|
-
query unloadedInventoriesByReusablePallet($reusablePalletId: String!, $worksheetDetailName: String!) {
|
|
422
|
-
unloadedInventoriesByReusablePallet(
|
|
423
|
-
reusablePalletId: $reusablePalletId
|
|
424
|
-
worksheetDetailName: $worksheetDetailName
|
|
425
|
-
) {
|
|
426
|
-
id
|
|
427
|
-
batchId
|
|
428
|
-
palletId
|
|
429
|
-
qty
|
|
430
|
-
product {
|
|
431
|
-
id
|
|
432
|
-
name
|
|
433
|
-
description
|
|
434
|
-
}
|
|
435
|
-
reusablePallet {
|
|
436
|
-
id
|
|
437
|
-
name
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
`,
|
|
442
|
-
variables: {
|
|
443
|
-
reusablePalletId: this.reusablePallet,
|
|
444
|
-
worksheetDetailName: this._selectedOrderProduct.name
|
|
445
|
-
}
|
|
446
|
-
})
|
|
447
|
-
|
|
448
|
-
if (!response.errors) {
|
|
449
|
-
this._unloadedInventories = response.data.unloadedInventoriesByReusablePallet
|
|
450
|
-
this._selectedInventory = null
|
|
451
|
-
this.unloadedGristData = {
|
|
452
|
-
records: this._unloadedInventories
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
this.unloadingGristData = {
|
|
456
|
-
records: this.unloadingGristData.records.map(unloading => {
|
|
457
|
-
if (unloading.batchId === this._unloadedInventories.batchId) {
|
|
458
|
-
unloading.actualPalletQty = this._unloadedInventories.length
|
|
459
|
-
unloading.actualTotalPackQty = this._unloadedInventories
|
|
460
|
-
.map(inventory => inventory.qty)
|
|
461
|
-
.reduce((a, b) => a + b, 0)
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
return unloading
|
|
465
|
-
})
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
async _unload(e) {
|
|
471
|
-
if (e.keyCode === 13) {
|
|
472
|
-
try {
|
|
473
|
-
this._validateUnloading()
|
|
474
|
-
const response = await client.mutate({
|
|
475
|
-
mutation: gql`
|
|
476
|
-
mutation unload($worksheetDetailName: String!, $inventory: InventoryPatch!) {
|
|
477
|
-
unload(worksheetDetailName: $worksheetDetailName, inventory: $inventory)
|
|
478
|
-
}
|
|
479
|
-
`,
|
|
480
|
-
variables: {
|
|
481
|
-
worksheetDetailName: this._selectedOrderProduct.name,
|
|
482
|
-
inventory: {
|
|
483
|
-
palletId: this.palletInput.value.trim(),
|
|
484
|
-
qty: parseInt(this.actualQtyInput.value),
|
|
485
|
-
reusablePallet: this.reusablePalletData,
|
|
486
|
-
expirationDate: this.expDateInput.value
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
})
|
|
490
|
-
|
|
491
|
-
if (!response.errors) {
|
|
492
|
-
this.palletInput.value = ''
|
|
493
|
-
this.actualQtyInput.value = ''
|
|
494
|
-
this.expDateInput.value = null
|
|
495
|
-
|
|
496
|
-
await this._fetchProducts(this.ganNo)
|
|
497
|
-
await this._fetchInventoriesByReusablePallet()
|
|
498
|
-
this._focusOnPalletInput()
|
|
499
|
-
}
|
|
500
|
-
} catch (e) {
|
|
501
|
-
this._showToast({ message: e.message })
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
_validateUnloading() {
|
|
507
|
-
// 1. validate for order selection
|
|
508
|
-
if (!this._selectedOrderProduct) throw new Error(i18next.t('text.target_does_not_selected'))
|
|
509
|
-
|
|
510
|
-
// 2. pallet id existing
|
|
511
|
-
if (!this.palletInput.value) {
|
|
512
|
-
this._focusOnPalletInput()
|
|
513
|
-
throw new Error(i18next.t('text.lot_id_is_empty'))
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// 4. qty value existing
|
|
517
|
-
if (!parseInt(this.actualQtyInput.value)) {
|
|
518
|
-
this._focusOnActualQtyInput()
|
|
519
|
-
throw new Error(i18next.t('text.qty_is_empty'))
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
// 5. qty value has to be positive
|
|
523
|
-
if (!(parseInt(this.actualQtyInput.value) > 0)) {
|
|
524
|
-
setTimeout(() => this.actualQtyInput.select(), 100)
|
|
525
|
-
throw new Error(i18next.t('text.qty_should_be_positive'))
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
_fillUpInputForm(data) {
|
|
530
|
-
this.inputForm.reset()
|
|
531
|
-
for (let key in data) {
|
|
532
|
-
Array.from(this.inputForm.querySelectorAll('input, textarea')).forEach(field => {
|
|
533
|
-
if (field.name === key && field.type === 'checkbox') {
|
|
534
|
-
field.checked = data[key]
|
|
535
|
-
} else if (field.name === key && field.type === 'datetime-local') {
|
|
536
|
-
const datetime = Number(data[key])
|
|
537
|
-
const timezoneOffset = new Date(datetime).getTimezoneOffset() * 60000
|
|
538
|
-
field.value = new Date(datetime - timezoneOffset).toISOString().slice(0, -1)
|
|
539
|
-
} else if (field.name === key) {
|
|
540
|
-
field.value = data[key]
|
|
541
|
-
}
|
|
542
|
-
})
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
async _undoUnloading() {
|
|
547
|
-
try {
|
|
548
|
-
this._validateUndo()
|
|
549
|
-
const result = await CustomAlert({
|
|
550
|
-
title: i18next.t('title.are_you_sure'),
|
|
551
|
-
text: i18next.t('text.undo_unloading'),
|
|
552
|
-
confirmButton: { text: i18next.t('button.confirm') },
|
|
553
|
-
cancelButton: { text: i18next.t('button.cancel') }
|
|
554
|
-
})
|
|
555
|
-
|
|
556
|
-
if (!result.value) {
|
|
557
|
-
return
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
const response = await client.mutate({
|
|
561
|
-
mutation: gql`
|
|
562
|
-
mutation undoUnloading($orderType: String!, $worksheetDetailName: String!, $selectedId: [String]!) {
|
|
563
|
-
undoUnloading(orderType: $orderType, orderNo: $worksheetDetailName, inventoryIds: $selectedId)
|
|
564
|
-
}
|
|
565
|
-
`,
|
|
566
|
-
variables: {
|
|
567
|
-
orderType: this.orderType,
|
|
568
|
-
worksheetDetailName: this.orderNo,
|
|
569
|
-
selectedId: this._selectedInventory.id
|
|
570
|
-
}
|
|
571
|
-
})
|
|
572
|
-
|
|
573
|
-
if (!response.errors) {
|
|
574
|
-
this._selectedInventory = null
|
|
575
|
-
this.palletInput.value = ''
|
|
576
|
-
this.actualQtyInput.value = ''
|
|
577
|
-
}
|
|
578
|
-
await this._fetchProducts(this.ganNo)
|
|
579
|
-
await this._fetchInventoriesByReusablePallet()
|
|
580
|
-
this._focusOnPalletInput()
|
|
581
|
-
} catch (e) {
|
|
582
|
-
this._showToast(e)
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
_validateUndo() {
|
|
587
|
-
if (!this._selectedInventory) throw new Error('text.target_does_not_selected')
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
_focusOnPalletInput() {
|
|
591
|
-
setTimeout(() => this.palletInput.focus(), 100)
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
_focusOnActualQtyInput() {
|
|
595
|
-
setTimeout(() => this.actualQtyInput.focus(), 100)
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
_showToast({ type, message }) {
|
|
599
|
-
document.dispatchEvent(
|
|
600
|
-
new CustomEvent('notify', {
|
|
601
|
-
detail: {
|
|
602
|
-
type,
|
|
603
|
-
message
|
|
604
|
-
}
|
|
605
|
-
})
|
|
606
|
-
)
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
window.customElements.define('popup-unloading', PopupUnloading)
|