init: init proj
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.databinding.ActivityBoxAssembleBinding
|
||||
import com.lukouguoji.gjc.holder.BoxAssembleViewHolder
|
||||
import com.lukouguoji.gjc.viewModel.BoxAssembleViewModel
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.base.CommonAdapter
|
||||
import com.lukouguoji.module_base.common.ConstantEvent
|
||||
import com.lukouguoji.module_base.impl.FlowBus
|
||||
import com.lukouguoji.module_base.impl.observe
|
||||
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
|
||||
/**
|
||||
* 板箱组装
|
||||
*/
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_BOX_ASSEMBLE)
|
||||
class BoxAssembleActivity :
|
||||
BaseBindingActivity<ActivityBoxAssembleBinding, BoxAssembleViewModel>() {
|
||||
|
||||
override fun layoutId() = R.layout.activity_box_assemble
|
||||
|
||||
override fun viewModelClass() = BoxAssembleViewModel::class.java
|
||||
|
||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||
setBackArrow("国际出港板箱组装")
|
||||
binding.viewModel = viewModel
|
||||
|
||||
binding.rv.adapter =
|
||||
CommonAdapter(this, R.layout.item_box_assemble, BoxAssembleViewHolder::class.java)
|
||||
binding.rv.addOnItemClickListener(viewModel)
|
||||
// 绑定刷新事件
|
||||
viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this)
|
||||
|
||||
// 刷新数据
|
||||
viewModel.getData()
|
||||
|
||||
FlowBus.with<Any>(ConstantEvent.GJC_BOX_ADD_SUCCESS)
|
||||
.observe(this) {
|
||||
viewModel.getData()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.databinding.ActivityGjcBoxAssembleAddBinding
|
||||
import com.lukouguoji.gjc.holder.BoxAddListViewHolder
|
||||
import com.lukouguoji.gjc.viewModel.GjcBoxAssembleAddViewModel
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.base.CommonAdapter
|
||||
import com.lukouguoji.module_base.bean.GjcWaybillBean
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.common.ConstantEvent
|
||||
import com.lukouguoji.module_base.impl.FlowBus
|
||||
import com.lukouguoji.module_base.impl.observe
|
||||
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
||||
import com.lukouguoji.module_base.ktx.loge
|
||||
import com.lukouguoji.module_base.ktx.noNull
|
||||
|
||||
class GjcBoxAssembleAddActivity :
|
||||
BaseBindingActivity<ActivityGjcBoxAssembleAddBinding, GjcBoxAssembleAddViewModel>() {
|
||||
|
||||
override fun layoutId() = R.layout.activity_gjc_box_assemble_add
|
||||
|
||||
override fun viewModelClass() = GjcBoxAssembleAddViewModel::class.java
|
||||
|
||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||
setBackArrow("国际出港开始组装")
|
||||
val locId = intent.getStringExtra(Constant.Key.DATA)
|
||||
// 获取传入的数据
|
||||
viewModel.insertId = locId.noNull()
|
||||
viewModel.isAdd.value = locId.isNullOrEmpty()
|
||||
|
||||
binding.viewModel = viewModel
|
||||
|
||||
binding.rv.adapter = CommonAdapter(
|
||||
requireContext(),
|
||||
R.layout.item_box_add,
|
||||
BoxAddListViewHolder::class.java
|
||||
)
|
||||
binding.rv.addOnItemClickListener(viewModel)
|
||||
|
||||
viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this)
|
||||
|
||||
viewModel.getData()
|
||||
|
||||
// 监听待装运单选中事件
|
||||
FlowBus.with<List<GjcWaybillBean>>(ConstantEvent.GJC_UNLOAD_LIST_CHECKED)
|
||||
.observe(this) {
|
||||
viewModel.onWaybillListSelected(requireContext(), it)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun start(context: Context, locId: String = "") {
|
||||
val starter = Intent(context, GjcBoxAssembleAddActivity::class.java)
|
||||
.putExtra(Constant.Key.DATA, locId)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,638 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.alibaba.android.arouter.facade.annotation.Autowired
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.model.GjcFuBang
|
||||
import com.lukouguoji.gjc.viewModel.GjcFuBangViewModel
|
||||
import com.lukouguoji.module_base.BaseActivity
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.ktx.noNull
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
import com.lukouguoji.module_base.util.Common
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_FU_BANG)
|
||||
class GjcFuBangActivity : BaseActivity(), View.OnClickListener {
|
||||
private lateinit var viewModel: GjcFuBangViewModel
|
||||
|
||||
private lateinit var carId: EditText
|
||||
private lateinit var carIdScan: ImageView
|
||||
private lateinit var uld: EditText
|
||||
private lateinit var uldScan: ImageView
|
||||
private lateinit var dibangWeight: EditText
|
||||
private lateinit var dibangWeightScan: ImageView
|
||||
|
||||
//第一行
|
||||
private lateinit var carWeight: EditText
|
||||
private lateinit var uldWeight: EditText
|
||||
private lateinit var netWeight: EditText
|
||||
|
||||
//第二行
|
||||
private lateinit var dgrCode: EditText
|
||||
private lateinit var boardType: EditText
|
||||
private lateinit var cargoWeight: EditText
|
||||
|
||||
//第三行
|
||||
private lateinit var plClose: Button
|
||||
private lateinit var plCloseSize: EditText
|
||||
private lateinit var plCloseSizeMust: TextView
|
||||
private lateinit var totalWeight: EditText
|
||||
|
||||
//第四行
|
||||
private lateinit var height: EditText
|
||||
private lateinit var fdate: Button
|
||||
private lateinit var fno: EditText
|
||||
|
||||
//第5行
|
||||
private lateinit var fdest: EditText
|
||||
private lateinit var cargoType: Button
|
||||
|
||||
private lateinit var remark: EditText
|
||||
|
||||
private lateinit var submit: TextView
|
||||
|
||||
private val ymdSdf = SimpleDateFormat("yyyy-MM-dd")//年月日
|
||||
private val calendar = Calendar.getInstance()
|
||||
|
||||
@JvmField
|
||||
@Autowired
|
||||
var carNoParam: String? = null
|
||||
|
||||
@JvmField
|
||||
@Autowired
|
||||
var userIdParam: String? = null
|
||||
|
||||
private fun initView() {
|
||||
carId = findViewById(R.id.carId)
|
||||
carIdScan = findViewById(R.id.carIdScan)
|
||||
uld = findViewById(R.id.uld)
|
||||
uldScan = findViewById(R.id.uldScan)
|
||||
dibangWeight = findViewById(R.id.dibangWeight)
|
||||
dibangWeightScan = findViewById(R.id.dibangWeightScan)
|
||||
|
||||
//第一行
|
||||
carWeight = findViewById(R.id.carWeight)
|
||||
uldWeight = findViewById(R.id.uldWeight)
|
||||
netWeight = findViewById(R.id.netWeight)
|
||||
|
||||
//第二行
|
||||
dgrCode = findViewById(R.id.dgrCode)
|
||||
boardType = findViewById(R.id.boardType)
|
||||
cargoWeight = findViewById(R.id.cargoWeight)
|
||||
|
||||
//第三行
|
||||
plClose = findViewById(R.id.plClose)
|
||||
plCloseSizeMust = findViewById(R.id.plCloseSizeMust)
|
||||
plCloseSize = findViewById(R.id.plCloseSize)
|
||||
totalWeight = findViewById(R.id.totalWeight)
|
||||
|
||||
//第四行
|
||||
height = findViewById(R.id.height)
|
||||
fdate = findViewById(R.id.fdate)
|
||||
fno = findViewById(R.id.fno)
|
||||
|
||||
//第五行
|
||||
fdest = findViewById(R.id.fdest)
|
||||
cargoType = findViewById(R.id.cargoType)
|
||||
|
||||
remark = findViewById(R.id.remark)
|
||||
submit = findViewById(R.id.submit)
|
||||
|
||||
carIdScan.setOnClickListener(this)
|
||||
uldScan.setOnClickListener(this)
|
||||
dibangWeightScan.setOnClickListener(this)
|
||||
plClose.setOnClickListener(this)
|
||||
fdate.setOnClickListener(this)
|
||||
cargoType.setOnClickListener(this)
|
||||
submit.setOnClickListener(this)
|
||||
|
||||
fdate.text = ymdSdf.format(calendar.time)
|
||||
|
||||
///////////// 监听edittext变化
|
||||
dibangWeight.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
if (s != null && s.toString().trim() != "") {
|
||||
val tempWeight = s.toString().toDouble()
|
||||
//架子车自重
|
||||
var carWeightDouble = 0.0
|
||||
if (carWeight.text.toString().trim() != "") {
|
||||
carWeightDouble = carWeight.text.toString().trim().toDouble()
|
||||
}
|
||||
//集装器自重
|
||||
var uldWeightDouble = 0.0
|
||||
if (uldWeight.text.toString().trim() != "") {
|
||||
uldWeightDouble = uldWeight.text.toString().trim().toDouble()
|
||||
}
|
||||
|
||||
//赋值
|
||||
//装机重
|
||||
netWeight.setText("${tempWeight - carWeightDouble}")
|
||||
//货重
|
||||
cargoWeight.setText("${tempWeight - carWeightDouble - uldWeightDouble}")
|
||||
//总重
|
||||
totalWeight.setText("$tempWeight")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
carWeight.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
if (s != null && s.toString().trim() != "") {
|
||||
val tempWeight = s.toString().toDouble()
|
||||
//地磅
|
||||
var dibangWeightDouble = 0.0
|
||||
if (dibangWeight.text.toString().trim() != "") {
|
||||
dibangWeightDouble = dibangWeight.text.toString().trim().toDouble()
|
||||
}
|
||||
//集装器自重
|
||||
var uldWeightDouble = 0.0
|
||||
if (uldWeight.text.toString().trim() != "") {
|
||||
uldWeightDouble = uldWeight.text.toString().trim().toDouble()
|
||||
}
|
||||
|
||||
//赋值
|
||||
//装机重
|
||||
netWeight.setText("${dibangWeightDouble - tempWeight}")
|
||||
//货重
|
||||
cargoWeight.setText("${dibangWeightDouble - tempWeight - uldWeightDouble}")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
uldWeight.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
if (s != null && s.toString().trim() != "") {
|
||||
val tempWeight = s.toString().toDouble()
|
||||
//地磅
|
||||
var dibangWeightDouble = 0.0
|
||||
if (dibangWeight.text.toString().trim() != "") {
|
||||
dibangWeightDouble = dibangWeight.text.toString().trim().toDouble()
|
||||
}
|
||||
//架子车自重
|
||||
var carWeightDouble = 0.0
|
||||
if (carWeight.text.toString().trim() != "") {
|
||||
carWeightDouble = carWeight.text.toString().trim().toDouble()
|
||||
}
|
||||
|
||||
//赋值
|
||||
//货重
|
||||
cargoWeight.setText("${dibangWeightDouble - carWeightDouble - tempWeight}")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
//失去焦点
|
||||
carId.onFocusChangeListener = View.OnFocusChangeListener { v, hasFocus ->
|
||||
if (hasFocus) {
|
||||
|
||||
} else {
|
||||
//失去焦点
|
||||
// viewModel.queryFlatcarGjcReceive(carId.text.toString())
|
||||
viewModel.getBoxDetailsByCarId(carId.text.toString())
|
||||
}
|
||||
}
|
||||
uld.onFocusChangeListener = View.OnFocusChangeListener { v, hasFocus ->
|
||||
if (hasFocus) {
|
||||
|
||||
} else {
|
||||
//失去焦点
|
||||
viewModel.queryUldGjcReceive(uld.text.toString())
|
||||
}
|
||||
}
|
||||
fno.onFocusChangeListener = View.OnFocusChangeListener { v, hasFocus ->
|
||||
if (hasFocus) {
|
||||
|
||||
} else {
|
||||
if (fdate.text.toString() != "" && fno.text.toString() != "") {
|
||||
viewModel.queryFlight(fdate.text.toString(), fno.text.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
fno.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun afterTextChanged(editable: Editable?) {
|
||||
val originText = editable.toString()
|
||||
if (originText != null && originText != "") {
|
||||
val regularExpression = "(^([A-Z0-9]+)$)"
|
||||
val matches = originText.matches(regularExpression.toRegex())
|
||||
if (!matches) {
|
||||
val regularExpression2 = "([^A-Za-z0-9]+)"
|
||||
val replaceStr = originText.replace(regularExpression2.toRegex(), "")
|
||||
val replaceStrToUpper = replaceStr.uppercase(Locale.ROOT)//小写转大写
|
||||
fno.setText(replaceStrToUpper)
|
||||
fno.setSelection(replaceStrToUpper.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
//赋值
|
||||
viewModel.fuBangInfo.cargoType = "0"//货物类型初始化 默认 0-> 计重货
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_gjc_fu_bang)
|
||||
setBackArrow("板箱过磅")
|
||||
viewModel = ViewModelProvider(this).get(GjcFuBangViewModel::class.java)
|
||||
initView()
|
||||
|
||||
|
||||
//监听完成过磅
|
||||
viewModel.completedObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
val data = it.getString("data")
|
||||
if (Constant.Result.succ == status) {
|
||||
if (data == "1") {
|
||||
carId.setText("")
|
||||
Common.alertDialog(this, "完成过磅!") { dialog ->
|
||||
resetData()
|
||||
dialog.dismiss()
|
||||
}
|
||||
} else if (data == "3") {
|
||||
Common.alertDialog(this, "航班不存在!") { dialog ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
|
||||
} else if (data == "4") {
|
||||
Common.alertDialog(this, "航班已关闭!") { dialog ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
|
||||
} else if (data == "5") {
|
||||
Common.alertDialog(this, "航班已截载!") { dialog ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
|
||||
} else {
|
||||
Common.alertDialog(this, "过磅失败!") { dialog ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Common.showToastLong(this, "收运失败! ")
|
||||
Common.alertDialog(this, "过磅失败!") { dialog ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//集装器编号,查询集装器自重
|
||||
viewModel.queryUldGjcReceiveObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
val data = it.getJSONObject("data")
|
||||
if (Constant.Result.succ == status && data != null) {
|
||||
val uldWeightTemp = data.getIntValue("uldWeight")
|
||||
uldWeight.setText("$uldWeightTemp")
|
||||
}
|
||||
}
|
||||
|
||||
//托盘编号,查询集装器自重
|
||||
viewModel.queryFlatcarGjcReceiveObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
val data = it.getJSONObject("data")
|
||||
if (Constant.Result.succ == status && data != null) {
|
||||
val carWeightTemp = data.getIntValue("carWeight")
|
||||
carWeight.setText("$carWeightTemp")
|
||||
}
|
||||
}
|
||||
|
||||
//航班返回结果
|
||||
viewModel.queryFlightObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
if (Constant.Result.succ == status) {
|
||||
var jsonObject = it.getJSONObject("data")
|
||||
val countryName = jsonObject.getString("countryName")
|
||||
val countryType = jsonObject.getString("countryType")
|
||||
val dep = jsonObject.getString("fdep")
|
||||
val dest = jsonObject.getString("fdest")
|
||||
|
||||
fdest.setText(dest)
|
||||
} else {
|
||||
fdest.setText("")
|
||||
}
|
||||
}
|
||||
|
||||
//下拉框赋值
|
||||
val plClose = JSONObject()
|
||||
plClose["code"] = ""
|
||||
plClose["name"] = "请选择"
|
||||
val plClose1 = JSONObject()
|
||||
plClose1["code"] = "探板"
|
||||
plClose1["name"] = "探板"
|
||||
val plClose2 = JSONObject()
|
||||
plClose2["code"] = "收口"
|
||||
plClose2["name"] = "收口"
|
||||
viewModel.plCloseList.add(plClose)
|
||||
viewModel.plCloseList.add(plClose1)
|
||||
viewModel.plCloseList.add(plClose2)
|
||||
|
||||
viewModel.cargoSelect(System.currentTimeMillis().toString())
|
||||
viewModel.cargoObserver.observe(this) { vd ->
|
||||
viewModel.cargoList = vd.getJSONArray("data")
|
||||
for ((index, obj) in viewModel.cargoList.withIndex()) {
|
||||
val tempObj = obj as JSONObject
|
||||
val name = tempObj.getString("name")
|
||||
val code = tempObj.getString("code")
|
||||
if (viewModel.fuBangInfo.cargoType == code) {
|
||||
cargoType.text = name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.boxDetails.observe(this) {
|
||||
it.gjcLoading?.firstOrNull()?.let { bean ->
|
||||
uld.setText(bean.uld.noNull())
|
||||
carWeight.setText(it.carweight.noNull())
|
||||
uldWeight.setText(bean.uldweight.noNull())
|
||||
|
||||
fdate.text = bean.fdate.noNull()
|
||||
fno.setText(bean.fno.noNull())
|
||||
fdest.setText(bean.dest.noNull())
|
||||
|
||||
bean.cargotype?.let { cargoType ->
|
||||
viewModel.cargoList.forEach { cargo ->
|
||||
val cargoObj = cargo as JSONObject
|
||||
if (cargoObj.getString("code") == cargoType) {
|
||||
this.cargoType.text = cargoObj.getString("name")
|
||||
viewModel.fuBangInfo.cargoType = cargoObj.getString("code")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
v?.let {
|
||||
when (it.id) {
|
||||
R.id.carIdScan -> {
|
||||
scanCode(Constant.RequestCode.gjc_fubang_car_id)
|
||||
}
|
||||
|
||||
R.id.uldScan -> {
|
||||
scanCode(Constant.RequestCode.gjc_fubang_uld_id)
|
||||
}
|
||||
|
||||
R.id.dibangWeightScan -> {
|
||||
dibangWeight.setText("")
|
||||
}
|
||||
|
||||
R.id.plClose -> {
|
||||
Common.singleSelect(
|
||||
this,
|
||||
"探板收口",
|
||||
viewModel.plCloseList,
|
||||
viewModel.fuBangInfo.plClose
|
||||
) { position, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
plClose.text = name
|
||||
viewModel.fuBangInfo.plClose = code
|
||||
|
||||
if (code != "") {
|
||||
plCloseSizeMust.visibility = View.VISIBLE
|
||||
plCloseSize.isEnabled = true
|
||||
} else {
|
||||
plCloseSizeMust.visibility = View.GONE
|
||||
plCloseSize.isEnabled = false
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
R.id.cargoType -> {
|
||||
Common.singleSelect(
|
||||
this,
|
||||
"货物类型",
|
||||
viewModel.cargoList,
|
||||
viewModel.fuBangInfo.cargoType
|
||||
) { position, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
cargoType.text = name
|
||||
viewModel.fuBangInfo.cargoType = code
|
||||
}
|
||||
}
|
||||
|
||||
R.id.fdate -> {
|
||||
Common.onYearMonthDay(this, fdate.text.toString()) { year, month, day ->
|
||||
calendar.set(year, month - 1, day)
|
||||
val selDate = ymdSdf.format(calendar.time)
|
||||
fdate.text = selDate
|
||||
if (selDate != "" && fno.text.toString() != "") {
|
||||
viewModel.queryFlight(selDate, fno.text.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
R.id.submit -> {
|
||||
if (getAllEditData()) {
|
||||
Common.secondConfirmDialog(this, "确认过磅") { dialog ->
|
||||
// viewModel.completed(viewModel.fuBangInfo)
|
||||
viewModel.onConfirmClick(this, viewModel.fuBangInfo) {
|
||||
resetData()
|
||||
}
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
Toast.makeText(this, "未找到对应操作", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码返回的结果
|
||||
*/
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
// 扫描二维码/条码回传
|
||||
if (resultCode == RESULT_OK && data != null) {
|
||||
val content = data.getStringExtra(com.yzq.zxinglibrary.common.Constant.CODED_CONTENT)
|
||||
if (content == null) {
|
||||
Common.showToast(this, "条码错误!")
|
||||
return
|
||||
}
|
||||
when (requestCode) {
|
||||
Constant.RequestCode.gjc_fubang_car_id -> {
|
||||
carId.setText(content)
|
||||
// viewModel.queryFlatcarGjcReceive(content)
|
||||
viewModel.getBoxDetailsByCarId(content)
|
||||
}
|
||||
|
||||
Constant.RequestCode.gjc_fubang_uld_id -> {
|
||||
uld.setText(content)
|
||||
viewModel.queryUldGjcReceive(content)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步viewModel的实体类数据
|
||||
*/
|
||||
private fun getAllEditData(): Boolean {
|
||||
if (carId.text.toString() == "") {
|
||||
Common.showToast(this, "请填写平板车号!")
|
||||
return false
|
||||
}
|
||||
if (uld.text.toString() == "") {
|
||||
//默认值 BULK
|
||||
Common.secondConfirmDialog(this, "集装器编号未填写,是否填入默认值!") { dialog ->
|
||||
uld.setText("BULK")
|
||||
dialog.dismiss()
|
||||
}
|
||||
return false
|
||||
}
|
||||
if (netWeight.text.toString() == "" || netWeight.text.toString().toDouble() == 0.0) {
|
||||
Common.showToast(this, "请填写装机重!")
|
||||
return false
|
||||
}
|
||||
if (cargoWeight.text.toString() == "" || cargoWeight.text.toString().toDouble() == 0.0) {
|
||||
Common.showToast(this, "请填写货物重量!")
|
||||
return false
|
||||
}
|
||||
if (totalWeight.text.toString() == "" || totalWeight.text.toString().toDouble() == 0.0) {
|
||||
Common.showToast(this, "请填写总重量!")
|
||||
return false
|
||||
}
|
||||
if (plClose.text.toString() != "") {
|
||||
if (plCloseSize.text.toString() == null || plCloseSize.text.toString() == "") {
|
||||
Common.showToast(this, "探板收口大小不能为空!")
|
||||
return false
|
||||
}
|
||||
}
|
||||
// if (fdate.text.toString() == "") {
|
||||
// Common.showToast(this, "航班日期不能为空!")
|
||||
// return false
|
||||
// }
|
||||
// if (fno.text.toString() == "") {
|
||||
// Common.showToast(this, "航班号不能为空!")
|
||||
// return false
|
||||
// }
|
||||
if (fdest.text.toString() == "") {
|
||||
Common.showToast(this, "请填写目的港!")
|
||||
return false
|
||||
}
|
||||
if (cargoType.text.toString() == "") {
|
||||
Common.showToast(this, "请填写货物类型!")
|
||||
return false
|
||||
}
|
||||
if (height.text.toString() == "") {
|
||||
height.setText("0.0")
|
||||
}
|
||||
|
||||
viewModel.fuBangInfo.carId = carId.text.toString()
|
||||
viewModel.fuBangInfo.uld = uld.text.toString()
|
||||
|
||||
viewModel.fuBangInfo.carWeight = carWeight.text.toString().toDouble()
|
||||
viewModel.fuBangInfo.uldWeight = uldWeight.text.toString().toDouble()
|
||||
viewModel.fuBangInfo.netWeight = netWeight.text.toString().toDouble()
|
||||
|
||||
viewModel.fuBangInfo.dgrCode = dgrCode.text.toString()
|
||||
viewModel.fuBangInfo.boardType = boardType.text.toString()
|
||||
viewModel.fuBangInfo.cargoWeight = cargoWeight.text.toString().toDouble()
|
||||
|
||||
viewModel.fuBangInfo.plClose = plClose.text.toString()
|
||||
viewModel.fuBangInfo.plCloseSize = plCloseSize.text.toString()
|
||||
viewModel.fuBangInfo.totalWeight = totalWeight.text.toString().toDouble()
|
||||
|
||||
viewModel.fuBangInfo.height = height.text.toString().toDouble()
|
||||
viewModel.fuBangInfo.fdate = fdate.text.toString()
|
||||
viewModel.fuBangInfo.fno = fno.text.toString()
|
||||
|
||||
viewModel.fuBangInfo.fdest = fdest.text.toString()
|
||||
|
||||
viewModel.fuBangInfo.remark = remark.text.toString()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空数据
|
||||
*/
|
||||
private fun resetData() {
|
||||
carId.setText("")
|
||||
uld.setText("")
|
||||
dibangWeight.setText("")
|
||||
|
||||
carWeight.setText("")
|
||||
uldWeight.setText("")
|
||||
netWeight.setText("")
|
||||
|
||||
dgrCode.setText("")
|
||||
boardType.setText("")
|
||||
cargoWeight.setText("")
|
||||
|
||||
plClose.text = ""
|
||||
plCloseSize.setText("")
|
||||
totalWeight.setText("")
|
||||
|
||||
height.setText("")
|
||||
calendar.time = Date()
|
||||
fdate.text = ymdSdf.format(calendar.time)
|
||||
fno.setText("")
|
||||
|
||||
fdest.setText("")
|
||||
cargoType.text = ""
|
||||
|
||||
remark.setText("")
|
||||
|
||||
viewModel.fuBangInfo = GjcFuBang()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.databinding.ActivityGjcGoodsAddBinding
|
||||
import com.lukouguoji.gjc.viewModel.GjcGoodsAddViewModel
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
||||
|
||||
class GjcGoodsAddActivity :
|
||||
BaseBindingActivity<ActivityGjcGoodsAddBinding, GjcGoodsAddViewModel>() {
|
||||
|
||||
override fun layoutId() = R.layout.activity_gjc_goods_add
|
||||
|
||||
override fun viewModelClass() = GjcGoodsAddViewModel::class.java
|
||||
|
||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||
setBackArrow("国际出港货物开始交接")
|
||||
binding.viewModel = viewModel
|
||||
|
||||
viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this)
|
||||
binding.rv.addOnItemClickListener(viewModel)
|
||||
|
||||
viewModel.getData()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun start(context: Context) {
|
||||
val starter = Intent(context, GjcGoodsAddActivity::class.java)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.databinding.ActivityGjcGoodsListBinding
|
||||
import com.lukouguoji.gjc.holder.GjcGoodsViewHolder
|
||||
import com.lukouguoji.gjc.viewModel.GjcGoodsListViewModel
|
||||
import com.lukouguoji.module_base.BaseActivity
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.base.CommonAdapter
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.common.ConstantEvent
|
||||
import com.lukouguoji.module_base.impl.FlowBus
|
||||
import com.lukouguoji.module_base.impl.observe
|
||||
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_GOODS_LIST)
|
||||
class GjcGoodsListActivity :
|
||||
BaseBindingActivity<ActivityGjcGoodsListBinding, GjcGoodsListViewModel>() {
|
||||
|
||||
override fun layoutId() = R.layout.activity_gjc_goods_list
|
||||
|
||||
override fun viewModelClass() = GjcGoodsListViewModel::class.java
|
||||
|
||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||
setBackArrow("国际出港货物交接")
|
||||
binding.viewModel = viewModel
|
||||
|
||||
binding.rv.adapter =
|
||||
CommonAdapter(this, R.layout.item_gjc_goods, GjcGoodsViewHolder::class.java)
|
||||
viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this)
|
||||
binding.rv.addOnItemClickListener(viewModel)
|
||||
|
||||
viewModel.getData()
|
||||
|
||||
// 新增成功
|
||||
FlowBus.with<Any>(ConstantEvent.GJC_HANDOVER_ADD_SUCCESS)
|
||||
.observe(this) {
|
||||
viewModel.refresh()
|
||||
}
|
||||
// 签名成功
|
||||
FlowBus.with<Any>(ConstantEvent.GJC_HANDOVER_SIGNATURE_SUCCESS)
|
||||
.observe(this) {
|
||||
viewModel.refresh()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.databinding.ActivityGjcGoodsManifestBinding
|
||||
import com.lukouguoji.gjc.viewModel.GjcGoodsManifestViewModel
|
||||
import com.lukouguoji.module_base.adapter.loadImage
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.common.ConstantEvent
|
||||
import com.lukouguoji.module_base.impl.FlowBus
|
||||
import com.lukouguoji.module_base.impl.observe
|
||||
import com.lukouguoji.module_base.ktx.noNull
|
||||
import com.yzq.zxinglibrary.encode.CodeCreator
|
||||
|
||||
class GjcGoodsManifestActivity :
|
||||
BaseBindingActivity<ActivityGjcGoodsManifestBinding, GjcGoodsManifestViewModel>() {
|
||||
|
||||
override fun layoutId() = R.layout.activity_gjc_goods_manifest
|
||||
override fun viewModelClass() = GjcGoodsManifestViewModel::class.java
|
||||
|
||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||
viewModel.movID = intent.getStringExtra(Constant.Key.ID).noNull("")
|
||||
|
||||
binding.viewModel = viewModel
|
||||
|
||||
viewModel.pageModel.rv = binding.rv
|
||||
viewModel.getData()
|
||||
|
||||
CodeCreator.createQRCode("123456", 400, 400, null)?.let {
|
||||
loadImage(binding.iv, it)
|
||||
}
|
||||
|
||||
FlowBus.with<String>(ConstantEvent.SIGNATURE_SUCCESS)
|
||||
.observe(this) {
|
||||
viewModel.signature.postValue(it)
|
||||
viewModel.submitSignature(requireContext(), it)
|
||||
}
|
||||
|
||||
viewModel.resultSign.observe(this) {
|
||||
loadImage(binding.ivSign, it)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun start(context: Context, movID: String) {
|
||||
val starter = Intent(context, GjcGoodsManifestActivity::class.java)
|
||||
.putExtra(Constant.Key.ID, movID)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.core.widget.NestedScrollView
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.facade.annotation.Autowired
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.adapt.GjcQueryInfoListAdapter
|
||||
import com.lukouguoji.gjc.adapt.GjcQueryInfoWhListAdapter
|
||||
import com.lukouguoji.gjc.model.GjcQueryInfo
|
||||
import com.lukouguoji.gjc.model.GjcQueryInfoWh
|
||||
import com.lukouguoji.gjc.viewModel.GjcQueryInfoViewModel
|
||||
import com.lukouguoji.module_base.BaseActivity
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_QUERY_INFO)
|
||||
class GjcQueryInfoActivity : BaseActivity(), View.OnClickListener {
|
||||
|
||||
private lateinit var viewModel: GjcQueryInfoViewModel
|
||||
|
||||
private lateinit var scrollView: NestedScrollView
|
||||
private lateinit var queryInfoList: RecyclerView
|
||||
private lateinit var adapter: GjcQueryInfoListAdapter
|
||||
private val queryInfoAdapterList = arrayListOf<GjcQueryInfo>()
|
||||
|
||||
private lateinit var submit: TextView
|
||||
|
||||
private lateinit var refWareHouseInfo: LinearLayout
|
||||
private lateinit var wareHouseInfoLayout: LinearLayout
|
||||
private lateinit var queryWareHouseInfoList: RecyclerView
|
||||
private lateinit var wareHouseInfoAdapter: GjcQueryInfoWhListAdapter
|
||||
private val queryWareHouseInfoAdapterList = arrayListOf<GjcQueryInfoWh>()
|
||||
|
||||
@JvmField
|
||||
@Autowired
|
||||
var id: Int = -9999
|
||||
|
||||
@JvmField
|
||||
@Autowired
|
||||
var wbNoParam: String? = null
|
||||
|
||||
private fun initView() {
|
||||
viewModel = ViewModelProvider(this).get(GjcQueryInfoViewModel::class.java)
|
||||
|
||||
scrollView = findViewById(R.id.scrollView)
|
||||
refWareHouseInfo = findViewById(R.id.refWareHouseInfo)
|
||||
wareHouseInfoLayout = findViewById(R.id.wareHouseInfoLayout)
|
||||
submit = findViewById(R.id.submit)
|
||||
|
||||
val layoutManager = GridLayoutManager(this, 2)
|
||||
adapter = GjcQueryInfoListAdapter(this, queryInfoAdapterList)
|
||||
queryInfoList = findViewById(R.id.gncQueryInfoList)
|
||||
queryInfoList.adapter = adapter
|
||||
queryInfoList.layoutManager = layoutManager
|
||||
|
||||
val wareHouseLayoutManager = LinearLayoutManager(this)
|
||||
wareHouseInfoAdapter = GjcQueryInfoWhListAdapter(this, queryWareHouseInfoAdapterList)
|
||||
queryWareHouseInfoList = findViewById(R.id.gncQueryWareHouseInfoList)
|
||||
queryWareHouseInfoList.adapter = wareHouseInfoAdapter
|
||||
queryWareHouseInfoList.layoutManager = wareHouseLayoutManager
|
||||
|
||||
refWareHouseInfo.setOnClickListener(this)
|
||||
submit.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_gjc_query_info)
|
||||
setBackArrow("国际出港查询详情")
|
||||
initView()
|
||||
|
||||
// initData()
|
||||
|
||||
viewModel.queryWaybillById(id, wbNoParam)
|
||||
viewModel.waybillLiveData.observe(this) {
|
||||
val status = it.getString("status")
|
||||
if (Constant.Result.succ == status) {
|
||||
viewModel.wayBillInfo = it.getJSONObject("data")
|
||||
//主运单详情
|
||||
val maWbObj = viewModel.wayBillInfo.getJSONObject("maWb")
|
||||
adapter.append(GjcQueryInfo(1, "运单号", maWbObj.getString("wbNo") ?: ""))
|
||||
viewModel.wbNo = maWbObj.getString("wbNo")
|
||||
adapter.append(GjcQueryInfo(1, "件数", maWbObj.getIntValue("pc").toString()))
|
||||
adapter.append(
|
||||
GjcQueryInfo(
|
||||
1,
|
||||
"重量",
|
||||
"${maWbObj.getDoubleValue("grossWeight")} KG"
|
||||
)
|
||||
)
|
||||
adapter.append(GjcQueryInfo(1, "承运人", maWbObj.getString("by1") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "目的港", maWbObj.getString("dest") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "品名(英)", maWbObj.getString("goods") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "特码", maWbObj.getString("spCode") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "代理", maWbObj.getString("agent") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "运单类型", maWbObj.getString("awbType") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "业务类型", maWbObj.getString("businessType") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "包装类型", maWbObj.getString("packageType") ?: ""))
|
||||
/*adapter.append(GjcQueryInfo(1, "卸货港", maWbObj.getString("dest1") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "危险品描述", maWbObj.getString("dgrDetail") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "危险品库位", maWbObj.getString("dgrLocation") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "航班", maWbObj.getString("flight") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "入库时间", maWbObj.getString("opDate") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "出库时间", maWbObj.getString("mclose") ?: ""))
|
||||
adapter.append(GjcQueryInfo(1, "收运人", maWbObj.getString("opId") ?: ""))*/
|
||||
|
||||
//关联仓库详情
|
||||
val whListArr = viewModel.wayBillInfo.getJSONArray("whList")
|
||||
whListArr.forEach { waybill ->
|
||||
val waybillObj = waybill as JSONObject
|
||||
wareHouseInfoAdapter.append(
|
||||
GjcQueryInfoWh(
|
||||
1,
|
||||
waybillObj.getString("wbNo") ?: "",
|
||||
waybillObj.getString("location") ?: "",
|
||||
waybillObj.getIntValue("pc"),
|
||||
waybillObj.getDoubleValue("weight"),
|
||||
waybillObj.getString("flight") ?: "",
|
||||
waybillObj.getString("opDate") ?: "",
|
||||
waybillObj.getString("mclose") ?: "",
|
||||
waybillObj.getString("opId") ?: ""
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
} else {
|
||||
//无数据
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun initData() {
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "入库时间", "2021-04-05 15:22:33"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "运单号", "A014d384"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "代理人", "张三"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "特码", "A06"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "件数", "39件"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "重量", "30kg"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "品名(英)", "TF"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "目的港", "白云国际机场"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "航班号", "U23"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "运单类型", "配载单"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "承运人", "SF"))
|
||||
queryInfoAdapterList.add(GjcQueryInfo(1, "包装", "木箱"))
|
||||
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
v?.let {
|
||||
when (it.id) {
|
||||
R.id.refWareHouseInfo -> {
|
||||
//开关关联列表
|
||||
if (wareHouseInfoLayout.visibility == View.GONE) {
|
||||
wareHouseInfoLayout.visibility = View.VISIBLE
|
||||
} else {
|
||||
wareHouseInfoLayout.visibility = View.GONE
|
||||
}
|
||||
scrollView.post { scrollView.scrollTo(0, scrollView.bottom) }
|
||||
}
|
||||
R.id.submit -> {
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_CARGO_TRACKING)
|
||||
.withString("countryTypeParam", Constant.CargoTracking.gjStatus)
|
||||
.withString("ieFlagParam", Constant.CargoTracking.exportStatus)
|
||||
.withString("wbNoParam", viewModel.wbNo)
|
||||
.navigation()
|
||||
}
|
||||
else -> {
|
||||
Toast.makeText(this, "未找到对应操作", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,503 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.fastjson.JSONArray
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.adapt.GjcQueryListAdapter
|
||||
import com.lukouguoji.gjc.model.GjcQueryList
|
||||
import com.lukouguoji.gjc.viewModel.GjcQueryListViewModel
|
||||
import com.lukouguoji.module_base.ActivityCollector
|
||||
import com.lukouguoji.module_base.BaseActivity
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
import com.lukouguoji.module_base.util.Common
|
||||
import com.scwang.smart.refresh.footer.ClassicsFooter
|
||||
import com.scwang.smart.refresh.header.ClassicsHeader
|
||||
import com.scwang.smart.refresh.layout.api.RefreshLayout
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_QUERY_LIST)
|
||||
class GjcQueryListActivity : BaseActivity(), View.OnClickListener {
|
||||
private val currentTitleName = "国际出港查询"
|
||||
|
||||
private lateinit var viewModel: GjcQueryListViewModel
|
||||
|
||||
private lateinit var adapter: GjcQueryListAdapter
|
||||
private val collectList = ArrayList<GjcQueryList>()
|
||||
|
||||
private var currentPage = 1
|
||||
private var pageSize = 10
|
||||
private var totalPage = 0
|
||||
private lateinit var refreshLayout: RefreshLayout
|
||||
|
||||
//标题
|
||||
private lateinit var toolBack: LinearLayout
|
||||
private lateinit var titleName: TextView
|
||||
|
||||
//搜索条件
|
||||
private lateinit var searchListFragment: LinearLayout
|
||||
private lateinit var filtrateLayout: LinearLayout
|
||||
private lateinit var wbNo: EditText
|
||||
private lateinit var fno: EditText
|
||||
private lateinit var startDate: TextView
|
||||
private lateinit var endDate: TextView
|
||||
private lateinit var mudiGang: EditText
|
||||
private lateinit var searchLayout: LinearLayout
|
||||
private lateinit var summaryText: TextView
|
||||
|
||||
//筛选页
|
||||
private lateinit var filtrateFragment: LinearLayout
|
||||
|
||||
private lateinit var spCode: TextView
|
||||
private var spCodeValue = ""
|
||||
private lateinit var agentCode: TextView
|
||||
private var agentCodeValue = ""
|
||||
private lateinit var goods: EditText
|
||||
private lateinit var awbType: TextView
|
||||
private var awbTypeValue = ""
|
||||
private lateinit var businessType: TextView
|
||||
private var businessTypeValue = ""
|
||||
|
||||
private lateinit var submit: TextView
|
||||
private lateinit var reset: TextView
|
||||
|
||||
// 、、特码、代理人、品名、运单类型、业务类型查询
|
||||
|
||||
|
||||
private val ymdSdf = SimpleDateFormat("yyyy-MM-dd")//年月日
|
||||
private val ymdHmsSdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")//年月日 时分秒
|
||||
private val calendar = Calendar.getInstance()
|
||||
|
||||
private fun initView() {
|
||||
viewModel = ViewModelProvider(this).get(GjcQueryListViewModel::class.java)
|
||||
val layoutManager = LinearLayoutManager(this)
|
||||
adapter = GjcQueryListAdapter(this, collectList)
|
||||
var recyclerView: RecyclerView = findViewById(R.id.recyclerList)
|
||||
recyclerView.layoutManager = layoutManager
|
||||
recyclerView.adapter = adapter
|
||||
|
||||
//标题
|
||||
toolBack = findViewById(R.id.tool_back)
|
||||
titleName = findViewById(R.id.title_name)
|
||||
//搜索列表页
|
||||
searchListFragment = findViewById(R.id.searchListFragment)
|
||||
wbNo = findViewById(R.id.wbNo)
|
||||
fno = findViewById(R.id.fno)
|
||||
startDate = findViewById(R.id.startDate)
|
||||
endDate = findViewById(R.id.endDate)
|
||||
|
||||
|
||||
mudiGang = findViewById(R.id.mudiGang)
|
||||
searchLayout = findViewById(R.id.searchLayout)
|
||||
summaryText = findViewById(R.id.summaryText)
|
||||
filtrateLayout = findViewById(R.id.filtrateLayout)
|
||||
//筛选页
|
||||
filtrateFragment = findViewById(R.id.filtrateFragment)
|
||||
|
||||
goods = findViewById(R.id.goods)
|
||||
spCode = findViewById(R.id.spCode)
|
||||
agentCode = findViewById(R.id.agentCode)
|
||||
businessType = findViewById(R.id.businessType)
|
||||
awbType = findViewById(R.id.awbType)
|
||||
submit = findViewById(R.id.submit)
|
||||
reset = findViewById(R.id.reset)
|
||||
|
||||
toolBack.setOnClickListener(this)
|
||||
searchLayout.setOnClickListener(this)
|
||||
startDate.setOnClickListener(this)
|
||||
endDate.setOnClickListener(this)
|
||||
|
||||
spCode.setOnClickListener(this)
|
||||
agentCode.setOnClickListener(this)
|
||||
businessType.setOnClickListener(this)
|
||||
awbType.setOnClickListener(this)
|
||||
filtrateLayout.setOnClickListener(this)
|
||||
submit.setOnClickListener(this)
|
||||
reset.setOnClickListener(this)
|
||||
|
||||
wbNo.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
if (s != null && s.toString().length > 11) {
|
||||
Common.alertDialog(ActivityCollector.getLastActivity()!!, "运单号不能超过11位!") { dialog ->
|
||||
wbNo.setText(s.toString().substring(0, 11))
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
fno.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun afterTextChanged(editable: Editable?) {
|
||||
val originText = editable.toString()
|
||||
if (originText != null && originText != "") {
|
||||
val regularExpression = "(^([A-Z0-9]+)$)"
|
||||
val matches = originText.matches(regularExpression.toRegex())
|
||||
if(!matches){
|
||||
val regularExpression2 = "([^A-Za-z0-9]+)"
|
||||
val replaceStr = originText.replace(regularExpression2.toRegex(),"")
|
||||
val replaceStrToUpper = replaceStr.uppercase(Locale.ROOT)//小写转大写
|
||||
fno.setText(replaceStrToUpper)
|
||||
fno.setSelection(replaceStrToUpper.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
mudiGang.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun afterTextChanged(editable: Editable?) {
|
||||
val originText = editable.toString()
|
||||
if (originText != null && originText != "") {
|
||||
val regularExpression = "(^([A-Z]+)$)"
|
||||
val matches = originText.matches(regularExpression.toRegex())
|
||||
if(!matches){
|
||||
val regularExpression2 = "([^A-Za-z]+)"
|
||||
val replaceStr = originText.replace(regularExpression2.toRegex(),"")
|
||||
val replaceStrToUpper = replaceStr.uppercase(Locale.ROOT)//小写转大写
|
||||
mudiGang.setText(replaceStrToUpper)
|
||||
mudiGang.setSelection(replaceStrToUpper.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
val format = ymdSdf.format(Date())
|
||||
startDate.text = format
|
||||
endDate.text = format
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_gjc_query_list)
|
||||
initView()
|
||||
|
||||
//初始化查询
|
||||
searchFun()
|
||||
loading()
|
||||
viewModel.searchParamLive.observe(this) {
|
||||
loadingCancel()
|
||||
//1.获取数据
|
||||
var listArr: JSONArray = it["list"] as JSONArray
|
||||
totalPage = it["pages"] as Int
|
||||
// var listArr :JSONArray =it["list"] as JSONArray
|
||||
if (listArr.size > 0) {
|
||||
//2.循环遍历塞入collectList
|
||||
listArr.forEach {
|
||||
val itemObj = it as JSONObject
|
||||
val id = itemObj.getIntValue("maWbId")
|
||||
val wbNo = itemObj.getString("wbNo") ?: ""
|
||||
val agentCode = itemObj.getString("agent") ?: ""
|
||||
val spCode = itemObj.getString("spCode") ?: ""
|
||||
val goods = itemObj.getString("goods") ?: ""
|
||||
val flight = itemObj.getString("flight") ?: ""
|
||||
val range = itemObj.getString("range") ?: ""
|
||||
val fclose = itemObj.getString("actualTakeOff") ?: ""
|
||||
val awbType = itemObj.getString("awbType") ?: ""
|
||||
val pc = itemObj.getString("pc") ?: ""
|
||||
val weight = itemObj.getString("grossWeight") ?: ""
|
||||
|
||||
collectList.add(GjcQueryList(id, wbNo, agentCode, spCode, goods, flight, range, fclose, awbType, pc, weight))
|
||||
}
|
||||
//3.调adpter展示
|
||||
if (currentPage == 1) {
|
||||
adapter.notifyDataSetChanged()
|
||||
} else {
|
||||
adapter.notifyItemRangeInserted((currentPage - 1) * 10, collectList.size)
|
||||
}
|
||||
refreshLayout.finishRefresh()
|
||||
refreshLayout.finishLoadMore()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//汇总返回结果
|
||||
viewModel.summaryObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
if (Constant.Result.succ == status) {
|
||||
var jsonObject = it.getJSONObject("data")
|
||||
val totalTemp = jsonObject.getIntValue("total")
|
||||
val totalPcTemp = jsonObject.getIntValue("pc")
|
||||
val totalWeightTemp = jsonObject.getDoubleValue("GROSSWEIGHT")
|
||||
summaryText.text = "总票数:$totalTemp,总件数:$totalPcTemp,总重量:$totalWeightTemp"
|
||||
} else {
|
||||
//无数据
|
||||
}
|
||||
}
|
||||
|
||||
/////////////// 下拉框 start
|
||||
viewModel.agentCode(System.currentTimeMillis().toString())
|
||||
viewModel.agentCodeObserver.observe(this) { vd ->
|
||||
val noneObj = JSONObject()
|
||||
noneObj["name"] = "请选择代理人"
|
||||
noneObj["code"] = ""
|
||||
viewModel.agentCodeList.add(noneObj)
|
||||
viewModel.agentCodeList.addAll(vd.getJSONArray("data"))
|
||||
}
|
||||
|
||||
viewModel.business(Constant.businessType.IO)
|
||||
viewModel.businessObserver.observe(this) { vd ->
|
||||
val noneObj = JSONObject()
|
||||
noneObj["name"] = "请选择业务类型"
|
||||
noneObj["code"] = ""
|
||||
viewModel.businessList.add(noneObj)
|
||||
viewModel.businessList.addAll(vd.getJSONArray("data"))
|
||||
}
|
||||
|
||||
viewModel.specialCode(System.currentTimeMillis().toString())
|
||||
viewModel.specialCodeObserver.observe(this) { vd ->
|
||||
val noneObj = JSONObject()
|
||||
noneObj["name"] = "请选择特码"
|
||||
noneObj["code"] = ""
|
||||
viewModel.specialCodeList.add(noneObj)
|
||||
viewModel.specialCodeList.addAll(vd.getJSONArray("data"))
|
||||
}
|
||||
|
||||
viewModel.awb(Constant.businessType.IO)
|
||||
viewModel.awbObserver.observe(this) { vd ->
|
||||
val noneObj = JSONObject()
|
||||
noneObj["name"] = "请选择运单类型"
|
||||
noneObj["code"] = ""
|
||||
viewModel.awbList.add(noneObj)
|
||||
viewModel.awbList.addAll(vd.getJSONArray("data"))
|
||||
}
|
||||
/////////////// 下拉框 end
|
||||
|
||||
/////////////////////////////// 加载刷新的布局
|
||||
refreshLayout = findViewById<View>(R.id.refreshLayout) as RefreshLayout
|
||||
refreshLayout.setRefreshHeader(ClassicsHeader(this))
|
||||
refreshLayout.setRefreshFooter(ClassicsFooter(this))
|
||||
/////////////////////////////// 下拉刷新
|
||||
refreshLayout.setOnRefreshListener {
|
||||
resetSearch()
|
||||
}
|
||||
/////////////////////////////// 上拉加载
|
||||
refreshLayout.setOnLoadMoreListener {
|
||||
if (currentPage < totalPage) {
|
||||
currentPage++
|
||||
//初始化查询
|
||||
searchFun()
|
||||
} else {
|
||||
refreshLayout.finishLoadMoreWithNoMoreData()
|
||||
}
|
||||
}
|
||||
|
||||
//点击扫码
|
||||
/*scanCodeImg.setOnClickListener {
|
||||
scanCode(Constant.RequestCode.gnc_query_list)
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* onActivityResult 回调
|
||||
*/
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
||||
// 扫描二维码/条码回传
|
||||
/*if (requestCode == Constant.RequestCode.gnc_query_list && resultCode == RESULT_OK) {
|
||||
if (data != null) {
|
||||
val content = data.getStringExtra(com.yzq.zxinglibrary.common.Constant.CODED_CONTENT)
|
||||
searchContent.setText("$content")
|
||||
|
||||
//调用接口查询进入详情页
|
||||
if (content != null && content != "") {
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GNC_QUERY_INFO).withString("wbNoParam", content)
|
||||
.navigation(this)
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
v?.let {
|
||||
when (it.id) {
|
||||
R.id.tool_back -> {
|
||||
if (searchListFragment.visibility == View.GONE && filtrateFragment.visibility == View.VISIBLE) {
|
||||
searchListFragment.visibility = View.VISIBLE
|
||||
filtrateFragment.visibility = View.GONE
|
||||
titleName.text = currentTitleName
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
R.id.searchLayout -> {
|
||||
resetSearch()
|
||||
}
|
||||
R.id.filtrateLayout -> {
|
||||
if (searchListFragment.visibility == View.VISIBLE && filtrateFragment.visibility == View.GONE) {
|
||||
searchListFragment.visibility = View.GONE
|
||||
filtrateFragment.visibility = View.VISIBLE
|
||||
titleName.text = "搜索"
|
||||
} else {
|
||||
searchListFragment.visibility = View.VISIBLE
|
||||
filtrateFragment.visibility = View.GONE
|
||||
titleName.text = currentTitleName
|
||||
}
|
||||
// Common.showToast(this,"筛选")
|
||||
}
|
||||
R.id.startDate -> {
|
||||
Common.onYearMonthDay(this, startDate.text.toString()) { year, month, day ->
|
||||
calendar.set(year, month - 1, day)
|
||||
startDate.text = ymdSdf.format(calendar.time)
|
||||
}
|
||||
}
|
||||
R.id.endDate -> {
|
||||
Common.onYearMonthDay(this, endDate.text.toString()) { year, month, day ->
|
||||
calendar.set(year, month - 1, day)
|
||||
endDate.text = ymdSdf.format(calendar.time)
|
||||
}
|
||||
}
|
||||
R.id.agentCode -> {
|
||||
Common.singleSelect(this, "代理", viewModel.agentCodeList, agentCodeValue) { _, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
agentCode.text = name
|
||||
agentCodeValue = code
|
||||
}
|
||||
}
|
||||
R.id.businessType -> {
|
||||
Common.singleSelect(this, "业务类型", viewModel.businessList, businessTypeValue) { _, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
businessType.text = name
|
||||
businessTypeValue = code
|
||||
}
|
||||
}
|
||||
R.id.spCode -> {
|
||||
Common.singleSelect(this, "特码", viewModel.specialCodeList, spCodeValue) { _, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
spCode.text = name
|
||||
spCodeValue = code
|
||||
}
|
||||
}
|
||||
R.id.awbType -> {
|
||||
Common.singleSelect(this, "运单类型", viewModel.awbList, awbTypeValue) { _, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
awbType.text = name
|
||||
awbTypeValue = code
|
||||
}
|
||||
}
|
||||
R.id.submit -> {
|
||||
//筛选页隐藏
|
||||
searchListFragment.visibility = View.VISIBLE
|
||||
filtrateFragment.visibility = View.GONE
|
||||
titleName.text = currentTitleName
|
||||
//搜索
|
||||
resetSearch()
|
||||
}
|
||||
R.id.reset -> {
|
||||
resetFun()
|
||||
}
|
||||
else -> {
|
||||
Toast.makeText(this, "未找到对应操作", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
private fun searchFun() {
|
||||
viewModel.search(
|
||||
pageSize,
|
||||
currentPage,
|
||||
"", // carrier.text.toString(),
|
||||
agentCodeValue,
|
||||
awbTypeValue,
|
||||
startDate.text.toString(),
|
||||
endDate.text.toString(),
|
||||
"",// fdate.text.toString(),
|
||||
fno.text.toString(),
|
||||
mudiGang.text.toString(),
|
||||
"",// kuWei.text.toString(),
|
||||
"",// hangCheng.text.toString(),
|
||||
businessTypeValue,
|
||||
"",// isCangDanStatus,
|
||||
wbNo.text.toString(),
|
||||
spCodeValue,
|
||||
goods.text.toString()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置数据,搜索
|
||||
*/
|
||||
private fun resetSearch() {
|
||||
//recyclerView 清除所有数据数据
|
||||
refreshLayout.setNoMoreData(false)
|
||||
adapter.notifyItemRangeRemoved(0, collectList.size)
|
||||
collectList.clear()
|
||||
currentPage = 1
|
||||
searchFun()
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置筛选条件
|
||||
*/
|
||||
private fun resetFun() {
|
||||
currentPage = 1
|
||||
wbNo.setText("")
|
||||
mudiGang.setText("")
|
||||
val format = ymdSdf.format(Date())
|
||||
startDate.text = format
|
||||
calendar.time = Date()
|
||||
endDate.text = format
|
||||
fno.setText("")
|
||||
spCode.text = ""
|
||||
spCodeValue = ""
|
||||
agentCode.text = ""
|
||||
agentCodeValue = ""
|
||||
goods.setText("")
|
||||
businessType.text = ""
|
||||
businessTypeValue = ""
|
||||
awbType.text = ""
|
||||
awbTypeValue = ""
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.alibaba.fastjson.JSONArray
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.adapt.GjcReceiveListAdapter
|
||||
import com.lukouguoji.gjc.model.GjcReceive
|
||||
import com.lukouguoji.gjc.viewModel.GjcReceiveListViewModel
|
||||
import com.lukouguoji.module_base.BaseActivity
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
import com.scwang.smart.refresh.footer.ClassicsFooter
|
||||
import com.scwang.smart.refresh.header.ClassicsHeader
|
||||
import com.scwang.smart.refresh.layout.api.RefreshLayout
|
||||
import com.yzq.zxinglibrary.common.Constant
|
||||
import java.util.*
|
||||
|
||||
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_RECEIVE_LIST)
|
||||
class GjcReceiveListActivity : BaseActivity() {
|
||||
private lateinit var adapter: GjcReceiveListAdapter
|
||||
private val collectList = ArrayList<GjcReceive>()
|
||||
|
||||
private var currentPage = 1
|
||||
private var pageSize = 10
|
||||
private var totalPage = 0
|
||||
private var text = ""
|
||||
private lateinit var refreshLayout: RefreshLayout
|
||||
private lateinit var search: TextView
|
||||
private lateinit var wbNo: EditText
|
||||
private lateinit var wbNoScanIcon: ImageView
|
||||
|
||||
//是否刷新
|
||||
private var refresh = false
|
||||
private lateinit var viewModel: GjcReceiveListViewModel
|
||||
|
||||
|
||||
private fun initView() {
|
||||
search = findViewById(R.id.search)
|
||||
wbNo = findViewById(R.id.wbNo)
|
||||
wbNoScanIcon = findViewById(R.id.wbNoScanIcon)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_gjc_receive_list)
|
||||
setBackArrow("国际出港待收运")
|
||||
initView()
|
||||
viewModel = ViewModelProvider(this).get(GjcReceiveListViewModel::class.java)
|
||||
|
||||
|
||||
val layoutManager = LinearLayoutManager(this)
|
||||
adapter = GjcReceiveListAdapter(this, collectList)
|
||||
var recyclerView: RecyclerView = findViewById(R.id.guo_nei_collect_list)
|
||||
recyclerView.layoutManager = layoutManager
|
||||
recyclerView.adapter = adapter
|
||||
|
||||
viewModel.searchParamLive.observe(this) {
|
||||
loadingCancel()
|
||||
//1.获取数据
|
||||
var listArr: JSONArray = it["list"] as JSONArray
|
||||
totalPage = it["pages"] as Int
|
||||
// var listArr :JSONArray =it["list"] as JSONArray
|
||||
if (listArr.size > 0) {
|
||||
//2.循环遍历塞入collectList
|
||||
listArr.forEach {
|
||||
val itemObj = it as JSONObject
|
||||
val mawbId = itemObj.getIntValue("maWbId")
|
||||
val wbNo = itemObj.getString("wbNo") ?: ""
|
||||
val pc = itemObj.getIntValue("pc")
|
||||
val weight = itemObj.getDoubleValue("grossWeight")
|
||||
val agentCode = itemObj.getString("agent") ?: ""
|
||||
val spCode = itemObj.getString("spCode") ?: ""
|
||||
val goods = itemObj.getString("goodsCn") ?: ""
|
||||
val flight = itemObj.getString("flight") ?: ""
|
||||
val businessType = itemObj.getString("businessType") ?: ""
|
||||
|
||||
collectList.add(GjcReceive(mawbId, wbNo, pc, weight, agentCode, spCode, goods, flight, businessType))
|
||||
}
|
||||
//3.调adpter展示
|
||||
if (currentPage == 1) {
|
||||
adapter.notifyDataSetChanged()
|
||||
} else {
|
||||
adapter.notifyItemRangeInserted((currentPage - 1) * 10, collectList.size)
|
||||
}
|
||||
refreshLayout.finishRefresh()
|
||||
refreshLayout.finishLoadMore()
|
||||
|
||||
}
|
||||
}
|
||||
//初始化查询
|
||||
viewModel.search(pageSize, currentPage, text)
|
||||
loading()
|
||||
|
||||
/////////////////////////////// 加载刷新的布局
|
||||
refreshLayout = findViewById<View>(R.id.refreshLayout) as RefreshLayout
|
||||
refreshLayout.setRefreshHeader(ClassicsHeader(this))
|
||||
refreshLayout.setRefreshFooter(ClassicsFooter(this))
|
||||
/////////////////////////////// 下拉刷新
|
||||
refreshLayout.setOnRefreshListener {
|
||||
refresh = true
|
||||
currentPage = 1
|
||||
//recyclerView 清除所有数据数据
|
||||
adapter.notifyItemRangeRemoved(0, collectList.size)
|
||||
collectList.clear()
|
||||
//初始化查询
|
||||
viewModel.search(pageSize, currentPage, text)
|
||||
adapter.notifyItemRangeInserted(0, collectList.size)
|
||||
}
|
||||
/////////////////////////////// 上拉加载
|
||||
refreshLayout.setOnLoadMoreListener {
|
||||
refresh = false
|
||||
if (currentPage < totalPage) {
|
||||
currentPage++
|
||||
//初始化查询
|
||||
viewModel.search(pageSize, currentPage, text)
|
||||
} else {
|
||||
refreshLayout.finishLoadMoreWithNoMoreData()
|
||||
}
|
||||
}
|
||||
|
||||
search.setOnClickListener {
|
||||
currentPage = 1
|
||||
//recyclerView 清除所有数据数据
|
||||
adapter.notifyItemRangeRemoved(0, collectList.size)
|
||||
collectList.clear()
|
||||
//初始化查询
|
||||
viewModel.search(pageSize, currentPage, wbNo.text.toString())
|
||||
}
|
||||
|
||||
|
||||
//点击扫码
|
||||
wbNoScanIcon.setOnClickListener {
|
||||
scanCode(com.lukouguoji.module_base.common.Constant.RequestCode.gjc_shouyun_search)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
||||
// 扫描二维码/条码回传
|
||||
if (requestCode == com.lukouguoji.module_base.common.Constant.RequestCode.gjc_shouyun_search) {
|
||||
if (data != null) {
|
||||
val content = data.getStringExtra(Constant.CODED_CONTENT)
|
||||
wbNo.setText("$content")
|
||||
|
||||
//调用接口查询进入详情页
|
||||
if (content != null && content != "") {
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJC_START_RECEIVE).withString("wbNoParam", content)
|
||||
.navigation(this)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (requestCode == com.lukouguoji.module_base.common.Constant.RequestCode.gjc_shouyun_refresh && resultCode == RESULT_OK) {
|
||||
collectList.clear()
|
||||
currentPage = 1
|
||||
refreshLayout.setNoMoreData(false)
|
||||
viewModel.search(10, currentPage, "")
|
||||
loading()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,615 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.alibaba.android.arouter.facade.annotation.Autowired
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.model.GjcStartReceiveWaybill
|
||||
import com.lukouguoji.gjc.viewModel.GjcStartReceiveViewModel
|
||||
import com.lukouguoji.module_base.BaseActivity
|
||||
import com.lukouguoji.module_base.MyApplication
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
import com.lukouguoji.module_base.util.Arith
|
||||
import com.lukouguoji.module_base.util.Common
|
||||
import java.text.SimpleDateFormat
|
||||
import kotlin.math.abs
|
||||
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_START_RECEIVE)
|
||||
class GjcStartReceiveActivity : BaseActivity(), View.OnClickListener {
|
||||
private lateinit var finishCollect: TextView
|
||||
private lateinit var viewModel: GjcStartReceiveViewModel
|
||||
|
||||
private lateinit var wbNo: EditText
|
||||
private lateinit var wbNoScan: ImageView
|
||||
private lateinit var diBangWeight: EditText
|
||||
|
||||
|
||||
private lateinit var tuoPanCode: EditText
|
||||
private lateinit var tuoPanScan: ImageView
|
||||
private lateinit var tuoPanWeight: EditText
|
||||
|
||||
private lateinit var spCode: Button
|
||||
private lateinit var jiZhuangCode: EditText
|
||||
private lateinit var jiZhuangScan: ImageView
|
||||
private lateinit var jiZhuangWeight: EditText
|
||||
|
||||
private lateinit var pc: EditText
|
||||
private lateinit var weight: EditText
|
||||
private lateinit var volume: EditText
|
||||
|
||||
private lateinit var arrivePc: EditText
|
||||
private lateinit var arriveWeight: EditText
|
||||
private lateinit var arriveVolume: EditText
|
||||
|
||||
private lateinit var tuoPanWeightCheck: TextView
|
||||
private lateinit var jiZhuangCheck: TextView
|
||||
|
||||
private lateinit var businessType: Button
|
||||
private lateinit var remark: EditText
|
||||
|
||||
var simpleDateFormat = SimpleDateFormat("yyyy-MM-dd")
|
||||
|
||||
@JvmField
|
||||
@Autowired
|
||||
var wbId: Int = -9999
|
||||
|
||||
@JvmField
|
||||
@Autowired
|
||||
var wbNoParam: String? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_gjc_start_receive)
|
||||
setBackArrow("开始收运")
|
||||
initView()
|
||||
viewModel = ViewModelProvider(this).get(GjcStartReceiveViewModel::class.java)
|
||||
val dgrObj = JSONObject()
|
||||
dgrObj["name"] = "请选择"
|
||||
dgrObj["code"] = ""
|
||||
viewModel.dgrDetailList.add(dgrObj)
|
||||
|
||||
viewModel.queryWaybillById(wbId, wbNoParam)
|
||||
viewModel.waybillLiveData.observe(this) {
|
||||
val status = it.getString("status")
|
||||
if (Constant.Result.succ == status) {
|
||||
var jsonObject = it.getJSONObject("data")
|
||||
viewModel.waybillFormNetWork = jsonObject
|
||||
|
||||
val checkIn = jsonObject.getString("checkIn")
|
||||
if (checkIn == "1") {
|
||||
Common.showToast(this, "该订单收运已完成,不可再收运!")
|
||||
return@observe
|
||||
}
|
||||
viewModel.receiveWaybill.maWbId = jsonObject.getIntValue("maWbId")
|
||||
viewModel.receiveWaybill.prefix = jsonObject.getString("prefix") ?: ""
|
||||
viewModel.receiveWaybill.no = jsonObject.getString("no") ?: ""
|
||||
viewModel.receiveWaybill.wbNo = jsonObject.getString("wbNo") ?: ""
|
||||
viewModel.receiveWaybill.agentCode = jsonObject.getString("agentCode") ?: ""
|
||||
viewModel.receiveWaybill.goods = jsonObject.getString("goods") ?: ""
|
||||
viewModel.receiveWaybill.spCode = jsonObject.getString("spCode") ?: ""
|
||||
viewModel.receiveWaybill.businessType = jsonObject.getString("businessType") ?: ""
|
||||
viewModel.receiveWaybill.pc = jsonObject.getIntValue("pc")
|
||||
viewModel.receiveWaybill.weight = jsonObject.getDoubleValue("grossWeight")
|
||||
viewModel.receiveWaybill.volume = jsonObject.getDoubleValue("volume")
|
||||
viewModel.receiveWaybill.arrivePc = jsonObject.getIntValue("arrivePc")
|
||||
viewModel.receiveWaybill.arriveWeight = jsonObject.getDoubleValue("arriveWeight")
|
||||
viewModel.receiveWaybill.arriveVolume = jsonObject.getDoubleValue("arriveVolume")
|
||||
|
||||
viewModel.receiveWaybill.remark = jsonObject.getString("remark") ?: ""
|
||||
viewModel.receiveWaybill.activeId = jsonObject.getIntValue("activeId")
|
||||
viewModel.receiveWaybill.awbType = jsonObject.getString("awbType")
|
||||
|
||||
viewModel.receiveWaybill.dep = jsonObject.getString("dep") ?: ""
|
||||
viewModel.receiveWaybill.dest = jsonObject.getString("dest") ?: ""
|
||||
viewModel.receiveWaybill.dest1 = jsonObject.getString("dest1") ?: ""
|
||||
viewModel.receiveWaybill.by1 = jsonObject.getString("by1") ?: ""
|
||||
viewModel.receiveWaybill.checkIn = jsonObject.getString("checkIn") ?: ""
|
||||
|
||||
|
||||
wbNo.setText(viewModel.receiveWaybill.wbNo)
|
||||
|
||||
pc.setText(viewModel.receiveWaybill.pc.toString())
|
||||
weight.setText(viewModel.receiveWaybill.weight.toString())
|
||||
volume.setText(viewModel.receiveWaybill.volume.toString())
|
||||
|
||||
|
||||
remark.setText(viewModel.receiveWaybill.remark)
|
||||
|
||||
|
||||
//下拉框赋值
|
||||
viewModel.business(Constant.businessType.IO)
|
||||
viewModel.businessObserver.observe(this) { vd ->
|
||||
viewModel.businessList = vd.getJSONArray("data")
|
||||
for ((index, obj) in viewModel.businessList.withIndex()) {
|
||||
val tempObj = obj as JSONObject
|
||||
val name = tempObj.getString("name")
|
||||
val code = tempObj.getString("code")
|
||||
if (viewModel.receiveWaybill.businessType == code) {
|
||||
businessType.text = name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.specialCode(System.currentTimeMillis().toString())
|
||||
viewModel.specialCodeObserver.observe(this) { vd ->
|
||||
viewModel.specialCodeList = vd.getJSONArray("data")
|
||||
for ((index, obj) in viewModel.specialCodeList.withIndex()) {
|
||||
val tempObj = obj as JSONObject
|
||||
var code = tempObj.getString("code")
|
||||
var name = tempObj.getString("name")
|
||||
if (viewModel.receiveWaybill.spCode == code) {
|
||||
spCode.text = name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
//无数据
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//监听完成收运
|
||||
viewModel.completedObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
val data = it.getString("data")
|
||||
val msg = it.getString("msg")
|
||||
if (Constant.Result.succ == status) {
|
||||
if (data == Constant.Result.succ) {
|
||||
reset()
|
||||
}
|
||||
Common.alertDialog(this, msg) { dialog ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
} else {
|
||||
Common.alertDialog(this, "收运失败!") { dialog ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//集装器编号,查询集装器自重
|
||||
viewModel.queryUldGjcReceiveObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
val data = it.getJSONObject("data")
|
||||
if (Constant.Result.succ == status && data != null) {
|
||||
var uldWeight = data.getIntValue("uldWeight")
|
||||
jiZhuangWeight.setText("$uldWeight")
|
||||
val uldWeightDb = uldWeight.toDouble()
|
||||
val diBangWeightDb = diBangWeight.text.toString().toDouble()
|
||||
if (mt3percent(uldWeightDb - diBangWeightDb, uldWeightDb)) {
|
||||
jiZhuangCheck.isEnabled = true
|
||||
jiZhuangCheck.background = ContextCompat.getDrawable(this, R.drawable.submit_shape)
|
||||
} else {
|
||||
jiZhuangCheck.isEnabled = false
|
||||
jiZhuangCheck.background = ContextCompat.getDrawable(this, R.drawable.input_shape)
|
||||
}
|
||||
}
|
||||
}
|
||||
//集装器编号,校验集装器重量
|
||||
viewModel.updateUldGjcReceiveObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
val data = it.getString("data")
|
||||
if (Constant.Result.succ == status && Constant.Result.succ == data) {
|
||||
jiZhuangWeight.setText(diBangWeight.text.toString())
|
||||
} else {
|
||||
Common.alertDialog(this, "校验失败!") { dialog ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//托盘编号,查询集装器自重
|
||||
viewModel.queryFlatcarGjcReceiveObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
val data = it.getJSONObject("data")
|
||||
if (Constant.Result.succ == status && data != null) {
|
||||
var carWeight = data.getIntValue("carWeight")
|
||||
tuoPanWeight.setText("$carWeight")
|
||||
val carWeightDb = carWeight.toDouble()
|
||||
val diBangWeightDb = diBangWeight.text.toString().toDouble()
|
||||
if (mt3percent(carWeightDb - diBangWeightDb, carWeightDb)) {
|
||||
tuoPanWeightCheck.isEnabled = true
|
||||
tuoPanWeightCheck.background = ContextCompat.getDrawable(this, R.drawable.submit_shape)
|
||||
} else {
|
||||
tuoPanWeightCheck.isEnabled = false
|
||||
tuoPanWeightCheck.background = ContextCompat.getDrawable(this, R.drawable.input_shape)
|
||||
}
|
||||
}
|
||||
}
|
||||
//托盘编号,校验平板车重量
|
||||
viewModel.updateFlatcarGjcReceiveObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
val data = it.getString("data")
|
||||
if (Constant.Result.succ == status && Constant.Result.succ == data) {
|
||||
tuoPanWeight.setText(diBangWeight.text.toString())
|
||||
} else {
|
||||
Common.alertDialog(this, "校验失败!") { dialog ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////onCreate 结束
|
||||
|
||||
private fun initView() {
|
||||
|
||||
finishCollect = findViewById(R.id.finish_collect)
|
||||
|
||||
wbNo = findViewById(R.id.wbNo)
|
||||
wbNoScan = findViewById(R.id.wbNo_scan)
|
||||
diBangWeight = findViewById(R.id.diBangWeight)
|
||||
|
||||
tuoPanCode = findViewById(R.id.tuoPanCode)
|
||||
tuoPanScan = findViewById(R.id.tuoPanScan)
|
||||
tuoPanWeight = findViewById(R.id.tuoPanWeight)
|
||||
|
||||
spCode = findViewById(R.id.spCode)
|
||||
jiZhuangCode = findViewById(R.id.jiZhuangCode)
|
||||
jiZhuangScan = findViewById(R.id.jiZhuangScan)
|
||||
jiZhuangWeight = findViewById(R.id.jiZhuangWeight)
|
||||
|
||||
pc = findViewById(R.id.pc)
|
||||
weight = findViewById(R.id.weight)
|
||||
volume = findViewById(R.id.volume)
|
||||
arrivePc = findViewById(R.id.arrivePc)
|
||||
arriveWeight = findViewById(R.id.arriveWeight)
|
||||
arriveVolume = findViewById(R.id.arriveVolume)
|
||||
|
||||
businessType = findViewById(R.id.businessType)
|
||||
remark = findViewById(R.id.remark)
|
||||
|
||||
tuoPanWeightCheck = findViewById(R.id.tuoPanWeightCheck)
|
||||
jiZhuangCheck = findViewById(R.id.jiZhuangCheck)
|
||||
|
||||
|
||||
//////////////// 绑定点击事件
|
||||
// fenDou.setOnClickListener(this)
|
||||
finishCollect.setOnClickListener(this)
|
||||
wbNoScan.setOnClickListener(this)
|
||||
tuoPanScan.setOnClickListener(this)
|
||||
jiZhuangScan.setOnClickListener(this)
|
||||
businessType.setOnClickListener(this)
|
||||
spCode.setOnClickListener(this)
|
||||
tuoPanWeightCheck.setOnClickListener(this)
|
||||
jiZhuangCheck.setOnClickListener(this)
|
||||
|
||||
///////////// 监听edittext变化
|
||||
diBangWeight.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
var tempWeight = "0.0"
|
||||
if (s != null && s.toString().trim() != "") {
|
||||
tempWeight = s.toString()
|
||||
}
|
||||
|
||||
var tuoPanWeightDouble = 0.0
|
||||
if (tuoPanWeight.text.toString() != "") {
|
||||
tuoPanWeightDouble = tuoPanWeight.text.toString().toDouble()
|
||||
} else {
|
||||
tuoPanWeightDouble = 0.0
|
||||
}
|
||||
|
||||
var jiZhuangWeightDouble = 0.0
|
||||
if (jiZhuangWeight.text.toString() != "") {
|
||||
jiZhuangWeightDouble = jiZhuangWeight.text.toString().toDouble()
|
||||
} else {
|
||||
jiZhuangWeightDouble = 0.0
|
||||
}
|
||||
|
||||
val arriveWeightTemp = tempWeight.toDouble() - tuoPanWeightDouble - jiZhuangWeightDouble
|
||||
arriveWeight.setText(arriveWeightTemp.toString())
|
||||
arriveVolume.setText(Arith.div(arriveWeightTemp, 220.0, 2).toString())
|
||||
|
||||
//校验集装器差值
|
||||
if (mt3percent(jiZhuangWeightDouble - tempWeight.toDouble(), jiZhuangWeightDouble)) {
|
||||
jiZhuangCheck.isEnabled = true
|
||||
jiZhuangCheck.background = ContextCompat.getDrawable(MyApplication.context, R.drawable.submit_shape)
|
||||
} else {
|
||||
jiZhuangCheck.isEnabled = false
|
||||
jiZhuangCheck.background = ContextCompat.getDrawable(MyApplication.context, R.drawable.input_shape)
|
||||
}
|
||||
//校验托盘差值
|
||||
if (mt3percent(tuoPanWeightDouble - tempWeight.toDouble(), tuoPanWeightDouble)) {
|
||||
tuoPanWeightCheck.isEnabled = true
|
||||
tuoPanWeightCheck.background = ContextCompat.getDrawable(MyApplication.context, R.drawable.submit_shape)
|
||||
} else {
|
||||
tuoPanWeightCheck.isEnabled = false
|
||||
tuoPanWeightCheck.background = ContextCompat.getDrawable(MyApplication.context, R.drawable.input_shape)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
jiZhuangWeight.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
if (s != null && s.toString().trim() != "") {
|
||||
val tempWeight = s.toString()
|
||||
var diBangWeightDouble = 0.0
|
||||
if (diBangWeight.text.toString() != "") {
|
||||
diBangWeightDouble = diBangWeight.text.toString().toDouble()
|
||||
} else {
|
||||
diBangWeightDouble = 0.0
|
||||
}
|
||||
|
||||
var tuoPanWeightDouble = 0.0
|
||||
if (tuoPanWeight.text.toString() != "") {
|
||||
tuoPanWeightDouble = tuoPanWeight.text.toString().toDouble()
|
||||
} else {
|
||||
tuoPanWeightDouble = 0.0
|
||||
}
|
||||
|
||||
val arriveWeightTemp = diBangWeightDouble - tempWeight.toDouble() - tuoPanWeightDouble
|
||||
arriveWeight.setText(arriveWeightTemp.toString())
|
||||
arriveVolume.setText(Arith.div(arriveWeightTemp, 220.0, 2).toString())
|
||||
}
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
tuoPanWeight.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
if (s != null && s.toString().trim() != "") {
|
||||
val tempWeight = s.toString()
|
||||
var diBangWeightDouble = 0.0
|
||||
if (diBangWeight.text.toString() != "") {
|
||||
diBangWeightDouble = diBangWeight.text.toString().toDouble()
|
||||
} else {
|
||||
diBangWeightDouble = 0.0
|
||||
}
|
||||
|
||||
var jiZhuangWeightDouble = 0.0
|
||||
if (jiZhuangWeight.text.toString() != "") {
|
||||
jiZhuangWeightDouble = jiZhuangWeight.text.toString().toDouble()
|
||||
} else {
|
||||
jiZhuangWeightDouble = 0.0
|
||||
}
|
||||
|
||||
val arriveWeightTemp = diBangWeightDouble - tempWeight.toDouble() - jiZhuangWeightDouble
|
||||
arriveWeight.setText(arriveWeightTemp.toString())
|
||||
arriveVolume.setText(Arith.div(arriveWeightTemp, 220.0, 2).toString())
|
||||
}
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
//点击确认
|
||||
/* uld.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
// uld.setText(fill0AndQueryActiveCar(uld.text.toString()))
|
||||
}
|
||||
false
|
||||
}*/
|
||||
//失去焦点
|
||||
tuoPanCode.onFocusChangeListener = View.OnFocusChangeListener { v, hasFocus ->
|
||||
if (hasFocus) {
|
||||
|
||||
} else {
|
||||
//失去焦点
|
||||
viewModel.queryFlatcarGjcReceive(tuoPanCode.text.toString())
|
||||
}
|
||||
}
|
||||
jiZhuangCode.onFocusChangeListener = View.OnFocusChangeListener { v, hasFocus ->
|
||||
if (hasFocus) {
|
||||
|
||||
} else {
|
||||
//失去焦点
|
||||
viewModel.queryUldGjcReceive(jiZhuangCode.text.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
v?.let {
|
||||
when (it.id) {
|
||||
R.id.finish_collect -> {
|
||||
if (getAllEditData()) {
|
||||
Common.secondConfirmDialog(this, "是否确认收运") { dialog ->
|
||||
viewModel.completed(viewModel.receiveWaybill)
|
||||
dialog.dismiss()
|
||||
loading()
|
||||
}
|
||||
}
|
||||
}
|
||||
R.id.wbNo_scan -> {
|
||||
scanCode(Constant.RequestCode.gjc_shouyun_waybill)
|
||||
}
|
||||
R.id.tuoPanScan -> {
|
||||
scanCode(Constant.RequestCode.gjc_shouyun_tuopan)
|
||||
}
|
||||
R.id.jiZhuangScan -> {
|
||||
scanCode(Constant.RequestCode.gjc_shouyun_jizhuang)
|
||||
}
|
||||
R.id.tuoPanWeightCheck -> {
|
||||
Common.secondConfirmDialog(this, "是否校验此托盘重量?") { dialog ->
|
||||
viewModel.updateFlatcarGjcReceive(tuoPanCode.text.toString(), diBangWeight.text.toString().toDouble())
|
||||
dialog.dismiss()
|
||||
loading()
|
||||
}
|
||||
}
|
||||
R.id.jiZhuangCheck -> {
|
||||
Common.secondConfirmDialog(this, "是否校验此集装器重量?") { dialog ->
|
||||
viewModel.updateUldGjcReceive(jiZhuangCode.text.toString(), diBangWeight.text.toString().toDouble())
|
||||
dialog.dismiss()
|
||||
loading()
|
||||
}
|
||||
}
|
||||
R.id.businessType -> {
|
||||
Common.singleSelect(this, "业务类型", viewModel.businessList, viewModel.receiveWaybill.businessType) { position, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
businessType.text = name
|
||||
viewModel.receiveWaybill.businessType = code
|
||||
}
|
||||
}
|
||||
R.id.spCode -> {
|
||||
Common.singleSelect(this, "特码", viewModel.specialCodeList, viewModel.receiveWaybill.spCode) { position, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
spCode.text = name
|
||||
viewModel.receiveWaybill.spCode = code
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
Toast.makeText(this, "未找到对应操作", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码返回的结果
|
||||
*/
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
// 扫描二维码/条码回传
|
||||
if (resultCode == RESULT_OK && data != null) {
|
||||
val content = data.getStringExtra(com.yzq.zxinglibrary.common.Constant.CODED_CONTENT)
|
||||
if (content == null) {
|
||||
Common.showToast(this, "条码错误!")
|
||||
return
|
||||
}
|
||||
when (requestCode) {
|
||||
Constant.RequestCode.gjc_shouyun_waybill -> {
|
||||
wbNo.setText("$content")
|
||||
viewModel.queryWaybillById(-9999, content)
|
||||
}
|
||||
Constant.RequestCode.gjc_shouyun_tuopan -> {
|
||||
tuoPanCode.setText("$content")
|
||||
viewModel.queryFlatcarGjcReceive(content)
|
||||
}
|
||||
Constant.RequestCode.gjc_shouyun_jizhuang -> {
|
||||
jiZhuangCode.setText("$content")
|
||||
viewModel.queryUldGjcReceive(content)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步viewModel的实体类数据
|
||||
*/
|
||||
private fun getAllEditData(): Boolean {
|
||||
viewModel.receiveWaybill.wbNo = wbNo.text.toString()
|
||||
viewModel.receiveWaybill.arrivePc = arrivePc.text.toString().toIntOrNull() ?: 0
|
||||
viewModel.receiveWaybill.arriveWeight = arriveWeight.text.toString().toDoubleOrNull() ?: 0.0
|
||||
viewModel.receiveWaybill.arriveVolume = arriveVolume.text.toString().toDoubleOrNull() ?: 0.0
|
||||
viewModel.receiveWaybill.remark = remark.text.toString()
|
||||
|
||||
if (viewModel.receiveWaybill.wbNo == "") {
|
||||
Common.showToast(this, "请填写运单号!")
|
||||
return false
|
||||
}
|
||||
|
||||
if (viewModel.receiveWaybill.arrivePc < 1) {
|
||||
Common.showToast(this, "请填写件数!")
|
||||
return false
|
||||
}
|
||||
|
||||
if (viewModel.receiveWaybill.spCode == "") {
|
||||
Common.showToast(this, "特码不能为空!")
|
||||
return false
|
||||
}
|
||||
if (viewModel.receiveWaybill.arriveWeight == 0.0) {
|
||||
Common.showToast(this, "请填写重量!")
|
||||
return false
|
||||
}
|
||||
if (viewModel.receiveWaybill.arriveVolume == 0.0) {
|
||||
Common.showToast(this, "请填写体积!")
|
||||
return false
|
||||
}
|
||||
|
||||
if (viewModel.receiveWaybill.businessType == "") {
|
||||
Common.showToast(this, "业务类型不能为空!")
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun setBackArrow(title: String) {
|
||||
setResult(RESULT_OK)
|
||||
super.setBackArrow(title)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重置数据
|
||||
*/
|
||||
private fun reset() {
|
||||
wbNo.setText("")
|
||||
diBangWeight.setText("")
|
||||
|
||||
pc.setText("")
|
||||
weight.setText("")
|
||||
volume.setText("")
|
||||
arrivePc.setText("")
|
||||
arriveWeight.setText("")
|
||||
arriveVolume.setText("")
|
||||
|
||||
jiZhuangCode.setText("")
|
||||
jiZhuangWeight.setText("")
|
||||
spCode.text = ""
|
||||
|
||||
businessType.text = ""
|
||||
tuoPanCode.setText("")
|
||||
tuoPanWeight.setText("")
|
||||
|
||||
remark.setText("")
|
||||
|
||||
//清空
|
||||
viewModel.receiveWaybill = GjcStartReceiveWaybill()
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否超过百分之三
|
||||
*/
|
||||
private fun mt3percent(num1: Double, num2: Double): Boolean {
|
||||
if (num2 == 0.0) {
|
||||
return false
|
||||
}
|
||||
val tempNum = abs(num1)
|
||||
val div = Arith.div(tempNum, num2, 3) * 100
|
||||
return div > 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.databinding.ActivityGjcUnLoadListBinding
|
||||
import com.lukouguoji.gjc.viewModel.GjcUnLoadListViewModel
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
||||
import com.lukouguoji.module_base.ktx.noNull
|
||||
|
||||
class GjcUnLoadListActivity :
|
||||
BaseBindingActivity<ActivityGjcUnLoadListBinding, GjcUnLoadListViewModel>() {
|
||||
|
||||
override fun layoutId() = R.layout.activity_gjc_un_load_list
|
||||
|
||||
override fun viewModelClass() = GjcUnLoadListViewModel::class.java
|
||||
|
||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||
setBackArrow("国际出港待装信息")
|
||||
binding.viewModel = viewModel
|
||||
|
||||
viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this)
|
||||
binding.rv.addOnItemClickListener(viewModel)
|
||||
|
||||
viewModel.refresh()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun start(context: Context) {
|
||||
val starter = Intent(context, GjcUnLoadListActivity::class.java)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,532 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.fastjson.JSONArray
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.adapt.GjcWareHouseListAdapter
|
||||
import com.lukouguoji.gjc.model.GjcWareHouseList
|
||||
import com.lukouguoji.gjc.viewModel.GjcWareHouseListViewModel
|
||||
import com.lukouguoji.module_base.ActivityCollector
|
||||
import com.lukouguoji.module_base.BaseActivity
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
import com.lukouguoji.module_base.util.Common
|
||||
import com.scwang.smart.refresh.footer.ClassicsFooter
|
||||
import com.scwang.smart.refresh.header.ClassicsHeader
|
||||
import com.scwang.smart.refresh.layout.api.RefreshLayout
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_WARE_HOUSE)
|
||||
class GjcWareHouseActivity : BaseActivity(), View.OnClickListener {
|
||||
private lateinit var viewModel: GjcWareHouseListViewModel
|
||||
private val currentTitleName = "国际出港仓库管理"
|
||||
|
||||
private lateinit var adapter: GjcWareHouseListAdapter
|
||||
private val collectList = ArrayList<GjcWareHouseList>()
|
||||
|
||||
private lateinit var refreshLayout: RefreshLayout
|
||||
private var currentPage = 1
|
||||
private var pageSize = 10
|
||||
private var totalPage = 0
|
||||
|
||||
//是否刷新
|
||||
private var refresh = false
|
||||
|
||||
//标题
|
||||
private lateinit var toolBack: LinearLayout
|
||||
private lateinit var titleName: TextView
|
||||
|
||||
//搜索条件
|
||||
private lateinit var searchListFragment: LinearLayout
|
||||
|
||||
// private lateinit var startDate: TextView
|
||||
// private lateinit var endDate: TextView
|
||||
// private lateinit var flightDate: TextView
|
||||
// private lateinit var flightDateIcon: ImageView
|
||||
// private lateinit var flightNo: EditText
|
||||
private lateinit var mudiGang: EditText
|
||||
private lateinit var searchLayout: LinearLayout
|
||||
private lateinit var summaryText: TextView
|
||||
|
||||
//筛选页
|
||||
private lateinit var filtrateLayout: LinearLayout
|
||||
private lateinit var filtrateFragment: LinearLayout
|
||||
private lateinit var isGroup: TextView
|
||||
private var isGroupStatus = ""
|
||||
private val isGroupArr = JSONArray()
|
||||
|
||||
private lateinit var agentCode: TextView
|
||||
private var agentCodeValue = ""
|
||||
|
||||
private lateinit var carrier: EditText
|
||||
private lateinit var businessType: TextView
|
||||
private var businessTypeValue = ""
|
||||
private lateinit var wayNo: EditText
|
||||
private lateinit var submit: TextView
|
||||
private lateinit var reset: TextView
|
||||
|
||||
private val ymdSdf = SimpleDateFormat("yyyy-MM-dd")//年月日
|
||||
private val ymdHmsSdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")//年月日 时分秒
|
||||
private val calendar = Calendar.getInstance()
|
||||
|
||||
private fun initView() {
|
||||
viewModel = ViewModelProvider(this).get(GjcWareHouseListViewModel::class.java)
|
||||
|
||||
val layoutManager = LinearLayoutManager(this)
|
||||
adapter = GjcWareHouseListAdapter(this, collectList)
|
||||
var recyclerView: RecyclerView = findViewById(R.id.guo_nei_collect_list)
|
||||
recyclerView.layoutManager = layoutManager
|
||||
recyclerView.adapter = adapter
|
||||
|
||||
refreshLayout = findViewById(R.id.refreshLayout)
|
||||
|
||||
//标题
|
||||
toolBack = findViewById(R.id.tool_back)
|
||||
titleName = findViewById(R.id.title_name)
|
||||
|
||||
//搜索列表页
|
||||
searchListFragment = findViewById(R.id.searchListFragment)
|
||||
// startDate = findViewById(R.id.startDate)
|
||||
// endDate = findViewById(R.id.endDate)
|
||||
// flightDate = findViewById(R.id.flightDate)
|
||||
// flightDateIcon = findViewById(R.id.flightDateIcon)
|
||||
// flightNo = findViewById(R.id.fno)
|
||||
mudiGang = findViewById(R.id.mudiGang)
|
||||
searchLayout = findViewById(R.id.searchLayout)
|
||||
filtrateLayout = findViewById(R.id.filtrateLayout)
|
||||
summaryText = findViewById(R.id.summaryText)
|
||||
//筛选页
|
||||
filtrateFragment = findViewById(R.id.filtrateFragment)
|
||||
isGroup = findViewById(R.id.isGroup)
|
||||
agentCode = findViewById(R.id.agentCode)
|
||||
carrier = findViewById(R.id.carrier)
|
||||
businessType = findViewById(R.id.businessType)
|
||||
wayNo = findViewById(R.id.waybillNo)
|
||||
submit = findViewById(R.id.submit)
|
||||
reset = findViewById(R.id.reset)
|
||||
|
||||
toolBack.setOnClickListener(this)
|
||||
// startDate.setOnClickListener(this)
|
||||
// endDate.setOnClickListener(this)
|
||||
// flightDate.setOnClickListener(this)
|
||||
// flightDateIcon.setOnClickListener(this)
|
||||
searchLayout.setOnClickListener(this)
|
||||
filtrateLayout.setOnClickListener(this)
|
||||
submit.setOnClickListener(this)
|
||||
reset.setOnClickListener(this)
|
||||
isGroup.setOnClickListener(this)
|
||||
businessType.setOnClickListener(this)
|
||||
agentCode.setOnClickListener(this)
|
||||
|
||||
carrier.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun afterTextChanged(editable: Editable?) {
|
||||
val originText = editable.toString()
|
||||
if (originText != null && originText != "") {
|
||||
val regularExpression = "(^([A-Z]+)$)"
|
||||
val matches = originText.matches(regularExpression.toRegex())
|
||||
if(!matches){
|
||||
val regularExpression2 = "([^A-Za-z]+)"
|
||||
val replaceStr = originText.replace(regularExpression2.toRegex(),"")
|
||||
val replaceStrToUpper = replaceStr.uppercase(Locale.ROOT)//小写转大写
|
||||
carrier.setText(replaceStrToUpper)
|
||||
carrier.setSelection(replaceStrToUpper.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
mudiGang.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun afterTextChanged(editable: Editable?) {
|
||||
val originText = editable.toString()
|
||||
if (originText != null && originText != "") {
|
||||
val regularExpression = "(^([A-Z]+)$)"
|
||||
val matches = originText.matches(regularExpression.toRegex())
|
||||
if(!matches){
|
||||
val regularExpression2 = "([^A-Za-z]+)"
|
||||
val replaceStr = originText.replace(regularExpression2.toRegex(),"")
|
||||
val replaceStrToUpper = replaceStr.uppercase(Locale.ROOT)//小写转大写
|
||||
mudiGang.setText(replaceStrToUpper)
|
||||
mudiGang.setSelection(replaceStrToUpper.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
//赋值
|
||||
// val format = ymdSdf.format(Date())
|
||||
// startDate.text = "$format 00:00:00"
|
||||
// endDate.text = ymdHmsSdf.format(Date())
|
||||
// calendar.time = Date()
|
||||
// calendar.add(Calendar.MINUTE, 30)
|
||||
// endDate.text = ymdHmsSdf.format(calendar.time)
|
||||
//是否上舱单
|
||||
val noneGroup = JSONObject()
|
||||
noneGroup["name"] = "请选择分组类型"
|
||||
noneGroup["code"] = ""
|
||||
val yesGroup = JSONObject()
|
||||
yesGroup["name"] = "航程"
|
||||
yesGroup["code"] = "dest"
|
||||
val noGroup = JSONObject()
|
||||
noGroup["name"] = "入库时间"
|
||||
noGroup["code"] = "date"
|
||||
isGroupArr.add(noneGroup)
|
||||
isGroupArr.add(yesGroup)
|
||||
isGroupArr.add(noGroup)
|
||||
|
||||
wayNo.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
if (s != null && s.toString().length > 11) {
|
||||
Common.alertDialog(ActivityCollector.getLastActivity()!!, "运单号不能超过11位!") { dialog ->
|
||||
wayNo.setText(s.toString().substring(0, 11))
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_gjc_ware_house)
|
||||
initView()
|
||||
|
||||
//查询返回结果
|
||||
viewModel.searchParamLive.observe(this) {
|
||||
loadingCancel()
|
||||
//1.获取数据
|
||||
var listArr = JSONArray()
|
||||
try {
|
||||
listArr = it["list"] as JSONArray
|
||||
} catch (e: Exception) {
|
||||
return@observe
|
||||
}
|
||||
totalPage = it["pages"] as Int
|
||||
// var listArr :JSONArray =it["list"] as JSONArray
|
||||
if (listArr.size > 0) {
|
||||
//2.循环遍历塞入collectList
|
||||
listArr.forEach {
|
||||
val itemObj = it as JSONObject
|
||||
val whId = itemObj.getIntValue("whid")
|
||||
val no = itemObj.getString("wbNo") ?: ""
|
||||
val weight = itemObj.getDouble("weight")
|
||||
val pc = itemObj.getIntValue("pc")
|
||||
val fno = itemObj.getString("fno") ?: ""
|
||||
val flight = itemObj.getString("flight") ?: ""
|
||||
val opDate = itemObj.getString("opDate") ?: ""
|
||||
val gdate = itemObj.getString("gdate") ?: ""
|
||||
val locStatus = itemObj.getString("locStatus") ?: ""
|
||||
val dest = itemObj.getString("dest") ?: ""
|
||||
val location = itemObj.getString("location") ?: ""
|
||||
val goods = itemObj.getString("goods") ?: ""
|
||||
val spCode = itemObj.getString("spCode") ?: ""
|
||||
val agentCode = itemObj.getString("agentCode") ?: ""
|
||||
val by1 = itemObj.getString("by1") ?: ""
|
||||
val origin = itemObj.getString("origin") ?: ""
|
||||
val awbType = itemObj.getString("awbType") ?: ""
|
||||
val businessType = itemObj.getString("businessType") ?: ""
|
||||
val status = itemObj.getString("status") ?: ""
|
||||
val days = itemObj.getIntValue("days")
|
||||
|
||||
var groupTitle = ""
|
||||
var groupName = ""
|
||||
var daysString: String? = null
|
||||
when (isGroupStatus) {
|
||||
"dest" -> {
|
||||
groupTitle = "目的港:"
|
||||
groupName = dest
|
||||
}
|
||||
"date" -> {
|
||||
groupTitle = "入库时间:"
|
||||
groupName = "$gdate,入库天数:"
|
||||
daysString = days.toString()
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
val element = GjcWareHouseList(
|
||||
whId,
|
||||
no,
|
||||
pc,
|
||||
weight,
|
||||
fno,
|
||||
flight,
|
||||
opDate,
|
||||
locStatus,
|
||||
groupTitle,
|
||||
groupName,
|
||||
daysString,
|
||||
goods,
|
||||
spCode,
|
||||
agentCode,
|
||||
by1,
|
||||
origin,
|
||||
location,
|
||||
awbType,
|
||||
businessType,
|
||||
status,
|
||||
)
|
||||
collectList.add(
|
||||
element
|
||||
)
|
||||
}
|
||||
//3.调adpter展示
|
||||
if (currentPage == 1) {
|
||||
adapter.notifyDataSetChanged()
|
||||
} else {
|
||||
adapter.notifyItemRangeInserted((currentPage - 1) * 10, collectList.size)
|
||||
}
|
||||
refreshLayout.finishRefresh()
|
||||
refreshLayout.finishLoadMore()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//汇总返回结果
|
||||
viewModel.summaryObserver.observe(this) {
|
||||
loadingCancel()
|
||||
val status = it.getString("status")
|
||||
if (Constant.Result.succ == status) {
|
||||
var jsonObject = it.getJSONObject("data")
|
||||
val totalTemp = jsonObject.getIntValue("total")
|
||||
val totalPcTemp = jsonObject.getIntValue("pc")
|
||||
val totalWeightTemp = jsonObject.getDoubleValue("weight")
|
||||
summaryText.text = "总票数:$totalTemp,总件数:$totalPcTemp,总重量:$totalWeightTemp"
|
||||
} else {
|
||||
//无数据
|
||||
}
|
||||
}
|
||||
|
||||
//初始化查询
|
||||
searchFun()
|
||||
loading()
|
||||
|
||||
/////////////// 下拉框 start
|
||||
viewModel.agentCode(System.currentTimeMillis().toString())
|
||||
viewModel.agentCodeObserver.observe(this) { vd ->
|
||||
val noneObj = JSONObject()
|
||||
noneObj["name"] = "请选择代理人"
|
||||
noneObj["code"] = ""
|
||||
viewModel.agentCodeList.add(noneObj)
|
||||
viewModel.agentCodeList.addAll(vd.getJSONArray("data"))
|
||||
}
|
||||
|
||||
viewModel.business(Constant.businessType.IO)
|
||||
viewModel.businessObserver.observe(this) { vd ->
|
||||
val noneObj = JSONObject()
|
||||
noneObj["name"] = "请选择业务类型"
|
||||
noneObj["code"] = ""
|
||||
viewModel.businessList.add(noneObj)
|
||||
viewModel.businessList.addAll(vd.getJSONArray("data"))
|
||||
}
|
||||
/////////////// 下拉框 end
|
||||
|
||||
/////////////////////////////// 加载刷新的布局
|
||||
refreshLayout.setRefreshHeader(ClassicsHeader(this))
|
||||
refreshLayout.setRefreshFooter(ClassicsFooter(this))
|
||||
/////////////////////////////// 下拉刷新
|
||||
refreshLayout.setOnRefreshListener {
|
||||
refresh = true
|
||||
resetSearch()
|
||||
}
|
||||
/////////////////////////////// 上拉加载
|
||||
refreshLayout.setOnLoadMoreListener {
|
||||
refresh = false
|
||||
if (currentPage < totalPage) {
|
||||
currentPage++
|
||||
//初始化查询
|
||||
searchFun()
|
||||
} else {
|
||||
refreshLayout.finishLoadMoreWithNoMoreData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
v?.let {
|
||||
when (it.id) {
|
||||
R.id.tool_back -> {
|
||||
if (searchListFragment.visibility == View.GONE && filtrateFragment.visibility == View.VISIBLE) {
|
||||
searchListFragment.visibility = View.VISIBLE
|
||||
filtrateFragment.visibility = View.GONE
|
||||
titleName.text = currentTitleName
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
/*R.id.startDate -> {
|
||||
Common.onYearMonthDayTime(this, startDate.text.toString()) { year, month, day, hour, minute, second ->
|
||||
calendar.set(year, month - 1, day, hour, minute, second)
|
||||
startDate.text = ymdHmsSdf.format(calendar.time)
|
||||
}
|
||||
}
|
||||
R.id.endDate -> {
|
||||
Common.onYearMonthDayTime(this, endDate.text.toString()) { year, month, day, hour, minute, second ->
|
||||
calendar.set(year, month - 1, day, hour, minute, second)
|
||||
endDate.text = ymdHmsSdf.format(calendar.time)
|
||||
}
|
||||
}
|
||||
R.id.flightDate -> {
|
||||
Common.onYearMonthDay(this, endDate.text.toString()) { year, month, day ->
|
||||
calendar.set(year, month - 1, day)
|
||||
flightDate.text = ymdSdf.format(calendar.time)
|
||||
}
|
||||
// Common.showToast(this, "航班日期")
|
||||
}
|
||||
R.id.flightDateIcon -> {
|
||||
flightDate.text = ""
|
||||
}*/
|
||||
R.id.searchLayout -> {
|
||||
resetSearch()
|
||||
}
|
||||
R.id.filtrateLayout -> {
|
||||
if (searchListFragment.visibility == View.VISIBLE && filtrateFragment.visibility == View.GONE) {
|
||||
searchListFragment.visibility = View.GONE
|
||||
filtrateFragment.visibility = View.VISIBLE
|
||||
titleName.text = "搜索"
|
||||
} else {
|
||||
searchListFragment.visibility = View.VISIBLE
|
||||
filtrateFragment.visibility = View.GONE
|
||||
titleName.text = currentTitleName
|
||||
}
|
||||
}
|
||||
R.id.isGroup -> {
|
||||
Common.singleSelect(this, "分组类型", isGroupArr, isGroupStatus) { position, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
isGroup.text = name
|
||||
isGroupStatus = code
|
||||
}
|
||||
}
|
||||
R.id.businessType -> {
|
||||
Common.singleSelect(this, "业务类型", viewModel.businessList, businessTypeValue) { _, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
businessType.text = name
|
||||
businessTypeValue = code
|
||||
}
|
||||
}
|
||||
R.id.agentCode -> {
|
||||
Common.singleSelect(this, "代理", viewModel.agentCodeList, agentCodeValue) { _, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val name = jsonObject.getString("name")
|
||||
val code = jsonObject.getString("code")
|
||||
agentCode.text = name
|
||||
agentCodeValue = code
|
||||
}
|
||||
}
|
||||
R.id.submit -> {
|
||||
//筛选页隐藏
|
||||
searchListFragment.visibility = View.VISIBLE
|
||||
filtrateFragment.visibility = View.GONE
|
||||
titleName.text = currentTitleName
|
||||
//搜索
|
||||
resetSearch()
|
||||
}
|
||||
R.id.reset -> {
|
||||
resetFun()
|
||||
}
|
||||
else -> {
|
||||
Toast.makeText(this, "未找到对应操作", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
private fun searchFun() {
|
||||
viewModel.search(
|
||||
pageSize,
|
||||
currentPage,
|
||||
carrier.text.toString(),
|
||||
"",//startDate.text.toString(),
|
||||
"",//endDate.text.toString(),
|
||||
"",//flightDate.text.toString(),
|
||||
"",//flightNo.text.toString(),
|
||||
mudiGang.text.toString(),
|
||||
businessTypeValue,
|
||||
"",
|
||||
"",//isCangDanStatus
|
||||
wayNo.text.toString(),
|
||||
isGroupStatus,
|
||||
agentCodeValue
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置数据,搜索
|
||||
*/
|
||||
private fun resetSearch() {
|
||||
//recyclerView 清除所有数据数据
|
||||
refreshLayout.setNoMoreData(false)
|
||||
adapter.notifyItemRangeRemoved(0, collectList.size)
|
||||
collectList.clear()
|
||||
currentPage = 1
|
||||
searchFun()
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置筛选条件
|
||||
*/
|
||||
private fun resetFun() {
|
||||
currentPage = 1
|
||||
carrier.setText("")
|
||||
/* var format = ymdSdf.format(Date())
|
||||
startDate.text = "$format 00:00:00"
|
||||
calendar.time = Date()
|
||||
calendar.add(Calendar.MINUTE, 30)
|
||||
endDate.text = ymdHmsSdf.format(calendar.time)
|
||||
flightDate.text = ""
|
||||
flightNo.setText("")*/
|
||||
mudiGang.setText("")
|
||||
businessType.text = ""
|
||||
businessTypeValue = ""
|
||||
isGroup.text = ""
|
||||
isGroupStatus = ""
|
||||
agentCode.text = ""
|
||||
agentCodeValue = ""
|
||||
wayNo.setText("")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.core.widget.NestedScrollView
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.facade.annotation.Autowired
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.adapt.GjcWareHouseInfoListAdapter
|
||||
import com.lukouguoji.gjc.model.GjcWareHouseInfo
|
||||
import com.lukouguoji.gjc.viewModel.GjcWareHouseInfoViewModel
|
||||
import com.lukouguoji.module_base.BaseActivity
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_WARE_HOUSE_INFO)
|
||||
class GjcWareHouseInfoActivity : BaseActivity(), View.OnClickListener {
|
||||
private lateinit var viewModel: GjcWareHouseInfoViewModel
|
||||
|
||||
private lateinit var scrollView: NestedScrollView
|
||||
private lateinit var gncQueryInfoList: RecyclerView
|
||||
private lateinit var adapter: GjcWareHouseInfoListAdapter
|
||||
private val queryInfoAdapterList = arrayListOf<GjcWareHouseInfo>()
|
||||
|
||||
@JvmField
|
||||
@Autowired
|
||||
var id: Int = -9999
|
||||
|
||||
private fun initView() {
|
||||
viewModel = ViewModelProvider(this).get(GjcWareHouseInfoViewModel::class.java)
|
||||
|
||||
scrollView = findViewById(R.id.scrollView)
|
||||
|
||||
val layoutManager = GridLayoutManager(this, 2)
|
||||
adapter = GjcWareHouseInfoListAdapter(this, queryInfoAdapterList)
|
||||
gncQueryInfoList = findViewById(R.id.gncQueryInfoList)
|
||||
gncQueryInfoList.adapter = adapter
|
||||
gncQueryInfoList.layoutManager = layoutManager
|
||||
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_gjc_ware_house_info)
|
||||
setBackArrow("仓库管理详情")
|
||||
initView()
|
||||
|
||||
viewModel.queryInfoByIdWareHouse(id)
|
||||
viewModel.queryInfoByIdWareHouseObserver.observe(this) {
|
||||
val status = it.getString("status")
|
||||
if (Constant.Result.succ == status) {
|
||||
viewModel.wayBillInfo = it.getJSONObject("data")
|
||||
//运单号、
|
||||
adapter.append(GjcWareHouseInfo(1, "运单号", viewModel.wayBillInfo.getString("wbNo") ?: ""))
|
||||
// 件数、
|
||||
adapter.append(GjcWareHouseInfo(1, "件数", viewModel.wayBillInfo.getString("pc") ?: ""))
|
||||
// 重量、
|
||||
adapter.append(GjcWareHouseInfo(1, "重量", "${viewModel.wayBillInfo.getDoubleValue("weight")} KG"))
|
||||
// 品名、
|
||||
adapter.append(GjcWareHouseInfo(1, "品名(英)", viewModel.wayBillInfo.getString("goods") ?: ""))
|
||||
// 特码、
|
||||
adapter.append(GjcWareHouseInfo(1, "特码", viewModel.wayBillInfo.getString("spcode") ?: ""))
|
||||
// 代理人、
|
||||
adapter.append(GjcWareHouseInfo(1, "代理人", viewModel.wayBillInfo.getString("agent") ?: ""))
|
||||
// 承运人、
|
||||
adapter.append(GjcWareHouseInfo(1, "承运人", viewModel.wayBillInfo.getString("by1") ?: ""))
|
||||
//始发港、
|
||||
adapter.append(GjcWareHouseInfo(1, "目的港", viewModel.wayBillInfo.getString("dest") ?: ""))
|
||||
// 航班、
|
||||
adapter.append(GjcWareHouseInfo(1, "航班", viewModel.wayBillInfo.getString("flight") ?: ""))
|
||||
// 库位
|
||||
// adapter.append(GjcWareHouseInfo(1, "库位", viewModel.wayBillInfo.getString("location") ?: ""))
|
||||
// 运单类型、
|
||||
adapter.append(GjcWareHouseInfo(1, "运单类型", viewModel.wayBillInfo.getString("awbType") ?: ""))
|
||||
// 业务类型、
|
||||
adapter.append(GjcWareHouseInfo(1, "业务类型", viewModel.wayBillInfo.getString("businesstype") ?: ""))
|
||||
// 包装类型
|
||||
adapter.append(GjcWareHouseInfo(1, "包装类型", viewModel.wayBillInfo.getString("packageCode") ?: ""))
|
||||
// 状态、
|
||||
// adapter.append(GjcWareHouseInfo(1, "状态", viewModel.wayBillInfo.getString("ref") ?: ""))
|
||||
// 入库时间
|
||||
adapter.append(GjcWareHouseInfo(1, "入库时间", viewModel.wayBillInfo.getString("opDate") ?: ""))
|
||||
|
||||
} else {
|
||||
//无数据
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
v?.let {
|
||||
when (it.id) {
|
||||
else -> {
|
||||
Toast.makeText(this, "未找到对应操作", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.lukouguoji.gjc.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.adapt.GjcYiKuListSwitchAdapter
|
||||
import com.lukouguoji.gjc.fragment.GjcYiKu2Fragment
|
||||
import com.lukouguoji.gjc.fragment.GjcYiKuFragment
|
||||
import com.lukouguoji.module_base.BaseActivity
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
|
||||
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_YI_KU)
|
||||
class GjcYiKuListActivity : BaseActivity(), View.OnClickListener {
|
||||
|
||||
val viewContainter = ArrayList<View>()
|
||||
var pager: ViewPager? = null
|
||||
|
||||
|
||||
private fun initView() {
|
||||
val listFragment = arrayListOf<Fragment>()
|
||||
listFragment.add(GjcYiKu2Fragment())
|
||||
listFragment.add(GjcYiKuFragment())
|
||||
val viewPager2 = findViewById<ViewPager2>(R.id.viewpager2)
|
||||
val viewPagerAdapter = GjcYiKuListSwitchAdapter(listFragment, supportFragmentManager, lifecycle)
|
||||
viewPager2.adapter = viewPagerAdapter
|
||||
viewPager2.setCurrentItem(1, false)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_gjc_yi_ku_list)
|
||||
initView()
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
v?.let {
|
||||
when (it.id) {
|
||||
else -> {
|
||||
Toast.makeText(this, "未找到对应操作", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user