|
|
@@ -49,8 +49,9 @@ import org.jetbrains.anko.support.v4.viewPager
|
|
|
*/
|
|
|
fun AppCompatActivity.OneListedDialog(
|
|
|
activity: AppCompatActivity,
|
|
|
+ type: String,
|
|
|
viewModel: BusinessHallViewModel,
|
|
|
- data : OrderQuoteData
|
|
|
+ data: OrderQuoteData
|
|
|
): CustomDialogFragment {
|
|
|
|
|
|
lateinit var segment: QMUITabSegment
|
|
|
@@ -59,26 +60,26 @@ fun AppCompatActivity.OneListedDialog(
|
|
|
|
|
|
//一口价卖挂牌
|
|
|
val oneSellListedUI by lazy {
|
|
|
- OneSellListedUI(activity,viewModel,data)
|
|
|
+ OneSellListedUI(activity, viewModel, type, data)
|
|
|
}
|
|
|
|
|
|
//一口价买挂牌
|
|
|
val oneBuyListedUI by lazy {
|
|
|
- OneBuyListedUI(activity, viewModel,data)
|
|
|
+ OneBuyListedUI(activity, viewModel, type, data)
|
|
|
}
|
|
|
|
|
|
//viewpager的适配器
|
|
|
- var newPagerAdapter : PagerAdapter? = null
|
|
|
+ var newPagerAdapter: PagerAdapter? = null
|
|
|
|
|
|
//tabSegment标题
|
|
|
- val newTabsArray : ArrayList<String> = arrayListOf()
|
|
|
+ val newTabsArray: ArrayList<String> = arrayListOf()
|
|
|
|
|
|
//暂存的页面组
|
|
|
- val uiList : ArrayList<_FrameLayout> = arrayListOf()
|
|
|
+ val uiList: ArrayList<_FrameLayout> = arrayListOf()
|
|
|
|
|
|
- val selectIndex : MutableLiveData<Int> = MutableLiveData()
|
|
|
+ val selectIndex: MutableLiveData<Int> = MutableLiveData()
|
|
|
|
|
|
- fun initMenuData(){
|
|
|
+ fun initMenuData() {
|
|
|
|
|
|
newTabsArray.add("卖挂牌")
|
|
|
uiList.add(oneSellListedUI.root)
|
|
|
@@ -115,8 +116,8 @@ fun AppCompatActivity.OneListedDialog(
|
|
|
backgroundColor = Color.parseColor("#5f000000")
|
|
|
initMenuData()
|
|
|
verticalLayout {
|
|
|
- viewModel.controlDialogDisappear.bindOptional(context){
|
|
|
- if (it == true){
|
|
|
+ viewModel.controlDialogDisappear.bindOptional(context) {
|
|
|
+ if (it == true) {
|
|
|
dialog.dismiss()
|
|
|
viewModel.controlDialogDisappear.postValue(false)
|
|
|
}
|
|
|
@@ -158,7 +159,7 @@ fun AppCompatActivity.OneListedDialog(
|
|
|
|
|
|
segment.setupWithViewPager(viewPager)
|
|
|
segment.selectTab(1)
|
|
|
- }.lparams(matchParent, matchParent){
|
|
|
+ }.lparams(matchParent, matchParent) {
|
|
|
topMargin = autoSize(120)
|
|
|
}
|
|
|
}
|
|
|
@@ -168,24 +169,26 @@ fun AppCompatActivity.OneListedDialog(
|
|
|
class OneSellListedUI(
|
|
|
private val activity: AppCompatActivity,
|
|
|
private val viewModel: BusinessHallViewModel,
|
|
|
- data : OrderQuoteData
|
|
|
+ type: String,
|
|
|
+ data: OrderQuoteData
|
|
|
) {
|
|
|
//选择的现货仓单明细数据
|
|
|
- val selectSpotDetailsData : MutableLiveData<HoldLBData> = MutableLiveData()
|
|
|
+ val selectSpotDetailsData: MutableLiveData<HoldLBData> = MutableLiveData()
|
|
|
|
|
|
//选择的资金账号
|
|
|
- val selectAccountData : MutableLiveData<AccountData> = MutableLiveData()
|
|
|
+ val selectAccountData: MutableLiveData<AccountData> = MutableLiveData()
|
|
|
+
|
|
|
//挂牌价格输入
|
|
|
- lateinit var onePriceInputEdittext : MangeNumberEditText2
|
|
|
+ lateinit var onePriceInputEdittext: MangeNumberEditText2
|
|
|
|
|
|
//挂牌数量
|
|
|
- lateinit var oneNumberInputEdittext : MangeNumberEditText2
|
|
|
+ lateinit var oneNumberInputEdittext: MangeNumberEditText2
|
|
|
|
|
|
//起摘数量输入框
|
|
|
- lateinit var startInputNumber : EditText
|
|
|
+ lateinit var startInputNumber: EditText
|
|
|
|
|
|
//摘牌金额
|
|
|
- lateinit var one_delisting_amount : TextView
|
|
|
+ lateinit var one_delisting_amount: TextView
|
|
|
|
|
|
@SuppressLint("NewApi")
|
|
|
@RequiresApi(Build.VERSION_CODES.O)
|
|
|
@@ -196,7 +199,10 @@ class OneSellListedUI(
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
onThrottleFirstClick {
|
|
|
- activity.creatAccountDataSheetDialog("请选择资金账号", GlobalDataCollection.instance?.accountDataList ?: arrayListOf()) {
|
|
|
+ activity.creatAccountDataSheetDialog(
|
|
|
+ "请选择资金账号",
|
|
|
+ GlobalDataCollection.instance?.accountDataList ?: arrayListOf()
|
|
|
+ ) {
|
|
|
selectAccountData.postValue(this)
|
|
|
}
|
|
|
}
|
|
|
@@ -205,13 +211,13 @@ class OneSellListedUI(
|
|
|
text = "交易账户"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(autoSize(250), wrapContent)
|
|
|
|
|
|
textView {
|
|
|
- selectAccountData.bindOptional(context){
|
|
|
+ selectAccountData.bindOptional(context) {
|
|
|
text = it?.accountid.toString() + " " + it?.accountname
|
|
|
}
|
|
|
textSizeAuto = 34
|
|
|
@@ -231,24 +237,27 @@ class OneSellListedUI(
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
onThrottleFirstClick {
|
|
|
- activity.creatHnstSpotDetailSheetDialog("请选择资金账号", viewModel.detailsWarehouseContentDataList.value ?: arrayListOf()) {
|
|
|
+ activity.creatHnstSpotDetailSheetDialog(
|
|
|
+ "请选择现货仓单",
|
|
|
+ viewModel.detailsWarehouseContentDataList.value ?: arrayListOf()
|
|
|
+ ) {
|
|
|
selectSpotDetailsData.postValue(this)
|
|
|
}
|
|
|
}
|
|
|
linearLayout {
|
|
|
textView {
|
|
|
- text = "仓单现货明细"
|
|
|
+ text = "现货仓单"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(autoSize(250), wrapContent)
|
|
|
|
|
|
textView {
|
|
|
- text = "请选择仓单现货明细"
|
|
|
- selectSpotDetailsData.bindOptional(context){
|
|
|
- text = it?.deliverygoodsname
|
|
|
+ text = "请选择现货仓单"
|
|
|
+ selectSpotDetailsData.bindOptional(context) {
|
|
|
+ text = it?.ladingbillid + "(" + it?.enableqty + it?.enumdicname + ")"
|
|
|
}
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -271,22 +280,27 @@ class OneSellListedUI(
|
|
|
text = "挂牌价格"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.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()){
|
|
|
- one_delisting_amount.text = NumberUtils.roundNum(value.toString().toDouble().times(oneNumberInputEdittext.text.toString().toDouble()).toString(),2)
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+ if (oneNumberInputEdittext.text.toString().isNullOrEmpty().not()) {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ value.toString().toDouble()
|
|
|
+ .times(oneNumberInputEdittext.text.toString().toDouble())
|
|
|
+ .toString(), 2
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- }.lparams(0, autoSize(72),1f){
|
|
|
+ }.lparams(0, autoSize(72), 1f) {
|
|
|
marginEnd = autoSize(110)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(143))
|
|
|
@@ -299,7 +313,7 @@ class OneSellListedUI(
|
|
|
text = "挂牌数量"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
topMargin = autoSize(36)
|
|
|
}
|
|
|
@@ -310,16 +324,23 @@ class OneSellListedUI(
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
numberEditText {
|
|
|
+ text = "1"
|
|
|
oneNumberInputEdittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
- if (value.isNullOrEmpty().not()){
|
|
|
- if (onePriceInputEdittext.text.toString().isNullOrEmpty().not()){
|
|
|
- one_delisting_amount.text = NumberUtils.roundNum(value.toString().toDouble().times(onePriceInputEdittext.text.toString().toDouble()).toString(),2)
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()
|
|
|
+ .not()
|
|
|
+ ) {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ value.toString().toDouble().times(
|
|
|
+ onePriceInputEdittext.text.toString().toDouble()
|
|
|
+ ).toString(), 2
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- }.lparams(0, autoSize(72),1f){
|
|
|
+ }.lparams(0, autoSize(72), 1f) {
|
|
|
marginEnd = autoSize(36)
|
|
|
}
|
|
|
|
|
|
@@ -327,21 +348,21 @@ class OneSellListedUI(
|
|
|
text = "吨"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginEnd = autoSize(36)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(143))
|
|
|
|
|
|
- inflateLayout<SeekBar>(R.layout.main_seekbar) {
|
|
|
+ inflateLayout<SeekBar>(R.layout.main_seekbar) {
|
|
|
min = 10
|
|
|
max = 100
|
|
|
isIndeterminate = false
|
|
|
splitTrack = false
|
|
|
- setPadding(0,0,0,0)
|
|
|
- thumb = resources.getDrawable(R.mipmap.hnxt_seekbar)
|
|
|
+ setPadding(0, 0, 0, 0)
|
|
|
+ thumb = resources.getDrawable(R.mipmap.hnst_seekbar)
|
|
|
|
|
|
progressDrawable = resources.getDrawable(R.drawable.seekbar_bg)
|
|
|
- setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
|
|
+ setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
|
|
override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
|
|
|
|
|
|
}
|
|
|
@@ -354,7 +375,7 @@ class OneSellListedUI(
|
|
|
|
|
|
}
|
|
|
})
|
|
|
- }.lparams(matchParent, wrapContent){
|
|
|
+ }.lparams(matchParent, wrapContent) {
|
|
|
marginEnd = autoSize(110)
|
|
|
topMargin = autoSize(20)
|
|
|
}
|
|
|
@@ -373,7 +394,7 @@ class OneSellListedUI(
|
|
|
textSizeAuto = 29
|
|
|
textColorInt = R.color.rma_gray_color
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
|
- }.lparams(matchParent, wrapContent){
|
|
|
+ }.lparams(matchParent, wrapContent) {
|
|
|
marginEnd = autoSize(110)
|
|
|
topMargin = autoSize(10)
|
|
|
}
|
|
|
@@ -381,6 +402,8 @@ class OneSellListedUI(
|
|
|
}.lparams(matchParent, autoSize(290))
|
|
|
}.lparams(matchParent, autoSize(290))
|
|
|
|
|
|
+
|
|
|
+
|
|
|
itemView()
|
|
|
|
|
|
linearLayout {
|
|
|
@@ -390,7 +413,7 @@ class OneSellListedUI(
|
|
|
text = "起摘数量"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(autoSize(250), wrapContent)
|
|
|
@@ -406,14 +429,14 @@ class OneSellListedUI(
|
|
|
hintColorStr = "#CCCCCC"
|
|
|
textSizeAuto = 31
|
|
|
textColorStr = "#333333"
|
|
|
- }.lparams(0, autoSize(132),1f) {
|
|
|
+ }.lparams(0, autoSize(132), 1f) {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
text = "吨"
|
|
|
textSizeAuto = 31
|
|
|
- textColorInt = R.color.rma_black_33
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginEnd = autoSize(36)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(100))
|
|
|
@@ -435,17 +458,30 @@ class OneSellListedUI(
|
|
|
text = "挂牌金额"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(autoSize(214), wrapContent){
|
|
|
+ }.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 {
|
|
|
@@ -453,54 +489,84 @@ class OneSellListedUI(
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
|
- if (selectSpotDetailsData.value?.deliverygoodsid.isNullOrEmpty()){
|
|
|
+ if (selectSpotDetailsData.value?.deliverygoodsid.isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请选择现货仓单明细")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- if (onePriceInputEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入挂牌价格")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- if (onePriceInputEdittext.text.toString().toDouble() == 0.0){
|
|
|
+ if (onePriceInputEdittext.text.toString().toDouble() == 0.0) {
|
|
|
ToastUtils.showLong("挂牌价格不能为零")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
|
|
|
- if (oneNumberInputEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ if (oneNumberInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入挂牌数量")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- if (oneNumberInputEdittext.text.toString().toDouble() == 0.0){
|
|
|
+ if (oneNumberInputEdittext.text.toString().toDouble() == 0.0) {
|
|
|
ToastUtils.showLong("挂牌数量不能为零")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
val selectDetailsData = selectSpotDetailsData.value
|
|
|
- viewModel.requeryWRListingOrderReq(
|
|
|
- LadingBillId = selectDetailsData?.ladingbillid?.toLong() ?: 0,
|
|
|
- SubNum = selectDetailsData?.subnum?.toLong() ?: 0,
|
|
|
- TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
- WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 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,
|
|
|
- WRStandardID = data.wrstandardid?.toInt() ?: 0
|
|
|
- ){
|
|
|
- viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ if (type == "1") {
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ LadingBillId = selectDetailsData?.ladingbillid?.toLong() ?: 0,
|
|
|
+ SubNum = selectDetailsData?.subnum?.toLong() ?: 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 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,
|
|
|
+ WRStandardID = data.wrstandardid?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ LadingBillId = selectDetailsData?.ladingbillid?.toLong() ?: 0,
|
|
|
+ SubNum = selectDetailsData?.subnum?.toLong() ?: 0,
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 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,
|
|
|
+ WRStandardID = data.wrstandardid?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
gravity = Gravity.CENTER
|
|
|
backgroundResource = R.drawable.qhj_main_blue_bg
|
|
|
@@ -534,23 +600,25 @@ class OneSellListedUI(
|
|
|
class OneBuyListedUI(
|
|
|
private val activity: AppCompatActivity,
|
|
|
private val viewModel: BusinessHallViewModel,
|
|
|
- data : OrderQuoteData
|
|
|
+ type: String,
|
|
|
+ data: OrderQuoteData
|
|
|
) {
|
|
|
|
|
|
//选择的资金账号
|
|
|
- val selectAccountData : MutableLiveData<AccountData> = MutableLiveData()
|
|
|
+ val selectAccountData: MutableLiveData<AccountData> = MutableLiveData()
|
|
|
|
|
|
//挂牌价格输入
|
|
|
- lateinit var onePriceInputEdittext : MangeNumberEditText2
|
|
|
+ lateinit var onePriceInputEdittext: MangeNumberEditText2
|
|
|
|
|
|
//挂牌数量
|
|
|
- lateinit var oneNumberInputEdittext : MangeNumberEditText2
|
|
|
+ lateinit var oneNumberInputEdittext: MangeNumberEditText2
|
|
|
|
|
|
//起摘数量输入框
|
|
|
- lateinit var startInputNumber : EditText
|
|
|
+ lateinit var startInputNumber: EditText
|
|
|
|
|
|
//挂牌金额
|
|
|
- lateinit var one_delisting_amount : TextView
|
|
|
+ lateinit var one_delisting_amount: TextView
|
|
|
+
|
|
|
@RequiresApi(Build.VERSION_CODES.O)
|
|
|
val root = _FrameLayout(activity).apply {
|
|
|
verticalLayout {
|
|
|
@@ -559,22 +627,25 @@ class OneBuyListedUI(
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
onThrottleFirstClick {
|
|
|
- activity.creatAccountDataSheetDialog("请选择资金账号", GlobalDataCollection.instance?.accountDataList ?: arrayListOf()) {
|
|
|
- selectAccountData.postValue(this)
|
|
|
- }
|
|
|
+ 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){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(autoSize(250), wrapContent)
|
|
|
|
|
|
textView {
|
|
|
- selectAccountData.bindOptional(context){
|
|
|
+ selectAccountData.bindOptional(context) {
|
|
|
text = it?.accountid.toString() + " " + it?.accountname
|
|
|
}
|
|
|
textSizeAuto = 34
|
|
|
@@ -595,25 +666,30 @@ class OneBuyListedUI(
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
linearLayout {
|
|
|
textView {
|
|
|
- text = "基 差"
|
|
|
+ text = "挂牌价格"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.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()){
|
|
|
- one_delisting_amount.text = NumberUtils.roundNum(value.toString().toDouble().times(oneNumberInputEdittext.text.toString().toDouble()).toString(),2)
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+ if (oneNumberInputEdittext.text.toString().isNullOrEmpty().not()) {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ value.toString().toDouble()
|
|
|
+ .times(oneNumberInputEdittext.text.toString().toDouble())
|
|
|
+ .toString(), 2
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- }.lparams(0, autoSize(72),1f){
|
|
|
+ }.lparams(0, autoSize(72), 1f) {
|
|
|
marginEnd = autoSize(110)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(143))
|
|
|
@@ -626,7 +702,7 @@ class OneBuyListedUI(
|
|
|
text = "挂牌数量"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
topMargin = autoSize(36)
|
|
|
}
|
|
|
@@ -636,15 +712,22 @@ class OneBuyListedUI(
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
numberEditText {
|
|
|
+ text = "1"
|
|
|
oneNumberInputEdittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
- if (value.isNullOrEmpty().not()){
|
|
|
- if (onePriceInputEdittext.text.toString().isNullOrEmpty().not()){
|
|
|
- one_delisting_amount.text = NumberUtils.roundNum(value.toString().toDouble().times(onePriceInputEdittext.text.toString().toDouble()).toString(),2)
|
|
|
+ if (value.isNullOrEmpty().not()) {
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()
|
|
|
+ .not()
|
|
|
+ ) {
|
|
|
+ one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
+ value.toString().toDouble().times(
|
|
|
+ onePriceInputEdittext.text.toString().toDouble()
|
|
|
+ ).toString(), 2
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }.lparams(0, autoSize(72),1f){
|
|
|
+ }.lparams(0, autoSize(72), 1f) {
|
|
|
marginEnd = autoSize(36)
|
|
|
}
|
|
|
|
|
|
@@ -652,20 +735,20 @@ class OneBuyListedUI(
|
|
|
text = "吨"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginEnd = autoSize(36)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(143))
|
|
|
|
|
|
- inflateLayout<SeekBar>(R.layout.main_seekbar) {
|
|
|
+ inflateLayout<SeekBar>(R.layout.main_seekbar) {
|
|
|
min = 10
|
|
|
max = 100
|
|
|
isIndeterminate = false
|
|
|
splitTrack = false
|
|
|
- setPadding(0,0,0,0)
|
|
|
- thumb = resources.getDrawable(R.mipmap.hnxt_seekbar)
|
|
|
+ setPadding(0, 0, 0, 0)
|
|
|
+ thumb = resources.getDrawable(R.mipmap.hnst_seekbar)
|
|
|
progressDrawable = resources.getDrawable(R.drawable.seekbar_bg)
|
|
|
- setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
|
|
+ setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
|
|
override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
|
|
|
|
|
|
}
|
|
|
@@ -678,7 +761,7 @@ class OneBuyListedUI(
|
|
|
|
|
|
}
|
|
|
})
|
|
|
- }.lparams(matchParent, autoSize(46)){
|
|
|
+ }.lparams(matchParent, wrapContent) {
|
|
|
marginEnd = autoSize(110)
|
|
|
topMargin = autoSize(20)
|
|
|
}
|
|
|
@@ -697,7 +780,7 @@ class OneBuyListedUI(
|
|
|
textSizeAuto = 29
|
|
|
textColorInt = R.color.rma_gray_color
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
|
- }.lparams(matchParent, wrapContent){
|
|
|
+ }.lparams(matchParent, wrapContent) {
|
|
|
marginEnd = autoSize(110)
|
|
|
topMargin = autoSize(10)
|
|
|
}
|
|
|
@@ -714,7 +797,7 @@ class OneBuyListedUI(
|
|
|
text = "起摘数量"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(autoSize(250), wrapContent)
|
|
|
@@ -730,7 +813,7 @@ class OneBuyListedUI(
|
|
|
hintColorStr = "#CCCCCC"
|
|
|
textSizeAuto = 31
|
|
|
textColorStr = "#333333"
|
|
|
- }.lparams(0, autoSize(132),1f) {
|
|
|
+ }.lparams(0, autoSize(132), 1f) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -738,7 +821,7 @@ class OneBuyListedUI(
|
|
|
text = "吨"
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginEnd = autoSize(36)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(100))
|
|
|
@@ -761,17 +844,30 @@ class OneBuyListedUI(
|
|
|
text = "挂牌金额"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
- }.lparams(autoSize(214), wrapContent){
|
|
|
+ }.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 {
|
|
|
@@ -779,48 +875,75 @@ class OneBuyListedUI(
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
|
- if (onePriceInputEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入挂牌价格")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- if (onePriceInputEdittext.text.toString().toDouble() == 0.0){
|
|
|
+ if (onePriceInputEdittext.text.toString().toDouble() == 0.0) {
|
|
|
ToastUtils.showLong("挂牌价格不能为零")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
|
|
|
- if (oneNumberInputEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ if (oneNumberInputEdittext.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入挂牌数量")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- if (oneNumberInputEdittext.text.toString().toDouble() == 0.0){
|
|
|
+ if (oneNumberInputEdittext.text.toString().toDouble() == 0.0) {
|
|
|
ToastUtils.showLong("挂牌数量不能为零")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
-
|
|
|
- viewModel.requeryWRListingOrderReq(
|
|
|
- TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
- WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 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,
|
|
|
- CanBargain = 0,
|
|
|
- ApplyID = 0,
|
|
|
- CanPart = 1,
|
|
|
- HasWr = 1,
|
|
|
- WRStandardID = data.wrstandardid?.toInt() ?: 0
|
|
|
- ){
|
|
|
- viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ if (type == "1") {
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 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,
|
|
|
+ CanBargain = 0,
|
|
|
+ ApplyID = 0,
|
|
|
+ CanPart = 1,
|
|
|
+ HasWr = 1,
|
|
|
+ WRStandardID = data.wrstandardid?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ viewModel.requeryWRListingOrderReq(
|
|
|
+ TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
|
|
|
+ WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 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,
|
|
|
+ CanBargain = 0,
|
|
|
+ ApplyID = 0,
|
|
|
+ CanPart = 1,
|
|
|
+ HasWr = 0,
|
|
|
+ WRStandardID = data.wrstandardid?.toInt() ?: 0
|
|
|
+ ) {
|
|
|
+ viewModel.controlDialogDisappear.postValue(true)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
gravity = Gravity.CENTER
|
|
|
backgroundResource = R.drawable.qhj_main_blue_bg
|
|
|
@@ -848,7 +971,7 @@ class OneBuyListedUI(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun check() : Boolean{
|
|
|
+ fun check(): Boolean {
|
|
|
|
|
|
|
|
|
return true
|