采购列表和入库列表页支持修改数量和价格;识别弹窗关闭及延迟识别;入库页面逻辑优化;提交未选择仓库时提示优化;
This commit is contained in:
@@ -113,7 +113,9 @@ class FoodCollectionActivity : ComponentActivity() {
|
|||||||
binding = ActivityFoodCollectionBinding.inflate(layoutInflater)
|
binding = ActivityFoodCollectionBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
cameraUtils.initCamera()
|
cameraUtils.initCamera()
|
||||||
binding.root.hideKeyboard()
|
binding.root.setOnClickListener {
|
||||||
|
it.hideKeyboard()
|
||||||
|
}
|
||||||
val previewBinding =
|
val previewBinding =
|
||||||
LayoutCameraPreviewBinding.inflate(layoutInflater, binding.flCameraPreview)
|
LayoutCameraPreviewBinding.inflate(layoutInflater, binding.flCameraPreview)
|
||||||
previewView = previewBinding.previewView.also {
|
previewView = previewBinding.previewView.also {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.sw.inbound.activity
|
package com.sw.inbound.activity
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.SpannableStringBuilder
|
import android.text.SpannableStringBuilder
|
||||||
@@ -21,7 +22,6 @@ import com.sw.inbound.dialog.DropdownPopup
|
|||||||
import com.sw.inbound.dialog.GoodsRecognizeDialog
|
import com.sw.inbound.dialog.GoodsRecognizeDialog
|
||||||
import com.sw.inbound.dialog.GoodsSearchDialog
|
import com.sw.inbound.dialog.GoodsSearchDialog
|
||||||
import com.sw.inbound.dialog.NotReceiptWarnDialog
|
import com.sw.inbound.dialog.NotReceiptWarnDialog
|
||||||
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
|
||||||
@@ -36,6 +36,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.roundedDecimalPlace
|
||||||
import com.sw.inbound.utils.ext.toJsonString
|
import com.sw.inbound.utils.ext.toJsonString
|
||||||
import com.sw.inbound.utils.ext.toast
|
import com.sw.inbound.utils.ext.toast
|
||||||
import com.sw.inbound.viewmodel.ReceiptViewModel
|
import com.sw.inbound.viewmodel.ReceiptViewModel
|
||||||
@@ -43,12 +45,14 @@ import dagger.hilt.android.AndroidEntryPoint
|
|||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import kotlin.math.abs
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
abstract class GoodsListActivity : ComponentActivity() {
|
abstract class GoodsListActivity : ComponentActivity() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
private const val TAG = "GoodsListActivity"
|
||||||
public const val ID = "id"
|
public const val ID = "id"
|
||||||
public const val SUPPLIER_ID = "supplierId"
|
public const val SUPPLIER_ID = "supplierId"
|
||||||
|
|
||||||
@@ -56,6 +60,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
public const val IS_NEW_RECEIPT = "isNewReceipt"
|
public const val IS_NEW_RECEIPT = "isNewReceipt"
|
||||||
|
|
||||||
const val PAGE_SIZE = 10
|
const val PAGE_SIZE = 10
|
||||||
|
private const val DELAY_TIME = 30 * 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
var isReceiptPage: Boolean = false
|
var isReceiptPage: Boolean = false
|
||||||
@@ -89,7 +94,9 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
replaceIncludeContent()
|
replaceIncludeContent()
|
||||||
initRecyclerView()
|
initRecyclerView()
|
||||||
initView()
|
initView()
|
||||||
|
binding.root.setOnClickListener {
|
||||||
|
it.hideKeyboard()
|
||||||
|
}
|
||||||
binding.btnBack.setOnClickListener { handleBackEvent() }
|
binding.btnBack.setOnClickListener { handleBackEvent() }
|
||||||
|
|
||||||
binding.flWarehouseDropdown.setOnClickListener { v ->
|
binding.flWarehouseDropdown.setOnClickListener { v ->
|
||||||
@@ -105,6 +112,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
list = dropdownList,
|
list = dropdownList,
|
||||||
popHeight = min(355.dp, dropdownList.size * 71.dp)
|
popHeight = min(355.dp, dropdownList.size * 71.dp)
|
||||||
) {
|
) {
|
||||||
|
binding.cvDropdownBg.setCardBackgroundColor(Color.TRANSPARENT)
|
||||||
binding.tvWareHouse.run {
|
binding.tvWareHouse.run {
|
||||||
text = it.value
|
text = it.value
|
||||||
tag = it.id
|
tag = it.id
|
||||||
@@ -114,23 +122,11 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
dropdownPopup?.showAsDropDown(v)
|
dropdownPopup?.showAsDropDown(v)
|
||||||
}
|
}
|
||||||
binding.tvPurchaseNo.setOnClickListener {
|
binding.tvPurchaseNo.setOnClickListener {
|
||||||
isShowRecognizeDialog = false
|
handleGoodsResult(
|
||||||
GoodsRecognizeDialog(
|
goodsList = mutableListOf(),
|
||||||
context = this,
|
file = null,
|
||||||
list = mutableListOf()
|
name = null
|
||||||
) {
|
)
|
||||||
GoodsSearchDialog(this).show()
|
|
||||||
}.apply {
|
|
||||||
setOnDismissListener {
|
|
||||||
isShowRecognizeDialog = true
|
|
||||||
}
|
|
||||||
setOnShowListener {
|
|
||||||
isShowRecognizeDialog = false
|
|
||||||
}
|
|
||||||
if (isFinishing.not() && isDestroyed.not()) {
|
|
||||||
show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
binding.tvUserName.text = GlobalData.deviceId
|
binding.tvUserName.text = GlobalData.deviceId
|
||||||
binding.tvUserName.gone()
|
binding.tvUserName.gone()
|
||||||
@@ -144,8 +140,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cameraUtils.setPreviewController(previewView)
|
cameraUtils.setPreviewController(previewView)
|
||||||
|
startTime = System.currentTimeMillis()
|
||||||
//viewModel.startSensorScale()
|
|
||||||
binding.root.postDelayed({
|
binding.root.postDelayed({
|
||||||
SensorScaleUtils.addWeightListener {
|
SensorScaleUtils.addWeightListener {
|
||||||
weightCallback?.invoke(it)
|
weightCallback?.invoke(it)
|
||||||
@@ -159,14 +154,37 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
weightCallback = callback
|
weightCallback = callback
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var lastWeight = 0
|
||||||
private fun recognizeWeight(weight: Int) {
|
private fun recognizeWeight(weight: Int) {
|
||||||
|
Timber.tag(TAG).d("recognizeWeight,lastWeight=$lastWeight,weight=$weight")
|
||||||
|
//if (this.lastWeight - weight >= 0) {
|
||||||
|
// this.lastWeight = weight
|
||||||
|
// //从秤上取物品中
|
||||||
|
// return
|
||||||
|
//}
|
||||||
if (weight < 200) {
|
if (weight < 200) {
|
||||||
|
if (abs(weight) < 10) {
|
||||||
|
if (goodsRecognizeDialog?.isShowing == true) {
|
||||||
|
goodsRecognizeDialog?.dismiss()
|
||||||
|
isShowRecognizeDialog = true
|
||||||
|
goodsRecognizeDialog = null
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
runOnUiThread {
|
this.lastWeight = weight
|
||||||
|
val checkResult = isFirstRecognize.not() && System.currentTimeMillis() - startTime <= DELAY_TIME
|
||||||
|
Timber.tag(TAG).d("recognizeWeight,checkResult=$checkResult")
|
||||||
|
if (checkResult) {
|
||||||
|
Timber.tag(TAG).d("recognizeWeight,等待中:${(System.currentTimeMillis() - startTime)/1000}")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Timber.tag(TAG).d("recognizeWeight,recognizeFood:isShowRecognizeDialog=$isShowRecognizeDialog")
|
||||||
recognizeFood()
|
recognizeFood()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
var startTime = 0L
|
||||||
|
var isFirstRecognize = true
|
||||||
|
|
||||||
private val takePhotoSuccessCallback: (Uri) -> Unit = { uri ->
|
private val takePhotoSuccessCallback: (Uri) -> Unit = { uri ->
|
||||||
Thread {
|
Thread {
|
||||||
@@ -178,9 +196,11 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
if (isShowRecognizeDialog.not()) {
|
if (isShowRecognizeDialog.not()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Timber.tag(TAG).d("recognizeFood,takePhoto")
|
||||||
isShowRecognizeDialog = false
|
isShowRecognizeDialog = false
|
||||||
bindCamera()
|
//bindCamera()
|
||||||
cameraUtils.takePhoto(takePhotoSuccessCallback)
|
cameraUtils.takePhoto(takePhotoSuccessCallback)
|
||||||
|
isFirstRecognize = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private var dropdownPopup: DropdownPopup? = null
|
private var dropdownPopup: DropdownPopup? = null
|
||||||
@@ -230,7 +250,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
private fun handleGoodsResult(
|
private fun handleGoodsResult(
|
||||||
goodsList: List<SearchGoodsInfo.Record>,
|
goodsList: List<SearchGoodsInfo.Record>,
|
||||||
file: File?,
|
file: File?,
|
||||||
name: String
|
name: String?
|
||||||
) {
|
) {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (goodsRecognizeDialog?.isShowing == true) {
|
if (goodsRecognizeDialog?.isShowing == true) {
|
||||||
@@ -241,7 +261,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
context = this,
|
context = this,
|
||||||
list = goodsList.toMutableList(),
|
list = goodsList.toMutableList(),
|
||||||
goodsFile = file,
|
goodsFile = file,
|
||||||
goodsName = name
|
goodsName = name,
|
||||||
) {
|
) {
|
||||||
GoodsSearchDialog(this).show()
|
GoodsSearchDialog(this).show()
|
||||||
}.apply {
|
}.apply {
|
||||||
@@ -249,17 +269,15 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
goodsRecognizeDialog = null
|
goodsRecognizeDialog = null
|
||||||
isShowRecognizeDialog = true
|
isShowRecognizeDialog = true
|
||||||
}
|
}
|
||||||
setOnShowListener {
|
|
||||||
isShowRecognizeDialog = false
|
|
||||||
}
|
|
||||||
if (isFinishing.not() && isDestroyed.not()) {
|
if (isFinishing.not() && isDestroyed.not()) {
|
||||||
|
isShowRecognizeDialog = false
|
||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var goodsRecognizeDialog: GoodsRecognizeDialog? = null
|
var goodsRecognizeDialog: GoodsRecognizeDialog? = null
|
||||||
|
|
||||||
private fun replaceIncludeContent() {
|
private fun replaceIncludeContent() {
|
||||||
binding.flContainer.removeAllViews()
|
binding.flContainer.removeAllViews()
|
||||||
@@ -305,22 +323,23 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
val item = goodsList.firstOrNull { it.goodId == goods.goodId }
|
val item = goodsList.firstOrNull { it.goodId == goods.goodId }
|
||||||
if (item == null) {
|
if (item == null || item.unitName != goods.unitName) {
|
||||||
|
//不存在物品或者物品单位不同
|
||||||
goods.isSelected = true
|
goods.isSelected = true
|
||||||
goodsList.add(goods)
|
goodsList.add(goods)
|
||||||
binding.rvGoodsList.adapter?.notifyItemInserted(goodsList.size - 1)
|
binding.rvGoodsList.adapter?.notifyItemInserted(goodsList.size - 1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
item.isSelected = true
|
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)
|
||||||
val finalAmount = item.recUnitPriceTaxIn.plus2(goods.recUnitPriceTaxIn)
|
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
|
|
||||||
item.run {
|
item.run {
|
||||||
receivedNum = finalNum
|
receivedNum = finalNum
|
||||||
recUnitPriceTaxIn = goods.recUnitPriceTaxIn
|
recUnitPriceTaxIn = finalPrice.roundedDecimalPlace(2)
|
||||||
recPriceInItem = finalPrice.toSafeDouble()
|
recPriceInItem = finalAmount.roundedDecimalPlace(2)
|
||||||
goodsWeight = goods.goodsWeight
|
goodsWeight = finalWeight.toBigDecimal()
|
||||||
}
|
}
|
||||||
binding.rvGoodsList.adapter?.notifyItemChanged(goodsList.indexOf(item))
|
binding.rvGoodsList.adapter?.notifyItemChanged(goodsList.indexOf(item))
|
||||||
if (this is ReceiptActivity) {
|
if (this is ReceiptActivity) {
|
||||||
@@ -430,6 +449,11 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
fun selfProcurementSubmit() {
|
fun selfProcurementSubmit() {
|
||||||
if (binding.tvWareHouse.tag == null) {
|
if (binding.tvWareHouse.tag == null) {
|
||||||
toast("请选择仓库")
|
toast("请选择仓库")
|
||||||
|
binding.cvDropdownBg.setCardBackgroundColor(Color.RED)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (goodsList.isEmpty()) {
|
||||||
|
toast("暂无入库物品,请采集后操作")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val submitData = goodsList.map {
|
val submitData = goodsList.map {
|
||||||
@@ -442,7 +466,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
goodsPrice = it.goodsPrice ?: 0.0,
|
goodsPrice = it.goodsPrice ?: 0.0,
|
||||||
//goodPurId = it.goodsPurId,
|
//goodPurId = it.goodsPurId,
|
||||||
warehouseId = binding.tvWareHouse.tag.toString(),
|
warehouseId = binding.tvWareHouse.tag.toString(),
|
||||||
buyToInventoryValue = it.consumeValue ?: ""
|
buyToInventoryValue = it.buyToInventoryValue ?: ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Timber.tag("SelfProcurementActivity")
|
Timber.tag("SelfProcurementActivity")
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ class ReceiptActivity : GoodsListActivity() {
|
|||||||
binding.tvPurchaseNo.text = "采购单号:${detail.purCode}"
|
binding.tvPurchaseNo.text = "采购单号:${detail.purCode}"
|
||||||
val list = detail.receiveGoodsInfoList
|
val list = detail.receiveGoodsInfoList
|
||||||
list.forEach { goodsInfo ->
|
list.forEach { goodsInfo ->
|
||||||
goodsInfo.recUnitPriceTaxIn2 = goodsInfo.recUnitPriceTaxIn
|
goodsInfo.recUnitPriceTaxInBak = goodsInfo.recUnitPriceTaxIn
|
||||||
|
goodsInfo.unitNameBak = goodsInfo.unitName
|
||||||
|
goodsInfo.receivedNumBak = goodsInfo.receivedNum
|
||||||
}
|
}
|
||||||
goodsList.addAll(list)
|
goodsList.addAll(list)
|
||||||
adapter.notifyDataSetChanged()
|
adapter.notifyDataSetChanged()
|
||||||
|
|||||||
@@ -1,24 +1,33 @@
|
|||||||
package com.sw.inbound.adapter
|
package com.sw.inbound.adapter
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.text.InputType
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.EditText
|
||||||
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.graphics.toColorInt
|
import androidx.core.graphics.toColorInt
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.chad.library.adapter4.BaseQuickAdapter
|
import com.chad.library.adapter4.BaseQuickAdapter
|
||||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||||
import com.sw.inbound.R
|
import com.sw.inbound.R
|
||||||
import com.sw.inbound.databinding.ListItemReceiptGoodsBinding
|
import com.sw.inbound.databinding.ListItemReceiptGoodsBinding
|
||||||
|
import com.sw.inbound.dialog.WarnDialog
|
||||||
import com.sw.inbound.ext.toSafeDouble
|
import com.sw.inbound.ext.toSafeDouble
|
||||||
import com.sw.inbound.model.response.GoodsInfo
|
import com.sw.inbound.model.response.GoodsInfo
|
||||||
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.ifNullOrBlank
|
import com.sw.inbound.utils.ext.ifNullOrBlank
|
||||||
import com.sw.inbound.utils.ext.ifNullOrZero
|
import com.sw.inbound.utils.ext.ifNullOrZero
|
||||||
|
import com.sw.inbound.utils.ext.roundedDecimalPlace
|
||||||
import com.sw.inbound.utils.ext.setShapeDrawable
|
import com.sw.inbound.utils.ext.setShapeDrawable
|
||||||
|
import com.sw.inbound.utils.ext.toast
|
||||||
import com.sw.inbound.utils.ext.visible
|
import com.sw.inbound.utils.ext.visible
|
||||||
|
import com.sw.inbound.utils.removeTrailingZeros
|
||||||
|
|
||||||
class ReceiptGoodsAdapter(var list: MutableList<GoodsInfo>) :
|
class ReceiptGoodsAdapter(var list: MutableList<GoodsInfo>) :
|
||||||
BaseQuickAdapter<GoodsInfo, ReceiptGoodsAdapter.VH>(list) {
|
BaseQuickAdapter<GoodsInfo, ReceiptGoodsAdapter.VH>(list) {
|
||||||
@@ -42,18 +51,32 @@ class ReceiptGoodsAdapter(var list: MutableList<GoodsInfo>) :
|
|||||||
solidColor = if (item!!.isSelected) "#FFD5E1FF" else "#FFFFFFFF",
|
solidColor = if (item!!.isSelected) "#FFD5E1FF" else "#FFFFFFFF",
|
||||||
radius = 6.dp
|
radius = 6.dp
|
||||||
)
|
)
|
||||||
|
root.setOnClickListener {
|
||||||
|
it.hideKeyboard()
|
||||||
|
}
|
||||||
updateTextView(
|
updateTextView(
|
||||||
tvGoodsName, tvProcurementUnit,
|
tvGoodsName, tvProcurementUnit,
|
||||||
tvProcurementCount, tvProcurementPrice,
|
tvProcurementCount, tvGoodsWeight,
|
||||||
tvProcurementAmount, tvReceiptCount, tvGoodsWeight,
|
etReceiptCount, etReceiptAmount
|
||||||
|
//tvReceiptCount, tvProcurementPrice, tvProcurementAmount,
|
||||||
)
|
)
|
||||||
tvGoodsName.text = item.goodName.ifNullOrBlank("-")
|
tvGoodsName.text = item.goodName.ifNullOrBlank("-")
|
||||||
tvProcurementUnit.text = item.unitName.ifNullOrBlank("-")
|
tvProcurementUnit.text = item.unitName.ifNullOrBlank("-")
|
||||||
tvProcurementCount.text = item.receiveCount.ifNullOrZero("-")
|
tvProcurementCount.text = if (item.receiveCount == null || item.receiveCount == 0.toDouble()) "-"
|
||||||
tvProcurementPrice.text = item.recUnitPriceTaxIn2.toSafeDouble(2).ifNullOrZero("-")
|
else item.receiveCount.removeTrailingZeros()
|
||||||
tvProcurementAmount.text = item.recPriceExItem.toSafeDouble(2).ifNullOrZero("-")
|
//tvProcurementPrice.text = item.recUnitPriceTaxInBak.toSafeDouble(2).ifNullOrZero("-")
|
||||||
tvReceiptCount.text = item.receivedNum.toSafeDouble(2).ifNullOrZero("-")
|
//tvProcurementAmount.text = item.recPriceExItem.toSafeDouble(2).ifNullOrZero("-")
|
||||||
tvGoodsWeight.text = item.goodsWeight?.toDouble().toSafeDouble(2).ifNullOrZero("-")
|
//tvReceiptCount.text = item.receivedNum.toSafeDouble(2).ifNullOrZero("-")
|
||||||
|
tvGoodsWeight.text = if (item.goodsWeight == null || item.goodsWeight == 0.toBigDecimal()) "-"
|
||||||
|
else item.goodsWeight?.toDouble().removeTrailingZeros()
|
||||||
|
|
||||||
|
if (item.unitHint.isNullOrBlank().not()) {
|
||||||
|
unitDivider.visible()
|
||||||
|
tvUnitHint.run {
|
||||||
|
visible()
|
||||||
|
text = item.unitHint?.replace(",", "\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tvState.gone()
|
tvState.gone()
|
||||||
ivState.run {
|
ivState.run {
|
||||||
@@ -65,8 +88,92 @@ class ReceiptGoodsAdapter(var list: MutableList<GoodsInfo>) :
|
|||||||
else R.mipmap.ic_receipt_all
|
else R.mipmap.ic_receipt_all
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
etReceiptCount.run {
|
||||||
|
isEnabled = item.receivedNum != null && item.receivedNum != 0.toDouble()
|
||||||
|
updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
|
topMargin = if (isEnabled) 20.dp else 0
|
||||||
|
bottomMargin = if (isEnabled) 20.dp else 0
|
||||||
|
leftMargin = if (isEnabled) 20.dp else 0
|
||||||
|
rightMargin = if (isEnabled) 20.dp else 0
|
||||||
}
|
}
|
||||||
|
if (isEnabled) {
|
||||||
|
setShapeDrawable(strokeColor = "#FFDCDCF0", strokeWidth = 2.dp, radius = 8.dp)
|
||||||
|
val unit = item.unitName
|
||||||
|
inputType = if (unit == "千克" || unit == "公斤" || unit == "斤") {
|
||||||
|
InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL
|
||||||
|
} else {
|
||||||
|
InputType.TYPE_CLASS_NUMBER
|
||||||
|
}
|
||||||
|
setText(item.receivedNum?.removeTrailingZeros())
|
||||||
|
setSelection(length())
|
||||||
|
} else {
|
||||||
|
setText("-")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
etReceiptAmount.run {
|
||||||
|
isEnabled = item.recPriceInItem != null && item.recPriceInItem != 0.toDouble()
|
||||||
|
updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
|
topMargin = if (isEnabled) 20.dp else 0
|
||||||
|
bottomMargin = if (isEnabled) 20.dp else 0
|
||||||
|
leftMargin = if (isEnabled) 20.dp else 0
|
||||||
|
rightMargin = if (isEnabled) 20.dp else 0
|
||||||
|
}
|
||||||
|
if (isEnabled) {
|
||||||
|
setShapeDrawable(strokeColor = "#FFDCDCF0", strokeWidth = 2.dp, radius = 6.dp)
|
||||||
|
setText(item.recPriceInItem?.removeTrailingZeros())
|
||||||
|
setSelection(length())
|
||||||
|
} else {
|
||||||
|
setText("-")
|
||||||
|
val colorString = if (item.isSelected) "#FFD5E1FF" else "#FFFFFFFF"
|
||||||
|
setBackgroundColor(colorString.toColorInt())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addEditListener(etReceiptCount) {
|
||||||
|
if (it == 0.toDouble()) {
|
||||||
|
context.toast("数量不能为0")
|
||||||
|
etReceiptCount.setText(item.receivedNum?.removeTrailingZeros())
|
||||||
|
return@addEditListener
|
||||||
|
}
|
||||||
|
item.receivedNum = it
|
||||||
|
item.recUnitPriceTaxIn = item.recPriceInItem!! / it
|
||||||
|
//tvGoodsPrice.text = "${item.goodsUnitPrice?.roundedDecimalPlace(2)}"
|
||||||
|
}
|
||||||
|
addEditListener(etReceiptAmount) {
|
||||||
|
if (it == 0.toDouble()) {
|
||||||
|
context.toast("金额不能为0")
|
||||||
|
etReceiptAmount.setText(item.recPriceInItem?.removeTrailingZeros())
|
||||||
|
return@addEditListener
|
||||||
|
}
|
||||||
|
item.recPriceInItem = it
|
||||||
|
item.recUnitPriceTaxIn = it / item.receivedNum!!
|
||||||
|
//tvGoodsPrice.text = "${item.goodsUnitPrice?.roundedDecimalPlace(2)}"
|
||||||
|
}
|
||||||
|
ivClear.run {
|
||||||
|
visible()
|
||||||
|
setOnClickListener {
|
||||||
|
if (item.isLocalGoods) {
|
||||||
|
//删除行数据弹窗
|
||||||
|
showWarnDialog(content = "请确认是否删除该条采购数据,删除后不可恢复?") {
|
||||||
|
list.removeAt(position)
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
//清除数据,恢复默认
|
||||||
|
showWarnDialog(content = "请确认是否清除添加的收货信息,清除后不可恢复?") {
|
||||||
|
item.receivedNum = item.receivedNumBak
|
||||||
|
item.recPriceInItem = 0.0
|
||||||
|
item.recUnitPriceTaxIn = 0.0
|
||||||
|
item.unitName = item.unitNameBak
|
||||||
|
notifyItemChanged(position)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showWarnDialog(content:String, callback:()-> Unit) {
|
||||||
|
WarnDialog(context = context, content = content, confirmBlock = callback).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTextView(vararg views: TextView) {
|
private fun updateTextView(vararg views: TextView) {
|
||||||
@@ -76,4 +183,31 @@ class ReceiptGoodsAdapter(var list: MutableList<GoodsInfo>) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun addEditListener(editText: EditText, action: (Double) -> Unit) {
|
||||||
|
editText.run {
|
||||||
|
addTextChangedListener(onTextChanged = { it, _, _, _ ->
|
||||||
|
try {
|
||||||
|
if (editText.isFocused.not()) {
|
||||||
|
return@addTextChangedListener
|
||||||
|
}
|
||||||
|
val input = it.toString()
|
||||||
|
if (input.startsWith(".")) {
|
||||||
|
setText("0.")
|
||||||
|
setSelection(length())
|
||||||
|
} else if (input.contains(".")) {
|
||||||
|
val index = input.indexOf(".")
|
||||||
|
if (input.length - index > 3) {
|
||||||
|
setText(input.substring(0, index + 3))
|
||||||
|
setSelection(length())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val value = if (input == "0.") 0.0 else input.toDouble()
|
||||||
|
action(value)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,29 @@
|
|||||||
package com.sw.inbound.adapter
|
package com.sw.inbound.adapter
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.text.InputType
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
|
import android.widget.EditText
|
||||||
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.graphics.toColorInt
|
import androidx.core.graphics.toColorInt
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.chad.library.adapter4.BaseQuickAdapter
|
import com.chad.library.adapter4.BaseQuickAdapter
|
||||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||||
import com.sw.inbound.databinding.ListItemSelfProcurementBinding
|
import com.sw.inbound.databinding.ListItemSelfProcurementBinding
|
||||||
import com.sw.inbound.ext.toSafeDouble
|
|
||||||
import com.sw.inbound.model.response.GoodsInfo
|
import com.sw.inbound.model.response.GoodsInfo
|
||||||
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.ifNullOrBlank
|
import com.sw.inbound.utils.ext.hideKeyboard
|
||||||
import com.sw.inbound.utils.ext.ifNullOrZero
|
import com.sw.inbound.utils.ext.roundedDecimalPlace
|
||||||
import com.sw.inbound.utils.ext.setShapeDrawable
|
import com.sw.inbound.utils.ext.setShapeDrawable
|
||||||
|
import com.sw.inbound.utils.ext.toast
|
||||||
import com.sw.inbound.utils.ext.visible
|
import com.sw.inbound.utils.ext.visible
|
||||||
|
import com.sw.inbound.utils.removeTrailingZeros
|
||||||
|
|
||||||
class SelfProcurementAdapter(var list: MutableList<GoodsInfo>) :
|
class SelfProcurementAdapter(var list: MutableList<GoodsInfo>) :
|
||||||
BaseQuickAdapter<GoodsInfo, SelfProcurementAdapter.VH>(list) {
|
BaseQuickAdapter<GoodsInfo, SelfProcurementAdapter.VH>(list) {
|
||||||
@@ -41,19 +47,79 @@ class SelfProcurementAdapter(var list: MutableList<GoodsInfo>) :
|
|||||||
solidColor = if (item!!.isSelected) "#FFD5E1FF" else "#FFFFFFFF",
|
solidColor = if (item!!.isSelected) "#FFD5E1FF" else "#FFFFFFFF",
|
||||||
radius = 6.dp
|
radius = 6.dp
|
||||||
)
|
)
|
||||||
|
root.setOnClickListener {
|
||||||
|
it.hideKeyboard()
|
||||||
|
}
|
||||||
updateTextView(
|
updateTextView(
|
||||||
tvGoodsName, tvProcurementUnit,
|
tvGoodsName, tvGoodsUnit,
|
||||||
tvProcurementCount, tvProcurementPrice,
|
etGoodsCount, tvGoodsWeight, tvGoodsPrice,
|
||||||
tvProcurementAmount
|
etGoodsAmount
|
||||||
)
|
)
|
||||||
tvGoodsName.text = item.goodName.ifNullOrBlank("-")
|
tvGoodsName.text = item.goodName
|
||||||
tvProcurementUnit.text = item.unitName.ifNullOrBlank("-")
|
tvGoodsUnit.text = item.unitName
|
||||||
tvProcurementCount.text = item.goodsCount.ifNullOrZero("-")
|
if (item.unitHint.isNullOrBlank().not()) {
|
||||||
tvProcurementPrice.text = item.goodsUnitPrice.toSafeDouble(2).ifNullOrZero("-")
|
unitDivider.visible()
|
||||||
tvProcurementAmount.text = item.goodsPrice.toSafeDouble(2).ifNullOrZero("-")
|
tvUnitHint.run {
|
||||||
|
visible()
|
||||||
|
text = item.unitHint?.replace(",", "\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
etGoodsCount.run {
|
||||||
|
updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
|
topMargin = 20.dp
|
||||||
|
bottomMargin = 20.dp
|
||||||
|
}
|
||||||
|
setShapeDrawable(strokeColor = "#FFDCDCF0", strokeWidth = 2.dp, radius = 8.dp)
|
||||||
|
isEnabled = true
|
||||||
|
setText(item.goodsCount?.removeTrailingZeros())
|
||||||
|
val unit = item.unitName
|
||||||
|
inputType = if (unit == "千克" || unit == "公斤" || unit == "斤") {
|
||||||
|
InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL
|
||||||
|
} else {
|
||||||
|
InputType.TYPE_CLASS_NUMBER
|
||||||
|
}
|
||||||
|
if (isEnabled) {
|
||||||
|
setSelection(length())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tvGoodsWeight.text = item.goodsWeight?.toDouble()?.removeTrailingZeros()
|
||||||
|
tvGoodsPrice.text = "${item.goodsUnitPrice?.roundedDecimalPlace(2)}"
|
||||||
|
etGoodsAmount.run {
|
||||||
|
updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
|
topMargin = 20.dp
|
||||||
|
bottomMargin = 20.dp
|
||||||
|
}
|
||||||
|
setShapeDrawable(strokeColor = "#FFDCDCF0", strokeWidth = 2.dp, radius = 6.dp)
|
||||||
|
isEnabled = true
|
||||||
|
setText(item.goodsPrice?.removeTrailingZeros())
|
||||||
|
if (isEnabled) {
|
||||||
|
setSelection(length())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tvState.gone()
|
tvState.gone()
|
||||||
ivState.visible()
|
ivState.visible()
|
||||||
|
|
||||||
|
addEditListener(etGoodsCount) {
|
||||||
|
if (it == 0.toDouble()) {
|
||||||
|
context.toast("数量不能为0")
|
||||||
|
etGoodsCount.setText(item.goodsCount?.removeTrailingZeros())
|
||||||
|
return@addEditListener
|
||||||
|
}
|
||||||
|
item.goodsCount = it
|
||||||
|
item.goodsUnitPrice = item.goodsPrice!! / it
|
||||||
|
tvGoodsPrice.text = "${item.goodsUnitPrice?.roundedDecimalPlace(2)}"
|
||||||
|
}
|
||||||
|
addEditListener(etGoodsAmount) {
|
||||||
|
if (it == 0.toDouble()) {
|
||||||
|
context.toast("金额不能为0")
|
||||||
|
etGoodsAmount.setText(item.goodsPrice?.removeTrailingZeros())
|
||||||
|
return@addEditListener
|
||||||
|
}
|
||||||
|
item.goodsPrice = it
|
||||||
|
item.goodsUnitPrice = it / item.goodsCount!!
|
||||||
|
tvGoodsPrice.text = "${item.goodsUnitPrice?.roundedDecimalPlace(2)}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,4 +130,31 @@ class SelfProcurementAdapter(var list: MutableList<GoodsInfo>) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun addEditListener(editText: EditText, action: (Double) -> Unit) {
|
||||||
|
editText.run {
|
||||||
|
addTextChangedListener(onTextChanged = { it, _, _, _ ->
|
||||||
|
try {
|
||||||
|
if (editText.isFocused.not()) {
|
||||||
|
return@addTextChangedListener
|
||||||
|
}
|
||||||
|
val input = it.toString()
|
||||||
|
if (input.startsWith(".")) {
|
||||||
|
setText("0.")
|
||||||
|
setSelection(length())
|
||||||
|
} else if (input.contains(".")) {
|
||||||
|
val index = input.indexOf(".")
|
||||||
|
if (input.length - index > 3) {
|
||||||
|
setText(input.substring(0, index + 3))
|
||||||
|
setSelection(length())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val value = if (input == "0.") 0.0 else input.toDouble()
|
||||||
|
action(value)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,6 @@ import android.content.Context
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import coil.load
|
|
||||||
import com.sw.inbound.activity.GoodsListActivity
|
import com.sw.inbound.activity.GoodsListActivity
|
||||||
import com.sw.inbound.adapter.RecognizeAdapter
|
import com.sw.inbound.adapter.RecognizeAdapter
|
||||||
import com.sw.inbound.databinding.DialogGoodsRecognizeBinding
|
import com.sw.inbound.databinding.DialogGoodsRecognizeBinding
|
||||||
@@ -19,6 +18,7 @@ class GoodsRecognizeDialog(
|
|||||||
var goodsFile: File?=null,
|
var goodsFile: File?=null,
|
||||||
var goodsName: String?=null,
|
var goodsName: String?=null,
|
||||||
var list: MutableList<SearchGoodsInfo.Record>,
|
var list: MutableList<SearchGoodsInfo.Record>,
|
||||||
|
//var closeCallback:()->Unit,
|
||||||
var findGoods: () -> Unit
|
var findGoods: () -> Unit
|
||||||
) : BaseDialog(context) {
|
) : BaseDialog(context) {
|
||||||
|
|
||||||
@@ -41,9 +41,7 @@ class GoodsRecognizeDialog(
|
|||||||
isStateViewEnable = true
|
isStateViewEnable = true
|
||||||
setOnItemClickListener { adapter, view, position ->
|
setOnItemClickListener { adapter, view, position ->
|
||||||
if (list[position].isSelected) {
|
if (list[position].isSelected) {
|
||||||
GoodsStoreDialog(context, list[position]) {
|
showGoodsStoreDialog(position)
|
||||||
activity?.addGoods(it)
|
|
||||||
}.show()
|
|
||||||
return@setOnItemClickListener
|
return@setOnItemClickListener
|
||||||
}
|
}
|
||||||
list.forEach { item ->
|
list.forEach { item ->
|
||||||
@@ -51,12 +49,18 @@ class GoodsRecognizeDialog(
|
|||||||
}
|
}
|
||||||
list[position].isSelected = true
|
list[position].isSelected = true
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
|
showGoodsStoreDialog(position)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showGoodsStoreDialog(position: Int) {
|
||||||
GoodsStoreDialog(context, list[position]) {
|
GoodsStoreDialog(context, list[position]) {
|
||||||
activity?.addGoods(it)
|
activity?.addGoods(it)
|
||||||
|
activity?.startTime = System.currentTimeMillis()
|
||||||
|
dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var activity: GoodsListActivity? = null
|
private var activity: GoodsListActivity? = null
|
||||||
override fun initView() {
|
override fun initView() {
|
||||||
@@ -68,7 +72,12 @@ class GoodsRecognizeDialog(
|
|||||||
if (recognizeAdapter.list.isEmpty()) {
|
if (recognizeAdapter.list.isEmpty()) {
|
||||||
loadEmptyView()
|
loadEmptyView()
|
||||||
}
|
}
|
||||||
binding.ivClose.setOnClickListener { dismiss() }
|
binding.ivClose.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
activity?.isShowRecognizeDialog = true
|
||||||
|
activity?.goodsRecognizeDialog = null
|
||||||
|
activity?.startTime = System.currentTimeMillis()
|
||||||
|
}
|
||||||
binding.btnManuallyFind.setOnClickListener {
|
binding.btnManuallyFind.setOnClickListener {
|
||||||
findGoods()
|
findGoods()
|
||||||
//dismiss()
|
//dismiss()
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ class GoodsSearchDialog(
|
|||||||
}
|
}
|
||||||
GoodsStoreDialog(context, list[clickIndex]) {
|
GoodsStoreDialog(context, list[clickIndex]) {
|
||||||
activity?.addGoods(it)
|
activity?.addGoods(it)
|
||||||
|
activity?.startTime = System.currentTimeMillis()
|
||||||
|
activity?.goodsRecognizeDialog?.dismiss()
|
||||||
|
dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
binding.rvSearch.let {
|
binding.rvSearch.let {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.sw.inbound.dialog
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
|
import android.text.InputType
|
||||||
import android.text.SpannableStringBuilder
|
import android.text.SpannableStringBuilder
|
||||||
import android.text.style.ForegroundColorSpan
|
import android.text.style.ForegroundColorSpan
|
||||||
import android.text.style.StyleSpan
|
import android.text.style.StyleSpan
|
||||||
@@ -21,8 +22,11 @@ import com.sw.inbound.model.response.GoodsInfo
|
|||||||
import com.sw.inbound.model.response.SearchGoodsInfo
|
import com.sw.inbound.model.response.SearchGoodsInfo
|
||||||
import com.sw.inbound.sdk.SensorScaleUtils
|
import com.sw.inbound.sdk.SensorScaleUtils
|
||||||
import com.sw.inbound.utils.ext.dp
|
import com.sw.inbound.utils.ext.dp
|
||||||
|
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.removeTrailingZeros
|
||||||
import kotlin.Int
|
import kotlin.Int
|
||||||
|
import kotlin.math.abs
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
class GoodsStoreDialog(
|
class GoodsStoreDialog(
|
||||||
@@ -47,23 +51,6 @@ class GoodsStoreDialog(
|
|||||||
private var activity: GoodsListActivity? = null
|
private var activity: GoodsListActivity? = null
|
||||||
override fun initView() {
|
override fun initView() {
|
||||||
activity = getReceiptActivity()
|
activity = getReceiptActivity()
|
||||||
activity?.readWeightInfo { weight ->
|
|
||||||
this.realWeight = weight
|
|
||||||
binding.tvTotalWeight.text = getSpannable(weight)
|
|
||||||
val id = binding.tvProcurementUnit.tag.toString()
|
|
||||||
val count = getUnitVo(id)
|
|
||||||
if (count == 0.toDouble()) {
|
|
||||||
return@readWeightInfo
|
|
||||||
}
|
|
||||||
val currentCount = binding.etProcurementCount.text.toString().trim()
|
|
||||||
if (currentCount == "$count") {
|
|
||||||
return@readWeightInfo
|
|
||||||
}
|
|
||||||
binding.etProcurementCount.let {
|
|
||||||
it.setText("$count")
|
|
||||||
it.setSelection(it.length())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (goods.unitVoList.isNullOrEmpty()) {
|
if (goods.unitVoList.isNullOrEmpty()) {
|
||||||
activity?.toast("未匹配到合适的入库单位")
|
activity?.toast("未匹配到合适的入库单位")
|
||||||
dismiss()
|
dismiss()
|
||||||
@@ -73,6 +60,7 @@ class GoodsStoreDialog(
|
|||||||
goods.unitVoList!!.forEach {
|
goods.unitVoList!!.forEach {
|
||||||
dropdownList.add(DictType(id = it.businessUnitId, value = it.purchaseUnitName))
|
dropdownList.add(DictType(id = it.businessUnitId, value = it.purchaseUnitName))
|
||||||
}
|
}
|
||||||
|
//binding.etProcurementCount.isEnabled = false
|
||||||
binding.etGoodsName.run {
|
binding.etGoodsName.run {
|
||||||
setText(goods.goodsName)
|
setText(goods.goodsName)
|
||||||
isEnabled = false
|
isEnabled = false
|
||||||
@@ -96,25 +84,38 @@ class GoodsStoreDialog(
|
|||||||
popWidth = 428.dp,
|
popWidth = 428.dp,
|
||||||
popHeight = min(dropdownList.size, 4) * 71.dp
|
popHeight = min(dropdownList.size, 4) * 71.dp
|
||||||
) { dictType ->
|
) { dictType ->
|
||||||
|
try {
|
||||||
binding.tvProcurementUnit.run {
|
binding.tvProcurementUnit.run {
|
||||||
text = dictType.value
|
text = dictType.value
|
||||||
tag = dictType.id
|
tag = dictType.id
|
||||||
}
|
}
|
||||||
binding.tvCountUnit.text = dictType.value
|
val unit = dictType.value
|
||||||
|
binding.tvCountUnit.text = unit
|
||||||
|
binding.etProcurementCount.let {
|
||||||
|
//it.isEnabled = true
|
||||||
|
it.inputType = if (unit == "千克" || unit == "公斤" || unit == "斤") {
|
||||||
|
InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL
|
||||||
|
} else {
|
||||||
|
InputType.TYPE_CLASS_NUMBER
|
||||||
|
}
|
||||||
|
}
|
||||||
val first = goods.unitVoList!!.first { it.businessUnitId == dictType.id }
|
val first = goods.unitVoList!!.first { it.businessUnitId == dictType.id }
|
||||||
val stringBuilder = StringBuilder()
|
val stringBuilder = StringBuilder()
|
||||||
.append("1").append(dictType.value).append("=").append(first.purchaseValue!!.toInt().toString()).append(goods.kcUnitName)
|
.append("1").append(dictType.value).append("=").append(first.purchaseValue!!.toInt().toString()).append(goods.kcUnitName)
|
||||||
.append(",")
|
.append(",")
|
||||||
.append("1").append(goods.kcUnitName).append("=").append(first.consumeValue).append("克")
|
.append("1").append(goods.kcUnitName).append("=").append(first.consumeValue).append("克")
|
||||||
binding.tvUnitCalculate.text = stringBuilder.toString()
|
binding.tvUnitCalculate.text = stringBuilder.toString()
|
||||||
val count = getUnitVo(dictType.id!!)
|
//val count = getUnitCount(dictType.id!!)
|
||||||
if (count == 0.toDouble()) {
|
//if (count.isBlank() || "0" == count) {
|
||||||
//context.toast("入库数量不能为0")
|
// //context.toast("入库数量不能为0")
|
||||||
return@DropdownPopup
|
// return@DropdownPopup
|
||||||
}
|
//}
|
||||||
binding.etProcurementCount.let {
|
//binding.etProcurementCount.let {
|
||||||
it.setText("$count")
|
// it.setText(count)
|
||||||
it.setSelection(it.length())
|
// it.setSelection(it.length())
|
||||||
|
//}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,43 +137,76 @@ class GoodsStoreDialog(
|
|||||||
//context.toast("入库数量不能为0")
|
//context.toast("入库数量不能为0")
|
||||||
return@addPriceInputListener
|
return@addPriceInputListener
|
||||||
}
|
}
|
||||||
val price = (it / count).toFormattedString(2)
|
val price = (it / count).roundedDecimalPlace(2)
|
||||||
binding.tvProcurementPrice.text = price
|
binding.tvProcurementPrice.text = price.removeTrailingZeros()
|
||||||
}
|
}
|
||||||
binding.etProcurementCount.run {
|
binding.etProcurementCount.run {
|
||||||
addTextChangedListener(onTextChanged = { it, _, _, _ ->
|
addTextChangedListener(onTextChanged = { it, _, _, _ ->
|
||||||
try {
|
try {
|
||||||
if (isFocused.not()) {
|
if (it.isNullOrBlank()) {
|
||||||
|
if (it.isNullOrBlank()) {
|
||||||
|
binding.tvProcurementPrice.text = ""
|
||||||
|
}
|
||||||
return@addTextChangedListener
|
return@addTextChangedListener
|
||||||
}
|
}
|
||||||
val amountText = binding.etProcurementAmount.text.toString().trim()
|
val amountText = binding.etProcurementAmount.text.toString().trim()
|
||||||
if (amountText.isEmpty()) {
|
if (amountText.isBlank()) {
|
||||||
return@addTextChangedListener
|
return@addTextChangedListener
|
||||||
}
|
}
|
||||||
val input = it?.toString() ?: ""
|
val input = it.toString()
|
||||||
val count = if (input.isNotBlank()) input.toDouble() else 0.toDouble()
|
val count = input.toDouble()
|
||||||
if (count == 0.toDouble()) {
|
if (count == 0.toDouble()) {
|
||||||
//context.toast("入库数量不能为0")
|
//context.toast("入库数量不能为0")
|
||||||
return@addTextChangedListener
|
return@addTextChangedListener
|
||||||
}
|
}
|
||||||
val amount = amountText.toDouble()
|
val amount = amountText.toDouble()
|
||||||
val price = amount / count
|
val price = (amount / count).roundedDecimalPlace(2)
|
||||||
binding.tvProcurementPrice.text = price.toFormattedString(2)
|
binding.tvProcurementPrice.text = price.removeTrailingZeros()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
addWeightListener()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addWeightListener() {
|
||||||
|
activity?.readWeightInfo { weight ->
|
||||||
|
if (abs(this.realWeight - weight) < 10 && binding.etProcurementCount.text.isNotBlank()) {
|
||||||
|
//两次数据差在10克内,认为无变化,不进行操作
|
||||||
|
return@readWeightInfo
|
||||||
|
}
|
||||||
|
this.realWeight = weight
|
||||||
|
binding.tvTotalWeight.text = getSpannable(weight)
|
||||||
|
if (binding.etProcurementCount.isFocused) {
|
||||||
|
return@readWeightInfo
|
||||||
|
}
|
||||||
|
val unitTag = binding.tvProcurementUnit.tag
|
||||||
|
if (unitTag == null) {
|
||||||
|
return@readWeightInfo
|
||||||
|
}
|
||||||
|
val id = unitTag.toString()
|
||||||
|
val count = getUnitCount(id)
|
||||||
|
val currentCount = binding.etProcurementCount.text.toString().trim()
|
||||||
|
if (currentCount == count || count.isBlank() || "0" == count) {
|
||||||
|
return@readWeightInfo
|
||||||
|
}
|
||||||
|
binding.etProcurementCount.let {
|
||||||
|
it.setText(count)
|
||||||
|
it.setSelection(it.length())
|
||||||
|
//it.isEnabled = true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addPriceInputListener(editText: EditText, action: (Double) -> Unit) {
|
private fun addPriceInputListener(editText: EditText, action: (Double) -> Unit) {
|
||||||
editText.run {
|
editText.run {
|
||||||
addTextChangedListener(onTextChanged = { it, _, _, _ ->
|
addTextChangedListener(onTextChanged = { it, _, _, _ ->
|
||||||
try {
|
try {
|
||||||
if (editText.isFocused.not()) {
|
if (it.isNullOrBlank()) {
|
||||||
return@addTextChangedListener
|
return@addTextChangedListener
|
||||||
}
|
}
|
||||||
val input = it ?: ""
|
val input = it.toString()
|
||||||
if (input.startsWith(".")) {
|
if (input.startsWith(".")) {
|
||||||
setText("0.")
|
setText("0.")
|
||||||
setSelection(length())
|
setSelection(length())
|
||||||
@@ -183,7 +217,7 @@ class GoodsStoreDialog(
|
|||||||
setSelection(length())
|
setSelection(length())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val value = if (input.toString() == "0.") 0.0 else input.toString().toDouble()
|
val value = if (input == "0.") 0.0 else input.toDouble()
|
||||||
action(value)
|
action(value)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
@@ -214,7 +248,7 @@ class GoodsStoreDialog(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
val countText = binding.etProcurementCount.text.trim().toString()
|
val countText = binding.etProcurementCount.text.trim().toString()
|
||||||
if (countText.isBlank()) {
|
if (countText.isBlank() || "0" == countText) {
|
||||||
context.toast("请录入入库数量")
|
context.toast("请录入入库数量")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -247,6 +281,8 @@ class GoodsStoreDialog(
|
|||||||
context.toast("入库金额不能为0")
|
context.toast("入库金额不能为0")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
val id = binding.tvProcurementUnit.tag.toString()
|
||||||
|
val unitVo = goods.unitVoList!!.first { it.businessUnitId == id }
|
||||||
confirmBlock(
|
confirmBlock(
|
||||||
GoodsInfo(
|
GoodsInfo(
|
||||||
goodId = goods.id,
|
goodId = goods.id,
|
||||||
@@ -255,8 +291,11 @@ class GoodsStoreDialog(
|
|||||||
//goodsPurId = binding.tvProcurementUnit.tag.toString(),
|
//goodsPurId = binding.tvProcurementUnit.tag.toString(),
|
||||||
kcUnitId = binding.tvProcurementUnit.tag.toString(),
|
kcUnitId = binding.tvProcurementUnit.tag.toString(),
|
||||||
unitName = unit,
|
unitName = unit,
|
||||||
|
//收货接口-数量
|
||||||
receivedNum = count,
|
receivedNum = count,
|
||||||
|
//收货接口-单价(含税)
|
||||||
recUnitPriceTaxIn = price,
|
recUnitPriceTaxIn = price,
|
||||||
|
//收货接口-金额(含税)
|
||||||
recPriceInItem = totalPrice,
|
recPriceInItem = totalPrice,
|
||||||
goodsWeight = realWeight.toBigDecimal(),
|
goodsWeight = realWeight.toBigDecimal(),
|
||||||
isLocalGoods = true,
|
isLocalGoods = true,
|
||||||
@@ -264,12 +303,15 @@ class GoodsStoreDialog(
|
|||||||
goodsCount = count,
|
goodsCount = count,
|
||||||
goodsUnitPrice = price,
|
goodsUnitPrice = price,
|
||||||
goodsPrice = totalPrice,
|
goodsPrice = totalPrice,
|
||||||
|
buyToInventoryValue = unitVo.buyToInventoryValue,
|
||||||
|
|
||||||
|
unitHint = binding.tvUnitCalculate.text.toString()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getUnitVo(id: String): Double {
|
private fun getUnitCount(id: String): String {
|
||||||
val first = goods.unitVoList!!.first { it.businessUnitId == id }
|
val first = goods.unitVoList!!.first { it.businessUnitId == id }
|
||||||
val count = first.getPurchaseUnitValue( this.realWeight)
|
val count = first.getPurchaseUnitValue( this.realWeight)
|
||||||
return count
|
return count
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.sw.inbound.dialog
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import com.sw.inbound.databinding.DialogNotReceiptWarnBinding
|
||||||
|
import com.sw.inbound.databinding.DialogWarnBinding
|
||||||
|
import com.sw.inbound.utils.ext.dp
|
||||||
|
|
||||||
|
class WarnDialog(
|
||||||
|
context: Context,
|
||||||
|
var content:String,
|
||||||
|
var cancelBlock: () -> Unit = {},
|
||||||
|
var confirmBlock: () -> Unit = {},
|
||||||
|
) : BaseDialog(context = context, defWidth = 960.dp, defHeight = 540.dp) {
|
||||||
|
|
||||||
|
private lateinit var binding: DialogWarnBinding
|
||||||
|
override fun getRootView(): View {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
binding = DialogWarnBinding.inflate(inflater)
|
||||||
|
return binding.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
binding.tvWarnContent.text = content
|
||||||
|
binding.btnCancel.setOnClickListener {
|
||||||
|
cancelBlock()
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
binding.btnConfirm.setOnClickListener {
|
||||||
|
confirmBlock()
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ data class GoodsInfo(
|
|||||||
* 单价
|
* 单价
|
||||||
*/
|
*/
|
||||||
var recUnitPriceTaxIn: Double? = null,
|
var recUnitPriceTaxIn: Double? = null,
|
||||||
var recUnitPriceTaxIn2: Double? = null,
|
var recUnitPriceTaxInBak: Double? = null,
|
||||||
|
|
||||||
// 单价 界面显示
|
// 单价 界面显示
|
||||||
var recUnitPriceTaxInTemp: String = "",
|
var recUnitPriceTaxInTemp: String = "",
|
||||||
@@ -44,6 +44,7 @@ data class GoodsInfo(
|
|||||||
* 单位名称
|
* 单位名称
|
||||||
*/
|
*/
|
||||||
var unitName: String? = null,
|
var unitName: String? = null,
|
||||||
|
var unitNameBak: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购单位id
|
* 采购单位id
|
||||||
@@ -88,6 +89,7 @@ data class GoodsInfo(
|
|||||||
|
|
||||||
// 收货数量 收货入参
|
// 收货数量 收货入参
|
||||||
var receivedNum: Double? = null,
|
var receivedNum: Double? = null,
|
||||||
|
var receivedNumBak: Double? = null,
|
||||||
var receiveCountAll: Double? = null,
|
var receiveCountAll: Double? = null,
|
||||||
// 收货数量显示
|
// 收货数量显示
|
||||||
var receivedNumTemp: String = "",
|
var receivedNumTemp: String = "",
|
||||||
@@ -107,7 +109,11 @@ data class GoodsInfo(
|
|||||||
var recPriceInItem:Double?=null,
|
var recPriceInItem:Double?=null,
|
||||||
var goodsCount:Double?=null,
|
var goodsCount:Double?=null,
|
||||||
var goodsUnitPrice:Double?=null,
|
var goodsUnitPrice:Double?=null,
|
||||||
var goodsPrice:Double?=null
|
var goodsPrice:Double?=null,
|
||||||
|
|
||||||
|
var unitHint:String?="",
|
||||||
|
var buyToInventoryValue:String?="",
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
) : Parcelable, BaseBean() {
|
) : Parcelable, BaseBean() {
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package com.sw.inbound.model.response
|
|||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
import com.sw.inbound.utils.ext.roundedDecimalPlace
|
import com.sw.inbound.utils.ext.roundedDecimalPlace
|
||||||
|
import com.sw.inbound.utils.removeTrailingZeros
|
||||||
import kotlinx.parcelize.IgnoredOnParcel
|
import kotlinx.parcelize.IgnoredOnParcel
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ data class SearchGoodsInfo(
|
|||||||
/**
|
/**
|
||||||
* 购买单位数值
|
* 购买单位数值
|
||||||
*/
|
*/
|
||||||
fun getPurchaseUnitValue(value: Int): Double {
|
fun getPurchaseUnitValue(value: Int): String {
|
||||||
val defZero = 0.toDouble()
|
val defZero = 0.toDouble()
|
||||||
val num = when (purchaseUnitName) {
|
val num = when (purchaseUnitName) {
|
||||||
"千克", "公斤" -> 2
|
"千克", "公斤" -> 2
|
||||||
@@ -130,16 +131,17 @@ data class SearchGoodsInfo(
|
|||||||
else -> 0
|
else -> 0
|
||||||
}
|
}
|
||||||
if (purchaseValue == null || purchaseValue == defZero || consumeValue.isNullOrBlank()) {
|
if (purchaseValue == null || purchaseValue == defZero || consumeValue.isNullOrBlank()) {
|
||||||
return defZero.roundedDecimalPlace(num)
|
return ""
|
||||||
}
|
}
|
||||||
var consumeValueDouble: Double
|
var consumeValueDouble: Double
|
||||||
try {
|
try {
|
||||||
consumeValueDouble = consumeValue.toDouble()
|
consumeValueDouble = consumeValue.toDouble()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
return defZero.roundedDecimalPlace(num)
|
return ""
|
||||||
}
|
}
|
||||||
return (value / purchaseValue / consumeValueDouble).roundedDecimalPlace(num)
|
val count = (value / purchaseValue / consumeValueDouble).roundedDecimalPlace(num)
|
||||||
|
return count.removeTrailingZeros()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ class RequestInterceptor : Interceptor {
|
|||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.header("Accept", "application/json")
|
.header("Accept", "application/json")
|
||||||
.header("deviceId", GlobalData.deviceId)
|
.header("deviceId", GlobalData.deviceId)
|
||||||
.header("X-DEVICE-CODE", GlobalData.deviceId)
|
// .header("X-DEVICE-CODE", GlobalData.deviceId)
|
||||||
// .header("X-DEVICE-CODE", "bcf396ed-78f6-3864-9837-7c37c5b2ec41")
|
.header("X-DEVICE-CODE", "bcf396ed-78f6-3864-9837-7c37c5b2ec41")
|
||||||
.header("x-access-token", GlobalData.appToken)
|
.header("x-access-token", GlobalData.appToken)
|
||||||
.header("authorization", "57ee87183f2a4fa59683ec9ef41c8f5d")
|
.header("authorization", "57ee87183f2a4fa59683ec9ef41c8f5d")
|
||||||
// .header("Authorization", "Bearer ${getToken()}")
|
// .header("Authorization", "Bearer ${getToken()}")
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.sw.inbound.sdk
|
package com.sw.inbound.sdk
|
||||||
|
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
import com.sw.inbound.utils.ThreadUtils
|
import com.sw.inbound.utils.ThreadUtils
|
||||||
import com.sw.inbound.utils.ToastUtils
|
import com.sw.inbound.utils.ToastUtils
|
||||||
import com.wabon.wbintelligenthardwaresdk.api.SensorScale
|
import com.wabon.wbintelligenthardwaresdk.api.SensorScale
|
||||||
@@ -26,14 +28,18 @@ object SensorScaleUtils {
|
|||||||
* 读取重量
|
* 读取重量
|
||||||
*/
|
*/
|
||||||
override fun readWeight(state: Int, value: Double) {
|
override fun readWeight(state: Int, value: Double) {
|
||||||
val stateStr = when (state) {
|
//val stateStr = when (state) {
|
||||||
SensorScale.STATE_STABLE -> "稳定"
|
// SensorScale.STATE_STABLE -> "稳定"
|
||||||
SensorScale.STATE_UNSTABLE -> "不稳定"
|
// SensorScale.STATE_UNSTABLE -> "不稳定"
|
||||||
SensorScale.STATE_OVER_WEIGHT -> "量程溢出"
|
// SensorScale.STATE_OVER_WEIGHT -> "量程溢出"
|
||||||
else -> "未知"
|
// else -> "未知"
|
||||||
|
//}
|
||||||
|
if (state != SensorScale.STATE_STABLE) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
Handler(Looper.getMainLooper()).post {
|
||||||
weightCallback?.invoke((value * 1000).toInt())
|
weightCallback?.invoke((value * 1000).toInt())
|
||||||
|
}
|
||||||
//Timber.d("readWeight state = ${stateStr}, weight = $value")
|
//Timber.d("readWeight state = ${stateStr}, weight = $value")
|
||||||
// 只使用稳定值
|
// 只使用稳定值
|
||||||
// if (state == SensorScale.STATE_STABLE) {
|
// if (state == SensorScale.STATE_STABLE) {
|
||||||
|
|||||||
@@ -107,8 +107,6 @@ fun HomeScreen(
|
|||||||
// .build()
|
// .build()
|
||||||
// )
|
// )
|
||||||
navController.context.startActivity<SelfProcurementActivity> {
|
navController.context.startActivity<SelfProcurementActivity> {
|
||||||
putExtra(GoodsListActivity.ID, "2342342343")
|
|
||||||
putExtra(GoodsListActivity.SUPPLIER_ID, "23423423424234")
|
|
||||||
putExtra(GoodsListActivity.IS_RECEIPT_PAGE, false)
|
putExtra(GoodsListActivity.IS_RECEIPT_PAGE, false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -190,7 +190,8 @@ fun PurchaseOrderScreen(
|
|||||||
navController.popBackStack()
|
navController.popBackStack()
|
||||||
}, onRight2ButtonClick = {
|
}, onRight2ButtonClick = {
|
||||||
//navController.navigate(Screen.SelfProcurement.route)
|
//navController.navigate(Screen.SelfProcurement.route)
|
||||||
navController.context.startActivity<SelfProcurementActivity> {}
|
navController.context.startActivity<SelfProcurementActivity> {
|
||||||
|
putExtra(GoodsListActivity.IS_RECEIPT_PAGE, false)}
|
||||||
//navController.context.startActivity<ReceiptActivity> {
|
//navController.context.startActivity<ReceiptActivity> {
|
||||||
// //xtra(GoodsListActivity.ID,it!!.id)
|
// //xtra(GoodsListActivity.ID,it!!.id)
|
||||||
// //xtra(GoodsListActivity.SUPPLIER_ID,it.supplierId)
|
// //xtra(GoodsListActivity.SUPPLIER_ID,it.supplierId)
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ class CameraUtils(private var activity: ComponentActivity) {
|
|||||||
}
|
}
|
||||||
photoCaptureHelper?.let {
|
photoCaptureHelper?.let {
|
||||||
it.addSuccessCallback(callback)
|
it.addSuccessCallback(callback)
|
||||||
|
it.bindCameraCallback {
|
||||||
|
bind()
|
||||||
|
}
|
||||||
it.takePhoto()
|
it.takePhoto()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,7 +55,7 @@ class CameraUtils(private var activity: ComponentActivity) {
|
|||||||
)
|
)
|
||||||
cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA
|
cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA
|
||||||
}
|
}
|
||||||
//cameraController?.bindToLifecycle(activity)
|
bind()
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (isCameraReady.not()) {
|
// if (isCameraReady.not()) {
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.sw.inbound.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.sw.inbound.MyApp;
|
||||||
|
import com.sw.inbound.R;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Toast utils.
|
||||||
|
*/
|
||||||
|
public class CustomToastUtils {
|
||||||
|
|
||||||
|
private static Toast toast;
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
private static TextView textCenterView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show center toast.
|
||||||
|
*
|
||||||
|
* @param text the text
|
||||||
|
*/
|
||||||
|
public static void showToast(String text) {
|
||||||
|
Context context = MyApp.Companion.getInstance();
|
||||||
|
if (toast == null) {
|
||||||
|
View view = LayoutInflater.from(context).inflate(R.layout.layout_custom_toast, null);
|
||||||
|
textCenterView = view.findViewById(R.id.toast_tv);
|
||||||
|
toast = new Toast(context);
|
||||||
|
toast.setGravity(Gravity.CENTER, 0, 20);
|
||||||
|
toast.setDuration(Toast.LENGTH_SHORT);
|
||||||
|
toast.setView(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
textCenterView.setText(text);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show center toast.
|
||||||
|
*
|
||||||
|
* @param text the text
|
||||||
|
*/
|
||||||
|
public static void showToast(String text, int duration) {
|
||||||
|
Context context = MyApp.Companion.getInstance();
|
||||||
|
if (toast == null) {
|
||||||
|
View view = LayoutInflater.from(context).inflate(R.layout.layout_custom_toast, null);
|
||||||
|
textCenterView = view.findViewById(R.id.toast_tv);
|
||||||
|
toast = new Toast(context);
|
||||||
|
toast.setGravity(Gravity.CENTER, 0, 20);
|
||||||
|
toast.setView(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
textCenterView.setText(text);
|
||||||
|
toast.setDuration(duration);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showLongToast(String text) {
|
||||||
|
Context context = MyApp.Companion.getInstance();
|
||||||
|
if (toast == null) {
|
||||||
|
View view = LayoutInflater.from(context).inflate(R.layout.layout_custom_toast, null);
|
||||||
|
textCenterView = view.findViewById(R.id.toast_tv);
|
||||||
|
toast = new Toast(context);
|
||||||
|
toast.setGravity(Gravity.TOP, 0, 20);
|
||||||
|
toast.setDuration(Toast.LENGTH_LONG);
|
||||||
|
toast.setView(view);
|
||||||
|
}
|
||||||
|
textCenterView.setText(text);
|
||||||
|
showMyToast(toast, 1000000 * 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//自定义Toast控件
|
||||||
|
private static void showMyToast(final Toast toast, final int cnt) {
|
||||||
|
final Timer timer = new Timer();
|
||||||
|
timer.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
}, 0, Toast.LENGTH_LONG);
|
||||||
|
new Timer().schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
toast.cancel();
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
}, cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showSystemToast(String text) {
|
||||||
|
Context context = MyApp.Companion.getInstance();
|
||||||
|
Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -32,6 +32,11 @@ class PhotoCaptureHelper(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var bindCamera:(()->Unit)?=null
|
||||||
|
fun bindCameraCallback(callback:()->Unit) {
|
||||||
|
this.bindCamera = callback
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拍照方法
|
* 拍照方法
|
||||||
* @param fileNamePrefix 文件名前缀,默认为"IMG_"
|
* @param fileNamePrefix 文件名前缀,默认为"IMG_"
|
||||||
@@ -69,6 +74,13 @@ class PhotoCaptureHelper(
|
|||||||
|
|
||||||
override fun onError(exception: ImageCaptureException) {
|
override fun onError(exception: ImageCaptureException) {
|
||||||
val errorMsg = "拍照失败: ${exception.message}"
|
val errorMsg = "拍照失败: ${exception.message}"
|
||||||
|
if (errorMsg.contains("Not bound to a valid Camera")) {
|
||||||
|
if (bindCamera != null) {
|
||||||
|
bindCamera?.invoke()
|
||||||
|
takePhoto()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Timber.e(exception, errorMsg)
|
Timber.e(exception, errorMsg)
|
||||||
onError(errorMsg)
|
onError(errorMsg)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.sw.inbound.utils
|
||||||
|
/**
|
||||||
|
* 去除小数点后无效零的工具类
|
||||||
|
* 功能示例:
|
||||||
|
* 1230.00 => 1230
|
||||||
|
* 1230.10 => 1230.1
|
||||||
|
* 3.40 => 3.4
|
||||||
|
* 3.0 => 3
|
||||||
|
*/
|
||||||
|
class RemoveZeroUtils {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法1:使用字符串格式化(最简单)
|
||||||
|
* @param number 输入的double数值
|
||||||
|
* @return 去除无效零后的字符串
|
||||||
|
*/
|
||||||
|
fun removeZeroByFormat(number: Double): String {
|
||||||
|
return "%.10f".format(number) // 先格式化为固定小数位
|
||||||
|
.replace(Regex("0*$"), "") // 移除末尾的零
|
||||||
|
.replace(Regex("\\.$"), "") // 如果小数点后全为零,移除小数点
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法2:使用DecimalFormat(推荐)
|
||||||
|
* @param number 输入的double数值
|
||||||
|
* @return 去除无效零后的字符串
|
||||||
|
*/
|
||||||
|
fun removeZeroByDecimalFormat(number: Double): String {
|
||||||
|
val format = java.text.DecimalFormat("0.##########")
|
||||||
|
format.roundingMode = java.math.RoundingMode.FLOOR
|
||||||
|
return format.format(number)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法3:使用正则表达式处理字符串
|
||||||
|
* @param number 输入的double数值
|
||||||
|
* @return 去除无效零后的字符串
|
||||||
|
*/
|
||||||
|
fun removeZeroByRegex(number: Double): String {
|
||||||
|
var str = number.toString()
|
||||||
|
|
||||||
|
// 如果包含小数点,处理末尾的零
|
||||||
|
if (str.contains(".")) {
|
||||||
|
str = str.replace(Regex("0+?$"), "") // 移除末尾的零
|
||||||
|
.replace(Regex("[.]$"), "") // 如果小数点后全为零,移除小数点
|
||||||
|
}
|
||||||
|
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 扩展函数方式,更符合Kotlin风格
|
||||||
|
fun Double?.removeTrailingZeros(): String {
|
||||||
|
if (this == null) return ""
|
||||||
|
return RemoveZeroUtils.removeZeroByDecimalFormat(this)
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@ import androidx.core.graphics.toColorInt
|
|||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.reflect.TypeToken
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import com.sw.inbound.utils.CustomToastUtils
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
@@ -38,7 +39,8 @@ fun Context.toast(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
Handler(Looper.getMainLooper()).post {
|
Handler(Looper.getMainLooper()).post {
|
||||||
Toast.makeText(this, message, duration).show()
|
//Toast.makeText(this, message, duration).show()
|
||||||
|
CustomToastUtils.showToast(message, duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,10 +83,19 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/cvDropdownBg"
|
||||||
|
android:layout_width="284dp"
|
||||||
|
android:layout_height="74dp"
|
||||||
|
app:cardElevation="0dp"
|
||||||
|
app:cardBackgroundColor="@android:color/transparent"
|
||||||
|
app:cardCornerRadius="10dp">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/flWarehouseDropdown"
|
android:id="@+id/flWarehouseDropdown"
|
||||||
android:layout_width="280dp"
|
android:layout_width="280dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="70dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:background="@drawable/bg_white_radius10_stroke"
|
android:background="@drawable/bg_white_radius10_stroke"
|
||||||
android:paddingHorizontal="30dp">
|
android:paddingHorizontal="30dp">
|
||||||
|
|
||||||
@@ -111,6 +120,7 @@
|
|||||||
android:src="@mipmap/ic_triangle_down"
|
android:src="@mipmap/ic_triangle_down"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
|||||||
@@ -170,7 +170,7 @@
|
|||||||
android:layout_marginEnd="70dp"
|
android:layout_marginEnd="70dp"
|
||||||
android:background="#00000000"
|
android:background="#00000000"
|
||||||
android:hint="请录入"
|
android:hint="请录入"
|
||||||
android:inputType="number"
|
android:inputType="numberDecimal"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingHorizontal="24dp"
|
android:paddingHorizontal="24dp"
|
||||||
android:textColor="#ff141428"
|
android:textColor="#ff141428"
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="960dp"
|
||||||
|
android:layout_height="540dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/bg_white_radius12"
|
||||||
|
tools:ignore="HardcodedText">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:src="@mipmap/ic_tip_warn"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvWarnContent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="80dp"
|
||||||
|
android:layout_marginVertical="50dp"
|
||||||
|
android:gravity="center"
|
||||||
|
tools:text="存在未收货的物品,请确认是否放弃收货,若放弃则数据不会保存?"
|
||||||
|
android:textColor="#ff141428"
|
||||||
|
android:textSize="36sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnCancel"
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="240dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:background="@drawable/bg_white_stroke_blue_ripple"
|
||||||
|
android:text="取消"
|
||||||
|
android:textColor="#FF0033CC"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnConfirm"
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="240dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:background="@drawable/bg_blue_ripple"
|
||||||
|
android:text="确认"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:cardCornerRadius="10dp"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
app:cardPreventCornerOverlap="true"
|
||||||
|
app:cardElevation="0dp"
|
||||||
|
app:cardBackgroundColor="@color/black">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/toast_tv"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="90dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingHorizontal="15dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="26sp"
|
||||||
|
tools:text="TextView"/>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
@@ -15,15 +15,22 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
android:paddingHorizontal="5dp"
|
||||||
android:text="物品名称"
|
android:text="物品名称"
|
||||||
android:textColor="#ff999999"
|
android:textColor="#ff999999"
|
||||||
android:textSize="26sp" />
|
android:textSize="26sp" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/tvProcurementUnit"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvProcurementUnit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
@@ -31,6 +38,28 @@
|
|||||||
android:textColor="#ff999999"
|
android:textColor="#ff999999"
|
||||||
android:textSize="26sp" />
|
android:textSize="26sp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/unitDivider"
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginHorizontal="5dp"
|
||||||
|
android:background="#FFD5E1FF"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvUnitHint"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:textColor="#FF1E2832"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:text="1袋=10斤" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvProcurementCount"
|
android:id="@+id/tvProcurementCount"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -43,41 +72,52 @@
|
|||||||
android:textColor="#ff999999"
|
android:textColor="#ff999999"
|
||||||
android:textSize="26sp" />
|
android:textSize="26sp" />
|
||||||
|
|
||||||
<TextView
|
<!-- <TextView-->
|
||||||
android:id="@+id/tvProcurementPrice"
|
<!-- android:id="@+id/tvProcurementPrice"-->
|
||||||
android:layout_width="0dp"
|
<!-- android:layout_width="0dp"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_weight="1"
|
<!-- android:layout_weight="1"-->
|
||||||
android:ellipsize="end"
|
<!-- android:ellipsize="end"-->
|
||||||
android:gravity="center"
|
<!-- android:gravity="center"-->
|
||||||
android:maxLines="1"
|
<!-- android:maxLines="1"-->
|
||||||
android:text="采购单价(元)"
|
<!-- android:text="采购单价(元)"-->
|
||||||
android:textColor="#ff999999"
|
<!-- android:textColor="#ff999999"-->
|
||||||
android:textSize="26sp" />
|
<!-- android:textSize="26sp" />-->
|
||||||
|
|
||||||
<TextView
|
<!-- <TextView-->
|
||||||
android:id="@+id/tvProcurementAmount"
|
<!-- android:id="@+id/tvProcurementAmount"-->
|
||||||
android:layout_width="0dp"
|
<!-- android:layout_width="0dp"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_weight="1"
|
<!-- android:layout_weight="1"-->
|
||||||
android:ellipsize="end"
|
<!-- android:ellipsize="end"-->
|
||||||
android:gravity="center"
|
<!-- android:gravity="center"-->
|
||||||
android:maxLines="1"
|
<!-- android:maxLines="1"-->
|
||||||
android:text="采购金额(元)"
|
<!-- android:text="采购金额(元)"-->
|
||||||
android:textColor="#ff999999"
|
<!-- android:textColor="#ff999999"-->
|
||||||
android:textSize="26sp" />
|
<!-- android:textSize="26sp" />-->
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/tvReceiptCount"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/etReceiptCount"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:inputType="none"
|
||||||
|
android:enabled="false"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
android:paddingHorizontal="5dp"
|
||||||
android:text="收货数量"
|
android:text="收货数量"
|
||||||
android:textColor="#ff999999"
|
android:textColor="#ff999999"
|
||||||
android:textSize="26sp" />
|
android:textSize="26sp"
|
||||||
|
tools:ignore="Autofill,LabelFor,TextFields" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvGoodsWeight"
|
android:id="@+id/tvGoodsWeight"
|
||||||
@@ -91,9 +131,33 @@
|
|||||||
android:textColor="#ff999999"
|
android:textColor="#ff999999"
|
||||||
android:textSize="26sp" />
|
android:textSize="26sp" />
|
||||||
|
|
||||||
<FrameLayout
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/etReceiptAmount"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:inputType="none"
|
||||||
|
android:enabled="false"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingHorizontal="5dp"
|
||||||
|
android:text="收货金额(元)"
|
||||||
|
android:textColor="#ff999999"
|
||||||
|
android:textSize="26sp"
|
||||||
|
tools:ignore="Autofill,LabelFor,TextFields" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
android:layout_weight="0.6">
|
android:layout_weight="0.6">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -112,11 +176,21 @@
|
|||||||
android:id="@+id/ivState"
|
android:id="@+id/ivState"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:src="@mipmap/ic_receipt_no"
|
android:src="@mipmap/ic_receipt_no"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
</FrameLayout>
|
<ImageView
|
||||||
|
android:id="@+id/ivClear"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="25dp"
|
||||||
|
android:src="@mipmap/ic_close"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -19,11 +19,17 @@
|
|||||||
android:textColor="#ff999999"
|
android:textColor="#ff999999"
|
||||||
android:textSize="26sp" />
|
android:textSize="26sp" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/tvProcurementUnit"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvGoodsUnit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
@@ -31,20 +37,59 @@
|
|||||||
android:textColor="#ff999999"
|
android:textColor="#ff999999"
|
||||||
android:textSize="26sp" />
|
android:textSize="26sp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/unitDivider"
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginHorizontal="5dp"
|
||||||
|
android:background="#FFD5E1FF"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvProcurementCount"
|
android:id="@+id/tvUnitHint"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:textColor="#FF1E2832"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:text="1袋=10斤" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/etGoodsCount"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center"
|
||||||
|
android:inputType="none"
|
||||||
|
android:enabled="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingHorizontal="5dp"
|
||||||
|
android:text="数量"
|
||||||
|
android:textColor="#ff999999"
|
||||||
|
android:textSize="26sp"
|
||||||
|
tools:ignore="Autofill,LabelFor,TextFields" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvGoodsWeight"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:text="数量"
|
android:text="物品重量(克)"
|
||||||
android:textColor="#ff999999"
|
android:textColor="#ff999999"
|
||||||
android:textSize="26sp" />
|
android:textSize="26sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvProcurementPrice"
|
android:id="@+id/tvGoodsPrice"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
@@ -55,17 +100,22 @@
|
|||||||
android:textColor="#ff999999"
|
android:textColor="#ff999999"
|
||||||
android:textSize="26sp" />
|
android:textSize="26sp" />
|
||||||
|
|
||||||
<TextView
|
<EditText
|
||||||
android:id="@+id/tvProcurementAmount"
|
android:id="@+id/etGoodsAmount"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:inputType="none"
|
||||||
|
android:enabled="false"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
android:paddingHorizontal="5dp"
|
||||||
android:text="金额(元)"
|
android:text="金额(元)"
|
||||||
android:textColor="#ff999999"
|
android:textColor="#ff999999"
|
||||||
android:textSize="26sp" />
|
android:textSize="26sp"
|
||||||
|
tools:ignore="Autofill,LabelFor,TextFields" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|||||||
Reference in New Issue
Block a user