优化
This commit is contained in:
@@ -25,6 +25,7 @@ import com.sw.inbound.dialog.GoodsRecognizeDialog
|
||||
import com.sw.inbound.dialog.GoodsSearchDialog
|
||||
import com.sw.inbound.dialog.Loading
|
||||
import com.sw.inbound.dialog.WarnDialog
|
||||
import com.sw.inbound.ext.toSafeDouble
|
||||
import com.sw.inbound.model.request.GoodsAddParam
|
||||
import com.sw.inbound.model.request.PurchaseWarehouseParam
|
||||
import com.sw.inbound.model.request.UploadInfo
|
||||
@@ -160,6 +161,9 @@ abstract class GoodsListActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
}, 1 * 1000)
|
||||
binding.btnClearZero.setOnClickListener {
|
||||
SensorScaleUtils.tare()
|
||||
}
|
||||
}
|
||||
|
||||
private var weightCallback: ((weight: Int) -> Unit)? = null
|
||||
@@ -175,6 +179,9 @@ abstract class GoodsListActivity : ComponentActivity() {
|
||||
// //从秤上取物品中
|
||||
// return
|
||||
//}
|
||||
if (lastWeight != weight || weight == 0) {
|
||||
binding.tvTotalWeight.text = "重量:${weight}克"
|
||||
}
|
||||
if (weight < 200) {
|
||||
if (abs(weight) < 10) {
|
||||
// val clazzName = DialogManager.getDialogList()
|
||||
@@ -190,8 +197,8 @@ abstract class GoodsListActivity : ComponentActivity() {
|
||||
}
|
||||
return
|
||||
}
|
||||
this.lastWeight = weight
|
||||
if (DialogManager.hasShowDialog()) {
|
||||
this.lastWeight = weight
|
||||
return
|
||||
}
|
||||
// val checkResult = isFirstRecognize.not()
|
||||
@@ -204,7 +211,11 @@ abstract class GoodsListActivity : ComponentActivity() {
|
||||
// }
|
||||
Timber.tag(TAG)
|
||||
.d("recognizeWeight,recognizeFood:isShowRecognizeDialog=$isShowRecognizeDialog")
|
||||
recognizeFood()
|
||||
//两次相差5克内视作重量未变,不进行重新识别
|
||||
if (abs(lastWeight - weight) > 5) {
|
||||
recognizeFood()
|
||||
}
|
||||
this.lastWeight = weight
|
||||
}
|
||||
|
||||
//var startTime = 0L
|
||||
@@ -439,7 +450,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
||||
}
|
||||
item.isSelected = true
|
||||
val finalWeight = item.goodsWeight?.toDouble().plus2(goods.goodsWeight?.toDouble())
|
||||
val finalNum = item.receivedNum.plus2(goods.receivedNum)
|
||||
val finalNum = item.receivedNum.plus2(goods.receivedNum).toSafeDouble(item.unitName)
|
||||
val finalAmount = item.recPriceInItem.plus2(goods.recPriceInItem)
|
||||
val finalPrice =
|
||||
if (finalAmount == 0.toDouble() || finalNum == 0.toDouble()) 0.toDouble() else finalAmount / finalNum
|
||||
|
||||
Reference in New Issue
Block a user