@things-factory/operato-wms 4.0.23 → 4.0.27
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/bootstrap.js +1 -1
- package/client/pages/adjustment/transfer-inventory.js +32 -6
- package/client/pages/billing/claim-chit/claim-chit-detail.js +32 -35
- package/client/pages/billing/claim-chit/claim-chit-list.js +17 -17
- package/client/pages/billing/claim-chit/create-claim-chit.js +39 -30
- package/client/pages/billing/transport-summary-report.js +21 -23
- package/client/pages/bulk-operation/bulk-operation.js +189 -64
- package/client/pages/bulk-operation/validate-gan-popup.js +391 -0
- package/client/pages/bulk-operation/validate-ro-popup.js +44 -54
- package/client/pages/components/popup-unloading.js +47 -34
- package/client/pages/components/select-product-popup.js +74 -27
- package/client/pages/components/worksheet-information-popup.js +100 -0
- package/client/pages/inbound/expiry-date-popup.js +2 -2
- package/client/pages/inbound/inbound-reusable-pallet.js +21 -19
- package/client/pages/inbound/palletizing-pallets-popup.js +10 -9
- package/client/pages/inbound/putaway-product.js +196 -235
- package/client/pages/inbound/putaway-worksheet-generate-popup.js +4 -4
- package/client/pages/inbound/undo-unload-popup.js +295 -0
- package/client/pages/inbound/unload-product.js +236 -646
- package/client/pages/inbound/unloaded-inventories-popup.js +129 -0
- package/client/pages/inbound/vas-selector.js +9 -8
- package/client/pages/inbound/worksheet-unloading.js +15 -11
- package/client/pages/inventory/inventory-adjustment.js +9 -10
- package/client/pages/inventory-check/check-inventory-popup.js +20 -18
- package/client/pages/inventory-check/cycle-count-recheck-popup.js +25 -15
- package/client/pages/inventory-check/inspecting-product.js +2 -2
- package/client/pages/inventory-check/inventory-check-list.js +30 -19
- package/client/pages/inventory-check/search-popup.js +15 -14
- package/client/pages/inventory-check/worksheet-cycle-count.js +17 -15
- package/client/pages/master/location-list.js +60 -52
- package/client/pages/master/pallet-list.js +34 -30
- package/client/pages/master/print-location-label.js +37 -36
- package/client/pages/master/product/product-list.js +1 -1
- package/client/pages/master/warehouse-list.js +33 -29
- package/client/pages/master/worker-list.js +30 -30
- package/client/pages/order/arrival-notice/arrival-notice-detail.js +409 -21
- package/client/pages/order/arrival-notice/assign-buffer-location.js +1 -1
- package/client/pages/order/arrival-notice/create-arrival-notice.js +89 -13
- package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +90 -10
- package/client/pages/order/arrival-notice/edit-product-popup.js +2 -2
- package/client/pages/order/goods-received-note/customer-grn-list.js +9 -8
- package/client/pages/order/goods-received-note/customer-received-note.js +8 -7
- package/client/pages/order/goods-received-note/received-note-list.js +9 -8
- package/client/pages/order/release-order/b2b/b2b-order-list.js +78 -2
- package/client/pages/order/release-order/b2b/b2b-order-requests.js +32 -16
- package/client/pages/order/release-order/b2c/b2c-order-requests.js +49 -5
- package/client/pages/order/release-order/batch-generate-single-picking-worksheet-popup.js +314 -0
- package/client/pages/order/release-order/batch-picking-popup.js +19 -2
- package/client/pages/order/release-order/create-release-order.js +194 -89
- package/client/pages/order/release-order/release-extra-product-popup.js +3 -7
- package/client/pages/order/release-order/release-order-detail.js +390 -107
- package/client/pages/order/return-order/check-return-order.js +15 -13
- package/client/pages/order/return-order/create-return-order.js +3 -3
- package/client/pages/order/return-order/receive-return-order-requests.js +25 -22
- package/client/pages/order/return-order/rejected-return-order.js +8 -14
- package/client/pages/order/return-order/return-order-assign-buffer-location.js +16 -14
- package/client/pages/order/return-order/return-order-detail.js +35 -31
- package/client/pages/order/return-order/return-order-list.js +9 -8
- package/client/pages/order/return-order/return-order-requests.js +20 -18
- package/client/pages/order/reverse-kitting-order/reverse-kitting-order-list.js +9 -8
- package/client/pages/order/transfer-order/receive-transfer-order-request.js +67 -66
- package/client/pages/order/transfer-order/rejected-transfer-order.js +7 -6
- package/client/pages/order/transfer-order/transfer-order-detail.js +7 -6
- package/client/pages/order/transfer-order/transfer-order-requests.js +20 -18
- package/client/pages/order/transport-order/contact-point-selector-popup.js +20 -20
- package/client/pages/order/transport-order/create-delivery-order.js +1 -1
- package/client/pages/order/transport-order/delivery-note-popup.js +52 -46
- package/client/pages/order/transport-order/delivery-order-list.js +1 -1
- package/client/pages/order/transport-order/print-delivery-note.js +17 -16
- package/client/pages/order/transport-order/upload-delivery-note.js +21 -18
- package/client/pages/order/transport-order/view-delivery-note.js +19 -22
- package/client/pages/order/vas-order/create-vas-order.js +12 -11
- package/client/pages/order/vas-order/receive-vas-order.js +25 -22
- package/client/pages/order/vas-order/vas-order-detail.js +26 -23
- package/client/pages/order/vas-order/vas-order-list.js +9 -8
- package/client/pages/order/vas-order/vas-order-requests.js +11 -12
- package/client/pages/outbound/outbound-reusable-pallet.js +25 -33
- package/client/pages/outbound/packing-product.js +111 -236
- package/client/pages/outbound/picking-product.js +288 -380
- package/client/pages/outbound/single-outbound-worksheet.js +9 -8
- package/client/pages/outbound/sorting-product.js +66 -63
- package/client/pages/outbound/worksheet-loading.js +7 -3
- package/client/pages/outbound/worksheet-packing.js +3 -3
- package/client/pages/outbound/worksheet-picking.js +22 -18
- package/client/pages/report/job-sheet-list.js +9 -8
- package/client/pages/vas/print-product-label.js +17 -9
- package/client/route.js +16 -32
- package/dist-server/graphql/resolvers/reports/product-label-report.js +1 -0
- package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -1
- package/package.json +65 -65
- package/server/graphql/resolvers/reports/product-label-report.ts +1 -0
- package/things-factory.config.js +0 -16
- package/translations/en.json +34 -2
- package/translations/ko.json +34 -3
- package/translations/ms.json +34 -3
- package/translations/zh.json +34 -3
- package/client/pages/inbound/location-selector.js +0 -224
- package/client/pages/master/picking-bin-list.js +0 -354
- package/client/pages/order/retail-replenishment-order/retail-replenishment-order-detail.js +0 -315
- package/client/pages/order/retail-replenishment-order/retail-replenishment-order-requests.js +0 -307
- package/client/pages/order/vas-order/rejected-vas-order.js +0 -300
|
@@ -0,0 +1,391 @@
|
|
|
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, sleep } from '@things-factory/utils'
|
|
11
|
+
|
|
12
|
+
class ValidateGanPopup extends localize(i18next)(LitElement) {
|
|
13
|
+
static get properties() {
|
|
14
|
+
return {
|
|
15
|
+
_ganConfig: 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.remark && record.remark != ''
|
|
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
|
+
this.records = [...data.records.filter((_, idx) => idx !== rowIndex)]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{ type: 'string', name: 'productId', hidden: true },
|
|
91
|
+
{ type: 'string', name: 'productDetailId', hidden: true },
|
|
92
|
+
{
|
|
93
|
+
type: 'string',
|
|
94
|
+
name: 'refNo',
|
|
95
|
+
header: i18next.t('field.ref_no'),
|
|
96
|
+
width: 150
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: 'string',
|
|
100
|
+
name: 'refNo2',
|
|
101
|
+
header: i18next.t('field.ref_no_2'),
|
|
102
|
+
width: 150
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: 'string',
|
|
106
|
+
name: 'refNo3',
|
|
107
|
+
header: i18next.t('field.ref_no_3'),
|
|
108
|
+
width: 150
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'string',
|
|
112
|
+
name: 'etaDate',
|
|
113
|
+
header: i18next.t('field.eta_date'),
|
|
114
|
+
width: 150
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: 'string',
|
|
118
|
+
name: 'truckNo',
|
|
119
|
+
header: i18next.t('field.truck_no'),
|
|
120
|
+
width: 150
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
type: 'string',
|
|
124
|
+
name: 'containerNo',
|
|
125
|
+
header: i18next.t('field.container_no'),
|
|
126
|
+
width: 150
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: 'string',
|
|
130
|
+
name: 'containerSize',
|
|
131
|
+
header: i18next.t('field.container_size'),
|
|
132
|
+
width: 150
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
type: 'boolean',
|
|
136
|
+
name: 'looseItem',
|
|
137
|
+
header: i18next.t('field.loose_item'),
|
|
138
|
+
width: 150
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: 'boolean',
|
|
142
|
+
name: 'importCargo',
|
|
143
|
+
header: i18next.t('field.import_cargo'),
|
|
144
|
+
width: 150
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
type: 'string',
|
|
148
|
+
name: 'sku',
|
|
149
|
+
header: i18next.t('field.sku'),
|
|
150
|
+
width: 150
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: 'string',
|
|
154
|
+
name: 'productInfo',
|
|
155
|
+
header: i18next.t('field.product_info'),
|
|
156
|
+
width: 400
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: 'string',
|
|
160
|
+
name: 'batchId',
|
|
161
|
+
header: i18next.t('field.batch_no'),
|
|
162
|
+
width: 150
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'integer',
|
|
166
|
+
name: 'packQty',
|
|
167
|
+
header: i18next.t('field.pack_qty'),
|
|
168
|
+
width: 150
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: 'float',
|
|
172
|
+
name: 'uomValue',
|
|
173
|
+
header: i18next.t('field.uom_value'),
|
|
174
|
+
width: 150
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
type: 'string',
|
|
178
|
+
name: 'totalUomValue',
|
|
179
|
+
header: i18next.t('field.total_uom_value'),
|
|
180
|
+
width: 150
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
type: 'string',
|
|
184
|
+
name: 'uom',
|
|
185
|
+
header: i18next.t('field.uom'),
|
|
186
|
+
width: 100
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
type: 'integer',
|
|
190
|
+
name: 'palletQty',
|
|
191
|
+
header: i18next.t('field.pallet_qty'),
|
|
192
|
+
width: 100
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
type: 'float',
|
|
196
|
+
name: 'unitPrice',
|
|
197
|
+
header: i18next.t('field.unit_price'),
|
|
198
|
+
width: 100
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: 'integer',
|
|
202
|
+
name: 'manufactureYear',
|
|
203
|
+
header: i18next.t('field.manufacture_year'),
|
|
204
|
+
width: 100
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
type: 'string',
|
|
208
|
+
name: 'remark',
|
|
209
|
+
header: i18next.t('field.remark'),
|
|
210
|
+
width: 350
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
render() {
|
|
217
|
+
return html`
|
|
218
|
+
<div class="grist">
|
|
219
|
+
<data-grist .mode=${isMobileDevice() ? 'LIST' : 'GRID'} .config=${this._ganConfig}></data-grist>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<div class="button-container">
|
|
223
|
+
<mwc-button
|
|
224
|
+
@click=${async () => {
|
|
225
|
+
const answer = await CustomAlert({
|
|
226
|
+
title: i18next.t('label.create_arrival_notices'),
|
|
227
|
+
text: i18next.t('text.are_you_sure'),
|
|
228
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
229
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
if (!answer.value) return
|
|
233
|
+
await this._generateArrivalNotices(this.records, this.bizplaceId)
|
|
234
|
+
}}
|
|
235
|
+
>${i18next.t('button.create_gan')}</mwc-button
|
|
236
|
+
>
|
|
237
|
+
<mwc-button @click=${e => history.back()}>${i18next.t('button.cancel')}</mwc-button>
|
|
238
|
+
</div>
|
|
239
|
+
`
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
async firstUpdated() {
|
|
243
|
+
this._ganConfig = this._config
|
|
244
|
+
await this._getValidatedArrivalNoticeItems(this.records, this.bizplaceId)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
updated(changedProps) {
|
|
248
|
+
if (changedProps.has('records')) {
|
|
249
|
+
this.dataGrist.data = {
|
|
250
|
+
records: this.records,
|
|
251
|
+
total: this.records.length
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async _getValidatedArrivalNoticeItems(rawArrivalNotices, bizplaceId) {
|
|
257
|
+
try {
|
|
258
|
+
const response = await client.query({
|
|
259
|
+
query: gql`
|
|
260
|
+
query validateBulkArrivalNotices($rawArrivalNotices: [NewArrivalNotice!], $bizplaceId: String!) {
|
|
261
|
+
validateBulkArrivalNotices(rawArrivalNotices: $rawArrivalNotices, bizplaceId: $bizplaceId) {
|
|
262
|
+
refNo
|
|
263
|
+
refNo2
|
|
264
|
+
refNo3
|
|
265
|
+
etaDate
|
|
266
|
+
truckNo
|
|
267
|
+
ownTransport
|
|
268
|
+
containerNo
|
|
269
|
+
containerSize
|
|
270
|
+
container
|
|
271
|
+
looseItem
|
|
272
|
+
importCargo
|
|
273
|
+
productId
|
|
274
|
+
productDetailId
|
|
275
|
+
sku
|
|
276
|
+
productInfo
|
|
277
|
+
batchId
|
|
278
|
+
packingType
|
|
279
|
+
packingSize
|
|
280
|
+
uom
|
|
281
|
+
packQty
|
|
282
|
+
uomValue
|
|
283
|
+
totalUomValue
|
|
284
|
+
palletQty
|
|
285
|
+
unitPrice
|
|
286
|
+
manufactureYear
|
|
287
|
+
remark
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
`,
|
|
291
|
+
variables: { rawArrivalNotices, bizplaceId }
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
if (!response.errors) {
|
|
295
|
+
this.records = response.data.validateBulkArrivalNotices
|
|
296
|
+
}
|
|
297
|
+
} catch (e) {
|
|
298
|
+
console.error(e)
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async _generateArrivalNotices(rawArrivalNotices, bizplaceId) {
|
|
303
|
+
this.dataGrist.showSpinner()
|
|
304
|
+
|
|
305
|
+
try {
|
|
306
|
+
this._validateArrivalNotices()
|
|
307
|
+
|
|
308
|
+
const response = await client.mutate({
|
|
309
|
+
mutation: gql`
|
|
310
|
+
mutation bulkGenerateArrivalNotices($rawArrivalNotices: [NewArrivalNotice!], $bizplaceId: String!) {
|
|
311
|
+
bulkGenerateArrivalNotices(rawArrivalNotices: $rawArrivalNotices, bizplaceId: $bizplaceId) {
|
|
312
|
+
items {
|
|
313
|
+
name
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
`,
|
|
318
|
+
variables: {
|
|
319
|
+
rawArrivalNotices: rawArrivalNotices.map(raw => {
|
|
320
|
+
return {
|
|
321
|
+
refNo: raw.refNo,
|
|
322
|
+
refNo2: raw.refNo2,
|
|
323
|
+
refNo3: raw.refNo3,
|
|
324
|
+
etaDate: raw.etaDate,
|
|
325
|
+
truckNo: raw.truckNo,
|
|
326
|
+
ownTransport: !!raw.truckNo || false,
|
|
327
|
+
looseItem: !!raw.looseItem || false,
|
|
328
|
+
importCargo: !!raw.importCargo || false,
|
|
329
|
+
container: (!!raw.containerNo && !!raw.containerSize) || false,
|
|
330
|
+
containerNo: raw.containerNo,
|
|
331
|
+
containerSize: raw.containerSize,
|
|
332
|
+
sku: raw.sku,
|
|
333
|
+
batchId: raw.batchId,
|
|
334
|
+
packingType: raw.packingType,
|
|
335
|
+
packingSize: raw.packingSize,
|
|
336
|
+
uom: raw.uom,
|
|
337
|
+
packQty: raw.packQty,
|
|
338
|
+
palletQty: raw.palletQty,
|
|
339
|
+
unitPrice: raw.unitPrice,
|
|
340
|
+
manufactureYear: raw.manufactureYear
|
|
341
|
+
}
|
|
342
|
+
}),
|
|
343
|
+
bizplaceId
|
|
344
|
+
}
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
if (!response.errors) {
|
|
348
|
+
this._showToast({ message: i18next.t('text.arrival_notices_created') })
|
|
349
|
+
history.back()
|
|
350
|
+
} else {
|
|
351
|
+
let invalidDataError = response.errors.find(err => err.extensions.exception.errorCode == 'ivd1')
|
|
352
|
+
if (invalidDataError) {
|
|
353
|
+
this.records = JSON.parse(invalidDataError.extensions.exception.detail.data)
|
|
354
|
+
this._showToast({ message: i18next.t('text.please_recheck_your_request_data') })
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
} catch (e) {
|
|
358
|
+
this._showToast(e)
|
|
359
|
+
} finally {
|
|
360
|
+
this.dataGrist.hideSpinner()
|
|
361
|
+
await sleep(1)
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
_validateArrivalNotices() {
|
|
366
|
+
if (this.records.some(record => record.remark && record.remark != '')) {
|
|
367
|
+
throw new Error(i18next.t('text.please_recheck_your_request_data'))
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
_getStdDateStr(date) {
|
|
372
|
+
if (isNaN(date.getFullYear())) return ''
|
|
373
|
+
else {
|
|
374
|
+
date.setHours(date.getHours() + 8)
|
|
375
|
+
return date.toISOString().split('T')[0]
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
_showToast({ type, message }) {
|
|
380
|
+
document.dispatchEvent(
|
|
381
|
+
new CustomEvent('notify', {
|
|
382
|
+
detail: {
|
|
383
|
+
type,
|
|
384
|
+
message
|
|
385
|
+
}
|
|
386
|
+
})
|
|
387
|
+
)
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
window.customElements.define('validate-gan-popup', ValidateGanPopup)
|
|
@@ -7,7 +7,7 @@ import { css, html, LitElement } from 'lit-element'
|
|
|
7
7
|
import { i18next, localize } from '@things-factory/i18n-base'
|
|
8
8
|
import { client, CustomAlert } from '@things-factory/shell'
|
|
9
9
|
import { ScrollbarStyles } from '@things-factory/styles'
|
|
10
|
-
import { isMobileDevice
|
|
10
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
11
11
|
|
|
12
12
|
class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
13
13
|
static get properties() {
|
|
@@ -77,13 +77,7 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
|
77
77
|
appendable: false,
|
|
78
78
|
classifier: (record, rowIndex) => {
|
|
79
79
|
return {
|
|
80
|
-
|
|
81
|
-
emphasized:
|
|
82
|
-
record.assignedQty <= 0 ||
|
|
83
|
-
!record.refNo ||
|
|
84
|
-
record?.refNo == '' ||
|
|
85
|
-
!record.releaseDate ||
|
|
86
|
-
record?.releaseDate == ''
|
|
80
|
+
emphasized: record.errorMsg && record.errorMsg != ''
|
|
87
81
|
}
|
|
88
82
|
}
|
|
89
83
|
},
|
|
@@ -192,8 +186,8 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
|
192
186
|
},
|
|
193
187
|
{
|
|
194
188
|
type: 'string',
|
|
195
|
-
name: '
|
|
196
|
-
header: i18next.t('field.
|
|
189
|
+
name: 'productInfo',
|
|
190
|
+
header: i18next.t('field.product_info'),
|
|
197
191
|
width: 400
|
|
198
192
|
},
|
|
199
193
|
{
|
|
@@ -228,8 +222,20 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
|
228
222
|
},
|
|
229
223
|
{
|
|
230
224
|
type: 'string',
|
|
231
|
-
name: '
|
|
232
|
-
header: i18next.t('field.
|
|
225
|
+
name: 'packingType',
|
|
226
|
+
header: i18next.t('field.packing_type'),
|
|
227
|
+
width: 100
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
type: 'string',
|
|
231
|
+
name: 'packingSize',
|
|
232
|
+
header: i18next.t('field.packing_size'),
|
|
233
|
+
width: 100
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
type: 'string',
|
|
237
|
+
name: 'errorMsg',
|
|
238
|
+
header: i18next.t('field.error_message'),
|
|
233
239
|
width: 350
|
|
234
240
|
}
|
|
235
241
|
]
|
|
@@ -279,7 +285,7 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
|
279
285
|
async _getAvailableItems(rawData) {
|
|
280
286
|
const response = await client.query({
|
|
281
287
|
query: gql`
|
|
282
|
-
query bulkReleaseGoodsAvailableItems($rawReleaseGoods: [
|
|
288
|
+
query bulkReleaseGoodsAvailableItems($rawReleaseGoods: [NewReleaseGood!], $bizplaceId: String!) {
|
|
283
289
|
bulkReleaseGoodsAvailableItems(rawReleaseGoods: $rawReleaseGoods, bizplaceId: $bizplaceId) {
|
|
284
290
|
refNo
|
|
285
291
|
refNo2
|
|
@@ -295,6 +301,7 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
|
295
301
|
country
|
|
296
302
|
sku
|
|
297
303
|
productId
|
|
304
|
+
productInfo
|
|
298
305
|
batchId
|
|
299
306
|
packingType
|
|
300
307
|
packingSize
|
|
@@ -304,6 +311,7 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
|
304
311
|
assignedUomValue
|
|
305
312
|
postalCode
|
|
306
313
|
phone1
|
|
314
|
+
errorMsg
|
|
307
315
|
}
|
|
308
316
|
}
|
|
309
317
|
`,
|
|
@@ -329,7 +337,8 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
|
329
337
|
uom: raw.uom,
|
|
330
338
|
releaseQty: raw.releaseQty,
|
|
331
339
|
postalCode: String(raw.postalCode),
|
|
332
|
-
phone1: String(raw.phone1)
|
|
340
|
+
phone1: String(raw.phone1),
|
|
341
|
+
exportOption: false
|
|
333
342
|
}
|
|
334
343
|
}),
|
|
335
344
|
bizplaceId: this.bizplaceId
|
|
@@ -337,22 +346,7 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
|
337
346
|
})
|
|
338
347
|
|
|
339
348
|
if (!response.errors) {
|
|
340
|
-
this.records = response.data.bulkReleaseGoodsAvailableItems
|
|
341
|
-
return {
|
|
342
|
-
...item,
|
|
343
|
-
remark: !item.productId
|
|
344
|
-
? i18next.t('text.product_not_found')
|
|
345
|
-
: item.releaseQty <= 0
|
|
346
|
-
? i18next.t('text.invalid_release_qty')
|
|
347
|
-
: item.assignedQty == 0
|
|
348
|
-
? i18next.t('text.insufficient_stock')
|
|
349
|
-
: !item.releaseDate
|
|
350
|
-
? i18next.t('text.release_date_is_empty')
|
|
351
|
-
: !item.refNo
|
|
352
|
-
? i18next.t('text.ref_no_is_empty')
|
|
353
|
-
: ''
|
|
354
|
-
}
|
|
355
|
-
})
|
|
349
|
+
this.records = response.data.bulkReleaseGoodsAvailableItems
|
|
356
350
|
}
|
|
357
351
|
}
|
|
358
352
|
|
|
@@ -364,21 +358,20 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
|
364
358
|
|
|
365
359
|
const response = await client.mutate({
|
|
366
360
|
mutation: gql`
|
|
367
|
-
mutation bulkAddReleaseGoods($rawReleaseGoods: [
|
|
361
|
+
mutation bulkAddReleaseGoods($rawReleaseGoods: [NewReleaseGood!], $bizplaceId: String!) {
|
|
368
362
|
bulkAddReleaseGoods(rawReleaseGoods: $rawReleaseGoods, bizplaceId: $bizplaceId) {
|
|
369
|
-
|
|
370
|
-
name
|
|
371
|
-
}
|
|
363
|
+
name
|
|
372
364
|
}
|
|
373
365
|
}
|
|
374
366
|
`,
|
|
375
367
|
variables: {
|
|
376
368
|
rawReleaseGoods: this.records.map(x => {
|
|
369
|
+
// list out all properties again to avoid additional props added by user in excel
|
|
377
370
|
return {
|
|
378
371
|
refNo: x.refNo,
|
|
379
372
|
refNo2: x.refNo2,
|
|
380
373
|
refNo3: x.refNo3,
|
|
381
|
-
releaseDate:
|
|
374
|
+
releaseDate: x.releaseDate,
|
|
382
375
|
deliveryAddress1: x.deliveryAddress1,
|
|
383
376
|
deliveryAddress2: x.deliveryAddress2,
|
|
384
377
|
deliveryAddress3: x.deliveryAddress3,
|
|
@@ -394,40 +387,37 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
|
|
|
394
387
|
uom: x.uom,
|
|
395
388
|
releaseQty: x.releaseQty,
|
|
396
389
|
postalCode: String(x.postalCode),
|
|
397
|
-
phone1: String(x.phone1)
|
|
390
|
+
phone1: String(x.phone1),
|
|
391
|
+
exportOption: false
|
|
398
392
|
}
|
|
399
393
|
}),
|
|
400
394
|
bizplaceId: this.bizplaceId
|
|
401
395
|
}
|
|
402
396
|
})
|
|
403
397
|
|
|
404
|
-
this.dataGrist.hideSpinner()
|
|
405
|
-
await sleep(1)
|
|
406
|
-
|
|
407
398
|
if (!response.errors) {
|
|
408
399
|
this._showToast({ message: i18next.t('text.release_order_created') })
|
|
409
400
|
history.back()
|
|
401
|
+
} else {
|
|
402
|
+
let insufficientStockError = response.errors.find(err => err.extensions.exception.errorCode == 'ins1')
|
|
403
|
+
if (insufficientStockError) {
|
|
404
|
+
// if system suddenly found that any item is insufficient,
|
|
405
|
+
// display the available items again.
|
|
406
|
+
await this._getAvailableItems(this.records)
|
|
407
|
+
this._showToast({ message: i18next.t('text.please_recheck_your_request_data') })
|
|
408
|
+
}
|
|
410
409
|
}
|
|
411
410
|
} catch (e) {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
// display the available items again.
|
|
416
|
-
await this._getAvailableItems(this.records)
|
|
417
|
-
this._showToast({ message: i18next.t('text.please_recheck_your_request_data') })
|
|
418
|
-
} else this._showToast(e)
|
|
411
|
+
this._showToast(e)
|
|
412
|
+
} finally {
|
|
413
|
+
this.dataGrist.hideSpinner()
|
|
419
414
|
}
|
|
420
415
|
}
|
|
421
416
|
|
|
422
417
|
_validateReleaseOrders() {
|
|
423
|
-
if (this.records.some(record =>
|
|
424
|
-
throw new Error(i18next.t('text.
|
|
425
|
-
|
|
426
|
-
if (this.records.some(record => !record.releaseDate || record?.releaseDate == ''))
|
|
427
|
-
throw new Error(i18next.t('text.release_date_is_required'))
|
|
428
|
-
|
|
429
|
-
if (this.records.some(record => !record.releaseQty || record.releaseQty > record.assignedQty))
|
|
430
|
-
throw new Error(i18next.t('text.invalid_release_qty'))
|
|
418
|
+
if (this.records.some(record => record.errorMsg && record.errorMsg != '')) {
|
|
419
|
+
throw new Error(i18next.t('text.please_recheck_your_request_data'))
|
|
420
|
+
}
|
|
431
421
|
}
|
|
432
422
|
|
|
433
423
|
_showToast({ type, message }) {
|