设备联调优化,增加已采集物品弹窗
This commit is contained in:
@@ -50,9 +50,12 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.sw.inbound.activity.ReceiptActivity"
|
<activity android:name="com.sw.inbound.activity.ReceiptActivity"
|
||||||
android:screenOrientation="landscape"/>
|
android:screenOrientation="landscape"
|
||||||
<activity android:name="com.sw.inbound.activity.SelfProcurementActivity" />
|
android:windowSoftInputMode="adjustPan" />
|
||||||
<activity android:name="com.sw.inbound.activity.FoodCollectionActivity" />
|
<activity android:name="com.sw.inbound.activity.SelfProcurementActivity"
|
||||||
|
android:windowSoftInputMode="adjustPan" />
|
||||||
|
<activity android:name="com.sw.inbound.activity.FoodCollectionActivity"
|
||||||
|
android:windowSoftInputMode="adjustPan" />
|
||||||
|
|
||||||
<!-- <activity-->
|
<!-- <activity-->
|
||||||
<!-- android:name=".InitActivity"-->
|
<!-- android:name=".InitActivity"-->
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.sw.inbound.adapter.GoodsSearchAdapter
|
|||||||
import com.sw.inbound.databinding.ActivityFoodCollectionBinding
|
import com.sw.inbound.databinding.ActivityFoodCollectionBinding
|
||||||
import com.sw.inbound.databinding.LayoutCameraPreviewBinding
|
import com.sw.inbound.databinding.LayoutCameraPreviewBinding
|
||||||
import com.sw.inbound.databinding.LayoutEmptySearchBinding
|
import com.sw.inbound.databinding.LayoutEmptySearchBinding
|
||||||
|
import com.sw.inbound.dialog.CollectSearchDialog
|
||||||
import com.sw.inbound.dialog.Loading
|
import com.sw.inbound.dialog.Loading
|
||||||
import com.sw.inbound.model.response.SearchGoodsInfo
|
import com.sw.inbound.model.response.SearchGoodsInfo
|
||||||
import com.sw.inbound.objbox.Food
|
import com.sw.inbound.objbox.Food
|
||||||
@@ -152,6 +153,9 @@ class FoodCollectionActivity : ComponentActivity() {
|
|||||||
binding.btnTakePhoto.clickWithDebounce {
|
binding.btnTakePhoto.clickWithDebounce {
|
||||||
takePhoto()
|
takePhoto()
|
||||||
}
|
}
|
||||||
|
binding.btnCollectedGoods.setOnClickListener {
|
||||||
|
CollectSearchDialog(this@FoodCollectionActivity).show()
|
||||||
|
}
|
||||||
// binding.btnAddDefault.clickWithDebounce {
|
// binding.btnAddDefault.clickWithDebounce {
|
||||||
// Thread{
|
// Thread{
|
||||||
// FoodModule.initDefFoodData(this) {
|
// FoodModule.initDefFoodData(this) {
|
||||||
@@ -212,6 +216,8 @@ class FoodCollectionActivity : ComponentActivity() {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// binding.radioGroup.check(R.id.rbCollected)
|
// binding.radioGroup.check(R.id.rbCollected)
|
||||||
|
|
||||||
|
loadEmptyView()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.sw.inbound.dialog.DialogManager
|
|||||||
import com.sw.inbound.dialog.DropdownPopup
|
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.WarnDialog
|
||||||
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
|
||||||
@@ -169,13 +169,14 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
DialogManager.contains("GoodsRecognizeDialog") &&
|
DialogManager.contains("GoodsRecognizeDialog") &&
|
||||||
goodsRecognizeDialog?.isShowing == true) {
|
goodsRecognizeDialog?.isShowing == true) {
|
||||||
goodsRecognizeDialog?.dismiss()
|
goodsRecognizeDialog?.dismiss()
|
||||||
isShowRecognizeDialog = true
|
|
||||||
goodsRecognizeDialog = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.lastWeight = weight
|
this.lastWeight = weight
|
||||||
|
if (DialogManager.hasShowDialog()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
val checkResult = isFirstRecognize.not() && System.currentTimeMillis() - startTime <= DELAY_TIME
|
val checkResult = isFirstRecognize.not() && System.currentTimeMillis() - startTime <= DELAY_TIME
|
||||||
Timber.tag(TAG).d("recognizeWeight,checkResult=$checkResult")
|
Timber.tag(TAG).d("recognizeWeight,checkResult=$checkResult")
|
||||||
if (checkResult) {
|
if (checkResult) {
|
||||||
@@ -202,8 +203,13 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
Timber.tag(TAG).d("recognizeFood,takePhoto")
|
Timber.tag(TAG).d("recognizeFood,takePhoto")
|
||||||
isShowRecognizeDialog = false
|
isShowRecognizeDialog = false
|
||||||
//bindCamera()
|
//bindCamera()
|
||||||
cameraUtils.takePhoto(takePhotoSuccessCallback)
|
try {
|
||||||
isFirstRecognize = false
|
cameraUtils.takePhoto(takePhotoSuccessCallback)
|
||||||
|
isFirstRecognize = false
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Timber.tag(TAG).d("recognizeFood,takePhoto异常:${e.message}")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var dropdownPopup: DropdownPopup? = null
|
private var dropdownPopup: DropdownPopup? = null
|
||||||
@@ -265,7 +271,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
) {
|
) {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (goodsRecognizeDialog?.isShowing == true) {
|
if (goodsRecognizeDialog?.isShowing == true) {
|
||||||
isShowRecognizeDialog = false
|
//isShowRecognizeDialog = false
|
||||||
return@runOnUiThread
|
return@runOnUiThread
|
||||||
}
|
}
|
||||||
goodsRecognizeDialog = GoodsRecognizeDialog(
|
goodsRecognizeDialog = GoodsRecognizeDialog(
|
||||||
@@ -276,12 +282,8 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
) {
|
) {
|
||||||
GoodsSearchDialog(this).show()
|
GoodsSearchDialog(this).show()
|
||||||
}.apply {
|
}.apply {
|
||||||
setOnDismissListener {
|
|
||||||
goodsRecognizeDialog = null
|
|
||||||
isShowRecognizeDialog = true
|
|
||||||
}
|
|
||||||
if (isFinishing.not() && isDestroyed.not()) {
|
if (isFinishing.not() && isDestroyed.not()) {
|
||||||
isShowRecognizeDialog = false
|
//isShowRecognizeDialog = false
|
||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -415,7 +417,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
val count = goodsList.count { it.isLocalGoods }
|
val count = goodsList.count { it.isLocalGoods }
|
||||||
// 处理返回事件
|
// 处理返回事件
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
NotReceiptWarnDialog(context = this@GoodsListActivity) {
|
WarnDialog(context = this@GoodsListActivity, content = "存在未收货的物品,请确认是否放弃收货,若放弃则数据不会保存?") {
|
||||||
//onBackPressedDispatcher.onBackPressed()
|
//onBackPressedDispatcher.onBackPressed()
|
||||||
finish()
|
finish()
|
||||||
}.show()
|
}.show()
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.util.Log
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.sw.inbound.R
|
import com.sw.inbound.R
|
||||||
import com.sw.inbound.adapter.SelfProcurementAdapter
|
import com.sw.inbound.adapter.SelfProcurementAdapter
|
||||||
|
import com.sw.inbound.dialog.WarnDialog
|
||||||
import com.sw.inbound.model.request.PurchaseWarehouseParam
|
import com.sw.inbound.model.request.PurchaseWarehouseParam
|
||||||
import com.sw.inbound.model.response.DictType
|
import com.sw.inbound.model.response.DictType
|
||||||
import com.sw.inbound.utils.ext.toJsonString
|
import com.sw.inbound.utils.ext.toJsonString
|
||||||
@@ -22,11 +23,18 @@ class SelfProcurementActivity : GoodsListActivity() {
|
|||||||
notifyItemChanged(position)
|
notifyItemChanged(position)
|
||||||
}
|
}
|
||||||
addOnItemChildClickListener(R.id.ivState) { adapter, view, position ->
|
addOnItemChildClickListener(R.id.ivState) { adapter, view, position ->
|
||||||
removeAt(position)
|
///删除行数据弹窗
|
||||||
|
showWarnDialog(content = "请确认是否删除该条入库数据,删除后将无法恢复?") {
|
||||||
|
removeAt(position)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showWarnDialog(content:String, callback:()-> Unit) {
|
||||||
|
WarnDialog(context = this, content = content, confirmBlock = callback).show()
|
||||||
|
}
|
||||||
|
|
||||||
override fun initRecyclerView() {
|
override fun initRecyclerView() {
|
||||||
binding.rvGoodsList.let {
|
binding.rvGoodsList.let {
|
||||||
it.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
it.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||||
|
|||||||
@@ -26,30 +26,30 @@ class CollectSearchAdapter(var list: MutableList<SearchGoodsInfo.Record>) :
|
|||||||
holder.binding.let {
|
holder.binding.let {
|
||||||
it.tvGoodsName.run {
|
it.tvGoodsName.run {
|
||||||
text = item!!.goodsName
|
text = item!!.goodsName
|
||||||
// setTextColor(if (item!!.isSelected) "#FF0032C8".toColorInt() else "#FF666666".toColorInt())
|
setTextColor(if (item!!.isSelected) "#FF0032C8".toColorInt() else "#FF666666".toColorInt())
|
||||||
setTextColor("#FF666666".toColorInt())
|
//setTextColor("#FF666666".toColorInt())
|
||||||
|
}
|
||||||
|
it.root.run {
|
||||||
|
if (item!!.isSelected) {
|
||||||
|
setShapeDrawable(
|
||||||
|
solidColor = "#FFEAF0FF",
|
||||||
|
strokeColor = "#FF0033CC",
|
||||||
|
strokeWidth = 2.dp,
|
||||||
|
radius = 10.dp
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
setShapeDrawable(
|
||||||
|
solidColor = "#FFF5F5F5",
|
||||||
|
radius = 10.dp
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// it.root.run {
|
// it.root.run {
|
||||||
// if (item!!.isSelected) {
|
// setShapeDrawable(
|
||||||
// setShapeDrawable(
|
// solidColor = "#FFF5F5F5",
|
||||||
// solidColor = "#FFEAF0FF",
|
// radius = 10.dp
|
||||||
// strokeColor = "#FF0033CC",
|
// )
|
||||||
// strokeWidth = 2.dp,
|
|
||||||
// radius = 10.dp
|
|
||||||
// )
|
|
||||||
// } else {
|
|
||||||
// setShapeDrawable(
|
|
||||||
// solidColor = "#FFF5F5F5",
|
|
||||||
// radius = 10.dp
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
// }
|
||||||
it.root.run {
|
|
||||||
setShapeDrawable(
|
|
||||||
solidColor = "#FFF5F5F5",
|
|
||||||
radius = 10.dp
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.os.Bundle
|
|||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.sw.inbound.R
|
import com.sw.inbound.R
|
||||||
|
import com.sw.inbound.activity.FoodCollectionActivity
|
||||||
import com.sw.inbound.activity.GoodsListActivity
|
import com.sw.inbound.activity.GoodsListActivity
|
||||||
import com.sw.inbound.utils.ext.dp
|
import com.sw.inbound.utils.ext.dp
|
||||||
import com.sw.inbound.utils.ext.hideKeyboard
|
import com.sw.inbound.utils.ext.hideKeyboard
|
||||||
@@ -15,7 +16,7 @@ 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 = 800.dp
|
||||||
) : Dialog(context, R.style.DialogTheme) {
|
) : Dialog(context, R.style.DialogTheme) {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@@ -48,6 +49,17 @@ abstract class BaseDialog(
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getFoodCollectionActivity(): FoodCollectionActivity? {
|
||||||
|
var ctx = context
|
||||||
|
while (ctx is ContextWrapper) {
|
||||||
|
ctx = ctx.baseContext
|
||||||
|
if (ctx is FoodCollectionActivity) {
|
||||||
|
return ctx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
super.show()
|
super.show()
|
||||||
DialogManager.addDialog(this)
|
DialogManager.addDialog(this)
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ import android.annotation.SuppressLint
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.sw.inbound.R
|
import com.sw.inbound.R
|
||||||
import com.sw.inbound.activity.GoodsListActivity
|
import com.sw.inbound.activity.FoodCollectionActivity
|
||||||
import com.sw.inbound.adapter.CollectSearchAdapter
|
import com.sw.inbound.adapter.CollectSearchAdapter
|
||||||
import com.sw.inbound.databinding.DialogCollectSearchBinding
|
import com.sw.inbound.databinding.DialogCollectSearchBinding
|
||||||
import com.sw.inbound.databinding.LayoutEmptySearchBinding
|
import com.sw.inbound.databinding.LayoutEmptySearchBinding
|
||||||
@@ -34,14 +35,31 @@ class CollectSearchDialog(
|
|||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
private var activity: GoodsListActivity? = null
|
private var activity: FoodCollectionActivity? = null
|
||||||
override fun initView() {
|
override fun initView() {
|
||||||
activity = getReceiptActivity()
|
activity = getFoodCollectionActivity()
|
||||||
binding.ivClose.setOnClickListener { dismiss() }
|
binding.ivClose.setOnClickListener { dismiss() }
|
||||||
binding.ivGoodsSearch.setOnClickListener { searchGoods() }
|
binding.ivGoodsSearch.setOnClickListener {
|
||||||
|
val searchName = binding.etInputGoods.text.toString().trim()
|
||||||
|
if (searchName.isBlank()) {
|
||||||
|
activity?.toast("请输入物品名称")
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
getCollectGoods(searchName)
|
||||||
|
}
|
||||||
binding.etInputGoods.let { v ->
|
binding.etInputGoods.let { v ->
|
||||||
v.addOnActionSearchListener {
|
v.addOnActionSearchListener {
|
||||||
searchGoods()
|
val searchName = binding.etInputGoods.text.toString().trim()
|
||||||
|
if (searchName.isBlank()) {
|
||||||
|
activity?.toast("请输入物品名称")
|
||||||
|
return@addOnActionSearchListener
|
||||||
|
}
|
||||||
|
getCollectGoods(searchName)
|
||||||
|
}
|
||||||
|
v.addTextChangedListener {
|
||||||
|
if (it.isNullOrBlank()) {
|
||||||
|
getCollectGoods()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.btnConfirm.setOnClickListener {
|
binding.btnConfirm.setOnClickListener {
|
||||||
@@ -56,55 +74,28 @@ class CollectSearchDialog(
|
|||||||
it.setEnableLoadMore(false)
|
it.setEnableLoadMore(false)
|
||||||
it.setOnRefreshListener {
|
it.setOnRefreshListener {
|
||||||
pageNo = 1
|
pageNo = 1
|
||||||
searchGoods()
|
val searchName = binding.etInputGoods.text.toString().trim()
|
||||||
}
|
getCollectGoods(searchName)
|
||||||
it.setOnLoadMoreListener {
|
|
||||||
searchGoods()
|
|
||||||
}
|
}
|
||||||
|
//it.setOnLoadMoreListener {
|
||||||
|
// searchGoods()
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
getCollectGoods()
|
getCollectGoods()
|
||||||
|
//binding.root.clickWithDebounce {
|
||||||
|
// Thread {
|
||||||
|
// FoodModule.initDefFoodData(activity!!) {
|
||||||
|
// activity?.runOnUiThread {
|
||||||
|
// activity?.toast("添加完成")
|
||||||
|
// getCollectGoods()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }.start()
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var pageNo = 1
|
private var pageNo = 1
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val PAGE_SIZE = 10
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
|
||||||
private fun searchGoods() {
|
|
||||||
val searchName = binding.etInputGoods.text.toString().trim()
|
|
||||||
if (searchName.isBlank()) {
|
|
||||||
activity?.toast("请输入物品名称")
|
|
||||||
finishRefresh()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
activity?.searchGoods(
|
|
||||||
searchName = searchName,
|
|
||||||
pageNo = pageNo,
|
|
||||||
pageSize = PAGE_SIZE
|
|
||||||
) { records ->
|
|
||||||
finishRefresh()
|
|
||||||
binding.etInputGoods.hideKeyboard()
|
|
||||||
if (pageNo == 1) {
|
|
||||||
list.clear()
|
|
||||||
}
|
|
||||||
list.addAll(records)
|
|
||||||
if (list.isEmpty()) {
|
|
||||||
loadEmptyView()
|
|
||||||
return@searchGoods
|
|
||||||
}
|
|
||||||
val enableLoadMore = records.size >= PAGE_SIZE
|
|
||||||
binding.refreshLayout.setEnableLoadMore(enableLoadMore)
|
|
||||||
if (enableLoadMore) {
|
|
||||||
pageNo++
|
|
||||||
}
|
|
||||||
binding.rvSearch.layoutManager =
|
|
||||||
GridLayoutManager(context, 2, GridLayoutManager.VERTICAL, false)
|
|
||||||
searchAdapter.notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadEmptyView() {
|
private fun loadEmptyView() {
|
||||||
binding.rvSearch.layoutManager =
|
binding.rvSearch.layoutManager =
|
||||||
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||||
@@ -140,9 +131,9 @@ class CollectSearchDialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteGoods(position:Int) {
|
private fun deleteGoods(position: Int) {
|
||||||
WarnDialog(context = context, content = "请确认是否删除该物品?", confirmBlock = {
|
WarnDialog(context = context, content = "请确认是否删除物品:${list[position].goodsName}?", confirmBlock = {
|
||||||
Thread{
|
Thread {
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
Loading.show(context)
|
Loading.show(context)
|
||||||
}
|
}
|
||||||
@@ -151,9 +142,13 @@ class CollectSearchDialog(
|
|||||||
box?.removeByIds(filterIdList)
|
box?.removeByIds(filterIdList)
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
Loading.dismiss()
|
Loading.dismiss()
|
||||||
list.removeAt(position)
|
//list.remove(list[position])
|
||||||
searchAdapter.notifyDataSetChanged()
|
//searchAdapter.notifyDataSetChanged()
|
||||||
|
searchAdapter.removeAt(position)
|
||||||
activity?.toast("删除成功")
|
activity?.toast("删除成功")
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
loadEmptyView()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.start()
|
}.start()
|
||||||
}).show()
|
}).show()
|
||||||
@@ -170,19 +165,28 @@ class CollectSearchDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var box: Box<Food>? = null
|
private var box: Box<Food>? = null
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
private fun getCollectGoods() {
|
private fun getCollectGoods(searchName:String?=null) {
|
||||||
if (box == null) {
|
if (box == null) {
|
||||||
box = ObjectBox.boxStore.boxFor(Food::class)
|
box = ObjectBox.boxStore.boxFor(Food::class)
|
||||||
}
|
}
|
||||||
box?.all?.distinctBy { it.name }?.forEach {
|
list.clear()
|
||||||
|
var queryList = box?.all?.distinctBy { it.name }
|
||||||
|
if (searchName.isNullOrBlank().not()) {
|
||||||
|
queryList = queryList?.filter { it.name?.contains(searchName) == true }
|
||||||
|
}
|
||||||
|
queryList?.forEach {
|
||||||
list.add((SearchGoodsInfo.Record(goodsName = it.name)))
|
list.add((SearchGoodsInfo.Record(goodsName = it.name)))
|
||||||
}
|
}
|
||||||
binding.rvSearch.layoutManager = GridLayoutManager(activity, 2, LinearLayoutManager.VERTICAL, false)
|
binding.rvSearch.layoutManager =
|
||||||
|
GridLayoutManager(activity, 2, LinearLayoutManager.VERTICAL, false)
|
||||||
searchAdapter.notifyDataSetChanged()
|
searchAdapter.notifyDataSetChanged()
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
loadEmptyView()
|
loadEmptyView()
|
||||||
}
|
}
|
||||||
|
finishRefresh()
|
||||||
|
binding.root.hideKeyboard()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ package com.sw.inbound.dialog
|
|||||||
|
|
||||||
object DialogManager {
|
object DialogManager {
|
||||||
|
|
||||||
private var dialogList:MutableList<BaseDialog> = mutableListOf()
|
private var dialogList: MutableList<BaseDialog> = mutableListOf()
|
||||||
|
|
||||||
fun addDialog(dialog: BaseDialog) {
|
fun addDialog(dialog: BaseDialog) {
|
||||||
if (dialogList.contains(dialog).not()) {
|
if (dialogList.contains(dialog).not()) {
|
||||||
@@ -17,7 +17,7 @@ object DialogManager {
|
|||||||
dialogList.remove(dialog)
|
dialogList.remove(dialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDialogList():MutableList<BaseDialog> {
|
fun getDialogList(): MutableList<BaseDialog> {
|
||||||
return dialogList
|
return dialogList
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,9 +35,14 @@ object DialogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun contains(vararg className: String):Boolean {
|
fun contains(vararg className: String): Boolean {
|
||||||
val item = dialogList.firstOrNull { className.contains(it.javaClass.simpleName) }
|
val item = dialogList.firstOrNull { className.contains(it.javaClass.simpleName) }
|
||||||
return item != null
|
return item != null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun hasShowDialog(): Boolean {
|
||||||
|
val item = dialogList.firstOrNull { it.isShowing }
|
||||||
|
return item != null
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -98,4 +98,12 @@ class GoodsRecognizeDialog(
|
|||||||
recognizeAdapter.stateView = it
|
recognizeAdapter.stateView = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun dismiss() {
|
||||||
|
super.dismiss()
|
||||||
|
activity?.run {
|
||||||
|
isShowRecognizeDialog = true
|
||||||
|
goodsRecognizeDialog = null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,34 +1,34 @@
|
|||||||
package com.sw.inbound.dialog
|
//package com.sw.inbound.dialog
|
||||||
|
//
|
||||||
import android.content.Context
|
//import android.content.Context
|
||||||
import android.view.LayoutInflater
|
//import android.view.LayoutInflater
|
||||||
import android.view.View
|
//import android.view.View
|
||||||
import com.sw.inbound.databinding.DialogNotReceiptWarnBinding
|
//import com.sw.inbound.databinding.DialogNotReceiptWarnBinding
|
||||||
import com.sw.inbound.utils.ext.dp
|
//import com.sw.inbound.utils.ext.dp
|
||||||
|
//
|
||||||
class NotReceiptWarnDialog(
|
//class NotReceiptWarnDialog(
|
||||||
context: Context,
|
// context: Context,
|
||||||
var cancelBlock: () -> Unit = {},
|
// var cancelBlock: () -> Unit = {},
|
||||||
var confirmBlock: () -> Unit = {},
|
// var confirmBlock: () -> Unit = {},
|
||||||
) : BaseDialog(context = context, defWidth = 960.dp, defHeight = 540.dp) {
|
//) : BaseDialog(context = context, defWidth = 960.dp, defHeight = 540.dp) {
|
||||||
|
//
|
||||||
private lateinit var binding: DialogNotReceiptWarnBinding
|
// private lateinit var binding: DialogNotReceiptWarnBinding
|
||||||
override fun getRootView(): View {
|
// override fun getRootView(): View {
|
||||||
val inflater = LayoutInflater.from(context)
|
// val inflater = LayoutInflater.from(context)
|
||||||
binding = DialogNotReceiptWarnBinding.inflate(inflater)
|
// binding = DialogNotReceiptWarnBinding.inflate(inflater)
|
||||||
return binding.root
|
// return binding.root
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun initView() {
|
// override fun initView() {
|
||||||
binding.btnCancel.setOnClickListener {
|
// binding.btnCancel.setOnClickListener {
|
||||||
cancelBlock()
|
// cancelBlock()
|
||||||
dismiss()
|
// dismiss()
|
||||||
}
|
// }
|
||||||
binding.btnConfirm.setOnClickListener {
|
// binding.btnConfirm.setOnClickListener {
|
||||||
confirmBlock()
|
// confirmBlock()
|
||||||
dismiss()
|
// dismiss()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
@@ -12,7 +12,7 @@ class WarnDialog(
|
|||||||
var content:String,
|
var content:String,
|
||||||
var cancelBlock: () -> Unit = {},
|
var cancelBlock: () -> Unit = {},
|
||||||
var confirmBlock: () -> Unit = {},
|
var confirmBlock: () -> Unit = {},
|
||||||
) : BaseDialog(context = context, defWidth = 960.dp, defHeight = 540.dp) {
|
) : BaseDialog(context = context, defWidth = 660.dp, defHeight = 360.dp) {
|
||||||
|
|
||||||
private lateinit var binding: DialogWarnBinding
|
private lateinit var binding: DialogWarnBinding
|
||||||
override fun getRootView(): View {
|
override fun getRootView(): View {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class PhotoCaptureHelper(
|
|||||||
if (errorMsg.contains("Not bound to a valid Camera")) {
|
if (errorMsg.contains("Not bound to a valid Camera")) {
|
||||||
if (bindCamera != null) {
|
if (bindCamera != null) {
|
||||||
bindCamera?.invoke()
|
bindCamera?.invoke()
|
||||||
takePhoto()
|
//takePhoto()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,16 @@
|
|||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btnCollectedGoods"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingHorizontal="20dp"
|
||||||
|
android:text="查看已采集物品"
|
||||||
|
android:textColor="#ff333333"
|
||||||
|
android:textSize="24sp" />
|
||||||
|
|
||||||
<!-- <TextView-->
|
<!-- <TextView-->
|
||||||
<!-- android:id="@+id/btnAddDefault"-->
|
<!-- android:id="@+id/btnAddDefault"-->
|
||||||
<!-- android:layout_width="wrap_content"-->
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="960dp"
|
android:layout_width="660dp"
|
||||||
android:layout_height="540dp"
|
android:layout_height="360dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="@drawable/bg_white_radius12"
|
android:background="@drawable/bg_white_radius12"
|
||||||
tools:ignore="HardcodedText">
|
tools:ignore="HardcodedText">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="60dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="60dp"
|
android:layout_height="50dp"
|
||||||
android:src="@mipmap/ic_tip_warn"
|
android:src="@mipmap/ic_tip_warn"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
@@ -18,42 +18,41 @@
|
|||||||
android:id="@+id/tvWarnContent"
|
android:id="@+id/tvWarnContent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="80dp"
|
android:layout_marginHorizontal="40dp"
|
||||||
android:layout_marginVertical="50dp"
|
android:layout_marginVertical="50dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
tools:text="存在未收货的物品,请确认是否放弃收货,若放弃则数据不会保存?"
|
tools:text="存在未收货的物品,请确认是否放弃收货,若放弃则数据不会保存?"
|
||||||
android:textColor="#ff141428"
|
android:textColor="#ff141428"
|
||||||
android:textSize="36sp"
|
android:textSize="32sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnCancel"
|
android:id="@+id/btnCancel"
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
android:layout_width="240dp"
|
android:layout_width="180dp"
|
||||||
android:layout_height="80dp"
|
android:layout_height="60dp"
|
||||||
android:background="@drawable/bg_white_stroke_blue_ripple"
|
android:background="@drawable/bg_white_stroke_blue_ripple"
|
||||||
android:text="取消"
|
android:text="取消"
|
||||||
android:textColor="#FF0033CC"
|
android:textColor="#FF0033CC"
|
||||||
android:textSize="30sp"
|
android:textSize="26sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnConfirm"
|
android:id="@+id/btnConfirm"
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
android:layout_width="240dp"
|
android:layout_width="180dp"
|
||||||
android:layout_height="80dp"
|
android:layout_height="60dp"
|
||||||
android:layout_marginStart="50dp"
|
android:layout_marginStart="50dp"
|
||||||
android:background="@drawable/bg_blue_ripple"
|
android:background="@drawable/bg_blue_ripple"
|
||||||
android:text="确认"
|
android:text="确认"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="30sp"
|
android:textSize="26sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -136,8 +136,9 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ivState"
|
android:id="@+id/ivState"
|
||||||
android:layout_width="50dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="80dp"
|
||||||
|
android:padding="25dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:src="@mipmap/ic_close"
|
android:src="@mipmap/ic_close"
|
||||||
|
|||||||
Reference in New Issue
Block a user