添加物品单位功能

This commit is contained in:
zxj
2025-08-05 16:57:03 +08:00
parent d99c0e6e79
commit 1ac73df8d9
@@ -193,13 +193,6 @@ class SelfProcurementViewModel @Inject constructor(
}
}
fun updateAddPurchaseUnitDialog(show: Boolean) {
_showAddPurchaseUnitDialog.value = show
if (!show) {
_goodsAddUnitParam.value = GoodsPurchaseUnitParam()
}
}
fun updateSelectedItem(purchaseOrder: PurchaseWarehouseParam?) {
if (purchaseOrder != null) {
if (purchaseOrder.goodsCount != 0.0) {
@@ -388,13 +381,20 @@ class SelfProcurementViewModel @Inject constructor(
}
}
fun updateAddPurchaseUnitDialog(show: Boolean) {
_showAddPurchaseUnitDialog.value = show
if (show) {
val hasUnitId = GlobalData.unitTypeList.any { it.id == _selectedItem.value?.kcUnitId }
_dropdownTextChange.value = !hasUnitId
} else {
_goodsAddUnitParam.value = GoodsPurchaseUnitParam()
}
}
fun updateGoodsPurchaseUnit(goodsPurchaseUnitParam: GoodsPurchaseUnitParam?) {
if (goodsPurchaseUnitParam == null) {
_dropdownTextChange.value = true
_goodsAddUnitParam.value = GoodsPurchaseUnitParam()
} else {
val hasUnitId = GlobalData.unitTypeList.any { it.id == goodsPurchaseUnitParam.unitId }
_dropdownTextChange.value = !hasUnitId
_goodsAddUnitParam.value = goodsPurchaseUnitParam
}
}