优化
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.GoodsSearchDialog
|
||||||
import com.sw.inbound.dialog.Loading
|
import com.sw.inbound.dialog.Loading
|
||||||
import com.sw.inbound.dialog.WarnDialog
|
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.GoodsAddParam
|
||||||
import com.sw.inbound.model.request.PurchaseWarehouseParam
|
import com.sw.inbound.model.request.PurchaseWarehouseParam
|
||||||
import com.sw.inbound.model.request.UploadInfo
|
import com.sw.inbound.model.request.UploadInfo
|
||||||
@@ -160,6 +161,9 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1 * 1000)
|
}, 1 * 1000)
|
||||||
|
binding.btnClearZero.setOnClickListener {
|
||||||
|
SensorScaleUtils.tare()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var weightCallback: ((weight: Int) -> Unit)? = null
|
private var weightCallback: ((weight: Int) -> Unit)? = null
|
||||||
@@ -175,6 +179,9 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
// //从秤上取物品中
|
// //从秤上取物品中
|
||||||
// return
|
// return
|
||||||
//}
|
//}
|
||||||
|
if (lastWeight != weight || weight == 0) {
|
||||||
|
binding.tvTotalWeight.text = "重量:${weight}克"
|
||||||
|
}
|
||||||
if (weight < 200) {
|
if (weight < 200) {
|
||||||
if (abs(weight) < 10) {
|
if (abs(weight) < 10) {
|
||||||
// val clazzName = DialogManager.getDialogList()
|
// val clazzName = DialogManager.getDialogList()
|
||||||
@@ -190,8 +197,8 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.lastWeight = weight
|
|
||||||
if (DialogManager.hasShowDialog()) {
|
if (DialogManager.hasShowDialog()) {
|
||||||
|
this.lastWeight = weight
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// val checkResult = isFirstRecognize.not()
|
// val checkResult = isFirstRecognize.not()
|
||||||
@@ -204,7 +211,11 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
// }
|
// }
|
||||||
Timber.tag(TAG)
|
Timber.tag(TAG)
|
||||||
.d("recognizeWeight,recognizeFood:isShowRecognizeDialog=$isShowRecognizeDialog")
|
.d("recognizeWeight,recognizeFood:isShowRecognizeDialog=$isShowRecognizeDialog")
|
||||||
recognizeFood()
|
//两次相差5克内视作重量未变,不进行重新识别
|
||||||
|
if (abs(lastWeight - weight) > 5) {
|
||||||
|
recognizeFood()
|
||||||
|
}
|
||||||
|
this.lastWeight = weight
|
||||||
}
|
}
|
||||||
|
|
||||||
//var startTime = 0L
|
//var startTime = 0L
|
||||||
@@ -439,7 +450,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
item.isSelected = true
|
item.isSelected = true
|
||||||
val finalWeight = item.goodsWeight?.toDouble().plus2(goods.goodsWeight?.toDouble())
|
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 finalAmount = item.recPriceInItem.plus2(goods.recPriceInItem)
|
||||||
val finalPrice =
|
val finalPrice =
|
||||||
if (finalAmount == 0.toDouble() || finalNum == 0.toDouble()) 0.toDouble() else finalAmount / finalNum
|
if (finalAmount == 0.toDouble() || finalNum == 0.toDouble()) 0.toDouble() else finalAmount / finalNum
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ import com.sw.inbound.utils.ext.hideKeyboard
|
|||||||
abstract class BaseDialog(
|
abstract class BaseDialog(
|
||||||
context: Context,
|
context: Context,
|
||||||
var defWidth: Int = 1500.dp,
|
var defWidth: Int = 1500.dp,
|
||||||
var defHeight: Int = 900.dp
|
// var defHeight: Int = 900.dp
|
||||||
|
var defHeight: Int = 750.dp
|
||||||
) : Dialog(context, R.style.DialogTheme) {
|
) : Dialog(context, R.style.DialogTheme) {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class GoodsRecognizeDialog(
|
|||||||
// }
|
// }
|
||||||
binding.ivClose.setOnClickListener {
|
binding.ivClose.setOnClickListener {
|
||||||
dismiss()
|
dismiss()
|
||||||
activity?.delayRecognizeFood()
|
// activity?.delayRecognizeFood()
|
||||||
//activity?.startTime = System.currentTimeMillis()
|
//activity?.startTime = System.currentTimeMillis()
|
||||||
}
|
}
|
||||||
binding.btnManuallyFind.setOnClickListener {
|
binding.btnManuallyFind.setOnClickListener {
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ import com.sw.inbound.utils.CameraUtils
|
|||||||
import com.sw.inbound.utils.ImageUtil
|
import com.sw.inbound.utils.ImageUtil
|
||||||
import com.sw.inbound.utils.ext.dp
|
import com.sw.inbound.utils.ext.dp
|
||||||
import com.sw.inbound.utils.ext.gone
|
import com.sw.inbound.utils.ext.gone
|
||||||
|
import com.sw.inbound.utils.ext.hideKeyboard
|
||||||
|
import com.sw.inbound.utils.ext.invisible
|
||||||
import com.sw.inbound.utils.ext.roundedDecimalPlace
|
import com.sw.inbound.utils.ext.roundedDecimalPlace
|
||||||
import com.sw.inbound.utils.ext.toast
|
import com.sw.inbound.utils.ext.toast
|
||||||
import com.sw.inbound.utils.ext.visible
|
import com.sw.inbound.utils.ext.visible
|
||||||
@@ -103,6 +105,7 @@ class GoodsStoreDialog(
|
|||||||
// AddProcurementUnitDialog(context).show()
|
// AddProcurementUnitDialog(context).show()
|
||||||
// }
|
// }
|
||||||
binding.flUnitDropdown.setOnClickListener { v ->
|
binding.flUnitDropdown.setOnClickListener { v ->
|
||||||
|
v.hideKeyboard()
|
||||||
if (dropdownPopup == null) {
|
if (dropdownPopup == null) {
|
||||||
dropdownPopup = DropdownPopup(
|
dropdownPopup = DropdownPopup(
|
||||||
context = context,
|
context = context,
|
||||||
@@ -111,6 +114,7 @@ class GoodsStoreDialog(
|
|||||||
popHeight = min(dropdownList.size, 4) * 71.dp
|
popHeight = min(dropdownList.size, 4) * 71.dp
|
||||||
) { dictType ->
|
) { dictType ->
|
||||||
try {
|
try {
|
||||||
|
v.hideKeyboard()
|
||||||
binding.tvProcurementUnit.run {
|
binding.tvProcurementUnit.run {
|
||||||
text = dictType.value
|
text = dictType.value
|
||||||
tag = dictType.id
|
tag = dictType.id
|
||||||
@@ -164,8 +168,8 @@ class GoodsStoreDialog(
|
|||||||
addPriceInputListener(binding.etProcurementAmount) {
|
addPriceInputListener(binding.etProcurementAmount) {
|
||||||
val countText = binding.etProcurementCount.text.trim().toString()
|
val countText = binding.etProcurementCount.text.trim().toString()
|
||||||
val count = if (countText.isNotBlank()) countText.toDouble() else 0.toDouble()
|
val count = if (countText.isNotBlank()) countText.toDouble() else 0.toDouble()
|
||||||
if (count == 0.toDouble()) {
|
if (count == 0.toDouble() || it == (-1).toDouble()) {
|
||||||
//context.toast("入库数量不能为0")
|
binding.tvProcurementPrice.text = ""
|
||||||
return@addPriceInputListener
|
return@addPriceInputListener
|
||||||
}
|
}
|
||||||
val price = (it / count).roundedDecimalPlace(2)
|
val price = (it / count).roundedDecimalPlace(2)
|
||||||
@@ -198,6 +202,11 @@ class GoodsStoreDialog(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
binding.tvProcurementPrice.addTextChangedListener {
|
||||||
|
binding.tvPriceUnit.run {
|
||||||
|
if (it.isNullOrBlank()) invisible() else visible()
|
||||||
|
}
|
||||||
|
}
|
||||||
addWeightListener()
|
addWeightListener()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,6 +248,7 @@ class GoodsStoreDialog(
|
|||||||
addTextChangedListener(onTextChanged = { it, _, _, _ ->
|
addTextChangedListener(onTextChanged = { it, _, _, _ ->
|
||||||
try {
|
try {
|
||||||
if (it.isNullOrBlank()) {
|
if (it.isNullOrBlank()) {
|
||||||
|
action((-1).toDouble())
|
||||||
return@addTextChangedListener
|
return@addTextChangedListener
|
||||||
}
|
}
|
||||||
val input = it.toString()
|
val input = it.toString()
|
||||||
|
|||||||
@@ -34,7 +34,8 @@
|
|||||||
android:textColor="#141428"
|
android:textColor="#141428"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:text="冯厨子" />
|
tools:text="冯厨子"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ivLogout"
|
android:id="@+id/ivLogout"
|
||||||
@@ -43,7 +44,31 @@
|
|||||||
android:layout_marginEnd="40dp"
|
android:layout_marginEnd="40dp"
|
||||||
android:paddingHorizontal="20dp"
|
android:paddingHorizontal="20dp"
|
||||||
android:src="@mipmap/ic_logout"
|
android:src="@mipmap/ic_logout"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvTotalWeight"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingHorizontal="50dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="#FF141428"
|
||||||
|
android:textSize="24sp"
|
||||||
|
tools:text="重量:6300克" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
|
android:id="@+id/btnClearZero"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginVertical="20dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:background="@drawable/bg_white_alpha40_radius6"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="清零"
|
||||||
|
android:textColor="#FF141428"
|
||||||
|
android:textSize="24sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|||||||
@@ -22,12 +22,12 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvDialogTitle"
|
android:id="@+id/tvDialogTitle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="180dp"
|
||||||
android:text="物品识别结果"
|
android:text="物品识别结果"
|
||||||
android:textColor="#ff141428"
|
android:textColor="#ff141428"
|
||||||
android:textSize="36sp"
|
android:textSize="36sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/flContent"
|
android:gravity="center_vertical"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -39,14 +39,13 @@
|
|||||||
android:layout_marginHorizontal="30dp"
|
android:layout_marginHorizontal="30dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toBottomOf="@id/tvDialogTitle">
|
||||||
android:layout_marginTop="180dp">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rvRecognize"
|
android:id="@+id/rvRecognize"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="top|center_horizontal"
|
||||||
tools:itemCount="5"
|
tools:itemCount="5"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
tools:listitem="@layout/list_item_recognize" />
|
tools:listitem="@layout/list_item_recognize" />
|
||||||
@@ -57,7 +56,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="top|center_horizontal"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:ignore="HardcodedText,UseCompoundDrawables">
|
tools:ignore="HardcodedText,UseCompoundDrawables">
|
||||||
@@ -118,16 +117,34 @@
|
|||||||
android:textSize="30sp"
|
android:textSize="30sp"
|
||||||
android:background="@drawable/bg_blue_ripple"/>
|
android:background="@drawable/bg_blue_ripple"/>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:text="若以上识别结果都不是该物品,请点击“重新识别”或“手动查找”"
|
android:gravity="center"
|
||||||
android:textColor="#ff999999"
|
android:orientation="vertical"
|
||||||
android:textSize="30sp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@id/dividerLine"
|
app:layout_constraintTop_toBottomOf="@id/flContent"
|
||||||
android:layout_marginBottom="60dp"/>
|
app:layout_constraintBottom_toTopOf="@id/dividerLine">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="2"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="若以上识别结果都不是该物品,请点击“重新识别”或“手动查找”"
|
||||||
|
android:textColor="#ff999999"
|
||||||
|
android:textSize="30sp" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- <LinearLayout-->
|
<!-- <LinearLayout-->
|
||||||
<!-- android:layout_width="0dp"-->
|
<!-- android:layout_width="0dp"-->
|
||||||
|
|||||||
@@ -212,7 +212,8 @@
|
|||||||
android:layout_width="428dp"
|
android:layout_width="428dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="70dp"
|
||||||
android:layout_marginStart="57dp"
|
android:layout_marginStart="57dp"
|
||||||
android:background="@drawable/bg_white_radius10_stroke2">
|
android:background="@drawable/bg_gray_radius10">
|
||||||
|
<!-- bg_white_radius10_stroke2-->
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvProcurementPrice"
|
android:id="@+id/tvProcurementPrice"
|
||||||
@@ -232,6 +233,7 @@
|
|||||||
tools:ignore="Autofill,TextFields" />
|
tools:ignore="Autofill,TextFields" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tvPriceUnit"
|
||||||
android:layout_width="70dp"
|
android:layout_width="70dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="70dp"
|
||||||
android:layout_gravity="end|center_vertical"
|
android:layout_gravity="end|center_vertical"
|
||||||
@@ -239,7 +241,8 @@
|
|||||||
android:text="元"
|
android:text="元"
|
||||||
android:textColor="#ff96a0aa"
|
android:textColor="#ff96a0aa"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
android:visibility="invisible"/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user