@things-factory/operato-wms 4.1.41 → 4.2.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/.eslintrc.json +11 -0
- package/client/pages/constants/index.js +1 -0
- package/client/pages/constants/inventory-item-change.js +10 -0
- package/client/pages/constants/order.js +5 -0
- package/client/pages/constants/picking-strategy.js +4 -0
- package/client/pages/constants/setting.js +1 -0
- package/client/pages/inbound/serial-number-list-popup.js +0 -1
- package/client/pages/inventory/inventory-adjustment-approval.js +34 -3
- package/client/pages/inventory/inventory-adjustment.js +144 -5
- package/client/pages/inventory/serial-number-list-popup.js +468 -0
- package/client/pages/master/pallet-list.js +24 -0
- package/client/pages/order/arrival-notice/edit-product-popup.js +13 -0
- package/client/pages/order/release-order/b2b/b2b-order-list.js +24 -1
- package/client/pages/order/release-order/batch-picking-popup.js +8 -0
- package/client/pages/outbound/inventory-assign-popup.js +3 -24
- package/client/pages/outbound/inventory-auto-assign-popup.js +25 -50
- package/client/pages/outbound/loading-product.js +3 -3
- package/client/pages/outbound/merged-outbound-worksheet.js +83 -16
- package/client/pages/outbound/packing-product.js +109 -9
- package/client/pages/outbound/picking-product.js +21 -8
- package/client/pages/outbound/picking-replacement-popup.js +5 -0
- package/client/pages/outbound/return-pallet-check-popup.js +7 -1
- package/client/pages/outbound/route-label-popup.js +464 -0
- package/client/pages/outbound/serial-number-popup.js +55 -26
- package/client/pages/outbound/single-outbound-worksheet.js +78 -11
- package/client/pages/outbound/sorting-product.js +125 -34
- package/client/pages/outbound/worksheet-batch-picking.js +3 -15
- package/client/pages/outbound/worksheet-picking.js +2 -6
- package/cypress/fixtures/globals.json +3 -0
- package/cypress/fixtures/master-data/location.json +31 -0
- package/cypress/fixtures/master-data/pallet.json +129 -0
- package/cypress/fixtures/master-data/palletImport.xlsx +0 -0
- package/cypress/fixtures/master-data/transport-driver.json +22 -0
- package/cypress/fixtures/master-data/transport-vehicle.json +24 -0
- package/cypress/fixtures/master-data/transportDriverDeletedImport.xlsx +0 -0
- package/cypress/fixtures/master-data/transportDriverImport.xlsx +0 -0
- package/cypress/fixtures/master-data/transportVehicleDeletedImport.xlsx +0 -0
- package/cypress/fixtures/master-data/transportVehicleImport.xlsx +0 -0
- package/cypress/fixtures/master-data/transportVehicleNameSizeImport.xlsx +0 -0
- package/cypress/fixtures/master-data/transportVehicleNameStatusImport.xlsx +0 -0
- package/cypress/fixtures/master-data/warehouse.json +20 -0
- package/cypress/fixtures/master-data/warehouseImport.xlsx +0 -0
- package/cypress/integration/master-data/location.spec.js +31 -0
- package/cypress/integration/master-data/pallet.spec.js +176 -0
- package/cypress/integration/master-data/transport-driver.spec.js +131 -0
- package/cypress/integration/master-data/transport-vehicle.spec.js +165 -0
- package/cypress/integration/master-data/warehouse.spec.js +135 -0
- package/cypress/plugins/index.js +22 -0
- package/cypress/support/commands.js +425 -0
- package/cypress/support/index.js +31 -0
- package/cypress.json +9 -0
- package/dist-server/graphql/resolvers/board-setting/board-settings.js +2 -1
- package/dist-server/graphql/resolvers/board-setting/board-settings.js.map +1 -1
- package/dist-server/opa-app-setting-constants.js +2 -1
- package/dist-server/opa-app-setting-constants.js.map +1 -1
- package/package.json +20 -10
- package/server/graphql/resolvers/board-setting/board-settings.ts +4 -2
- package/server/opa-app-setting-constants.ts +2 -1
- package/translations/en.json +13 -4
- package/translations/ko.json +12 -2
- package/translations/ms.json +11 -2
- package/translations/zh.json +11 -2
|
@@ -9,7 +9,7 @@ import { i18next, localize } from '@things-factory/i18n-base'
|
|
|
9
9
|
import { client, CustomAlert } from '@things-factory/shell'
|
|
10
10
|
import { isMobileDevice } from '@things-factory/utils'
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { WORKSHEET_TYPE } from '../constants'
|
|
13
13
|
|
|
14
14
|
class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
|
|
15
15
|
static get properties() {
|
|
@@ -58,24 +58,6 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
|
|
|
58
58
|
|
|
59
59
|
render() {
|
|
60
60
|
return html`
|
|
61
|
-
<form id="input-form" class="multi-column-form">
|
|
62
|
-
<fieldset>
|
|
63
|
-
<legend>${i18next.t('title.picking_strategy')}</legend>
|
|
64
|
-
${PICKING_STRATEGY.map(
|
|
65
|
-
(strategy, idx) => html`
|
|
66
|
-
<input
|
|
67
|
-
id="picking-strategy-${idx}"
|
|
68
|
-
type="radio"
|
|
69
|
-
name="pickingStrategy"
|
|
70
|
-
value="${strategy.value}"
|
|
71
|
-
?checked="${idx === 0}"
|
|
72
|
-
/>
|
|
73
|
-
<label for="picking-strategy-${idx}">${i18next.t(strategy.name)}</label>
|
|
74
|
-
`
|
|
75
|
-
)}
|
|
76
|
-
</fieldset>
|
|
77
|
-
</form>
|
|
78
|
-
|
|
79
61
|
<div class="grist">
|
|
80
62
|
<data-grist
|
|
81
63
|
id="grist"
|
|
@@ -95,11 +77,6 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
|
|
|
95
77
|
`
|
|
96
78
|
}
|
|
97
79
|
|
|
98
|
-
get selectedStrategy() {
|
|
99
|
-
return Array.from(this.shadowRoot.querySelectorAll('input[name=pickingStrategy]')).find(input => input.checked)
|
|
100
|
-
.value
|
|
101
|
-
}
|
|
102
|
-
|
|
103
80
|
get grist() {
|
|
104
81
|
return this.shadowRoot.querySelector('data-grist')
|
|
105
82
|
}
|
|
@@ -207,11 +184,11 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
|
|
|
207
184
|
//// Note: Picking and Batch picking has been moved to server side processing.
|
|
208
185
|
switch (this.worksheetType) {
|
|
209
186
|
case WORKSHEET_TYPE.PICKING.value:
|
|
210
|
-
await this._pickingAssignItem(this.worksheetNo, bizplaceId[0], selectedItems
|
|
187
|
+
await this._pickingAssignItem(this.worksheetNo, bizplaceId[0], selectedItems)
|
|
211
188
|
break
|
|
212
189
|
|
|
213
190
|
case WORKSHEET_TYPE.BATCH_PICKING.value:
|
|
214
|
-
await this._batchPickingAssignItem(this.worksheetId, bizplaceId[0], selectedItems
|
|
191
|
+
await this._batchPickingAssignItem(this.worksheetId, bizplaceId[0], selectedItems)
|
|
215
192
|
break
|
|
216
193
|
}
|
|
217
194
|
|
|
@@ -228,19 +205,17 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
|
|
|
228
205
|
}
|
|
229
206
|
}
|
|
230
207
|
|
|
231
|
-
async _pickingAssignItem(worksheetNo, bizplaceId, selectedItems
|
|
208
|
+
async _pickingAssignItem(worksheetNo, bizplaceId, selectedItems) {
|
|
232
209
|
await client.mutate({
|
|
233
210
|
mutation: gql`
|
|
234
211
|
mutation generatePickingWorksheetDetails(
|
|
235
212
|
$bizplaceId: String!
|
|
236
213
|
$selectedItems: [OrderInventoryPatch]!
|
|
237
|
-
$pickingStrategy: String!
|
|
238
214
|
$worksheetNo: String!
|
|
239
215
|
) {
|
|
240
216
|
generatePickingWorksheetDetails(
|
|
241
217
|
bizplaceId: $bizplaceId
|
|
242
218
|
selectedItems: $selectedItems
|
|
243
|
-
pickingStrategy: $pickingStrategy
|
|
244
219
|
worksheetNo: $worksheetNo
|
|
245
220
|
)
|
|
246
221
|
}
|
|
@@ -256,29 +231,15 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
|
|
|
256
231
|
productId: item.product.id,
|
|
257
232
|
uom: item.uom,
|
|
258
233
|
releaseQty: item.releaseQty,
|
|
259
|
-
releaseUomValue: item.releaseUomValue
|
|
234
|
+
releaseUomValue: item.releaseUomValue,
|
|
235
|
+
pickingStrategy: item.product.pickingStrategy
|
|
260
236
|
}
|
|
261
|
-
})
|
|
262
|
-
pickingStrategy
|
|
237
|
+
})
|
|
263
238
|
}
|
|
264
239
|
})
|
|
265
240
|
}
|
|
266
241
|
|
|
267
|
-
|
|
268
|
-
async _batchPickingAssignItem(worksheetId, bizplaceId, selectedItems, pickingStrategy) {
|
|
269
|
-
selectedItems = selectedItems.map(itm => {
|
|
270
|
-
return {
|
|
271
|
-
batchId: itm.batchId,
|
|
272
|
-
productId: itm.product.id,
|
|
273
|
-
packingType: itm.packingType,
|
|
274
|
-
packingSize: itm.packingSize,
|
|
275
|
-
uom: itm.uom,
|
|
276
|
-
releaseQty: itm.releaseQty,
|
|
277
|
-
releaseUomValue: itm.releaseUomValue,
|
|
278
|
-
extraJsonData: JSON.stringify(itm.extraJsonData)
|
|
279
|
-
}
|
|
280
|
-
})
|
|
281
|
-
|
|
242
|
+
async _batchPickingAssignItem(worksheetId, bizplaceId, selectedItems) {
|
|
282
243
|
try {
|
|
283
244
|
await client.mutate({
|
|
284
245
|
mutation: gql`
|
|
@@ -286,17 +247,31 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
|
|
|
286
247
|
$worksheetId: String!
|
|
287
248
|
$bizplaceId: String!
|
|
288
249
|
$selectedItems: [OrderInventoryPatch]!
|
|
289
|
-
$pickingStrategy: String!
|
|
290
250
|
) {
|
|
291
251
|
generateBatchPickingWorksheetDetailsByBulk(
|
|
292
252
|
worksheetId: $worksheetId
|
|
293
253
|
bizplaceId: $bizplaceId
|
|
294
254
|
selectedItems: $selectedItems
|
|
295
|
-
pickingStrategy: $pickingStrategy
|
|
296
255
|
)
|
|
297
256
|
}
|
|
298
257
|
`,
|
|
299
|
-
variables: {
|
|
258
|
+
variables: {
|
|
259
|
+
worksheetId,
|
|
260
|
+
bizplaceId,
|
|
261
|
+
selectedItems: selectedItems.map(itm => {
|
|
262
|
+
return {
|
|
263
|
+
batchId: itm.batchId,
|
|
264
|
+
productId: itm.product.id,
|
|
265
|
+
packingType: itm.packingType,
|
|
266
|
+
packingSize: itm.packingSize,
|
|
267
|
+
uom: itm.uom,
|
|
268
|
+
pickingStrategy: itm.product.pickingStrategy,
|
|
269
|
+
releaseQty: itm.releaseQty,
|
|
270
|
+
releaseUomValue: itm.releaseUomValue,
|
|
271
|
+
extraJsonData: JSON.stringify(itm.extraJsonData)
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
}
|
|
300
275
|
})
|
|
301
276
|
} catch (e) {
|
|
302
277
|
this._showToast(e)
|
|
@@ -183,7 +183,7 @@ class LoadingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
183
183
|
if (this.releaseGoodNoInput.value) {
|
|
184
184
|
this._clearView()
|
|
185
185
|
await this._fetchLoadingWorksheet(this.releaseGoodNoInput.value)
|
|
186
|
-
await this._fetchDeliveryOrders(this.
|
|
186
|
+
await this._fetchDeliveryOrders(this._releaseGoodNo)
|
|
187
187
|
if (!this._ownCollection) {
|
|
188
188
|
await this._fetchTransportVehicle()
|
|
189
189
|
}
|
|
@@ -655,7 +655,7 @@ class LoadingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
655
655
|
if (!response.errors) {
|
|
656
656
|
this._clearView()
|
|
657
657
|
await this._fetchLoadingWorksheet(this.releaseGoodNoInput.value)
|
|
658
|
-
await this._fetchDeliveryOrders(this.
|
|
658
|
+
await this._fetchDeliveryOrders(this._releaseGoodNo)
|
|
659
659
|
}
|
|
660
660
|
} catch (e) {
|
|
661
661
|
this._showToast(e)
|
|
@@ -701,7 +701,7 @@ class LoadingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
701
701
|
async _fetchTransportVehicle() {
|
|
702
702
|
const response = await client.query({
|
|
703
703
|
query: gql`
|
|
704
|
-
query($filters: [Filter!]) {
|
|
704
|
+
query transportVehicles($filters: [Filter!]) {
|
|
705
705
|
transportVehicles(filters: $filters) {
|
|
706
706
|
items {
|
|
707
707
|
id
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import '@things-factory/form-ui'
|
|
2
2
|
import '@things-factory/grist-ui'
|
|
3
|
+
import './route-label-popup'
|
|
3
4
|
import './select-operator-popup'
|
|
4
5
|
|
|
5
6
|
import gql from 'graphql-tag'
|
|
6
7
|
import { css, html } from 'lit-element'
|
|
7
|
-
import { openPopup } from '@things-factory/layout-base'
|
|
8
8
|
|
|
9
9
|
import { getCodeByName } from '@things-factory/code-base'
|
|
10
10
|
import { i18next, localize } from '@things-factory/i18n-base'
|
|
11
11
|
import { client, navigate, PageView } from '@things-factory/shell'
|
|
12
|
-
import { ScrollbarStyles,CommonButtonStyles } from '@things-factory/styles'
|
|
12
|
+
import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
|
|
13
13
|
import { isMobileDevice } from '@things-factory/utils'
|
|
14
|
+
import { openPopup } from '@things-factory/layout-base'
|
|
15
|
+
|
|
16
|
+
import { fetchSettingRule } from '../../fetch-setting-value'
|
|
14
17
|
|
|
15
18
|
import { WORKSHEET_TYPE } from '../constants'
|
|
16
19
|
|
|
@@ -38,7 +41,9 @@ class MergedOutboundWorksheet extends localize(i18next)(PageView) {
|
|
|
38
41
|
|
|
39
42
|
static get properties() {
|
|
40
43
|
return {
|
|
44
|
+
_partnersList: Array,
|
|
41
45
|
_searchFields: Array,
|
|
46
|
+
_routeLabelSetting: Boolean,
|
|
42
47
|
config: Object,
|
|
43
48
|
data: Object,
|
|
44
49
|
assignee: String,
|
|
@@ -59,20 +64,29 @@ class MergedOutboundWorksheet extends localize(i18next)(PageView) {
|
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
get context() {
|
|
67
|
+
var actions = []
|
|
68
|
+
if (this._routeLabelSetting) {
|
|
69
|
+
actions.push({
|
|
70
|
+
title: i18next.t('button.print_route_label'),
|
|
71
|
+
action: this._openPrintLabelPopup.bind(this),
|
|
72
|
+
...CommonButtonStyles.label
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
actions.push({
|
|
77
|
+
title: i18next.t('button.assign_picker'),
|
|
78
|
+
action: this._assignPicker.bind(this),
|
|
79
|
+
...CommonButtonStyles.activate
|
|
80
|
+
})
|
|
81
|
+
|
|
62
82
|
return {
|
|
63
83
|
title: i18next.t('title.merged_outbound_worksheet'),
|
|
64
84
|
exportable: {
|
|
65
85
|
name: i18next.t('title.merged_outbound_worksheet'),
|
|
66
86
|
data: this._exportableData.bind(this)
|
|
67
87
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
title: i18next.t('button.assign_picker'),
|
|
71
|
-
action: this._assignPicker.bind(this),
|
|
72
|
-
...CommonButtonStyles.activate
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
help: 'operato-wms/outbound/merged-outbound-worksheet'
|
|
88
|
+
help: 'operato-wms/outbound/merged-outbound-worksheet',
|
|
89
|
+
actions
|
|
76
90
|
}
|
|
77
91
|
}
|
|
78
92
|
|
|
@@ -319,7 +333,7 @@ class MergedOutboundWorksheet extends localize(i18next)(PageView) {
|
|
|
319
333
|
id
|
|
320
334
|
name
|
|
321
335
|
taskNo
|
|
322
|
-
assignee{
|
|
336
|
+
assignee {
|
|
323
337
|
id
|
|
324
338
|
name
|
|
325
339
|
}
|
|
@@ -337,6 +351,10 @@ class MergedOutboundWorksheet extends localize(i18next)(PageView) {
|
|
|
337
351
|
name
|
|
338
352
|
description
|
|
339
353
|
}
|
|
354
|
+
domain {
|
|
355
|
+
id
|
|
356
|
+
name
|
|
357
|
+
}
|
|
340
358
|
}
|
|
341
359
|
total
|
|
342
360
|
}
|
|
@@ -346,6 +364,9 @@ class MergedOutboundWorksheet extends localize(i18next)(PageView) {
|
|
|
346
364
|
})
|
|
347
365
|
|
|
348
366
|
if (!response.errors) {
|
|
367
|
+
let domain = response.data.worksheets.items[0]?.domain
|
|
368
|
+
this._routeLabelSetting = await fetchSettingRule('enable-print-route-label', domain.id)
|
|
369
|
+
this.updateContext()
|
|
349
370
|
return {
|
|
350
371
|
total: response.data.worksheets.total || 0,
|
|
351
372
|
records: response.data.worksheets.items || []
|
|
@@ -367,6 +388,10 @@ class MergedOutboundWorksheet extends localize(i18next)(PageView) {
|
|
|
367
388
|
id
|
|
368
389
|
name
|
|
369
390
|
description
|
|
391
|
+
domain {
|
|
392
|
+
id
|
|
393
|
+
name
|
|
394
|
+
}
|
|
370
395
|
}
|
|
371
396
|
}
|
|
372
397
|
}
|
|
@@ -375,10 +400,40 @@ class MergedOutboundWorksheet extends localize(i18next)(PageView) {
|
|
|
375
400
|
})
|
|
376
401
|
|
|
377
402
|
if (!response.errors) {
|
|
403
|
+
this._partnersList = response.data.partnersBizplaces
|
|
378
404
|
return response.data.partnersBizplaces.items
|
|
379
405
|
}
|
|
380
406
|
}
|
|
381
407
|
|
|
408
|
+
async _openPrintLabelPopup() {
|
|
409
|
+
try {
|
|
410
|
+
const bizplaceFilters = (await this.searchForm.getQueryFilters()).find(x => x.name === 'bizplaceId')
|
|
411
|
+
if (!bizplaceFilters) {
|
|
412
|
+
throw new Error(`Please select a customer to print route label.`)
|
|
413
|
+
} else {
|
|
414
|
+
let selectedPartnerDomain = this._partnersList.items.find(itm => itm.id == bizplaceFilters.value)
|
|
415
|
+
let partnerRouteLabelSetting = await fetchSettingRule(
|
|
416
|
+
'enable-print-route-label',
|
|
417
|
+
selectedPartnerDomain.domain.id
|
|
418
|
+
)
|
|
419
|
+
if (partnerRouteLabelSetting == false) throw new Error(`Partner setting not found`)
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
openPopup(
|
|
423
|
+
html`
|
|
424
|
+
<route-label-popup .partnerId="${bizplaceFilters.value}" .worksheetType="${'merged'}"></route-label-popup>
|
|
425
|
+
`,
|
|
426
|
+
{
|
|
427
|
+
backdrop: true,
|
|
428
|
+
size: 'large',
|
|
429
|
+
title: i18next.t('title.print_route_label')
|
|
430
|
+
}
|
|
431
|
+
)
|
|
432
|
+
} catch (e) {
|
|
433
|
+
this._showToast(e)
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
382
437
|
_modifyDateRange(e) {
|
|
383
438
|
const fromDate = e.currentTarget.value
|
|
384
439
|
|
|
@@ -428,10 +483,11 @@ class MergedOutboundWorksheet extends localize(i18next)(PageView) {
|
|
|
428
483
|
|
|
429
484
|
_assignPicker() {
|
|
430
485
|
try {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
486
|
+
let selectedData = this.dataGrist.selected.filter(item => {
|
|
487
|
+
return item.status == 'DEACTIVATED'
|
|
488
|
+
})
|
|
489
|
+
|
|
490
|
+
if (selectedData.length <= 0) throw new Error('No available worksheet selected')
|
|
435
491
|
|
|
436
492
|
openPopup(
|
|
437
493
|
html`
|
|
@@ -466,7 +522,7 @@ class MergedOutboundWorksheet extends localize(i18next)(PageView) {
|
|
|
466
522
|
size: 'medium',
|
|
467
523
|
title: 'select operator'
|
|
468
524
|
}
|
|
469
|
-
)
|
|
525
|
+
)
|
|
470
526
|
} catch (error) {
|
|
471
527
|
return this._showToast(error)
|
|
472
528
|
}
|
|
@@ -518,6 +574,17 @@ class MergedOutboundWorksheet extends localize(i18next)(PageView) {
|
|
|
518
574
|
|
|
519
575
|
return { header: headerSetting, data: data }
|
|
520
576
|
}
|
|
577
|
+
|
|
578
|
+
_showToast({ type, message }) {
|
|
579
|
+
document.dispatchEvent(
|
|
580
|
+
new CustomEvent('notify', {
|
|
581
|
+
detail: {
|
|
582
|
+
type,
|
|
583
|
+
message
|
|
584
|
+
}
|
|
585
|
+
})
|
|
586
|
+
)
|
|
587
|
+
}
|
|
521
588
|
}
|
|
522
589
|
|
|
523
590
|
window.customElements.define('merged-outbound-worksheet', MergedOutboundWorksheet)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@things-factory/barcode-ui'
|
|
2
2
|
import '@things-factory/grist-ui'
|
|
3
3
|
import '../components/worksheet-information-popup'
|
|
4
|
+
import './serial-number-popup'
|
|
4
5
|
|
|
5
6
|
import gql from 'graphql-tag'
|
|
6
7
|
import { css, html } from 'lit-element'
|
|
@@ -15,7 +16,7 @@ import { CommonButtonStyles } from '@things-factory/styles'
|
|
|
15
16
|
import { isMobileDevice } from '@things-factory/utils'
|
|
16
17
|
|
|
17
18
|
import { fetchSettingRule } from '../../fetch-setting-value'
|
|
18
|
-
import { PLATFORM, WORKSHEET_STATUS } from '../constants'
|
|
19
|
+
import { ORDER_SOURCES, PLATFORM, WORKSHEET_STATUS } from '../constants'
|
|
19
20
|
|
|
20
21
|
class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
21
22
|
static get properties() {
|
|
@@ -27,6 +28,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
27
28
|
orderInformation: String,
|
|
28
29
|
platform: String,
|
|
29
30
|
releaseGoodNo: String,
|
|
31
|
+
releaseGoodId: String,
|
|
30
32
|
shippingProvider: String,
|
|
31
33
|
trackingNo: String,
|
|
32
34
|
_bizplaceName: String,
|
|
@@ -35,7 +37,9 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
35
37
|
_logisticsInitiated: Boolean,
|
|
36
38
|
_selectedTaskStatus: String,
|
|
37
39
|
_worksheetInfo: Object,
|
|
38
|
-
_scanning: Boolean
|
|
40
|
+
_scanning: Boolean,
|
|
41
|
+
_isRequireSerialNumberScanningOutbound: Boolean,
|
|
42
|
+
_isBatchPicking: Boolean
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
|
|
@@ -124,6 +128,14 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
124
128
|
})
|
|
125
129
|
}
|
|
126
130
|
|
|
131
|
+
if (this._selectedOrderInventory && this._isRequireSerialNumberScanningOutbound && this._isBatchPicking) {
|
|
132
|
+
actions.push({
|
|
133
|
+
title: i18next.t('button.serial_number'),
|
|
134
|
+
action: this.openSerialNumberPopup.bind(this),
|
|
135
|
+
...CommonButtonStyles.activate
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
127
139
|
if (this._selectedTaskStatus === 'EXECUTING') {
|
|
128
140
|
actions.push({
|
|
129
141
|
title: i18next.t('button.pack'),
|
|
@@ -177,6 +189,10 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
177
189
|
return this.shadowRoot.querySelector('input[name=packedQty]')
|
|
178
190
|
}
|
|
179
191
|
|
|
192
|
+
get serialInput() {
|
|
193
|
+
return this.shadowRoot.querySelector('barcode-scanable-input[name=serialNumber]')?.shadowRoot.querySelector('input')
|
|
194
|
+
}
|
|
195
|
+
|
|
180
196
|
get scannable() {
|
|
181
197
|
return this._selectedTaskStatus && this._selectedTaskStatus === WORKSHEET_STATUS.EXECUTING.value
|
|
182
198
|
}
|
|
@@ -193,6 +209,12 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
193
209
|
setTimeout(() => this.releaseQtyInput.focus(), 100)
|
|
194
210
|
}
|
|
195
211
|
|
|
212
|
+
_focusOnSerialInput() {
|
|
213
|
+
if (this.serialInput) {
|
|
214
|
+
setTimeout(() => this.serialInput.focus(), 50)
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
196
218
|
render() {
|
|
197
219
|
return html`
|
|
198
220
|
<form id="info-form" class="multi-column-form">
|
|
@@ -219,10 +241,18 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
219
241
|
${this._enableProductScanning
|
|
220
242
|
? html` <label>${i18next.t('label.product_barcode')}</label>
|
|
221
243
|
<barcode-scanable-input name="productBarcode" custom-input></barcode-scanable-input>`
|
|
244
|
+
: this._isRequireSerialNumberScanningOutbound && this._isBatchPicking
|
|
245
|
+
? ``
|
|
222
246
|
: html`
|
|
223
247
|
<label>${i18next.t('label.packed_qty')}</label>
|
|
224
248
|
<input type="number" min="1" name="packedQty" />
|
|
225
249
|
`}
|
|
250
|
+
${this._isRequireSerialNumberScanningOutbound && this._isBatchPicking
|
|
251
|
+
? html`
|
|
252
|
+
<label>${i18next.t('label.serial_number')}</label>
|
|
253
|
+
<barcode-scanable-input name="serialNumber" custom-input></barcode-scanable-input>
|
|
254
|
+
`
|
|
255
|
+
: ``}
|
|
226
256
|
</fieldset>
|
|
227
257
|
</form>
|
|
228
258
|
|
|
@@ -248,11 +278,14 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
248
278
|
super()
|
|
249
279
|
this.data = { records: [] }
|
|
250
280
|
this.releaseGoodNo = ''
|
|
281
|
+
this.releaseGoodId = ''
|
|
251
282
|
this._enableProductScanning = false
|
|
252
283
|
this._productName = ''
|
|
253
284
|
this._selectedOrderInventory = null
|
|
254
285
|
this._selectedTaskStatus = null
|
|
255
286
|
this._scanning = false
|
|
287
|
+
this._isRequireSerialNumberScanningOutbound = false
|
|
288
|
+
this._isBatchPicking = false
|
|
256
289
|
}
|
|
257
290
|
|
|
258
291
|
updated(changedProps) {
|
|
@@ -270,10 +303,13 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
270
303
|
if (data.records.length && record) {
|
|
271
304
|
this._selectedOrderInventory = record
|
|
272
305
|
this._selectedTaskStatus = record.status
|
|
306
|
+
this._isRequireSerialNumberScanningOutbound = record.product.isRequireSerialNumberScanningOutbound
|
|
273
307
|
|
|
274
308
|
if (this._enableProductScanning) this._focusOnProductBarcodeInput()
|
|
275
309
|
else this._focusOnReleaseQtyInput()
|
|
276
310
|
}
|
|
311
|
+
|
|
312
|
+
this.updateContext()
|
|
277
313
|
}
|
|
278
314
|
}
|
|
279
315
|
},
|
|
@@ -347,6 +383,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
347
383
|
packingWorksheet(releaseGoodNo: $releaseGoodNo) {
|
|
348
384
|
worksheetInfo {
|
|
349
385
|
releaseGood {
|
|
386
|
+
id
|
|
350
387
|
name
|
|
351
388
|
}
|
|
352
389
|
bizplaceName
|
|
@@ -379,13 +416,17 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
379
416
|
}
|
|
380
417
|
worksheetDetailInfos {
|
|
381
418
|
name
|
|
419
|
+
palletId
|
|
420
|
+
cartonId
|
|
382
421
|
batchId
|
|
383
422
|
batchIdRef
|
|
384
423
|
sku
|
|
385
424
|
product {
|
|
425
|
+
id
|
|
386
426
|
name
|
|
387
427
|
description
|
|
388
428
|
gtin
|
|
429
|
+
isRequireSerialNumberScanningOutbound
|
|
389
430
|
productDetails {
|
|
390
431
|
id
|
|
391
432
|
packingType
|
|
@@ -407,10 +448,13 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
407
448
|
batchId
|
|
408
449
|
batchIdRef
|
|
409
450
|
packingType
|
|
451
|
+
refWorksheetId
|
|
410
452
|
product {
|
|
453
|
+
id
|
|
411
454
|
sku
|
|
412
455
|
name
|
|
413
456
|
description
|
|
457
|
+
isRequireSerialNumberScanningOutbound
|
|
414
458
|
}
|
|
415
459
|
}
|
|
416
460
|
}
|
|
@@ -422,6 +466,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
422
466
|
|
|
423
467
|
if (!response.errors) {
|
|
424
468
|
this.releaseGoodNo = response.data.packingWorksheet.worksheetInfo.releaseGood.name
|
|
469
|
+
this.releaseGoodId = response.data.packingWorksheet.worksheetInfo.releaseGood.id
|
|
425
470
|
if (!response.data?.packingWorksheet) return
|
|
426
471
|
|
|
427
472
|
const { worksheetInfo, worksheetDetailInfos } = response.data.packingWorksheet
|
|
@@ -435,6 +480,8 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
435
480
|
this.shippingProvider = worksheetInfo.shippingProvider
|
|
436
481
|
this.orderInformation = worksheetInfo.marketplaceOrder
|
|
437
482
|
|
|
483
|
+
this._isBatchPicking = worksheetDetailInfos[0].relatedOrderInv?.refWorksheetId ? true : false
|
|
484
|
+
|
|
438
485
|
this._bizplaceName = worksheetInfo.bizplaceName
|
|
439
486
|
this._worksheetInfo = worksheetInfo
|
|
440
487
|
|
|
@@ -445,6 +492,10 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
445
492
|
this._selectedTaskStatus = null
|
|
446
493
|
this.inputForm.reset()
|
|
447
494
|
}
|
|
495
|
+
} else {
|
|
496
|
+
this._selectedOrderInventory = worksheetDetailInfos[0]
|
|
497
|
+
this._isRequireSerialNumberScanningOutbound =
|
|
498
|
+
worksheetDetailInfos[0].product?.isRequireSerialNumberScanningOutbound
|
|
448
499
|
}
|
|
449
500
|
|
|
450
501
|
this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
|
|
@@ -637,10 +688,15 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
637
688
|
this._selectedOrderInventory = null
|
|
638
689
|
}
|
|
639
690
|
|
|
691
|
+
if (this._isRequireSerialNumberScanningOutbound && this._isBatchPicking) {
|
|
692
|
+
this.serialInput.value = ''
|
|
693
|
+
}
|
|
694
|
+
|
|
640
695
|
this._fetchInventories(this.releaseGoodNo)
|
|
641
696
|
}
|
|
642
697
|
} catch (e) {
|
|
643
|
-
if (this.
|
|
698
|
+
if (this._isRequireSerialNumberScanningOutbound && this._isBatchPicking) this.serialInput.value = ''
|
|
699
|
+
else if (this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound) {
|
|
644
700
|
this.productBarcodeInput.value = ''
|
|
645
701
|
this._focusOnProductBarcodeInput()
|
|
646
702
|
} else {
|
|
@@ -661,13 +717,19 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
661
717
|
this._scanning = true
|
|
662
718
|
return await client.mutate({
|
|
663
719
|
mutation: gql`
|
|
664
|
-
mutation scanProductPacking($worksheetDetailName: String!, $productBarcode: String
|
|
665
|
-
scanProductPacking(
|
|
720
|
+
mutation scanProductPacking($worksheetDetailName: String!, $productBarcode: String!, $serialNumber: String) {
|
|
721
|
+
scanProductPacking(
|
|
722
|
+
worksheetDetailName: $worksheetDetailName
|
|
723
|
+
productBarcode: $productBarcode
|
|
724
|
+
serialNumber: $serialNumber
|
|
725
|
+
)
|
|
666
726
|
}
|
|
667
727
|
`,
|
|
668
728
|
variables: {
|
|
669
729
|
worksheetDetailName: this._selectedOrderInventory.name,
|
|
670
|
-
productBarcode: this.productBarcodeInput.value.trim()
|
|
730
|
+
productBarcode: this.productBarcodeInput.value.trim(),
|
|
731
|
+
serialNumber:
|
|
732
|
+
this._isRequireSerialNumberScanningOutbound && this._isBatchPicking ? this.serialInput.value.trim() : null
|
|
671
733
|
}
|
|
672
734
|
})
|
|
673
735
|
}
|
|
@@ -677,13 +739,18 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
677
739
|
this._scanning = true
|
|
678
740
|
return await client.mutate({
|
|
679
741
|
mutation: gql`
|
|
680
|
-
mutation packing($worksheetDetailName: String!, $releaseQty: Int
|
|
681
|
-
packing(worksheetDetailName: $worksheetDetailName, releaseQty: $releaseQty)
|
|
742
|
+
mutation packing($worksheetDetailName: String!, $releaseQty: Int!, $serialNumber: String) {
|
|
743
|
+
packing(worksheetDetailName: $worksheetDetailName, releaseQty: $releaseQty, serialNumber: $serialNumber)
|
|
682
744
|
}
|
|
683
745
|
`,
|
|
684
746
|
variables: {
|
|
685
747
|
worksheetDetailName: this._selectedOrderInventory.name,
|
|
686
|
-
releaseQty:
|
|
748
|
+
releaseQty:
|
|
749
|
+
this._isRequireSerialNumberScanningOutbound && this._isBatchPicking
|
|
750
|
+
? 1
|
|
751
|
+
: parseInt(this.releaseQtyInput.value),
|
|
752
|
+
serialNumber:
|
|
753
|
+
this._isRequireSerialNumberScanningOutbound && this._isBatchPicking ? this.serialInput.value.trim() : null
|
|
687
754
|
}
|
|
688
755
|
})
|
|
689
756
|
}
|
|
@@ -734,6 +801,13 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
734
801
|
throw new Error(i18next.t('text.wrong_release_qty'))
|
|
735
802
|
}
|
|
736
803
|
}
|
|
804
|
+
|
|
805
|
+
if (this._isRequireSerialNumberScanningOutbound && this._isBatchPicking) {
|
|
806
|
+
if (!this.serialInput?.value) {
|
|
807
|
+
this._focusOnSerialInput()
|
|
808
|
+
throw new Error(i18next.t('text.empty_serial_number'))
|
|
809
|
+
}
|
|
810
|
+
}
|
|
737
811
|
}
|
|
738
812
|
|
|
739
813
|
async _complete() {
|
|
@@ -770,6 +844,32 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
770
844
|
)
|
|
771
845
|
}
|
|
772
846
|
|
|
847
|
+
openSerialNumberPopup() {
|
|
848
|
+
openPopup(
|
|
849
|
+
html`
|
|
850
|
+
<serial-number-popup
|
|
851
|
+
.enableRemove=${false}
|
|
852
|
+
.enableUpdateBtn=${false}
|
|
853
|
+
.orderInventory="${this?._selectedOrderInventory?.relatedOrderInv}"
|
|
854
|
+
.orderType="${i18next.t('text.outbound')}"
|
|
855
|
+
.orderSource="${ORDER_SOURCES.PACKING.value}"
|
|
856
|
+
.orderId="${this.releaseGoodId}"
|
|
857
|
+
.data="${this?._selectedOrderInventory}"
|
|
858
|
+
@close-serial-number-popup="${async e => {
|
|
859
|
+
await this._fetchInventories(this.releaseGoodNo)
|
|
860
|
+
}}"
|
|
861
|
+
></serial-number-popup>
|
|
862
|
+
`,
|
|
863
|
+
{
|
|
864
|
+
closable: false,
|
|
865
|
+
backdrop: false,
|
|
866
|
+
escapable: false,
|
|
867
|
+
size: 'large',
|
|
868
|
+
title: i18next.t('title.serial_number_list')
|
|
869
|
+
}
|
|
870
|
+
)
|
|
871
|
+
}
|
|
872
|
+
|
|
773
873
|
async _setOrderToRTS() {
|
|
774
874
|
let result = await CustomAlert({
|
|
775
875
|
title: i18next.t('title.are_you_sure'),
|