package com.lukouguoji.module_base.bean

import androidx.databinding.ObservableArrayList

class GjjTallyDetailsBean(
    var carID: String? = "",
    var isBatch: String? = "",
    var list: String? = "",
    var mfId: String? = "",
    var no: String? = "",
    var organizationcode: String? = "",
    var pc: String? = "",
    var pcID: String? = "",
    var prefix: String? = "",
    var weight: String? = ""
) {

    // 件号列表
    var jianList: ObservableArrayList<JianBean> = ObservableArrayList<JianBean>()

    fun initJianList() {
        jianList.clear()
        if (list.isNullOrEmpty()) {
            return
        }
        val listArr = list!!.split(",")
        listArr.forEach {
            addJian(it)
        }
    }

    fun addJian(code: String) {
        if (code.isEmpty() || code.toInt() <= 0) {
            return
        }
        val codeIntStr = code.toInt().toString()
        if (jianList.find { b -> b.code == codeIntStr } == null) {
            jianList.add(JianBean(codeIntStr, code))
        }
    }

}