refactor(inbound): 将净材相关功能调整为净菜入库功能
- 将界面中的"净材"文本全部替换为"净菜" - 更新按钮ID命名从btnOrderPurchase改为btnCleanDishStore - 更新毛菜按钮ID从btnOrderSelfProcurement改为btnRawDishStore - 修改入库弹窗类注释说明,将净材改为净菜 - 更新storeType参数说明,将净材改为净菜 - 重构动态表单字段配置,统一字段提示文本为"请输入/请选择"格式 - 将净菜类型字段设置为固定类型并添加规格下拉选项 - 更新RecyclerView设置方式,优化代码结构 - 调整标题显示逻辑,根据入库类型动态显示净菜或毛菜入库 - 优化相机预览布局,隐藏图片背景视图 - 更新StoreActivity中关于净菜类型的注释说明
This commit is contained in:
@@ -108,15 +108,15 @@ class HomeActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 净材按钮点击提示
|
// 净菜按钮点击提示
|
||||||
binding.btnOrderPurchase.setOnClickListener {
|
binding.btnCleanDishStore.setOnClickListener {
|
||||||
startActivity<StoreActivity> {
|
startActivity<StoreActivity> {
|
||||||
putExtra(StoreActivity.EXTRA_STORE_TYPE, 0)
|
putExtra(StoreActivity.EXTRA_STORE_TYPE, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 毛菜按钮点击提示
|
// 毛菜按钮点击提示
|
||||||
binding.btnOrderSelfProcurement.setOnClickListener {
|
binding.btnRawDishStore.setOnClickListener {
|
||||||
startActivity<StoreActivity> {
|
startActivity<StoreActivity> {
|
||||||
putExtra(StoreActivity.EXTRA_STORE_TYPE, 1)
|
putExtra(StoreActivity.EXTRA_STORE_TYPE, 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class StoreActivity : GoodsListActivity() {
|
|||||||
|
|
||||||
val storeViewModel: StoreViewModel by viewModels()
|
val storeViewModel: StoreViewModel by viewModels()
|
||||||
|
|
||||||
/** 0=净材,1=毛菜,由 HomeActivity 通过 Intent 传入 */
|
/** 0=净菜,1=毛菜,由 HomeActivity 通过 Intent 传入 */
|
||||||
var storeType: Int = 0
|
var storeType: Int = 0
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.Date
|
|||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
/** 入库录入弹窗,使用 FlexboxLayoutManager 动态表单,根据 storeType 展示净材/毛菜对应字段 */
|
/** 入库输入弹窗,使用 RecyclerView加载 动态表单,根据 storeType 展示净菜/毛菜对应字段 */
|
||||||
class InboundGoodsStoreDialog(
|
class InboundGoodsStoreDialog(
|
||||||
context: Context,
|
context: Context,
|
||||||
private val goods: GoodsSearchModel,
|
private val goods: GoodsSearchModel,
|
||||||
@@ -41,7 +41,7 @@ class InboundGoodsStoreDialog(
|
|||||||
|
|
||||||
private var storeActivity: StoreActivity? = null
|
private var storeActivity: StoreActivity? = null
|
||||||
|
|
||||||
/** 0=净材,1=毛菜 */
|
/** 0=净菜,1=毛菜 */
|
||||||
private var storeType: Int = 0
|
private var storeType: Int = 0
|
||||||
|
|
||||||
private var realWeight: Int = 0
|
private var realWeight: Int = 0
|
||||||
@@ -92,25 +92,75 @@ class InboundGoodsStoreDialog(
|
|||||||
DictType(id = id, value = zone.zoneName)
|
DictType(id = id, value = zone.zoneName)
|
||||||
}
|
}
|
||||||
return mutableListOf(
|
return mutableListOf(
|
||||||
FormField("溯源码", FieldType.TEXT, apiKey = "traceCode", value = goods.traceCode, required = true, hint = "请录入溯源码"),
|
FormField(
|
||||||
FormField("来源类型", FieldType.DROPDOWN, apiKey = "", options = listOf(
|
"溯源码",
|
||||||
DictType("0", "手动录入"), DictType("1", "系统识别")
|
FieldType.TEXT,
|
||||||
)),
|
apiKey = "traceCode",
|
||||||
FormField("食材名称", FieldType.FIXED, apiKey = "materialName", required = true, value = goods.materName),
|
value = "",
|
||||||
FormField("供应商", FieldType.DROPDOWN, apiKey = "supplierId", required = true,
|
required = true,
|
||||||
hint = "请选择供应商", options = supplierOptions, submitValueId = true),
|
hint = "请输入溯源码"
|
||||||
FormField("入库规格", FieldType.TEXT, apiKey = "spec", required = true, hint = "请录入入库规格"),
|
),
|
||||||
FormField("入库数量", FieldType.NUMBER, apiKey = "quantity", required = true, hint = "请录入入库数量"),
|
FormField(
|
||||||
FormField("入库时间", FieldType.DATE_PICKER, apiKey = "inboundTime", required = true,
|
"来源类型", FieldType.DROPDOWN, apiKey = "", options = listOf(
|
||||||
hint = "请选择入库时间", submitValueId = true),
|
DictType("0", "外采"), DictType("1", "自产")
|
||||||
FormField("存放区域", FieldType.DROPDOWN, apiKey = "zoneId", required = true,
|
)
|
||||||
hint = "请选择存放区域", options = zoneOptions, submitValueId = true),
|
),
|
||||||
FormField("操作人", FieldType.TEXT, apiKey = "operator", value = GlobalData.user?.name ?: "")
|
FormField(
|
||||||
|
"食材名称",
|
||||||
|
FieldType.DROPDOWN,
|
||||||
|
apiKey = "materialName",
|
||||||
|
required = true,
|
||||||
|
value = "",
|
||||||
|
hint = "请选择食材名称"
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"供应商", FieldType.DROPDOWN, apiKey = "supplierId", required = true,
|
||||||
|
hint = "请选择供应商", options = supplierOptions, submitValueId = true
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"入库规格",
|
||||||
|
FieldType.TEXT,
|
||||||
|
apiKey = "spec",
|
||||||
|
required = true,
|
||||||
|
hint = "请输入入库规格"
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"入库数量",
|
||||||
|
FieldType.NUMBER,
|
||||||
|
apiKey = "quantity",
|
||||||
|
required = true,
|
||||||
|
hint = "请输入入库数量"
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"入库时间",
|
||||||
|
FieldType.DATE_PICKER,
|
||||||
|
apiKey = "inboundTime",
|
||||||
|
required = true,
|
||||||
|
hint = "请选择入库时间",
|
||||||
|
submitValueId = true
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"存放区域",
|
||||||
|
FieldType.DROPDOWN,
|
||||||
|
apiKey = "zoneId",
|
||||||
|
required = true,
|
||||||
|
hint = "请选择存放区域",
|
||||||
|
options = zoneOptions,
|
||||||
|
submitValueId = true
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"操作人",
|
||||||
|
FieldType.TEXT,
|
||||||
|
apiKey = "operator",
|
||||||
|
value = GlobalData.user?.name ?: "",
|
||||||
|
required = true,
|
||||||
|
hint = "请输入操作人"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 净材字段列表
|
* 净菜字段列表
|
||||||
* 接口字段:traceCode, ingredientName, cleanType, spec, quantity,
|
* 接口字段:traceCode, ingredientName, cleanType, spec, quantity,
|
||||||
* weight(额外注入), inboundTime(额外注入当前时间), zoneId, operator,
|
* weight(额外注入), inboundTime(额外注入当前时间), zoneId, operator,
|
||||||
* expiryDate, storageTemp
|
* expiryDate, storageTemp
|
||||||
@@ -125,30 +175,94 @@ class InboundGoodsStoreDialog(
|
|||||||
DictType(id = id, value = zone.zoneName)
|
DictType(id = id, value = zone.zoneName)
|
||||||
}
|
}
|
||||||
return mutableListOf(
|
return mutableListOf(
|
||||||
FormField("溯源码", FieldType.TEXT, apiKey = "traceCode", value = goods.traceCode, required = true, hint = "请录入溯源码"),
|
FormField(
|
||||||
FormField("食材名称", FieldType.FIXED, apiKey = "ingredientName", required = true, value = goods.materName),
|
"溯源码",
|
||||||
FormField("净材类型", FieldType.DROPDOWN, apiKey = "cleanType",
|
FieldType.TEXT,
|
||||||
required = cleanTypeOptions.isNotEmpty(), hint = "请选择净材类型", options = cleanTypeOptions),
|
apiKey = "traceCode",
|
||||||
FormField("入库规格", FieldType.TEXT, apiKey = "spec", required = true, hint = "请录入入库规格"),
|
value = goods.traceCode,
|
||||||
FormField("入库数量", FieldType.NUMBER, apiKey = "quantity", required = true, hint = "请录入入库数量"),
|
required = true,
|
||||||
FormField("保质期至", FieldType.DATE_PICKER, apiKey = "expiryDate",
|
hint = "请输入溯源码"
|
||||||
hint = "请选择保质期", submitValueId = true),
|
),
|
||||||
FormField("存放区域", FieldType.DROPDOWN, apiKey = "zoneId", required = true,
|
FormField(
|
||||||
hint = "请选择存放区域", options = zoneOptions, submitValueId = true),
|
"食材名称",
|
||||||
FormField("存放温度(℃)", FieldType.NUMBER, apiKey = "storageTemp"),
|
FieldType.FIXED,
|
||||||
FormField("操作人", FieldType.TEXT, apiKey = "operator", value = GlobalData.user?.name ?: "")
|
apiKey = "ingredientName",
|
||||||
|
required = true,
|
||||||
|
value = goods.materName
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"净菜类型",
|
||||||
|
FieldType.FIXED,
|
||||||
|
required = true,
|
||||||
|
apiKey = "cleanType",
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"入库规格",
|
||||||
|
FieldType.DROPDOWN,
|
||||||
|
apiKey = "spec",
|
||||||
|
required = true,
|
||||||
|
hint = "请选择入库规格",
|
||||||
|
options = listOf(
|
||||||
|
DictType("0", "袋装/500g"),
|
||||||
|
DictType("1", "袋装/300g"),
|
||||||
|
DictType("1", "瓶装/800ml"),
|
||||||
|
DictType("1", "瓶装/500ml"),
|
||||||
|
DictType("1", "其它"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"入库数量",
|
||||||
|
FieldType.NUMBER,
|
||||||
|
apiKey = "quantity",
|
||||||
|
required = true,
|
||||||
|
hint = "请输入入库数量"
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"保质期至",
|
||||||
|
FieldType.DATE_PICKER,
|
||||||
|
apiKey = "expiryDate",
|
||||||
|
hint = "请选择保质期",
|
||||||
|
submitValueId = true
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"存放区域",
|
||||||
|
FieldType.DROPDOWN,
|
||||||
|
apiKey = "zoneId",
|
||||||
|
required = true,
|
||||||
|
hint = "请选择存放区域",
|
||||||
|
options = zoneOptions,
|
||||||
|
submitValueId = true
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"存放温度(℃)",
|
||||||
|
FieldType.NUMBER,
|
||||||
|
apiKey = "storageTemp"
|
||||||
|
),
|
||||||
|
FormField(
|
||||||
|
"操作人",
|
||||||
|
FieldType.TEXT,
|
||||||
|
apiKey = "operator",
|
||||||
|
value = GlobalData.user?.name ?: "",
|
||||||
|
required = true,
|
||||||
|
hint = "请输入操作人"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupRecyclerView() {
|
private fun setupRecyclerView() {
|
||||||
binding.rvFormFields.layoutManager = GridLayoutManager(context, 2)
|
binding.rvFormFields.run {
|
||||||
binding.rvFormFields.adapter = FormFieldAdapter(storeActivity ?: context, fields)
|
layoutManager = GridLayoutManager(context, 2)
|
||||||
|
adapter = FormFieldAdapter(storeActivity ?: context, fields)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupButtons() {
|
private fun setupButtons() {
|
||||||
binding.btnCancel.setOnClickListener { dismiss() }
|
binding.btnCancel.setOnClickListener { dismiss() }
|
||||||
binding.btnConfirm.setOnClickListener { confirmInputData() }
|
binding.btnConfirm.setOnClickListener { confirmInputData() }
|
||||||
binding.tvTitle.setOnClickListener { SensorScaleUtils.startScale(autoScale = true) }
|
binding.tvTitle.run {
|
||||||
|
text = if (storeType == 1) "毛菜入库" else "净菜入库"
|
||||||
|
setOnClickListener { SensorScaleUtils.startScale(autoScale = true) }
|
||||||
|
}
|
||||||
binding.btnClearZero.setOnClickListener { SensorScaleUtils.tare() }
|
binding.btnClearZero.setOnClickListener { SensorScaleUtils.tare() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,8 +276,16 @@ class InboundGoodsStoreDialog(
|
|||||||
|
|
||||||
private fun buildWeightSpannable(num: Int): SpannableStringBuilder {
|
private fun buildWeightSpannable(num: Int): SpannableStringBuilder {
|
||||||
return buildSpannableString {
|
return buildSpannableString {
|
||||||
appendText(num.toString(), ForegroundColorSpan("#FF141428".toColorInt()), StyleSpan(Typeface.BOLD))
|
appendText(
|
||||||
appendText(" 克", ForegroundColorSpan("#FF000033".toColorInt()), StyleSpan(Typeface.BOLD))
|
num.toString(),
|
||||||
|
ForegroundColorSpan("#FF141428".toColorInt()),
|
||||||
|
StyleSpan(Typeface.BOLD)
|
||||||
|
)
|
||||||
|
appendText(
|
||||||
|
" 克",
|
||||||
|
ForegroundColorSpan("#FF000033".toColorInt()),
|
||||||
|
StyleSpan(Typeface.BOLD)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,6 +377,7 @@ class InboundGoodsStoreDialog(
|
|||||||
takePhotoBinding?.let {
|
takePhotoBinding?.let {
|
||||||
previewView = it.previewView
|
previewView = it.previewView
|
||||||
it.flCameraPreview.visibility = View.VISIBLE
|
it.flCameraPreview.visibility = View.VISIBLE
|
||||||
|
it.cvImageBg.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,14 +115,14 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<!-- 净材入库入口 -->
|
<!-- 净菜入库入口 -->
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnOrderPurchase"
|
android:id="@+id/btnCleanDishStore"
|
||||||
android:layout_width="595dp"
|
android:layout_width="595dp"
|
||||||
android:layout_height="477dp"
|
android:layout_height="477dp"
|
||||||
android:background="@drawable/bg_gradient_blue_btn"
|
android:background="@drawable/bg_gradient_blue_btn"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:text="净材"
|
android:text="净菜"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="100sp"
|
android:textSize="100sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
|
|
||||||
<!-- 毛菜入库入口 -->
|
<!-- 毛菜入库入口 -->
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnOrderSelfProcurement"
|
android:id="@+id/btnRawDishStore"
|
||||||
android:layout_width="595dp"
|
android:layout_width="595dp"
|
||||||
android:layout_height="477dp"
|
android:layout_height="477dp"
|
||||||
android:background="@drawable/bg_gradient_orange_btn"
|
android:background="@drawable/bg_gradient_orange_btn"
|
||||||
|
|||||||
Reference in New Issue
Block a user