feat(activity): StoreActivity 进入时直接弹出入库弹窗,关闭后退出页面
- InboundGoodsStoreDialog.goods 改为可空类型,支持毛菜无需预搜索直接录入 - StoreActivity 根据 storeType 自动弹出对应弹窗(毛菜→录入弹窗,净菜→检索弹窗) - GoodsListActivity.recognizeFood 标记为 open,StoreActivity override 为空以关闭识别 - 修复相机预览被 cvImageBg 白色遮罩遮挡的问题
This commit is contained in:
@@ -274,7 +274,7 @@ abstract class GoodsListActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
fun recognizeFood() {
|
||||
open fun recognizeFood() {
|
||||
if (isShowRecognizeDialog.not()) {
|
||||
if (goodsRecognizeDialog == null) {
|
||||
isShowRecognizeDialog = true
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.os.Bundle
|
||||
import androidx.activity.viewModels
|
||||
import com.sw.inbound.GlobalData
|
||||
import com.sw.inbound.dialog.InboundGoodsSearchDialog
|
||||
import com.sw.inbound.dialog.InboundGoodsStoreDialog
|
||||
import com.sw.inbound.model.response.DictType
|
||||
import com.sw.inbound.utils.ext.gone
|
||||
import com.sw.inbound.viewmodel.StoreViewModel
|
||||
@@ -22,6 +23,9 @@ class StoreActivity : GoodsListActivity() {
|
||||
/** 0=净菜,1=毛菜,由 HomeActivity 通过 Intent 传入 */
|
||||
var storeType: Int = 0
|
||||
|
||||
/** 防止 onResume 重复弹窗 */
|
||||
private var dialogShown = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
storeType = intent.getIntExtra(EXTRA_STORE_TYPE, 0)
|
||||
super.onCreate(savedInstanceState)
|
||||
@@ -31,6 +35,23 @@ class StoreActivity : GoodsListActivity() {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
preloadInboundOptions()
|
||||
if (!dialogShown) {
|
||||
dialogShown = true
|
||||
showEntryDialog()
|
||||
}
|
||||
}
|
||||
|
||||
/** 根据 storeType 弹出对应入库弹窗,dismiss 时关闭页面 */
|
||||
private fun showEntryDialog() {
|
||||
if (storeType == 1) {
|
||||
InboundGoodsStoreDialog(this, null).apply {
|
||||
setOnDismissListener { finish() }
|
||||
}.show()
|
||||
} else {
|
||||
InboundGoodsSearchDialog(this).apply {
|
||||
setOnDismissListener { finish() }
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
|
||||
/** 预加载供应商和仓库区域列表到 GlobalData,供弹窗直接使用 */
|
||||
@@ -55,6 +76,9 @@ class StoreActivity : GoodsListActivity() {
|
||||
|
||||
override fun initView() {}
|
||||
|
||||
/** 入库页面暂不需要识别功能 */
|
||||
override fun recognizeFood() {}
|
||||
|
||||
override fun getWarehouseList(): List<DictType> = emptyList()
|
||||
|
||||
/** 使用入库专用检索弹窗替代原有 GoodsSearchDialog */
|
||||
|
||||
@@ -32,7 +32,7 @@ import kotlin.math.abs
|
||||
/** 入库输入弹窗,使用 RecyclerView加载 动态表单,根据 storeType 展示净菜/毛菜对应字段 */
|
||||
class InboundGoodsStoreDialog(
|
||||
context: Context,
|
||||
private val goods: GoodsSearchModel,
|
||||
private val goods: GoodsSearchModel?,
|
||||
private val confirmBlock: () -> Unit = {}
|
||||
) : BaseDialog(context) {
|
||||
|
||||
@@ -166,7 +166,7 @@ class InboundGoodsStoreDialog(
|
||||
* expiryDate, storageTemp
|
||||
*/
|
||||
private fun buildCleanFields(): MutableList<FormField> {
|
||||
val vegTypes = goods.vegTypeList()
|
||||
val vegTypes = goods?.vegTypeList() ?: emptyList()
|
||||
val cleanTypeOptions = vegTypes.mapIndexed { index, type ->
|
||||
DictType(id = index.toString(), value = type)
|
||||
}
|
||||
@@ -179,7 +179,7 @@ class InboundGoodsStoreDialog(
|
||||
"溯源码",
|
||||
FieldType.TEXT,
|
||||
apiKey = "traceCode",
|
||||
value = goods.traceCode,
|
||||
value = goods?.traceCode ?: "",
|
||||
required = true,
|
||||
hint = "请输入溯源码"
|
||||
),
|
||||
@@ -188,7 +188,7 @@ class InboundGoodsStoreDialog(
|
||||
FieldType.FIXED,
|
||||
apiKey = "ingredientName",
|
||||
required = true,
|
||||
value = goods.materName
|
||||
value = goods?.materName ?: ""
|
||||
),
|
||||
FormField(
|
||||
"净菜类型",
|
||||
|
||||
Reference in New Issue
Block a user