|
|
@@ -0,0 +1,405 @@
|
|
|
+package cn.muchinfo.rma.view.base.spot.associated.perioddocuments
|
|
|
+
|
|
|
+import android.annotation.SuppressLint
|
|
|
+import android.os.Bundle
|
|
|
+import android.view.Gravity
|
|
|
+import android.view.inputmethod.EditorInfo
|
|
|
+import android.widget.EditText
|
|
|
+import androidx.lifecycle.MutableLiveData
|
|
|
+import cn.muchinfo.rma.R
|
|
|
+import cn.muchinfo.rma.global.MTPEnums
|
|
|
+import cn.muchinfo.rma.global.data.PaTradeLinkData
|
|
|
+import cn.muchinfo.rma.global.data.SCMiddleGoodsData
|
|
|
+import cn.muchinfo.rma.global.data.WrDeliveryAvalidHoldLBData
|
|
|
+import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
+import cn.muchinfo.rma.view.autoWidget.*
|
|
|
+import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
+import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
+import cn.muchinfo.rma.view.base.hnstmain.contractorders.delivery.DeliveryViewHolder
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
+import com.blankj.utilcode.util.ToastUtils
|
|
|
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
|
|
|
+import mtp.polymer.com.autowidget.dialog.SelectData
|
|
|
+import mtp.polymer.com.autowidget.dialog.creatBottomSheetDialog
|
|
|
+import org.jetbrains.anko.*
|
|
|
+
|
|
|
+/**
|
|
|
+ * 业务关联页面
|
|
|
+ */
|
|
|
+@Suppress("DEPRECATION")
|
|
|
+class BusinessAssociationsActivity : BaseActivity<BusinessAssociationsViewModel>(){
|
|
|
+
|
|
|
+ //传入的实体数据
|
|
|
+ val data by lazy { intent.getParcelableExtra<PaTradeLinkData>("data") as PaTradeLinkData }
|
|
|
+
|
|
|
+ //选择的业务类型
|
|
|
+ val selectBusinessType : MutableLiveData<SelectData> = MutableLiveData()
|
|
|
+
|
|
|
+ //输入的现货编号
|
|
|
+ lateinit var spot_number_edittext : EditText
|
|
|
+
|
|
|
+ //输入的对手方
|
|
|
+ lateinit var counterparty_edittext : EditText
|
|
|
+
|
|
|
+ //输入的现货商品
|
|
|
+ lateinit var spot_goods_edittext : EditText
|
|
|
+
|
|
|
+ private val businessAssociationsAdapter: BaseAdapter<SCMiddleGoodsData, BusinessAssociationsViewHolder> =
|
|
|
+ BaseAdapter { _, _ ->
|
|
|
+ BusinessAssociationsViewHolder(
|
|
|
+ this,
|
|
|
+ viewModel
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressLint("SetTextI18n")
|
|
|
+ override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
+ super.onCreate(savedInstanceState)
|
|
|
+ verticalLayout {
|
|
|
+ background = resources.getDrawable(R.color.rma_hint_line_color_eee)
|
|
|
+ topBar {
|
|
|
+ commonLeftButton()
|
|
|
+ commonTitle {
|
|
|
+ text = "业务关联"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ frameLayout {
|
|
|
+ scrollView {
|
|
|
+ verticalLayout {
|
|
|
+ linearLayout {
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "账户"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_gray_color
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = data.taname + "/" + data.accountid
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ }
|
|
|
+ }.lparams(0, autoSize(95),1f)
|
|
|
+
|
|
|
+ view {
|
|
|
+ background = resources.getDrawable(R.color.rma_hint_line_color_eee)
|
|
|
+ }.lparams(autoSize(1), autoSize(95))
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "合约"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_gray_color
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = data.goodsname + "/" + data.goodscode
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ }
|
|
|
+ }.lparams(0, autoSize(95),1f)
|
|
|
+ }.lparams(matchParent, autoSize(95))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "方向"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_gray_color
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = if (data.buyorsell == "0"){"买入"}else{"卖出"}
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ }
|
|
|
+ }.lparams(0, autoSize(95),1f)
|
|
|
+
|
|
|
+ view {
|
|
|
+ background = resources.getDrawable(R.color.rma_hint_line_color_eee)
|
|
|
+ }.lparams(autoSize(1), autoSize(95))
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "期货数量"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_gray_color
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = data.tradelot + "手(" + data.tradelot?.toDouble()?.times(data.agreeunit?.toDouble() ?: 0.0) + data.enumdicname + ")"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ }
|
|
|
+ }.lparams(0, autoSize(95),1f)
|
|
|
+ }.lparams(matchParent, autoSize(95))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val selectDataList = arrayListOf(
|
|
|
+ SelectData(
|
|
|
+ id = "1",
|
|
|
+ value = "套期保值"
|
|
|
+ ),
|
|
|
+ SelectData(
|
|
|
+ id = "2",
|
|
|
+ value = "套利"
|
|
|
+ ),
|
|
|
+ SelectData(
|
|
|
+ id = "3",
|
|
|
+ value = "换月"
|
|
|
+ )
|
|
|
+ )
|
|
|
+ creatBottomSheetDialog("请选择交易类型", selectDataList) {
|
|
|
+ selectBusinessType.postValue(this)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ text = "*"
|
|
|
+ textColorInt = R.color.rma_star_color
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(37)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "业务类型"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ selectBusinessType.bindOptional(context) {
|
|
|
+ text = it?.value
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }
|
|
|
+ text = "请选择业务类型"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(80)
|
|
|
+ }
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_more
|
|
|
+ }.lparams(autoSize(36), autoSize(36)) {
|
|
|
+ marginEnd = autoSize(25)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(95))
|
|
|
+
|
|
|
+ view {
|
|
|
+ background = resources.getDrawable(R.color.rma_hint_line_color_eee)
|
|
|
+ }.lparams(matchParent, autoSize(18))
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "现货订单"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ }
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ textView {
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginEnd = autoSize(32)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(95))
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ linearLayout {
|
|
|
+ backgroundResource = R.drawable.qyfg_search_item_bg
|
|
|
+
|
|
|
+ editText {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ spot_number_edittext = this
|
|
|
+ hint = "搜索现货编号"
|
|
|
+ background = null
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_NUMBER
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(matchParent, autoSize(90))
|
|
|
+
|
|
|
+ }.lparams(0, autoSize(90),1f){
|
|
|
+ marginStart = autoSize(28)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ backgroundResource = R.drawable.qyfg_search_item_bg
|
|
|
+
|
|
|
+ editText {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ counterparty_edittext = this
|
|
|
+ hint = "搜索对手方"
|
|
|
+ background = null
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_NUMBER
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(matchParent, autoSize(90))
|
|
|
+
|
|
|
+
|
|
|
+ }.lparams(0, autoSize(90),1f){
|
|
|
+ marginStart = autoSize(28)
|
|
|
+ marginEnd = autoSize(28)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ backgroundResource = R.drawable.qyfg_search_item_bg
|
|
|
+
|
|
|
+ editText {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ spot_goods_edittext = this
|
|
|
+ hint = "搜索现货商品"
|
|
|
+ background = null
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_NUMBER
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(matchParent, autoSize(90))
|
|
|
+ }.lparams(0, autoSize(90),1f){
|
|
|
+ marginEnd = autoSize(28)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(90))
|
|
|
+
|
|
|
+ view {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ }.lparams(matchParent, autoSize(18))
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ textView {
|
|
|
+ backgroundResource = R.drawable.yrdz_item_click_bg
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ text = "查询"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_blue_color
|
|
|
+ }.lparams(matchParent, autoSize(68)){
|
|
|
+ marginStart = autoSize(28)
|
|
|
+ marginEnd = autoSize(28)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(68))
|
|
|
+
|
|
|
+ view {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ }.lparams(matchParent, autoSize(18))
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ verticalLayout {
|
|
|
+ gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "商品"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ }
|
|
|
+ }.lparams(0, autoSize(85),1f)
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ gravity = Gravity.CENTER_HORIZONTAL
|
|
|
+ textView {
|
|
|
+ text = "应套保数量/"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "已关联数量"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+ }.lparams(0, autoSize(85),1f)
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL or Gravity.RIGHT
|
|
|
+ textView {
|
|
|
+ text = "本次关联数量(期货)"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginEnd = autoSize(32)
|
|
|
+ }
|
|
|
+ }.lparams(0, autoSize(85),1f)
|
|
|
+ }.lparams(matchParent, autoSize(85))
|
|
|
+
|
|
|
+ recyclerView {
|
|
|
+ background = resources.getDrawable(R.color.segtabment_bg_color)
|
|
|
+ adapter = businessAssociationsAdapter
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+
|
|
|
+ viewModel.associationsSpotDataList.bindOptional(context) {
|
|
|
+ businessAssociationsAdapter.setNewData(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ backgroundResource = R.mipmap.rma_submit_bg
|
|
|
+ text = "确定"
|
|
|
+ textColorInt = R.color.white
|
|
|
+ textSizeAuto = 38
|
|
|
+ }.lparams(matchParent, autoSize(119)) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(144)){
|
|
|
+ gravity = Gravity.BOTTOM
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|