|
|
@@ -0,0 +1,1098 @@
|
|
|
+package cn.muchinfo.rma.view.base.warehousereceipt.dialog
|
|
|
+
|
|
|
+import android.annotation.SuppressLint
|
|
|
+import android.graphics.Color
|
|
|
+import android.os.Build
|
|
|
+import android.view.Gravity
|
|
|
+import android.view.View
|
|
|
+import android.view.ViewGroup
|
|
|
+import android.view.inputmethod.EditorInfo
|
|
|
+import android.widget.EditText
|
|
|
+import android.widget.SeekBar
|
|
|
+import android.widget.TextView
|
|
|
+import androidx.annotation.RequiresApi
|
|
|
+import androidx.appcompat.app.AppCompatActivity
|
|
|
+import androidx.lifecycle.MutableLiveData
|
|
|
+import androidx.viewpager.widget.PagerAdapter
|
|
|
+import androidx.viewpager.widget.ViewPager
|
|
|
+import cn.bingoogolapple.bgabanner.BGABanner
|
|
|
+import cn.muchinfo.rma.R
|
|
|
+import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
+import cn.muchinfo.rma.global.data.AccountData
|
|
|
+import cn.muchinfo.rma.global.data.HoldLBData
|
|
|
+import cn.muchinfo.rma.global.data.OrderQuoteData
|
|
|
+import cn.muchinfo.rma.global.utils.TimeUtils
|
|
|
+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.utils.NumberUtils
|
|
|
+import cn.muchinfo.rma.view.autoWidget.view.MangeNumberEditText2
|
|
|
+import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.verticalEmptyView
|
|
|
+import cn.muchinfo.rma.view.base.warehousereceipt.WarehouseReceiptViewModel
|
|
|
+import com.blankj.utilcode.util.ConvertUtils
|
|
|
+import com.blankj.utilcode.util.ToastUtils
|
|
|
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
|
|
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
|
|
|
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
|
|
|
+import mtp.polymer.com.autowidget.dialog.CustomDialogFragment
|
|
|
+import mtp.polymer.com.autowidget.dialog.creatAccountDataSheetDialog
|
|
|
+import mtp.polymer.com.autowidget.dialog.creatHnstSpotDetailSheetDialog
|
|
|
+import mtp.polymer.com.autowidget.dialog.createCustomDialog
|
|
|
+import org.jetbrains.anko.*
|
|
|
+import org.jetbrains.anko.support.v4.viewPager
|
|
|
+
|
|
|
+/**
|
|
|
+ * 买卖大厅的一口价挂牌(此页面是进入买卖大厅有仓单要素id的一口价价挂牌)
|
|
|
+ * @receiver AppCompatActivity
|
|
|
+ * @return CustomDialogFragment
|
|
|
+ */
|
|
|
+fun AppCompatActivity.WarehouseOneListedDialog(
|
|
|
+ activity: AppCompatActivity,
|
|
|
+ type: String,
|
|
|
+ viewModel: WarehouseReceiptViewModel,
|
|
|
+ data : ListedData
|
|
|
+): CustomDialogFragment {
|
|
|
+
|
|
|
+ lateinit var segment: QMUITabSegment
|
|
|
+ var selectedTabIndex: Int = 0
|
|
|
+ lateinit var viewPager: ViewPager
|
|
|
+
|
|
|
+ //一口价卖挂牌
|
|
|
+ val oneSellListedUI by lazy {
|
|
|
+ OneSellListedUI(activity, viewModel, type, data)
|
|
|
+ }
|
|
|
+
|
|
|
+ //一口价买挂牌
|
|
|
+ val oneBuyListedUI by lazy {
|
|
|
+ OneBuyListedUI(activity, viewModel, type, data)
|
|
|
+ }
|
|
|
+
|
|
|
+ //viewpager的适配器
|
|
|
+ var newPagerAdapter: PagerAdapter? = null
|
|
|
+
|
|
|
+ //tabSegment标题
|
|
|
+ val newTabsArray: ArrayList<String> = arrayListOf()
|
|
|
+
|
|
|
+ //暂存的页面组
|
|
|
+ val uiList: ArrayList<_FrameLayout> = arrayListOf()
|
|
|
+
|
|
|
+ val selectIndex: MutableLiveData<Int> = MutableLiveData()
|
|
|
+
|
|
|
+ fun initMenuData() {
|
|
|
+
|
|
|
+ newTabsArray.add("卖挂牌")
|
|
|
+ uiList.add(oneSellListedUI.root)
|
|
|
+
|
|
|
+ newTabsArray.add("买挂牌")
|
|
|
+ uiList.add(oneBuyListedUI.root)
|
|
|
+
|
|
|
+ newPagerAdapter = object : PagerAdapter() {
|
|
|
+
|
|
|
+ override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
|
|
|
+
|
|
|
+ override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
|
+ return uiList.get(position).apply {
|
|
|
+ container.addView(
|
|
|
+ this,
|
|
|
+ ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
|
|
|
+ (`object` as? View)?.let { container.removeView(it) }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
|
|
|
+
|
|
|
+ override fun getCount(): Int = newTabsArray.size
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return createCustomDialog(cancelable = false) { dialog ->
|
|
|
+ backgroundColor = Color.parseColor("#5f000000")
|
|
|
+ initMenuData()
|
|
|
+ verticalLayout {
|
|
|
+ viewModel.controlDialogDisappear.bindOptional(context) {
|
|
|
+ if (it == true) {
|
|
|
+ dialog.dismiss()
|
|
|
+ viewModel.controlDialogDisappear.postValue(false)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tabSegment {
|
|
|
+ segment = this
|
|
|
+ background = resources.getDrawable(R.color.segtabment_bg_color)
|
|
|
+ addOnTabSelectedListener(object :
|
|
|
+ QMUITabSegment.OnTabSelectedListener {
|
|
|
+ override fun onDoubleTap(index: Int) {}
|
|
|
+ override fun onTabReselected(index: Int) {}
|
|
|
+ override fun onTabUnselected(index: Int) {}
|
|
|
+ override fun onTabSelected(index: Int) {
|
|
|
+ selectedTabIndex = index
|
|
|
+ selectIndex.postValue(index)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ setIndicator(
|
|
|
+ QMUITabIndicator(
|
|
|
+ QMUIDisplayHelper.dp2px(context, 2),
|
|
|
+ false,
|
|
|
+ true
|
|
|
+ )
|
|
|
+ )
|
|
|
+ setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
+ view {
|
|
|
+ background = resources.getDrawable(R.color.main_hit_bg_color)
|
|
|
+ }.lparams(matchParent, autoSize(1)) {
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ marginEnd = autoSize(32)
|
|
|
+ }
|
|
|
+ viewPager {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ viewPager = this
|
|
|
+ adapter = newPagerAdapter
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+
|
|
|
+ segment.setupWithViewPager(viewPager)
|
|
|
+ segment.selectTab(1)
|
|
|
+ }.lparams(matchParent, matchParent) {
|
|
|
+ topMargin = autoSize(120)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//一口价卖挂牌
|
|
|
+class OneSellListedUI(
|
|
|
+ private val activity: AppCompatActivity,
|
|
|
+ private val viewModel: WarehouseReceiptViewModel,
|
|
|
+ private val type: String,
|
|
|
+ data : ListedData
|
|
|
+) {
|
|
|
+ //选择的现货仓单明细数据
|
|
|
+ val selectSpotDetailsData: MutableLiveData<HoldLBData> = MutableLiveData()
|
|
|
+
|
|
|
+ //选择的资金账号
|
|
|
+ val selectAccountData: MutableLiveData<AccountData> = MutableLiveData()
|
|
|
+
|
|
|
+ //挂牌价格输入
|
|
|
+ lateinit var onePriceInputEdittext: MangeNumberEditText2
|
|
|
+
|
|
|
+ //挂牌数量
|
|
|
+ lateinit var oneNumberInputEdittext: MangeNumberEditText2
|
|
|
+
|
|
|
+ //起摘数量输入框
|
|
|
+ lateinit var startInputNumber: EditText
|
|
|
+
|
|
|
+ //摘牌金额
|
|
|
+ lateinit var one_delisting_amount: TextView
|
|
|
+
|
|
|
+ var marginValue = 0.0//履约保证金比例
|
|
|
+
|
|
|
+ //初始化设置履约保证金比例
|
|
|
+ fun setMarginValue() {
|
|
|
+ if (type == "1") {//有仓单的卖履约保证金
|
|
|
+ marginValue =
|
|
|
+ GlobalDataCollection.instance?.marketTradeConfigData?.sellmarginvalue?.toDouble()
|
|
|
+ ?: 0.0
|
|
|
+ } else {//无仓单的卖履约保证金比例
|
|
|
+ marginValue =
|
|
|
+ GlobalDataCollection.instance?.marketTradeConfigData?.sellmarginvalue2?.toDouble()
|
|
|
+ ?: 0.0
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressLint("NewApi", "SetTextI18n")
|
|
|
+ @RequiresApi(Build.VERSION_CODES.O)
|
|
|
+ val root = _FrameLayout(activity).apply {
|
|
|
+ verticalLayout {
|
|
|
+ setMarginValue()
|
|
|
+ selectAccountData.postValue(GlobalDataCollection.instance?.accountData)
|
|
|
+ backgroundDrawable = createRoundRectDrawable("#ffffff", 24)
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.creatAccountDataSheetDialog(
|
|
|
+ "请选择资金账号",
|
|
|
+ GlobalDataCollection.instance?.accountDataList ?: arrayListOf()
|
|
|
+ ) {
|
|
|
+ selectAccountData.postValue(this)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "交易账户"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ selectAccountData.bindOptional(context) {
|
|
|
+ text = it?.accountid.toString() + " " + it?.accountname
|
|
|
+ }
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_more
|
|
|
+ }.lparams(autoSize(36), autoSize(36))
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.creatHnstSpotDetailSheetDialog(
|
|
|
+ "请选择现货仓单",
|
|
|
+ viewModel.detailsWarehouseContentDataList.value ?: arrayListOf()
|
|
|
+ ) {
|
|
|
+ selectSpotDetailsData.postValue(this)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "现货仓单"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "请选择现货仓单"
|
|
|
+ selectSpotDetailsData.bindOptional(context) {
|
|
|
+ text = it?.wrfactortypeid + "(" + it?.enableqty + it?.enumdicname + ")"
|
|
|
+ }
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_more
|
|
|
+ }.lparams(autoSize(36), autoSize(36))
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ 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)
|
|
|
+
|
|
|
+ numberEditText {
|
|
|
+ text = "0"
|
|
|
+ onePriceInputEdittext = this
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+ if (oneNumberInputEdittext.text.toString().isNullOrEmpty().not()) {
|
|
|
+ var marginValue = value.toString().toDouble()
|
|
|
+ .times(oneNumberInputEdittext.text.toString().toDouble())
|
|
|
+ if (marginValue == 0.0) {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ marginValue.toString(),
|
|
|
+ 2
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ marginValue.toString(),
|
|
|
+ 2
|
|
|
+ ) + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ marginValue?.times(
|
|
|
+ marginValue
|
|
|
+ ) ?: 0.0, 2
|
|
|
+ ) + ")"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }.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 {
|
|
|
+ text = "1"
|
|
|
+ oneNumberInputEdittext = this
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()
|
|
|
+ .not()
|
|
|
+ ) {
|
|
|
+ var marginValue = value.toString().toDouble()
|
|
|
+ .times(oneNumberInputEdittext.text.toString().toDouble())
|
|
|
+ if (marginValue == 0.0) {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ marginValue.toString(),
|
|
|
+ 2
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ marginValue.toString(),
|
|
|
+ 2
|
|
|
+ ) + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ marginValue?.times(
|
|
|
+ marginValue
|
|
|
+ ) ?: 0.0, 2
|
|
|
+ ) + ")"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(0, autoSize(72), 1f) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "吨"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ inflateLayout<SeekBar>(R.layout.main_seekbar) {
|
|
|
+ min = 10
|
|
|
+ max = 100
|
|
|
+ isIndeterminate = false
|
|
|
+ splitTrack = false
|
|
|
+ setPadding(0, 0, 0, 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) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onStartTrackingTouch(p0: SeekBar?) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onStopTrackingTouch(p0: SeekBar?) {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }.lparams(matchParent, wrapContent) {
|
|
|
+ marginEnd = autoSize(110)
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ visibility = View.GONE
|
|
|
+ textView {
|
|
|
+ text = "0"
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_gray_color
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "80吨"
|
|
|
+ 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 {
|
|
|
+ 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 {
|
|
|
+ setText("1")
|
|
|
+ startInputNumber = this
|
|
|
+ hint = "请输入起摘数量"
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_NUMBER
|
|
|
+// setDecimalInputType()
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(0, autoSize(132), 1f) {
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "吨"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
+ textView {
|
|
|
+ visibility = View.GONE
|
|
|
+ text = "最小单位"
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+ }.lparams(matchParent, autoSize(167))
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(167))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ 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 = "--"
|
|
|
+ one_delisting_amount = this
|
|
|
+ textSizeAuto = 29
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ verticalEmptyView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (selectSpotDetailsData.value?.deliverygoodsid.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择现货仓单明细")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入挂牌价格")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (onePriceInputEdittext.text.toString().toDouble() == 0.0) {
|
|
|
+ ToastUtils.showLong("挂牌价格不能为零")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+
|
|
|
+ if (oneNumberInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入挂牌数量")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (oneNumberInputEdittext.text.toString().toDouble() == 0.0) {
|
|
|
+ ToastUtils.showLong("挂牌数量不能为零")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+
|
|
|
+ if (startInputNumber.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入起摘数量")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+
|
|
|
+ val selectDetailsData = selectSpotDetailsData.value
|
|
|
+ if (type == "1") {
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ FactoryItems = data.getFactoryItems(),
|
|
|
+ LadingBillId = selectDetailsData?.ladingbillid?.toLong() ?: 0,
|
|
|
+ SubNum = selectDetailsData?.subnum?.toLong() ?: 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ WRFactorTypeId = 0,
|
|
|
+ UserID = GlobalDataCollection.instance?.loginRsp?.userID ?: 0,
|
|
|
+ AccountID = selectAccountData.value?.accountid ?: 0,
|
|
|
+ IsSpecified = 0,
|
|
|
+ OrderQty = oneNumberInputEdittext.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
|
|
|
+ ) {
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ FactoryItems = data.getFactoryItems(),
|
|
|
+ LadingBillId = selectDetailsData?.ladingbillid?.toLong() ?: 0,
|
|
|
+ SubNum = selectDetailsData?.subnum?.toLong() ?: 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ WRFactorTypeId = 0,
|
|
|
+ UserID = GlobalDataCollection.instance?.loginRsp?.userID ?: 0,
|
|
|
+ AccountID = selectAccountData.value?.accountid ?: 0,
|
|
|
+ IsSpecified = 0,
|
|
|
+ OrderQty = oneNumberInputEdittext.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 = 0,
|
|
|
+ DelistMinQty = startInputNumber.text.toString().toLong(),
|
|
|
+ WRStandardID = data.WRStandardID?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ backgroundResource = R.drawable.qhj_main_blue_bg
|
|
|
+ text = "卖出"
|
|
|
+ textSizeAuto = 38
|
|
|
+ textColorInt = R.color.white
|
|
|
+ }.lparams(autoSize(419), autoSize(119)) {
|
|
|
+ marginStart = autoSize(24)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ backgroundResource = R.drawable.hnxt_cancel_bg
|
|
|
+ text = "取消"
|
|
|
+ textColorInt = R.color.white
|
|
|
+ textSizeAuto = 38
|
|
|
+ }.lparams(autoSize(419), autoSize(119)) {
|
|
|
+ marginStart = autoSize(13)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(144)) {
|
|
|
+ gravity = Gravity.BOTTOM
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//一口价买挂牌
|
|
|
+class OneBuyListedUI(
|
|
|
+ private val activity: AppCompatActivity,
|
|
|
+ private val viewModel: WarehouseReceiptViewModel,
|
|
|
+ private val type: String,
|
|
|
+ data : ListedData
|
|
|
+) {
|
|
|
+
|
|
|
+ //选择的资金账号
|
|
|
+ val selectAccountData: MutableLiveData<AccountData> = MutableLiveData()
|
|
|
+
|
|
|
+ //挂牌价格输入
|
|
|
+ lateinit var onePriceInputEdittext: MangeNumberEditText2
|
|
|
+
|
|
|
+ //挂牌数量
|
|
|
+ lateinit var oneNumberInputEdittext: MangeNumberEditText2
|
|
|
+
|
|
|
+ //起摘数量输入框
|
|
|
+ lateinit var startInputNumber: EditText
|
|
|
+
|
|
|
+ //挂牌金额
|
|
|
+ lateinit var one_delisting_amount: TextView
|
|
|
+
|
|
|
+ //SeekBar
|
|
|
+ lateinit var seekBar: SeekBar
|
|
|
+ //挂牌最大数量
|
|
|
+ val maxlistedNumber : MutableLiveData<Int> = MutableLiveData()
|
|
|
+
|
|
|
+ var marginValue = 0.0//履约保证金比例
|
|
|
+
|
|
|
+ //初始化设置履约保证金比例
|
|
|
+ fun setMarginValue() {
|
|
|
+ marginValue =
|
|
|
+ GlobalDataCollection.instance?.marketTradeConfigData?.buymarginvalue?.toDouble()
|
|
|
+ ?: 0.0
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressLint("SetTextI18n")
|
|
|
+ @RequiresApi(Build.VERSION_CODES.O)
|
|
|
+ val root = _FrameLayout(activity).apply {
|
|
|
+ verticalLayout {
|
|
|
+ setMarginValue()
|
|
|
+ selectAccountData.postValue(GlobalDataCollection.instance?.accountData)
|
|
|
+ backgroundDrawable = createRoundRectDrawable("#ffffff", 24)
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.creatAccountDataSheetDialog(
|
|
|
+ "请选择资金账号",
|
|
|
+ GlobalDataCollection.instance?.accountDataList ?: arrayListOf()
|
|
|
+ ) {
|
|
|
+ selectAccountData.postValue(this)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "交易账户"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ selectAccountData.bindOptional(context) {
|
|
|
+ text = it?.accountid.toString() + " " + it?.accountname
|
|
|
+ }
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_more
|
|
|
+ }.lparams(autoSize(36), autoSize(36))
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ 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)
|
|
|
+
|
|
|
+ numberEditText {
|
|
|
+ text = "0"
|
|
|
+ onePriceInputEdittext = this
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+ if (oneNumberInputEdittext.text.toString().isNullOrEmpty().not()) {
|
|
|
+ //这里计算金额和履约保证金
|
|
|
+ var marginValue = value.toString().toDouble()
|
|
|
+ .times(oneNumberInputEdittext.text.toString().toDouble())
|
|
|
+ if (marginValue == 0.0) {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ marginValue.toString(),
|
|
|
+ 2
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ marginValue.toString(),
|
|
|
+ 2
|
|
|
+ ) + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ marginValue.times(
|
|
|
+ marginValue
|
|
|
+ ) ?: 0.0, 2
|
|
|
+ ) + ")"
|
|
|
+ }
|
|
|
+ //这里计算最多购买数量 挂牌最大数量=可用资金/(买方履约保证金比例*挂牌价格)
|
|
|
+ if (value.toDouble() != 0.0 && marginValue != 0.0){
|
|
|
+ maxlistedNumber.postValue(viewModel.usedAccountData.value?.canUserAmount?.div(marginValue)?.div(value.toDouble())?.toInt())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }.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 {
|
|
|
+ text = "1"
|
|
|
+ oneNumberInputEdittext = this
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()
|
|
|
+ .not()
|
|
|
+ ) {
|
|
|
+ var marginValue = value.toString().toDouble()
|
|
|
+ .times(oneNumberInputEdittext.text.toString().toDouble())
|
|
|
+ if (marginValue == 0.0) {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ marginValue.toString(),
|
|
|
+ 2
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ marginValue.toString(),
|
|
|
+ 2
|
|
|
+ ) + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ marginValue.times(
|
|
|
+ marginValue
|
|
|
+ ) ?: 0.0, 2
|
|
|
+ ) + ")"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(0, autoSize(72), 1f) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "吨"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ inflateLayout<SeekBar>(R.layout.main_seekbar) {
|
|
|
+ min = 10
|
|
|
+ max = 100
|
|
|
+ seekBar = this
|
|
|
+ isIndeterminate = false
|
|
|
+ splitTrack = false
|
|
|
+ setPadding(0, 0, 0, 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) {
|
|
|
+// oneNumberInputEdittext.text = NumberUtils.roundNum(maxlistedNumber.value?.times(p1.div(100.0)).toString(),0)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onStartTrackingTouch(p0: SeekBar?) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onStopTrackingTouch(p0: SeekBar?) {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }.lparams(matchParent, wrapContent) {
|
|
|
+ marginEnd = autoSize(110)
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "0"
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_gray_color
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ textView {
|
|
|
+ maxlistedNumber.bindOptional(context){
|
|
|
+ //最大可交易数量变更后,输入的值要根据seekbar进度来进行更新
|
|
|
+// oneNumberInputEdittext.text = NumberUtils.roundNum(it?.times(seekBar.progress.div(100.0)).toString(),0)
|
|
|
+ text = it.toString() + "吨"
|
|
|
+ }
|
|
|
+ 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 {
|
|
|
+ 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 {
|
|
|
+ setText("1")
|
|
|
+ startInputNumber = this
|
|
|
+ hint = "请输入起摘数量"
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_NUMBER
|
|
|
+// setDecimalInputType()
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(0, autoSize(132), 1f) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "吨"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
+ textView {
|
|
|
+ visibility = View.GONE
|
|
|
+ text = "最小单位"
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+ }.lparams(matchParent, autoSize(167))
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(167))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ visibility = View.GONE
|
|
|
+ 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 = "--"
|
|
|
+ one_delisting_amount = this
|
|
|
+ textSizeAuto = 29
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ verticalEmptyView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入挂牌价格")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (onePriceInputEdittext.text.toString().toDouble() == 0.0) {
|
|
|
+ ToastUtils.showLong("挂牌价格不能为零")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+
|
|
|
+ if (oneNumberInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入挂牌数量")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (oneNumberInputEdittext.text.toString().toDouble() == 0.0) {
|
|
|
+ ToastUtils.showLong("挂牌数量不能为零")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+
|
|
|
+ if (startInputNumber.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入起摘数量")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+
|
|
|
+ if (type == "1") {
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ FactoryItems = data.getFactoryItems(),
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ WRFactorTypeId = 0,
|
|
|
+ UserID = GlobalDataCollection.instance?.loginRsp?.userID ?: 0,
|
|
|
+ AccountID = selectAccountData.value?.accountid ?: 0,
|
|
|
+ IsSpecified = 0,
|
|
|
+ OrderQty = oneNumberInputEdittext.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 = 0,
|
|
|
+ PriceDisplayMode = 1,
|
|
|
+ DeliveryMonth = data.DeliveryMonth,
|
|
|
+ CanBargain = 0,
|
|
|
+ ApplyID = 0,
|
|
|
+ CanPart = 1,
|
|
|
+ HasWr = 1,
|
|
|
+ DelistMinQty = startInputNumber.text.toString().toLong(),
|
|
|
+ WRStandardID = data.WRStandardID?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ FactoryItems = data.getFactoryItems(),
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ WRFactorTypeId = 0,
|
|
|
+ UserID = GlobalDataCollection.instance?.loginRsp?.userID ?: 0,
|
|
|
+ AccountID = selectAccountData.value?.accountid ?: 0,
|
|
|
+ IsSpecified = 0,
|
|
|
+ OrderQty = oneNumberInputEdittext.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 = 0,
|
|
|
+ DeliveryMonth = data.DeliveryMonth,
|
|
|
+ PriceDisplayMode = 1,
|
|
|
+ CanBargain = 0,
|
|
|
+ ApplyID = 0,
|
|
|
+ CanPart = 1,
|
|
|
+ HasWr = 0,
|
|
|
+ DelistMinQty = startInputNumber.text.toString().toLong(),
|
|
|
+ WRStandardID = data.WRStandardID?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ backgroundResource = R.drawable.qhj_main_blue_bg
|
|
|
+ text = "买入"
|
|
|
+ textSizeAuto = 38
|
|
|
+ textColorInt = R.color.white
|
|
|
+ }.lparams(autoSize(419), autoSize(119)) {
|
|
|
+ marginStart = autoSize(24)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ backgroundResource = R.drawable.hnxt_cancel_bg
|
|
|
+ text = "取消"
|
|
|
+ textColorInt = R.color.white
|
|
|
+ textSizeAuto = 38
|
|
|
+ }.lparams(autoSize(419), autoSize(119)) {
|
|
|
+ marginStart = autoSize(13)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(144)) {
|
|
|
+ gravity = Gravity.BOTTOM
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ fun check(): Boolean {
|
|
|
+
|
|
|
+
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|