|
|
@@ -32,6 +32,7 @@ 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 com.blankj.utilcode.util.ConvertUtils
|
|
|
+import com.blankj.utilcode.util.LogUtils
|
|
|
import com.blankj.utilcode.util.ToastUtils
|
|
|
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
|
|
import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
|
|
|
@@ -231,473 +232,476 @@ class FloatSellListedUI(
|
|
|
@SuppressLint("SetTextI18n")
|
|
|
@RequiresApi(Build.VERSION_CODES.O)
|
|
|
val root = _FrameLayout(activity).apply {
|
|
|
- verticalLayout {
|
|
|
- setMarginValue()
|
|
|
- selectAccountData.postValue(GlobalDataCollection.instance?.accountData)
|
|
|
- backgroundDrawable = createRoundRectDrawable("#ffffff", 24)
|
|
|
- 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))
|
|
|
- }
|
|
|
- }
|
|
|
- linearLayout {
|
|
|
- gravity = Gravity.CENTER_VERTICAL
|
|
|
- onThrottleFirstClick {
|
|
|
- activity.creatAccountDataSheetDialog("请选择资金账号", GlobalDataCollection.instance?.accountDataList ?: arrayListOf()) {
|
|
|
- selectAccountData.postValue(this)
|
|
|
+ scrollView {
|
|
|
+ verticalLayout {
|
|
|
+ setMarginValue()
|
|
|
+ selectAccountData.postValue(GlobalDataCollection.instance?.accountData)
|
|
|
+ backgroundDrawable = createRoundRectDrawable("#ffffff", 24)
|
|
|
+ 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))
|
|
|
}
|
|
|
}
|
|
|
linearLayout {
|
|
|
- textView {
|
|
|
- text = "交易账户"
|
|
|
- textSizeAuto = 34
|
|
|
- textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
- marginStart = autoSize(36)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.creatAccountDataSheetDialog("请选择资金账号", GlobalDataCollection.instance?.accountDataList ?: arrayListOf()) {
|
|
|
+ selectAccountData.postValue(this)
|
|
|
+ }
|
|
|
}
|
|
|
- }.lparams(autoSize(250), wrapContent)
|
|
|
+ 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)
|
|
|
+ textView {
|
|
|
+ selectAccountData.bindOptional(context){
|
|
|
+ text = it?.accountid.toString() + " " + it?.accountname
|
|
|
+ }
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
|
|
|
- emptyView()
|
|
|
+ emptyView()
|
|
|
|
|
|
- imageView {
|
|
|
- imageResource = R.mipmap.rma_more
|
|
|
- }.lparams(autoSize(36), autoSize(36))
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_more
|
|
|
+ }.lparams(autoSize(36), autoSize(36))
|
|
|
|
|
|
- }.lparams(matchParent, autoSize(143))
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
|
|
|
- itemView()
|
|
|
+ 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)
|
|
|
+ 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
|
|
|
- isdefineByBasis = true
|
|
|
- text = "0"
|
|
|
- setOnTextChangeListener { view, value ->
|
|
|
- if (value.isNotEmpty()){
|
|
|
- //行情下发计算挂牌金额 = (基差价格+期货合约价)* 挂牌数量
|
|
|
- listed_price.postValue(value.toString().toDouble().plus(viewModel.quoteDayData.value?.getPrice() ?: 0.0))
|
|
|
+ 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
|
|
|
+ isdefineByBasis = true
|
|
|
+ text = "0"
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ 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(0, autoSize(72),1f){
|
|
|
- marginEnd = autoSize(110)
|
|
|
- }
|
|
|
- }.lparams(matchParent, autoSize(143))
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
|
|
|
- itemView()
|
|
|
+ itemView()
|
|
|
|
|
|
- linearLayout {
|
|
|
- if (type == "2"){//预售挂卖时不需要选择现货仓单
|
|
|
- visibility = View.GONE
|
|
|
- }else{
|
|
|
- visibility = View.VISIBLE
|
|
|
- }
|
|
|
- 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)
|
|
|
+ if (type == "2"){//预售挂卖时不需要选择现货仓单
|
|
|
+ visibility = View.GONE
|
|
|
+ }else{
|
|
|
+ visibility = View.VISIBLE
|
|
|
}
|
|
|
- }.lparams(autoSize(250), wrapContent)
|
|
|
-
|
|
|
- textView {
|
|
|
- text = "请选择现货仓单"
|
|
|
- selectSpotDetailsData.bindOptional(context){
|
|
|
- text = it?.ladingbillid + "(" + it?.enableqty + it?.enumdicname + ")"
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.creatHnstSpotDetailSheetDialog("请选择现货仓单", viewModel.detailsWarehouseContentDataList.value ?: arrayListOf()) {
|
|
|
+ selectSpotDetailsData.postValue(this)
|
|
|
+ }
|
|
|
}
|
|
|
- textSizeAuto = 34
|
|
|
- textColorInt = R.color.rma_black_33
|
|
|
- }.lparams(wrapContent, wrapContent)
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "现货仓单"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
|
|
|
- emptyView()
|
|
|
+ textView {
|
|
|
+ text = "请选择现货仓单"
|
|
|
+ selectSpotDetailsData.bindOptional(context){
|
|
|
+ text = it?.ladingbillid + "(" + it?.enableqty + it?.enumdicname + ")"
|
|
|
+ }
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
|
|
|
- imageView {
|
|
|
- imageResource = R.mipmap.rma_more
|
|
|
- }.lparams(autoSize(36), autoSize(36))
|
|
|
+ emptyView()
|
|
|
|
|
|
- }.lparams(matchParent, autoSize(143))
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_more
|
|
|
+ }.lparams(autoSize(36), autoSize(36))
|
|
|
|
|
|
- itemView()
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
|
|
|
- linearLayout {
|
|
|
- verticalLayout {
|
|
|
- textView {
|
|
|
- text = "挂牌数量"
|
|
|
- textSizeAuto = 34
|
|
|
- textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
- marginStart = autoSize(36)
|
|
|
- topMargin = autoSize(36)
|
|
|
- }
|
|
|
+ itemView()
|
|
|
|
|
|
- }.lparams(autoSize(250), autoSize(290))
|
|
|
+ linearLayout {
|
|
|
+ verticalLayout {
|
|
|
+ textView {
|
|
|
+ text = "挂牌数量"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ topMargin = autoSize(36)
|
|
|
+ }
|
|
|
|
|
|
- verticalLayout {
|
|
|
- linearLayout {
|
|
|
- gravity = Gravity.CENTER_VERTICAL
|
|
|
- numberEditText {
|
|
|
- text = data.minivalue
|
|
|
- changeValue = data.minivalue?.toDouble() ?: 1.0
|
|
|
- listednumberEdittext = this
|
|
|
- setOnTextChangeListener { view, value ->
|
|
|
- if (value.isNullOrEmpty().not()) {
|
|
|
- if (selectSpotDetailsData.value?.accountid.isNullOrEmpty().not()) {
|
|
|
- val floatDelistingAmount = listed_price.value?.times(value.toString().toDouble())
|
|
|
- if (floatDelistingAmount != 0.0){
|
|
|
- //显示估算总额
|
|
|
- if (marginValue == 0.0){
|
|
|
- float_delisting_amount.text = NumberUtils.roundNum(floatDelistingAmount ?: 0.0,2)
|
|
|
- }else{
|
|
|
- float_delisting_amount.text = NumberUtils.roundNum(floatDelistingAmount ?: 0.0,2) + "(需履约保证金" + NumberUtils.roundNum(floatDelistingAmount?.times(marginValue) ?: 0.0,2) + ")"
|
|
|
+ }.lparams(autoSize(250), autoSize(290))
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ numberEditText {
|
|
|
+ text = data.minivalue
|
|
|
+ changeValue = data.minivalue?.toDouble() ?: 1.0
|
|
|
+ listednumberEdittext = this
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+ if (selectSpotDetailsData.value?.accountid.isNullOrEmpty().not()) {
|
|
|
+ val floatDelistingAmount = listed_price.value?.times(value.toString().toDouble())
|
|
|
+ if (floatDelistingAmount != 0.0){
|
|
|
+ //显示估算总额
|
|
|
+ if (marginValue == 0.0){
|
|
|
+ float_delisting_amount.text = NumberUtils.roundNum(floatDelistingAmount ?: 0.0,2)
|
|
|
+ }else{
|
|
|
+ float_delisting_amount.text = NumberUtils.roundNum(floatDelistingAmount ?: 0.0,2) + "(需履约保证金" + NumberUtils.roundNum(floatDelistingAmount?.times(marginValue) ?: 0.0,2) + ")"
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ setTextColor(R.color.buy_hall_color)
|
|
|
+ }.lparams(0, autoSize(72),1f){
|
|
|
+ marginEnd = autoSize(36)
|
|
|
}
|
|
|
- setTextColor(R.color.buy_hall_color)
|
|
|
- }.lparams(0, autoSize(72),1f){
|
|
|
- marginEnd = autoSize(36)
|
|
|
- }
|
|
|
-
|
|
|
- textView {
|
|
|
- text = data.enumdicname
|
|
|
- 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(autoSize(30), 0, autoSize(30), 0)
|
|
|
- thumb = resources.getDrawable(R.mipmap.hnst_seekbar)
|
|
|
- thumbOffset = 0
|
|
|
- progressDrawable = resources.getDrawable(R.drawable.seekbar_bg)
|
|
|
- setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
|
|
- override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
|
|
|
- listednumberEdittext.text = NumberUtils.roundNum(max_number.text.toString().toDouble().times(p1.div(100.0)),0)
|
|
|
+ textView {
|
|
|
+ text = data.enumdicname
|
|
|
+ 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(autoSize(30), 0, autoSize(30), 0)
|
|
|
+ thumb = resources.getDrawable(R.mipmap.hnst_seekbar)
|
|
|
+ thumbOffset = 0
|
|
|
+ progressDrawable = resources.getDrawable(R.drawable.seekbar_bg)
|
|
|
+ setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
|
|
+ override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
|
|
|
+ listednumberEdittext.text = NumberUtils.roundNum(max_number.text.toString().toDouble().times(p1.div(100.0)),0)
|
|
|
+ }
|
|
|
|
|
|
- override fun onStartTrackingTouch(p0: SeekBar?) {
|
|
|
+ override fun onStartTrackingTouch(p0: SeekBar?) {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- override fun onStopTrackingTouch(p0: SeekBar?) {
|
|
|
+ override fun onStopTrackingTouch(p0: SeekBar?) {
|
|
|
|
|
|
- }
|
|
|
- })
|
|
|
- }.lparams(matchParent, wrapContent){
|
|
|
- marginEnd = autoSize(110)
|
|
|
- topMargin = autoSize(20)
|
|
|
- }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }.lparams(matchParent, wrapContent){
|
|
|
+ marginEnd = autoSize(110)
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ }
|
|
|
|
|
|
- linearLayout {
|
|
|
- textView {
|
|
|
- text = "0"
|
|
|
- textSizeAuto = 29
|
|
|
- textColorInt = R.color.rma_gray_color
|
|
|
- }.lparams(wrapContent, wrapContent)
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "0"
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_gray_color
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
|
|
|
- emptyView()
|
|
|
+ emptyView()
|
|
|
|
|
|
- textView {
|
|
|
- max_number = this
|
|
|
- viewModel.summaryWrPositionDataByDialog.bindOptional(context){
|
|
|
- if (type == "2"){
|
|
|
- text = it?.creditenableqty + data.enumdicname
|
|
|
+ textView {
|
|
|
+ max_number = this
|
|
|
+ viewModel.summaryWrPositionDataByDialog.bindOptional(context){
|
|
|
+ if (type == "2"){
|
|
|
+ text = it?.creditenableqty + data.enumdicname
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- selectSpotDetailsData.bindOptional(context){
|
|
|
- if (type == "1"){
|
|
|
- text = it?.enableqty + data.enumdicname
|
|
|
+ selectSpotDetailsData.bindOptional(context){
|
|
|
+ if (type == "1"){
|
|
|
+ text = it?.enableqty + data.enumdicname
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+ text = "1"
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_gray_color
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+ }.lparams(matchParent, wrapContent){
|
|
|
+ marginEnd = autoSize(110)
|
|
|
+ topMargin = autoSize(10)
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- text = "1"
|
|
|
+ }.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(data.minivalue)
|
|
|
+ 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)
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "最小单位" + data.minivalue + data.enumdicname
|
|
|
textSizeAuto = 29
|
|
|
- textColorInt = R.color.rma_gray_color
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
|
- }.lparams(matchParent, wrapContent){
|
|
|
- marginEnd = autoSize(110)
|
|
|
- topMargin = autoSize(10)
|
|
|
- }
|
|
|
+ }.lparams(matchParent, autoSize(167))
|
|
|
|
|
|
- }.lparams(matchParent, autoSize(290))
|
|
|
- }.lparams(matchParent, autoSize(290))
|
|
|
+ }.lparams(matchParent, autoSize(167))
|
|
|
|
|
|
- itemView()
|
|
|
+ itemView()
|
|
|
|
|
|
- linearLayout {
|
|
|
- gravity = Gravity.CENTER_VERTICAL
|
|
|
linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
- text = "起摘数量"
|
|
|
+ text = "估算总价"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(autoSize(214), wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
- }.lparams(autoSize(250), wrapContent)
|
|
|
-
|
|
|
- verticalLayout {
|
|
|
- linearLayout {
|
|
|
- editText {
|
|
|
- setText(data.minivalue)
|
|
|
- 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)
|
|
|
- }.lparams(matchParent, autoSize(100))
|
|
|
|
|
|
textView {
|
|
|
- text = "最小单位" + data.minivalue + data.enumdicname
|
|
|
+ text = "--"
|
|
|
+ listed_price.bindOptional(context){
|
|
|
+ text = NumberUtils.roundNum(it ?: 0.0,2)
|
|
|
+ }
|
|
|
+ float_total_amount = this
|
|
|
textSizeAuto = 29
|
|
|
- textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
|
- }.lparams(matchParent, autoSize(167))
|
|
|
-
|
|
|
- }.lparams(matchParent, autoSize(167))
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
|
|
|
- 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)
|
|
|
- }
|
|
|
+ itemView()
|
|
|
|
|
|
- textView {
|
|
|
- text = "--"
|
|
|
- listed_price.bindOptional(context){
|
|
|
- text = NumberUtils.roundNum(it ?: 0.0,2)
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ text = "估算总额"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(autoSize(214), wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
}
|
|
|
- float_total_amount = this
|
|
|
- textSizeAuto = 29
|
|
|
- textColorInt = R.color.rma_black_33
|
|
|
- }.lparams(wrapContent, wrapContent)
|
|
|
- }.lparams(matchParent, autoSize(143))
|
|
|
-
|
|
|
- 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 = "--"
|
|
|
- listed_price.bindOptional(context){
|
|
|
- val floatDelistingAmount = it?.times(listednumberEdittext.text.toString().toDouble())
|
|
|
- if (floatDelistingAmount != 0.0){
|
|
|
- if (marginValue == 0.0){
|
|
|
- text = NumberUtils.roundNum(floatDelistingAmount ?: 0.0,2)
|
|
|
- }else{
|
|
|
- text = NumberUtils.roundNum(floatDelistingAmount ?: 0.0,2) + "(需履约保证金" + NumberUtils.roundNum(floatDelistingAmount?.times(marginValue) ?: 0.0,2) + ")"
|
|
|
+ textView {
|
|
|
+ text = "--"
|
|
|
+ listed_price.bindOptional(context){
|
|
|
+ val floatDelistingAmount = it?.times(listednumberEdittext.text.toString().toDouble())
|
|
|
+ if (floatDelistingAmount != 0.0){
|
|
|
+ if (marginValue == 0.0){
|
|
|
+ text = NumberUtils.roundNum(floatDelistingAmount ?: 0.0,2)
|
|
|
+ }else{
|
|
|
+ text = NumberUtils.roundNum(floatDelistingAmount ?: 0.0,2) + "(需履约保证金" + NumberUtils.roundNum(floatDelistingAmount?.times(marginValue) ?: 0.0,2) + ")"
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ float_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)
|
|
|
}
|
|
|
- float_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)
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ marginStart = autoSize(250)
|
|
|
}
|
|
|
- textSizeAuto = 29
|
|
|
- textColorInt = R.color.rma_black_33
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
- topMargin = autoSize(20)
|
|
|
- marginStart = autoSize(250)
|
|
|
- }
|
|
|
|
|
|
- verticalEmptyView()
|
|
|
+ verticalEmptyView()
|
|
|
|
|
|
- linearLayout {
|
|
|
- background = resources.getDrawable(R.color.white)
|
|
|
- gravity = Gravity.CENTER_VERTICAL
|
|
|
- textView {
|
|
|
- onThrottleFirstClick {
|
|
|
- if (type == "1") {
|
|
|
- if (selectSpotDetailsData.value?.deliverygoodsid.isNullOrEmpty()) {
|
|
|
- ToastUtils.showLong("请选择现货仓单明细")
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (type == "1") {
|
|
|
+ if (selectSpotDetailsData.value?.deliverygoodsid.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请选择现货仓单明细")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (viewModel.summaryWrPositionDataByDialog.value?.accountid.isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("没有对应的仓单数据,不能进行挂牌操作")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (listednumberEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("请输入挂牌数量")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- }else{
|
|
|
- if (viewModel.summaryWrPositionDataByDialog.value?.accountid.isNullOrEmpty()){
|
|
|
- ToastUtils.showLong("没有对应的仓单数据,不能进行挂牌操作")
|
|
|
+ if (listednumberEdittext.text.toString().toDouble() == 0.0){
|
|
|
+ ToastUtils.showLong("挂牌数量不能为零")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- }
|
|
|
- if (listednumberEdittext.text.toString().isNullOrEmpty()){
|
|
|
- ToastUtils.showLong("请输入挂牌数量")
|
|
|
- return@onThrottleFirstClick
|
|
|
- }
|
|
|
- if (listednumberEdittext.text.toString().toDouble() == 0.0){
|
|
|
- ToastUtils.showLong("挂牌数量不能为零")
|
|
|
- return@onThrottleFirstClick
|
|
|
- }
|
|
|
|
|
|
- if (basisInputEdittext.text.toString().isNullOrEmpty()){
|
|
|
- ToastUtils.showLong("请输入基差")
|
|
|
- return@onThrottleFirstClick
|
|
|
- }
|
|
|
-
|
|
|
- if (startInputNumber.text.toString().isNullOrEmpty()) {
|
|
|
- ToastUtils.showLong("请输入起摘数量")
|
|
|
- return@onThrottleFirstClick
|
|
|
- }
|
|
|
- if (startInputNumber.text.toString().toLong() < data.minivalue?.toLong() ?: 0){
|
|
|
- ToastUtils.showLong("起摘数量不能小于" + data.minivalue)
|
|
|
- return@onThrottleFirstClick
|
|
|
- }
|
|
|
+ if (basisInputEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("请输入基差")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
|
|
|
- if (type == "1"){
|
|
|
- viewModel.requeryWRListingOrderReq(
|
|
|
- FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
|
|
|
- LadingBillId = selectSpotDetailsData.value?.ladingbillid?.toLong() ?: 0,
|
|
|
- TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
- SubNum = selectSpotDetailsData.value?.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(data),
|
|
|
- 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
|
|
|
- ){
|
|
|
- viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ if (startInputNumber.text.toString().isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入起摘数量")
|
|
|
+ return@onThrottleFirstClick
|
|
|
}
|
|
|
- }else{
|
|
|
- viewModel.requeryWRListingOrderReq(
|
|
|
- FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
|
|
|
- LadingBillId = 0,
|
|
|
- TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
- SubNum = 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(data),
|
|
|
- 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 = 0,
|
|
|
- DelistMinQty = startInputNumber.text.toString().toLong(),
|
|
|
- WRStandardID = data.wrstandardid?.toInt() ?: 0
|
|
|
- ){
|
|
|
- viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ if (startInputNumber.text.toString().toLong() < data.minivalue?.toLong() ?: 0){
|
|
|
+ ToastUtils.showLong("起摘数量不能小于" + data.minivalue)
|
|
|
+ return@onThrottleFirstClick
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ if (type == "1"){
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
|
|
|
+ LadingBillId = selectSpotDetailsData.value?.ladingbillid?.toLong() ?: 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ SubNum = selectSpotDetailsData.value?.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(data),
|
|
|
+ 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
|
|
|
+ ){
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
|
|
|
+ LadingBillId = 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ SubNum = 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(data),
|
|
|
+ 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 = 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)
|
|
|
}
|
|
|
- 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)
|
|
|
+ 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)
|
|
|
}
|
|
|
- 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
|
|
|
}
|
|
|
- }.lparams(matchParent, autoSize(144)) {
|
|
|
- gravity = Gravity.BOTTOM
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
fun getWRTradeGoods(data: OrderQuoteData) : WarehouseTradeMI1.WRGoodsInfo{
|
|
|
@@ -910,6 +914,7 @@ class FloatBuyListedUI(
|
|
|
}
|
|
|
|
|
|
linearLayout {
|
|
|
+ LogUtils.aTag("aaaa", "aaaa:" + maxlistedNumber.toString())
|
|
|
textView {
|
|
|
text = "0"
|
|
|
textSizeAuto = 29
|
|
|
@@ -918,6 +923,7 @@ class FloatBuyListedUI(
|
|
|
|
|
|
emptyView()
|
|
|
|
|
|
+ maxlistedNumber.postValue(0)
|
|
|
textView {
|
|
|
maxlistedNumber.bindOptional(context){
|
|
|
text = it.toString() + data.enumdicname
|
|
|
@@ -993,9 +999,17 @@ class FloatBuyListedUI(
|
|
|
text = "--"
|
|
|
listed_price.bindOptional(context){
|
|
|
text = NumberUtils.roundNum(it ?: 0.0,2)
|
|
|
+
|
|
|
if (it != 0.0 && marginValue != 0.0){
|
|
|
- maxlistedNumber.postValue(viewModel.usedAccountData.value?.canUserAmount?.div(marginValue)?.div(it ?: 1.0)?.toInt())
|
|
|
+ var maxNumber = viewModel.usedAccountData.value?.canUserAmount?.div(marginValue)?.div(it ?: 1.0)?.toInt()
|
|
|
+ if (maxNumber != null) {
|
|
|
+ if (maxNumber < 0) { maxNumber = 0 }
|
|
|
+ }
|
|
|
+ maxlistedNumber.postValue(maxNumber)
|
|
|
+ } else {
|
|
|
+ maxlistedNumber.postValue(0)
|
|
|
}
|
|
|
+ LogUtils.aTag("aaaa", "aaaa:" + maxlistedNumber)
|
|
|
}
|
|
|
float_total_amount = this
|
|
|
textSizeAuto = 29
|
|
|
@@ -1136,7 +1150,7 @@ class FloatBuyListedUI(
|
|
|
}
|
|
|
gravity = Gravity.CENTER
|
|
|
backgroundResource = R.drawable.qhj_main_blue_bg
|
|
|
- text = "卖出"
|
|
|
+ text = "买入"
|
|
|
textSizeAuto = 38
|
|
|
textColorInt = R.color.white
|
|
|
}.lparams(autoSize(419), autoSize(119)) {
|