Jelajahi Sumber

风险管理8月12日提交代码-liu.bolan-云融大宗

Liu.bolan 4 tahun lalu
induk
melakukan
1dfa8b557d
39 mengubah file dengan 4527 tambahan dan 188 penghapusan
  1. 54 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/financial/FinancialManager.kt
  2. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/global/StringUtils.kt
  3. 2 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/AreaExpourseContractDetailData.kt
  4. 73 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/WrBuybackDetailData.kt
  5. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/WrFinanceBuyApplyData.kt
  6. 81 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/WrScfContractInterestData.kt
  7. 2 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/autoWidget/dialog/Dialog.kt
  8. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/app/Constant.kt
  9. 6 6
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/exposure/ExposurePositionDetailsViewholder.kt
  10. 0 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/FutureFragment.kt
  11. 6 8
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstcdys/CdysWarehouseScreeningDialog.kt
  12. 32 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstcdys/HnstcdysFragment.kt
  13. 325 24
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstcdys/HnstcdysViewModel.kt
  14. 1140 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstcdys/dialog/HnstFloatListedDialog.kt
  15. 999 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstcdys/dialog/HnstOneListedDialog.kt
  16. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/bookingwarehouse/adapter/BookingAreCancelContentAdapter.java
  17. 4 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/ContractOrdersActivity.kt
  18. 33 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/finance/FinanceManagementViewModel.kt
  19. 83 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/finance/FinancePayalanceActivity.kt
  20. 89 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/finance/FinancePayalanceViewHolder.kt
  21. 24 17
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/finance/FinanceRepoActivity.kt
  22. 67 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/finance/FinanceRepoViewHolder.kt
  23. 3 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/SpotWareHouseActivity.kt
  24. 3 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/SpotWareHouseViewModel.kt
  25. 4 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/adapter/PickUpContentAdapter.java
  26. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/reportdetail/ReportCommonDetailsViewModel.kt
  27. 6 6
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/BusinessHallActivity.kt
  28. 25 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/BusinessHallViewModel.kt
  29. 39 10
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/FloatListedDialog.kt
  30. 61 23
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/OneListedDialog.kt
  31. 9 8
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/WarehouseReceiptFragment.kt
  32. 125 25
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/WarehouseReceiptViewModel.kt
  33. 5 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/WarehouseScreeningDialog.kt
  34. 35 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/ListedData.kt
  35. 35 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/ListedNoWrfactortypeidActivity.kt
  36. 12 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/ListedNoWrfactortypeidViewModel.kt
  37. 1102 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/WarehouseFloatListedDialog.kt
  38. 34 33
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/WarehouseOneListedDialog.kt
  39. 2 1
      RMA/app/src/main/res/layout/layout_item_hnst_content.xml

+ 54 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/financial/FinancialManager.kt

@@ -186,6 +186,60 @@ class FinancialManager {
         )
     }
 
+    /**
+     * 查询仓单回购明细
+     * @param params Map<String, String>
+     * @param responseBack Function3<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] List<FinancialManageData>?, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun queryWrBuybackDetail(
+        params: Map<String, String>,
+        responseBack: (isSuccess: Boolean, respData: List<WrBuybackDetailData>?, error: Error?) -> Unit
+    ) {
+        MyOkHttpUtils().query(
+            URL = SPUtils.getInstance()
+                .getString(Constant.goCommonSearchUrl) + "/WrTrade2/QueryWrBuybackDetail",
+            params = params,
+            type = "1",
+            callback = object : ResponseCallback<BaseResult<List<WrBuybackDetailData>>>() {
+                override fun onResponse(response: BaseResult<List<WrBuybackDetailData>>?, id: Int) {
+                    responseBack(true, response?.data, null)
+                }
+
+                override fun onError(call: Call?, e: Exception?, id: Int) {
+                    responseBack(false, null, Error(e?.message))
+                }
+
+            }
+        )
+    }
+
+    /**
+     * 查询融资合同费用明细
+     * @param params Map<String, String>
+     * @param responseBack Function3<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] List<FinancialManageData>?, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun queryWrScfContractInterest(
+        params: Map<String, String>,
+        responseBack: (isSuccess: Boolean, respData: List<WrScfContractInterestData>?, error: Error?) -> Unit
+    ) {
+        MyOkHttpUtils().query(
+            URL = SPUtils.getInstance()
+                .getString(Constant.goCommonSearchUrl) + "/WrTrade2/QueryWrScfContractInterest",
+            params = params,
+            type = "1",
+            callback = object : ResponseCallback<BaseResult<List<WrScfContractInterestData>>>() {
+                override fun onResponse(response: BaseResult<List<WrScfContractInterestData>>?, id: Int) {
+                    responseBack(true, response?.data, null)
+                }
+
+                override fun onError(call: Call?, e: Exception?, id: Int) {
+                    responseBack(false, null, Error(e?.message))
+                }
+
+            }
+        )
+    }
+
 
     /**
      * 查询融资购买申请

+ 1 - 1
RMA/app/src/main/java/cn/muchinfo/rma/global/StringUtils.kt

@@ -155,7 +155,7 @@ fun String.performancestatus() : String{
     var str = ""
     when {
         this == "1" -> {
-            str = "初始化"
+            str = "待激活"//bug 97298
         }
         this == "2" -> {
             str = "正常"

+ 2 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/data/AreaExpourseContractDetailData.kt

@@ -20,6 +20,8 @@ data class AreaExpourseContractDetailData(
     val curqty : String = "",//今定价量
     @SerializedName("deliverygoodsid")
     val deliverygoodsid : String = "",//现货商品id
+    @SerializedName("mgunitname")
+    val mgunitname : String = "",//套保品种单位名称
     @SerializedName("diffqty")
     val diffqty : String = "",//套保品种今变动量
     @SerializedName("enumdicname")

+ 73 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/data/WrBuybackDetailData.kt

@@ -0,0 +1,73 @@
+package cn.muchinfo.rma.global.data
+
+import android.os.Parcel
+import android.os.Parcelable
+import com.google.gson.annotations.SerializedName
+
+/**
+ * 仓单回购明细
+ */
+data class WrBuybackDetailData(
+    @SerializedName("buybackamount")
+    val buybackamount : String? = "",//回购金额
+    @SerializedName("buybackqty")
+    val buybackqty:  String? = "",//回购数量
+    @SerializedName("buybackreleasemargin")
+    val buybackreleasemargin : String? = "",//回购释放保证金
+    @SerializedName("buybacktime")
+    val buybacktime:  String? = "",//回购时间
+    @SerializedName("errordesc")
+    val errordesc:  String? = "",//错误描述
+    @SerializedName("handlestatus")
+    val handlestatus : String? = "",//处理 - 1:待处理 2:处理成功 3:处理失败
+    @SerializedName("relatedwrid")
+    val relatedwrid:  String? = "",//关联仓单ID
+    @SerializedName("scfcontractid")
+    val scfcontractid:  String? = "",//SCF合同ID
+    @SerializedName("scfwrbuybackid")
+    val scfwrbuybackid: String? = "",//SCF仓单回购明细ID(312+Unix秒时间戳(10位)+xxxxxx)
+    @SerializedName("tradedate")
+    val tradedate:  String? = ""//交易日(yyyyMMdd)
+) : Parcelable{
+    constructor(parcel: Parcel) : this(
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString()
+    ) {
+    }
+
+    override fun writeToParcel(parcel: Parcel, flags: Int) {
+        parcel.writeString(buybackamount)
+        parcel.writeString(buybackqty)
+        parcel.writeString(buybackreleasemargin)
+        parcel.writeString(buybacktime)
+        parcel.writeString(errordesc)
+        parcel.writeString(handlestatus)
+        parcel.writeString(relatedwrid)
+        parcel.writeString(scfcontractid)
+        parcel.writeString(scfwrbuybackid)
+        parcel.writeString(tradedate)
+    }
+
+    override fun describeContents(): Int {
+        return 0
+    }
+
+    companion object CREATOR : Parcelable.Creator<WrBuybackDetailData> {
+        override fun createFromParcel(parcel: Parcel): WrBuybackDetailData {
+            return WrBuybackDetailData(parcel)
+        }
+
+        override fun newArray(size: Int): Array<WrBuybackDetailData?> {
+            return arrayOfNulls(size)
+        }
+    }
+
+}

+ 1 - 1
RMA/app/src/main/java/cn/muchinfo/rma/global/data/WrFinanceBuyApplyData.kt

@@ -85,7 +85,7 @@ data class WrFinanceBuyApplyData(
     @SerializedName("productid")
     val productid: String? = "",//金融产品ID
     @SerializedName("productname")
-    val productname: String? = "",//产品名称
+    val productname: String? = "",//融资产品名称
     @SerializedName("remark")
     val remark:  String? = "",//备注
     @SerializedName("scfcontractid")

+ 81 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/data/WrScfContractInterestData.kt

@@ -0,0 +1,81 @@
+package cn.muchinfo.rma.global.data
+
+import android.os.Parcel
+import android.os.Parcelable
+import com.google.gson.annotations.SerializedName
+
+/**
+ * 融资合同费用明细
+ */
+data class WrScfContractInterestData(
+    @SerializedName("closeinterest")
+    val closeinterest : String? = "",//已结利息
+    @SerializedName("closeintereststatus")
+    val closeintereststatus : String? = "",//结息状态 - 1:未结 2:已结
+    @SerializedName("closetime")
+    val closetime : String? = "",//结息时间
+    @SerializedName("closetradedate")
+    val closetradedate : String? = "",//结息交易日
+    @SerializedName("creatorid")
+    val creatorid : String? = "",//操作人ID
+    @SerializedName("dayrate")
+    val dayrate : String? = "",//日利率(根据利率配置计算出的日利率值,年利率则除以360,保留5位小数)
+    @SerializedName("interest")
+    val interest : String? = "",//利息
+    @SerializedName("interestamount")
+    val interestamount : String? = "",//计息金额
+    @SerializedName("interestday")
+    val interestday : String? = "",//计息日(yyyyMMdd)
+    @SerializedName("scfcontractid")
+    val scfcontractid :String? = "",//SCF合同ID
+    @SerializedName("scfcontractinterestid")
+    val scfcontractinterestid : String? = "",//SCF合同计息ID(313+Unix秒时间戳(10位)+xxxxxx)
+    @SerializedName("updatetime")
+    val updatetime : String? = ""//更新时间
+) : Parcelable{
+    constructor(parcel: Parcel) : this(
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString()
+    ) {
+    }
+
+    override fun writeToParcel(parcel: Parcel, flags: Int) {
+        parcel.writeString(closeinterest)
+        parcel.writeString(closeintereststatus)
+        parcel.writeString(closetime)
+        parcel.writeString(closetradedate)
+        parcel.writeString(creatorid)
+        parcel.writeString(dayrate)
+        parcel.writeString(interest)
+        parcel.writeString(interestamount)
+        parcel.writeString(interestday)
+        parcel.writeString(scfcontractid)
+        parcel.writeString(scfcontractinterestid)
+        parcel.writeString(updatetime)
+    }
+
+    override fun describeContents(): Int {
+        return 0
+    }
+
+    companion object CREATOR : Parcelable.Creator<WrScfContractInterestData> {
+        override fun createFromParcel(parcel: Parcel): WrScfContractInterestData {
+            return WrScfContractInterestData(parcel)
+        }
+
+        override fun newArray(size: Int): Array<WrScfContractInterestData?> {
+            return arrayOfNulls(size)
+        }
+    }
+
+}

+ 2 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/autoWidget/dialog/Dialog.kt

@@ -288,7 +288,7 @@ fun AppCompatActivity.creatHnstSpotDetailSheetDialog(
         .setTitle(titleStr)
         .setAddCancelBtn(true)
     selectList.forEach {
-        builder.addItem(it.wrfactortypeid.toString() + "(" + it.enableqty + it.enumdicname + ")")
+        builder.addItem(it.ladingbillid.toString() + "(" + it.enableqty + it.enumdicname + ")")
     }
     builder.setOnSheetItemClickListener { dialog, itemView, position, tag ->
         select?.invoke(selectList.get(position))
@@ -553,6 +553,7 @@ fun Dialog.autoDismissAfterShow(
 data class SelectData(
     var id: String,//现货商品id
     var value: String,
+    var goodsCode : String = "",//用于选择商品时写入code
     var goodsgroupid : String = "",//商品组id
     var deliverygoodsid: String = "",//现货合同中的现货品种id
     var areauserid: String = "",//现货areauserid

+ 2 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/app/Constant.kt

@@ -16,12 +16,12 @@ object Constant {
 //     const val baseurl = "http://192.168.31.101:8080/cfg?key=test_101"//李倩千海金 18611112222
 
 //     const val baseurl = "http://192.168.31.107:8080/cfg?key=test_107"//李倩千海金 18611112222
-      const val baseurl = "http://192.168.30.211:8080/cfg?key=test_211"// 瑶姐 130000000001 123456
+//      const val baseurl = "http://192.168.30.211:8080/cfg?key=test_211"// 瑶姐 130000000001 123456
 //          const val baseurl = "http://192.168.31.107:8080/cfg?key=test_107"// 瑶姐 千海金 13760119855
 
 //    const val baseurl = "http://192.168.31.175:8080/cfg?key=test_175" // 8888  123123
 //    const val baseurl = "http://192.168.31.223:8080/cfg?key=test_223"
-//    const val baseurl = "http://192.168.31.174:8080/cfg?key=test_174"// 邓工
+    const val baseurl = "http://192.168.31.174:8080/cfg?key=test_174"// 邓工
 
 //     const val baseurl = "http://192.168.31.176:8080/cfg?key=test_176" // 9999  123123  黄老板千海金
 //    const val baseurl = "http://192.168.31.171:8080/cfg?key=test_171" // 邓工 签约解约环境

+ 6 - 6
RMA/app/src/main/java/cn/muchinfo/rma/view/base/exposure/ExposurePositionDetailsViewholder.kt

@@ -41,7 +41,7 @@ class ExposurePositionDetailsViewholder(
                         }
                     }
                     textColorInt = R.color.rma_black_33
-                    textSizeAuto = 24
+                    textSizeAuto = 27
                 }.lparams(wrapContent, wrapContent){
                     topMargin = autoSize(20)
 
@@ -55,7 +55,7 @@ class ExposurePositionDetailsViewholder(
                         }
                     }
                     textColorInt = R.color.rma_black_33
-                    textSizeAuto = 24
+                    textSizeAuto = 27
                 }.lparams(wrapContent, wrapContent)
             }.lparams(autoSize(225), autoSize(92))
 
@@ -70,7 +70,7 @@ class ExposurePositionDetailsViewholder(
                         }
                     }
                     textColorInt = R.color.rma_black_33
-                    textSizeAuto = 24
+                    textSizeAuto = 27
                 }.lparams(wrapContent, wrapContent)
             }.lparams(autoSize(225), autoSize(92))
 
@@ -85,7 +85,7 @@ class ExposurePositionDetailsViewholder(
                         }
                     }
                     textColorInt = R.color.rma_black_33
-                    textSizeAuto = 24
+                    textSizeAuto = 27
                 }.lparams(wrapContent, wrapContent)
 
             }.lparams(autoSize(225), autoSize(92))
@@ -97,11 +97,11 @@ class ExposurePositionDetailsViewholder(
                         if (type == "1"){
                             text = it?.qty + it?.enumdicname
                         }else{
-                            text = it?.tradeqty
+                            text = it?.tradeqty + "手"
                         }
                     }
                     textColorInt = R.color.rma_black_33
