@things-factory/operato-wms 4.3.512 → 4.3.514
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/pages/constants/order.js +9 -1
- package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +4 -1
- package/client/pages/order/release-order/b2b/b2b-order-list.js +71 -10
- package/client/pages/order/release-order/release-order-detail.js +266 -80
- package/client/pages/order/vas-order/popup/proceed-edit-vas-popup.js +549 -0
- package/client/pages/order/vas-order/popup/select-vas-popup.js +5 -1
- package/client/pages/order/vas-order/popup/vas-changes-popup.js +370 -0
- package/client/pages/report/order-vas-report.js +28 -5
- package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +1 -1
- package/dist-server/graphql/resolvers/reports/vas-report.js +40 -20
- package/dist-server/graphql/resolvers/reports/vas-report.js.map +1 -1
- package/dist-server/graphql/types/reports/vas-report.js +1 -0
- package/dist-server/graphql/types/reports/vas-report.js.map +1 -1
- package/helps/release-note.md +4 -4
- package/package.json +5 -5
- package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +1 -1
- package/server/graphql/resolvers/reports/vas-report.ts +44 -21
- package/server/graphql/types/reports/vas-report.ts +1 -0
- package/translations/en.json +24 -0
- package/translations/ko.json +24 -0
- package/translations/ms.json +24 -0
- package/translations/zh.json +24 -0
|
@@ -10,6 +10,8 @@ import '@things-factory/import-ui'
|
|
|
10
10
|
import '../../components/select-product-popup'
|
|
11
11
|
import '../../order/vas-order/popup/vas-target-product-popup'
|
|
12
12
|
import '../../order/vas-order/popup/select-vas-popup'
|
|
13
|
+
import '../../order/vas-order/popup/proceed-edit-vas-popup'
|
|
14
|
+
import '../../order/vas-order/popup/vas-changes-popup'
|
|
13
15
|
|
|
14
16
|
import gql from 'graphql-tag'
|
|
15
17
|
import { css, html } from 'lit-element'
|
|
@@ -26,6 +28,7 @@ import { isMobileDevice } from '@things-factory/utils'
|
|
|
26
28
|
import { fetchSettingRule } from '../../../fetch-setting-value'
|
|
27
29
|
import {
|
|
28
30
|
ORDER_STATUS,
|
|
31
|
+
ORDER_VAS_STATUS,
|
|
29
32
|
PICKING_STANDARD,
|
|
30
33
|
VAS_BATCH_AND_PRODUCT_TYPE,
|
|
31
34
|
VAS_BATCH_NO_TYPE,
|
|
@@ -916,14 +919,28 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
916
919
|
...CommonButtonStyles.edit
|
|
917
920
|
})
|
|
918
921
|
}
|
|
919
|
-
}
|
|
920
922
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
923
|
+
if (this.vasData.records.some( vas => vas.status === ORDER_VAS_STATUS.PENDING_APPROVE.value )) {
|
|
924
|
+
actions.push({
|
|
925
|
+
title: i18next.t('button.vas_changes'),
|
|
926
|
+
action: this._openVasChangesPopup.bind(this),
|
|
927
|
+
...CommonButtonStyles.inspect
|
|
928
|
+
})
|
|
929
|
+
} else if (this._editVasStatus.indexOf(this._status) >= 0) {
|
|
930
|
+
actions.push({
|
|
931
|
+
title: i18next.t('button.edit_vas'),
|
|
932
|
+
action: this.editVas.bind(this),
|
|
933
|
+
...CommonButtonStyles.edit
|
|
934
|
+
})
|
|
935
|
+
}
|
|
936
|
+
} else {
|
|
937
|
+
if (this.vasData.records.some( vas => vas.status === ORDER_VAS_STATUS.PENDING_APPROVE.value )) {
|
|
938
|
+
actions.push({
|
|
939
|
+
title: i18next.t('button.inspect_changes'),
|
|
940
|
+
action: this._openApproveVasChangesPopup.bind(this),
|
|
941
|
+
...CommonButtonStyles.inspect
|
|
942
|
+
})
|
|
943
|
+
}
|
|
927
944
|
}
|
|
928
945
|
|
|
929
946
|
if (this._status === ORDER_STATUS.PENDING.value) {
|
|
@@ -1223,7 +1240,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1223
1240
|
}
|
|
1224
1241
|
if (column.name === 'newBatchId') {
|
|
1225
1242
|
try {
|
|
1226
|
-
if (!record.newProductId) {
|
|
1243
|
+
if (!record.newProduct?.id && !record.newProductId) {
|
|
1227
1244
|
column.record.editable = false
|
|
1228
1245
|
throw new Error(i18next.t('text.new_sku_empty'))
|
|
1229
1246
|
} else {
|
|
@@ -1246,14 +1263,25 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1246
1263
|
handlers: {
|
|
1247
1264
|
click: (columns, data, column, record, rowIndex) => {
|
|
1248
1265
|
if (this._editVasStatus.indexOf(this._status) >= 0) {
|
|
1249
|
-
|
|
1266
|
+
if (record.id) {
|
|
1267
|
+
this.deletedVas.push({
|
|
1268
|
+
...record,
|
|
1269
|
+
editType: ORDER_VAS_STATUS.REMOVED.value,
|
|
1270
|
+
cuFlag: 'M'
|
|
1271
|
+
})
|
|
1272
|
+
} else {
|
|
1273
|
+
this.deletedVas.push({
|
|
1274
|
+
...record,
|
|
1275
|
+
itemEditType: ORDER_VAS_STATUS.REMOVED.value,
|
|
1276
|
+
cuFlag: 'M'
|
|
1277
|
+
})
|
|
1278
|
+
}
|
|
1250
1279
|
this.vasData = {
|
|
1251
1280
|
...this.vasData,
|
|
1252
1281
|
records: data.records.filter((rec, idx) =>
|
|
1253
1282
|
record.productSKU ? rec.group !== record.group : idx !== rowIndex
|
|
1254
1283
|
)
|
|
1255
1284
|
}
|
|
1256
|
-
const test = this.vasData
|
|
1257
1285
|
}
|
|
1258
1286
|
}
|
|
1259
1287
|
}
|
|
@@ -1322,7 +1350,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1322
1350
|
{
|
|
1323
1351
|
type: 'string',
|
|
1324
1352
|
name: 'newBatchId',
|
|
1325
|
-
header: i18next.t('field.
|
|
1353
|
+
header: i18next.t('field.batch_no_sku', { sku: 'New SKU' }),
|
|
1326
1354
|
record: { editable: true },
|
|
1327
1355
|
width: 150
|
|
1328
1356
|
},
|
|
@@ -1335,7 +1363,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1335
1363
|
{
|
|
1336
1364
|
type: 'code',
|
|
1337
1365
|
name: 'newPackingType',
|
|
1338
|
-
header: i18next.t('field.packing_type_sku', { sku: '
|
|
1366
|
+
header: i18next.t('field.packing_type_sku', { sku: 'New SKU' }),
|
|
1339
1367
|
record: {
|
|
1340
1368
|
editable: true,
|
|
1341
1369
|
codeName: 'PACKING_TYPES'
|
|
@@ -1345,21 +1373,21 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1345
1373
|
{
|
|
1346
1374
|
type: 'code',
|
|
1347
1375
|
name: 'newUom',
|
|
1348
|
-
header: i18next.t('field.uom_sku', { sku: '
|
|
1376
|
+
header: i18next.t('field.uom_sku', { sku: 'New SKU' }),
|
|
1349
1377
|
record: { editable: true, codeName: 'UOM' },
|
|
1350
1378
|
width: 80
|
|
1351
1379
|
},
|
|
1352
1380
|
{
|
|
1353
1381
|
type: 'float',
|
|
1354
1382
|
name: 'newUnitUomValue',
|
|
1355
|
-
header: i18next.t('field.uom_value_sku', { sku: '
|
|
1383
|
+
header: i18next.t('field.uom_value_sku', { sku: 'New SKU' }),
|
|
1356
1384
|
record: { editable: !this._strictProductSelection },
|
|
1357
1385
|
width: 150
|
|
1358
1386
|
},
|
|
1359
1387
|
{
|
|
1360
1388
|
type: 'float',
|
|
1361
1389
|
name: 'newUomValue',
|
|
1362
|
-
header: i18next.t('field.total_uom_value_sku', { sku: '
|
|
1390
|
+
header: i18next.t('field.total_uom_value_sku', { sku: 'New SKU' }),
|
|
1363
1391
|
record: { editable: !this._strictProductSelection, options: { min: 0 } },
|
|
1364
1392
|
width: 150
|
|
1365
1393
|
},
|
|
@@ -1524,8 +1552,10 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1524
1552
|
id
|
|
1525
1553
|
name
|
|
1526
1554
|
createdAt
|
|
1555
|
+
editType
|
|
1527
1556
|
orderVasItems {
|
|
1528
1557
|
id
|
|
1558
|
+
itemEditType
|
|
1529
1559
|
vas {
|
|
1530
1560
|
id
|
|
1531
1561
|
name
|
|
@@ -1534,25 +1564,45 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1534
1564
|
}
|
|
1535
1565
|
vasQty
|
|
1536
1566
|
vasRemark
|
|
1567
|
+
adjustedVasQty
|
|
1568
|
+
adjustedVasRemark
|
|
1537
1569
|
}
|
|
1538
1570
|
batchId
|
|
1571
|
+
adjustedBatchId
|
|
1539
1572
|
product {
|
|
1540
1573
|
id
|
|
1541
1574
|
name
|
|
1542
1575
|
description
|
|
1543
1576
|
sku
|
|
1544
1577
|
}
|
|
1578
|
+
adjustedProduct {
|
|
1579
|
+
id
|
|
1580
|
+
name
|
|
1581
|
+
description
|
|
1582
|
+
sku
|
|
1583
|
+
}
|
|
1545
1584
|
productDetail {
|
|
1546
1585
|
id
|
|
1547
1586
|
name
|
|
1548
1587
|
uom
|
|
1549
1588
|
}
|
|
1589
|
+
adjustedProductDetail {
|
|
1590
|
+
id
|
|
1591
|
+
name
|
|
1592
|
+
uom
|
|
1593
|
+
}
|
|
1550
1594
|
newProduct {
|
|
1551
1595
|
id
|
|
1552
1596
|
name
|
|
1553
1597
|
description
|
|
1554
1598
|
sku
|
|
1555
1599
|
}
|
|
1600
|
+
adjustedNewProduct {
|
|
1601
|
+
id
|
|
1602
|
+
name
|
|
1603
|
+
description
|
|
1604
|
+
sku
|
|
1605
|
+
}
|
|
1556
1606
|
newProductDetail {
|
|
1557
1607
|
id
|
|
1558
1608
|
name
|
|
@@ -1560,16 +1610,32 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1560
1610
|
uomValue
|
|
1561
1611
|
uom
|
|
1562
1612
|
}
|
|
1613
|
+
adjustedNewProductDetail {
|
|
1614
|
+
id
|
|
1615
|
+
name
|
|
1616
|
+
packingType
|
|
1617
|
+
uomValue
|
|
1618
|
+
uom
|
|
1619
|
+
}
|
|
1563
1620
|
productName
|
|
1564
1621
|
outputQty
|
|
1622
|
+
adjustedOutputQty
|
|
1565
1623
|
packingType
|
|
1624
|
+
adjustedPackingType
|
|
1566
1625
|
qty
|
|
1626
|
+
adjustedQty
|
|
1567
1627
|
uom
|
|
1628
|
+
adjustedUom
|
|
1568
1629
|
uomValue
|
|
1630
|
+
adjustedUomValue
|
|
1569
1631
|
newBatchId
|
|
1632
|
+
adjustedNewBatchId
|
|
1570
1633
|
newPackingType
|
|
1634
|
+
adjustedNewPackingType
|
|
1571
1635
|
newUom
|
|
1636
|
+
adjustedNewUom
|
|
1572
1637
|
newUomValue
|
|
1638
|
+
adjustedNewUomValue
|
|
1573
1639
|
description
|
|
1574
1640
|
remark
|
|
1575
1641
|
status
|
|
@@ -1733,12 +1799,19 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1733
1799
|
acc.push({
|
|
1734
1800
|
...orderVas,
|
|
1735
1801
|
productSKU: orderVas.product?.sku,
|
|
1802
|
+
adjustedSku: orderVas.adjustedProduct?.sku,
|
|
1736
1803
|
uom: orderVas.productDetail?.uom,
|
|
1804
|
+
adjustedUom: orderVas.adjustedProductDetail?.uom,
|
|
1737
1805
|
newSku: orderVas.newProduct?.sku,
|
|
1806
|
+
adjustedNewSku: orderVas.adjustedNewProduct?.sku,
|
|
1738
1807
|
newPackingType: orderVas?.newPackingType,
|
|
1808
|
+
adjustedNewPackingType: orderVas?.adjustedNewPackingType,
|
|
1739
1809
|
newUnitUomValue: calUnitUomValue(orderVas?.newUomValue, orderVas?.outputQty).toFixed(2),
|
|
1810
|
+
adjustedNewUnitUomValue: calUnitUomValue(orderVas?.adjustedNewUomValue, orderVas?.adjustedOutputQty).toFixed(2),
|
|
1740
1811
|
newUomValue: orderVas?.newUomValue,
|
|
1812
|
+
adjustedNewUomValue: orderVas?.adjustedNewUomValue,
|
|
1741
1813
|
newUom: orderVas?.newUom,
|
|
1814
|
+
adjustedNewUom: orderVas?.adjustedNewUom,
|
|
1742
1815
|
releaseQty: releaseQty
|
|
1743
1816
|
})
|
|
1744
1817
|
|
|
@@ -1755,8 +1828,11 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1755
1828
|
vasName: itm.vas.name,
|
|
1756
1829
|
type: itm.vas.type
|
|
1757
1830
|
},
|
|
1831
|
+
itemEditType: itm.itemEditType ? itm.itemEditType : orderVas.editType,
|
|
1758
1832
|
vasQty: itm.vasQty,
|
|
1759
|
-
vasRemark: itm.vasRemark
|
|
1833
|
+
vasRemark: itm.vasRemark,
|
|
1834
|
+
adjustedVasQty: itm.adjustedVasQty,
|
|
1835
|
+
adjustedVasRemark: itm.adjustedVasRemark
|
|
1760
1836
|
}
|
|
1761
1837
|
} else {
|
|
1762
1838
|
acc.push({
|
|
@@ -1769,8 +1845,11 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1769
1845
|
vasName: itm.vas.name,
|
|
1770
1846
|
type: itm.vas.type
|
|
1771
1847
|
},
|
|
1848
|
+
itemEditType: itm.itemEditType,
|
|
1772
1849
|
vasQty: itm.vasQty,
|
|
1773
|
-
vasRemark: itm.vasRemark
|
|
1850
|
+
vasRemark: itm.vasRemark,
|
|
1851
|
+
adjustedVasQty: itm.adjustedVasQty,
|
|
1852
|
+
adjustedVasRemark: itm.adjustedVasRemark
|
|
1774
1853
|
})
|
|
1775
1854
|
}
|
|
1776
1855
|
})
|
|
@@ -2226,7 +2305,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2226
2305
|
sku: d.productSKU,
|
|
2227
2306
|
maxQty: d.releaseQty,
|
|
2228
2307
|
uomValue: d.releaseUomValue / d.releaseQty,
|
|
2229
|
-
group: record.
|
|
2308
|
+
group: record.id ? record.group : ++group,
|
|
2230
2309
|
unitUomValue: d.unitUomValue,
|
|
2231
2310
|
packingSize: d.packingSize,
|
|
2232
2311
|
packingType: d.packingType,
|
|
@@ -2235,12 +2314,18 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2235
2314
|
productSKU: d.productSKU,
|
|
2236
2315
|
uom: d.uom,
|
|
2237
2316
|
status: record.status,
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2317
|
+
editType: record.id ? ORDER_VAS_STATUS.CHANGES.value : ORDER_VAS_STATUS.NEW.value,
|
|
2318
|
+
cuFlag: record.id ? 'M' : '+',
|
|
2319
|
+
__dirty__: record.id ? 'M' : '+',
|
|
2320
|
+
__dirtyfields__: record.__dirtyfields__
|
|
2321
|
+
? {
|
|
2322
|
+
...record.__dirtyfields__,
|
|
2323
|
+
productSKU: { before: record.productSKU, after: d.productSKU }
|
|
2324
|
+
}
|
|
2325
|
+
: {
|
|
2326
|
+
productSKU: { before: record.productSKU, after: d.productSKU }
|
|
2327
|
+
// qty: { before: record.qty, after: d.qty }
|
|
2328
|
+
}
|
|
2244
2329
|
|
|
2245
2330
|
// group: ++group
|
|
2246
2331
|
}
|
|
@@ -2297,9 +2382,15 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2297
2382
|
newUomValue: e.detail.uomValue,
|
|
2298
2383
|
newUnitUomValue: e.detail.uomValue,
|
|
2299
2384
|
newProductDetailId: e.detail.productDetailId,
|
|
2385
|
+
editType: ORDER_VAS_STATUS.CHANGES.value,
|
|
2300
2386
|
cuFlag: 'M',
|
|
2301
2387
|
__dirty__: 'M',
|
|
2302
|
-
__dirtyfields__:
|
|
2388
|
+
__dirtyfields__: record.__dirtyfields__
|
|
2389
|
+
? {
|
|
2390
|
+
...record.__dirtyfields__,
|
|
2391
|
+
newSku: { before: record.newSku, after: e.detail.product.sku }
|
|
2392
|
+
}
|
|
2393
|
+
: { newSku: { before: record.newSku, after: e.detail.product.sku } }
|
|
2303
2394
|
}
|
|
2304
2395
|
// for (let i = 0; i < e.detail.multipleProducts.length; i++) {
|
|
2305
2396
|
// newRecords.push(e.detail.multipleProducts[i])
|
|
@@ -2368,68 +2459,86 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2368
2459
|
let lastIndex = this.vasGrist.dirtyData.records.findLastIndex(oldData => oldData.group == record.group)
|
|
2369
2460
|
|
|
2370
2461
|
for (let i = 0; i < e.detail.length; i++) {
|
|
2371
|
-
let a = oldRecords.find(vb => vb.vas?.id === e.detail[i].id)
|
|
2462
|
+
let a = oldRecords.find(vb => vb.vas?.id === e.detail[i].id && vb.group === this.vasGrist.dirtyData.records[firstIndex].group)
|
|
2372
2463
|
if (i == 0) {
|
|
2373
2464
|
newRecords.push({
|
|
2374
2465
|
...this.vasGrist.dirtyData.records[firstIndex],
|
|
2375
|
-
id:
|
|
2466
|
+
id: a?.id ? a.id : this.vasGrist.dirtyData.records[firstIndex].id,
|
|
2376
2467
|
vas: {
|
|
2377
2468
|
...e.detail[i],
|
|
2378
2469
|
name: e.detail[i].name,
|
|
2379
2470
|
vasName: e.detail[i].name
|
|
2380
2471
|
},
|
|
2381
|
-
vasQty: a?.vasQty
|
|
2472
|
+
vasQty: a?.vasQty,
|
|
2382
2473
|
newBatchId: this.vasGrist.dirtyData.records[firstIndex].newBatchId,
|
|
2383
2474
|
newProduct: this.vasGrist.dirtyData.records[firstIndex].newProduct,
|
|
2384
2475
|
newProductDetail: this.vasGrist.dirtyData.records[firstIndex].newProductDetail,
|
|
2385
2476
|
newSku: this.vasGrist.dirtyData.records[firstIndex].newSku,
|
|
2386
2477
|
newUom: this.vasGrist.dirtyData.records[firstIndex].newUom,
|
|
2387
2478
|
newUomValue: this.vasGrist.dirtyData.records[firstIndex].newUomValue,
|
|
2388
|
-
vasRemark: a?.vasRemark
|
|
2389
|
-
|
|
2390
|
-
__dirty__: '+',
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2479
|
+
vasRemark: a?.vasRemark,
|
|
2480
|
+
itemEditType: a?.orderVasItemId ? (a.itemEditType || (a.__dirty__ ? ORDER_VAS_STATUS.CHANGES.value : undefined)) : ORDER_VAS_STATUS.NEW.value,
|
|
2481
|
+
cuFlag: a?.orderVasItemId ? (a.cuFlag || (a.__dirty__ ? 'M' : undefined)) : '+',
|
|
2482
|
+
__dirty__: a?.orderVasItemId ? a.__dirty__ ? a.__dirty__ : undefined : '+',
|
|
2483
|
+
__dirtyfields__: a?.__dirtyfields__
|
|
2484
|
+
? {
|
|
2485
|
+
...a.__dirtyfields__,
|
|
2486
|
+
productSKU: {
|
|
2487
|
+
before: this.vasGrist.dirtyData.records[firstIndex].productSKU,
|
|
2488
|
+
after: e.detail[i].productSKU
|
|
2489
|
+
},
|
|
2490
|
+
vas: { before: this.vasGrist.dirtyData.records[firstIndex].vas, after: e.detail[i] },
|
|
2491
|
+
vasQty: {
|
|
2492
|
+
before: 0,
|
|
2493
|
+
after: this.vasGrist.dirtyData.records[firstIndex].qty
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
: {
|
|
2497
|
+
productSKU: {
|
|
2498
|
+
before: this.vasGrist.dirtyData.records[firstIndex].productSKU,
|
|
2499
|
+
after: e.detail[i].productSKU
|
|
2500
|
+
},
|
|
2501
|
+
vas: { before: this.vasGrist.dirtyData.records[firstIndex].vas, after: e.detail[i] },
|
|
2502
|
+
vasQty: {
|
|
2503
|
+
before: 0,
|
|
2504
|
+
after: this.vasGrist.dirtyData.records[firstIndex].qty
|
|
2505
|
+
}
|
|
2400
2506
|
}
|
|
2401
|
-
}
|
|
2402
2507
|
})
|
|
2403
2508
|
} else {
|
|
2404
2509
|
newRecords.push({
|
|
2405
2510
|
group: this.vasGrist.dirtyData.records[firstIndex].group,
|
|
2406
|
-
vasQty:
|
|
2511
|
+
vasQty: a?.vasQty,
|
|
2407
2512
|
vas: {
|
|
2408
2513
|
...e.detail[i],
|
|
2409
2514
|
name: e.detail[i].name,
|
|
2410
2515
|
vasName: e.detail[i].name
|
|
2411
2516
|
},
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
__dirty__:
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2517
|
+
orderVasItemId: a?.orderVasItemId,
|
|
2518
|
+
vasRemark: a?.vasRemark,
|
|
2519
|
+
itemEditType: a?.orderVasItemId ? (a.itemEditType || (a.__dirty__ ? ORDER_VAS_STATUS.CHANGES.value : undefined)) : ORDER_VAS_STATUS.NEW.value,
|
|
2520
|
+
cuFlag: a?.orderVasItemId ? (a.cuFlag || (a.__dirty__ ? 'M' : undefined)) : '+',
|
|
2521
|
+
__dirty__: a?.orderVasItemId ? a.__dirty__ ? a.__dirty__ : undefined : '+',
|
|
2522
|
+
__dirtyfields__: a?.__dirtyfields__
|
|
2523
|
+
? {
|
|
2524
|
+
...a.__dirtyfields__,
|
|
2525
|
+
vas: { before: this.vasGrist.dirtyData.records[firstIndex].vas, after: e.detail[i] },
|
|
2526
|
+
vasQty: {
|
|
2527
|
+
before: 0,
|
|
2528
|
+
after: this.vasGrist.dirtyData.records[firstIndex].qty
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
: {
|
|
2532
|
+
vas: { before: this.vasGrist.dirtyData.records[firstIndex].vas, after: e.detail[i] },
|
|
2533
|
+
vasQty: {
|
|
2534
|
+
before: 0,
|
|
2535
|
+
after: this.vasGrist.dirtyData.records[firstIndex].qty
|
|
2536
|
+
}
|
|
2420
2537
|
}
|
|
2421
|
-
}
|
|
2422
2538
|
})
|
|
2423
2539
|
}
|
|
2424
2540
|
}
|
|
2425
2541
|
|
|
2426
|
-
for (
|
|
2427
|
-
let i = firstIndex;
|
|
2428
|
-
i < this.vasGrist.dirtyData.records.filter(data => data.group === record.group).length + firstIndex;
|
|
2429
|
-
i++
|
|
2430
|
-
) {
|
|
2431
|
-
this.deletedVas.push({ ...this.vasGrist.dirtyData.records[i], cuFlag: '-' })
|
|
2432
|
-
}
|
|
2433
2542
|
this.vasGrist.dirtyData.records.splice(firstIndex, lastIndex - firstIndex + 1, ...newRecords)
|
|
2434
2543
|
this.vasData.records = this.vasGrist.dirtyData.records
|
|
2435
2544
|
|
|
@@ -2438,6 +2547,22 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2438
2547
|
records: this.sortByNameField(this.vasData.records, 'group', 'product')
|
|
2439
2548
|
}
|
|
2440
2549
|
}}"
|
|
2550
|
+
@deleted="${e => {
|
|
2551
|
+
let oldRecord = this.vasGrist.dirtyData.records.filter(data => data.group === record.group && data.id === record.id)
|
|
2552
|
+
let oldOvi = oldRecord[0].orderVasItems
|
|
2553
|
+
for (const vas of e.detail) {
|
|
2554
|
+
let ovi = oldOvi?.find(data => data.vas.id === vas.id)
|
|
2555
|
+
if (ovi) {
|
|
2556
|
+
this.deletedVas.push({
|
|
2557
|
+
vas: vas,
|
|
2558
|
+
group: record.group,
|
|
2559
|
+
orderVasItemId: ovi.id,
|
|
2560
|
+
itemEditType: ORDER_VAS_STATUS.REMOVED.value,
|
|
2561
|
+
cuFlag: 'M'
|
|
2562
|
+
})
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
}}"
|
|
2441
2566
|
></select-vas-popup>
|
|
2442
2567
|
`,
|
|
2443
2568
|
{
|
|
@@ -2644,8 +2769,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2644
2769
|
const totalQtyVas = this.vasGrist.dirtyData.records.reduce(
|
|
2645
2770
|
(total, vas) =>
|
|
2646
2771
|
vas.qty &&
|
|
2647
|
-
vas.
|
|
2648
|
-
vas.
|
|
2772
|
+
vas.product.id === changeRecord.product?.id &&
|
|
2773
|
+
vas.productDetail.id === changeRecord.productDetail?.id &&
|
|
2649
2774
|
vas.batchId === changeRecord.batchId
|
|
2650
2775
|
? total + vas.qty
|
|
2651
2776
|
: total,
|
|
@@ -2654,8 +2779,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2654
2779
|
const totalReleaseQty = this.inventoryData.records.reduce(
|
|
2655
2780
|
(total, inv) =>
|
|
2656
2781
|
inv.releaseQty &&
|
|
2657
|
-
inv.
|
|
2658
|
-
inv.
|
|
2782
|
+
inv.product.id === changeRecord.product?.id &&
|
|
2783
|
+
inv.productDetail.id === changeRecord.productDetail?.id &&
|
|
2659
2784
|
inv.batchId === changeRecord.batchId
|
|
2660
2785
|
? total + inv.releaseQty
|
|
2661
2786
|
: total,
|
|
@@ -3211,21 +3336,16 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
3211
3336
|
this._validateVas()
|
|
3212
3337
|
let orderVasPatch = []
|
|
3213
3338
|
let orderVasItemPatch = []
|
|
3214
|
-
let vasStatus =
|
|
3215
|
-
this._releaseOrder.status === 'READY_TO_PICK' || this._releaseOrder.status === 'PICKING'
|
|
3216
|
-
? 'READY_TO_PROCESS'
|
|
3217
|
-
: 'PENDING_RECEIVE'
|
|
3218
3339
|
|
|
3219
3340
|
orderVasPatch = this.vasGrist.dirtyData.records.filter(p => p.product)
|
|
3220
|
-
|
|
3221
|
-
// p => !orderVasPatch.find(ovp => ovp.group === p.group && ovp.cuFlag !== '+')
|
|
3222
|
-
// )
|
|
3341
|
+
orderVasItemPatch = this.vasGrist.dirtyData.records.filter(p => !p.id)
|
|
3223
3342
|
|
|
3224
3343
|
// deleted Data
|
|
3225
3344
|
orderVasPatch = orderVasPatch.concat(this.deletedVas.filter(del => del.id))
|
|
3226
3345
|
orderVasItemPatch = orderVasItemPatch.concat(this.deletedVas.filter(del => !del.id && del.orderVasItemId))
|
|
3227
3346
|
|
|
3228
|
-
orderVasPatch = orderVasPatch
|
|
3347
|
+
orderVasPatch = orderVasPatch
|
|
3348
|
+
.map(ov => {
|
|
3229
3349
|
return {
|
|
3230
3350
|
id: ov?.id,
|
|
3231
3351
|
bizplace: !ov.id && ov.cuFlag !== '-' ? this._releaseOrder.bizplace : undefined,
|
|
@@ -3236,7 +3356,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
3236
3356
|
name: !ov.name ? `${ov.batchId} (${ov.sku})- ${new Date().toISOString()}` : undefined,
|
|
3237
3357
|
productName: !ov.productName ? ov.product.name : undefined,
|
|
3238
3358
|
productDetail: { id: ov.productDetail.id, name: ov.productDetail.name },
|
|
3239
|
-
status:
|
|
3359
|
+
status: ORDER_VAS_STATUS.PENDING_APPROVE.value,
|
|
3240
3360
|
packingType: ov.packingType,
|
|
3241
3361
|
uom: ov.uom,
|
|
3242
3362
|
uomValue: ov.uomValue,
|
|
@@ -3252,32 +3372,37 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
3252
3372
|
return [
|
|
3253
3373
|
...acc,
|
|
3254
3374
|
{
|
|
3255
|
-
id: cur?.orderVasItemId,
|
|
3375
|
+
id: cur?.orderVasItemId ? cur.orderVasItemId : undefined,
|
|
3256
3376
|
vas: { id: cur.vas.id, name: cur.vas.name },
|
|
3257
3377
|
vasQty: cur.vasQty,
|
|
3258
3378
|
vasRemark: cur?.vasRemark,
|
|
3259
|
-
cuFlag:
|
|
3379
|
+
cuFlag: cur.orderVasItemId ? (cur.cuFlag || (cur.__dirty__ ? 'M' : undefined)) : '+',
|
|
3380
|
+
itemEditType: cur?.orderVasItemId ? (cur.itemEditType || (cur.__dirty__ ? ORDER_VAS_STATUS.CHANGES.value : undefined)) : ORDER_VAS_STATUS.NEW.value,
|
|
3260
3381
|
}
|
|
3261
3382
|
]
|
|
3262
3383
|
} else {
|
|
3263
3384
|
return acc
|
|
3264
3385
|
}
|
|
3265
3386
|
}, []),
|
|
3266
|
-
cuFlag:
|
|
3387
|
+
cuFlag: ov?.cuFlag,
|
|
3388
|
+
editType: ov?.editType
|
|
3267
3389
|
}
|
|
3268
3390
|
})
|
|
3269
3391
|
|
|
3392
|
+
orderVasPatch = this._determineOvFlags(orderVasPatch)
|
|
3393
|
+
|
|
3270
3394
|
orderVasItemPatch = orderVasItemPatch
|
|
3271
3395
|
.map(ovi => {
|
|
3272
3396
|
return {
|
|
3273
|
-
id: ovi.orderVasItemId,
|
|
3397
|
+
id: ovi.orderVasItemId ? ovi.orderVasItemId : undefined,
|
|
3274
3398
|
vas: { id: ovi.vas.id, name: ovi.vas.name },
|
|
3275
|
-
orderVas: { id: this.vasData.records.find(vasData => ovi.group === vasData.group && vasData.id)?.id },
|
|
3399
|
+
orderVas: { id: ovi.orderVas?.id ? ovi.orderVas.id : this.vasData.records.find(vasData => ovi.group === vasData.group && vasData.id)?.id },
|
|
3276
3400
|
vasQty: ovi.vasQty,
|
|
3277
|
-
cuFlag:
|
|
3401
|
+
cuFlag: ovi.orderVasItemId ? (ovi.cuFlag || (ovi.__dirty__ ? 'M' : undefined)) : '+',
|
|
3402
|
+
itemEditType: ovi.orderVasItemId ? (ovi.itemEditType || (ovi.__dirty__ ? ORDER_VAS_STATUS.CHANGES.value : undefined)) : ORDER_VAS_STATUS.NEW.value
|
|
3278
3403
|
}
|
|
3279
3404
|
})
|
|
3280
|
-
.filter(ovi => ovi.orderVas.id)
|
|
3405
|
+
.filter(ovi => ovi.orderVas.id && !orderVasPatch.some(ovp => ovp.orderVasItemsPatch.some(item => item.id === ovi.id)))
|
|
3281
3406
|
|
|
3282
3407
|
const result = await CustomAlert({
|
|
3283
3408
|
title: i18next.t('title.are_you_sure'),
|
|
@@ -3302,13 +3427,26 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
3302
3427
|
|
|
3303
3428
|
if (!response.errors) {
|
|
3304
3429
|
this._showToast({ message: i18next.t('text.vas_edited') })
|
|
3305
|
-
this._fetchReleaseOrder()
|
|
3430
|
+
await this._fetchReleaseOrder()
|
|
3431
|
+
this.updateContext()
|
|
3306
3432
|
}
|
|
3307
3433
|
} catch (e) {
|
|
3308
3434
|
this._showToast(e)
|
|
3309
3435
|
}
|
|
3310
3436
|
}
|
|
3311
3437
|
|
|
3438
|
+
_determineOvFlags(orderVas) {
|
|
3439
|
+
return orderVas.map(ov => {
|
|
3440
|
+
const isDirty = ov.__dirty__ || ov.orderVasItemsPatch.some(ovi => ovi.__dirty__)
|
|
3441
|
+
const hasChanges = ov.cuFlag || isDirty || ov.orderVasItemsPatch.some(ovi => ovi.cuFlag)
|
|
3442
|
+
return {
|
|
3443
|
+
...ov,
|
|
3444
|
+
cuFlag: !ov.id ? '+' : hasChanges ? (ov.cuFlag || 'M') : undefined,
|
|
3445
|
+
editType: !ov.id ? ORDER_VAS_STATUS.NEW.value : hasChanges ? (ov.editType || ORDER_VAS_STATUS.CHANGES.value) : undefined
|
|
3446
|
+
}
|
|
3447
|
+
})
|
|
3448
|
+
}
|
|
3449
|
+
|
|
3312
3450
|
_validateCountry(e) {
|
|
3313
3451
|
if (e.target.value != 'MY') {
|
|
3314
3452
|
this._selectedCountry = e.target.value
|
|
@@ -3326,11 +3464,14 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
3326
3464
|
}
|
|
3327
3465
|
|
|
3328
3466
|
_validateVas() {
|
|
3467
|
+
if (this.deletedVas.length === 0 && !this.vasGrist.dirtyData.records.some( vas => vas.__dirty__ )) {
|
|
3468
|
+
throw new Error(i18next.t('text.no_changes_to_be_submitted'))
|
|
3469
|
+
}
|
|
3329
3470
|
const roData = this.inventoryData.records
|
|
3330
3471
|
roData.find(ro => {
|
|
3331
3472
|
let newSku = []
|
|
3332
3473
|
this.vasGrist.dirtyData.records.map(vas => {
|
|
3333
|
-
if (vas.
|
|
3474
|
+
if (vas.productSKU === ro.productSKU && vas.batchId === ro.batchId && vas.newSku) {
|
|
3334
3475
|
newSku.push(vas)
|
|
3335
3476
|
}
|
|
3336
3477
|
})
|
|
@@ -3460,6 +3601,51 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
3460
3601
|
|
|
3461
3602
|
return items
|
|
3462
3603
|
}
|
|
3604
|
+
|
|
3605
|
+
_openVasChangesPopup() {
|
|
3606
|
+
try {
|
|
3607
|
+
openPopup(
|
|
3608
|
+
html`
|
|
3609
|
+
<vas-changes-popup
|
|
3610
|
+
.releaseGoodNo="${this._releaseOrderNo}"
|
|
3611
|
+
.data="${this.vasData}"
|
|
3612
|
+
></vas-changes-popup>
|
|
3613
|
+
`,
|
|
3614
|
+
{
|
|
3615
|
+
backdrop: true,
|
|
3616
|
+
size: 'large',
|
|
3617
|
+
title: i18next.t('title.view_vas_changes')
|
|
3618
|
+
}
|
|
3619
|
+
)
|
|
3620
|
+
} catch(e) {
|
|
3621
|
+
this._showToast(e)
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
_openApproveVasChangesPopup() {
|
|
3626
|
+
try {
|
|
3627
|
+
openPopup(
|
|
3628
|
+
html`
|
|
3629
|
+
<proceed-edit-vas-popup
|
|
3630
|
+
.releaseGoodNo="${this._releaseOrderNo}"
|
|
3631
|
+
.bizplace="${this.partnerBizplaceId}"
|
|
3632
|
+
.data="${this.vasData}"
|
|
3633
|
+
@completed="${e => {
|
|
3634
|
+
this._fetchReleaseOrder(this._releaseOrderNo)
|
|
3635
|
+
this.updateContext()
|
|
3636
|
+
}}"
|
|
3637
|
+
></proceed-edit-vas-popup>
|
|
3638
|
+
`,
|
|
3639
|
+
{
|
|
3640
|
+
backdrop: true,
|
|
3641
|
+
size: 'large',
|
|
3642
|
+
title: i18next.t('title.proceed_edited_vas')
|
|
3643
|
+
}
|
|
3644
|
+
)
|
|
3645
|
+
} catch(e) {
|
|
3646
|
+
this._showToast(e)
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3463
3649
|
}
|
|
3464
3650
|
|
|
3465
3651
|
window.customElements.define('release-order-detail', ReleaseOrderDetail)
|