添加物品单位功能
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.sw.inbound.model.request
|
||||
|
||||
import com.sw.inbound.GlobalData
|
||||
|
||||
data class GoodsPurchaseUnitParam(
|
||||
val goodsId: Int = 0,// 物品id integer ,
|
||||
val purchaseUnit: Int = 0, // 采购单位 integer ,
|
||||
val unitId: Int = 0, // 库存单位id integer,
|
||||
val purchaseValue: Float = 0f, // 单位转换值 float
|
||||
) {
|
||||
|
||||
val unitIdStr: String
|
||||
get() {
|
||||
if (unitId == 0) return ""
|
||||
return GlobalData.unitTypeList.find { it.id == unitId }?.value ?: ""
|
||||
}
|
||||
|
||||
val purchaseUnitStr: String
|
||||
get() {
|
||||
if (purchaseUnit == 0) {
|
||||
return ""
|
||||
}
|
||||
return GlobalData.unitTypeList.find { it.id == purchaseUnit }?.value ?: ""
|
||||
}
|
||||
|
||||
fun hasNullField(): String? {
|
||||
if (goodsId == null || goodsId == 0)
|
||||
return "物品信息异常"
|
||||
if (unitId == null || unitId == 0) {
|
||||
return "请选择库存单位"
|
||||
}
|
||||
if (purchaseUnit == null || purchaseUnit == 0) {
|
||||
return "请选择采购单位"
|
||||
}
|
||||
if (purchaseValue == null || purchaseValue == 0f) {
|
||||
return "请输入采购单位对应的库存数量"
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -113,13 +113,12 @@ data class PurchaseWarehouseParam(
|
||||
get() {
|
||||
return if (unitList == null) emptyList()
|
||||
else {
|
||||
unitList!!.map {
|
||||
DictType(it.businessUnitId!!.toInt(), it.purchaseUnitName!!)
|
||||
unitList!!.filter { it.businessUnitId != null && it.purchaseUnitName != null }.map {
|
||||
DictType(it.businessUnitId?.toInt() ?: 0, it.purchaseUnitName ?: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val unitNameStr: String
|
||||
get() {
|
||||
if (unitName == null) return ""
|
||||
|
||||
Reference in New Issue
Block a user