-                    textSizeAuto = 24
+                    textSizeAuto = 27
                 }.lparams(wrapContent, wrapContent){
                     marginEnd = autoSize(36)
                     topMargin = autoSize(30)

+ 0 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/FutureFragment.kt

@@ -147,13 +147,10 @@ class FutureFragment : BaseFragment<FutureViewModel>() {
     }
 
     fun refrashAccount() {
-
         viewModel.initAccountData()//初始化页面时进行一次资金账号的拿取
-
     }
 
     private fun initViews() {
-
         idTab = _view?.findViewById(R.id.id_tab)
         idPager = _view?.findViewById(R.id.id_pager)
         idHead = _view?.findViewById(R.id.id_head)

+ 6 - 8
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstcdys/CdysWarehouseScreeningDialog.kt

@@ -52,7 +52,7 @@ fun AppCompatActivity.CdysScreeningDialog(
 
     lateinit var warehouseRecycview: RecyclerView
 
-    return createCustomDialog(cancelable = false) { dialog ->
+    return createCustomDialog(cancelable = true) { dialog ->
         backgroundColor = Color.parseColor("#5f000000")
 
         verticalLayout {
@@ -280,8 +280,10 @@ fun AppCompatActivity.CdysScreeningDialog(
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
                         onThrottleFirstClick {
+                            viewModel.queryOneOrderQuote()
+                            viewModel.queryFloatOrderQuote()
                             dialog.dismiss()
-                            viewModel.selectWrFtWrstandardData.postValue(WrFtWrstandard())
+                            viewModel.resetSelectContent()
                         }
                         backgroundResource = R.drawable.rma_item_click_bg
                         gravity = Gravity.CENTER
@@ -342,12 +344,8 @@ fun AppCompatActivity.CdysScreeningDialog(
                                     return@onThrottleFirstClick
                                 }
                             }
-                            if (viewModel.getSelectWarehouseOrFactoryid("2")
-                                    .split(",").size < viewModel.WrStandardFactoryItemDataList.value?.size?.minus(
-                                    1
-                                ) ?: 0
-                            ) {
-                                ToastUtils.showLong("请选择必要要素")
+                            if (viewModel.getSelectBooble().not()){
+                                ToastUtils.showLong("挂牌时每个属性都需要选择一个具体的选项")
                                 return@onThrottleFirstClick
                             }
                             if (type == "1") {

+ 32 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstcdys/HnstcdysFragment.kt

@@ -13,9 +13,12 @@ import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.lifecycle.getAppCompatActivity
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.hnstcdys.dialog.HnstFloatListedDialog
+import cn.muchinfo.rma.view.base.hnstcdys.dialog.HnstOneListedDialog
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
 import cn.muchinfo.rma.view.base.warehousereceipt.BusinessHallActivity
+import cn.muchinfo.rma.view.base.warehousereceipt.dialog.ListedData
 import cn.muchinfo.rma.view.base.warehousereceipt.floata.FloatPriceAdapter
 import cn.muchinfo.rma.view.base.warehousereceipt.one.OnePriceAdapter
 import com.blankj.utilcode.util.ActivityUtils
@@ -26,6 +29,8 @@ import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
 import com.qmuiteam.qmui.widget.tab.QMUITabSegment
 import io.reactivex.Flowable
 import io.reactivex.disposables.Disposable
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
 import org.jetbrains.anko.*
 import org.jetbrains.anko.support.v4.UI
 import org.jetbrains.anko.support.v4.viewPager
@@ -100,12 +105,19 @@ class HnstcdysFragment : BaseFragment<HnstcdysViewModel>(){
         mdDisposable = Flowable.interval(5, 10, TimeUnit.SECONDS)
             .doOnNext {
                 if (selectedTabIndex == 0){
-                    viewModel.queryOneOrderQuote()
+                    viewModel.queryOneOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid
+                        ?: "",
+                        warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),
+                        dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
                 }else{
-                    viewModel.queryFloatOrderQuote()
+                    viewModel.queryFloatOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid
+                        ?: "",
+                        warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),
+                        dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
                 }
             }.subscribe()
         return UI {
+            createLoadingDialog(hintStr = "").bindTaskStatus(context!!, viewModel.loadingDialogStatus)
             verticalLayout {
                 viewModel.queryFtDeliveryGoods()
                 viewModel.orderQuoteDataByListed.bindOptional(context){
@@ -119,6 +131,16 @@ class HnstcdysFragment : BaseFragment<HnstcdysViewModel>(){
                         ActivityUtils.startActivity(intent)
                     }
                 }
+
+                 viewModel.noWRFactorTypeIdDataForListed.bindOptional(context){
+                    if (it?.DeliveryGoodsID.isNullOrEmpty().not()){
+                        if (selectedTabIndex == 0){//一口价
+                            getAppCompatActivity().HnstOneListedDialog(activity = getAppCompatActivity(),viewModel = viewModel,type = "2",data = it ?: ListedData()).show()
+                        }else{//浮动价
+                            getAppCompatActivity().HnstFloatListedDialog(activity = getAppCompatActivity(),viewModel = viewModel,type = "2",data = it ?: ListedData()).show()
+                        }
+                    }
+                }
                 linearLayout {
                     background = resources.getDrawable(R.color.main_title_bg_color)
                     gravity = Gravity.CENTER_VERTICAL
@@ -227,7 +249,10 @@ class YSOnePriceUI(private val fragment : Fragment, private val viewModel: Hnstc
 
     val root = _FrameLayout(fragment.context!!).apply {
         verticalLayout {
-            viewModel.queryOneOrderQuote()
+            viewModel.queryOneOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid
+                ?: "",
+                warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),
+                dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
             linearLayout {
                 linearLayout {
                     gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
@@ -388,7 +413,10 @@ class YSFloatingPriceUI(private val fragment : Fragment, private val viewModel:
 
     val root = _FrameLayout(fragment.context!!).apply {
         verticalLayout {
-            viewModel.queryFloatOrderQuote()
+            viewModel.queryFloatOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid
+                ?: "",
+                warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),
+                dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
             linearLayout {
                 linearLayout {
                     gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL

+ 325 - 24
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstcdys/HnstcdysViewModel.kt

@@ -4,23 +4,35 @@ import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.global.database.DataBase
+import cn.muchinfo.rma.netManage.base.InteractiveException
+import cn.muchinfo.rma.protobuf.protoclasses.WarehouseTradeMI1
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
+import cn.muchinfo.rma.view.base.warehousereceipt.dialog.ListedData
+import com.blankj.utilcode.util.LogUtils
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
 import mtp.polymer.com.autowidget.dialog.SelectData
+import mtp.polymer.com.autowidget.utils.TaskUiModel
 
 /**
  * 华南顺通 仓单预售viewmodel
  */
 class HnstcdysViewModel : BaseViewModel(){
 
+    /**
+     * 加载状态控制
+     */
+    val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
+
     //一口价报价牌数据
     val onePrcieDataList : MutableLiveData<List<OrderQuoteData>> = MutableLiveData()
 
     //浮动价报价牌数据
     val floatProceDataList : MutableLiveData<List<OrderQuoteData>> = MutableLiveData()
 
-
-
+    //用于控制挂牌弹窗的消失 当值设置为true时,控制dialog隐藏
+    val controlDialogDisappear : MutableLiveData<Boolean> = MutableLiveData<Boolean>().apply { value = false }
 
     //品种品类筛选框列表
     val ftDeliveryGoodsDataList : MutableLiveData<List<FtDeliveryGoodsData>> = MutableLiveData()
@@ -40,22 +52,64 @@ class HnstcdysViewModel : BaseViewModel(){
     val goodsInfoList : MutableLiveData<List<SelectData>> = MutableLiveData()
     //选择的期货合约实体
     val selectGoodsInfoData : MutableLiveData<SelectData> = MutableLiveData()
+    /**
+     * 当前选择的资金账户
+     */
+    val usedAccountData : MutableLiveData<AccountData> = MutableLiveData()
+
+    /**
+     * 交易页面的当前商品的盘面信息
+     */
+    val quoteDayData: MutableLiveData<QuoteDayData> = MutableLiveData()
+
+    //点击挂牌后若找不到相应的信息则组装无仓单要素id的挂牌信息
+    val noWRFactorTypeIdDataForListed : MutableLiveData<ListedData> = MutableLiveData()
+
+    /**
+     * 在无仓单预售下的情况下查询是否有相应的预售仓单持仓
+     */
+    val summaryWrPositionDataByDialog : MutableLiveData<HnstWrPositionData> = MutableLiveData()
+    /**
+     * 查询相应要素下的预售仓单
+     */
+    fun queryorderSummaryWrPosition(deliverygoodsid : String = "",warehouseid : String = "",wrstandardid : String = "",dgitemname : String = ""){
+        val params = mutableMapOf<String,String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+            put("querytype","2")
+            put("haswr","0")
+            put("deliverygoodsid",deliverygoodsid)
+            put("warehouseid",warehouseid)
+            put("wrstandardid",wrstandardid)
+            put("dgitemname",dgitemname)
+        }
+        MyApplication.getInstance()?.warehouseManager?.queryWrPosition(params = params){ isSuccess, respData, error ->
+            if (isSuccess){
+                if (respData?.isNotEmpty() == true){
+                    summaryWrPositionDataByDialog.postValue(respData.get(0))
+                }
+            }
+        }
+    }
 
     //获取选择的仓库ID和选择的要素类型
     //type 为1是仓库 type 为2是其他要素
     fun getSelectWarehouseOrFactoryid(type : String) : String{
         var returnString = ""
         WrStandardFactoryItemDataList.value?.forEach {
-            if (type == it.dgfactoryitemtypeid){
-                it.itemlst?.forEach { data ->
-                    if (data.isSelect == 1){
-                        returnString = data.warehouseid ?: ""
+            if (type == "1"){//取仓库id
+                if (it.dgfactoryitemtypeid == "1"){
+                    it.itemlst?.forEach { data ->
+                        if (data.isSelect == 1){
+                            returnString = data.warehouseid ?: ""
+                        }
                     }
                 }
-            }else {
-                it.itemlst?.forEach { data ->
-                    if (data.isSelect == 1){
-                        returnString = returnString + "," + data.dgfactoryitemid
+            }else{
+                if (it.dgfactoryitemtypeid != "1"){
+                    it.itemlst?.forEach { data ->
+                        if (data.isSelect == 1){
+                            returnString = returnString + "," + data.dgfactoryitemid
+                        }
                     }
                 }
             }
@@ -63,6 +117,142 @@ class HnstcdysViewModel : BaseViewModel(){
         return returnString
     }
 
+    /**
+     * 持仓挂牌
+     * @param LadingBillId Long
+     * @param TradeDate String
+     * @param SubNum Long
+     * @param WRFactorTypeId Long
+     * @param UserID Int
+     * @param AccountID Long
+     * @param IsSpecified Int
+     * @param MatchAccIDs List<Long>
+     * @param OrderQty Long
+     * @param DeliveryGoodsID Int
+     * @param WRPriceType Int
+     * @param FixedPrice Double
+     * @param WRTradeGoods WRGoodsInfo
+     * @param PriceFactor Double
+     * @param PriceMove Double
+     * @param TimevalidType Int
+     * @param FirstRatio Double
+     * @param PerformanceTemplateID Long
+     * @param BuyOrSell Int
+     * @param PriceDisplayMode Int
+     * @param CanBargain Int
+     * @param Attachment1 String
+     * @param Attachment2 String
+     * @param Remark String
+     * @param ApplyID Long
+     * @param CanPart Int
+     * @param HasWr Int
+     * @param WRStandardID Int
+     * @param isSuccess Function1<[@kotlin.ParameterName] Boolean, Unit>
+     */
+    fun requeryWRListingOrderReq(
+        LadingBillId: Long = 0,//提单id(wrholdlb的LadingBillId字段),卖的时候填写
+        TradeDate: String = "",//交易日
+        SubNum: Long = 0,// 提单子单号(wrholdlb的SubNum字段),卖的时候填写
+        WRFactorTypeId: Long = 0,//仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写
+        UserID: Int = 0,//用户ID
+        AccountID: Long = 0,//资金账号
+        IsSpecified: Int = 0,//是否指定对手 0 不指定 1 指定
+        MatchAccIDs: List<Long> = arrayListOf(),//仓单贸易对手用户ID集合(指定对手时填写)
+        OrderQty: Long = 0,//委托数量(可挂部分数据量)
+        DeliveryGoodsID: Int = 0,//交割商品商品ID
+        WRPriceType: Int = 0,//价格方式
+        FixedPrice: Double = 0.0,//固定价格
+        WRTradeGoods: WarehouseTradeMI1.WRGoodsInfo,//仓单贸易商品配置集合(浮动价时填写)
+        PriceFactor: Double = 0.0,//价格系数(浮动价时填写)    -   [挂牌]
+        PriceMove: Double = 0.0,//升贴水(浮动价时填写)
+        TimevalidType: Int = 0,//时间有效类型
+        FirstRatio: Double = 0.0,//首付比例
+        PerformanceTemplateID: Long = 0,//履约计划模板ID
+        BuyOrSell: Int = 0,// 买卖方向
+        PriceDisplayMode: Int = 0,//浮动价显示方式
+        CanBargain: Int = 0,//挂牌是否可议价0:不可1:可-摘牌是否议价
+        Attachment1: String = "",//附件1
+        Attachment2: String = "",//附件2
+        Remark: String = "",//备注
+        ApplyID: Long = 0,//申请ID
+        CanPart: Int = 0,//是否允许部份摘牌0:不允许;1:允许
+//        MatchAccIDsString : List<String> = arrayListOf(),//仓单贸易对手用户ID集合(指定对手时填写)
+        DeliveryMonth : String = "",//交收月
+        HasWr: Int = 0,//是否有仓单-0:没有仓单 1:有仓单
+        DelistMinQty : Long = 0,//起摘数量
+        WRStandardID: Int = 0,//现货品种ID
+        FactoryItems : List<WarehouseTradeMI1.DGFactoryItems>,//要素类型明细集合(没有仓单要素ID填写)
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.warehouseManager?.HdWROrderReq(
+                LadingBillId = LadingBillId,
+                TradeDate = TradeDate,
+                AccountID = AccountID,
+                OrderQty = OrderQty,
+                IsSpecified = IsSpecified,
+                SubNum = SubNum,
+                DeliveryMonth = DeliveryMonth,
+                DeliveryGoodsID = DeliveryGoodsID,
+                WRFactorTypeId = WRFactorTypeId,
+                UserID = UserID,
+                MatchAccIDs = MatchAccIDs,
+                WRPriceType = WRPriceType,
+                FixedPrice = FixedPrice,
+                WRTradeGoods = WRTradeGoods,
+                PriceFactor = PriceFactor,
+                PriceMove = PriceMove,
+                DelistMinQty = DelistMinQty,
+                TimevalidType = TimevalidType,
+                FirstRatio = FirstRatio,
+                PerformanceTemplateID = PerformanceTemplateID,
+                BuyOrSell = BuyOrSell,
+                CanPart = CanPart,
+                HasWr = HasWr,
+                WRStandardID = WRStandardID,
+                PriceDisplayMode = PriceDisplayMode,
+                CanBargain = CanBargain,
+                Attachment1 = Attachment1,
+                Attachment2 = Attachment2,
+                Remark = Remark,
+                ApplyID = ApplyID,
+                FactoryItems = FactoryItems
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+    //重新赋值资金账户
+    fun resetAccountData(){
+        val accountDataList = GlobalDataCollection.instance?.accountDataList
+        if (accountDataList.isNullOrEmpty().not()) {
+            val accountData = GlobalDataCollection.instance?.accountData
+            accountData?.clearData()
+            accountData?.setNormalData()
+            usedAccountData.postValue(accountData)
+        }
+    }
+
+    //重新赋值资金账户
+    fun resetAccountDataBySelect(data : AccountData){
+        data.clearData()
+        data.setNormalData()
+        usedAccountData.postValue(data)
+    }
+
     //根据选择的商品组组织商品选择列表
     fun setGoodsInfoList(goodsgroupid : String){
         val newGoodsInfoList = arrayListOf<SelectData>()
@@ -186,8 +376,34 @@ class HnstcdysViewModel : BaseViewModel(){
     //左侧菜单所有的挂牌信息
     val orderQuoteDataByListed : MutableLiveData<OrderQuoteData> = MutableLiveData()
 
+    //通过选择的wrstandardid查找相对应的DeliveryGoodsID
+    fun getDeliveryGoodsIDByWRStandardID(wrstandardid : String = "") : String{
+        var deliverygoodsid = ""
+        ftDeliveryGoodsDataList.value?.forEach {
+            it.wdlst?.forEach { data ->
+                if (data.wrstandardid == wrstandardid){
+                    deliverygoodsid = it.deliverygoodsid ?: ""
+                }
+            }
+        }
+        return deliverygoodsid
+    }
+
+    //通过选择的wrstandardid查找相对应的实体
+    fun getWrFtWrstandardByWRStandardID(wrstandardid : String = "") : WrFtWrstandard{
+        var WrFtWrstandard = WrFtWrstandard()
+        ftDeliveryGoodsDataList.value?.forEach {
+            it.wdlst?.forEach { data ->
+                if (data.wrstandardid == wrstandardid){
+                    WrFtWrstandard = data
+                }
+            }
+        }
+        return WrFtWrstandard
+    }
+
     /**
-     * 查询一口价报价牌
+     * 查询一口价报价牌筛选
      */
     fun queryOneOrderQuoteByListed(wrstandardid : String = "",warehouseid : String = "",dgitemname : String = "",deliverymonth : String = ""){
         val params = mutableMapOf<String,String>().apply {
@@ -207,13 +423,15 @@ class HnstcdysViewModel : BaseViewModel(){
                 put("deliverymonth",deliverymonth)
             }
         }
-        if (wrstandardid.isNotEmpty()){
-            resetSelectContent()
-        }
+
         MyApplication.getInstance()?.quoteManager?.queryOrderQuote(params = params){ isSuccess, respData, error ->
             if (isSuccess){
                 if (respData.isNullOrEmpty().not()){
                     orderQuoteDataByListed.postValue(respData?.get(0))
+
+                }else{
+                    noWRFactorTypeIdDataForListed.postValue(ListedData(DeliveryMonth = deliverymonth,DeliveryGoodsID = getDeliveryGoodsIDByWRStandardID(wrstandardid),WrFtWrstandard = getWrFtWrstandardByWRStandardID(wrstandardid),FactoryItemsList = WrStandardFactoryItemDataList.value ?: arrayListOf()))
+
                 }
             }
         }
@@ -240,9 +458,7 @@ class HnstcdysViewModel : BaseViewModel(){
                 put("deliverymonth",deliverymonth)
             }
         }
-        if (wrstandardid.isNotEmpty()){
-            resetSelectContent()
-        }
+
         MyApplication.getInstance()?.quoteManager?.queryOrderQuote(params = params){ isSuccess, respData, error ->
             if (isSuccess){
                 onePrcieDataList.postValue(respData)
@@ -251,7 +467,7 @@ class HnstcdysViewModel : BaseViewModel(){
     }
 
     /**
-     * 查询浮动价报价牌
+     * 查询浮动价报价牌筛选
      */
     fun queryFloatOrderQuoteByListed(wrstandardid : String = "",warehouseid : String = "",dgitemname : String = "",deliverymonth : String = ""){
         val params = mutableMapOf<String,String>().apply {
@@ -271,13 +487,15 @@ class HnstcdysViewModel : BaseViewModel(){
                 put("deliverymonth",deliverymonth)
             }
         }
-        if (wrstandardid.isNotEmpty()){
-            resetSelectContent()
-        }
+
         MyApplication.getInstance()?.quoteManager?.queryOrderQuote(params = params){ isSuccess, respData, error ->
             if (isSuccess){
                 if (respData.isNullOrEmpty().not()){
                     orderQuoteDataByListed.postValue(respData?.get(0))
+
+                }else{
+                    noWRFactorTypeIdDataForListed.postValue(ListedData(DeliveryMonth = deliverymonth,DeliveryGoodsID = getDeliveryGoodsIDByWRStandardID(wrstandardid),WrFtWrstandard = getWrFtWrstandardByWRStandardID(wrstandardid),FactoryItemsList = WrStandardFactoryItemDataList.value ?: arrayListOf()))
+
                 }
             }
         }
@@ -304,9 +522,7 @@ class HnstcdysViewModel : BaseViewModel(){
                 put("deliverymonth",deliverymonth)
             }
         }
-        if (wrstandardid.isNotEmpty()){
-            resetSelectContent()
-        }
+
         MyApplication.getInstance()?.quoteManager?.queryOrderQuote(params = params){ isSuccess, respData, error ->
             if (isSuccess){
                 floatProceDataList.postValue(respData)
@@ -314,4 +530,89 @@ class HnstcdysViewModel : BaseViewModel(){
         }
     }
 
+    /**
+     * 请求盘面信息
+     * @param first Int
+     * @param last Int
+     * @param callback Function2<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun queryQuoteDayByListed(
+        tag: String,
+        goodsCodes: String,
+        isShowLoading: Boolean
+    ) {
+        if (isShowLoading) {
+            loadingDialogStatus.postValue(TaskUiModel.inFlight())
+        }
+
+        val params = mutableMapOf<String, String>().apply {
+            put("goodsCodes", goodsCodes)
+        }
+        MyApplication.getInstance()?.futureManager?.queryQuoteDay(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                if (respData?.isEmpty()?.not() == true) {
+                    quoteDayData.postValue(respData[0])
+                }
+                if (isShowLoading) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "数据请求成功"))
+                }
+
+            } else {
+                if (isShowLoading) {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = "数据请求失败"
+                            )
+                        )
+                    )
+                }
+            }
+        }
+        addSubscriptQuote(tag = tag, goodsCodes = setOf(goodsCodes))
+    }
+
+
+    /**
+     * 订阅行情
+     * @param tag String
+     * @param goodsInfoList List<GoodsInfo>
+     */
+    fun addSubscriptQuote(tag: String, goodsCodes: Set<String>) {
+        GlobalScope.launch {
+            MyApplication.getInstance()?.quoteManager?.addSubscriptQuote(
+                tag = tag, goodsCodeSet = goodsCodes
+            ) { isCompleted, err ->
+                LogUtils.eTag("订阅行情", goodsCodes)
+            }
+        }
+    }
+
+    /**
+     * 取消订阅
+     * @param tag String
+     */
+    fun removeSubscriptQuote(tag: String) {
+        GlobalScope.launch {
+            MyApplication.getInstance()?.quoteManager?.removeSubscriptQuote(
+                tag = tag
+            )
+        }
+    }
+
+    //获取选择的仓库ID和选择的要素类型 是否全部选择
+    fun getSelectBooble() : Boolean{
+        var selectNum = 0
+        var returnBooble = false
+        WrStandardFactoryItemDataList.value?.forEach {
+            it.itemlst?.forEach { data ->
+                if (data.isSelect == 1){
+                    selectNum = selectNum.plus(1)
+                }
+            }
+        }
+        returnBooble = selectNum >= WrStandardFactoryItemDataList.value?.size ?: 0
+        return returnBooble
+    }
+
 }

+ 1140 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstcdys/dialog/HnstFloatListedDialog.kt

@@ -0,0 +1,1140 @@
+package cn.muchinfo.rma.view.base.hnstcdys.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.core.view.isInvisible
+import androidx.lifecycle.MutableLiveData
+import androidx.viewpager.widget.PagerAdapter
+import androidx.viewpager.widget.ViewPager
+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.autoWidget.view.MangeNumberEditText3
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.base.hnstcdys.HnstcdysViewModel
+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 cn.muchinfo.rma.view.base.warehousereceipt.dialog.ListedData
+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
+import org.w3c.dom.Text
+
+/**
+ * 浮动价的买卖挂牌(此页面是进入买卖大厅有仓单要素id的浮动价挂牌)
+ * @receiver AppCompatActivity
+ * @param activity AppCompatActivity
+ * @param viewModel BusinessHallViewModel
+ * @param data OrderQuoteData
+ * @return CustomDialogFragment
+ */
+fun AppCompatActivity.HnstFloatListedDialog(
+    activity: AppCompatActivity,
+    type: String,
+    viewModel: HnstcdysViewModel,
+    data: ListedData
+): CustomDialogFragment {
+
+    val tag = "quotetag"
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    lateinit var viewPager: ViewPager
+
+    //浮动价卖挂牌
+    val oneSellListedUI by lazy {
+        FloatSellListedUI(activity, viewModel, type, data, tag)
+    }
+
+    //浮动价买挂牌
+    val oneBuyListedUI by lazy {
+        FloatBuyListedUI(activity, viewModel, type, data, tag)
+    }
+
+    //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()
+        //对资金信息进行初始化
+        viewModel.resetAccountData()
+        //查询是否有相应的预售仓单
+        viewModel.queryorderSummaryWrPosition(deliverygoodsid = data.DeliveryGoodsID,wrstandardid = data.WrFtWrstandard.wrstandardid ?: "",warehouseid = data.getWarehouseid(),dgitemname = data.getdgitemname())
+
+        viewModel.queryQuoteDayByListed(
+            tag = tag,
+            goodsCodes = data.goodsCode,
+            isShowLoading = false
+        )
+        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(selectedTabIndex)
+        }.lparams(matchParent, matchParent) {
+            topMargin = autoSize(120)
+        }
+    }
+}
+
+//浮动价卖挂牌
+class FloatSellListedUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: HnstcdysViewModel,
+    private val type: String,
+    data: ListedData,
+    tag: String//订阅标示
+) {
+
+    //选择的资金账号
+    val selectAccountData: MutableLiveData<AccountData> = MutableLiveData()
+
+    //基差输入
+    lateinit var basisInputEdittext: MangeNumberEditText3
+
+    //初始化后基差是否被define
+    var isdefineByBasis: Boolean = false
+
+    //数量
+    lateinit var listednumberEdittext: MangeNumberEditText2
+
+    //起摘数量输入框
+    lateinit var startInputNumber: EditText
+
+    //估算总额
+    lateinit var float_delisting_amount: TextView
+
+    //估算总价
+    lateinit var float_total_amount: TextView
+
+    lateinit var max_number: TextView
+
+    //浮动价挂牌金额
+    val listed_price: MutableLiveData<Double> = MutableLiveData()
+
+    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("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)
+                    }
+                }
+                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)
+
+                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(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"
+                            listednumberEdittext = this
+                            setOnTextChangeListener { view, value ->
+                                if (value.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(0, autoSize(72), 1f) {
+                            marginEnd = autoSize(36)
+                        }
+
+                        textView {
+                            text = data.WrFtWrstandard.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(0, 0, 0, 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 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 {
+                            max_number = this
+                            text = "1"
+                            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 {
+                            startInputNumber = this
+                            hint = "请输入起摘数量"
+                            background = null
+                            inputType = EditorInfo.TYPE_CLASS_NUMBER
+//                            setDecimalInputType()
+                            hintColorStr = "#CCCCCC"
+                            textSizeAuto = 31
+                            textColorStr = "#333333"
+                        }.lparams(0, autoSize(132), 1f) {
+                            topMargin = autoSize(15)
+                        }
+
+                        textView {
+                            text = data.WrFtWrstandard.enumdicname
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent) {
+                            marginEnd = autoSize(36)
+                        }
+                    }.lparams(matchParent, autoSize(100))
+
+                    textView {
+                        text =
+                            "最小单位" + data.WrFtWrstandard.minivalue + data.WrFtWrstandard.enumdicname
+                        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 = "--"
+                    listed_price.bindOptional(context) {
+                        text = NumberUtils.roundNum(it ?: 0.0, 2)
+                    }
+                    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
+                                ) + ")"
+                            }
+                        }
+                    }
+                    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)
+                }
+                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 (viewModel.summaryWrPositionDataByDialog.value?.accountid.isNullOrEmpty()){
+                            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.WrFtWrstandard.minivalue?.toLong() ?: 0
+                        ) {
+                            ToastUtils.showLong("起摘数量不能小于" + data.WrFtWrstandard.minivalue)
+                            return@onThrottleFirstClick
+                        }
+
+                        viewModel.requeryWRListingOrderReq(
+                            FactoryItems = data.getFactoryItems(),
+                            LadingBillId = 0,
+                            TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
+                            SubNum = 0,
+                            WRFactorTypeId = 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,
+                            DeliveryMonth = data.DeliveryMonth,
+                            DelistMinQty = startInputNumber.text.toString().toLong(),
+                            WRStandardID = data.WrFtWrstandard.wrstandardid?.toInt() ?: 0
+                        ) {
+                            viewModel.removeSubscriptQuote(tag = tag)
+                            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.removeSubscriptQuote(tag = tag)
+                        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 getWRTradeGoods(data: ListedData): WarehouseTradeMI1.WRGoodsInfo {
+        val wRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder()
+        wRTradeGoods.setGoodsID(data.goodsId.toInt())
+        wRTradeGoods.setGoodsCode(data.goodsCode)
+        wRTradeGoods.setPriceFactor(1.0)
+        wRTradeGoods.setPriceMove(1.0)
+        wRTradeGoods.setWeightRatio(1.0)
+        return wRTradeGoods.build()
+    }
+}
+
+//浮动价买挂牌
+class FloatBuyListedUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: HnstcdysViewModel,
+    type: String,
+    data: ListedData,
+    tag: String//订阅标示
+) {
+    //选择的资金账号
+    val selectAccountData: MutableLiveData<AccountData> = MutableLiveData()
+
+    //基差
+    lateinit var basisInputEdittext: MangeNumberEditText3
+
+    //初始化后基差是否被define
+    var isdefineByBasis: Boolean = false
+
+    //挂牌数量
+    lateinit var oneNumberInputEdittext: MangeNumberEditText2
+
+    //起摘数量输入框
+    lateinit var startInputNumber: EditText
+
+    //摘牌金额
+    lateinit var one_delisting_amount: TextView
+
+    //估算总额
+    lateinit var float_delisting_amount: TextView
+
+    //估算总价
+    lateinit var float_total_amount: TextView
+
+    //SeekBar
+    lateinit var seekBar: SeekBar
+
+    //挂牌最大数量
+    val maxlistedNumber: MutableLiveData<Int> = MutableLiveData()
+
+    //浮动价挂牌金额
+    val listed_price: MutableLiveData<Double> = 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 {
+            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)
+                    )
+                }
+            }
+            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)
+
+
+
+                numberEditText3 {
+                    text = "0"
+                    basisInputEdittext = this
+                    isdefineByBasis = true
+                    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
+                    }
+                    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(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 ->
+
+                            }
+
+                        }.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)
+                        thumbOffset = 0
+                        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) {
+                                oneNumberInputEdittext.text = NumberUtils.roundNum(
+                                    it?.times(seekBar.progress.div(100.0)).toString(), 0
+                                )
+                                text = it.toString() + data.WrFtWrstandard.enumdicname
+                            }
+                            textSizeAuto = 29
+                            textColorInt = R.color.rma_gray_color
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(matchParent, wrapContent) {
+                        marginEnd = autoSize(110)
+                        topMargin = autoSize(10)
+                    }
+
+                }.lparams(matchParent, autoSize(290))
+            }.lparams(matchParent, autoSize(290))
+
+            itemView()
+
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                linearLayout {
+                    textView {
+                        text = "起摘数量"
+                        textSizeAuto = 34
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(36)
+                    }
+                }.lparams(autoSize(250), wrapContent)
+
+                verticalLayout {
+                    linearLayout {
+                        editText {
+                            startInputNumber = this
+                            hint = "请输入起摘数量"
+                            background = null
+//                            inputType = EditorInfo.TYPE_CLASS_NUMBER or EditorInfo.TYPE_NUMBER_FLAG_DECIMAL or EditorInfo.TYPE_NUMBER_FLAG_SIGNED
+//                            setDecimalInputType()
+                            hintColorStr = "#CCCCCC"
+                            textSizeAuto = 31
+                            textColorStr = "#333333"
+                        }.lparams(0, autoSize(132), 1f) {
+                            topMargin = autoSize(15)
+                        }
+
+                        textView {
+                            text = data.WrFtWrstandard.enumdicname
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent) {
+                            marginEnd = autoSize(36)
+                        }
+                    }.lparams(matchParent, autoSize(100))
+
+                    textView {
+                        text =
+                            "最小单位" + data.WrFtWrstandard.minivalue + data.WrFtWrstandard.enumdicname
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(5)
+                    }
+                }.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 = "--"
+                    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()
+                            )
+                        }
+                    }
+                    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(oneNumberInputEdittext.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)
+                }
+                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 (basisInputEdittext.text.toString().isNullOrEmpty()) {
+                            ToastUtils.showLong("请输入基差")
+                            return@onThrottleFirstClick
+                        }
+                        if (basisInputEdittext.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 (startInputNumber.text.toString()
+                                .toLong() < data.WrFtWrstandard.minivalue?.toLong() ?: 0
+                        ) {
+                            ToastUtils.showLong("起摘数量不能小于" + data.WrFtWrstandard.minivalue)
+                            return@onThrottleFirstClick
+                        }
+                        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 = 2,
+                            PriceMove = basisInputEdittext.text.toString().toDouble(),
+                            WRTradeGoods = getWRTradeGoods(data),
+                            TimevalidType = 4,
+                            FirstRatio = 0.0,
+                            PerformanceTemplateID = 0,
+                            BuyOrSell = 0,
+                            PriceDisplayMode = 1,
+                            CanBargain = 0,
+                            ApplyID = 0,
+                            CanPart = 1,
+                            HasWr = 0,
+                            DeliveryMonth = data.DeliveryMonth,
+                            DelistMinQty = startInputNumber.text.toString().toLong(),
+                            WRStandardID = data.WrFtWrstandard.wrstandardid?.toInt() ?: 0
+                        ) {
+                            viewModel.removeSubscriptQuote(tag = tag)
+                            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 getWRTradeGoods(data: ListedData): WarehouseTradeMI1.WRGoodsInfo {
+        val wRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder()
+        wRTradeGoods.setGoodsID(data.goodsId.toInt())
+        wRTradeGoods.setGoodsCode(data.goodsCode)
+        wRTradeGoods.setPriceFactor(1.0)
+        wRTradeGoods.setPriceMove(1.0)
+        wRTradeGoods.setWeightRatio(1.0)
+        return wRTradeGoods.build()
+    }
+}

+ 999 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstcdys/dialog/HnstOneListedDialog.kt

@@ -0,0 +1,999 @@
+package cn.muchinfo.rma.view.base.hnstcdys.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.hnstcdys.HnstcdysViewModel
+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 cn.muchinfo.rma.view.base.warehousereceipt.dialog.ListedData
+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.HnstOneListedDialog(
+    activity: AppCompatActivity,
+    type: String,
+    viewModel: HnstcdysViewModel,
+    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()
+        viewModel.resetAccountData()
+        viewModel.queryorderSummaryWrPosition(deliverygoodsid = data.DeliveryGoodsID,wrstandardid = data.WrFtWrstandard.wrstandardid ?: "",warehouseid = data.getWarehouseid(),dgitemname = data.getdgitemname())
+        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: HnstcdysViewModel,
+    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
+
+    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()
+                    ) {
+                        viewModel.resetAccountDataBySelect(this)
+                        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 amount = value.toString().toDouble()
+                                    .times(oneNumberInputEdittext.text.toString().toDouble())
+                                if (amount == 0.0) {
+                                    one_delisting_amount.text = NumberUtils.roundNum(
+                                        amount.toString(),
+                                        2
+                                    )
+                                } else {
+                                    one_delisting_amount.text = NumberUtils.roundNum(
+                                        amount.toString(),
+                                        2
+                                    ) + "(需履约保证金" + NumberUtils.roundNum(
+                                        amount.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 {
+                            startInputNumber = this
+                            hint = "请输入起摘数量"
+                            background = null
+                            inputType = EditorInfo.TYPE_CLASS_NUMBER
+//                            setDecimalInputType()
+                            hintColorStr = "#CCCCCC"
+                            textSizeAuto = 31
+                            textColorStr = "#333333"
+                        }.lparams(0, autoSize(132), 1f) {
+                            topMargin = autoSize(15)
+                        }
+
+                        textView {
+                            text = data.WrFtWrstandard.enumdicname
+                            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 (viewModel.summaryWrPositionDataByDialog.value?.accountid.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
+                        }
+
+                        viewModel.requeryWRListingOrderReq(
+                            FactoryItems = data.getFactoryItems(),
+                            LadingBillId = 0,
+                            SubNum = 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,
+                            DeliveryMonth = data.DeliveryMonth,
+                            DelistMinQty = startInputNumber.text.toString().toLong(),
+                            WRStandardID = data.WrFtWrstandard.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: HnstcdysViewModel,
+    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()
+                    ) {
+                        viewModel.resetAccountDataBySelect(this)
+                        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 amount = value.toString().toDouble()
+                                    .times(oneNumberInputEdittext.text.toString().toDouble())
+                                if (amount == 0.0) {
+                                    one_delisting_amount.text = NumberUtils.roundNum(
+                                        amount.toString(),
+                                        2
+                                    )
+                                } else {
+                                    one_delisting_amount.text = NumberUtils.roundNum(
+                                        amount.toString(),
+                                        2
+                                    ) + "(需履约保证金" + NumberUtils.roundNum(
+                                        amount.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 amount = value.toString().toDouble()
+                                            .times(onePriceInputEdittext.text.toString().toDouble())
+                                        if (amount == 0.0) {
+                                            one_delisting_amount.text = NumberUtils.roundNum(
+                                                amount.toString(),
+                                                2
+                                            )
+                                        } else {
+                                            one_delisting_amount.text = NumberUtils.roundNum(
+                                                amount.toString(),
+                                                2
+                                            ) + "(需履约保证金" + NumberUtils.roundNum(
+                                                amount.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() + data.WrFtWrstandard.enumdicname
+                            }
+                            textSizeAuto = 29
+                            textColorInt = R.color.rma_gray_color
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(matchParent, wrapContent) {
+                        marginEnd = autoSize(110)
+                        topMargin = autoSize(10)
+                    }
+
+                }.lparams(matchParent, autoSize(290))
+            }.lparams(matchParent, autoSize(290))
+
+            itemView()
+
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                linearLayout {
+                    textView {
+                        text = "起摘数量"
+                        textSizeAuto = 34
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(36)
+                    }
+                }.lparams(autoSize(250), wrapContent)
+
+                verticalLayout {
+                    linearLayout {
+                        editText {
+                            startInputNumber = this
+                            hint = "请输入起摘数量"
+                            background = null
+                            inputType = EditorInfo.TYPE_CLASS_NUMBER
+//                            setDecimalInputType()
+                            hintColorStr = "#CCCCCC"
+                            textSizeAuto = 31
+                            textColorStr = "#333333"
+                        }.lparams(0, autoSize(132), 1f) {
+                            topMargin = autoSize(15)
+                        }
+
+                        textView {
+                            text = data.WrFtWrstandard.enumdicname
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent) {
+                            marginEnd = autoSize(36)
+                        }
+                    }.lparams(matchParent, autoSize(100))
+
+                    textView {
+                        text = "最小单位" + data.WrFtWrstandard.minivalue + data.WrFtWrstandard.enumdicname
+                        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 (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
+                        }
+
+                        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.WrFtWrstandard.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
+        }
+    }
+}

+ 1 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/bookingwarehouse/adapter/BookingAreCancelContentAdapter.java

@@ -111,7 +111,7 @@ public class BookingAreCancelContentAdapter extends RecyclerView.Adapter<Booking
         itemViewHolder.all_click_View.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                if (data.getWrtradeorderstatus().equals("3")){
+                if (data.getWrtradeorderstatus().equals("3") || data.getWrtradeorderstatus().equals("10")){
                     setPosition(i);
                 }
             }

+ 4 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/ContractOrdersActivity.kt

@@ -7,4 +7,7 @@ import cn.muchinfo.rma.view.base.BaseActivity
  */
 class ContractOrdersActivity : BaseActivity<ContractOrdersViewModel>(){
 
-}
+
+
+}
+

+ 33 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/finance/FinanceManagementViewModel.kt

@@ -54,6 +54,38 @@ class FinanceManagementViewModel : BaseViewModel(){
     //点击撤单时选择的撤单实体
     val selectCancelData : MutableLiveData<WrFinanceBuyApplyData> = MutableLiveData()
 
+    /**
+     * 回购仓单下的明细列表
+     */
+    val wrBuybackDetailDataList : MutableLiveData<List<WrBuybackDetailData>> = MutableLiveData()
+
+    /**
+     * 费用明细数据
+     */
+    val wrScfContractInterestDataList : MutableLiveData<List<WrScfContractInterestData>> = MutableLiveData()
+
+    fun queryWrScfContractInterest(scfcontractid : String){
+        val params = mutableMapOf<String,String>().apply {
+            put("scfcontractid",scfcontractid)
+        }
+        MyApplication.getInstance()?.financialManager?.queryWrScfContractInterest(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                wrScfContractInterestDataList.postValue(respData)
+            }
+        }
+    }
+
+    fun queryWrBuybackDetail(scfcontractid : String){
+        val params = mutableMapOf<String,String>().apply {
+            put("scfcontractid",scfcontractid)
+        }
+        MyApplication.getInstance()?.financialManager?.queryWrBuybackDetail(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                wrBuybackDetailDataList.postValue(respData)
+            }
+        }
+    }
+
 
     fun queryWrFactorTypeInfoEx(wrfactortypeid : String){
         val params = mutableMapOf<String,String>().apply {
@@ -112,7 +144,7 @@ class FinanceManagementViewModel : BaseViewModel(){
             //借款金额'
             newRightData.add(it.tradeamount ?: "-")
             //购买商品
-            newRightData.add(it.productname ?: "-")
+            newRightData.add(it.wrfactortypename ?: "-")
             //商品数量
             newRightData.add(it.orderqty ?: "-")
             //借款天数

+ 83 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/finance/FinancePayalanceActivity.kt

@@ -2,12 +2,17 @@ package cn.muchinfo.rma.view.base.hnstmain.finance
 
 import android.os.Bundle
 import android.view.Gravity
+import android.view.View
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.WrBuybackDetailData
 import cn.muchinfo.rma.global.data.WrScfContractData
+import cn.muchinfo.rma.global.data.WrScfContractInterestData
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
 import org.jetbrains.anko.*
 
 
@@ -20,9 +25,14 @@ class FinancePayalanceActivity : BaseActivity<FinanceManagementViewModel>(){
     val data by lazy { intent.getParcelableExtra<WrScfContractData>("data") as WrScfContractData }
 
 
+    private val financePayalanceViewHolder : BaseAdapter<WrScfContractInterestData, FinancePayalanceViewHolder> =
+        BaseAdapter { _, _ -> FinancePayalanceViewHolder(this, viewModel) }
+
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            viewModel.queryWrScfContractInterest(data.scfcontractid ?: "")
             background = resources.getDrawable(R.color.segtabment_bg_color)
             topBar {
                 commonLeftButton()
@@ -43,6 +53,79 @@ class FinancePayalanceActivity : BaseActivity<FinanceManagementViewModel>(){
                         itemView()
                         contractItem(itemTile = "费用欠款", itemContent = data.interestdebt ?: "-")
 
+                        linearLayout {
+                            visibility = View.GONE
+                            gravity = Gravity.CENTER_VERTICAL
+                            textView {
+                                text = "回购明细"
+                                textSizeAuto = 34
+                                textColorInt = R.color.rma_black_33
+                            }.lparams(wrapContent, wrapContent){
+                                marginStart = autoSize(36)
+                            }
+                        }.lparams(matchParent, autoSize(100))
+
+                        linearLayout {
+                            background = resources.getDrawable(R.color.qhj_rule_bg_color)
+                            linearLayout {
+                                gravity = Gravity.CENTER
+                                textView {
+                                    text = "日期"
+                                    textSizeAuto = 29
+                                    textColorInt = R.color.rma_blue_color
+                                }.lparams(wrapContent, wrapContent)
+                            }.lparams(0, autoSize(80),1.5f)
+
+                            view {
+                                background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                            }.lparams(autoSize(1), autoSize(80))
+
+                            linearLayout {
+                                gravity = Gravity.CENTER
+                                textView {
+                                    text = "费用"
+                                    textSizeAuto = 29
+                                    textColorInt = R.color.rma_blue_color
+                                }.lparams(wrapContent, wrapContent)
+                            }.lparams(0, autoSize(80),1f)
+
+                            view {
+                                background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                            }.lparams(autoSize(1), autoSize(80))
+
+                            linearLayout {
+                                gravity = Gravity.CENTER
+                                textView {
+                                    text = "已结"
+                                    textSizeAuto = 29
+                                    textColorInt = R.color.rma_blue_color
+                                }.lparams(wrapContent, wrapContent)
+                            }.lparams(0, autoSize(80),1f)
+
+                            view {
+                                background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                            }.lparams(autoSize(1), autoSize(80))
+
+                            linearLayout {
+                                gravity = Gravity.CENTER
+                                textView {
+                                    text = "状态"
+                                    textSizeAuto = 29
+                                    textColorInt = R.color.rma_blue_color
+                                }.lparams(wrapContent, wrapContent)
+                            }.lparams(0, autoSize(80),1f)
+                        }.lparams(matchParent, autoSize(80))
+
+                        recyclerView {
+                            background = resources.getDrawable(R.color.white)
+                            adapter = financePayalanceViewHolder
+                            isNestedScrollingEnabled = false
+                        }.lparams(matchParent, matchParent)
+
+                        viewModel.wrScfContractInterestDataList.bindOptional(context){
+                            financePayalanceViewHolder.setNewData(it)
+                        }
+
                     }
                 }.lparams(matchParent, matchParent)
 

+ 89 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/finance/FinancePayalanceViewHolder.kt

@@ -0,0 +1,89 @@
+package cn.muchinfo.rma.view.base.hnstmain.finance
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.WrScfContractInterestData
+import cn.muchinfo.rma.global.isBlankString
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+class FinancePayalanceViewHolder(private val activity : AppCompatActivity,private val viewModel: FinanceManagementViewModel) : BaseViewHolder<WrScfContractInterestData>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            linearLayout {
+                background = resources.getDrawable(R.color.qhj_rule_bg_color)
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.closetime
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_blue_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(110),1.5f)
+
+                view {
+                    background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                }.lparams(autoSize(1), autoSize(110))
+
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.interestamount
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_blue_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(110),1f)
+
+                view {
+                    background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                }.lparams(autoSize(1), autoSize(110))
+
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                       data.bindOptional(context){
+                            text = it?.closeinterest?.isBlankString()
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_blue_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(110),1f)
+
+                view {
+                    background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                }.lparams(autoSize(1), autoSize(110))
+
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        data.bindOptional(context){
+                            if (it?.closeintereststatus == "1"){
+                                text = "未结"
+                            }else{
+                                text = "已结"
+                            }
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_blue_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(110),1f)
+            }.lparams(matchParent, autoSize(110))
+
+            itemView()
+
+        }.lparams(matchParent, autoSize(111))
+    }
+
+}

+ 24 - 17
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/finance/FinanceRepoActivity.kt

@@ -7,12 +7,16 @@ import android.view.inputmethod.EditorInfo
 import android.widget.EditText
 import android.widget.TextView
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.WrBuybackDetailData
+import cn.muchinfo.rma.global.data.WrFactorTypeInfoExData
 import cn.muchinfo.rma.global.data.WrScfContractData
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
 import org.jetbrains.anko.*
 import org.jetbrains.anko.sdk25.coroutines.textChangedListener
 
@@ -30,9 +34,13 @@ class FinanceRepoActivity : BaseActivity<FinanceManagementViewModel>() {
     //由列表传入的合同实体
     val data by lazy { intent.getParcelableExtra<WrScfContractData>("data") as WrScfContractData }
 
+    private val financeRepoAdapter : BaseAdapter<WrBuybackDetailData, FinanceRepoViewHolder> =
+        BaseAdapter { _, _ -> FinanceRepoViewHolder(this, viewModel) }
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            viewModel.queryWrBuybackDetail(data.scfcontractid ?: "")
             background = resources.getDrawable(R.color.segtabment_bg_color)
             topBar {
                 commonLeftButton()
@@ -144,7 +152,6 @@ class FinanceRepoActivity : BaseActivity<FinanceManagementViewModel>() {
                         }.lparams(matchParent, autoSize(100))
 
                         linearLayout {
-                            visibility = View.GONE
                             background = resources.getDrawable(R.color.qhj_rule_bg_color)
                             linearLayout {
                                 gravity = Gravity.CENTER
@@ -153,7 +160,7 @@ class FinanceRepoActivity : BaseActivity<FinanceManagementViewModel>() {
                                     textSizeAuto = 29
                                     textColorInt = R.color.rma_blue_color
                                 }.lparams(wrapContent, wrapContent)
-                            }.lparams(0, autoSize(80),1.4f)
+                            }.lparams(0, autoSize(80),1f)
 
                             view {
                                 background = resources.getDrawable(R.color.rma_hint_line_color_eee)
@@ -179,22 +186,19 @@ class FinanceRepoActivity : BaseActivity<FinanceManagementViewModel>() {
                                     textSizeAuto = 29
                                     textColorInt = R.color.rma_blue_color
                                 }.lparams(wrapContent, wrapContent)
-                            }.lparams(0, autoSize(80),1.4f)
-
-                            view {
-                                background = resources.getDrawable(R.color.rma_hint_line_color_eee)
-                            }.lparams(autoSize(1), autoSize(80))
-
-                            linearLayout {
-                                gravity = Gravity.CENTER
-                                textView {
-                                    text = "剩余数量"
-                                    textSizeAuto = 29
-                                    textColorInt = R.color.rma_blue_color
-                                }.lparams(wrapContent, wrapContent)
                             }.lparams(0, autoSize(80),1f)
                         }.lparams(matchParent, autoSize(80))
 
+                        recyclerView {
+                            background = resources.getDrawable(R.color.white)
+                            adapter = financeRepoAdapter
+                            isNestedScrollingEnabled = false
+                        }.lparams(matchParent, matchParent)
+
+                        viewModel.wrBuybackDetailDataList.bindOptional(context){
+                            financeRepoAdapter.setNewData(it)
+                        }
+
                     }
 
                 }.lparams(matchParent, matchParent)
@@ -232,9 +236,12 @@ class FinanceRepoActivity : BaseActivity<FinanceManagementViewModel>() {
                 }
 
             }.lparams(matchParent, matchParent)
-
-
         }
     }
 
+    fun _LinearLayout.RepoItemDetails(){
+        linearLayout {
+
+        }.lparams()
+    }
 }

+ 67 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/finance/FinanceRepoViewHolder.kt

@@ -1,2 +1,69 @@
 package cn.muchinfo.rma.view.base.hnstmain.finance
 
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.WrBuybackDetailData
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+
+class FinanceRepoViewHolder(private val activity : AppCompatActivity,private val viewModel: FinanceManagementViewModel) : BaseViewHolder<WrBuybackDetailData>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            linearLayout {
+                background = resources.getDrawable(R.color.white)
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.buybacktime
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_blue_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(110),1f)
+
+                view {
+                    background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                }.lparams(autoSize(1), autoSize(110))
+
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                         data.bindOptional(context){
+                            text = it?.buybackqty
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_blue_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(110),1f)
+
+                view {
+                    background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                }.lparams(autoSize(1), autoSize(110))
+
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                         data.bindOptional(context){
+                            text = it?.buybackamount
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_blue_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(110),1f)
+            }.lparams(matchParent, autoSize(110))
+
+            itemView()
+        }.lparams(matchParent, autoSize(111))
+    }
+
+}

+ 3 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/SpotWareHouseActivity.kt

@@ -130,12 +130,13 @@ class SpotWareHouseActivity : BaseActivity<SpotWareHouseViewModel>(){
 
     override fun onResume() {
         super.onResume()
-        viewModel.queryspotSummaryWrPosition()
+//        viewModel.queryspotSummaryWrPosition()
         viewModel.querySpecifyDealPosition()
         viewModel.querydealPosition()
         viewModel.queryAreCancelWrPosition()
-        viewModel.querywarehouseSummaryWrPosition()
+//        viewModel.querywarehouseSummaryWrPosition()
         viewModel.querydetailsWarehouseWrPosition()
+        viewModel.queryPickUpPosition()
     }
 
     override fun onCreate(savedInstanceState: Bundle?) {

+ 3 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/SpotWareHouseViewModel.kt

@@ -658,13 +658,13 @@ class SpotWareHouseViewModel : BaseViewModel(){
             //仓库
             newRightData.add(it.warehousename ?: "-")
             //库存数量
-            newRightData.add(it.qty ?: "-" + it.enumdicname)
+            newRightData.add(it.qty+ it.enumdicname)
             //冻结数量
-            newRightData.add(it.freezerqty ?: "-" + it.enumdicname)
+            newRightData.add(it.freezerqty + it.enumdicname)
             //质押数量
             newRightData.add("0" + it.enumdicname)//目前需求:质押数量为0
             //可用数量
-            newRightData.add(it.enableqty ?: "-" + it.enumdicname)
+            newRightData.add(it.enableqty + it.enumdicname)
             //仓单编号
             newRightData.add(it.wrholdeno ?: "-")
             //过户时间

+ 4 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/adapter/PickUpContentAdapter.java

@@ -115,9 +115,13 @@ public class PickUpContentAdapter extends RecyclerView.Adapter<PickUpContentAdap
 
         if (data.getApplystatus().equals("4") && data.getApplytype().equals("0")){
             itemViewHolder.settlement_of_registration.setVisibility(View.VISIBLE);
+        }else {
+            itemViewHolder.settlement_of_registration.setVisibility(View.GONE);
         }
         if (data.getApplystatus().equals("2") && data.getApplytype().equals("1")){
             itemViewHolder.midpoints_registration.setVisibility(View.VISIBLE);
+        }else {
+            itemViewHolder.midpoints_registration.setVisibility(View.GONE);
         }
 
         itemViewHolder.all_click_View.setOnClickListener(new View.OnClickListener() {

+ 2 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/reportdetail/ReportCommonDetailsViewModel.kt

@@ -900,8 +900,8 @@ class ReportCommonDetailsViewModel : BaseViewModel(){
             newRightData.add(it.buyusername + "\n" + it.sellusername)//'采购方/\n 销售方 '
             newRightData.add(it.deliverygoodsname + "\n" + it.wrstandardname)//'现货品种/\n 现货品类 '
             newRightData.add(if (it.biztype == "1"){ "套保" }else{ "套利" } + "\n" + NumberUtils.roundNum(it.todaypricedqty,2) + it.enumdicname)//'期现用途/\n 今定价量 ' TODO缺少期现用途
-            newRightData.add(it.middlegoodsname + "\n" + NumberUtils.roundNum(it.diffhedgeqty,2) + it.enumdicname)//'套保品种/\n 套保变动量 ' //
-            newRightData.add(NumberUtils.roundNum(it.diffneedhedgeqty,2) + it.enumdicname)//'应套保变动量 ',
+            newRightData.add(it.middlegoodsname + "\n" + NumberUtils.roundNum(it.diffhedgeqty,2) + it.mgunitname)//'套保品种/\n 套保变动量 ' //
+            newRightData.add(NumberUtils.roundNum(it.diffneedhedgeqty,2) + it.mgunitname)//'应套保变动量 ',
             data.rightData = newRightData
             newList.add(data)
         }

+ 6 - 6
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/BusinessHallActivity.kt

@@ -817,7 +817,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
                         text = "请选择现货仓单"
                         selectSpotDetailsData.bindOptional(context) {
                             maxpickNumber.postValue(Math.min(it?.enableqty?.toDouble()?:0.0,buySelldata?.orderqty?.toDouble() ?: 0.0))
-                            text = it?.wrfactortypeid + "(" + it?.enableqty + it?.enumdicname + ")"
+                            text = it?.ladingbillid + "(" + it?.enableqty + it?.enumdicname + ")"
                         }
                         textSizeAuto = 34
                         textColorInt = R.color.rma_black_33
@@ -908,7 +908,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
                         }
 
                         textView {
-                            text = data.minivalue + "(" +data.enumdicname +"起)"
+                            text =  "(" + data.minivalue +data.enumdicname +"起)"
                             textSizeAuto = 29
                             textColorInt = R.color.rma_hint_text_color_ccc
                         }.lparams(wrapContent, wrapContent) {
@@ -921,7 +921,6 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
                         linearLayout {
                             gravity = Gravity.CENTER_VERTICAL
                             numberEditText {
-                                text = "1"
                                 max = buySelldata.orderqty?.toDouble() ?: 1.0
                                 onePriceInputNumberEdittext = this
                                 setOnTextChangeListener { view, value ->
@@ -941,6 +940,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
                                             .toInt()
                                     }
                                 }
+                                text = "1"
                             }.lparams(0, autoSize(72), 1f) {
                                 marginEnd = autoSize(36)
                             }
@@ -1323,7 +1323,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
                         text = "请选择现货仓单"
                         selectSpotDetailsData.bindOptional(context) {
                             maxpickNumber.postValue(Math.min(it?.enableqty?.toDouble() ?: 0.0,buySelldata.orderqty?.toDouble() ?: 0.0))
-                            text = it?.wrfactortypeid + "(" + it?.enableqty + it?.enumdicname + ")"
+                            text = it?.ladingbillid + "(" + it?.enableqty + it?.enumdicname + ")"
                         }
                         textSizeAuto = 34
                         textColorInt = R.color.rma_black_33
@@ -1414,7 +1414,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
                         }
 
                         textView {
-                            text = data.minivalue + "(" +data.enumdicname +"起)"
+                            text =  "(" + data.minivalue +data.enumdicname +"起)"
                             textSizeAuto = 29
                             textColorInt = R.color.rma_hint_text_color_ccc
                         }.lparams(wrapContent, wrapContent) {
@@ -1906,7 +1906,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
                         }
 
                         textView {
-                            text = data.minivalue + "(" +data.enumdicname +"起)"
+                            text =  "(" + data.minivalue +data.enumdicname +"起)"
                             textSizeAuto = 29
                             textColorInt = R.color.rma_hint_text_color_ccc
                         }.lparams(wrapContent, wrapContent) {

+ 25 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/BusinessHallViewModel.kt

@@ -67,6 +67,31 @@ class BusinessHallViewModel : BaseViewModel(){
     val orderQuoteData : MutableLiveData<OrderQuoteData> = MutableLiveData()
 
     /**
+     * 在无仓单预售下的情况下查询是否有相应的预售仓单持仓
+     */
+    val summaryWrPositionDataByDialog : MutableLiveData<HnstWrPositionData> = MutableLiveData()
+    /**
+     * 查询相应要素下的预售仓单
+     */
+    fun queryorderSummaryWrPosition(deliverygoodsid : String = "",warehouseid : String = "",wrstandardid : String = ""){
+        val params = mutableMapOf<String,String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+            put("querytype","2")
+            put("haswr","0")
+            put("deliverygoodsid",deliverygoodsid)
+            put("warehouseid",warehouseid)
+            put("wrstandardid",wrstandardid)
+        }
+        MyApplication.getInstance()?.warehouseManager?.queryWrPosition(params = params){ isSuccess, respData, error ->
+            if (isSuccess){
+                if (respData?.isNotEmpty() == true){
+                    summaryWrPositionDataByDialog.postValue(respData.get(0))
+                }
+            }
+        }
+    }
+
+    /**
      * 查询一口价报价牌
      */
     fun queryOneOrderQuote(wrpricetype : String,haswr : String,wrfactortypeid : String = "",deliverymonth : String = ""){

+ 39 - 10
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/FloatListedDialog.kt

@@ -119,6 +119,13 @@ fun AppCompatActivity.FloatListedDialog(
     return createCustomDialog(cancelable = false) { dialog ->
         backgroundColor = Color.parseColor("#5f000000")
         initMenuData()
+        if (type == "2") {
+            viewModel.queryorderSummaryWrPosition(
+                deliverygoodsid = data.deliverygoodsid ?: "",
+                warehouseid = data.warehouseid ?: "",
+                wrstandardid = data.wrstandardid ?: ""
+            )
+        }
         verticalLayout {
             viewModel.controlDialogDisappear.bindOptional(context){
                 if (it == true){
@@ -304,6 +311,11 @@ class FloatSellListedUI(
              itemView()
 
             linearLayout {
+                if (type == "2"){//预售挂卖时不需要选择现货仓单
+                    visibility = View.GONE
+                }else{
+                    visibility = View.VISIBLE
+                }
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
                     activity.creatHnstSpotDetailSheetDialog("请选择现货仓单", viewModel.detailsWarehouseContentDataList.value ?: arrayListOf()) {
@@ -323,7 +335,7 @@ class FloatSellListedUI(
                 textView {
                     text = "请选择现货仓单"
                     selectSpotDetailsData.bindOptional(context){
-                        text = it?.wrfactortypeid + "(" + it?.enableqty + it?.enumdicname + ")"
+                        text = it?.ladingbillid + "(" + it?.enableqty + it?.enumdicname + ")"
                     }
                     textSizeAuto = 34
                     textColorInt = R.color.rma_black_33
@@ -555,9 +567,16 @@ class FloatSellListedUI(
                 gravity = Gravity.CENTER_VERTICAL
                 textView {
                     onThrottleFirstClick {
-                        if (selectSpotDetailsData.value?.deliverygoodsid.isNullOrEmpty()){
-                            ToastUtils.showLong("请选择现货仓单明细")
-                            return@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("请输入挂牌数量")
@@ -615,9 +634,9 @@ class FloatSellListedUI(
                         }else{
                             viewModel.requeryWRListingOrderReq(
                                 FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
-                                LadingBillId = selectSpotDetailsData.value?.ladingbillid?.toLong() ?: 0,
+                                LadingBillId = 0,
                                 TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
-                                SubNum = selectSpotDetailsData.value?.subnum?.toLong() ?: 0,
+                                SubNum = 0,
                                 WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 0,
                                 UserID = GlobalDataCollection.instance?.loginRsp?.userID ?: 0,
                                 AccountID = GlobalDataCollection.instance?.accountId ?: 0,
@@ -1059,9 +1078,9 @@ class FloatBuyListedUI(
                                 IsSpecified = 0,
                                 OrderQty = oneNumberInputEdittext.text.toString().toLong(),
                                 DeliveryGoodsID = data.deliverygoodsid?.toInt() ?: 0,
-                                WRPriceType = 1,
+                                WRPriceType = 2,
                                 PriceMove = basisInputEdittext.text.toString().toDouble(),
-                                WRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder().build(),
+                                WRTradeGoods = getWRTradeGoods(data),
                                 TimevalidType = 4,
                                 FirstRatio = 0.0,
                                 PerformanceTemplateID = 0,
@@ -1086,9 +1105,9 @@ class FloatBuyListedUI(
                                 IsSpecified = 0,
                                 OrderQty = oneNumberInputEdittext.text.toString().toLong(),
                                 DeliveryGoodsID = data.deliverygoodsid?.toInt() ?: 0,
-                                WRPriceType = 1,
+                                WRPriceType = 2,
                                 PriceMove = basisInputEdittext.text.toString().toDouble(),
-                                WRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder().build(),
+                                WRTradeGoods = getWRTradeGoods(data),
                                 TimevalidType = 4,
                                 FirstRatio = 0.0,
                                 PerformanceTemplateID = 0,
@@ -1132,4 +1151,14 @@ class FloatBuyListedUI(
             }
         }
     }
+
+    fun getWRTradeGoods(data: OrderQuoteData) : WarehouseTradeMI1.WRGoodsInfo{
+        val wRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder()
+        wRTradeGoods.setGoodsID(data.goodsid?.toInt() ?: 0)
+        wRTradeGoods.setGoodsCode(data.goodscode ?: "")
+        wRTradeGoods.setPriceFactor(1.0)
+        wRTradeGoods.setPriceMove(1.0)
+        wRTradeGoods.setWeightRatio(1.0)
+        return wRTradeGoods.build()
+    }
 }

+ 61 - 23
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/OneListedDialog.kt

@@ -115,6 +115,13 @@ fun AppCompatActivity.OneListedDialog(
     return createCustomDialog(cancelable = false) { dialog ->
         backgroundColor = Color.parseColor("#5f000000")
         initMenuData()
+        if (type == "2") {
+            viewModel.queryorderSummaryWrPosition(
+                deliverygoodsid = data.deliverygoodsid ?: "",
+                warehouseid = data.warehouseid ?: "",
+                wrstandardid = data.wrstandardid ?: ""
+            )
+        }
         verticalLayout {
             viewModel.controlDialogDisappear.bindOptional(context) {
                 if (it == true) {
@@ -297,6 +304,11 @@ class OneSellListedUI(
             itemView()
 
             linearLayout {
+                if (type == "2"){//预售挂卖时不需要选择现货仓单
+                    visibility = View.GONE
+                }else{
+                    visibility = View.VISIBLE
+                }
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
                     activity.creatHnstSpotDetailSheetDialog(
@@ -319,7 +331,7 @@ class OneSellListedUI(
                 textView {
                     text = "请选择现货仓单"
                     selectSpotDetailsData.bindOptional(context) {
-                        text = it?.wrfactortypeid + "(" + it?.enableqty + it?.enumdicname + ")"
+                        text = it?.ladingbillid + "(" + it?.enableqty + it?.enumdicname + ")"
                     }
                     textSizeAuto = 34
                     textColorInt = R.color.rma_black_33
@@ -360,7 +372,9 @@ class OneSellListedUI(
                                             .not()
                                     ) {
                                         var marginamount = value.toString().toDouble()
-                                            .times(oneNumberInputEdittext.text.toString().toDouble())
+                                            .times(
+                                                oneNumberInputEdittext.text.toString().toDouble()
+                                            )
                                         if (marginamount == 0.0) {
                                             one_delisting_amount.text = NumberUtils.roundNum(
                                                 marginamount.toString(),
@@ -385,7 +399,7 @@ class OneSellListedUI(
                         }
 
                         textView {
-                            text = "吨"
+                            text = data.enumdicname
                             textSizeAuto = 34
                             textColorInt = R.color.rma_hint_text_color_ccc
                         }.lparams(wrapContent, wrapContent) {
@@ -474,7 +488,7 @@ class OneSellListedUI(
                         }
 
                         textView {
-                            text = "吨"
+                            text = data.enumdicname
                             textSizeAuto = 31
                             textColorInt = R.color.rma_hint_text_color_ccc
                         }.lparams(wrapContent, wrapContent) {
@@ -530,10 +544,18 @@ class OneSellListedUI(
                 gravity = Gravity.CENTER_VERTICAL
                 textView {
                     onThrottleFirstClick {
-                        if (selectSpotDetailsData.value?.deliverygoodsid.isNullOrEmpty()) {
-                            ToastUtils.showLong("请选择现货仓单明细")
-                            return@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 (onePriceInputEdittext.text.toString().isNullOrEmpty()) {
                             ToastUtils.showLong("请输入挂牌价格")
                             return@onThrottleFirstClick
@@ -556,12 +578,15 @@ class OneSellListedUI(
                             ToastUtils.showLong("请输入起摘数量")
                             return@onThrottleFirstClick
                         }
-                        if (startInputNumber.text.toString().toLong() < data.minivalue?.toLong() ?: 0){
+                        if (startInputNumber.text.toString()
+                                .toLong() < data.minivalue?.toLong() ?: 0
+                        ) {
                             ToastUtils.showLong("起摘数量不能小于" + data.minivalue)
                             return@onThrottleFirstClick
                         }
-                        val selectDetailsData = selectSpotDetailsData.value
+
                         if (type == "1") {
+                            val selectDetailsData = selectSpotDetailsData.value
                             viewModel.requeryWRListingOrderReq(
                                 FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
                                 LadingBillId = selectDetailsData?.ladingbillid?.toLong() ?: 0,
@@ -593,8 +618,8 @@ class OneSellListedUI(
                         } else {
                             viewModel.requeryWRListingOrderReq(
                                 FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
-                                LadingBillId = selectDetailsData?.ladingbillid?.toLong() ?: 0,
-                                SubNum = selectDetailsData?.subnum?.toLong() ?: 0,
+                                LadingBillId = 0,
+                                SubNum = 0,
                                 TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
                                 WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 0,
                                 UserID = GlobalDataCollection.instance?.loginRsp?.userID ?: 0,
@@ -673,12 +698,13 @@ class OneBuyListedUI(
     lateinit var one_delisting_amount: TextView
 
     //履约保证金
-    lateinit var performance_bond_textview : TextView
+    lateinit var performance_bond_textview: TextView
 
     //SeekBar
     lateinit var seekBar: SeekBar
+
     //挂牌最大数量
-    val maxlistedNumber : MutableLiveData<Int> = MutableLiveData()
+    val maxlistedNumber: MutableLiveData<Int> = MutableLiveData()
 
     var marginValue1 = 0.0//履约保证金比例
 
@@ -771,8 +797,12 @@ class OneBuyListedUI(
                                     ) + ")"
                                 }
                                 //这里计算最多购买数量 挂牌最大数量=可用资金/(买方履约保证金比例*挂牌价格)
-                                if (value.toDouble() != 0.0 && marginamount != 0.0){
-                                    maxlistedNumber.postValue(viewModel.usedAccountData.value?.canUserAmount?.div(marginamount)?.div(value.toDouble())?.toInt())
+                                if (value.toDouble() != 0.0 && marginamount != 0.0) {
+                                    maxlistedNumber.postValue(
+                                        viewModel.usedAccountData.value?.canUserAmount?.div(
+                                            marginamount
+                                        )?.div(value.toDouble())?.toInt()
+                                    )
                                 }
                             }
                         }
@@ -820,9 +850,11 @@ class OneBuyListedUI(
                                                 marginValue.toString(),
                                                 2
                                             ) + "(需履约保证金" + NumberUtils.roundNum(
-                                                NumberUtils.doubleDistortion(marginValue?.times(
-                                                    marginValue1
-                                                ).toString()), 2
+                                                NumberUtils.doubleDistortion(
+                                                    marginValue?.times(
+                                                        marginValue1
+                                                    ).toString()
+                                                ), 2
                                             ) + ")"
                                         }
                                     }
@@ -852,7 +884,9 @@ class OneBuyListedUI(
                         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)
+                                oneNumberInputEdittext.text = NumberUtils.roundNum(
+                                    maxlistedNumber.value?.times(p1.div(100.0)).toString(), 0
+                                )
                             }
 
                             override fun onStartTrackingTouch(p0: SeekBar?) {
@@ -878,9 +912,11 @@ class OneBuyListedUI(
                         emptyView()
 
                         textView {
-                            maxlistedNumber.bindOptional(context){
+                            maxlistedNumber.bindOptional(context) {
                                 //最大可交易数量变更后,输入的值要根据seekbar进度来进行更新
-                                oneNumberInputEdittext.text = NumberUtils.roundNum(it?.times(seekBar.progress.div(100.0)).toString(),0)
+                                oneNumberInputEdittext.text = NumberUtils.roundNum(
+                                    it?.times(seekBar.progress.div(100.0)).toString(), 0
+                                )
                                 text = it.toString() + "吨"
                             }
                             textSizeAuto = 29
@@ -1024,14 +1060,16 @@ class OneBuyListedUI(
                             ToastUtils.showLong("请输入起摘数量")
                             return@onThrottleFirstClick
                         }
-                        if (startInputNumber.text.toString().toLong() < data.minivalue?.toLong() ?: 0){
+                        if (startInputNumber.text.toString()
+                                .toLong() < data.minivalue?.toLong() ?: 0
+                        ) {
                             ToastUtils.showLong("起摘数量不能小于" + data.minivalue)
                             return@onThrottleFirstClick
                         }
 
                         if (type == "1") {
                             viewModel.requeryWRListingOrderReq(
-                                FactoryItems =arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
+                                FactoryItems = arrayListOf<WarehouseTradeMI1.DGFactoryItems>(),
                                 TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
                                 WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 0,
                                 UserID = GlobalDataCollection.instance?.loginRsp?.userID ?: 0,

+ 9 - 8
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/WarehouseReceiptFragment.kt

@@ -16,6 +16,7 @@ import cn.muchinfo.rma.view.base.BaseFragment
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
 import cn.muchinfo.rma.view.base.warehousereceipt.dialog.ListedData
+import cn.muchinfo.rma.view.base.warehousereceipt.dialog.WarehouseFloatListedDialog
 import cn.muchinfo.rma.view.base.warehousereceipt.dialog.WarehouseOneListedDialog
 import cn.muchinfo.rma.view.base.warehousereceipt.floata.FloatPriceAdapter
 import cn.muchinfo.rma.view.base.warehousereceipt.one.OnePriceAdapter
@@ -137,9 +138,9 @@ class WarehouseReceiptFragment : BaseFragment<WarehouseReceiptViewModel>(){
         mdDisposable = Flowable.interval(5, 10, TimeUnit.SECONDS)
             .doOnNext {
                 if (selectedTabIndex == 0){
-                    viewModel.queryOneOrderQuote()
+                    viewModel.queryOneOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid ?: "",warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
                 }else{
-                    viewModel.queryFloatOrderQuote("")
+                    viewModel.queryFloatOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid ?: "",warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
                 }
             }.subscribe()
         // 销毁 mdDisposable.dispose();   这个是销毁
@@ -164,7 +165,7 @@ class WarehouseReceiptFragment : BaseFragment<WarehouseReceiptViewModel>(){
                         if (selectedTabIndex == 0){//一口价
                             getAppCompatActivity().WarehouseOneListedDialog(activity = getAppCompatActivity(),viewModel = viewModel,type = "1",data = it ?: ListedData()).show()
                         }else{//浮动价
-
+                            getAppCompatActivity().WarehouseFloatListedDialog(activity = getAppCompatActivity(),viewModel = viewModel,type = "1",data = it ?: ListedData()).show()
                         }
                     }
                 }
@@ -289,7 +290,7 @@ class OnePriceUI(private val fragment : Fragment,private val viewModel: Warehous
     val root = _FrameLayout(fragment.context!!).apply {
         verticalLayout {
             linearLayout {
-                viewModel.queryOneOrderQuote()
+                viewModel.queryOneOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid ?: "",warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
                 linearLayout {
                     gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
                     textView {//待点价头部左侧数据
@@ -343,7 +344,7 @@ class OnePriceUI(private val fragment : Fragment,private val viewModel: Warehous
             statusLayout(contentBlock = {
                 statusLayout = this
                 setRetryAction {
-                    viewModel.queryOneOrderQuote()
+                    viewModel.queryOneOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid ?: "",warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
                 }
 
                 swipeToLoadLayout {
@@ -351,7 +352,7 @@ class OnePriceUI(private val fragment : Fragment,private val viewModel: Warehous
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-                        viewModel.queryOneOrderQuote()
+                        viewModel.queryOneOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid ?: "",warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)
@@ -455,7 +456,7 @@ class FloatingPriceUI(private val fragment : Fragment,private val viewModel: War
 
     val root = _FrameLayout(fragment.context!!).apply {
         verticalLayout {
-            viewModel.queryFloatOrderQuote()
+            viewModel.queryFloatOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid ?: "",warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
             linearLayout {
                 linearLayout {
                     gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
@@ -518,7 +519,7 @@ class FloatingPriceUI(private val fragment : Fragment,private val viewModel: War
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-                        viewModel.queryFloatOrderQuote("")
+                        viewModel.queryFloatOrderQuote(wrstandardid = viewModel.selectWrFtWrstandardData.value?.wrstandardid ?: "",warehouseid = viewModel.getSelectWarehouseOrFactoryid("1"),dgitemname = viewModel.getSelectWarehouseOrFactoryid("2"))
 //                        viewModel.queryQuoteDay(
 //                            tag = thisTag ?: "",
 //                            first = fistShow,

+ 125 - 25
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/WarehouseReceiptViewModel.kt

@@ -12,6 +12,7 @@ import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
 import cn.muchinfo.rma.view.base.main.castsurely.JsonBean
 import cn.muchinfo.rma.view.base.warehousereceipt.dialog.ListedData
+import com.blankj.utilcode.util.LogUtils
 import kotlinx.coroutines.GlobalScope
 import kotlinx.coroutines.launch
 import mtp.polymer.com.autowidget.dialog.SelectData
@@ -61,6 +62,11 @@ class WarehouseReceiptViewModel : BaseViewModel(){
     val usedAccountData : MutableLiveData<AccountData> = MutableLiveData()
 
     /**
+     * 交易页面的当前商品的盘面信息
+     */
+    val quoteDayData: MutableLiveData<QuoteDayData> = MutableLiveData()
+
+    /**
      * 库存明细
      */
     val detailsWarehouseContentDataList: MutableLiveData<List<HoldLBData>> = MutableLiveData()
@@ -205,12 +211,12 @@ class WarehouseReceiptViewModel : BaseViewModel(){
     /**
      * 查询现货明细
      */
-    fun querydetailsWarehouseWrPosition(data : OrderQuoteData){
+    fun querydetailsWarehouseWrPosition(data : ListedData){
         val params = mutableMapOf<String,String>().apply {
             put("accountid", GlobalDataCollection.instance?.accountId.toString())
-            put("warehouseid",data.warehouseid ?: "")
-            put("deliverygoodsid",data.deliverygoodsid ?: "")
-            put("wrstandardid",data.wrstandardid ?: "")
+            put("warehouseid",data.getWarehouseid())
+            put("deliverygoodsid", data.DeliveryGoodsID)
+            put("wrstandardid",data.WrFtWrstandard.wrstandardid ?: "")
         }
         MyApplication.getInstance()?.warehouseManager?.queryHoldLB(params = params){isSuccess, respData, error ->
             if (isSuccess){
@@ -224,8 +230,8 @@ class WarehouseReceiptViewModel : BaseViewModel(){
     fun getSelectWarehouseOrFactoryid(type : String) : String{
         var returnString = ""
         WrStandardFactoryItemDataList.value?.forEach {
-            if (type == "1"){
-                if ("1" == it.dgfactoryitemtypeid){
+            if (type == "1"){//取仓库id
+                if (it.dgfactoryitemtypeid == "1"){
                     it.itemlst?.forEach { data ->
                         if (data.isSelect == 1){
                             returnString = data.warehouseid ?: ""
@@ -233,9 +239,11 @@ class WarehouseReceiptViewModel : BaseViewModel(){
                     }
                 }
             }else{
-                it.itemlst?.forEach { data ->
-                    if (data.isSelect == 1){
-                        returnString = returnString + "," + data.dgfactoryitemid
+                if (it.dgfactoryitemtypeid != "1"){
+                    it.itemlst?.forEach { data ->
+                        if (data.isSelect == 1){
+                            returnString = returnString + "," + data.dgfactoryitemid
+                        }
                     }
                 }
             }
@@ -243,13 +251,29 @@ class WarehouseReceiptViewModel : BaseViewModel(){
         return returnString
     }
 
+    //获取选择的仓库ID和选择的要素类型 是否全部选择
+    fun getSelectBooble() : Boolean{
+        var selectNum = 0
+        var returnBooble = false
+        WrStandardFactoryItemDataList.value?.forEach {
+            it.itemlst?.forEach { data ->
+                if (data.isSelect == 1){
+                    selectNum = selectNum.plus(1)
+                }
+            }
+        }
+        returnBooble = selectNum >= WrStandardFactoryItemDataList.value?.size ?: 0
+        return returnBooble
+    }
+
+
     //根据选择的商品组组织商品选择列表
     fun setGoodsInfoList(goodsgroupid : String){
         val newGoodsInfoList = arrayListOf<SelectData>()
         val goodsInfoList1 = DataBase.getInstance().goodsInfoDao().all
         goodsInfoList1?.forEach {
             if (it?.goodsgroupid.toString() == goodsgroupid){
-                newGoodsInfoList.add(SelectData(id = it?.goodsid.toString(),value = it?.goodsname.toString()))
+                newGoodsInfoList.add(SelectData(id = it?.goodsid.toString(),value = it?.goodsname.toString(),goodsCode = it.goodscode))
             }
         }
         goodsInfoList.postValue(newGoodsInfoList)
@@ -382,6 +406,19 @@ class WarehouseReceiptViewModel : BaseViewModel(){
         return deliverygoodsid
     }
 
+    //通过选择的wrstandardid查找相对应的实体
+    fun getWrFtWrstandardByWRStandardID(wrstandardid : String = "") : WrFtWrstandard{
+        var WrFtWrstandard = WrFtWrstandard()
+        ftDeliveryGoodsDataList.value?.forEach {
+            it.wdlst?.forEach { data ->
+                if (data.wrstandardid == wrstandardid){
+                    WrFtWrstandard = data
+                }
+            }
+        }
+        return WrFtWrstandard
+    }
+
     /**
      * 查询一口价报价牌用余挂牌时的筛选
      * wrstandardid 品类id
@@ -408,10 +445,10 @@ class WarehouseReceiptViewModel : BaseViewModel(){
             if (isSuccess){
                 if (respData.isNullOrEmpty().not()){
                     orderQuoteDataByListed.postValue(respData?.get(0))
-                    resetSelectContent()
+
                 }else{
-                    noWRFactorTypeIdDataForListed.postValue(ListedData(DeliveryGoodsID = getDeliveryGoodsIDByWRStandardID(wrstandardid),WRStandardID = wrstandardid,FactoryItemsList = WrStandardFactoryItemDataList.value ?: arrayListOf()))
-                    resetSelectContent()
+                    noWRFactorTypeIdDataForListed.postValue(ListedData(DeliveryGoodsID = getDeliveryGoodsIDByWRStandardID(wrstandardid),WrFtWrstandard = getWrFtWrstandardByWRStandardID(wrstandardid),FactoryItemsList = WrStandardFactoryItemDataList.value ?: arrayListOf()))
+
                 }
             }
         }
@@ -438,10 +475,6 @@ class WarehouseReceiptViewModel : BaseViewModel(){
                 put("dgitemname",dgitemname)
             }
         }
-        if (wrstandardid.isNotEmpty()){
-            resetSelectContent()
-        }
-
         MyApplication.getInstance()?.quoteManager?.queryOrderQuote(params = params){isSuccess, respData, error ->
             if (isSuccess){
                 onePrcieDataList.postValue(respData)
@@ -450,7 +483,7 @@ class WarehouseReceiptViewModel : BaseViewModel(){
     }
 
     /**
-     * 查询浮动价报价牌
+     * 查询浮动价报价牌用于挂牌
      */
     fun queryFloatOrderQuoteByListed(wrstandardid : String = "",warehouseid : String = "",dgitemname : String = ""){
         val params = mutableMapOf<String,String>().apply {
@@ -472,10 +505,10 @@ class WarehouseReceiptViewModel : BaseViewModel(){
             if (isSuccess){
                 if (respData.isNullOrEmpty().not()){
                     orderQuoteDataByListed.postValue(respData?.get(0))
-                    resetSelectContent()
+
                 }else{
-                    noWRFactorTypeIdDataForListed.postValue(ListedData(DeliveryMonth = getDeliveryGoodsIDByWRStandardID(wrstandardid),WRStandardID = warehouseid,FactoryItemsList = WrStandardFactoryItemDataList.value ?: arrayListOf()))
-                    resetSelectContent()
+                    noWRFactorTypeIdDataForListed.postValue(ListedData(goodsId = selectGoodsInfoData.value?.id ?: "",goodsCode = selectGoodsInfoData.value?.goodsCode ?: "",DeliveryGoodsID = getDeliveryGoodsIDByWRStandardID(wrstandardid),WrFtWrstandard = getWrFtWrstandardByWRStandardID(wrstandardid),FactoryItemsList = WrStandardFactoryItemDataList.value ?: arrayListOf()))
+
                 }
             }
         }
@@ -500,10 +533,6 @@ class WarehouseReceiptViewModel : BaseViewModel(){
                 put("dgitemname",dgitemname)
             }
         }
-        if (wrstandardid.isNotEmpty()){
-            resetSelectContent()
-        }
-
         MyApplication.getInstance()?.quoteManager?.queryOrderQuote(params = params){isSuccess, respData, error ->
             if (isSuccess){
                 floatProceDataList.postValue(respData)
@@ -566,4 +595,75 @@ class WarehouseReceiptViewModel : BaseViewModel(){
         }
     }
 
+
+    /**
+     * 请求盘面信息
+     * @param first Int
+     * @param last Int
+     * @param callback Function2<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun queryQuoteDayByListed(
+        tag: String,
+        goodsCodes: String,
+        isShowLoading: Boolean
+    ) {
+        if (isShowLoading) {
+            loadingDialogStatus.postValue(TaskUiModel.inFlight())
+        }
+
+        val params = mutableMapOf<String, String>().apply {
+            put("goodsCodes", goodsCodes)
+        }
+        MyApplication.getInstance()?.futureManager?.queryQuoteDay(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                if (respData?.isEmpty()?.not() == true) {
+                    quoteDayData.postValue(respData[0])
+                }
+                if (isShowLoading) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "数据请求成功"))
+                }
+
+            } else {
+                if (isShowLoading) {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = "数据请求失败"
+                            )
+                        )
+                    )
+                }
+            }
+        }
+        addSubscriptQuote(tag = tag, goodsCodes = setOf(goodsCodes))
+    }
+
+
+    /**
+     * 订阅行情
+     * @param tag String
+     * @param goodsInfoList List<GoodsInfo>
+     */
+    fun addSubscriptQuote(tag: String, goodsCodes: Set<String>) {
+        GlobalScope.launch {
+            MyApplication.getInstance()?.quoteManager?.addSubscriptQuote(
+                tag = tag, goodsCodeSet = goodsCodes
+            ) { isCompleted, err ->
+                LogUtils.eTag("订阅行情", goodsCodes)
+            }
+        }
+    }
+
+    /**
+     * 取消订阅
+     * @param tag String
+     */
+    fun removeSubscriptQuote(tag: String) {
+        GlobalScope.launch {
+            MyApplication.getInstance()?.quoteManager?.removeSubscriptQuote(
+                tag = tag
+            )
+        }
+    }
+
 }

+ 5 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/WarehouseScreeningDialog.kt

@@ -228,8 +228,10 @@ fun AppCompatActivity.WarehouseScreeningDialog(
 
                     textView {
                         onThrottleFirstClick {
+                            viewModel.queryOneOrderQuote()
+                            viewModel.queryFloatOrderQuote()
                             dialog.dismiss()
-                            viewModel.selectWrFtWrstandardData.postValue(WrFtWrstandard())
+                            viewModel.resetSelectContent()
                         }
                         backgroundResource = R.drawable.rma_item_click_bg
                         gravity = Gravity.CENTER
@@ -279,8 +281,8 @@ fun AppCompatActivity.WarehouseScreeningDialog(
                                     return@onThrottleFirstClick
                                 }
                             }
-                            if (viewModel.getSelectWarehouseOrFactoryid("2").split(",").size < viewModel.WrStandardFactoryItemDataList.value?.size?.minus(1) ?: 0){
-                                ToastUtils.showLong("请选择必要要素")
+                            if (!viewModel.getSelectBooble()){
+                                ToastUtils.showLong("挂牌时每个属性都需要选择一个具体的选项")
                                 return@onThrottleFirstClick
                             }
                             if (type == "1"){

+ 35 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/ListedData.kt

@@ -1,16 +1,50 @@
 package cn.muchinfo.rma.view.base.warehousereceipt.dialog
 
 import cn.muchinfo.rma.global.data.FtDeliveryGoodsDataListData
+import cn.muchinfo.rma.global.data.WrFtWrstandard
 import cn.muchinfo.rma.protobuf.protoclasses.WarehouseTradeMI1
 
 //无仓单要素id时的挂单需要传的参数
 data class ListedData(
+    var goodsCode : String = "",//浮动价选择的期货商品code
+    var goodsId : String = "",//浮动价选择的期货商品ID
     var DeliveryGoodsID : String = "",
-    var WRStandardID : String = "",
+    var WrFtWrstandard : WrFtWrstandard = WrFtWrstandard(),
     var DeliveryMonth : String = "",//预售时填入的值,交收月
     var FactoryItemsList : List<FtDeliveryGoodsDataListData> = arrayListOf()//要素类型明细集合(没有仓单要素ID填写)
 ){
 
+    //获取仓库id
+    fun getWarehouseid() :String{
+        var returnString = ""
+        FactoryItemsList.forEach {
+            if (it.dgfactoryitemtypeid == "1"){//1专指仓库
+                it.itemlst?.forEach { data ->
+                    if (data.isSelect == 1){
+                        returnString = data.warehouseid ?: ""
+                    }
+                }
+            }
+        }
+        return returnString
+    }
+
+    //商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm
+    fun getdgitemname() : String{
+        var returnString = ""
+        FactoryItemsList.forEach {
+            if (it.dgfactoryitemtypeid != "1"){//1专指仓库
+                it.itemlst?.forEach { data ->
+                    if (data.isSelect == 1){
+                        returnString = returnString + "," + data.dgfactoryitemid
+                    }
+                }
+            }
+        }
+        return returnString
+    }
+
+    //获取仓单要素集合
     fun getFactoryItems(): List<WarehouseTradeMI1.DGFactoryItems>{
         val factoryItemsList = arrayListOf<WarehouseTradeMI1.DGFactoryItems>()
         FactoryItemsList.forEach {
@@ -25,7 +59,6 @@ data class ListedData(
             FactoryItems.setItemTypeMode(1)
             factoryItemsList.add(FactoryItems.build())
         }
-
         return factoryItemsList
     }
 }

+ 35 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/ListedNoWrfactortypeidActivity.kt

@@ -0,0 +1,35 @@
+package cn.muchinfo.rma.view.base.warehousereceipt.dialog
+
+import android.os.Bundle
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.commonLeftButton
+import cn.muchinfo.rma.view.autoWidget.commonTitle
+import cn.muchinfo.rma.view.autoWidget.topBar
+import cn.muchinfo.rma.view.base.BaseActivity
+import org.jetbrains.anko.verticalLayout
+
+/**
+ * 用于无仓单要素id 的挂牌
+ */
+class ListedNoWrfactortypeidActivity : BaseActivity<ListedNoWrfactortypeidViewModel>(){
+
+    val titleName by lazy { intent.getStringExtra("titlename") }
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+            background = resources.getDrawable(R.color.white)
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = titleName
+                }
+            }
+
+
+
+
+        }
+    }
+
+}

+ 12 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/ListedNoWrfactortypeidViewModel.kt

@@ -0,0 +1,12 @@
+package cn.muchinfo.rma.view.base.warehousereceipt.dialog
+
+import cn.muchinfo.rma.view.base.BaseViewModel
+
+/**
+ * 用于在最外部挂牌用
+ */
+class ListedNoWrfactortypeidViewModel : BaseViewModel(){
+
+
+
+}

+ 1102 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/WarehouseFloatListedDialog.kt

@@ -0,0 +1,1102 @@
+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.core.view.isInvisible
+import androidx.lifecycle.MutableLiveData
+import androidx.viewpager.widget.PagerAdapter
+import androidx.viewpager.widget.ViewPager
+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.autoWidget.view.MangeNumberEditText3
+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
+import org.w3c.dom.Text
+
+/**
+ * 浮动价的买卖挂牌(此页面是进入买卖大厅有仓单要素id的浮动价挂牌)
+ * @receiver AppCompatActivity
+ * @param activity AppCompatActivity
+ * @param viewModel BusinessHallViewModel
+ * @param data OrderQuoteData
+ * @return CustomDialogFragment
+ */
+fun AppCompatActivity.WarehouseFloatListedDialog(
+    activity: AppCompatActivity,
+    type: String,
+    viewModel: WarehouseReceiptViewModel,
+    data : ListedData
+): CustomDialogFragment {
+
+    val tag = "quotetag"
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    lateinit var viewPager: ViewPager
+
+    //浮动价卖挂牌
+    val oneSellListedUI by lazy {
+        FloatSellListedUI(activity,viewModel,type,data,tag)
+    }
+
+    //浮动价买挂牌
+    val oneBuyListedUI by lazy {
+        FloatBuyListedUI(activity, viewModel,type,data,tag)
+    }
+
+    //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()
+        viewModel.resetAccountData()
+        viewModel.queryQuoteDayByListed(tag = tag,goodsCodes = data.goodsCode,isShowLoading = false)
+        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(selectedTabIndex)
+        }.lparams(matchParent, matchParent){
+            topMargin = autoSize(120)
+        }
+    }
+}
+
+//浮动价卖挂牌
+class FloatSellListedUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: WarehouseReceiptViewModel,
+    private val type: String,
+    data : ListedData,
+    tag : String//订阅标示
+) {
+
+    //选择的现货仓单明细数据
+    val selectSpotDetailsData : MutableLiveData<HoldLBData> = MutableLiveData()
+
+    //选择的资金账号
+    val selectAccountData : MutableLiveData<AccountData> = MutableLiveData()
+
+    //基差输入
+    lateinit var basisInputEdittext : MangeNumberEditText3
+
+    //初始化后基差是否被define
+    var isdefineByBasis : Boolean = false
+
+    //数量
+    lateinit var listednumberEdittext : MangeNumberEditText2
+
+    //起摘数量输入框
+    lateinit var startInputNumber : EditText
+
+    //估算总额
+    lateinit var float_delisting_amount : TextView
+
+    //估算总价
+    lateinit var float_total_amount : TextView
+
+    lateinit var max_number : TextView
+
+    //浮动价挂牌金额
+    val listed_price : MutableLiveData<Double> = MutableLiveData()
+
+    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("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)
+                    }
+                }
+                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)
+
+                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(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?.ladingbillid + "(" + 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 {
+                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"
+                            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(0, autoSize(72),1f){
+                            marginEnd = autoSize(36)
+                        }
+
+                        textView {
+                            text = data.WrFtWrstandard.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(0,0,0,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 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 {
+                            max_number = this
+                            selectSpotDetailsData.bindOptional(context){
+                                text = it?.enableqty
+                            }
+                            text = "1"
+                            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 {
+                            startInputNumber = this
+                            hint = "请输入起摘数量"
+                            background = null
+                            inputType = EditorInfo.TYPE_CLASS_NUMBER
+//                            setDecimalInputType()
+                            hintColorStr = "#CCCCCC"
+                            textSizeAuto = 31
+                            textColorStr = "#333333"
+                        }.lparams(0, autoSize(132),1f){
+                            topMargin = autoSize(15)
+                        }
+
+                        textView {
+                            text = data.WrFtWrstandard.enumdicname
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent){
+                            marginEnd = autoSize(36)
+                        }
+                    }.lparams(matchParent, autoSize(100))
+
+                    textView {
+                        text = "最小单位" + data.WrFtWrstandard.minivalue + data.WrFtWrstandard.enumdicname
+                        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 = "--"
+                    listed_price.bindOptional(context){
+                        text = NumberUtils.roundNum(it ?: 0.0,2)
+                    }
+                    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) + ")"
+                            }
+                        }
+                    }
+                    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)
+                }
+                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 (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.WrFtWrstandard.minivalue?.toLong() ?: 0){
+                            ToastUtils.showLong("起摘数量不能小于" + data.WrFtWrstandard.minivalue)
+                            return@onThrottleFirstClick
+                        }
+                        viewModel.requeryWRListingOrderReq(
+                            FactoryItems = data.getFactoryItems(),
+                            LadingBillId = selectSpotDetailsData.value?.ladingbillid?.toLong() ?: 0,
+                            TradeDate = TimeUtils.getNowTime("yyyyMMdd"),
+                            SubNum = selectSpotDetailsData.value?.subnum?.toLong() ?: 0,
+                            WRFactorTypeId = 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.WrFtWrstandard.wrstandardid?.toInt() ?: 0
+                        ){
+                            viewModel.removeSubscriptQuote(tag = tag)
+                            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.removeSubscriptQuote(tag = tag)
+                        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 getWRTradeGoods(data: ListedData) : WarehouseTradeMI1.WRGoodsInfo{
+        val wRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder()
+        wRTradeGoods.setGoodsID(data.goodsId.toInt())
+        wRTradeGoods.setGoodsCode(data.goodsCode)
+        wRTradeGoods.setPriceFactor(1.0)
+        wRTradeGoods.setPriceMove(1.0)
+        wRTradeGoods.setWeightRatio(1.0)
+        return wRTradeGoods.build()
+    }
+}
+
+//浮动价买挂牌
+class FloatBuyListedUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: WarehouseReceiptViewModel,
+    type: String,
+    data : ListedData,
+    tag : String//订阅标示
+) {
+    //选择的资金账号
+    val selectAccountData : MutableLiveData<AccountData> = MutableLiveData()
+
+    //基差
+    lateinit var basisInputEdittext : MangeNumberEditText3
+
+    //初始化后基差是否被define
+    var isdefineByBasis : Boolean = false
+
+    //挂牌数量
+    lateinit var oneNumberInputEdittext : MangeNumberEditText2
+
+    //起摘数量输入框
+    lateinit var startInputNumber : EditText
+
+    //摘牌金额
+    lateinit var one_delisting_amount : TextView
+
+    //估算总额
+    lateinit var float_delisting_amount : TextView
+
+    //估算总价
+    lateinit var float_total_amount : TextView
+
+    //SeekBar
+    lateinit var seekBar: SeekBar
+
+    //挂牌最大数量
+    val maxlistedNumber : MutableLiveData<Int> = MutableLiveData()
+
+    //浮动价挂牌金额
+    val listed_price : MutableLiveData<Double> = 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 {
+            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))
+                }
+            }
+            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)
+
+
+
+                numberEditText3 {
+                    text = "0"
+                    basisInputEdittext = this
+                    isdefineByBasis = true
+                    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
+                    }
+                    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(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 ->
+
+                            }
+
+                        }.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)
+                        thumbOffset = 0
+                        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){
+                                oneNumberInputEdittext.text = NumberUtils.roundNum(it?.times(seekBar.progress.div(100.0)).toString(),0)
+                                text = it.toString() +data.WrFtWrstandard.enumdicname
+                            }
+                            textSizeAuto = 29
+                            textColorInt = R.color.rma_gray_color
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(matchParent, wrapContent){
+                        marginEnd = autoSize(110)
+                        topMargin = autoSize(10)
+                    }
+
+                }.lparams(matchParent, autoSize(290))
+            }.lparams(matchParent, autoSize(290))
+
+            itemView()
+
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                linearLayout {
+                    textView {
+                        text = "起摘数量"
+                        textSizeAuto = 34
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(36)
+                    }
+                }.lparams(autoSize(250), wrapContent)
+
+                verticalLayout {
+                    linearLayout {
+                        editText {
+                            startInputNumber = this
+                            hint = "请输入起摘数量"
+                            background = null
+//                            inputType = EditorInfo.TYPE_CLASS_NUMBER or EditorInfo.TYPE_NUMBER_FLAG_DECIMAL or EditorInfo.TYPE_NUMBER_FLAG_SIGNED
+//                            setDecimalInputType()
+                            hintColorStr = "#CCCCCC"
+                            textSizeAuto = 31
+                            textColorStr = "#333333"
+                        }.lparams(0, autoSize(132),1f){
+                            topMargin = autoSize(15)
+                        }
+
+                        textView {
+                            text = data.WrFtWrstandard.enumdicname
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent){
+                            marginEnd = autoSize(36)
+                        }
+                    }.lparams(matchParent, autoSize(100))
+
+                    textView {
+                        text = "最小单位" + data.WrFtWrstandard.minivalue + data.WrFtWrstandard.enumdicname
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(5)
+                    }
+                }.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 = "--"
+                    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())
+                        }
+                    }
+                    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(oneNumberInputEdittext.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)
+                }
+                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 (basisInputEdittext.text.toString().isNullOrEmpty()){
+                            ToastUtils.showLong("请输入基差")
+                            return@onThrottleFirstClick
+                        }
+                        if (basisInputEdittext.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 (startInputNumber.text.toString().toLong() < data.WrFtWrstandard.minivalue?.toLong() ?: 0){
+                            ToastUtils.showLong("起摘数量不能小于" + data.WrFtWrstandard.minivalue)
+                            return@onThrottleFirstClick
+                        }
+                        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(),
+                            WRPriceType = 2,
+                            PriceMove = basisInputEdittext.text.toString().toDouble(),
+                            WRTradeGoods = getWRTradeGoods(data),
+                            TimevalidType = 4,
+                            FirstRatio = 0.0,
+                            PerformanceTemplateID = 0,
+                            BuyOrSell = 0,
+                            PriceDisplayMode = 1,
+                            CanBargain = 0,
+                            ApplyID = 0,
+                            CanPart = 1,
+                            HasWr = 1,
+                            DelistMinQty = startInputNumber.text.toString().toLong(),
+                            WRStandardID = data.WrFtWrstandard.wrstandardid?.toInt() ?: 0
+                        ){
+                            viewModel.removeSubscriptQuote(tag = tag)
+                            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 getWRTradeGoods(data: ListedData) : WarehouseTradeMI1.WRGoodsInfo{
+        val wRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder()
+        wRTradeGoods.setGoodsID(data.goodsId.toInt())
+        wRTradeGoods.setGoodsCode(data.goodsCode)
+        wRTradeGoods.setPriceFactor(1.0)
+        wRTradeGoods.setPriceMove(1.0)
+        wRTradeGoods.setWeightRatio(1.0)
+        return wRTradeGoods.build()
+    }
+}

+ 34 - 33
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/WarehouseOneListedDialog.kt

@@ -116,6 +116,8 @@ fun AppCompatActivity.WarehouseOneListedDialog(
     return createCustomDialog(cancelable = false) { dialog ->
         backgroundColor = Color.parseColor("#5f000000")
         initMenuData()
+        viewModel.querydetailsWarehouseWrPosition(data = data)
+        viewModel.resetAccountData()
         verticalLayout {
             viewModel.controlDialogDisappear.bindOptional(context) {
                 if (it == true) {
@@ -220,6 +222,7 @@ class OneSellListedUI(
                         "请选择资金账号",
                         GlobalDataCollection.instance?.accountDataList ?: arrayListOf()
                     ) {
+                        viewModel.resetAccountDataBySelect(this)
                         selectAccountData.postValue(this)
                     }
                 }
@@ -308,19 +311,19 @@ class OneSellListedUI(
                     setOnTextChangeListener { view, value ->
                         if (value.isNullOrEmpty().not()) {
                             if (oneNumberInputEdittext.text.toString().isNullOrEmpty().not()) {
-                                var marginValue = value.toString().toDouble()
+                                var amount = value.toString().toDouble()
                                     .times(oneNumberInputEdittext.text.toString().toDouble())
-                                if (marginValue == 0.0) {
+                                if (amount == 0.0) {
                                     one_delisting_amount.text = NumberUtils.roundNum(
-                                        marginValue.toString(),
+                                        amount.toString(),
                                         2
                                     )
                                 } else {
                                     one_delisting_amount.text = NumberUtils.roundNum(
-                                        marginValue.toString(),
+                                        amount.toString(),
                                         2
                                     ) + "(需履约保证金" + NumberUtils.roundNum(
-                                        marginValue?.times(
+                                        amount.times(
                                             marginValue
                                         ) ?: 0.0, 2
                                     ) + ")"
@@ -463,7 +466,6 @@ class OneSellListedUI(
                 verticalLayout {
                     linearLayout {
                         editText {
-                            setText("1")
                             startInputNumber = this
                             hint = "请输入起摘数量"
                             background = null
@@ -473,10 +475,11 @@ class OneSellListedUI(
                             textSizeAuto = 31
                             textColorStr = "#333333"
                         }.lparams(0, autoSize(132), 1f) {
+                            topMargin = autoSize(15)
                         }
 
                         textView {
-                            text = "吨"
+                            text = data.WrFtWrstandard.enumdicname
                             textSizeAuto = 31
                             textColorInt = R.color.rma_hint_text_color_ccc
                         }.lparams(wrapContent, wrapContent) {
@@ -586,7 +589,7 @@ class OneSellListedUI(
                                 CanPart = 1,
                                 HasWr = 1,
                                 DelistMinQty = startInputNumber.text.toString().toLong(),
-                                WRStandardID = data.WRStandardID?.toInt() ?: 0
+                                WRStandardID = data.WrFtWrstandard.wrstandardid?.toInt() ?: 0
                             ) {
                                 viewModel.controlDialogDisappear.postValue(true)
                             }
@@ -601,7 +604,7 @@ class OneSellListedUI(
                                 AccountID = selectAccountData.value?.accountid ?: 0,
                                 IsSpecified = 0,
                                 OrderQty = oneNumberInputEdittext.text.toString().toLong(),
-                                DeliveryGoodsID = data.DeliveryGoodsID?.toInt() ?: 0,
+                                DeliveryGoodsID = data.DeliveryGoodsID.toInt(),
                                 WRPriceType = 1,
                                 FixedPrice = onePriceInputEdittext.text.toString().toDouble(),
                                 WRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder().build(),
@@ -615,7 +618,7 @@ class OneSellListedUI(
                                 CanPart = 1,
                                 HasWr = 0,
                                 DelistMinQty = startInputNumber.text.toString().toLong(),
-                                WRStandardID = data.WRStandardID?.toInt() ?: 0
+                                WRStandardID = data.WrFtWrstandard.wrstandardid?.toInt() ?: 0
                             ) {
                                 viewModel.controlDialogDisappear.postValue(true)
                             }
@@ -701,6 +704,7 @@ class OneBuyListedUI(
                         "请选择资金账号",
                         GlobalDataCollection.instance?.accountDataList ?: arrayListOf()
                     ) {
+                        viewModel.resetAccountDataBySelect(this)
                         selectAccountData.postValue(this)
                     }
                 }
@@ -751,19 +755,19 @@ class OneBuyListedUI(
                         if (value.isNullOrEmpty().not()) {
                             if (oneNumberInputEdittext.text.toString().isNullOrEmpty().not()) {
                                 //这里计算金额和履约保证金
-                                var marginValue = value.toString().toDouble()
+                                var amount = value.toString().toDouble()
                                     .times(oneNumberInputEdittext.text.toString().toDouble())
-                                if (marginValue == 0.0) {
+                                if (amount == 0.0) {
                                     one_delisting_amount.text = NumberUtils.roundNum(
-                                        marginValue.toString(),
+                                        amount.toString(),
                                         2
                                     )
                                 } else {
                                     one_delisting_amount.text = NumberUtils.roundNum(
-                                        marginValue.toString(),
+                                        amount.toString(),
                                         2
                                     ) + "(需履约保证金" + NumberUtils.roundNum(
-                                        marginValue.times(
+                                        amount.times(
                                             marginValue
                                         ) ?: 0.0, 2
                                     ) + ")"
@@ -806,19 +810,19 @@ class OneBuyListedUI(
                                     if (onePriceInputEdittext.text.toString().isNullOrEmpty()
                                             .not()
                                     ) {
-                                        var marginValue = value.toString().toDouble()
-                                            .times(oneNumberInputEdittext.text.toString().toDouble())
-                                        if (marginValue == 0.0) {
+                                        var amount = value.toString().toDouble()
+                                            .times(onePriceInputEdittext.text.toString().toDouble())
+                                        if (amount == 0.0) {
                                             one_delisting_amount.text = NumberUtils.roundNum(
-                                                marginValue.toString(),
+                                                amount.toString(),
                                                 2
                                             )
                                         } else {
                                             one_delisting_amount.text = NumberUtils.roundNum(
-                                                marginValue.toString(),
+                                                amount.toString(),
                                                 2
                                             ) + "(需履约保证金" + NumberUtils.roundNum(
-                                                marginValue.times(
+                                                amount.times(
                                                     marginValue
                                                 ) ?: 0.0, 2
                                             ) + ")"
@@ -850,7 +854,7 @@ class OneBuyListedUI(
                         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)
+                                oneNumberInputEdittext.text = NumberUtils.roundNum(maxlistedNumber.value?.times(p1.div(100.0)).toString(),0)
                             }
 
                             override fun onStartTrackingTouch(p0: SeekBar?) {
@@ -878,8 +882,8 @@ class OneBuyListedUI(
                         textView {
                             maxlistedNumber.bindOptional(context){
                                 //最大可交易数量变更后,输入的值要根据seekbar进度来进行更新
-//                                oneNumberInputEdittext.text = NumberUtils.roundNum(it?.times(seekBar.progress.div(100.0)).toString(),0)
-                                text = it.toString() + "吨"
+                                oneNumberInputEdittext.text = NumberUtils.roundNum(it?.times(seekBar.progress.div(100.0)).toString(),0)
+                                text = it.toString() + data.WrFtWrstandard.enumdicname
                             }
                             textSizeAuto = 29
                             textColorInt = R.color.rma_gray_color
@@ -909,7 +913,6 @@ class OneBuyListedUI(
                 verticalLayout {
                     linearLayout {
                         editText {
-                            setText("1")
                             startInputNumber = this
                             hint = "请输入起摘数量"
                             background = null
@@ -919,11 +922,11 @@ class OneBuyListedUI(
                             textSizeAuto = 31
                             textColorStr = "#333333"
                         }.lparams(0, autoSize(132), 1f) {
-
+                            topMargin = autoSize(15)
                         }
 
                         textView {
-                            text = "吨"
+                            text = data.WrFtWrstandard.enumdicname
                             textSizeAuto = 31
                             textColorInt = R.color.rma_black_33
                         }.lparams(wrapContent, wrapContent) {
@@ -932,8 +935,7 @@ class OneBuyListedUI(
                     }.lparams(matchParent, autoSize(100))
 
                     textView {
-                        visibility = View.GONE
-                        text = "最小单位"
+                        text = "最小单位" + data.WrFtWrstandard.minivalue + data.WrFtWrstandard.enumdicname
                         textSizeAuto = 29
                         textColorInt = R.color.rma_hint_text_color_ccc
                     }.lparams(wrapContent, wrapContent)
@@ -944,7 +946,6 @@ class OneBuyListedUI(
             itemView()
 
             linearLayout {
-                visibility = View.GONE
                 gravity = Gravity.CENTER_VERTICAL
                 textView {
                     text = "挂牌金额"
@@ -1013,7 +1014,7 @@ class OneBuyListedUI(
                                 AccountID = selectAccountData.value?.accountid ?: 0,
                                 IsSpecified = 0,
                                 OrderQty = oneNumberInputEdittext.text.toString().toLong(),
-                                DeliveryGoodsID = data.DeliveryGoodsID?.toInt() ?: 0,
+                                DeliveryGoodsID = data.DeliveryGoodsID.toInt(),
                                 WRPriceType = 1,
                                 FixedPrice = onePriceInputEdittext.text.toString().toDouble(),
                                 WRTradeGoods = WarehouseTradeMI1.WRGoodsInfo.newBuilder().build(),
@@ -1028,7 +1029,7 @@ class OneBuyListedUI(
                                 CanPart = 1,
                                 HasWr = 1,
                                 DelistMinQty = startInputNumber.text.toString().toLong(),
-                                WRStandardID = data.WRStandardID?.toInt() ?: 0
+                                WRStandardID = data.WrFtWrstandard.wrstandardid?.toInt() ?: 0
                             ) {
                                 viewModel.controlDialogDisappear.postValue(true)
                             }
@@ -1056,7 +1057,7 @@ class OneBuyListedUI(
                                 CanPart = 1,
                                 HasWr = 0,
                                 DelistMinQty = startInputNumber.text.toString().toLong(),
-                                WRStandardID = data.WRStandardID?.toInt() ?: 0
+                                WRStandardID = data.WrFtWrstandard.wrstandardid?.toInt() ?: 0
                             ) {
                                 viewModel.controlDialogDisappear.postValue(true)
                             }

+ 2 - 1
RMA/app/src/main/res/layout/layout_item_hnst_content.xml

@@ -2,6 +2,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_marginTop="10dp"
     android:id="@+id/roots_view"
     android:orientation="vertical">
 
@@ -22,7 +23,7 @@
                 android:layout_height="match_parent">
 
                 <TextView
-
+                    android:layout_marginStart="5dp"
                     android:layout_gravity="center"
                     android:id="@+id/tv_left_title"
                     android:layout_width="wrap_content"