优化提交菜品时重量累加问题、其它优化
This commit is contained in:
@@ -13,12 +13,12 @@ object UrlConfig {
|
||||
*/
|
||||
const val DEVICE_CONFIG = "${DEVICE_BASE_URL}/equipment/stEquipment/queryByEquipmentCode"
|
||||
|
||||
const val BASE_URL = "http://vip.shuziweidao.com/shuwei-zhct"
|
||||
// const val BASE_URL = "http://vip.shuziweidao.com/shuwei-zhct"
|
||||
// const val DISH_DETAIL = "$BASE_URL/scales/goodsUseList?foodId={foodId}&foodWeight={foodWeight}"
|
||||
// const val DISH_LIST = "$BASE_URL/scales/getRestInfoFoods?eaId=99&type=0&foodName"
|
||||
|
||||
// const val BASE_URL = "http://192.168.1.207:9102"
|
||||
// const val BASE_URL = "https://yyjk.shuziweidao.com/gateway"
|
||||
const val BASE_URL = "https://yyjk.shuziweidao.com/gateway"
|
||||
// const val DISH_LIST = "$BASE_URL/scales/getRestInfoFoods?eaId=99&type=0&foodName"
|
||||
|
||||
|
||||
|
||||
@@ -156,34 +156,18 @@ class DishSamplingActivity : BaseActivity() {
|
||||
LinearLayoutManager(this@DishSamplingActivity, LinearLayoutManager.VERTICAL, false)
|
||||
adapter = dishAdapter
|
||||
}
|
||||
|
||||
binding.etInputDishType.addOnActionSearchListener {
|
||||
searchDishType()
|
||||
}
|
||||
binding.ivDishTypeSearch.setOnClickListener {
|
||||
val inputText = binding.etInputDishType.text.toString().trim()
|
||||
BottomDialog(goodsType = 0, defGoodsName = inputText).show(this@DishSamplingActivity) { item ->
|
||||
val filterResult = list.firstOrNull { it.goodsName == item.goodsName }
|
||||
if (filterResult != null) {
|
||||
toast("不允许重复添加同一食材")
|
||||
return@show
|
||||
}
|
||||
binding.etInputDishType.setText(item.goodsName)
|
||||
tempDishEntity = CookFoodGoodsEntity().apply {
|
||||
goodsId = item.goodsId
|
||||
goodsName = item.goodsName
|
||||
|
||||
relateionType = item.relateionType ?: 0
|
||||
goodsOrRelationCode = item.goodsOrRelationCode
|
||||
|
||||
// TODO: 待定
|
||||
//allEdible = item.allEdible
|
||||
}
|
||||
}
|
||||
searchDishType()
|
||||
}
|
||||
|
||||
binding.ivWeightClear.setOnClickListener {
|
||||
WeightUtil.tareTwo(AddressUtil.ONE)
|
||||
}
|
||||
WeightUtil.addWeightListener(getWeight = { address, state, weight ->
|
||||
Log.d(TAG, "addViewClickListener: address=$address,state=$state,weight=$weight")
|
||||
//Log.d(TAG, "addViewClickListener: address=$address,state=$state,weight=$weight")
|
||||
if (address == AddressUtil.ONE) {
|
||||
tempDishEntity?.useWeight = weight.toDouble()
|
||||
binding.tvDishPartWeight.text = "${weight}"
|
||||
@@ -276,4 +260,27 @@ class DishSamplingActivity : BaseActivity() {
|
||||
}
|
||||
KeyboardUtil.hideKeyboard(v.context, v)
|
||||
}
|
||||
|
||||
private fun searchDishType() {
|
||||
val inputText = binding.etInputDishType.text.toString().trim()
|
||||
BottomDialog(goodsType = 0, defGoodsName = inputText).show(this@DishSamplingActivity) { item ->
|
||||
val filterResult = list.firstOrNull { it.goodsName == item.goodsName }
|
||||
if (filterResult != null) {
|
||||
toast("不允许重复添加同一食材")
|
||||
return@show
|
||||
}
|
||||
binding.etInputDishType.setText(item.goodsName)
|
||||
tempDishEntity = CookFoodGoodsEntity().apply {
|
||||
goodsId = item.goodsId
|
||||
goodsName = item.goodsName
|
||||
|
||||
relateionType = item.relateionType ?: 0
|
||||
goodsOrRelationCode = item.goodsOrRelationCode
|
||||
|
||||
// TODO: 待定
|
||||
//allEdible = item.allEdible
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,8 +46,9 @@ class InitActivity : BaseActivity() {
|
||||
setHeaderBackground(isHomePage = true)
|
||||
|
||||
// 获取 ANDROID_ID
|
||||
val androidId =
|
||||
var androidId =
|
||||
Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID)
|
||||
androidId = "39a7abdd06b3c7ab"
|
||||
BaseApp.deviceId = androidId
|
||||
SpTool.put(SpTool.DEVICE_ID, androidId)
|
||||
BaseApp.configUrl = UrlConfig.BASE_URL
|
||||
|
||||
@@ -77,7 +77,7 @@ class PrepareCookActivity : BaseActivity() {
|
||||
WeightUtil.tareTwo(AddressUtil.ONE)
|
||||
}
|
||||
WeightUtil.addWeightListener(getWeight = { address, state, weight ->
|
||||
Log.d(TAG, "addViewClickListener: address=$address,state=$state,weight=$weight")
|
||||
//Log.d(TAG, "addViewClickListener: address=$address,state=$state,weight=$weight")
|
||||
if (address == AddressUtil.ONE) {
|
||||
binding.tvDishPartWeight.text = "${weight}"
|
||||
}
|
||||
|
||||
@@ -212,7 +212,8 @@ class SubmitFoodActivity : BaseActivity() {
|
||||
private fun getCookingSeasoning(address: Int): Double {
|
||||
if (isCooking.not()) return 0.toDouble()
|
||||
if (seasoningItems.isEmpty()) return 0.toDouble()
|
||||
val weight = seasoningItems[weightRelateArray2.get(address)].useWeight ?: 0.toDouble()
|
||||
// val weight = seasoningItems[weightRelateArray2.get(address)].useWeight ?: 0.toDouble()
|
||||
val weight = seasoningCookingItems?.get(weightRelateArray2.get(address))?.useWeight ?: 0.toDouble()
|
||||
//Log.i(TAG, "getCookingSeasoning: weight[${address}]=$weight,seasoningList=${seasoningList.toJsonString()}")
|
||||
return weight
|
||||
}
|
||||
@@ -408,11 +409,13 @@ class SubmitFoodActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
private var seasoningItems = mutableListOf<SeasoningEntity>()
|
||||
private var seasoningCookingItems: List<SeasoningEntity> ?= null
|
||||
private fun loadTextCell(list: MutableList<SeasoningEntity>) {
|
||||
seasoningItems.clear()
|
||||
seasoningItems.addAll(list)
|
||||
initConfigData()
|
||||
setGridData(list)
|
||||
seasoningCookingItems = seasoningItems.map { it.copy() }.toList()
|
||||
}
|
||||
|
||||
private fun initConfigData() {
|
||||
|
||||
@@ -83,6 +83,8 @@
|
||||
android:hint="@string/dish_search_hint2"
|
||||
android:textColor="@color/black333"
|
||||
android:textColorHint="@color/gray_c8"
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="text"
|
||||
android:textSize="28sp"
|
||||
android:maxLines="1"
|
||||
android:paddingEnd="6dp"
|
||||
|
||||
Reference in New Issue
Block a user