|
|
@@ -0,0 +1,1688 @@
|
|
|
+package cn.muchinfo.rma.view.base.hnstmain.spotwarehouse.listed
|
|
|
+
|
|
|
+import android.annotation.SuppressLint
|
|
|
+import android.content.Intent
|
|
|
+import android.graphics.Color
|
|
|
+import android.os.Build
|
|
|
+import android.os.Bundle
|
|
|
+import android.view.Gravity
|
|
|
+import android.view.View
|
|
|
+import android.view.inputmethod.EditorInfo
|
|
|
+import android.widget.CheckBox
|
|
|
+import android.widget.EditText
|
|
|
+import android.widget.SeekBar
|
|
|
+import android.widget.TextView
|
|
|
+import androidx.annotation.RequiresApi
|
|
|
+import androidx.lifecycle.MutableLiveData
|
|
|
+import cn.muchinfo.rma.R
|
|
|
+import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
+import cn.muchinfo.rma.global.MTPEnums
|
|
|
+import cn.muchinfo.rma.global.data.*
|
|
|
+import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
|
|
|
+import cn.muchinfo.rma.global.database.DataBase
|
|
|
+import cn.muchinfo.rma.global.isBlankString
|
|
|
+import cn.muchinfo.rma.global.toDoubleNoNull
|
|
|
+import cn.muchinfo.rma.global.utils.TimeUtils
|
|
|
+import cn.muchinfo.rma.global.utils.VIewUtils
|
|
|
+import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
+import cn.muchinfo.rma.protobuf.protoclasses.WarehouseTradeMI1
|
|
|
+import cn.muchinfo.rma.view.autoWidget.*
|
|
|
+import cn.muchinfo.rma.view.autoWidget.PickerView.builder.OptionsPickerBuilder
|
|
|
+import cn.muchinfo.rma.view.autoWidget.PickerView.listener.OnOptionsSelectListener
|
|
|
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
|
|
|
+import cn.muchinfo.rma.view.autoWidget.view.MangeNumberEditText2
|
|
|
+import cn.muchinfo.rma.view.autoWidget.view.MangeNumberEditText3
|
|
|
+import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
+import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
+import cn.muchinfo.rma.view.base.hnstmain.friend.SelectFriendActivty
|
|
|
+import cn.muchinfo.rma.view.base.hnstmain.friend.SelectFriendListData
|
|
|
+import cn.muchinfo.rma.view.base.hnstmain.performancetemplate.SelectPerformanceTemplateActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.viewItemUI
|
|
|
+import cn.muchinfo.rma.view.base.main.addressmanagement.AddressSelectActivity
|
|
|
+import cn.muchinfo.rma.view.base.main.castsurely.JsonBean
|
|
|
+import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
|
|
|
+import com.blankj.utilcode.util.LogUtils
|
|
|
+
|
|
|
+import com.blankj.utilcode.util.ToastUtils
|
|
|
+import mtp.polymer.com.autowidget.dialog.*
|
|
|
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
|
|
|
+import org.greenrobot.eventbus.EventBus
|
|
|
+import org.greenrobot.eventbus.Subscribe
|
|
|
+import org.greenrobot.eventbus.ThreadMode
|
|
|
+import org.jetbrains.anko.*
|
|
|
+import org.jetbrains.anko.sdk25.coroutines.textChangedListener
|
|
|
+import java.math.BigDecimal
|
|
|
+
|
|
|
+/**
|
|
|
+ * 现货仓单-挂单
|
|
|
+ */
|
|
|
+class YrdzListedActivity : BaseActivity<YrdzListedViewModel>() {
|
|
|
+
|
|
|
+ //1 现货仓单的挂 2 是预售仓单的挂
|
|
|
+ private val type by lazy {
|
|
|
+ intent.getStringExtra("type")
|
|
|
+ }
|
|
|
+
|
|
|
+ //现货仓单明细传入的实体
|
|
|
+ private val data by lazy {
|
|
|
+ intent.getParcelableExtra<HoldLBData>("data") as HoldLBData
|
|
|
+ }
|
|
|
+
|
|
|
+ //预售仓单汇总传入的实体
|
|
|
+ private val data1 by lazy {
|
|
|
+ intent.getParcelableExtra<HnstWrPositionData>("data1") as HnstWrPositionData
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 用于订阅行情的唯一标识 */
|
|
|
+ val thisTag by lazy {
|
|
|
+ "ListedActivity"
|
|
|
+ }
|
|
|
+
|
|
|
+ private var options1Items: List<JsonBean> = java.util.ArrayList<JsonBean>()
|
|
|
+ private var options2Items = java.util.ArrayList<java.util.ArrayList<String>>()
|
|
|
+
|
|
|
+ var opt1tx: JsonBean? = null
|
|
|
+ var opt2tx: JsonBean.CityBean? = null
|
|
|
+
|
|
|
+ lateinit var main_seekbar : SeekBar
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询所用的date 注意(页面显示时间规则yyyy-MM-dd,而接口请求规则yyyyMMdd,简直无fuck可说)
|
|
|
+ */
|
|
|
+ var tradedate: String = ""
|
|
|
+
|
|
|
+ //基差输入
|
|
|
+ lateinit var basisInputEdittext: MangeNumberEditText3
|
|
|
+
|
|
|
+ //初始化后基差是否被define
|
|
|
+ var isdefineByBasis: Boolean = false
|
|
|
+
|
|
|
+ //挂牌数量
|
|
|
+ lateinit var listednumberEdittext: MangeNumberEditText2
|
|
|
+
|
|
|
+ //起摘数量输入框
|
|
|
+ lateinit var startInputNumber: EditText
|
|
|
+
|
|
|
+ //挂牌金额 / 估算总额
|
|
|
+ lateinit var one_delisting_amount: TextView
|
|
|
+
|
|
|
+ //估算单价
|
|
|
+ lateinit var estimate_the_price: TextView
|
|
|
+
|
|
|
+ //交收月
|
|
|
+ lateinit var month_text: TextView
|
|
|
+
|
|
|
+ //挂牌价格输入
|
|
|
+ lateinit var onePriceInputEdittext: MangeNumberEditText2
|
|
|
+
|
|
|
+ //------------贸易圈时多余的内容-----------
|
|
|
+ //履约保证金
|
|
|
+ lateinit var performance_bond: EditText
|
|
|
+
|
|
|
+ //挂牌有效期
|
|
|
+ lateinit var validity_of_listing: TextView
|
|
|
+
|
|
|
+ //选择的履约模版数据
|
|
|
+ val selectPerformanceStepData: MutableLiveData<PermancePlanTmpData> = MutableLiveData()
|
|
|
+
|
|
|
+ //选择的朋友列表
|
|
|
+ val selectFriendList: MutableLiveData<List<WrUserFriendData>> = MutableLiveData()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 本页面选择的挂牌方式
|
|
|
+ */
|
|
|
+ var listedType: MutableLiveData<SelectData> = MutableLiveData()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 选择的行情商品
|
|
|
+ */
|
|
|
+ var selectGoodsInfo: MutableLiveData<SelectData> = MutableLiveData()
|
|
|
+
|
|
|
+
|
|
|
+ fun initData() {
|
|
|
+ listedType.postValue(SelectData(id = "1", value = "一口价"))
|
|
|
+ viewModel.initSelectGoodsInfo()
|
|
|
+ }
|
|
|
+
|
|
|
+ var marginValue: MutableLiveData<Double> = MutableLiveData()//履约保证金比例
|
|
|
+
|
|
|
+ //浮动价挂牌金额
|
|
|
+ val listed_price: MutableLiveData<Double> = MutableLiveData()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是否可议价的选择
|
|
|
+ */
|
|
|
+ lateinit var can_be_negotiation: CheckBox
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是否整单
|
|
|
+ */
|
|
|
+ lateinit var whole_list: CheckBox
|
|
|
+
|
|
|
+ val whole_list_data: MutableLiveData<Boolean> =
|
|
|
+ MutableLiveData<Boolean>().apply { value = false }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 朋友是否不限
|
|
|
+ */
|
|
|
+ lateinit var no_friend: CheckBox
|
|
|
+
|
|
|
+ //初始化设置履约保证金比例
|
|
|
+ fun setMarginValue() {
|
|
|
+ viewModel.queryMarketRun()
|
|
|
+ if (type == "1") {//现货仓单
|
|
|
+ marginValue.value =
|
|
|
+ GlobalDataCollection.instance?.marketTradeConfigData?.sellmarginvalue?.toDoubleNoNull()
|
|
|
+ ?: 0.0
|
|
|
+ } else {
|
|
|
+ marginValue.value =
|
|
|
+ GlobalDataCollection.instance?.marketTradeConfigData?.sellmarginvalue2?.toDoubleNoNull()
|
|
|
+ ?: 0.0
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //行情推送通知
|
|
|
+ @Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
+ fun onQuoteMessageEvent(quoteMessageEvent: QuoteMessageEvent) {
|
|
|
+ val goodsids = quoteMessageEvent.goodsid
|
|
|
+ //如果推送的goodsid包含当前页面的goodsid,则进行页面刷新
|
|
|
+ if (selectGoodsInfo.value?.id.isNullOrEmpty().not()) {
|
|
|
+ if (goodsids.contains(selectGoodsInfo.value?.id?.toInt())) {
|
|
|
+ LogUtils.eTag("BusinessHallActivity", "行情推送" + selectGoodsInfo.value?.id)
|
|
|
+ val quote =
|
|
|
+ GlobalDataCollection.instance?.goodsInfoAndQuotesList?.find { selectGoodsInfo.value?.value == it.outgoodscode }?.quoteDayData
|
|
|
+ if (quote != null) {
|
|
|
+ //赋值盘面信息
|
|
|
+ viewModel.quoteDayData.postValue(quote)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onDestroy() {
|
|
|
+ super.onDestroy()
|
|
|
+ viewModel.removeSubscriptQuote(thisTag)
|
|
|
+ EventBus.getDefault().unregister(this)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data)
|
|
|
+ if (requestCode == 1004 && resultCode == 1005) {
|
|
|
+ val permancePlanTmpData =
|
|
|
+ data?.getParcelableExtra<PermancePlanTmpData>("data") as PermancePlanTmpData
|
|
|
+ selectPerformanceStepData.postValue(permancePlanTmpData)
|
|
|
+ } else if (requestCode == 1000 && resultCode == 1001) {
|
|
|
+ val selectFriendDataList =
|
|
|
+ data?.getParcelableExtra<SelectFriendListData>("datalist") as SelectFriendListData
|
|
|
+ selectFriendList.postValue(selectFriendDataList.selectFriendList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressLint("SetTextI18n")
|
|
|
+ @RequiresApi(Build.VERSION_CODES.O)
|
|
|
+ override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
+ super.onCreate(savedInstanceState)
|
|
|
+ EventBus.getDefault().register(this)
|
|
|
+ verticalLayout {
|
|
|
+ createLoadingDialog(hintStr = "").bindTaskStatus(context, viewModel.loadingDialogStatus)
|
|
|
+ setMarginValue()
|
|
|
+ viewModel.resetAccountData()
|
|
|
+ initData()
|
|
|
+ viewModel.quoteDayData.bindOptional(context) {
|
|
|
+ //行情下发计算挂牌金额 = (基差价格+期货合约价)* 挂牌数量
|
|
|
+ if (isdefineByBasis && basisInputEdittext.text.toString().isNullOrEmpty()
|
|
|
+ .not() && basisInputEdittext.text.toString() != "-"
|
|
|
+ ) {//初始化相应控件后才能取值计算
|
|
|
+ listed_price.postValue(
|
|
|
+ basisInputEdittext.text.toString().toDouble().plus(it?.getPrice() ?: 0.0)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ topBar {
|
|
|
+ commonLeftButton()
|
|
|
+ commonTitle {
|
|
|
+ text = "挂牌"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ frameLayout {
|
|
|
+ scrollView {
|
|
|
+ verticalLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "品 种"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ if (type == "1") {
|
|
|
+ text = data.deliverygoodsname
|
|
|
+ } else {
|
|
|
+ text = data1.deliverygoodsname
|
|
|
+ }
|
|
|
+
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(132))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "商 品"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ if (type == "1") {
|
|
|
+ text = data.wrtypename
|
|
|
+ } else {
|
|
|
+ text = data1.wrtypename
|
|
|
+ }
|
|
|
+
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(132))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "仓 库"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ if (type == "1") {
|
|
|
+ text = data.warehousename
|
|
|
+ } else {
|
|
|
+ text = data1.warehousename
|
|
|
+ }
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(132))
|
|
|
+
|
|
|
+ viewItemUI()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val selectDataList = arrayListOf(
|
|
|
+ SelectData(
|
|
|
+ id = "1",
|
|
|
+ value = "一口价"
|
|
|
+ ),
|
|
|
+ SelectData(
|
|
|
+ id = "2",
|
|
|
+ value = "浮动价"
|
|
|
+ ),
|
|
|
+ SelectData(
|
|
|
+ id = "3",
|
|
|
+ value = "贸易圈"
|
|
|
+ )
|
|
|
+ )
|
|
|
+ creatBottomSheetDialog("请选择挂牌方式", selectDataList) {
|
|
|
+ listedType.postValue(this)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "挂牌方式"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ text = it?.value
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }
|
|
|
+ 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(132))
|
|
|
+
|
|
|
+ viewItemUI()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "2") {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val pvOptions = OptionsPickerBuilder(
|
|
|
+ context,
|
|
|
+ OnOptionsSelectListener { options1, options2, options3, v ->
|
|
|
+ opt2tx =
|
|
|
+ if (options2Items.size > 0 && options2Items.get(options1).size > 0)
|
|
|
+ options1Items.get(options1).cityList.get(options2)
|
|
|
+ else
|
|
|
+ JsonBean.CityBean()
|
|
|
+ selectGoodsInfo.postValue(
|
|
|
+ SelectData(
|
|
|
+ id = opt2tx?.autoId ?: "",
|
|
|
+ value = opt2tx?.code ?: ""
|
|
|
+ )
|
|
|
+ )
|
|
|
+ })
|
|
|
+ .setTitleText("行情商品")
|
|
|
+ .setDividerColor(Color.BLACK)
|
|
|
+ .setTextColorCenter(Color.BLACK) //设置选中项文字颜色
|
|
|
+ .setContentTextSize(20)
|
|
|
+ .build<Any>()
|
|
|
+
|
|
|
+ options1Items = viewModel.firstSelectData.value!!
|
|
|
+ options2Items =
|
|
|
+ viewModel.secondSelectData.value!! as ArrayList<ArrayList<String>>
|
|
|
+ pvOptions.setPicker(
|
|
|
+ viewModel.firstSelectData.value,
|
|
|
+ viewModel.secondSelectData.value
|
|
|
+ )
|
|
|
+ pvOptions.show()
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ text = "行情商品"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ selectGoodsInfo.bindOptional(context) {
|
|
|
+ viewModel.removeSubscriptQuote(thisTag)
|
|
|
+ viewModel.queryQuoteDay(
|
|
|
+ tag = thisTag,
|
|
|
+ goodsCodes = it?.value ?: "",
|
|
|
+ isShowLoading = false
|
|
|
+ )
|
|
|
+ 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(132))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "1" || it?.id == "3") {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "挂牌价格"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ numberEditText {
|
|
|
+ onePriceInputEdittext = this
|
|
|
+ text = "0"
|
|
|
+ decimal = 2
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ if (value.toString().isNullOrEmpty().not()) {
|
|
|
+ val delistingAmount = value.toDouble().times(
|
|
|
+ listednumberEdittext.text.toString()
|
|
|
+ .toDouble()
|
|
|
+ )
|
|
|
+ one_delisting_amount.text =
|
|
|
+ NumberUtils.roundNum(
|
|
|
+ delistingAmount,
|
|
|
+ 2
|
|
|
+ ) + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ delistingAmount.times(
|
|
|
+ marginValue.value ?: 0.0
|
|
|
+ ), 2
|
|
|
+ ) + ")"
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ setTextColor(R.color.buy_hall_color)
|
|
|
+ }.lparams(0, autoSize(72), 1f) {
|
|
|
+ marginEnd = autoSize(110)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "3") {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ checkBox {
|
|
|
+ can_be_negotiation = this
|
|
|
+ buttonDrawable = null
|
|
|
+ background =
|
|
|
+ resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
|
+
|
|
|
+ }.lparams(autoSize(41), autoSize(41)) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "可议价"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_zhushi_text_color
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(wrapContent, autoSize(143))
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "2") {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "基 差"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ numberEditText3 {
|
|
|
+ viewModel.quoteDayData.bindOptional(context) {
|
|
|
+ val MarketTradeConfig = GlobalDataCollection.instance?.marketTradeConfigData
|
|
|
+ max =
|
|
|
+ it?.preclose?.times(MarketTradeConfig?.basisupratio?.toDouble() ?: 0.0)
|
|
|
+ ?: 0.0
|
|
|
+ min = it?.preclose?.times(-1.0)
|
|
|
+ ?.times(MarketTradeConfig?.basisdownratio?.toDouble() ?: 0.0) ?: 0.0
|
|
|
+ }
|
|
|
+
|
|
|
+ basisInputEdittext = this
|
|
|
+ text = "0"
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+ if (type == "1") {
|
|
|
+ estimate_the_price.text = data.enableqty
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ if (value.isNotEmpty()) {
|
|
|
+ //行情下发计算挂牌金额 = (基差价格+期货合约价)* 挂牌数量
|
|
|
+ listed_price.postValue(
|
|
|
+ value.toString().toDouble().plus(
|
|
|
+ viewModel.quoteDayData.value?.getPrice() ?: 0.0
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(0, autoSize(72), 1f) {
|
|
|
+ marginEnd = autoSize(110)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ verticalLayout {
|
|
|
+ textView {
|
|
|
+ text = "挂牌数量"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ topMargin = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(autoSize(250), autoSize(290))
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ numberEditText {
|
|
|
+ listednumberEdittext = this
|
|
|
+ if (type == "1") {
|
|
|
+ changeValue = data.minivalue?.toDouble() ?: 1.0
|
|
|
+ text = data.minivalue
|
|
|
+ } else {
|
|
|
+ changeValue = data1.minivalue?.toDouble() ?: 1.0
|
|
|
+ text = data1.minivalue
|
|
|
+ }
|
|
|
+
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+
|
|
|
+ if (type == "1") {
|
|
|
+// main_seekbar.progress = value.toString().toDouble().div(data.enableqty?.toDouble() ?: 1.0).toInt()
|
|
|
+ main_seekbar.progress = value.toString().toDouble().div(data.enableqty?.toDouble() ?: 1.0).times(100).toInt()
|
|
|
+ } else {
|
|
|
+ main_seekbar.progress = value.toString().toDouble().div(data1.creditenableqty?.toDouble() ?: 1.0).times(100).toInt()
|
|
|
+ }
|
|
|
+
|
|
|
+ if (listedType.value?.id == "1" || listedType.value?.id == "3") {//一口价
|
|
|
+ val delistingAmount = value.toDouble().times(
|
|
|
+ onePriceInputEdittext.text.toString()
|
|
|
+ .toDouble()
|
|
|
+ )
|
|
|
+ one_delisting_amount.text =
|
|
|
+ NumberUtils.roundNum(
|
|
|
+ delistingAmount,
|
|
|
+ 2
|
|
|
+ ) + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ delistingAmount.times(
|
|
|
+ marginValue.value ?: 0.0
|
|
|
+ ), 2
|
|
|
+ ) + ")"
|
|
|
+ } else if (listedType.value?.id == "2") {//浮动价 //计算估算总额
|
|
|
+ val floatDelistingAmount =
|
|
|
+ listed_price.value?.times(
|
|
|
+ value.toString().toDouble()
|
|
|
+ )
|
|
|
+ if (floatDelistingAmount != 0.0) {
|
|
|
+ //显示估算总额
|
|
|
+ if (marginValue.value == 0.0) {
|
|
|
+ one_delisting_amount.text =
|
|
|
+ NumberUtils.roundNum(
|
|
|
+ floatDelistingAmount ?: 0.0,
|
|
|
+ 2
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ one_delisting_amount.text =
|
|
|
+ NumberUtils.roundNum(
|
|
|
+ floatDelistingAmount ?: 0.0,
|
|
|
+ 2
|
|
|
+ ) + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ floatDelistingAmount?.times(
|
|
|
+ marginValue.value ?: 0.0
|
|
|
+ ) ?: 0.0,
|
|
|
+ 2
|
|
|
+ ) + ")"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ setTextColor(R.color.buy_hall_color)
|
|
|
+ }.lparams(0, autoSize(72), 1f) {
|
|
|
+ marginEnd = autoSize(72)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = data.enumdicname
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "3") {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ checkBox {
|
|
|
+ whole_list = this
|
|
|
+ buttonDrawable = null
|
|
|
+ background =
|
|
|
+ resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
|
+ setOnCheckedChangeListener { compoundButton, b ->
|
|
|
+ whole_list_data.postValue(b)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(41), autoSize(41)) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "整单"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_zhushi_text_color
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(wrapContent, autoSize(143))
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ inflateLayout<SeekBar>(R.layout.main_seekbar) {
|
|
|
+ main_seekbar = this
|
|
|
+
|
|
|
+ min = 10
|
|
|
+ max = 100
|
|
|
+ isIndeterminate = false
|
|
|
+ splitTrack = false
|
|
|
+ setPadding(autoSize(30), 0, autoSize(30), 0)
|
|
|
+ thumb = resources.getDrawable(R.mipmap.hnst_seekbar)
|
|
|
+ progressDrawable = resources.getDrawable(R.drawable.seekbar_bg)
|
|
|
+ setOnSeekBarChangeListener(object :
|
|
|
+ SeekBar.OnSeekBarChangeListener {
|
|
|
+ override fun onProgressChanged(
|
|
|
+ p0: SeekBar?,
|
|
|
+ p1: Int,
|
|
|
+ p2: Boolean
|
|
|
+ ) {
|
|
|
+ if (type == "1") {
|
|
|
+ listednumberEdittext.text = NumberUtils.roundNum(
|
|
|
+ data.enableqty?.toDouble()?.times(p1.div(100.0))
|
|
|
+ ?.toString(), 0
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ listednumberEdittext.text = NumberUtils.roundNum(
|
|
|
+ data1.credittotalqty?.toDouble()
|
|
|
+ ?.times(p1.div(100.0))?.toString(), 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onStartTrackingTouch(p0: SeekBar?) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onStopTrackingTouch(p0: SeekBar?) {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }.lparams(matchParent, autoSize(46)) {
|
|
|
+ marginEnd = autoSize(110)
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "0"
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_gray_color
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ textView {
|
|
|
+ if (type == "1") {
|
|
|
+ text = data.enableqty + data.enumdicname
|
|
|
+ } else {
|
|
|
+ text = data1.creditenableqty + data1.enumdicname
|
|
|
+ }
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_gray_color
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+ }.lparams(matchParent, wrapContent) {
|
|
|
+ marginEnd = autoSize(110)
|
|
|
+ topMargin = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(290))
|
|
|
+ }.lparams(matchParent, autoSize(290))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ whole_list_data.bindOptional(context) {
|
|
|
+ if (it == true) {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "起摘数量"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ linearLayout {
|
|
|
+ editText {
|
|
|
+ startInputNumber = this
|
|
|
+ hint = "请输入起摘数量"
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_NUMBER
|
|
|
+// setDecimalInputType()
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(0, autoSize(132), 1f)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = data.enumdicname
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
+ textView {
|
|
|
+ if (type == "1") {
|
|
|
+ text = "最小单位" + data.minivalue + data.enumdicname
|
|
|
+ } else {
|
|
|
+ text = "最小单位" + data1.minivalue + data1.enumdicname
|
|
|
+ }
|
|
|
+
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(167))
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(167))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "3") {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "履约保证金"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ editText {
|
|
|
+ performance_bond = this
|
|
|
+ textChangedListener {
|
|
|
+ afterTextChanged {
|
|
|
+ if (it.toString().isNotEmpty()) {
|
|
|
+ marginValue.postValue(
|
|
|
+ it?.toString()?.toDouble()?.div(100.0)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ hint = "请输入履约保证金"
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_NUMBER
|
|
|
+ setDecimalInputType(maxValue = BigDecimal("100.00"))
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(0, autoSize(143), 1f)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "%"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "3") {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ onThrottleFirstClick {
|
|
|
+ showDataSelectDialog(type = "1") {
|
|
|
+ validity_of_listing.text = this
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "挂牌有效期"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(autoSize(214), wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ viewModel.marketRunData.bindOptional(context) {
|
|
|
+ text = it?.tradedate
|
|
|
+ }
|
|
|
+ validity_of_listing = this
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_search_by_time
|
|
|
+ }.lparams(autoSize(38), autoSize(38)) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ viewItemUI()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "3") {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val intent = Intent()
|
|
|
+ intent.setClass(
|
|
|
+ context,
|
|
|
+ SelectPerformanceTemplateActivity::class.java
|
|
|
+ )
|
|
|
+ startActivityForResult(intent, 1004)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "履约方式"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ selectPerformanceStepData.bindOptional(context) {
|
|
|
+ text = it?.templatename
|
|
|
+ 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(132))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "3") {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (no_friend.isChecked.not()) {
|
|
|
+ val intent = Intent()
|
|
|
+ intent.setClass(context, SelectFriendActivty::class.java)
|
|
|
+ startActivityForResult(intent, 1000)
|
|
|
+ } else {
|
|
|
+ ToastUtils.showLong("勾选不限后不能选择朋友")
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "指定朋友"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ selectFriendList.bindOptional(context) {
|
|
|
+ if (no_friend.isChecked) {
|
|
|
+ text = "不限"
|
|
|
+ } else {
|
|
|
+ text = "已选" + it?.size + "人"
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ checkBox {
|
|
|
+ no_friend = this
|
|
|
+ buttonDrawable = null
|
|
|
+ background =
|
|
|
+ resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
|
+ setOnCheckedChangeListener { compoundButton, b ->
|
|
|
+ if (b) {
|
|
|
+ selectFriendList.postValue(arrayListOf())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(41), autoSize(41)) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "不限"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_zhushi_text_color
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(wrapContent, autoSize(132))
|
|
|
+ }.lparams(matchParent, autoSize(132))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ if (type == "2") {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ onThrottleFirstClick {
|
|
|
+ showDataSelectDialog(type = "2") {
|
|
|
+ month_text.text = this
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "交收月"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(autoSize(214), wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = TimeUtils.getNowTime("yyyy-MM")
|
|
|
+ month_text = this
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_search_by_time
|
|
|
+ }.lparams(autoSize(38), autoSize(38)) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "1" || it?.id == "3") {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "估算价"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(autoSize(214), wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "--"
|
|
|
+ listed_price.bindOptional(context) {
|
|
|
+ text = NumberUtils.roundNum(it ?: 0.0, 2)
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()
|
|
|
+ .not() && listednumberEdittext.text.toString()
|
|
|
+ .isNullOrEmpty().not()
|
|
|
+ ) {
|
|
|
+ val delistingAmount =
|
|
|
+ it?.times(
|
|
|
+ listednumberEdittext.text.toString()
|
|
|
+ .toDouble()
|
|
|
+ )
|
|
|
+ one_delisting_amount.text =
|
|
|
+ NumberUtils.roundNum(
|
|
|
+ delistingAmount ?: 0.0,
|
|
|
+ 2
|
|
|
+ ) + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ delistingAmount?.times(
|
|
|
+ marginValue.value ?: 0.0
|
|
|
+ ) ?: 0.0, 2
|
|
|
+ ) + ")"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ estimate_the_price = this
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ listedType.bindOptional(context) {
|
|
|
+ if (it?.id == "1" || it?.id == "3") {
|
|
|
+ text = "挂牌金额"
|
|
|
+ } else {
|
|
|
+ text = "估算总额"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(autoSize(214), wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ marginValue.bindOptional(context) {
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()
|
|
|
+ .not() && listednumberEdittext.text.toString()
|
|
|
+ .isNullOrEmpty().not()
|
|
|
+ ) {
|
|
|
+ val delistingAmount =
|
|
|
+ onePriceInputEdittext.text.toString().toDouble().times(
|
|
|
+ listednumberEdittext.text.toString()
|
|
|
+ .toDouble()
|
|
|
+ )
|
|
|
+ one_delisting_amount.text =
|
|
|
+ NumberUtils.roundNum(
|
|
|
+ delistingAmount,
|
|
|
+ 2
|
|
|
+ ) + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ delistingAmount.times(
|
|
|
+ it ?: 0.0
|
|
|
+ ), 2
|
|
|
+ ) + ")"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ text = "0"
|
|
|
+ one_delisting_amount = this
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ textView {
|
|
|
+ viewModel.usedAccountData.bindOptional(context) {
|
|
|
+ text =
|
|
|
+ "可用资金" + NumberUtils.roundNum(it?.canUserAmount.toString(), 2)
|
|
|
+ }
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ marginStart = autoSize(250)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ view {
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(200))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (check().not()) {
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (type == "1") {//现货仓单挂单
|
|
|
+ if (listedType.value?.id == "1") {//一口价
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
|
|
|
+ LadingBillId = data.ladingbillid?.toLong() ?: 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ SubNum = data.subnum?.toLong() ?: 0,
|
|
|
+ WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 0,
|
|
|
+ UserID = GlobalDataCollection.instance?.loginRsp?.userID
|
|
|
+ ?: 0,
|
|
|
+ AccountID = GlobalDataCollection.instance?.accountId ?: 0,
|
|
|
+ IsSpecified = 0,
|
|
|
+ OrderQty = listednumberEdittext.text.toString().toLong(),
|
|
|
+ DeliveryGoodsID = data.deliverygoodsid?.toInt() ?: 0,
|
|
|
+ WRPriceType = 1,
|
|
|
+ FixedPrice = onePriceInputEdittext.text.toString()
|
|
|
+ .toDouble(),
|
|
|
+ WRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder()
|
|
|
+ .build(),
|
|
|
+ TimevalidType = 4,
|
|
|
+ FirstRatio = 0.0,
|
|
|
+ PerformanceTemplateID = 0,
|
|
|
+ BuyOrSell = 1,
|
|
|
+ PriceDisplayMode = 1,
|
|
|
+ CanBargain = 0,
|
|
|
+ ApplyID = 0,
|
|
|
+ CanPart = 1,
|
|
|
+ HasWr = 1,
|
|
|
+ DelistMinQty = startInputNumber.text.toString().toLong(),
|
|
|
+ WRStandardID = data.wrstandardid?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ } else if (listedType.value?.id == "2") {//浮动价
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
|
|
|
+ LadingBillId = data.ladingbillid?.toLong() ?: 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ SubNum = data.subnum?.toLong() ?: 0,
|
|
|
+ WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 0,
|
|
|
+ UserID = GlobalDataCollection.instance?.loginRsp?.userID
|
|
|
+ ?: 0,
|
|
|
+ AccountID = GlobalDataCollection.instance?.accountId ?: 0,
|
|
|
+ IsSpecified = 0,
|
|
|
+ OrderQty = listednumberEdittext.text.toString().toLong(),
|
|
|
+ DeliveryGoodsID = data.deliverygoodsid?.toInt() ?: 0,
|
|
|
+ WRPriceType = 2,
|
|
|
+ WRTradeGoods = getWRTradeGoods(),
|
|
|
+ PriceFactor = 1.0,
|
|
|
+ PriceMove = basisInputEdittext.text.toString().toDouble(),
|
|
|
+ TimevalidType = 4,
|
|
|
+ FirstRatio = 0.0,
|
|
|
+ PerformanceTemplateID = 0,
|
|
|
+ BuyOrSell = 1,
|
|
|
+ PriceDisplayMode = 1,
|
|
|
+ CanBargain = 0,
|
|
|
+ ApplyID = 0,
|
|
|
+ CanPart = 1,
|
|
|
+ HasWr = 1,
|
|
|
+ DelistMinQty = startInputNumber.text.toString().toLong(),
|
|
|
+ WRStandardID = data.wrstandardid?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ } else if (listedType.value?.id == "3"){//贸易圈
|
|
|
+ var canBargain = 0
|
|
|
+ if (can_be_negotiation.isChecked) {
|
|
|
+ canBargain = 1
|
|
|
+ } else {
|
|
|
+ canBargain = 0
|
|
|
+ }
|
|
|
+ var canPart = 1
|
|
|
+ var the_pick: Long = 0
|
|
|
+ if (whole_list.isChecked) {
|
|
|
+ canPart = 0
|
|
|
+ } else {
|
|
|
+ the_pick = startInputNumber.text.toString().toLong()
|
|
|
+ canPart = 1
|
|
|
+ }
|
|
|
+ var allFriendsFlag = 0
|
|
|
+ if (no_friend.isChecked) {
|
|
|
+ allFriendsFlag = 1
|
|
|
+ } else {
|
|
|
+ allFriendsFlag = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ ValidTime = validity_of_listing.text.toString()
|
|
|
+ .removeSuffix("-"),
|
|
|
+ MarginFlag = 1,//挂牌是否指定保证金 0:否 1:是
|
|
|
+ MarginAlgorithm = 1,//指定保证金方式 1:比率 2:固定
|
|
|
+ MarginValue = performance_bond.text.toString().toDouble()
|
|
|
+ .div(100),//指定保证金设置值
|
|
|
+ AllFriendsFlag = allFriendsFlag,
|
|
|
+ MatchAccIDsString = getSelectFriendList(),
|
|
|
+ FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
|
|
|
+ LadingBillId = data.ladingbillid?.toLong() ?: 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ SubNum = data.subnum?.toLong() ?: 0,
|
|
|
+ WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 0,
|
|
|
+ UserID = GlobalDataCollection.instance?.loginRsp?.userID
|
|
|
+ ?: 0,
|
|
|
+ AccountID = GlobalDataCollection.instance?.accountId ?: 0,
|
|
|
+ IsSpecified = 1,
|
|
|
+ OrderQty = listednumberEdittext.text.toString().toLong(),
|
|
|
+ DeliveryGoodsID = data.deliverygoodsid?.toInt() ?: 0,
|
|
|
+ WRPriceType = 1,
|
|
|
+ FixedPrice = onePriceInputEdittext.text.toString()
|
|
|
+ .toDouble(),
|
|
|
+ WRTradeGoods = getWRTradeGoods(),
|
|
|
+ TimevalidType = 3,
|
|
|
+ FirstRatio = 0.0,
|
|
|
+ PerformanceTemplateID = selectPerformanceStepData.value?.autoid?.toLong()
|
|
|
+ ?: 0,
|
|
|
+ BuyOrSell = 1,
|
|
|
+ PriceDisplayMode = 1,
|
|
|
+ CanBargain = canBargain,
|
|
|
+ ApplyID = 0,
|
|
|
+ CanPart = canPart,
|
|
|
+ HasWr = 1,
|
|
|
+ DelistMinQty = the_pick,
|
|
|
+ WRStandardID = data.wrstandardid?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {//预售仓单挂单
|
|
|
+ if (listedType.value?.id == "1") {//一口价
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
|
|
|
+ LadingBillId = 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ SubNum = 0,
|
|
|
+ WRFactorTypeId = data1.wrfactortypeid?.toLong() ?: 0,
|
|
|
+ UserID = GlobalDataCollection.instance?.loginRsp?.userID
|
|
|
+ ?: 0,
|
|
|
+ AccountID = GlobalDataCollection.instance?.accountId ?: 0,
|
|
|
+ IsSpecified = 0,
|
|
|
+ OrderQty = listednumberEdittext.text.toString().toLong(),
|
|
|
+ DeliveryGoodsID = data1.deliverygoodsid?.toInt() ?: 0,
|
|
|
+ WRPriceType = 1,
|
|
|
+ FixedPrice = onePriceInputEdittext.text.toString()
|
|
|
+ .toDouble(),
|
|
|
+ WRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder()
|
|
|
+ .build(),
|
|
|
+ TimevalidType = 4,
|
|
|
+ FirstRatio = 0.0,
|
|
|
+ DeliveryMonth = month_text.text.toString(),
|
|
|
+ PerformanceTemplateID = 0,
|
|
|
+ BuyOrSell = 1,
|
|
|
+ PriceDisplayMode = 1,
|
|
|
+ CanBargain = 0,
|
|
|
+ ApplyID = 0,
|
|
|
+ CanPart = 1,
|
|
|
+ HasWr = 0,
|
|
|
+ DelistMinQty = startInputNumber.text.toString().toLong(),
|
|
|
+ WRStandardID = data1.wrstandardid?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ } else if (listedType.value?.id == "2") {//浮动价
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
|
|
|
+ LadingBillId = 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ SubNum = 0,
|
|
|
+ WRFactorTypeId = data1.wrfactortypeid?.toLong() ?: 0,
|
|
|
+ UserID = GlobalDataCollection.instance?.loginRsp?.userID
|
|
|
+ ?: 0,
|
|
|
+ AccountID = GlobalDataCollection.instance?.accountId ?: 0,
|
|
|
+ IsSpecified = 0,
|
|
|
+ OrderQty = listednumberEdittext.text.toString().toLong(),
|
|
|
+ DeliveryGoodsID = data1.deliverygoodsid?.toInt() ?: 0,
|
|
|
+ WRPriceType = 2,
|
|
|
+ WRTradeGoods = getWRTradeGoods(),
|
|
|
+ PriceFactor = 1.0,
|
|
|
+ PriceMove = basisInputEdittext.text.toString().toDouble(),
|
|
|
+ TimevalidType = 4,
|
|
|
+ FirstRatio = 0.0,
|
|
|
+ PerformanceTemplateID = 0,
|
|
|
+ DeliveryMonth = month_text.text.toString(),
|
|
|
+ BuyOrSell = 1,
|
|
|
+ PriceDisplayMode = 1,
|
|
|
+ CanBargain = 0,
|
|
|
+ ApplyID = 0,
|
|
|
+ CanPart = 1,
|
|
|
+ HasWr = 0,
|
|
|
+ DelistMinQty = startInputNumber.text.toString().toLong(),
|
|
|
+ WRStandardID = data1.wrstandardid?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ } else if (listedType.value?.id == "3") {//贸易圈
|
|
|
+ var canBargain = 0
|
|
|
+ if (can_be_negotiation.isChecked) {
|
|
|
+ canBargain = 1
|
|
|
+ } else {
|
|
|
+ canBargain = 0
|
|
|
+ }
|
|
|
+ var canPart = 1
|
|
|
+ var the_pick: Long = 0
|
|
|
+ if (whole_list.isChecked) {
|
|
|
+ canPart = 0
|
|
|
+ } else {
|
|
|
+ the_pick = startInputNumber.text.toString().toLong()
|
|
|
+ canPart = 1
|
|
|
+ }
|
|
|
+ var allFriendsFlag = 0
|
|
|
+ if (no_friend.isChecked) {
|
|
|
+ allFriendsFlag = 1
|
|
|
+ } else {
|
|
|
+ allFriendsFlag = 0
|
|
|
+ }
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ ValidTime = validity_of_listing.text.toString()
|
|
|
+ .removeSuffix("-"),
|
|
|
+ MarginFlag = 1,//挂牌是否指定保证金 0:否 1:是
|
|
|
+ MarginAlgorithm = 1,//指定保证金方式 1:比率 2:固定
|
|
|
+ MarginValue = performance_bond.text.toString().toDouble()
|
|
|
+ .div(100),//指定保证金设置值
|
|
|
+ AllFriendsFlag = allFriendsFlag,
|
|
|
+ MatchAccIDsString = getSelectFriendList(),
|
|
|
+ FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
|
|
|
+ LadingBillId = 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ SubNum = 0,
|
|
|
+ WRFactorTypeId = data1.wrfactortypeid?.toLong() ?: 0,
|
|
|
+ UserID = GlobalDataCollection.instance?.loginRsp?.userID
|
|
|
+ ?: 0,
|
|
|
+ AccountID = GlobalDataCollection.instance?.accountId ?: 0,
|
|
|
+ IsSpecified = 1,
|
|
|
+ OrderQty = listednumberEdittext.text.toString().toLong(),
|
|
|
+ DeliveryGoodsID = data1.deliverygoodsid?.toInt() ?: 0,
|
|
|
+ WRPriceType = 1,
|
|
|
+ WRTradeGoods = getWRTradeGoods(),
|
|
|
+ FixedPrice = onePriceInputEdittext.text.toString()
|
|
|
+ .toDouble(),
|
|
|
+ TimevalidType = 3,
|
|
|
+ FirstRatio = 0.0,
|
|
|
+ PerformanceTemplateID = selectPerformanceStepData.value?.autoid?.toLong()
|
|
|
+ ?: 0,
|
|
|
+ DeliveryMonth = month_text.text.toString(),
|
|
|
+ BuyOrSell = 1,
|
|
|
+ PriceDisplayMode = 1,
|
|
|
+ CanBargain = canBargain,
|
|
|
+ ApplyID = 0,
|
|
|
+ CanPart = canPart,
|
|
|
+ HasWr = 0,
|
|
|
+ DelistMinQty = the_pick,
|
|
|
+ WRStandardID = data1.wrstandardid?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ backgroundResource = R.mipmap.rma_submit_bg
|
|
|
+ text = "卖出"
|
|
|
+ textSizeAuto = 38
|
|
|
+ textColorInt = R.color.white
|
|
|
+ }.lparams(0, autoSize(119), 1f) {
|
|
|
+ marginStart = autoSize(59)
|
|
|
+ marginEnd = autoSize(59)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(144)) {
|
|
|
+ gravity = Gravity.BOTTOM
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ fun getSelectFriendList(): List<String> {
|
|
|
+ val returnList = arrayListOf<String>()
|
|
|
+ selectFriendList.value?.forEach {
|
|
|
+ returnList.add(it.frienduserid?.toString() ?: "")
|
|
|
+ }
|
|
|
+ return returnList
|
|
|
+ }
|
|
|
+
|
|
|
+ fun getWRTradeGoods(): WarehouseTradeMI1.WRGoodsInfo {
|
|
|
+ val wRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder()
|
|
|
+ wRTradeGoods.setGoodsID(selectGoodsInfo.value?.id?.toInt() ?: 0)
|
|
|
+ wRTradeGoods.setGoodsCode(selectGoodsInfo.value?.value ?: "")
|
|
|
+ wRTradeGoods.setPriceFactor(1.0)
|
|
|
+ wRTradeGoods.setPriceMove(1.0)
|
|
|
+ wRTradeGoods.setWeightRatio(1.0)
|
|
|
+ return wRTradeGoods.build()
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 提交数据前的校验
|
|
|
+ */
|
|
|
+ fun check(): Boolean {
|
|
|
+ if (listedType.value?.id == "1") {//一口价校验
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入挂牌价格")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (onePriceInputEdittext.text.toString() == "0" || onePriceInputEdittext.text.toString() == "0.0" || onePriceInputEdittext.text.toString() == "0.00") {
|
|
|
+ ToastUtils.showLong("挂牌价格不能为0")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (listednumberEdittext.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入挂牌数量")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (listednumberEdittext.text.toString() == "0" || listednumberEdittext.text.toString() == "0.0" || listednumberEdittext.text.toString() == "0.00") {
|
|
|
+ ToastUtils.showLong("挂牌数量不能为0")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (startInputNumber.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入起摘数量")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (type == "2") {
|
|
|
+ if (startInputNumber.text.toString().toLong() < data1.minivalue?.toLong() ?: 0) {
|
|
|
+ ToastUtils.showLong("起摘数量不能小于" + data1.minivalue)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (startInputNumber.text.toString().toLong() < data.minivalue?.toLong() ?: 0) {
|
|
|
+ ToastUtils.showLong("起摘数量不能小于" + data.minivalue)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (type == "2") {
|
|
|
+ if (month_text.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择交收月")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (listedType.value?.id == "2") {//浮动价校验
|
|
|
+ if (selectGoodsInfo.value?.value.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择行情商品")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (basisInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入基差")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (listednumberEdittext.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入挂牌数量")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (listednumberEdittext.text.toString() == "0" || listednumberEdittext.text.toString() == "0.0" || listednumberEdittext.text.toString() == "0.00") {
|
|
|
+ ToastUtils.showLong("挂牌数量不能为0")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (startInputNumber.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入起摘数量")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (type == "2") {
|
|
|
+ if (startInputNumber.text.toString().toLong() < data1.minivalue?.toLong() ?: 0) {
|
|
|
+ ToastUtils.showLong("起摘数量不能小于" + data1.minivalue)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (startInputNumber.text.toString().toLong() < data.minivalue?.toLong() ?: 0) {
|
|
|
+ ToastUtils.showLong("起摘数量不能小于" + data.minivalue)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (type == "2") {
|
|
|
+ if (month_text.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择交收月")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入挂牌价格")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (onePriceInputEdittext.text.toString() == "0" || onePriceInputEdittext.text.toString() == "0.0" || onePriceInputEdittext.text.toString() == "0.00") {
|
|
|
+ ToastUtils.showLong("挂牌价格不能为0")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (listednumberEdittext.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入挂牌数量")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (listednumberEdittext.text.toString() == "0" || listednumberEdittext.text.toString() == "0.0" || listednumberEdittext.text.toString() == "0.00") {
|
|
|
+ ToastUtils.showLong("挂牌数量不能为0")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (whole_list.isChecked.not()) {
|
|
|
+
|
|
|
+ if (startInputNumber.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入起摘数量")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (type == "2") {
|
|
|
+ if (startInputNumber.text.toString()
|
|
|
+ .toLong() < data1.minivalue?.toLong() ?: 0
|
|
|
+ ) {
|
|
|
+ ToastUtils.showLong("起摘数量不能小于" + data1.minivalue)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (startInputNumber.text.toString().toLong() < data.minivalue?.toLong() ?: 0) {
|
|
|
+ ToastUtils.showLong("起摘数量不能小于" + data.minivalue)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (performance_bond.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入履约保证金比例")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (performance_bond.text.toString() == "0" || performance_bond.text.toString() == "0.0" || performance_bond.text.toString() == "0.00") {
|
|
|
+ ToastUtils.showLong("履约保证金比例不能为0")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (selectPerformanceStepData.value?.autoid.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择履约模版")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (no_friend.isChecked.not()) {
|
|
|
+ if (selectFriendList.value.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择朋友")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+}
|