@things-factory/sales-ui 4.3.135 → 4.3.138
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/purchase-order/purchase-order-approval-detail.js +5 -1
- package/client/pages/purchase-order/purchase-order-detail.js +113 -40
- package/package.json +8 -8
- package/translations/en.json +2 -0
- package/translations/ko.json +3 -1
- package/translations/ms.json +3 -1
- package/translations/zh.json +3 -1
|
@@ -772,7 +772,7 @@ class PurchaseOrderApprovalDetail extends connect(store)(localize(i18next)(PageV
|
|
|
772
772
|
|
|
773
773
|
if (!response.errors) {
|
|
774
774
|
this._clearView()
|
|
775
|
-
this._showToast({ message: i18next.t('purchase_order_updated') })
|
|
775
|
+
this._showToast({ message: i18next.t('text.purchase_order_updated') })
|
|
776
776
|
this._navigateToList()
|
|
777
777
|
}
|
|
778
778
|
} catch (e) {
|
|
@@ -839,6 +839,10 @@ class PurchaseOrderApprovalDetail extends connect(store)(localize(i18next)(PageV
|
|
|
839
839
|
brand
|
|
840
840
|
description
|
|
841
841
|
}
|
|
842
|
+
productDetail {
|
|
843
|
+
id
|
|
844
|
+
name
|
|
845
|
+
}
|
|
842
846
|
adjustedBatchId
|
|
843
847
|
remark
|
|
844
848
|
status
|
|
@@ -2,6 +2,7 @@ import '@things-factory/grist-ui'
|
|
|
2
2
|
import '@things-factory/biz-ui'
|
|
3
3
|
import '@things-factory/warehouse-ui'
|
|
4
4
|
import '@things-factory/import-ui/client/components/import-pop-up'
|
|
5
|
+
import '@things-factory/operato-wms/client/pages/components/select-product-popup'
|
|
5
6
|
|
|
6
7
|
import gql from 'graphql-tag'
|
|
7
8
|
import { css, html } from 'lit-element'
|
|
@@ -524,29 +525,13 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
524
525
|
width: 150
|
|
525
526
|
},
|
|
526
527
|
{
|
|
527
|
-
type: '
|
|
528
|
-
name: '
|
|
528
|
+
type: 'string',
|
|
529
|
+
name: 'productName',
|
|
529
530
|
header: i18next.t('field.product'),
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
basicArgs: {
|
|
535
|
-
filters: [{ name: 'bizplace_id', operator: 'eq', value: this._purchaseOrderData?.bizplace?.id }]
|
|
536
|
-
},
|
|
537
|
-
nameField: 'name',
|
|
538
|
-
descriptionField: 'description',
|
|
539
|
-
select: [
|
|
540
|
-
{ name: 'id', hidden: true },
|
|
541
|
-
{ name: 'sku', header: i18next.t('field.sku') },
|
|
542
|
-
{ name: 'name', header: i18next.t('field.name') },
|
|
543
|
-
{ name: 'brand', header: i18next.t('field.brand') },
|
|
544
|
-
{ name: 'description', header: i18next.t('field.description') },
|
|
545
|
-
{ name: 'packingType', header: i18next.t('field.packing_type') },
|
|
546
|
-
{ name: 'primaryUnit', header: i18next.t('field.uom') },
|
|
547
|
-
{ name: 'primaryValue', header: i18next.t('field.uom_value') }
|
|
548
|
-
],
|
|
549
|
-
list: { fields: ['sku', 'name', 'brand', 'description', 'packingType'] }
|
|
531
|
+
imex: { header: i18next.t('field.product'), key: 'productName', width: 50, type: 'string' },
|
|
532
|
+
handlers: {
|
|
533
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
534
|
+
this._openProductSelection(rowIndex)
|
|
550
535
|
}
|
|
551
536
|
},
|
|
552
537
|
width: 350
|
|
@@ -1094,6 +1079,10 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1094
1079
|
brand
|
|
1095
1080
|
description
|
|
1096
1081
|
}
|
|
1082
|
+
productDetail {
|
|
1083
|
+
id
|
|
1084
|
+
name
|
|
1085
|
+
}
|
|
1097
1086
|
adjustedBatchId
|
|
1098
1087
|
remark
|
|
1099
1088
|
status
|
|
@@ -1223,11 +1212,19 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1223
1212
|
throw new Error(i18next.t('text.container_no_is_empty'))
|
|
1224
1213
|
}
|
|
1225
1214
|
|
|
1226
|
-
_validateProducts() {
|
|
1215
|
+
_validateProducts(records = []) {
|
|
1227
1216
|
// no records
|
|
1228
|
-
|
|
1217
|
+
if (!records?.length) {
|
|
1218
|
+
records = this.productGrist.dirtyData.records
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1229
1221
|
if (!records?.length) throw new Error(i18next.t('text.no_products'))
|
|
1230
1222
|
|
|
1223
|
+
const duplicatedProducts = records.filter((item, index) => records.indexOf(item) != index)
|
|
1224
|
+
|
|
1225
|
+
if (duplicatedProducts?.length > 0)
|
|
1226
|
+
throw new Error(i18next.t('text.there_is_duplicated_products_with_same_batch_no'))
|
|
1227
|
+
|
|
1231
1228
|
const checkRequiredFields = ({ batchId, packingType, uomValue, uom }) =>
|
|
1232
1229
|
!batchId || !packingType || !uomValue || !uom
|
|
1233
1230
|
|
|
@@ -1268,6 +1265,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1268
1265
|
id: record.id || null,
|
|
1269
1266
|
batchId: record.batchId,
|
|
1270
1267
|
product: { id: record.product.id },
|
|
1268
|
+
productDetail: record.productDetailId ? { id: record.productDetailId } : { id: record.productDetail.id },
|
|
1271
1269
|
packingType: record.packingType,
|
|
1272
1270
|
uomValue: record?.uomValue ? record.uomValue : 0,
|
|
1273
1271
|
uom: record.uom,
|
|
@@ -1276,7 +1274,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1276
1274
|
remark: record?.remark || null,
|
|
1277
1275
|
discountAmt: record.discountAmt,
|
|
1278
1276
|
unitPrice:
|
|
1279
|
-
status == PURCHASE_ORDER_STATUS.DRAFT ? record.unitPrice : record.unitPrice >
|
|
1277
|
+
status == PURCHASE_ORDER_STATUS.DRAFT ? record.unitPrice : record.unitPrice > 0 ? record.unitPrice : 1,
|
|
1280
1278
|
miscAmt: record.miscAmt,
|
|
1281
1279
|
taxRate: record.taxRate
|
|
1282
1280
|
}
|
|
@@ -1498,6 +1496,20 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1498
1496
|
imex: { header: i18next.t('field.packing_type'), key: 'packingType', width: 25, type: 'string' },
|
|
1499
1497
|
width: 100
|
|
1500
1498
|
},
|
|
1499
|
+
{
|
|
1500
|
+
type: 'string',
|
|
1501
|
+
name: 'uom',
|
|
1502
|
+
header: i18next.t('field.uom'),
|
|
1503
|
+
imex: { header: i18next.t('field.uom'), key: 'uom', width: 25, type: 'string' },
|
|
1504
|
+
width: 100
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
type: 'float',
|
|
1508
|
+
name: 'uomValue',
|
|
1509
|
+
header: i18next.t('field.uom_value'),
|
|
1510
|
+
imex: { header: i18next.t('field.uom_value'), key: 'uomValue', width: 25, type: 'float' },
|
|
1511
|
+
width: 100
|
|
1512
|
+
},
|
|
1501
1513
|
{
|
|
1502
1514
|
type: 'string',
|
|
1503
1515
|
name: 'remark',
|
|
@@ -1545,6 +1557,59 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1545
1557
|
return productGrist
|
|
1546
1558
|
}
|
|
1547
1559
|
|
|
1560
|
+
_openProductSelection(rowIndex) {
|
|
1561
|
+
if (this._purchaseOrderData?.bizplace?.id) {
|
|
1562
|
+
openPopup(
|
|
1563
|
+
html`
|
|
1564
|
+
<select-product-popup
|
|
1565
|
+
.bizplaceId="${this._purchaseOrderData?.bizplace?.id}"
|
|
1566
|
+
@selected="${e => {
|
|
1567
|
+
// let newRecord = []
|
|
1568
|
+
// newRecord.push(e.detail)
|
|
1569
|
+
|
|
1570
|
+
if (this.productGrist.dirtyData.records.length !== rowIndex) {
|
|
1571
|
+
// update existing product data records
|
|
1572
|
+
this.productGrist.dirtyData.records.splice(rowIndex, 1, {
|
|
1573
|
+
...this.productGrist.dirtyData.records[rowIndex],
|
|
1574
|
+
...e.detail
|
|
1575
|
+
})
|
|
1576
|
+
|
|
1577
|
+
this.productGrist.dirtyData.records = this.productGrist.dirtyData.records.map(item => {
|
|
1578
|
+
return {
|
|
1579
|
+
...item,
|
|
1580
|
+
totalUomValue:
|
|
1581
|
+
item?.packQty > 0
|
|
1582
|
+
? item?.totalUomValue
|
|
1583
|
+
? item.totalUomValue
|
|
1584
|
+
: `${parseFloat(item.packQty * e.detail.uomValue).toFixed(2)} ${e.detail.uom}`
|
|
1585
|
+
: null
|
|
1586
|
+
}
|
|
1587
|
+
})
|
|
1588
|
+
|
|
1589
|
+
this.productData = {
|
|
1590
|
+
...this.productData,
|
|
1591
|
+
records: [...this.productGrist.dirtyData.records]
|
|
1592
|
+
}
|
|
1593
|
+
} else {
|
|
1594
|
+
this.productData = {
|
|
1595
|
+
...this.productData,
|
|
1596
|
+
records: [...this.productGrist.dirtyData.records, e.detail]
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
}}"
|
|
1600
|
+
></select-product-popup>
|
|
1601
|
+
`,
|
|
1602
|
+
{
|
|
1603
|
+
backdrop: true,
|
|
1604
|
+
size: 'large',
|
|
1605
|
+
title: i18next.t('title.select_item')
|
|
1606
|
+
}
|
|
1607
|
+
)
|
|
1608
|
+
} else {
|
|
1609
|
+
this._showToast({ message: i18next.t('text.company_selection_is_empty') })
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1548
1613
|
async _exportableData() {
|
|
1549
1614
|
try {
|
|
1550
1615
|
var headerSetting = [
|
|
@@ -1595,6 +1660,10 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1595
1660
|
primaryUnit
|
|
1596
1661
|
primaryValue
|
|
1597
1662
|
}
|
|
1663
|
+
productDetail {
|
|
1664
|
+
id
|
|
1665
|
+
name
|
|
1666
|
+
}
|
|
1598
1667
|
}
|
|
1599
1668
|
}
|
|
1600
1669
|
`,
|
|
@@ -1629,21 +1698,25 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1629
1698
|
}
|
|
1630
1699
|
|
|
1631
1700
|
async importHandler(records) {
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1701
|
+
try {
|
|
1702
|
+
this._validateProducts(records)
|
|
1703
|
+
|
|
1704
|
+
const orderProducts = records.map(record => {
|
|
1705
|
+
delete record.cuFlag
|
|
1706
|
+
delete record.id
|
|
1707
|
+
return {
|
|
1708
|
+
...record,
|
|
1709
|
+
unitPrice: record?.unitPrice > 0 ? parseFloat(record?.unitPrice) : 0,
|
|
1710
|
+
packQty: parseInt(record?.packQty) || 0,
|
|
1711
|
+
miscAmt: record?.miscAmt > 0 ? parseFloat(record?.miscAmt) : 0,
|
|
1712
|
+
discountAmt: record?.discountAmt > 0 ? parseFloat(record?.discountAmt) : 0,
|
|
1713
|
+
taxRate: record?.taxRate > 0 ? parseFloat(record?.taxRate) : 0
|
|
1714
|
+
}
|
|
1715
|
+
})
|
|
1716
|
+
await this.bulkUploadValidatePoOrderProducts(orderProducts)
|
|
1717
|
+
} catch (e) {
|
|
1718
|
+
this._showToast(e)
|
|
1719
|
+
}
|
|
1647
1720
|
history.back()
|
|
1648
1721
|
}
|
|
1649
1722
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/sales-ui",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.138",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@things-factory/code-base": "^4.3.
|
|
26
|
+
"@things-factory/code-base": "^4.3.138",
|
|
27
27
|
"@things-factory/form-ui": "^4.3.131",
|
|
28
|
-
"@things-factory/grist-ui": "^4.3.
|
|
28
|
+
"@things-factory/grist-ui": "^4.3.138",
|
|
29
29
|
"@things-factory/i18n-base": "^4.3.131",
|
|
30
|
-
"@things-factory/import-ui": "^4.3.
|
|
31
|
-
"@things-factory/sales-base": "^4.3.
|
|
32
|
-
"@things-factory/setting-ui": "^4.3.
|
|
30
|
+
"@things-factory/import-ui": "^4.3.138",
|
|
31
|
+
"@things-factory/sales-base": "^4.3.138",
|
|
32
|
+
"@things-factory/setting-ui": "^4.3.138",
|
|
33
33
|
"@things-factory/shell": "^4.3.131",
|
|
34
|
-
"@things-factory/warehouse-ui": "^4.3.
|
|
34
|
+
"@things-factory/warehouse-ui": "^4.3.138"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "1d4e0a3ff6b8792c843b9735a28a3f5fb946b144"
|
|
37
37
|
}
|
package/translations/en.json
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"text.please_select_a_valid_draft_order_to_generate_release_order": "please select a valid draft order to generate release order",
|
|
31
31
|
"text.purchase_order_form_invalid": "purchase order form invalid",
|
|
32
32
|
"text.purchase_order_saved": "purchase order saved",
|
|
33
|
+
"text.purchase_order_updated": "purchase order updated",
|
|
33
34
|
"text.release_order(s)_has_been_generated": "release order(s) has been generated",
|
|
34
35
|
"text.total_price_exceed_x_y": "total price exceed {x}{y}",
|
|
35
36
|
"text.update_draft_release_order": "update draft release order",
|
|
@@ -43,5 +44,6 @@
|
|
|
43
44
|
"title.purchase_order": "purchase order",
|
|
44
45
|
"title.purchase_orders_approval": "purchase orders approval",
|
|
45
46
|
"title.purchase_orders": "purchase orders",
|
|
47
|
+
"text.there_is_duplicated_products_with_same_batch_no": "there is duplicated products with same batch no",
|
|
46
48
|
"title.tolerance_limit": "tolerance limit"
|
|
47
49
|
}
|
package/translations/ko.json
CHANGED
|
@@ -43,5 +43,7 @@
|
|
|
43
43
|
"label.unit_price": "[ko] unit price",
|
|
44
44
|
"label.misc_amt": "[ko] misc amt",
|
|
45
45
|
"label.total_disc_amt": "[ko] total disc amt",
|
|
46
|
-
"label.tax_rate": "[ko] tax rate"
|
|
46
|
+
"label.tax_rate": "[ko] tax rate",
|
|
47
|
+
"text.purchase_order_updated": "[ko] purchase order updated",
|
|
48
|
+
"text.there_is_duplicated_products_with_same_batch_no": "[ko] there is duplicated products with same batch no"
|
|
47
49
|
}
|
package/translations/ms.json
CHANGED
|
@@ -43,5 +43,7 @@
|
|
|
43
43
|
"label.unit_price": "[ms] unit price",
|
|
44
44
|
"label.misc_amt": "[ms] misc amt",
|
|
45
45
|
"label.total_disc_amt": "[ms] total disc amt",
|
|
46
|
-
"label.tax_rate": "[ms] tax rate"
|
|
46
|
+
"label.tax_rate": "[ms] tax rate",
|
|
47
|
+
"text.purchase_order_updated": "[ms] purchase order updated",
|
|
48
|
+
"text.there_is_duplicated_products_with_same_batch_no": "[ms] there is duplicated products with same batch no"
|
|
47
49
|
}
|
package/translations/zh.json
CHANGED
|
@@ -43,5 +43,7 @@
|
|
|
43
43
|
"label.unit_price": "[zh] unit price",
|
|
44
44
|
"label.misc_amt": "[zh] misc amt",
|
|
45
45
|
"label.total_disc_amt": "[zh] total disc amt",
|
|
46
|
-
"label.tax_rate": "[zh] tax rate"
|
|
46
|
+
"label.tax_rate": "[zh] tax rate",
|
|
47
|
+
"text.purchase_order_updated": "[zh] purchase order updated",
|
|
48
|
+
"text.there_is_duplicated_products_with_same_batch_no": "[zh] there is duplicated products with same batch no"
|
|
47
49
|
}
|