添加了注释,完善了参数校验及空值处理
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
package com.sw.inbound.model.exception
|
||||
|
||||
class ApiException {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.sw.inbound.model.exception
|
||||
|
||||
|
||||
class NetException(val code: Int, override val message: String) : Exception(message)
|
||||
@@ -3,6 +3,7 @@ package com.sw.inbound.model.request
|
||||
import android.os.Parcelable
|
||||
import com.sw.inbound.GlobalData
|
||||
import com.sw.inbound.ext.toFormattedString
|
||||
import com.sw.inbound.ext.toSafeString
|
||||
import com.sw.inbound.model.response.DictType
|
||||
import com.sw.inbound.model.response.SearchGoodsInfo.Record.UnitVo
|
||||
import kotlinx.parcelize.Parcelize
|
||||
@@ -25,6 +26,9 @@ data class PurchaseWarehouseParam(
|
||||
* 入库数量
|
||||
*/
|
||||
var goodsCount: Double = 0.0,
|
||||
|
||||
// 用于数量输入框显示
|
||||
var goodsCountTemp: String = "",
|
||||
/**
|
||||
* 入库单价
|
||||
*/
|
||||
@@ -122,7 +126,7 @@ data class PurchaseWarehouseParam(
|
||||
if (goodsCount == null || goodsCount == 0.0) {
|
||||
return ""
|
||||
}
|
||||
return goodsCount.toFormattedString()
|
||||
return goodsCount.toSafeString(unitName)
|
||||
}
|
||||
|
||||
val goodsUnitPriceStr: String
|
||||
|
||||
+3
@@ -3,6 +3,9 @@ package com.sw.inbound.model.response
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* 字典类型 如仓库列表 物品类型 存储方式等
|
||||
*/
|
||||
@Parcelize
|
||||
data class DictType(
|
||||
val id: Int,
|
||||
@@ -75,12 +75,15 @@ data class GoodsInfo(
|
||||
|
||||
// 收货数量 收货入参
|
||||
var receivedNum: Float? = null,
|
||||
// 收货数量显示
|
||||
var receivedNumTemp: String = "",
|
||||
// 重量 收货入参
|
||||
var goodsWeight: BigDecimal? = null,
|
||||
|
||||
// 已调整
|
||||
var isAdjusted: Boolean = false,
|
||||
|
||||
// 选中物品的可选单位
|
||||
var unitList: List<UnitVo> = emptyList<UnitVo>()
|
||||
) : Parcelable, BaseBean() {
|
||||
|
||||
@@ -173,9 +176,25 @@ data class GoodsInfo(
|
||||
return warehouseName!!
|
||||
}
|
||||
|
||||
fun hasNull(): Boolean {
|
||||
return goodName == null || warehouseId == null ||
|
||||
purchaseUnitId == null || recUnitPriceTaxIn == null
|
||||
|| receiveCount == null || recPriceExItem == null
|
||||
fun hasNullField(): String? {
|
||||
if (warehouseId == null) {
|
||||
return "请选择仓库"
|
||||
}
|
||||
if (receivedNum == null || receivedNum == 0f) {
|
||||
return "请输入收货数量或进行称重"
|
||||
}
|
||||
if (recUnitPriceTaxIn == null || recUnitPriceTaxIn == 0f) {
|
||||
return "请输入收货单价"
|
||||
}
|
||||
if (recPriceExItem == null || recPriceExItem == 0f) {
|
||||
return "请输入收货金额"
|
||||
}
|
||||
if (goodsWeight == null || goodsWeight == BigDecimal(0)) {
|
||||
return "请放入要称重的物品"
|
||||
}
|
||||
return null
|
||||
// return goodName == null || warehouseId == null ||
|
||||
// purchaseUnitId == null || recUnitPriceTaxIn == null
|
||||
// || receiveCount == null || recPriceExItem == null
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@ import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* 物品类型
|
||||
*/
|
||||
@Parcelize
|
||||
data class GoodsType(
|
||||
@SerializedName("allType")
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.sw.inbound.model.response
|
||||
|
||||
/**
|
||||
* 采购详情
|
||||
*/
|
||||
data class PurchaseInfo(
|
||||
/**
|
||||
* 单据id
|
||||
@@ -12,21 +15,22 @@ data class PurchaseInfo(
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
var supplierName: String = "",
|
||||
var supplierName: String? = "",
|
||||
/**
|
||||
* 采购单号
|
||||
*/
|
||||
var purCode: String = "",
|
||||
var purCode: String? = "",
|
||||
/**
|
||||
* 收货单号
|
||||
*/
|
||||
var receiveCode: String = "",
|
||||
var receiveCode: String? = "",
|
||||
|
||||
/**
|
||||
* 物品信息
|
||||
*/
|
||||
var receiveGoodsInfoList: List<GoodsInfo> = emptyList<GoodsInfo>()
|
||||
) : BaseBean() {
|
||||
var receiveGoodsInfoList: List<GoodsInfo> = emptyList<GoodsInfo>(),
|
||||
// 自用
|
||||
var warehouseName: String = "选择仓库"
|
||||
) : BaseBean() {
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* 搜索商品结果
|
||||
*/
|
||||
@Parcelize
|
||||
data class SearchGoodsInfo(
|
||||
@SerializedName("current")
|
||||
@@ -60,7 +63,7 @@ data class SearchGoodsInfo(
|
||||
* 采购单位列表
|
||||
*/
|
||||
@SerializedName("unitVoList")
|
||||
val unitVoList: List<UnitVo>? = listOf(),
|
||||
val unitVoList: List<UnitVo>? = null,
|
||||
@SerializedName("zjmCode")
|
||||
val zjmCode: String? = ""
|
||||
) : Parcelable {
|
||||
|
||||
@@ -5,6 +5,9 @@ import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* 采购信息
|
||||
*/
|
||||
@Parcelize
|
||||
data class SupplierInfo(
|
||||
@SerializedName("createTime")
|
||||
|
||||
Reference in New Issue
Block a user