|
|
@@ -0,0 +1,388 @@
|
|
|
+package cn.muchinfo.rma.view.base.hnstcdys
|
|
|
+
|
|
|
+import android.graphics.Color
|
|
|
+import android.view.Gravity
|
|
|
+import android.view.View
|
|
|
+import android.widget.TextView
|
|
|
+import androidx.appcompat.app.AppCompatActivity
|
|
|
+import androidx.recyclerview.widget.RecyclerView
|
|
|
+import cn.muchinfo.rma.R
|
|
|
+import cn.muchinfo.rma.global.data.FtDeliveryGoodsData
|
|
|
+import cn.muchinfo.rma.global.data.FtDeliveryGoodsDataListData
|
|
|
+import cn.muchinfo.rma.global.data.WrFtWrstandard
|
|
|
+import cn.muchinfo.rma.global.data.WrStandardFactoryItem
|
|
|
+import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
+import cn.muchinfo.rma.view.autoWidget.*
|
|
|
+import cn.muchinfo.rma.view.base.hnstcdys.viewholder.CdysSelectViewHolder
|
|
|
+import cn.muchinfo.rma.view.base.hnstcdys.viewholder.CdysWrStandardFactoryItemViewHolder
|
|
|
+import cn.muchinfo.rma.view.base.hnstcdys.viewholder.CdysWrstandardnameViewHolder
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
+import cn.muchinfo.rma.view.base.warehousereceipt.viewholder.WarehouseSelectViewHolder
|
|
|
+import cn.muchinfo.rma.view.base.warehousereceipt.viewholder.WarehouseWrstandardnameViewHolder
|
|
|
+import cn.muchinfo.rma.view.base.warehousereceipt.viewholder.WarehouseWrstandnameSoneViewHolder
|
|
|
+import cn.muchinfo.rma.view.base.warehousereceipt.viewholder.WrStandardFactoryItemViewHolder
|
|
|
+import com.blankj.utilcode.util.TimeUtils
|
|
|
+import com.blankj.utilcode.util.ToastUtils
|
|
|
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
|
|
|
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
|
|
|
+import mtp.polymer.com.autowidget.dialog.CustomDialogFragment
|
|
|
+import mtp.polymer.com.autowidget.dialog.creatBottomSheetDialog
|
|
|
+import mtp.polymer.com.autowidget.dialog.createCustomDialog
|
|
|
+import mtp.polymer.com.autowidget.dialog.showDataSelectDialog
|
|
|
+import org.jetbrains.anko.*
|
|
|
+import java.text.SimpleDateFormat
|
|
|
+
|
|
|
+//仓单贸易左侧菜单栏
|
|
|
+fun AppCompatActivity.CdysScreeningDialog(
|
|
|
+ viewModel: HnstcdysViewModel,
|
|
|
+ activity: AppCompatActivity,
|
|
|
+ type: String//1 是一口价 2是浮动价
|
|
|
+): CustomDialogFragment {
|
|
|
+
|
|
|
+ /** 查询时间textview **/
|
|
|
+ lateinit var tradedatetextview: TextView
|
|
|
+
|
|
|
+ //品种
|
|
|
+ val spotCategoryAdapter: BaseAdapter<FtDeliveryGoodsData, CdysWrstandardnameViewHolder> =
|
|
|
+ BaseAdapter { _, _ -> CdysWrstandardnameViewHolder(activity, viewModel) }
|
|
|
+
|
|
|
+ //要素
|
|
|
+ val elementsAdapter: BaseAdapter<FtDeliveryGoodsDataListData, CdysWrStandardFactoryItemViewHolder> =
|
|
|
+ BaseAdapter { _, _ -> CdysWrStandardFactoryItemViewHolder(activity, viewModel) }
|
|
|
+
|
|
|
+ lateinit var warehouseRecycview: RecyclerView
|
|
|
+
|
|
|
+ return createCustomDialog(cancelable = false) { dialog ->
|
|
|
+ backgroundColor = Color.parseColor("#5f000000")
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ viewModel.resetFtDeliveryGoodsDataList()
|
|
|
+ viewModel.setGoodsGroupAndGoodsInfoList()
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ viewModel.selectWrFtWrstandardData.bindOptional(context) {
|
|
|
+ viewModel.queryWrStandardFactoryItem(it?.wrstandardid ?: "")
|
|
|
+ }
|
|
|
+
|
|
|
+ frameLayout {
|
|
|
+ nestedScrollView {
|
|
|
+ linearLayout {
|
|
|
+ recyclerView {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = spotCategoryAdapter
|
|
|
+ }.lparams(autoSize(310), matchParent) {
|
|
|
+ bottomMargin = autoSize(150)
|
|
|
+ }
|
|
|
+
|
|
|
+ viewModel.ftDeliveryGoodsDataList.bindOptional(context) {
|
|
|
+ spotCategoryAdapter.setNewData(it)
|
|
|
+ }
|
|
|
+
|
|
|
+ view {
|
|
|
+ background = resources.getDrawable(R.color.rma_hint_line_color_eee)
|
|
|
+ }.lparams(autoSize(1), matchParent)
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "仓库"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(34)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(80))
|
|
|
+
|
|
|
+ recyclerView {
|
|
|
+ warehouseRecycview = this
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ }.lparams(matchParent, wrapContent)
|
|
|
+
|
|
|
+ viewModel.WrStandardFactoryItemDataList.bindOptional(context) { data ->
|
|
|
+ //仓库
|
|
|
+ val ftDeliveryGoodsDataListData =
|
|
|
+ data?.find { it.dgfactoryitemtypeid == "1" }
|
|
|
+ if (ftDeliveryGoodsDataListData?.dgfactoryitemtypeid.isNullOrEmpty()
|
|
|
+ .not()
|
|
|
+ ) {
|
|
|
+ val watehouseAdapter: BaseAdapter<WrStandardFactoryItem, CdysSelectViewHolder> =
|
|
|
+ BaseAdapter { _, _ ->
|
|
|
+ CdysSelectViewHolder(
|
|
|
+ activity,
|
|
|
+ viewModel,
|
|
|
+ ftDeliveryGoodsDataListData?.dgfactoryitemtypeid
|
|
|
+ ?: ""
|
|
|
+ )
|
|
|
+ }
|
|
|
+ warehouseRecycview.adapter = watehouseAdapter
|
|
|
+ watehouseAdapter.setNewData(ftDeliveryGoodsDataListData?.itemlst)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "交收月"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(34)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(80))
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.showDataSelectDialog(type = "2") {
|
|
|
+ tradedatetextview.text = this
|
|
|
+ }
|
|
|
+ }
|
|
|
+ backgroundResource = R.drawable.rma_time_click_bg
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ tradedatetextview = this
|
|
|
+ text = TimeUtils.millis2String(
|
|
|
+ TimeUtils.getNowMills().minus(86400000),
|
|
|
+ SimpleDateFormat("yyyy-MM")
|
|
|
+ )
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(18)
|
|
|
+ }
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_search_by_time
|
|
|
+ }.lparams(autoSize(38), autoSize(38)){
|
|
|
+ marginEnd = autoSize(10)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(420), autoSize(72)) {
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ bottomMargin = autoSize(20)
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ if (type == "1") {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "期货合约"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(34)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(80))
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.creatBottomSheetDialog(
|
|
|
+ "请选择品种",
|
|
|
+ viewModel.goodsGroupList.value ?: arrayListOf()
|
|
|
+ ) {
|
|
|
+ viewModel.selectGoodsGroupData.postValue(this)
|
|
|
+ viewModel.setGoodsInfoList(this.goodsgroupid)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ backgroundResource = R.drawable.yrdz_item_normal_bg
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ viewModel.selectGoodsGroupData.bindOptional(context) {
|
|
|
+ text = it?.value
|
|
|
+ }
|
|
|
+ text = "请选择品种"
|
|
|
+ textSizeAuto = 32
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_down
|
|
|
+ }.lparams(autoSize(30), autoSize(20)) {
|
|
|
+ marginEnd = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(420), autoSize(72)) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (viewModel.selectGoodsGroupData.value?.id.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请先选择商品组")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ activity.creatBottomSheetDialog(
|
|
|
+ "请选择合约",
|
|
|
+ viewModel.goodsInfoList.value ?: arrayListOf()
|
|
|
+ ) {
|
|
|
+ viewModel.selectGoodsInfoData.postValue(this)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ backgroundResource = R.drawable.yrdz_item_normal_bg
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ viewModel.selectGoodsInfoData.bindOptional(context) {
|
|
|
+ text = it?.value
|
|
|
+ }
|
|
|
+ text = "请选择合约"
|
|
|
+ textSizeAuto = 32
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_down
|
|
|
+ }.lparams(autoSize(30), autoSize(20)) {
|
|
|
+ marginEnd = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(420), autoSize(72)) {
|
|
|
+ topMargin = autoSize(24)
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, wrapContent)
|
|
|
+
|
|
|
+
|
|
|
+ recyclerView {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = elementsAdapter
|
|
|
+ }.lparams(matchParent, wrapContent)
|
|
|
+
|
|
|
+ viewModel.WrStandardFactoryItemDataList.bindOptional(context) { data ->
|
|
|
+ val elementsDataList = arrayListOf<FtDeliveryGoodsDataListData>()
|
|
|
+
|
|
|
+ data?.forEach {
|
|
|
+ if (it.dgfactoryitemtypeid != "1") {
|
|
|
+ elementsDataList.add(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ elementsAdapter.setNewData(elementsDataList)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ dialog.dismiss()
|
|
|
+ viewModel.selectWrFtWrstandardData.postValue(WrFtWrstandard())
|
|
|
+ }
|
|
|
+ backgroundResource = R.drawable.rma_item_click_bg
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ text = "重置"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_blue_color
|
|
|
+ }.lparams(0, autoSize(84), 1f) {
|
|
|
+ marginStart = autoSize(23)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (viewModel.selectWrFtWrstandardData.value?.wrstandardid.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择相应商品")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (type == "1") {
|
|
|
+ viewModel.queryOneOrderQuote(
|
|
|
+ wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid
|
|
|
+ ?: "",
|
|
|
+ warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),
|
|
|
+ dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"),
|
|
|
+ deliverymonth = tradedatetextview.text.toString()
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ viewModel.queryFloatOrderQuote(
|
|
|
+ wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid
|
|
|
+ ?: "",
|
|
|
+ warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),
|
|
|
+ dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"),
|
|
|
+ deliverymonth = tradedatetextview.text.toString()
|
|
|
+ )
|
|
|
+ }
|
|
|
+ dialog.dismiss()
|
|
|
+ }
|
|
|
+ backgroundResource = R.drawable.rydz_main_blue_bg
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ text = "筛选"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.white
|
|
|
+ }.lparams(0, autoSize(84), 1f) {
|
|
|
+ marginStart = autoSize(23)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (viewModel.selectWrFtWrstandardData.value?.wrstandardid.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择相应商品")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (viewModel.getSelectWarehouseOrFactoryid("1").isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择仓库")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (viewModel.selectGoodsInfoData.value?.id.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择期货商品")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (viewModel.getSelectWarehouseOrFactoryid("2")
|
|
|
+ .split(",").size < viewModel.WrStandardFactoryItemDataList.value?.size?.minus(
|
|
|
+ 1
|
|
|
+ ) ?: 0
|
|
|
+ ) {
|
|
|
+ ToastUtils.showLong("请选择必要要素")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (type == "1") {
|
|
|
+ viewModel.queryOneOrderQuoteByListed(
|
|
|
+ wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid
|
|
|
+ ?: "",
|
|
|
+ warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),
|
|
|
+ dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"),
|
|
|
+ deliverymonth = tradedatetextview.text.toString()
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ viewModel.queryFloatOrderQuoteByListed(
|
|
|
+ wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid
|
|
|
+ ?: "",
|
|
|
+ warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),
|
|
|
+ dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"),
|
|
|
+ deliverymonth = tradedatetextview.text.toString()
|
|
|
+ )
|
|
|
+ }
|
|
|
+ dialog.dismiss()
|
|
|
+ }
|
|
|
+ backgroundResource = R.drawable.rydz_main_red_bg
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ text = "挂牌"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.white
|
|
|
+ }.lparams(0, autoSize(84), 1f) {
|
|
|
+ marginStart = autoSize(23)
|
|
|
+ marginEnd = autoSize(23)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(120)) {
|
|
|
+ gravity = Gravity.BOTTOM
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+ }.lparams(matchParent, matchParent) {
|
|
|
+ topMargin = autoSize(120)
|
|
|
+ marginEnd = autoSize(84)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|