@things-factory/operato-wms 4.3.458 → 4.3.459
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/bulk-operation/bulk-operation.js +161 -16
- package/client/pages/bulk-operation/validate-b2c-ro-popup.js +460 -0
- package/client/pages/bulk-operation/validate-ro-popup.js +1 -0
- package/client/pages/inventory/inventory-by-product.js +354 -58
- package/client/pages/order/draft-release-good/draft-release-good-popup.js +5 -0
- package/client/pages/outbound/item-label-popup.js +44 -29
- package/client/pages/outbound/worksheet-batch-picking.js +61 -4
- package/client/pages/outbound/worksheet-picking.js +6 -0
- package/helps/release-note.md +5 -5
- package/package.json +5 -5
- package/translations/en.json +23 -0
- package/translations/ko.json +20 -0
- package/translations/ms.json +20 -0
- package/translations/zh.json +20 -0
|
@@ -2,26 +2,16 @@ import '@things-factory/biz-ui'
|
|
|
2
2
|
import '@things-factory/warehouse-ui'
|
|
3
3
|
import './validate-gan-popup'
|
|
4
4
|
import './validate-ro-popup'
|
|
5
|
+
import './validate-b2c-ro-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
|
import XLSX from 'xlsx'
|
|
12
10
|
|
|
13
11
|
import { MultiColumnFormStyles } from '@things-factory/form-ui'
|
|
14
|
-
import {
|
|
15
|
-
i18next,
|
|
16
|
-
localize
|
|
17
|
-
} from '@things-factory/i18n-base'
|
|
12
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
18
13
|
import { openPopup } from '@things-factory/layout-base'
|
|
19
|
-
import {
|
|
20
|
-
client,
|
|
21
|
-
CustomAlert,
|
|
22
|
-
navigate,
|
|
23
|
-
PageView
|
|
24
|
-
} from '@things-factory/shell'
|
|
14
|
+
import { client, CustomAlert, navigate, PageView } from '@things-factory/shell'
|
|
25
15
|
import { sleep } from '@things-factory/utils'
|
|
26
16
|
|
|
27
17
|
import { fetchSettingRule } from '../../fetch-setting-value'
|
|
@@ -145,6 +135,8 @@ class BulkOperation extends localize(i18next)(PageView) {
|
|
|
145
135
|
_rawData: Array,
|
|
146
136
|
_roBizplaceId: String,
|
|
147
137
|
_roBizplaceName: String,
|
|
138
|
+
_roB2cBizplaceId: String,
|
|
139
|
+
_roB2cBizplaceName: String,
|
|
148
140
|
ganProcessingSetting: String,
|
|
149
141
|
_bufferLocationId: Object,
|
|
150
142
|
_arrivalNotices: Array
|
|
@@ -168,6 +160,10 @@ class BulkOperation extends localize(i18next)(PageView) {
|
|
|
168
160
|
return this.shadowRoot.querySelector('#upload-ro-document')
|
|
169
161
|
}
|
|
170
162
|
|
|
163
|
+
get _b2cRoDocument() {
|
|
164
|
+
return this.shadowRoot.querySelector('#upload-b2c-ro-document')
|
|
165
|
+
}
|
|
166
|
+
|
|
171
167
|
get _ganData() {
|
|
172
168
|
let date =
|
|
173
169
|
(new Date().getMonth() + 1).toString() + '-' + new Date().getDate().toString() + '-' + new Date().getFullYear()
|
|
@@ -233,6 +229,47 @@ class BulkOperation extends localize(i18next)(PageView) {
|
|
|
233
229
|
]
|
|
234
230
|
}
|
|
235
231
|
|
|
232
|
+
get _b2cRoData() {
|
|
233
|
+
return [
|
|
234
|
+
{
|
|
235
|
+
refNo: '',
|
|
236
|
+
refNo2: '',
|
|
237
|
+
refNo3: '',
|
|
238
|
+
releaseDate:
|
|
239
|
+
(new Date().getMonth() + 1).toString() +
|
|
240
|
+
'-' +
|
|
241
|
+
new Date().getDate().toString() +
|
|
242
|
+
'-' +
|
|
243
|
+
new Date().getFullYear(),
|
|
244
|
+
lmdOption: false,
|
|
245
|
+
codOption: false,
|
|
246
|
+
paidAmount: 0,
|
|
247
|
+
invoice: '',
|
|
248
|
+
airwayBill: '',
|
|
249
|
+
attentionTo: '',
|
|
250
|
+
deliveryAddress1: '',
|
|
251
|
+
deliveryAddress2: '',
|
|
252
|
+
deliveryAddress3: '',
|
|
253
|
+
deliveryAddress4: '',
|
|
254
|
+
postalCode: '',
|
|
255
|
+
city: '',
|
|
256
|
+
state: '',
|
|
257
|
+
country: '',
|
|
258
|
+
phone1: '',
|
|
259
|
+
billingAddress: '',
|
|
260
|
+
billingPostalCode: '',
|
|
261
|
+
billingCity: '',
|
|
262
|
+
billingState: '',
|
|
263
|
+
billingCountry: '',
|
|
264
|
+
sku: '',
|
|
265
|
+
packingType: '',
|
|
266
|
+
packingSize: 0,
|
|
267
|
+
uom: '',
|
|
268
|
+
releaseQty: 0
|
|
269
|
+
}
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
|
|
236
273
|
render() {
|
|
237
274
|
return html`
|
|
238
275
|
<ul export-form>
|
|
@@ -276,7 +313,7 @@ class BulkOperation extends localize(i18next)(PageView) {
|
|
|
276
313
|
</li>
|
|
277
314
|
<li>
|
|
278
315
|
<div subtitle>
|
|
279
|
-
Release Order
|
|
316
|
+
B2B Release Order
|
|
280
317
|
<a @click=${async () => await this._downloadOrderTemplate(this._roData, 'Bulk Release Orders')} download>
|
|
281
318
|
<mwc-icon>file_download</mwc-icon>
|
|
282
319
|
</a>
|
|
@@ -312,6 +349,49 @@ class BulkOperation extends localize(i18next)(PageView) {
|
|
|
312
349
|
>
|
|
313
350
|
</div>
|
|
314
351
|
</li>
|
|
352
|
+
|
|
353
|
+
<!-- ubah dkt sini -->
|
|
354
|
+
<li>
|
|
355
|
+
<div subtitle>
|
|
356
|
+
B2C Release Order
|
|
357
|
+
<a
|
|
358
|
+
@click=${async () => await this._downloadOrderTemplate(this._b2cRoData, 'Bulk B2C Release Orders')}
|
|
359
|
+
download
|
|
360
|
+
>
|
|
361
|
+
<mwc-icon>file_download</mwc-icon>
|
|
362
|
+
</a>
|
|
363
|
+
</div>
|
|
364
|
+
<form name="input-form" class="multi-column-form" autocomplete="off">
|
|
365
|
+
<fieldset>
|
|
366
|
+
<div attachment-wrap>
|
|
367
|
+
<input type="hidden" name="bizplaceId" value="${this._roB2cBizplaceId}" />
|
|
368
|
+
<input
|
|
369
|
+
type="text"
|
|
370
|
+
name="roBizplaceName"
|
|
371
|
+
placeholder="${i18next.t('label.company')}"
|
|
372
|
+
value="${this._roB2cBizplaceName}"
|
|
373
|
+
@click="${() => {
|
|
374
|
+
this._openBizplacesSelector('B2C_RO')
|
|
375
|
+
}}"
|
|
376
|
+
/>
|
|
377
|
+
</div>
|
|
378
|
+
<div attachment-wrap>
|
|
379
|
+
<file-uploader
|
|
380
|
+
name="attachments"
|
|
381
|
+
id="upload-b2c-ro-document"
|
|
382
|
+
label="${i18next.t('label.select_file')}"
|
|
383
|
+
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
384
|
+
custom-input
|
|
385
|
+
></file-uploader>
|
|
386
|
+
</div>
|
|
387
|
+
</fieldset>
|
|
388
|
+
</form>
|
|
389
|
+
<div class="button-container">
|
|
390
|
+
<mwc-button raised @click=${async () => await this._extractRawDataFromExcel(this._b2cRoDocument, 'B2C_RO')}
|
|
391
|
+
>${i18next.t('button.validate')}</mwc-button
|
|
392
|
+
>
|
|
393
|
+
</div>
|
|
394
|
+
</li>
|
|
315
395
|
</ul>
|
|
316
396
|
`
|
|
317
397
|
}
|
|
@@ -324,7 +404,11 @@ class BulkOperation extends localize(i18next)(PageView) {
|
|
|
324
404
|
}
|
|
325
405
|
|
|
326
406
|
async _extractRawDataFromExcel(_docs, sourceFn) {
|
|
327
|
-
if (
|
|
407
|
+
if (
|
|
408
|
+
(sourceFn == 'GAN' && !this._ganBizplaceId) ||
|
|
409
|
+
(sourceFn == 'RO' && !this._roBizplaceId) ||
|
|
410
|
+
(sourceFn == 'B2C_RO' && !this._roB2cBizplaceId)
|
|
411
|
+
) {
|
|
328
412
|
this._showToast({ level: 'error', message: `${i18next.t('text.please_select_the_company')}` })
|
|
329
413
|
return
|
|
330
414
|
}
|
|
@@ -352,6 +436,7 @@ class BulkOperation extends localize(i18next)(PageView) {
|
|
|
352
436
|
|
|
353
437
|
if (sourceFn == 'GAN') this._validateArrivalNotice(rawData)
|
|
354
438
|
else if (sourceFn == 'RO') this._validateReleaseOrder(rawData)
|
|
439
|
+
else if (sourceFn == 'B2C_RO') this._validateB2cReleaseOrder(rawData)
|
|
355
440
|
}
|
|
356
441
|
} else if (_docs.files.length > 1)
|
|
357
442
|
this._showToast({ level: 'error', message: i18next.t('text.you_can_only_upload_one_file_max') })
|
|
@@ -501,6 +586,63 @@ class BulkOperation extends localize(i18next)(PageView) {
|
|
|
501
586
|
)
|
|
502
587
|
}
|
|
503
588
|
|
|
589
|
+
_validateB2cReleaseOrder(records) {
|
|
590
|
+
/* validate excel that user uploaded */
|
|
591
|
+
openPopup(
|
|
592
|
+
html`
|
|
593
|
+
<validate-b2c-ro-popup
|
|
594
|
+
.records=${records.map(record => {
|
|
595
|
+
let releaseDate = new Date(String(record.releaseDate || ''))
|
|
596
|
+
let newPaidAmount = parseFloat(record?.paidAmount?.toFixed(2))
|
|
597
|
+
return {
|
|
598
|
+
refNo: String(record.refNo || ''),
|
|
599
|
+
refNo2: String(record.refNo2 || ''),
|
|
600
|
+
refNo3: String(record.refNo3 || ''),
|
|
601
|
+
releaseDate: this._getStdDateStr(releaseDate),
|
|
602
|
+
lmdOption: record.lmdOption || false,
|
|
603
|
+
codOption: record.codOption || false,
|
|
604
|
+
paidAmount: newPaidAmount,
|
|
605
|
+
invoice: String(record.invoice || ''),
|
|
606
|
+
airwayBill: String(record.airwayBill || ''),
|
|
607
|
+
attentionTo: String(record.attentionTo || ''),
|
|
608
|
+
deliveryAddress1: String(record.deliveryAddress1 || ''),
|
|
609
|
+
deliveryAddress2: String(record.deliveryAddress2 || ''),
|
|
610
|
+
deliveryAddress3: String(record.deliveryAddress3 || ''),
|
|
611
|
+
deliveryAddress4: String(record.deliveryAddress4 || ''),
|
|
612
|
+
postalCode: String(record.postalCode || ''),
|
|
613
|
+
city: String(record.city || ''),
|
|
614
|
+
state: String(record.state || ''),
|
|
615
|
+
country: String(record.country || ''),
|
|
616
|
+
phone1: String(record.phone1 || ''),
|
|
617
|
+
billingAddress: String(record.billingAddress || ''),
|
|
618
|
+
billingPostalCode: String(record.billingPostalCode || ''),
|
|
619
|
+
billingCountry: String(record.billingCountry || ''),
|
|
620
|
+
billingState: String(record.billingState || ''),
|
|
621
|
+
billingCity: String(record.billingCity || ''),
|
|
622
|
+
sku: String(record.sku || ''),
|
|
623
|
+
packingType: record.packingType && record.packingType != '' ? String(record.packingType) : null,
|
|
624
|
+
packingSize: !isNaN(Number(record.packingSize || 'x')) ? Number(record.packingSize) : null,
|
|
625
|
+
uom: record.uom && record.uom != '' ? String(record.uom) : null,
|
|
626
|
+
releaseQty: parseInt(record.releaseQty),
|
|
627
|
+
type: 'b2c',
|
|
628
|
+
exportOption: false,
|
|
629
|
+
packingOption: true,
|
|
630
|
+
courierOption: true
|
|
631
|
+
|
|
632
|
+
}
|
|
633
|
+
})}
|
|
634
|
+
.bizplaceId=${this._roB2cBizplaceId}
|
|
635
|
+
></validate-b2c-ro-popup>
|
|
636
|
+
`,
|
|
637
|
+
{
|
|
638
|
+
backdrop: true,
|
|
639
|
+
escapable: false,
|
|
640
|
+
size: 'large',
|
|
641
|
+
title: i18next.t('title.bulk_b2c_release_orders')
|
|
642
|
+
}
|
|
643
|
+
)
|
|
644
|
+
}
|
|
645
|
+
|
|
504
646
|
_openBizplacesSelector(source) {
|
|
505
647
|
openPopup(
|
|
506
648
|
html`
|
|
@@ -514,6 +656,9 @@ class BulkOperation extends localize(i18next)(PageView) {
|
|
|
514
656
|
} else if (source == 'RO') {
|
|
515
657
|
this._roBizplaceId = id
|
|
516
658
|
this._roBizplaceName = name
|
|
659
|
+
} else if (source == 'B2C_RO') {
|
|
660
|
+
this._roB2cBizplaceId = id
|
|
661
|
+
this._roB2cBizplaceName = name
|
|
517
662
|
}
|
|
518
663
|
this.ganProcessingSetting =
|
|
519
664
|
(await fetchSettingRule('gan-order-processing', this._ganPartnerDomainId)) || '-1'
|
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import '@material/mwc-button/mwc-button'
|
|
2
|
+
import '@things-factory/grist-ui'
|
|
3
|
+
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
import { css, html, LitElement } from 'lit-element'
|
|
6
|
+
|
|
7
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
8
|
+
import { client, CustomAlert } from '@things-factory/shell'
|
|
9
|
+
import { ScrollbarStyles } from '@things-factory/styles'
|
|
10
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
11
|
+
|
|
12
|
+
class ValidateB2cRoPopup extends localize(i18next)(LitElement) {
|
|
13
|
+
static get properties() {
|
|
14
|
+
return {
|
|
15
|
+
_roConfig: Object,
|
|
16
|
+
bizplaceId: String,
|
|
17
|
+
records: Array
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static get styles() {
|
|
22
|
+
return [
|
|
23
|
+
ScrollbarStyles,
|
|
24
|
+
css`
|
|
25
|
+
:host {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
background-color: white;
|
|
30
|
+
|
|
31
|
+
--grid-record-emphasized-background-color: #ffdbdb;
|
|
32
|
+
--grid-record-emphasized-color: #703f3f;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.grist {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
flex: 1;
|
|
39
|
+
overflow-y: auto;
|
|
40
|
+
}
|
|
41
|
+
data-grist {
|
|
42
|
+
overflow-y: hidden;
|
|
43
|
+
flex: 1;
|
|
44
|
+
}
|
|
45
|
+
h2 {
|
|
46
|
+
padding: var(--subtitle-padding);
|
|
47
|
+
font: var(--subtitle-font);
|
|
48
|
+
color: var(--subtitle-text-color);
|
|
49
|
+
border-bottom: var(--subtitle-border-bottom);
|
|
50
|
+
}
|
|
51
|
+
.button-container {
|
|
52
|
+
display: flex;
|
|
53
|
+
margin-left: auto;
|
|
54
|
+
}
|
|
55
|
+
.button-container > mwc-button {
|
|
56
|
+
padding: 10px;
|
|
57
|
+
}
|
|
58
|
+
`
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get dataGrist() {
|
|
63
|
+
return this.shadowRoot.querySelector('data-grist')
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
get _config() {
|
|
67
|
+
return {
|
|
68
|
+
list: {},
|
|
69
|
+
pagination: { infinite: true },
|
|
70
|
+
rows: {
|
|
71
|
+
appendable: false,
|
|
72
|
+
classifier: (record, rowIndex) => {
|
|
73
|
+
return {
|
|
74
|
+
emphasized: record.errorMsg && record.errorMsg != ''
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
columns: [
|
|
79
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
80
|
+
{
|
|
81
|
+
type: 'gutter',
|
|
82
|
+
gutterName: 'button',
|
|
83
|
+
icon: 'close',
|
|
84
|
+
handlers: {
|
|
85
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
86
|
+
data.records.splice(rowIndex, 1)
|
|
87
|
+
this.records = data.records
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: 'string',
|
|
93
|
+
name: 'refNo',
|
|
94
|
+
header: i18next.t('field.ref_no'),
|
|
95
|
+
width: 150
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: 'string',
|
|
99
|
+
name: 'refNo2',
|
|
100
|
+
header: i18next.t('field.ref_no_2'),
|
|
101
|
+
width: 150
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'string',
|
|
105
|
+
name: 'refNo3',
|
|
106
|
+
header: i18next.t('field.ref_no_3'),
|
|
107
|
+
width: 150
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: 'string',
|
|
111
|
+
name: 'releaseDate',
|
|
112
|
+
header: i18next.t('field.release_date'),
|
|
113
|
+
width: 150
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: 'boolean',
|
|
117
|
+
name: 'lmdOption',
|
|
118
|
+
header: i18next.t('field.lmd_option'),
|
|
119
|
+
width: 150
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: 'boolean',
|
|
123
|
+
name: 'codOption',
|
|
124
|
+
header: i18next.t('field.cod_option'),
|
|
125
|
+
width: 150
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'integer',
|
|
129
|
+
name: 'paidAmount',
|
|
130
|
+
header: i18next.t('field.paid_amount'),
|
|
131
|
+
width: 150
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: 'string',
|
|
135
|
+
name: 'airwayBill',
|
|
136
|
+
header: i18next.t('field.awb'),
|
|
137
|
+
width: 150
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
type: 'string',
|
|
141
|
+
name: 'invoice',
|
|
142
|
+
header: i18next.t('field.invoice'),
|
|
143
|
+
width: 150
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: 'string',
|
|
147
|
+
name: 'attentionTo',
|
|
148
|
+
header: i18next.t('field.attention_to'),
|
|
149
|
+
width: 150
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
type: 'string',
|
|
153
|
+
name: 'deliveryAddress1',
|
|
154
|
+
header: i18next.t('field.delivery_address_1'),
|
|
155
|
+
width: 150
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: 'string',
|
|
159
|
+
name: 'deliveryAddress2',
|
|
160
|
+
header: i18next.t('field.delivery_address_2'),
|
|
161
|
+
width: 150
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
type: 'string',
|
|
165
|
+
name: 'deliveryAddress3',
|
|
166
|
+
header: i18next.t('field.delivery_address_3'),
|
|
167
|
+
width: 150
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: 'string',
|
|
171
|
+
name: 'deliveryAddress4',
|
|
172
|
+
header: i18next.t('field.delivery_address_4'),
|
|
173
|
+
width: 150
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
type: 'string',
|
|
177
|
+
name: 'postalCode',
|
|
178
|
+
header: i18next.t('field.postal_code'),
|
|
179
|
+
width: 150
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
type: 'string',
|
|
183
|
+
name: 'city',
|
|
184
|
+
header: i18next.t('field.city'),
|
|
185
|
+
width: 150
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'string',
|
|
189
|
+
name: 'state',
|
|
190
|
+
header: i18next.t('field.state'),
|
|
191
|
+
width: 150
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
type: 'string',
|
|
195
|
+
name: 'country',
|
|
196
|
+
header: i18next.t('field.country'),
|
|
197
|
+
width: 150
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: 'string',
|
|
201
|
+
name: 'phone1',
|
|
202
|
+
header: i18next.t('field.phone'),
|
|
203
|
+
width: 150
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
type: 'string',
|
|
207
|
+
name: 'billingAddress',
|
|
208
|
+
header: i18next.t('field.billing_address'),
|
|
209
|
+
width: 150
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
type: 'string',
|
|
213
|
+
name: 'billingCity',
|
|
214
|
+
header: i18next.t('field.billing_city'),
|
|
215
|
+
width: 150
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
type: 'string',
|
|
219
|
+
name: 'billingPostalCode',
|
|
220
|
+
header: i18next.t('field.billing_postal_code'),
|
|
221
|
+
width: 150
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
type: 'string',
|
|
225
|
+
name: 'billingState',
|
|
226
|
+
header: i18next.t('field.billing_state'),
|
|
227
|
+
width: 150
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
type: 'string',
|
|
231
|
+
name: 'billingCountry',
|
|
232
|
+
header: i18next.t('field.billing_country'),
|
|
233
|
+
width: 150
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
type: 'string',
|
|
237
|
+
name: 'sku',
|
|
238
|
+
header: i18next.t('field.sku'),
|
|
239
|
+
width: 150
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
type: 'string',
|
|
243
|
+
name: 'packingType',
|
|
244
|
+
header: i18next.t('field.packing_type'),
|
|
245
|
+
width: 100
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: 'string',
|
|
249
|
+
name: 'packingSize',
|
|
250
|
+
header: i18next.t('field.packing_size'),
|
|
251
|
+
width: 100
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
type: 'string',
|
|
255
|
+
name: 'uom',
|
|
256
|
+
header: i18next.t('field.uom'),
|
|
257
|
+
width: 100
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
type: 'integer',
|
|
261
|
+
name: 'releaseQty',
|
|
262
|
+
header: i18next.t('field.release_qty'),
|
|
263
|
+
width: 150
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
type: 'string',
|
|
267
|
+
name: 'errorMsg',
|
|
268
|
+
header: i18next.t('field.error_message'),
|
|
269
|
+
width: 350
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
render() {
|
|
276
|
+
return html`
|
|
277
|
+
<div class="grist">
|
|
278
|
+
<data-grist .mode=${isMobileDevice() ? 'LIST' : 'GRID'} .config=${this._roConfig}></data-grist>
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
<div class="button-container">
|
|
282
|
+
<mwc-button
|
|
283
|
+
@click=${async () => {
|
|
284
|
+
const answer = await CustomAlert({
|
|
285
|
+
title: i18next.t('label.create_release_orders'),
|
|
286
|
+
text: i18next.t('text.are_you_sure'),
|
|
287
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
288
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
if (!answer.value) return
|
|
292
|
+
await this._generateReleaseOrders()
|
|
293
|
+
}}
|
|
294
|
+
>${i18next.t('button.create_ro')}</mwc-button
|
|
295
|
+
>
|
|
296
|
+
<mwc-button @click=${e => history.back()}>${i18next.t('button.cancel')}</mwc-button>
|
|
297
|
+
</div>
|
|
298
|
+
`
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
async firstUpdated() {
|
|
302
|
+
this._roConfig = this._config
|
|
303
|
+
await this._getAvailableItems(this.records, this.bizplaceId)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
updated(changedProps) {
|
|
307
|
+
if (changedProps.has('records')) {
|
|
308
|
+
this.dataGrist.data = {
|
|
309
|
+
records: this.records,
|
|
310
|
+
total: this.records.length
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
async _getAvailableItems(rawReleaseGoods, bizplaceId) {
|
|
316
|
+
const response = await client.query({
|
|
317
|
+
query: gql`
|
|
318
|
+
query bulkReleaseGoodsAvailableItems($rawReleaseGoods: [NewReleaseGood!], $bizplaceId: String!) {
|
|
319
|
+
bulkReleaseGoodsAvailableItems(rawReleaseGoods: $rawReleaseGoods, bizplaceId: $bizplaceId) {
|
|
320
|
+
refNo
|
|
321
|
+
refNo2
|
|
322
|
+
refNo3
|
|
323
|
+
releaseDate
|
|
324
|
+
lmdOption
|
|
325
|
+
codOption
|
|
326
|
+
paidAmount
|
|
327
|
+
invoice
|
|
328
|
+
airwayBill
|
|
329
|
+
attentionTo
|
|
330
|
+
deliveryAddress1
|
|
331
|
+
deliveryAddress2
|
|
332
|
+
deliveryAddress3
|
|
333
|
+
deliveryAddress4
|
|
334
|
+
postalCode
|
|
335
|
+
city
|
|
336
|
+
state
|
|
337
|
+
country
|
|
338
|
+
phone1
|
|
339
|
+
billingAddress
|
|
340
|
+
billingCity
|
|
341
|
+
billingPostalCode
|
|
342
|
+
billingState
|
|
343
|
+
billingCountry
|
|
344
|
+
sku
|
|
345
|
+
packingType
|
|
346
|
+
packingSize
|
|
347
|
+
uom
|
|
348
|
+
releaseQty
|
|
349
|
+
productId
|
|
350
|
+
type
|
|
351
|
+
errorMsg
|
|
352
|
+
exportOption
|
|
353
|
+
packingOption
|
|
354
|
+
courierOption
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
`,
|
|
358
|
+
variables: { rawReleaseGoods, bizplaceId }
|
|
359
|
+
})
|
|
360
|
+
if (!response.errors) {
|
|
361
|
+
this.records = response.data.bulkReleaseGoodsAvailableItems
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
async _generateReleaseOrders() {
|
|
366
|
+
this.dataGrist.showSpinner()
|
|
367
|
+
|
|
368
|
+
try {
|
|
369
|
+
this._validateReleaseOrders()
|
|
370
|
+
|
|
371
|
+
//codOption tak true, maybe lmd pun akan ada issue yg sama
|
|
372
|
+
|
|
373
|
+
const response = await client.mutate({
|
|
374
|
+
mutation: gql`
|
|
375
|
+
mutation bulkAddReleaseGoods($rawReleaseGoods: [NewReleaseGood!], $bizplaceId: String!) {
|
|
376
|
+
bulkAddReleaseGoods(rawReleaseGoods: $rawReleaseGoods, bizplaceId: $bizplaceId) {
|
|
377
|
+
name
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
`,
|
|
381
|
+
variables: {
|
|
382
|
+
rawReleaseGoods: this.records.map(x => {
|
|
383
|
+
// list out all properties again to avoid additional props added by user in excel
|
|
384
|
+
return {
|
|
385
|
+
refNo: x.refNo,
|
|
386
|
+
refNo2: x?.refNo2,
|
|
387
|
+
refNo3: x?.refNo3,
|
|
388
|
+
releaseDate: x.releaseDate,
|
|
389
|
+
lmdOption: x?.lmdOption || false,
|
|
390
|
+
codOption: x?.codOption || false,
|
|
391
|
+
paidAmount: x?.paidAmount,
|
|
392
|
+
invoice: x?.invoice,
|
|
393
|
+
airwayBill: x?.airwayBill,
|
|
394
|
+
attentionTo: x.attentionTo,
|
|
395
|
+
deliveryAddress1: x.deliveryAddress1,
|
|
396
|
+
deliveryAddress2: x?.deliveryAddress2,
|
|
397
|
+
deliveryAddress3: x?.deliveryAddress3,
|
|
398
|
+
deliveryAddress4: x?.deliveryAddress4,
|
|
399
|
+
postalCode: String(x.postalCode),
|
|
400
|
+
city: x.city,
|
|
401
|
+
state: x.state,
|
|
402
|
+
country: x.country,
|
|
403
|
+
phone1: String(x.phone1),
|
|
404
|
+
billingAddress: x.billingAddress,
|
|
405
|
+
billingCity: x.billingCity,
|
|
406
|
+
billingState: x.billingState,
|
|
407
|
+
billingPostalCode: x.billingPostalCode,
|
|
408
|
+
billingCountry: x.billingCountry,
|
|
409
|
+
sku: x.sku,
|
|
410
|
+
productId: x.productId,
|
|
411
|
+
packingType: x.packingType,
|
|
412
|
+
packingSize: x.packingSize,
|
|
413
|
+
uom: x.uom,
|
|
414
|
+
releaseQty: x.releaseQty,
|
|
415
|
+
type: x.type,
|
|
416
|
+
exportOption: x.exportOption,
|
|
417
|
+
packingOption: x.packingOption,
|
|
418
|
+
courierOption: x.courierOption
|
|
419
|
+
}
|
|
420
|
+
}),
|
|
421
|
+
bizplaceId: this.bizplaceId
|
|
422
|
+
}
|
|
423
|
+
})
|
|
424
|
+
|
|
425
|
+
if (!response.errors) {
|
|
426
|
+
this._showToast({ message: i18next.t('text.release_order_created') })
|
|
427
|
+
history.back()
|
|
428
|
+
} else {
|
|
429
|
+
let invalidDataError = response.errors.find(err => err.extensions.exception.errorCode == 'ivd1')
|
|
430
|
+
if (invalidDataError) {
|
|
431
|
+
this.records = JSON.parse(invalidDataError.extensions.exception.detail.data)
|
|
432
|
+
this._showToast({ message: i18next.t('text.please_recheck_your_request_data') })
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
} catch (e) {
|
|
436
|
+
this._showToast(e)
|
|
437
|
+
} finally {
|
|
438
|
+
this.dataGrist.hideSpinner()
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
_validateReleaseOrders() {
|
|
443
|
+
if (this.records.some(record => record.errorMsg && record.errorMsg != '')) {
|
|
444
|
+
throw new Error(i18next.t('text.please_recheck_your_request_data'))
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
_showToast({ type, message }) {
|
|
449
|
+
document.dispatchEvent(
|
|
450
|
+
new CustomEvent('notify', {
|
|
451
|
+
detail: {
|
|
452
|
+
type,
|
|
453
|
+
message
|
|
454
|
+
}
|
|
455
|
+
})
|
|
456
|
+
)
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
window.customElements.define('validate-b2c-ro-popup', ValidateB2cRoPopup)
|