@things-factory/operato-wms 4.3.246 → 4.3.248
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/components/select-inventory-popup.js +4 -1
- package/client/pages/constants/location.js +4 -0
- package/client/pages/inbound/putaway-product.js +43 -10
- package/client/pages/inbound/putaway-same-carton-popup.js +9 -7
- package/client/pages/inbound/unload-product.js +65 -67
- package/client/pages/inbound/worksheet-putaway-return.js +1 -1
- package/client/pages/inbound/worksheet-putaway.js +1 -1
- package/client/pages/inbound/worksheet-unloading-return.js +3 -3
- package/client/pages/inbound/worksheet-unloading.js +1 -1
- package/client/pages/inventory/inventory-by-product.js +11 -0
- package/client/pages/inventory/onhand-inventory.js +64 -3
- package/client/pages/master/product/product-list.js +5 -5
- package/client/pages/order/release-order/create-release-order.js +406 -116
- package/client/pages/order/vas-order/create-vas-order.js +1 -1
- package/client/pages/order/vas-order/popup/select-vas-popup.js +1 -1
- package/client/pages/outbound/loading-product.js +14 -4
- package/client/pages/outbound/sorting-product.js +1 -1
- package/client/pages/outbound/worksheet-batch-picking.js +1 -1
- package/client/pages/outbound/worksheet-loading.js +15 -4
- package/client/pages/outbound/worksheet-packing.js +1 -1
- package/client/pages/outbound/worksheet-picking.js +21 -6
- package/client/pages/outbound/worksheet-return.js +1 -1
- package/client/pages/outbound/worksheet-sorting.js +1 -1
- package/client/pages/report/vas-report.js +12 -11
- package/client/pages/vas/vas-execution-page.js +23 -11
- package/client/pages/vas/worksheet-ref-vas.js +28 -16
- package/config.development.js +96 -77
- package/dist-server/graphql/resolvers/reports/vas-report.js +19 -18
- package/dist-server/graphql/resolvers/reports/vas-report.js.map +1 -1
- package/package.json +23 -23
- package/server/graphql/resolvers/reports/vas-report.ts +19 -19
- package/translations/en.json +13 -2
- package/translations/ko.json +13 -2
- package/translations/ms.json +13 -2
- package/translations/zh.json +13 -2
|
@@ -69,10 +69,8 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
69
69
|
_productBundleName: String,
|
|
70
70
|
_selectedInventories: Array,
|
|
71
71
|
inventoryGristConfig: Object,
|
|
72
|
-
vasGristConfig: Object,
|
|
73
72
|
inventoryData: Object,
|
|
74
73
|
bundleData: Object,
|
|
75
|
-
vasData: Object,
|
|
76
74
|
crossDockingProducts: Array,
|
|
77
75
|
_releaseByBundleQty: Number,
|
|
78
76
|
_releaseByBundleUomValue: Number,
|
|
@@ -85,6 +83,11 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
85
83
|
// _vasExpanded: Boolean,
|
|
86
84
|
_selectedCP: String,
|
|
87
85
|
|
|
86
|
+
/* VAS related */
|
|
87
|
+
vasData: Object,
|
|
88
|
+
vasGristConfig: Object,
|
|
89
|
+
vasFormattedData: Object,
|
|
90
|
+
|
|
88
91
|
/* Shipping Form Field */
|
|
89
92
|
_contactPointId: String,
|
|
90
93
|
_contactPointName: String,
|
|
@@ -1096,15 +1099,15 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1096
1099
|
click: (columns, data, column, record, rowIndex) => {
|
|
1097
1100
|
this._selectedVasRecord = record
|
|
1098
1101
|
this._selectedVasRecordIdx = rowIndex
|
|
1099
|
-
if (column.name === 'sku') {
|
|
1102
|
+
if (column.name === 'sku' && (record.__dirty__ === '+' || (record.vasGristId && record.productId))) {
|
|
1100
1103
|
this.openTargetproductVasPopup(record)
|
|
1101
1104
|
}
|
|
1102
1105
|
if (column.name === 'newSKU') {
|
|
1103
|
-
this._openBulkProductSelectionForVas(this._selectBy, rowIndex)
|
|
1106
|
+
this._openBulkProductSelectionForVas(this._selectBy, rowIndex, record)
|
|
1104
1107
|
}
|
|
1105
1108
|
if (column.name === 'vas') {
|
|
1106
1109
|
try {
|
|
1107
|
-
if (!record.qty) {
|
|
1110
|
+
if (!record.qty && record.productId && record.productDetailId) {
|
|
1108
1111
|
throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.qty') }))
|
|
1109
1112
|
} else {
|
|
1110
1113
|
this.openSelectVasPopup(record, rowIndex)
|
|
@@ -1389,6 +1392,28 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1389
1392
|
if (record.isCrossDocking) throw new Error(i18next.t('text.cannot_delete_cross_docking_products'))
|
|
1390
1393
|
const newData = data.records.filter((_, idx) => idx !== rowIndex)
|
|
1391
1394
|
this.inventoryData = { ...this.inventoryData, records: newData }
|
|
1395
|
+
|
|
1396
|
+
if (this.vasData?.records.length > 0) {
|
|
1397
|
+
const vasGristId = this.vasData.records
|
|
1398
|
+
.filter(
|
|
1399
|
+
v =>
|
|
1400
|
+
v.productId === record.productId &&
|
|
1401
|
+
v.productDetailId === record.productDetailId &&
|
|
1402
|
+
v.batchId === record.batchId
|
|
1403
|
+
)
|
|
1404
|
+
.map(v => {
|
|
1405
|
+
return { vasGristId: v.vasGristId }
|
|
1406
|
+
})
|
|
1407
|
+
this.vasData = {
|
|
1408
|
+
...this.vasData,
|
|
1409
|
+
records: this.vasData.records.filter(v => {
|
|
1410
|
+
return !vasGristId.some(i => {
|
|
1411
|
+
return i.vasGristId === v.vasGristId
|
|
1412
|
+
})
|
|
1413
|
+
})
|
|
1414
|
+
}
|
|
1415
|
+
this.vasGrist.dirtyData.records = this.vasData.records
|
|
1416
|
+
}
|
|
1392
1417
|
this.inventoryGrist.dirtyData.records = newData
|
|
1393
1418
|
this._updateInventoryGristConfig()
|
|
1394
1419
|
} catch (e) {
|
|
@@ -1406,7 +1431,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1406
1431
|
handlers: {
|
|
1407
1432
|
click: (columns, data, column, record, rowIndex) => {
|
|
1408
1433
|
this._selectBy = 'product'
|
|
1409
|
-
this._openBulkProductSelection(this._selectBy, rowIndex)
|
|
1434
|
+
this._openBulkProductSelection(this._selectBy, rowIndex, record)
|
|
1410
1435
|
}
|
|
1411
1436
|
},
|
|
1412
1437
|
width: 350
|
|
@@ -1505,12 +1530,53 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1505
1530
|
handlers: {
|
|
1506
1531
|
click: (columns, data, column, record, rowIndex) => {
|
|
1507
1532
|
const newData = data.records.filter((_, idx) => idx !== rowIndex)
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1533
|
+
|
|
1534
|
+
if (this.vasData?.records.length > 0) {
|
|
1535
|
+
const invData = this.inventoryData
|
|
1536
|
+
const vasData = this.vasData
|
|
1537
|
+
const currentReleaseQty = this.inventoryData.records.reduce(
|
|
1538
|
+
(total, inv) =>
|
|
1539
|
+
inv.releaseQty &&
|
|
1540
|
+
inv.productId === record.productId &&
|
|
1541
|
+
inv.productDetailId === record.productDetailId &&
|
|
1542
|
+
inv.batchId === record.batchId
|
|
1543
|
+
? total + inv.releaseQty
|
|
1544
|
+
: total,
|
|
1545
|
+
0
|
|
1546
|
+
)
|
|
1547
|
+
let newReleaseQty = record.releaseQty ? currentReleaseQty - record.releaseQty : currentReleaseQty
|
|
1548
|
+
const vasDataQty = this.vasData.records.reduce(
|
|
1549
|
+
(total, vas) =>
|
|
1550
|
+
vas.qty &&
|
|
1551
|
+
vas.productId === record.productId &&
|
|
1552
|
+
vas.productDetailId === record.productDetailId &&
|
|
1553
|
+
vas.batchId === record.batchId
|
|
1554
|
+
? total + vas.qty
|
|
1555
|
+
: total,
|
|
1556
|
+
0
|
|
1557
|
+
)
|
|
1558
|
+
if (newReleaseQty < vasDataQty) {
|
|
1559
|
+
const vasGristId = this.vasData.records
|
|
1560
|
+
.filter(
|
|
1561
|
+
v =>
|
|
1562
|
+
v.productId === record.productId &&
|
|
1563
|
+
v.productDetailId === record.productDetailId &&
|
|
1564
|
+
v.batchId === record.batchId
|
|
1565
|
+
)
|
|
1566
|
+
.map(v => {
|
|
1567
|
+
return { vasGristId: v.vasGristId }
|
|
1568
|
+
})
|
|
1569
|
+
this.vasData = {
|
|
1570
|
+
...this.vasData,
|
|
1571
|
+
records: this.vasData.records.filter(v => {
|
|
1572
|
+
return !vasGristId.some(i => {
|
|
1573
|
+
return i.vasGristId === v.vasGristId
|
|
1574
|
+
})
|
|
1575
|
+
})
|
|
1576
|
+
}
|
|
1577
|
+
this.vasGrist.dirtyData.records = this.vasData.records
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1514
1580
|
this.inventoryData = { ...this.inventoryData, records: newData }
|
|
1515
1581
|
this.inventoryGrist.dirtyData.records = newData
|
|
1516
1582
|
this._updateInventoryGristConfig()
|
|
@@ -1799,10 +1865,72 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1799
1865
|
}
|
|
1800
1866
|
}
|
|
1801
1867
|
|
|
1802
|
-
_onProductChangeHandler(event) {
|
|
1868
|
+
async _onProductChangeHandler(event) {
|
|
1803
1869
|
const changeRecord = event.detail.after
|
|
1804
1870
|
const changedColumn = event.detail.column.name
|
|
1805
1871
|
|
|
1872
|
+
if (
|
|
1873
|
+
(changedColumn == 'releaseQty' || changedColumn == 'releaseUom') &&
|
|
1874
|
+
(changeRecord.releaseQty < event.detail.before.releaseQty ||
|
|
1875
|
+
changeRecord.releaseUomValue < changeRecord.releaseUomValue)
|
|
1876
|
+
) {
|
|
1877
|
+
const newTotalQty = this.formatVasTargetproductData()
|
|
1878
|
+
.filter(
|
|
1879
|
+
v =>
|
|
1880
|
+
v.productId === event.detail.after.productId &&
|
|
1881
|
+
v.productDetailId === event.detail.after.productDetailId &&
|
|
1882
|
+
v.batchId === event.detail.after.batchId
|
|
1883
|
+
)
|
|
1884
|
+
.reduce(a => a).releaseQty
|
|
1885
|
+
|
|
1886
|
+
const vasTotalQTy = this.vasData.records
|
|
1887
|
+
.filter(
|
|
1888
|
+
v =>
|
|
1889
|
+
v.productId === event.detail.after.productId &&
|
|
1890
|
+
v.productDetailId === event.detail.after.productDetailId &&
|
|
1891
|
+
v.batchId === event.detail.after.batchId
|
|
1892
|
+
)
|
|
1893
|
+
.reduce((a, b) => a.qty + b.qty)
|
|
1894
|
+
|
|
1895
|
+
if (vasTotalQTy > newTotalQty) {
|
|
1896
|
+
const result = await CustomAlert({
|
|
1897
|
+
title: i18next.t('title.are_you_sure'),
|
|
1898
|
+
text: i18next.t(
|
|
1899
|
+
'text.sku_has_vas_releaseQty_less_than_qty_for_vas_changing_will_require_user_to_reenter_vas_information'
|
|
1900
|
+
),
|
|
1901
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1902
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1903
|
+
})
|
|
1904
|
+
|
|
1905
|
+
if (!result.value) {
|
|
1906
|
+
this.inventoryGrist.dirtyData.records[event.detail.after.__seq__ - 1].releaseQty =
|
|
1907
|
+
event.detail.before.releaseQty
|
|
1908
|
+
this.inventoryData.records[event.detail.after.__seq__ - 1].releaseQty = event.detail.before.releaseQty
|
|
1909
|
+
return
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
const vasGristId = this.vasData.records
|
|
1913
|
+
.filter(
|
|
1914
|
+
v =>
|
|
1915
|
+
v.productId === changeRecord.productId &&
|
|
1916
|
+
v.productDetailId === changeRecord.productDetailId &&
|
|
1917
|
+
v.batchId === changeRecord.batchId
|
|
1918
|
+
)
|
|
1919
|
+
.map(v => {
|
|
1920
|
+
return { vasGristId: v.vasGristId }
|
|
1921
|
+
})
|
|
1922
|
+
this.vasData = {
|
|
1923
|
+
...this.vasData,
|
|
1924
|
+
records: this.vasData.records.filter(v => {
|
|
1925
|
+
return !vasGristId.some(i => {
|
|
1926
|
+
return i.vasGristId === v.vasGristId
|
|
1927
|
+
})
|
|
1928
|
+
})
|
|
1929
|
+
}
|
|
1930
|
+
this.vasGrist.dirtyData.records = this.vasData.records
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1806
1934
|
try {
|
|
1807
1935
|
if (changedColumn === 'releaseQty') {
|
|
1808
1936
|
if (changeRecord.isCrossDocking) {
|
|
@@ -1834,45 +1962,114 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1834
1962
|
const initialRecord = event.detail.before
|
|
1835
1963
|
const changeRecord = event.detail.after
|
|
1836
1964
|
const changedColumn = event.detail.column.name
|
|
1837
|
-
|
|
1965
|
+
this.vasFormattedData = this.formatVasTargetproductData()
|
|
1966
|
+
const inventoryData = this.vasFormattedData.find(
|
|
1967
|
+
invData =>
|
|
1968
|
+
invData.productId === event.detail.after.productId &&
|
|
1969
|
+
invData.productDetailId === event.detail.after.productDetailId &&
|
|
1970
|
+
invData.batchId === event.detail.after.batchId
|
|
1971
|
+
)
|
|
1838
1972
|
|
|
1839
1973
|
try {
|
|
1974
|
+
// to map to the first row
|
|
1975
|
+
if (
|
|
1976
|
+
changedColumn === 'qty' ||
|
|
1977
|
+
changedColumn === 'newPackingType' ||
|
|
1978
|
+
changedColumn === 'newUom' ||
|
|
1979
|
+
changedColumn === 'newUomValue' ||
|
|
1980
|
+
changedColumn === 'outputQty' ||
|
|
1981
|
+
changedColumn === 'remark'
|
|
1982
|
+
)
|
|
1983
|
+
if (!changeRecord.productId && !changeRecord.productDetailId && !changeRecord.batchId) {
|
|
1984
|
+
delete event.detail.after[event.detail.column.name]
|
|
1985
|
+
const index = this.vasGrist.dirtyData.records.findIndex(
|
|
1986
|
+
d => d.vasGristId === changeRecord.vasGristId && d.productId && d.productDetailId && d.batchId
|
|
1987
|
+
)
|
|
1988
|
+
throw new Error(
|
|
1989
|
+
i18next.t('text.please_enter_value_on_row_row', {
|
|
1990
|
+
row: `[ ${index + 1} ] ${this.vasGrist.dirtyData.records[index].sku} (${
|
|
1991
|
+
this.vasGrist.dirtyData.records[index].batchId
|
|
1992
|
+
}) `
|
|
1993
|
+
})
|
|
1994
|
+
)
|
|
1995
|
+
}
|
|
1996
|
+
if (changeRecord.qty <= 0 || changeRecord.vasQty <= 0 || changeRecord.outputQty <= 0) {
|
|
1997
|
+
throw new Error(i18next.t('text.invalid_quantity_input'))
|
|
1998
|
+
}
|
|
1840
1999
|
if (changedColumn === 'qty') {
|
|
1841
2000
|
if (changeRecord.qty === undefined) throw new Error(i18next.t('text.there_is_no_selected_items'))
|
|
1842
2001
|
// total up the qty
|
|
1843
|
-
if (
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
changeRecord.
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
2002
|
+
if (this._selectBy === 'pallet') {
|
|
2003
|
+
if (
|
|
2004
|
+
///
|
|
2005
|
+
this.vasData.records.reduce(
|
|
2006
|
+
(total, vas) =>
|
|
2007
|
+
vas.qty &&
|
|
2008
|
+
vas.productId === changeRecord.productId &&
|
|
2009
|
+
vas.productDetailId === changeRecord.productDetailId &&
|
|
2010
|
+
vas.batchId === changeRecord.batchId
|
|
2011
|
+
? total + vas.qty
|
|
2012
|
+
: total,
|
|
2013
|
+
0
|
|
2014
|
+
) > inventoryData.releaseQty
|
|
2015
|
+
|
|
2016
|
+
//
|
|
2017
|
+
) {
|
|
2018
|
+
throw new Error(i18next.t('text.qty_exceed_release_qty'))
|
|
2019
|
+
}
|
|
2020
|
+
} else if (this._selectBy === 'product') {
|
|
2021
|
+
if (changeRecord.qty > inventoryData.releaseQty) {
|
|
2022
|
+
throw new Error(i18next.t('text.qty_exceed_release_qty'))
|
|
2023
|
+
}
|
|
2024
|
+
if (
|
|
2025
|
+
this.vasData.records.reduce(
|
|
2026
|
+
(total, vas) =>
|
|
2027
|
+
vas.qty &&
|
|
2028
|
+
vas.productId === changeRecord.productId &&
|
|
2029
|
+
vas.productDetailId === changeRecord.productDetailId &&
|
|
2030
|
+
vas.batchId === changeRecord.batchId
|
|
2031
|
+
? total + vas.qty
|
|
2032
|
+
: total,
|
|
2033
|
+
0
|
|
2034
|
+
) > inventoryData.releaseQty
|
|
2035
|
+
) {
|
|
2036
|
+
throw new Error(i18next.t('text.qty_exceed_release_qty'))
|
|
2037
|
+
}
|
|
1866
2038
|
}
|
|
2039
|
+
//to change uom, vasQty
|
|
2040
|
+
let uomValue = initialRecord.releaseUomValue / initialRecord.releaseQty
|
|
2041
|
+
let newUomValue = initialRecord.newUomValue
|
|
2042
|
+
? initialRecord.qty
|
|
2043
|
+
? initialRecord.newUomValue / initialRecord.qty
|
|
2044
|
+
: initialRecord.newUomValue
|
|
2045
|
+
: null
|
|
2046
|
+
changeRecord.uomValue = uomValue * changeRecord.qty
|
|
2047
|
+
changeRecord.newUomValue
|
|
2048
|
+
? initialRecord.outputQty
|
|
2049
|
+
? initialRecord.outputQty
|
|
2050
|
+
: (changeRecord.newUomValue = changeRecord.qty * newUomValue)
|
|
2051
|
+
: null
|
|
2052
|
+
changeRecord.vasQty = changeRecord.qty
|
|
2053
|
+
changeRecord.outputQty = initialRecord.outputQty ? initialRecord.outputQty : null
|
|
2054
|
+
//
|
|
1867
2055
|
} else if (changedColumn === 'outputQty' || changedColumn === 'vasQty' || changedColumn === 'newUomValue') {
|
|
1868
2056
|
if (changeRecord.outputQty === undefined || changeRecord.vasQty === undefined)
|
|
1869
2057
|
throw new Error(i18next.t('text.there_is_no_selected_items'))
|
|
1870
|
-
if (
|
|
2058
|
+
else if (
|
|
1871
2059
|
changeRecord.outputQty <= 0 ||
|
|
2060
|
+
isNaN(changeRecord.outputQty) ||
|
|
1872
2061
|
changeRecord.vasQty <= 0 ||
|
|
1873
2062
|
(initialRecord.newProductId && initialRecord.productId && changeRecord.newUomValue <= 0)
|
|
1874
2063
|
) {
|
|
1875
2064
|
throw new Error(i18next.t('text.invalid_quantity_input'))
|
|
2065
|
+
} else if (changedColumn === 'outputQty' && changeRecord.newProductId && changeRecord.newProductDetailId) {
|
|
2066
|
+
if (initialRecord.outputQty == null) {
|
|
2067
|
+
const totalUomValue = changeRecord.outputQty * (changeRecord.newUomValue / changeRecord.qty)
|
|
2068
|
+
changeRecord.newUomValue = totalUomValue
|
|
2069
|
+
} else {
|
|
2070
|
+
const totalUomValue = changeRecord.outputQty * (initialRecord.newUomValue / initialRecord.outputQty)
|
|
2071
|
+
changeRecord.newUomValue = totalUomValue
|
|
2072
|
+
}
|
|
1876
2073
|
}
|
|
1877
2074
|
}
|
|
1878
2075
|
this._updateVasTargets()
|
|
@@ -2318,6 +2515,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2318
2515
|
|
|
2319
2516
|
_validateInventories() {
|
|
2320
2517
|
const inventories = this.inventoryGrist?.dirtyData?.records
|
|
2518
|
+
let recall = this._recallInput.checked
|
|
2321
2519
|
if (!inventories?.length) throw new Error(i18next.t('text.no_products'))
|
|
2322
2520
|
// required field (batchId, packingType, uomValue, unit, packQty)
|
|
2323
2521
|
if (!inventories.every(record => record.releaseQty && record.batchId && record.packingType)) {
|
|
@@ -2343,6 +2541,10 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2343
2541
|
throw new Error(i18next.t('text.lot_id_is_duplicated'))
|
|
2344
2542
|
}
|
|
2345
2543
|
}
|
|
2544
|
+
|
|
2545
|
+
if (inventories.some(record => record.locationType == 'DAMAGE') && recall == false) {
|
|
2546
|
+
throw new Error(i18next.t('text.there_are_damaged_inventories'))
|
|
2547
|
+
}
|
|
2346
2548
|
}
|
|
2347
2549
|
|
|
2348
2550
|
_validateVas() {
|
|
@@ -2373,7 +2575,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2373
2575
|
if (!record.vas) throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.vas') }))
|
|
2374
2576
|
// allowing repacking to same SKU
|
|
2375
2577
|
// if (record.productSKU == record.newSKU)
|
|
2376
|
-
// throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.new_sku_same_as_original_sku') }))
|
|
2578
|
+
// throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.new_sku_same_as_original_sku') }))\
|
|
2377
2579
|
if (record.newSKU) {
|
|
2378
2580
|
if (!record.newPackingType) {
|
|
2379
2581
|
throw new Error(
|
|
@@ -2428,8 +2630,29 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2428
2630
|
}
|
|
2429
2631
|
}
|
|
2430
2632
|
|
|
2431
|
-
_openBulkProductSelection(type, rowIndex) {
|
|
2633
|
+
async _openBulkProductSelection(type, rowIndex, record) {
|
|
2432
2634
|
if (this._bizplaceId) {
|
|
2635
|
+
{
|
|
2636
|
+
if (this.vasData.records.length > 0) {
|
|
2637
|
+
if (
|
|
2638
|
+
this.vasData.records.find(
|
|
2639
|
+
v =>
|
|
2640
|
+
v.productId === record?.productId &&
|
|
2641
|
+
v.productDetailId === record?.productDetailId &&
|
|
2642
|
+
v.batchId === record?.batchId
|
|
2643
|
+
)
|
|
2644
|
+
) {
|
|
2645
|
+
const result = await CustomAlert({
|
|
2646
|
+
title: i18next.t('title.are_you_sure'),
|
|
2647
|
+
text: i18next.t('text.sku_has_vas_changing_sku_will_need_user_to_reenter_vas_information'),
|
|
2648
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
2649
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
2650
|
+
})
|
|
2651
|
+
|
|
2652
|
+
if (!result.value) return
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2433
2656
|
openPopup(
|
|
2434
2657
|
html`
|
|
2435
2658
|
<select-inventory-popup
|
|
@@ -2462,8 +2685,26 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2462
2685
|
|
|
2463
2686
|
// if got this.vasData only, to prevent calling this function if this.vasData is unavailable
|
|
2464
2687
|
// delete vasData if product is changed in order tab
|
|
2465
|
-
if (this.vasData
|
|
2466
|
-
this.
|
|
2688
|
+
if (this.vasData?.records.length > 0) {
|
|
2689
|
+
const vasGristId = this.vasData.records
|
|
2690
|
+
.filter(
|
|
2691
|
+
v =>
|
|
2692
|
+
v.productId === record.productId &&
|
|
2693
|
+
v.productDetailId === record.productDetailId &&
|
|
2694
|
+
v.batchId === record.batchId
|
|
2695
|
+
)
|
|
2696
|
+
.map(v => {
|
|
2697
|
+
return { vasGristId: v.vasGristId }
|
|
2698
|
+
})
|
|
2699
|
+
this.vasData = {
|
|
2700
|
+
...this.vasData,
|
|
2701
|
+
records: this.vasData.records.filter(v => {
|
|
2702
|
+
return !vasGristId.some(i => {
|
|
2703
|
+
return i.vasGristId === v.vasGristId
|
|
2704
|
+
})
|
|
2705
|
+
})
|
|
2706
|
+
}
|
|
2707
|
+
this.vasGrist.dirtyData.records = this.vasData.records
|
|
2467
2708
|
}
|
|
2468
2709
|
}
|
|
2469
2710
|
}}"
|
|
@@ -2480,7 +2721,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2480
2721
|
}
|
|
2481
2722
|
}
|
|
2482
2723
|
|
|
2483
|
-
_openBulkProductSelectionForVas(type, rowIndex) {
|
|
2724
|
+
_openBulkProductSelectionForVas(type, rowIndex, record) {
|
|
2484
2725
|
if (this._bizplaceId) {
|
|
2485
2726
|
openPopup(
|
|
2486
2727
|
html`
|
|
@@ -2503,15 +2744,19 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2503
2744
|
// for (let i = 0; i < e.detail.multipleProducts.length; i++) {
|
|
2504
2745
|
// newRecords.push(e.detail.multipleProducts[i])
|
|
2505
2746
|
// }
|
|
2506
|
-
// update existing
|
|
2747
|
+
// update existing vas data records
|
|
2748
|
+
if (!record.productId) {
|
|
2749
|
+
rowIndex = this.vasGrist.dirtyData.records.findIndex(d => d.vasGristId === record.vasGristId)
|
|
2750
|
+
}
|
|
2507
2751
|
this.vasGrist.dirtyData.records.splice(rowIndex, 1, {
|
|
2508
2752
|
...this.vasGrist.dirtyData.records[rowIndex],
|
|
2509
2753
|
...newRecords
|
|
2510
2754
|
})
|
|
2511
|
-
|
|
2512
2755
|
this.vasGrist.dirtyData.records.map(record => {
|
|
2513
2756
|
record.newSKU
|
|
2514
|
-
? record.
|
|
2757
|
+
? record.outputQty
|
|
2758
|
+
? (record.newUomValue = record.outputQty * record.newUomValue)
|
|
2759
|
+
: record.qty
|
|
2515
2760
|
? (record.newUomValue = record.qty * record.newUomValue)
|
|
2516
2761
|
: record.newUomValue
|
|
2517
2762
|
: (record.newUomValue = null)
|
|
@@ -2951,53 +3196,12 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2951
3196
|
|
|
2952
3197
|
openTargetproductVasPopup(record) {
|
|
2953
3198
|
try {
|
|
3199
|
+
let targetList = this.formatVasTargetproductData()
|
|
2954
3200
|
this.checkInventoryValidity()
|
|
2955
3201
|
openPopup(
|
|
2956
3202
|
html`
|
|
2957
3203
|
<vas-target-product-popup
|
|
2958
|
-
.targetList="${
|
|
2959
|
-
.map(record => {
|
|
2960
|
-
const unitUomValue = record.releaseUomValue / record.releaseQty
|
|
2961
|
-
let packQty = record.releaseQty
|
|
2962
|
-
|
|
2963
|
-
if (this.vasData.records?.length) {
|
|
2964
|
-
const existVasData = this.vasData.records.filter(vasRecord => {
|
|
2965
|
-
const isSamePackingType = !!(record.packingType === vasRecord.packingType)
|
|
2966
|
-
switch (vasRecord.targetType) {
|
|
2967
|
-
case VAS_BATCH_AND_PRODUCT_TYPE:
|
|
2968
|
-
return (
|
|
2969
|
-
record.batchId === vasRecord.target.batchId &&
|
|
2970
|
-
record.product.id === vasRecord.target.productId &&
|
|
2971
|
-
isSamePackingType
|
|
2972
|
-
)
|
|
2973
|
-
case VAS_BATCH_NO_TYPE:
|
|
2974
|
-
return record.batchId === vasRecord.target && isSamePackingType
|
|
2975
|
-
case VAS_PRODUCT_TYPE:
|
|
2976
|
-
return record.product.id === vasRecord.target && isSamePackingType
|
|
2977
|
-
}
|
|
2978
|
-
})
|
|
2979
|
-
|
|
2980
|
-
if (existVasData?.length) {
|
|
2981
|
-
let assignedQty = 0
|
|
2982
|
-
|
|
2983
|
-
existVasData.forEach(dt => {
|
|
2984
|
-
assignedQty += dt.qty
|
|
2985
|
-
})
|
|
2986
|
-
|
|
2987
|
-
packQty -= assignedQty
|
|
2988
|
-
}
|
|
2989
|
-
}
|
|
2990
|
-
|
|
2991
|
-
delete record.__dirty__
|
|
2992
|
-
delete record.__dirtyfields__
|
|
2993
|
-
return {
|
|
2994
|
-
...record,
|
|
2995
|
-
packQty,
|
|
2996
|
-
unitUomValue,
|
|
2997
|
-
totalUomValue: record.releaseUomValue * packQty
|
|
2998
|
-
}
|
|
2999
|
-
})
|
|
3000
|
-
.filter(record => record.packQty > 0)}"
|
|
3204
|
+
.targetList="${targetList}"
|
|
3001
3205
|
.vasList="${this.vasData.records}"
|
|
3002
3206
|
.record="${record}"
|
|
3003
3207
|
@selected="${e => {
|
|
@@ -3030,7 +3234,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
3030
3234
|
records: this.vasData.records.map(record => {
|
|
3031
3235
|
return {
|
|
3032
3236
|
...record,
|
|
3033
|
-
vasGristId: record.vasGristId
|
|
3237
|
+
vasGristId: record.vasGristId
|
|
3238
|
+
? record.vasGristId
|
|
3239
|
+
: `${record.batchId} (${record.sku})- ${new Date().toISOString()}`
|
|
3034
3240
|
}
|
|
3035
3241
|
})
|
|
3036
3242
|
}
|
|
@@ -3063,28 +3269,53 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
3063
3269
|
for (let i = 0; i < e.detail.length; i++) {
|
|
3064
3270
|
newRecords.push({ ...record, vas: e.detail[i] })
|
|
3065
3271
|
}
|
|
3066
|
-
if (
|
|
3067
|
-
//
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3272
|
+
if (!record.vas) {
|
|
3273
|
+
// if no VAS data, it will update the vas and add new rows
|
|
3274
|
+
if (newRecords.length == 1) {
|
|
3275
|
+
// update existing inventory data records
|
|
3276
|
+
this.vasGrist.dirtyData.records.splice(rowIndex, 1, {
|
|
3277
|
+
...this.vasGrist.dirtyData.records[rowIndex],
|
|
3278
|
+
...newRecords[0]
|
|
3279
|
+
})
|
|
3280
|
+
this.vasData = {
|
|
3281
|
+
...this.vasData,
|
|
3282
|
+
records: [...this.vasGrist.dirtyData.records]
|
|
3283
|
+
}
|
|
3284
|
+
} else {
|
|
3285
|
+
// update existing inventory data records
|
|
3286
|
+
this.vasGrist.dirtyData.records.splice(rowIndex, 1, {
|
|
3287
|
+
...this.vasGrist.dirtyData.records[rowIndex],
|
|
3288
|
+
...newRecords[0]
|
|
3289
|
+
})
|
|
3290
|
+
this.vasData = {
|
|
3291
|
+
...this.vasData,
|
|
3292
|
+
records: [...this.vasGrist.dirtyData.records]
|
|
3293
|
+
}
|
|
3294
|
+
// add new data
|
|
3295
|
+
newRecords = newRecords.slice(1).map(nrecord => {
|
|
3296
|
+
return {
|
|
3297
|
+
vasGristId: record.vasGristId,
|
|
3298
|
+
vasQty: nrecord.vasQty,
|
|
3299
|
+
vas: nrecord.vas
|
|
3300
|
+
}
|
|
3301
|
+
})
|
|
3302
|
+
this.vasData = {
|
|
3303
|
+
...this.vasData,
|
|
3304
|
+
records: [...this.vasGrist.dirtyData.records, ...newRecords]
|
|
3305
|
+
}
|
|
3075
3306
|
}
|
|
3076
3307
|
} else {
|
|
3077
|
-
//
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3308
|
+
// if vas column is already there add new data ONLY
|
|
3309
|
+
newRecords = newRecords.map(nrecord => {
|
|
3310
|
+
if (
|
|
3311
|
+
this.vasData.records.find(v => v.vasGristId === nrecord.vasGristId && v.vas.id === nrecord.vas.id)
|
|
3312
|
+
) {
|
|
3313
|
+
throw new Error(
|
|
3314
|
+
this._showToast({
|
|
3315
|
+
message: i18next.t('text.duplicated_value_field', { field: i18next.t('field.vas') })
|
|
3316
|
+
})
|
|
3317
|
+
)
|
|
3318
|
+
}
|
|
3088
3319
|
return {
|
|
3089
3320
|
vasGristId: record.vasGristId,
|
|
3090
3321
|
vasQty: nrecord.vasQty,
|
|
@@ -3689,13 +3920,72 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
3689
3920
|
return items
|
|
3690
3921
|
}
|
|
3691
3922
|
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3923
|
+
formatVasTargetproductData() {
|
|
3924
|
+
let data = []
|
|
3925
|
+
data = this.inventoryGrist.dirtyData.records
|
|
3926
|
+
.map(record => {
|
|
3927
|
+
const unitUomValue = record.releaseUomValue / record.releaseQty
|
|
3928
|
+
let packQty = record.releaseQty
|
|
3929
|
+
|
|
3930
|
+
if (this.vasData.records?.length) {
|
|
3931
|
+
const existVasData = this.vasData.records.filter(vasRecord => {
|
|
3932
|
+
const isSamePackingType = !!(record.packingType === vasRecord.packingType)
|
|
3933
|
+
switch (vasRecord.targetType) {
|
|
3934
|
+
case VAS_BATCH_AND_PRODUCT_TYPE:
|
|
3935
|
+
return (
|
|
3936
|
+
record.batchId === vasRecord.target.batchId &&
|
|
3937
|
+
record.product.id === vasRecord.target.productId &&
|
|
3938
|
+
isSamePackingType
|
|
3939
|
+
)
|
|
3940
|
+
case VAS_BATCH_NO_TYPE:
|
|
3941
|
+
return record.batchId === vasRecord.target && isSamePackingType
|
|
3942
|
+
case VAS_PRODUCT_TYPE:
|
|
3943
|
+
return record.product.id === vasRecord.target && isSamePackingType
|
|
3944
|
+
}
|
|
3945
|
+
})
|
|
3946
|
+
|
|
3947
|
+
if (existVasData?.length) {
|
|
3948
|
+
let assignedQty = 0
|
|
3949
|
+
|
|
3950
|
+
existVasData.forEach(dt => {
|
|
3951
|
+
assignedQty += dt.qty
|
|
3952
|
+
})
|
|
3953
|
+
|
|
3954
|
+
packQty -= assignedQty
|
|
3955
|
+
}
|
|
3956
|
+
}
|
|
3957
|
+
|
|
3958
|
+
delete record.__dirty__
|
|
3959
|
+
delete record.__dirtyfields__
|
|
3960
|
+
return {
|
|
3961
|
+
...record,
|
|
3962
|
+
packQty,
|
|
3963
|
+
unitUomValue,
|
|
3964
|
+
totalUomValue: record.releaseUomValue * packQty
|
|
3965
|
+
}
|
|
3697
3966
|
})
|
|
3698
|
-
|
|
3967
|
+
.filter(record => record.packQty > 0)
|
|
3968
|
+
|
|
3969
|
+
if (this._selectBy === 'product') {
|
|
3970
|
+
this.vasFormattedData = data
|
|
3971
|
+
} else if ((this._selectBy = 'pallet')) {
|
|
3972
|
+
// this is a function to group by product Id, productDetail Id and batchId and sum up qty and total uomvalue
|
|
3973
|
+
const groupBy = data =>
|
|
3974
|
+
Object.values(
|
|
3975
|
+
data.reduce((d, e) => {
|
|
3976
|
+
const key = e.productId + e.productDetailId + e.batchId
|
|
3977
|
+
d[key] = d[key] ? d[key] : { ...e, releaseQty: 0, releaseUomValue: 0 }
|
|
3978
|
+
d[key].releaseQty = d[key] ? d[key].releaseQty + e.releaseQty : e.releaseQty
|
|
3979
|
+
d[key].releaseUomValue = d[key].releaseUomValue
|
|
3980
|
+
? d[key].releaseUomValue + e.releaseUomValue
|
|
3981
|
+
: e.releaseUomValue
|
|
3982
|
+
return d
|
|
3983
|
+
}, {})
|
|
3984
|
+
)
|
|
3985
|
+
|
|
3986
|
+
this.vasFormattedData = groupBy(data)
|
|
3987
|
+
}
|
|
3988
|
+
return this.vasFormattedData
|
|
3699
3989
|
}
|
|
3700
3990
|
|
|
3701
3991
|
_showToast({ type, message }) {
|