瀏覽代碼

风险管理10月10日提交代码-liu.bolan-天津麦顿

Liu.bolan 4 年之前
父節點
當前提交
0ab8c7aa34
共有 47 個文件被更改,包括 1288 次插入320 次删除
  1. 1 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/account/AccountManager.kt
  2. 6 1
      RMA/app/src/main/java/cn/muchinfo/rma/business/bank/adapter/BankAdapter.kt
  3. 62 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/swaps/SwapsAdapter.kt
  4. 38 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/swaps/SwapsManager.kt
  5. 4 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/ContractData.kt
  6. 6 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/ContractTradePositionData.kt
  7. 5 1
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/DeliveryGoodsDetailData.kt
  8. 5 0
      RMA/app/src/main/java/cn/muchinfo/rma/protobuf/funcode/FunCode.java
  9. 112 113
      RMA/app/src/main/java/cn/muchinfo/rma/protobuf/protoclasses/ErmcpMI1.java
  10. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/app/Constant.kt
  11. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/exposure/ExposurePositionDetailsViewholder.kt
  12. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/exposure/ExposureViewModel.kt
  13. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/exposure/NumberExposureDetailsActivity.kt
  14. 5 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/HnstMainFragment.kt
  15. 5 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/account/RydzAccountActivity.kt
  16. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/ContractOrdersActivity.kt
  17. 16 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/ContractOrdersViewModel.kt
  18. 6 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/adapter/ContractPositionContentAdapter.java
  19. 3 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/transfer/ContractTransferActivity.kt
  20. 307 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/unwind/ContractUnWindActivity.kt
  21. 217 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/unwind/ContractUnWindViewModel.kt
  22. 175 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/unwind/ContractUnwindViewHolder.kt
  23. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/HomeMenuUtils.kt
  24. 3 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/DemoViewHolder.kt
  25. 20 6
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newspot/NewAddSpotGoodsActivity.kt
  26. 43 25
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/contract/ContractViewModel.kt
  27. 26 30
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/hedge/HedgePlanActivity.kt
  28. 49 49
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/hedge/HedgePlanViewHolder.kt
  29. 3 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/hedge/HedgePlanViewModel.kt
  30. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/InventoryAuditActivity.kt
  31. 3 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/InventoryContentAdapter.java
  32. 6 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/contract/ContractAuditFragment.kt
  33. 5 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/delivery/DeliveryAuditFragment.kt
  34. 6 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/hedgeplan/HedgePlanFragment.kt
  35. 5 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/someprice/SomePriceFragment.kt
  36. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tjmd/TjmdHomeViewModel.kt
  37. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ContentAdapter.java
  38. 4 40
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ContractDetailActivity.kt
  39. 3 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ProcurementFragment.kt
  40. 16 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ProcurementViewModel.kt
  41. 3 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/SaleFragment.kt
  42. 15 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/SaleViewModel.kt
  43. 17 5
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/spot/SpotFragment.kt
  44. 4 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/chart/YrdzChartActivity.kt
  45. 31 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/chart/YrdzChartViewModel.kt
  46. 35 7
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/listed/PurchaseListedActivity.kt
  47. 7 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/swaps/delisting/SwapsDelistingActivity.kt

+ 1 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/account/AccountManager.kt

@@ -455,6 +455,7 @@ class AccountManager {
                 it.code == "client_spotmarketprice" ||
                 it.code == "client_stock_manage" ||
                 it.code == "client_stock_aduit" ||
+                it.code == "client_stock" ||
                 it.code == "client_warehouse" ||
                 it.code == "client_report" ||
                 it.code == "client_traderflow" ||

+ 6 - 1
RMA/app/src/main/java/cn/muchinfo/rma/business/bank/adapter/BankAdapter.kt

@@ -171,7 +171,12 @@ object BankAdapter {
             val resultRsp = BankMI1.t2bBankSignRsp.parseFrom(packet50.content)
             if (resultRsp.retCode == 0) {
                 // 操作成功
-                Triple(true, null, resultRsp)
+                if (resultRsp.status == 0){
+                    Triple(true, null, resultRsp)
+                }else{
+                    // 操作失败
+                    Triple(false, Error(ErrorMessageUtils.getErrorString(resultRsp.retCode)), null)
+                }
             }else if (resultRsp.retCode == -1){
                 // 操作失败
                 Triple(false, Error(resultRsp.retDesc), null)

+ 62 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/swaps/SwapsAdapter.kt

@@ -5,15 +5,77 @@ import cn.muchinfo.rma.global.ErrorMessageUtils
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.netcore.packet.Packet50
 import cn.muchinfo.rma.protobuf.funcode.FunCode
+import cn.muchinfo.rma.protobuf.protoclasses.ErmcpMI1
 import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI3
+import com.blankj.utilcode.util.TimeUtils
 import java.io.ByteArrayOutputStream
 import java.lang.Exception
+import java.util.*
 
 /**
  * 掉期相关装箱解箱
  */
 object SwapsAdapter {
 
+    /**
+     * 按单平仓请求
+     */
+    fun getHolderCloseReqInfo(
+        TradeID : Long = 0,
+        GoodsID : Int = 0,
+        BuyOrSell : Int = 0,
+        MarketID : Int = 0
+    ) : Packet50{
+        val builder = ErmcpMI1.HolderCloseReq.newBuilder()
+        val loginInfo = GlobalDataCollection.instance?.loginRsp!!
+        builder.setHeader(
+            MessageHeadModel.getHead(
+                FunCode.FID_HolderCloseReq,
+                loginInfo.userID,
+                GlobalDataCollection.instance?.accountId ?: 0,
+                GoodsID,
+                MarketID
+            )
+        )
+        builder.tradeID = TradeID
+        builder.clientSerialNo = UUID.randomUUID().toString().replace("-", "")
+        builder.clientOrderTime = TimeUtils.getNowString()
+        builder.clientType = 3
+        builder.loginID = loginInfo.loginID
+        builder.accountID = GlobalDataCollection.instance?.accountId ?: 0
+        builder.goodsID = GoodsID
+        builder.buyOrSell = BuyOrSell
+        builder.orderSrc = 1
+        builder.operatorID = loginInfo.userID.toLong()
+        val arrayOutputStream = ByteArrayOutputStream();
+        builder.build().writeTo(arrayOutputStream)
+        return Packet50(FunCode.FID_HolderCloseReq, arrayOutputStream.toByteArray())
+    }
+
+    /**
+     * 按单平仓响应
+     * @param packet50 Packet50
+     * @return Triple<Boolean, Error?, ErmcpMI1.SpotContractOperateRsp?>
+     */
+    fun analysisHolderCloseRsp(packet50: Packet50): Triple<Boolean, Error?, ErmcpMI1.HolderCloseRsp?> {
+        return try {
+            val resultRsp = ErmcpMI1.HolderCloseRsp.parseFrom(packet50.content)
+            if (resultRsp.retCode == 0) {
+                // 操作成功
+                Triple(true, null, resultRsp)
+            }else if (resultRsp.retCode == -1){
+                // 操作失败
+                Triple(false, Error(resultRsp.retDesc), null)
+            } else {
+                // 操作失败
+                Triple(false, Error(ErrorMessageUtils.getErrorString(resultRsp.retCode)), null)
+            }
+        } catch (e: Exception) {
+            // 操作失败
+            Triple(false, Error("装箱失败"), null)
+        }
+    }
+
 
     /**
      * 协议平仓操作

+ 38 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/swaps/SwapsManager.kt

@@ -20,6 +20,44 @@ import java.lang.Exception
  */
 class SwapsManager {
 
+
+    /**
+     * 按单平仓操作
+     */
+    fun HolderCloseReq(
+        TradeID : Long = 0,//持仓单号
+        GoodsID : Int = 0,//商品ID
+        BuyOrSell : Int = 0,//买卖方向
+        MarketID : Int = 0,//市场ID
+        callback: (isCompleted: Boolean, err: Error?) -> Unit
+    ){
+        val tradeSocketManager = MyApplication.getInstance()?.tradeSocketManager.guard {
+            callback(false, Error("交易链路未初始化"))
+            return
+        }
+
+        val reqPacket = SwapsAdapter.getHolderCloseReqInfo(
+            TradeID, GoodsID, BuyOrSell, MarketID
+        )
+
+        tradeSocketManager.send(
+            reqPacket,
+            FunCode.FID_HolderCloseRsp,
+            object : Callback<Packet50> {
+                override fun onSuccess(rsp: Packet50?) {
+                    val rst = SwapsAdapter.analysisHolderCloseRsp(rsp!!)
+                    callback(rst.first, rst.second)
+                }
+
+                override fun onFail(err: Error?) {
+                    // 发送数据失败
+                    callback(false, err)
+                }
+
+            }
+        )
+    }
+
     /**
      * 按单协议平仓操作
      */

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

@@ -212,6 +212,8 @@ data class ContractData(
     val merusername : String? = "",//跟单员名称
     @SerializedName("saleusername")
     val saleusername : String? = "",//业务员名称
+    @SerializedName("vatrate")
+    val vatrate : String? = "",//增值税税率
     @SerializedName("nickname")
     val nickname : String? = ""//nicheng
 ) : Parcelable {
@@ -296,6 +298,7 @@ data class ContractData(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
+        parcel.readString(),
         parcel.readString()
     ) {
     }
@@ -381,6 +384,7 @@ data class ContractData(
         parcel.writeString(tradeusername)
         parcel.writeString(merusername)
         parcel.writeString(saleusername)
+        parcel.writeString(vatrate)
         parcel.writeString(nickname)
     }
 

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

@@ -66,6 +66,8 @@ data class ContractTradePositionData(
     var isClick : Int = 0,//是否点击展开
     @SerializedName("usedmargin")
     val usedmargin :String? = "",//占用保证金[商品币种]
+    var refgoodsId : Int = 0,//关联goodsid
+    var refgoodsCode : String? = "",//关联goodscode
     var rightData : List<String?>? = arrayListOf()//组装的右侧数据
 ) : Parcelable{
     constructor(parcel: Parcel) : this(
@@ -98,6 +100,8 @@ data class ContractTradePositionData(
         parcel.readString(),
         parcel.readInt(),
         parcel.readString(),
+        parcel.readInt(),
+        parcel.readString(),
         parcel.createStringArrayList()
     ) {
     }
@@ -132,6 +136,8 @@ data class ContractTradePositionData(
         parcel.writeString(trademode)
         parcel.writeInt(isClick)
         parcel.writeString(usedmargin)
+        parcel.writeInt(refgoodsId)
+        parcel.writeString(refgoodsCode)
         parcel.writeStringList(rightData)
     }
 

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

@@ -163,6 +163,8 @@ data class XhMiddlergoods(
     val middlegoodsid : String? = "",//套保品种id
     @SerializedName("middlegoodsname")
     val middlegoodsname : String? = "",//套保品种名称
+    @SerializedName("GPLST")
+    val gplst : List<Ermcp3GoodsGroupEx>? = arrayListOf(),
     @SerializedName("unitid")
     val unitid : String? = ""//单位id
 ) : Parcelable{
@@ -172,6 +174,7 @@ data class XhMiddlergoods(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
+        parcel.createTypedArrayList(Ermcp3GoodsGroupEx),
         parcel.readString()
     ) {
     }
@@ -182,6 +185,7 @@ data class XhMiddlergoods(
         parcel.writeString(middlegoodscode)
         parcel.writeString(middlegoodsid)
         parcel.writeString(middlegoodsname)
+        parcel.writeTypedList(gplst)
         parcel.writeString(unitid)
     }
 
@@ -520,7 +524,7 @@ data class Ermcp3GoodsGroupEx(
     val goodsgroupname : String? = "",//商品组名称
     @SerializedName("middlegoodsid")
     val middlegoodsid : String? = "",//套保商品id
-    @SerializedName("glist")
+    @SerializedName("GDLST")
     val glist : List<Ermcp3Goods>? = arrayListOf()//合约列表
 ) : Parcelable{
     constructor(parcel: Parcel) : this(

+ 5 - 0
RMA/app/src/main/java/cn/muchinfo/rma/protobuf/funcode/FunCode.java

@@ -419,6 +419,11 @@ public class FunCode {
     //按单协议平仓操作响应
     public static final int FID_TradeHoldTransferApplyAuditRsp = 1900760;
 
+    //按单平仓请求
+    public static final int FID_HolderCloseReq = 196713;
+    //按单平仓相应
+    public static final int FID_HolderCloseRsp = 196714;
+
     /**
      * 交易委托请求(196639)
      */

File diff suppressed because it is too large
+ 112 - 113
RMA/app/src/main/java/cn/muchinfo/rma/protobuf/protoclasses/ErmcpMI1.java


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

@@ -14,9 +14,9 @@ object Constant {
 
 
 //    const val baseurl = "http://192.168.31.93:8080/cfg?key=test_93"//李倩企业风管 18611112222
-//    const val baseurl = "http://192.168.31.104:8080/cfg?key=test_104"//李倩云融 18611112222
+    const val baseurl = "http://192.168.31.104:8080/cfg?key=test_104"//李倩云融 18611112222
 //
-    const val baseurl = "http://192.168.31.135:8080/cfg?key=test_135"// 瑶姐 云融 190000000001 123456
+//    const val baseurl = "http://192.168.31.135:8080/cfg?key=test_135"// 瑶姐 云融 190000000001 123456
 
 //    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"

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

@@ -79,7 +79,7 @@ class ExposurePositionDetailsViewholder(
                 textView {
                      data.bindOptional(context){
                         if (type == "1"){
-                            text = it?.deliverygoodsname
+                            text = it?.wrstandardname
                         }else{
                             text = ViewEnumUtils.getchannelbuildtype(it?.channelbuildtype ?: "")
                         }

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

@@ -265,7 +265,7 @@ class ExposureViewModel : BaseViewModel(){
         val params = mutableMapOf<String, String>().apply {
             put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
             put("usertype",GlobalDataCollection.instance?.userAccountData?.usertype?.toString() ?: "")
-            put("deliverygoodsid", deliverygoodsid)
+            put("wrstandardid", deliverygoodsid)
         }
         MyApplication.getInstance()?.exposureManager?.queryExposureSpotDetail(params = params){isSuccess, respData, error ->
             if (isSuccess){

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

@@ -40,7 +40,7 @@ class NumberExposureDetailsActivity : BaseActivity<ExposureViewModel>(){
         super.onCreate(savedInstanceState)
         verticalLayout {
             if (type == "1"){
-                viewModel.queryExposureSpotDetail(data.deliverygoodsid ?: "")
+                viewModel.queryExposureSpotDetail(data.wrstandardid ?: "")
             }else{
                 viewModel.queryExposureHedgePositionDetail(data.goodsid ?: "")
             }

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

@@ -540,10 +540,10 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
                                             ///// 0 - 占用/净值  1 - 净值/占用
                                             val parmasvalue =
                                                 GlobalDataCollection.instance?.getSystemParamsValue(
-                                                    "307"
+                                                    "087"
                                                 )
                                             var worth = 0.0
-                                            if (parmasvalue == "1") {//1.净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
+                                            if (parmasvalue == "1") {//1.风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
                                                 worth = it?.currentbalance?.plus(
                                                             it.valueOfposition
                                                         )?.plus(it.valueOfposition_keep_watch_profit_and_loss)
@@ -551,10 +551,12 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
                                                             ?.minus(it.outamountfreeze) ?: 0.0
 
 
-                                            } else {//0.净值=期末余额+市值+浮动盈亏(收益权)
+                                            } else {//0.净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
                                                 worth = it?.currentbalance?.plus(
                                                     it.valueOfposition
                                                 )?.plus(it.valueOfposition_keep_watch_profit_and_loss) ?: 0.0
+                                                    .minus(it?.otherfreezemargin ?: 0.0)
+                                                    .minus(it?.outamountfreeze ?: 0.0) ?: 0.0
                                             }
 
                                             var risk = 0.0

+ 5 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/account/RydzAccountActivity.kt

@@ -546,10 +546,10 @@ class MoneyInfoUI(
                         ///// 0 - 占用/净值  1 - 净值/占用
                         val parmasvalue =
                             GlobalDataCollection.instance?.getSystemParamsValue(
-                                "307"
+                                "087"
                             )
                         var worth = 0.0
-                        if (parmasvalue == "1") {//1.净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
+                        if (parmasvalue == "1") {//1.风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
                             worth = it?.currentbalance?.plus(
                                 it.valueOfposition
                             )?.plus(it.valueOfposition_keep_watch_profit_and_loss)
@@ -557,10 +557,12 @@ class MoneyInfoUI(
                                 ?.minus(it.outamountfreeze) ?: 0.0
 
 
-                        } else {//0.净值=期末余额+市值+浮动盈亏(收益权)
+                        } else {//0.净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
                             worth = it?.currentbalance?.plus(
                                 it.valueOfposition
                             )?.plus(it.valueOfposition_keep_watch_profit_and_loss) ?: 0.0
+                                .minus(it?.otherfreezemargin ?: 0.0)
+                                .minus(it?.outamountfreeze ?: 0.0) ?: 0.0
                         }
 
                         var risk = 0.0

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

@@ -210,7 +210,7 @@ class PositionUI(private val activity : AppCompatActivity, private val viewModel
         quoteMessageEvent.goodsid.forEach { goodid ->
             //找到相应商品信息
             val goodsInfo =
-                viewModel.positionDataList.value?.find { it.goodsid?.toInt() == goodid }
+                viewModel.positionDataList.value?.find { it.refgoodsId == goodid }
             viewModel.positionDataList.value?.indexOf(goodsInfo)?.let {
                 if (it != -1) {//刷新相应item
                     contractPositionContentAdapter.notifyItemChanged(it)

+ 16 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/ContractOrdersViewModel.kt

@@ -450,12 +450,25 @@ class ContractOrdersViewModel : BaseViewModel(){
         }
         MyApplication.getInstance()?.contractGoodsManager?.queryContractTradePosition(params = params){ isSuccess, respData, error ->
             if (isSuccess){
-                positionDataList.postValue(respData)
-                queryPositionQuoteDay(Constant.position_tag,respData ?: arrayListOf())
+                resetPositionDataList(respData ?: arrayListOf())
             }
         }
     }
 
+    //根据合约汇总单去插入响应的关联商品
+    fun resetPositionDataList(list : List<ContractTradePositionData>){
+        val newList = arrayListOf<ContractTradePositionData>()
+        val quoteGoodsListDataArrayList = GlobalDataCollection.instance?.quoteGoodsListDataArrayList
+        list.forEach {data ->
+            val quoteGoodsListData = quoteGoodsListDataArrayList?.find { data.goodsid.toString() == it.goodsid }
+            if (quoteGoodsListData?.refgoodscode.isNullOrEmpty().not()){
+                newList.add(data.copy(refgoodsId = quoteGoodsListData?.refgoodsid?.toInt() ?: 0,refgoodsCode = quoteGoodsListData?.refgoodscode))
+            }
+        }
+        positionDataList.postValue(newList)
+        queryPositionQuoteDay(Constant.position_tag,newList)
+    }
+
     /**
      * 请求盘面信息
      * @param first Int
@@ -510,7 +523,7 @@ class ContractOrdersViewModel : BaseViewModel(){
     fun getgoodsCodes(list : List<ContractTradePositionData>): String {
         var goodsCodes = ""
         list?.forEach {
-            goodsCodes = goodsCodes + it.goodscode + "," //+ DataBase.getInstance().goodsInfoDao().getGoodsInfo(it.relatedgoodsid).goodscode + ","
+            goodsCodes = goodsCodes + it.refgoodsCode + "," //+ DataBase.getInstance().goodsInfoDao().getGoodsInfo(it.relatedgoodsid).goodscode + ","
         }
         return goodsCodes
     }

+ 6 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/adapter/ContractPositionContentAdapter.java

@@ -115,7 +115,7 @@ public class ContractPositionContentAdapter extends RecyclerView.Adapter<Contrac
 
         List<GoodsInfoAndQuotes> quotesList = GlobalDataCollection.Companion.getInstance().getGoodsInfoAndQuotesList();//获取盘面信息列表
         for (int j = 0;j < quotesList.size();j++){
-            if (data.getGoodscode().equals(quotesList.get(j).getOutgoodscode())){
+            if (data.getRefgoodsCode().equals(quotesList.get(j).getOutgoodscode())){
                 quoteDayData = quotesList.get(j).getQuoteDayData();//赋值当前商品的盘面信息
             }
         }
@@ -246,6 +246,11 @@ public class ContractPositionContentAdapter extends RecyclerView.Adapter<Contrac
             itemViewHolder.warehouse_register.setVisibility(View.GONE);
         }
 
+        //平仓操作
+        itemViewHolder.to_unwind.setOnClickListener(view -> {
+
+        });
+
         //协议平仓
         itemViewHolder.agreement_to_unwind.setOnClickListener(view -> {
             Intent intent = new Intent();

+ 3 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/transfer/ContractTransferActivity.kt

@@ -122,7 +122,7 @@ class ContractTransferActivity : BaseActivity<ContractTransferViewModel>(){
                             }
                         }
                     }
-
+                    setTextColor(R.color.buy_hall_color)
                 }.lparams(0, autoSize(72), 1f) {
                     marginEnd = autoSize(110)
                 }
@@ -167,7 +167,7 @@ class ContractTransferActivity : BaseActivity<ContractTransferViewModel>(){
                                     }
                                 }
                             }
-
+                            setTextColor(R.color.buy_hall_color)
                         }.lparams(0, autoSize(72), 1f) {
                             marginEnd = autoSize(110)
                         }
@@ -213,7 +213,7 @@ class ContractTransferActivity : BaseActivity<ContractTransferViewModel>(){
 
                     linearLayout {
                         textView {
-                            text = "0"
+                            text = "1"
                             textSizeAuto = 29
                             textColorInt = R.color.rma_gray_color
                         }.lparams(wrapContent, wrapContent)

+ 307 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/unwind/ContractUnWindActivity.kt

@@ -0,0 +1,307 @@
+package cn.muchinfo.rma.view.base.hnstmain.contractorders.unwind
+
+import android.annotation.SuppressLint
+import android.os.Bundle
+import android.view.Gravity
+import androidx.recyclerview.widget.RecyclerView
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.ContractTradePositionData
+import cn.muchinfo.rma.global.data.TradeHolderDetailData
+import cn.muchinfo.rma.global.database.DataBase
+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.autoWidget.view.MangeNumberEditText2
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
+import com.blankj.utilcode.util.LogUtils
+import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import org.jetbrains.anko.*
+
+class ContractUnWindActivity : BaseActivity<ContractUnWindViewModel>(){
+
+    // 下拉刷新
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+    private lateinit var agreement_recyclerView: RecyclerView
+
+    //合约汇总实体
+    val data by lazy { intent.getParcelableExtra<ContractTradePositionData>("data") as ContractTradePositionData }
+
+    //
+    private val agreementUnwindAdapter: BaseAdapter<TradeHolderDetailData, ContractUnwindViewHolder> =
+        BaseAdapter { _, _ ->
+            ContractUnwindViewHolder(
+                this,
+                viewModel
+            )
+        }
+
+    val thisTag by lazy {
+        "ContractUnWindActivity"
+    }
+
+    /**
+     * 输入的协议价
+     */
+    lateinit var agrement_price_edittext: MangeNumberEditText2
+
+    override fun onDestroy() {
+        super.onDestroy()
+        EventBus.getDefault().unregister(this)
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onQuoteMessageEvent(quoteMessageEvent: QuoteMessageEvent) {
+        /** 行情推送过来的goodsid **/
+        quoteMessageEvent.goodsid.forEach { goodid ->
+            LogUtils.eTag("dadafafsjhdkjahkjdhak", goodid)
+            //找到相应商品信息
+            val goodsInfo =
+                viewModel.agreementDataList.value?.find { it.refgoodsid?.toInt() == goodid }
+            viewModel.agreementDataList.value?.indexOf(goodsInfo)?.let {
+                if (it != -1) {//刷新相应item
+                    agreement_recyclerView.adapter?.notifyItemChanged(it)
+                }
+            }
+            //选择了相应的单据
+            if (viewModel.agreementData.value?.refgoodsid.isNullOrEmpty().not()){
+                if (goodid == viewModel.agreementData.value?.refgoodsid?.toInt()){
+                    val selectQuoteDayData = GlobalDataCollection.instance?.goodsInfoAndQuotesList?.find {
+                        it?.outgoodscode == viewModel.agreementData.value?.refgoodscode
+                    }
+                    viewModel.quoteDayData.postValue(selectQuoteDayData?.quoteDayData)
+                }
+            }
+        }
+    }
+
+    @SuppressLint("SetTextI18n")
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+
+        EventBus.getDefault().register(this)
+        verticalLayout {
+            viewModel.queryTradeHolderDetail(data = data,tag = thisTag)
+            createLoadingDialog(hintStr = "").bindTaskStatus(context, viewModel.loadingDialogStatus)
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "协议平仓"
+                }
+            }
+
+            linearLayout {
+                background = resources.getDrawable(R.color.yrdz_delivery_title_bg_color)
+                gravity = Gravity.CENTER_VERTICAL
+                textView {
+                    text = "合约:" + data.goodscode + "/" + data.goodsname
+                    textSizeAuto = 32
+                    textColorInt = R.color.qhj_blue_text_color
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(36)
+                }
+            }.lparams(matchParent, autoSize(70))
+
+            textView {
+                text = "选择持仓单"
+                textSizeAuto = 34
+                textColorInt = R.color.hint_text_color
+            }.lparams(wrapContent, wrapContent) {
+                marginStart = autoSize(36)
+            }
+
+            itemView()
+
+            linearLayout {
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        text = "持仓单号/方向"
+                        textSizeAuto = 29
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(36)
+                    }
+                }.lparams(0, autoSize(70), 1f)
+
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        text = "数量/价格/金额"
+                        textSizeAuto = 29
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(70), 1f)
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL or Gravity.RIGHT
+                    textView {
+                        text = "到期日/盈亏"
+                        textSizeAuto = 29
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent) {
+                        marginEnd = autoSize(36)
+                    }
+                }.lparams(0, autoSize(70), 1f)
+            }.lparams(matchParent, autoSize(70))
+
+            frameLayout {
+                verticalLayout {
+
+
+                    statusLayout(contentBlock = {
+                        statusLayout = this
+                        swipeToLoadLayout {
+                            swipeToLayout = this
+                            setEnableRefresh(false)
+                            setEnableLoadMore(false)
+                            setOnRefreshListener {
+
+                            }
+                            setEnableScrollContentWhenLoaded(false)
+                            setEnableLoadMoreWhenContentNotFull(false)
+
+                            // 未提交列表
+                            recyclerView {
+                                agreement_recyclerView = this
+                                background = resources.getDrawable(R.color.segtabment_bg_color)
+                                adapter = agreementUnwindAdapter
+                            }.lparams(matchParent, matchParent)
+                        }
+                    }, emptyBlock = {
+                        emptyView(hint = resources.getString(R.string.now_no_data))
+                    }).lparams(matchParent, matchParent)
+
+                    viewModel.agreementDataList.bindOptional(context) {
+                        if (it?.isEmpty() == true || it?.size == 0) {
+                            statusLayout.showEmpty()
+                        } else {
+                            if (swipeToLayout.getIsRefreshing()) {
+                                swipeToLayout.finishRefresh()
+                            }
+                            statusLayout.showSuccess()
+                            agreementUnwindAdapter.setNewData(it)
+                        }
+                    }
+
+                }.lparams(matchParent, matchParent) {
+                    bottomMargin = autoSize(340)
+                }
+
+                verticalLayout {
+                    background = resources.getDrawable(R.color.white)
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        linearLayout {
+                            gravity = Gravity.CENTER_VERTICAL
+                            textView {
+                                text = "估算价:"
+                                textSizeAuto = 31
+                                textColorInt = R.color.rma_black_33
+                            }.lparams(wrapContent, wrapContent) {
+                                marginStart = autoSize(36)
+                            }
+                        }.lparams(autoSize(250), autoSize(100))
+
+                        textView {
+                            viewModel.quoteDayData.bindOptional(context){
+                                if (it?.getPrice() == 0.0){
+                                    text = "--"
+                                }else{
+                                    if (viewModel.agreementData.value?.refgoodsid.isNullOrEmpty()){
+                                        text = "--"
+                                    }else{
+                                        text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.getPrice().toString()),2)
+                                    }
+                                }
+                            }
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent){
+                            marginStart = autoSize(32)
+                        }
+                    }.lparams(matchParent, autoSize(140))
+
+                    itemView()
+
+                    linearLayout {
+
+                        gravity = Gravity.CENTER_VERTICAL
+                        verticalLayout {
+                            textView {
+                                text = "估算金额"
+                                textSizeAuto = 29
+                                textColorInt = R.color.rma_gray_color
+                            }.lparams(wrapContent, wrapContent){
+                                topMargin = autoSize(30)
+                                marginStart = autoSize(36)
+                            }
+
+                            textView {
+                                viewModel.quoteDayData.bindOptional(context){
+                                    if (it?.getPrice() == 0.0){
+                                        text = "--"
+                                    }else{
+                                        if (viewModel.agreementData.value?.refgoodsid.isNullOrEmpty()){
+                                            text = "--"
+                                        }else{
+                                            text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.getPrice()?.times(viewModel.agreementData.value?.holderqty?.toInt() ?: 0).toString()),2)
+                                        }
+                                    }
+                                }
+                                text = "--"
+                                textSizeAuto = 34
+                                textColorInt = R.color.rma_black_33
+                            }.lparams(wrapContent, wrapContent){
+                                marginStart = autoSize(36)
+                                topMargin = autoSize(10)
+                            }
+                        }.lparams(0, autoSize(144),1f)
+
+
+                        textView {
+                            onThrottleFirstClick {
+                                if (viewModel.agreementData.value?.accountid.isNullOrEmpty()) {
+                                    ToastUtils.showLong("请选择需要进行协议平仓的单据")
+                                    return@onThrottleFirstClick
+                                }
+
+                                val applyData = viewModel.agreementData.value
+                                viewModel.HolderCloseReq(
+                                    GoodsID = applyData?.goodsid?.toInt() ?: 0,
+                                    MarketID = applyData?.marketid?.toInt() ?: 0,
+                                    TradeID = applyData?.tradeid?.toLong() ?: 0,
+                                    BuyOrSell = applyData?.buyorsell?.toInt() ?: 0
+                                ) {
+                                    finish()
+                                }
+                            }
+                            text = "平仓"
+                            gravity = Gravity.CENTER
+                            textSizeAuto = 36
+                            textColorInt = R.color.white
+                            backgroundResource = R.drawable.rydz_main_red_bg
+                        }.lparams(autoSize(268), autoSize(96)){
+                            marginEnd = autoSize(36)
+                        }
+
+                    }.lparams(matchParent, autoSize(144))
+
+
+                }.lparams(matchParent, wrapContent) {
+                    gravity = Gravity.BOTTOM
+                }
+            }.lparams(matchParent, matchParent)
+        }
+    }
+
+}

+ 217 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/unwind/ContractUnWindViewModel.kt

@@ -0,0 +1,217 @@
+package cn.muchinfo.rma.view.base.hnstmain.contractorders.unwind
+
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.ContractTradePositionData
+import cn.muchinfo.rma.global.data.QuoteDayData
+import cn.muchinfo.rma.global.data.TradeHolderDetailData
+import cn.muchinfo.rma.netManage.base.InteractiveException
+import cn.muchinfo.rma.view.MyApplication
+import cn.muchinfo.rma.view.base.BaseViewModel
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+import mtp.polymer.com.autowidget.utils.TaskUiModel
+
+//平仓操作viewmodel
+class ContractUnWindViewModel : BaseViewModel(){
+
+    /**
+     * 加载状态控制
+     */
+    val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
+
+    val agreementDataList : MutableLiveData<List<TradeHolderDetailData>> = MutableLiveData()
+
+    /**
+     * 当前选择的协议平仓单据
+     */
+    val agreementData : MutableLiveData<TradeHolderDetailData> = MutableLiveData()
+
+    val quoteDayData : MutableLiveData<QuoteDayData> = MutableLiveData()
+
+    /**
+     * 按单平仓操作
+     */
+    fun HolderCloseReq(
+        TradeID : Long = 0,//持仓单号
+        GoodsID : Int = 0,//商品ID
+        BuyOrSell : Int = 0,//买卖方向
+        MarketID : Int = 0,//市场ID
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.swapsManager?.HolderCloseReq(
+                BuyOrSell = BuyOrSell,
+                GoodsID = GoodsID,
+                MarketID = MarketID,
+                TradeID = TradeID
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+    /**
+     * 协议平仓申请
+     */
+    fun tradeHoldTransferApplyReq(
+        accoundId : Long = 0,//资金账号
+        GoodsId : Int = 0,//商品ID
+        MarketId : Int = 0,//市场id
+        TradeID : Long = 0,//申请人的持仓单表ID
+        BuyorSell : Int = 0,//持仓单方向  卖 - 0:买 1:卖
+        TransferPrice : Double = 0.0,//转让价格
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.swapsManager?.tradeHoldTransferApplyReq(
+                accoundId = accoundId,
+                GoodsId = GoodsId,
+                MarketId = MarketId,
+                TradeID = TradeID,
+                BuyorSell = BuyorSell,
+                TransferPrice = TransferPrice
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+
+    //查询协议平仓单据
+    fun queryTradeHolderDetail(
+        data : ContractTradePositionData,
+        tag : String
+    ){
+        val params = mutableMapOf<String,String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+            put("accids", GlobalDataCollection.instance?.accountId?.toString() ?: "")
+            put("trademodes","46")
+            put("marketids",data.marketid ?: "")
+            put("goodsid",data.goodsid ?: "")
+            put("buyorsell",data.buyorsell ?: "")
+        }
+
+        MyApplication.getInstance()?.quoteManager?.queryTradeHolderDetail(params = params){ isSuccess, respData, error ->
+            if (isSuccess){
+                val newList = arrayListOf<TradeHolderDetailData>()
+                respData?.forEach {
+                    if (it.holderqty != "0"){
+                        newList.add(it)
+                    }
+                }
+                agreementDataList.postValue(newList)
+                queryQuoteDay(tag = tag,list = newList ?: arrayListOf()){ isCompleted, err ->
+
+                }
+            }
+        }
+    }
+
+    /**
+     * item的点击事件
+     */
+    fun setOnItemOnClick(tradeid : String){
+        val newWrStandardFactoryItemDataList = arrayListOf<TradeHolderDetailData>()
+        agreementDataList.value?.forEach {
+            if (it.tradeid == tradeid){
+                if (it.isClick == 0){
+                    newWrStandardFactoryItemDataList.add(it.copy(isClick = 1))
+                    agreementData.postValue(it.copy(isClick = 1))
+                }else{
+                    newWrStandardFactoryItemDataList.add(it.copy(isClick = 0))
+                    agreementData.postValue(TradeHolderDetailData())
+                }
+            }else{
+                newWrStandardFactoryItemDataList.add(it.copy(isClick = 0))
+            }
+        }
+        agreementDataList.postValue(newWrStandardFactoryItemDataList)
+        if (agreementData.value?.refgoodsid.isNullOrEmpty().not()){
+            val selectQuoteDayData = GlobalDataCollection.instance?.goodsInfoAndQuotesList?.find {
+                it?.outgoodscode == agreementData.value?.refgoodscode
+            }
+            quoteDayData.postValue(selectQuoteDayData?.quoteDayData)
+        }else{
+            quoteDayData.postValue(QuoteDayData())
+        }
+
+    }
+
+
+    /**
+     * 请求盘面信息
+     * @param first Int
+     * @param last Int
+     * @param callback Function2<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun queryQuoteDay(
+        tag: String,
+        list : List<TradeHolderDetailData> = arrayListOf(),
+        callback: (isCompleted: Boolean, err: Error?) -> Unit
+    ) {
+        val goodsCodes = getgoodsCodes(list)
+        val params = mutableMapOf<String, String>().apply {
+            put("goodsCodes", goodsCodes)
+        }
+        MyApplication.getInstance()?.futureManager?.queryQuoteDay(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                callback(true, null)
+            } else {
+                callback(false, error)
+            }
+        }
+
+        addSubscriptQuote(tag = tag, goodsInfoList = list)
+    }
+
+
+    //获取本商品的盘面信息的同时,还要获取关联商品的盘面信息
+    fun getgoodsCodes(list : List<TradeHolderDetailData>): String {
+        var goodsCodes = ""
+        list.forEach {
+            goodsCodes = goodsCodes + it.refgoodscode + ","
+        }
+        return goodsCodes
+    }
+
+    /**
+     * 订阅行情
+     * @param tag String
+     * @param goodsInfoList List<GoodsInfo>
+     */
+    fun addSubscriptQuote(tag: String, goodsInfoList: List<TradeHolderDetailData>) {
+        GlobalScope.launch {
+            MyApplication.getInstance()?.quoteManager?.addSubscriptQuote(
+                tag = tag, goodsCodeSet = goodsInfoList.map { it.refgoodscode ?: "" }.toSet()
+            ) { _, _ ->
+
+            }
+        }
+    }
+
+}

+ 175 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/unwind/ContractUnwindViewHolder.kt

@@ -0,0 +1,175 @@
+package cn.muchinfo.rma.view.base.hnstmain.contractorders.unwind
+
+import android.annotation.SuppressLint
+import android.view.Gravity
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.TradeHolderDetailData
+import cn.muchinfo.rma.global.data.WrDeliveryAvalidHoldLBData
+import cn.muchinfo.rma.global.database.DataBase
+import cn.muchinfo.rma.global.toShowTime3
+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.future.trade.itemView
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 平仓的列表
+ * @property activity AppCompatActivity
+ * @property viewModel [ERROR : null type]
+ * @property itemSize IntArray
+ * @constructor
+ */
+class ContractUnwindViewHolder(private val activity : AppCompatActivity, private val viewModel: ContractUnWindViewModel) : BaseViewHolder<TradeHolderDetailData>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    @SuppressLint("SetTextI18n")
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            backgroundDrawable = createRoundRectDrawable("#ffffff", 24)
+            linearLayout {
+                onThrottleFirstClick {
+                    if (data.value?.holderdays == "0"){
+                        viewModel.setOnItemOnClick(data.value?.tradeid ?: "")
+                    }
+                }
+                gravity = Gravity.CENTER_VERTICAL
+                imageView {
+                    data.bindOptional(context){
+                        if (it?.isClick == 0){
+                            imageResource = R.mipmap.yrdz_delivery_normal_icon
+                        }else if (it?.isClick == 1){
+                            imageResource = R.mipmap.yrdz_delivery_select_icon
+                        }
+                    }
+                    imageResource = R.mipmap.yrdz_delivery_normal_icon
+                }.lparams(autoSize(43), autoSize(43)){
+                    marginStart = autoSize(23)
+                }
+
+                textView {
+                    data.bindOptional(context){
+                        text = it?.tradeid
+                    }
+                    textSizeAuto = 32
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent){
+                    marginStart = autoSize(28)
+                }
+
+                emptyView()
+
+                textView {
+                    data.bindOptional(context){
+                        if (it?.holderdays == "0"){
+                            visibility = View.GONE
+                        }else{
+                            visibility = View.VISIBLE
+                        }
+                        text = it?.holderdays + "天后可平"
+                    }
+                    textSizeAuto = 29
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent)
+
+                emptyView()
+
+                textView {
+                    data.bindOptional(context){
+                        text = it?.tradetime?.toShowTime3()
+                    }
+                    textSizeAuto = 32
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent){
+                    marginEnd = autoSize(36)
+                }
+
+            }.lparams(matchParent, autoSize(76))
+
+            itemView()
+
+            linearLayout {
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        data.bindOptional(context){
+                            if (it?.buyorsell == "0"){
+                                text = "买入"
+                            }else{
+                                text = "卖出"
+                            }
+                        }
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(30)
+                    }
+                }.lparams(0, autoSize(139),1f)
+
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.openqty + "/" + it?.openprice + "/" + it?.tradeamount
+                        }
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(139),2f)
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL or Gravity.RIGHT
+                    textView {
+                        data.bindOptional(context){data ->
+                            val quoteDayData = GlobalDataCollection.instance?.goodsInfoAndQuotesList?.find {
+                                data?.refgoodscode == it?.outgoodscode
+                            }?.quoteDayData
+                            val goodsInfo = DataBase.getInstance().goodsInfoDao()
+                                .getGoodsInfo(data?.goodsid?.toInt() ?: 0)
+                            if (quoteDayData != null){
+                                val buysell = if (data?.buyorsell == "0") {
+                                    1
+                                } else {
+                                    -1
+                                }
+                                val profit_loss =
+                                    (quoteDayData.getPrice().minus(data?.holderprice?.toDouble() ?: 0.0))
+                                        .times(data?.holderqty?.toInt() ?: 0)
+                                        .times(goodsInfo?.agreeunit ?: 0).times(buysell)
+
+                                if (profit_loss > 0) {
+                                    textColorInt = R.color.rma_red_color
+                                } else if (profit_loss < 0) {
+                                    textColorInt = R.color.rma_green_color
+                                } else {
+                                    textColorInt = R.color.rma_black_33
+                                }
+                                if (NumberUtils.roundNum(profit_loss, 2) == "-0.00"){
+                                    text = "0.00"
+                                }else{
+                                    text = NumberUtils.roundNum(profit_loss, 2)
+                                }
+                            }else{
+                                text = "--"
+                                textColorInt = R.color.rma_black_33
+                            }
+                        }
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_red_color
+                    }.lparams(wrapContent, wrapContent){
+                        marginEnd = autoSize(30)
+                    }
+                }.lparams(0, autoSize(139),1f)
+            }.lparams(matchParent, autoSize(139))
+        }.lparams(matchParent, autoSize(216)){
+            marginStart = autoSize(25)
+            marginEnd = autoSize(25)
+            topMargin = autoSize(24)
+        }
+    }
+}

+ 1 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/HomeMenuUtils.kt

@@ -20,7 +20,7 @@ fun String.getMenuIcon() : Int{
         returnString = R.mipmap.spot_market_price
     }else if (this == "client_stock_manage"){
         returnString = R.mipmap.rma_inventory_management
-    }else if (this == "client_stock_aduit"){
+    }else if (this == "client_stock"){
         returnString = R.mipmap.rma_inventory_audit
     }else if (this == "client_warehouse"){
         returnString = R.mipmap.rma_warehouse

+ 3 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/DemoViewHolder.kt

@@ -94,7 +94,7 @@ class DemoViewHolder(
                         val intent = Intent()
                         intent.putExtra("type","2")
                         intent.putExtra("data",data.value)
-                        intent.setClass(context, AddSpotGoodsActivity::class.java)
+                        intent.setClass(context, NewAddSpotGoodsActivity::class.java)
                         ActivityUtils.startActivity(intent)
                     }
                     data.bindOptional(context){
@@ -123,7 +123,7 @@ class DemoViewHolder(
                         val intent = Intent()
                         intent.putExtra("type","5")
                         intent.putExtra("data",data.value)
-                        intent.setClass(context, AddSpotGoodsActivity::class.java)
+                        intent.setClass(context, NewAddSpotGoodsActivity::class.java)
                         ActivityUtils.startActivity(intent)
                     }
                     data.bindOptional(context){
@@ -153,7 +153,7 @@ class DemoViewHolder(
                         val intent = Intent()
                         intent.putExtra("type","3")
                         intent.putExtra("data",data.value)
-                        intent.setClass(context, AddSpotGoodsActivity::class.java)
+                        intent.setClass(context, NewAddSpotGoodsActivity::class.java)
                         ActivityUtils.startActivity(intent)
                     }
                     data.bindOptional(context){

+ 20 - 6
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newspot/NewAddSpotGoodsActivity.kt

@@ -595,12 +595,26 @@ class NewAddSpotGoodsActivity : BaseActivity<NewAddSpotGoodsViewModel>() {
 //            }
 //        }
 //
-//        viewModel.brandModelcacheList.value?.forEach {
-//            if (it.value.isNullOrEmpty()) {
-//                ToastUtils.showLong("请输入品牌")
-//                return false
-//            }
-//        }
+        viewModel.brandModelcacheList.value?.forEach {
+            if (it.value.isNullOrEmpty()) {
+                ToastUtils.showLong("请输入品牌")
+                return false
+            }
+        }
+
+        viewModel.spotModelcacheList.value?.forEach {
+            it.middleGoodsList.forEach {
+                if (it.middleGoodsName.isNullOrEmpty()){
+                    ToastUtils.showLong("请选择套保品种")
+                    return false
+                }
+                if (it.value.isNullOrEmpty()){
+                    ToastUtils.showLong("请输入折算系数")
+                    return false
+                }
+            }
+
+        }
 
 //        viewModel.middlegoodCacheList.value?.forEach {
 //            if (it.middleGoodsName.isNullOrEmpty()) {

+ 43 - 25
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/contract/ContractViewModel.kt

@@ -2,12 +2,9 @@
 
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.business.contract.SpotContractInfo
-import cn.muchinfo.rma.global.GlobalDataCollection
-import cn.muchinfo.rma.global.ViewEnumUtils
+import cn.muchinfo.rma.global.*
 import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.global.database.DataBase
-import cn.muchinfo.rma.global.isBlankString
-import cn.muchinfo.rma.global.isShowTimeString
 import cn.muchinfo.rma.netManage.base.InteractiveException
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.autoWidget.remove
@@ -440,24 +437,24 @@ class ContractViewModel : BaseViewModel() {
                         newList?.sortWith(Comparator { t1, t2 ->
                             (TimeUtils.string2Millis(t2.updatetime) - TimeUtils.string2Millis(t1.updatetime)).toInt()
                         })
-                        unSubmitList.postValue(resetContraData(newList ?: arrayListOf()))
+                        unSubmitList.postValue(resetContraData(newList ?: arrayListOf(),QueryType))
                     }
                     "2" -> {
                         val newList = respData?.toArrayList()
                         newList?.sortWith(Comparator { t1, t2 ->
                             (TimeUtils.string2Millis(t2.updatetime) - TimeUtils.string2Millis(t1.updatetime)).toInt()
                         })
-                        toAuditList.postValue(resetContraData(newList ?: arrayListOf()))
+                        toAuditList.postValue(resetContraData(newList ?: arrayListOf(),QueryType))
                     }
                     "3" -> {
                         val newList = respData?.toArrayList()
                         newList?.sortWith(Comparator { t1, t2 ->
                             (TimeUtils.string2Millis(t2.updatetime) - TimeUtils.string2Millis(t1.updatetime)).toInt()
                         })
-                        performanceList.postValue(resetContraData(newList ?: arrayListOf()))
+                        performanceList.postValue(resetContraData(newList ?: arrayListOf(),QueryType))
                     }
                     "4" -> {
-                        finishList.postValue(resetContraData(respData ?: arrayListOf()))
+                        finishList.postValue(resetContraData(respData ?: arrayListOf(),QueryType))
                     }
                 }
             } else {
@@ -468,28 +465,34 @@ class ContractViewModel : BaseViewModel() {
     }
 
     //组装现货合同右侧数据
-    fun resetContraData(respData: List<ContractData>): List<ContractData> {
+    fun resetContraData(respData: List<ContractData>,QueryType: String): List<ContractData> {
         val newList = arrayListOf<ContractData>()
         respData.forEach {
             val newRightData = arrayListOf<String>()
 
             newRightData.add(if (it.contracttype == "1"){
-                it.sellusername
+                it.sellnickname
             }else{
-                it.buyusername
+                it.buynickname
             } + "\n" + it.qty + it.enumdicname)//'对手方/\n合同量 '
             newRightData.add(it.deliverygoodsname + "\n" + it.wrstandardname)//'现货品种/\n品类 '
+            newRightData.add(getProducType(it.producttype ?: "") + "\n" + it.vatrate)//'产品类型/\n增值税税率% '
+            newRightData.add(ViewEnumUtils.getPriceType(it.pricetype ?: "")  + "\n" + it.goodsname?.isBlankString())//'定价类型/\n点价合约 '
+            newRightData.add(it.price + "\n" + it.pricemove)//'价格/\n升贴水 '
+            newRightData.add(it.amount + "\n" + it.margin)//'金额/\n保证金 '
             newRightData.add(if (it.biztype == "1"){
                 "套保"
             }else{
                 "套利"
-            } + "\n" + it.subjectname)//'业务类型/\n标仓系数-改为交易主体 '
-            newRightData.add(ViewEnumUtils.getPriceType(it.pricetype ?: "")  + "\n" + it.goodsname?.isBlankString())//'定价类型/\n点价合约 '
-            newRightData.add(it.price + "\n" + it.pricemove)//'价格/\n升贴水 '
-            newRightData.add(it.amount + "\n" + it.margin)//'金额/\n保证金 '
-            newRightData.add(it.startdate?.isShowTimeString("MM-dd") + "~" + it.enddate?.isShowTimeString("MM-dd") + "\n" + it.deliverystartdate?.isShowTimeString("MM-dd") + "~" + it.deliveryenddate?.isShowTimeString("MM-dd"))//'点价期/\n交收期 '
-            newRightData.add(it.saleuserlogincode?.isBlankString() + "\n" + it.meruserlogincode?.isBlankString())//'业务员/\n跟单员 '
-            newRightData.add(it.tradeuserlogincode?.isBlankString() + "\n" + it.currencyname)//'交易用户/\n结算币种 '
+            } + "\n" + it.accountid)//'业务类型/\n资金账户 '
+
+            if (QueryType != "3"){
+                newRightData.add(it.startdate?.isShowTimeString("MM-dd") + "~" + it.enddate?.isShowTimeString("MM-dd") + "\n" + it.deliverystartdate?.isShowTimeString("MM-dd") + "~" + it.deliveryenddate?.isShowTimeString("MM-dd"))//'点价期/\n交收期 '
+            }
+           newRightData.add(it.saleusername?.isBlankString() + "\n" + it.merusername?.isBlankString())//'业务员/\n跟单员 '
+            if (QueryType != "3"){
+                newRightData.add(it.tradeuserlogincode?.isBlankString() + "\n" + it.currencyname)//'交易用户/\n结算币种 '
+            }
             val newData = it.copy(rightData = newRightData)
             newList.add(newData)
 
@@ -497,6 +500,18 @@ class ContractViewModel : BaseViewModel() {
         return newList
     }
 
+    fun getProducType(producttype : String) : String{
+        var returnTypeString = ""
+        if (producttype == "1"){
+            returnTypeString = "标准仓单"
+        }else if (producttype == "2"){
+            returnTypeString = "等标"
+        }else{
+            returnTypeString = "非标"
+        }
+        return returnTypeString
+    }
+
 
     /**
      * 查询客户资料列表(正常的列表)用来页面选择客户
@@ -543,13 +558,16 @@ class ContractViewModel : BaseViewModel() {
     fun setSelectGoodsList(): ArrayList<SelectData> {
         val goodsList = deliveryGoodsDetailsData.value?.wdlst
         val newCustomerList = arrayListOf<SelectData>()
-//        goodsList?.forEach {
-//            it.gplist?.forEach { data ->
-//                data.glist?.forEach { res ->
-//                    newCustomerList.add(SelectData(id = res.goodsid.toString(), value = res.goodsname ?: ""))
-//                }
-//            }
-//        }
+        goodsList?.forEach {
+            it.mglst?.forEach { data ->
+                data.gplst?.forEach { res ->
+                    res.glist?.forEach {data3->
+                        newCustomerList.add(SelectData(id = data3.goodsid.toString(), value = data3.goodsname ?: ""))
+                    }
+
+                }
+            }
+        }
         return newCustomerList
     }
 

+ 26 - 30
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/hedge/HedgePlanActivity.kt

@@ -411,23 +411,28 @@ fun _LinearLayout.creatHedgeHeadUI() {
             }.lparams(wrapContent, wrapContent){
                 marginStart = autoSize(35)
             }
-        }.lparams(autoSize(230), autoSize(120)){
+        }.lparams(autoSize(225), autoSize(120)){
 
         }
 
         verticalLayout {
             gravity = Gravity.CENTER_VERTICAL
             textView {
-                text = "现货品/"
+                text = "现货品/"
                 textColorInt = R.color.hint_text_color
                 textSizeAuto = 24
-            }.lparams(wrapContent, wrapContent)
+            }.lparams(wrapContent, wrapContent){
+                marginStart = autoSize(35)
+            }
             textView {
-                text = "品类"
+                text = "折算系数"
                 textColorInt = R.color.hint_text_color
                 textSizeAuto = 24
             }.lparams(wrapContent, wrapContent)
-        }.lparams(autoSize(150), autoSize(120)){
+            {
+                marginStart = autoSize(35)
+            }
+        }.lparams(autoSize(225), autoSize(120)){
             marginStart = autoSize(22)
         }
 
@@ -440,17 +445,10 @@ fun _LinearLayout.creatHedgeHeadUI() {
                 textSizeAuto = 24
             }.lparams(wrapContent, wrapContent)
 
-        }.lparams(autoSize(170), autoSize(120)){
-
-        }
+        }.lparams(autoSize(225), autoSize(120))
 
         verticalLayout {
-            gravity = Gravity.CENTER_VERTICAL
-            textView {
-                text = "期货账户/"
-                textColorInt = R.color.hint_text_color
-                textSizeAuto = 24
-            }.lparams(wrapContent, wrapContent)
+            gravity = Gravity.CENTER
 
             textView {
                 text = "状态"
@@ -458,21 +456,19 @@ fun _LinearLayout.creatHedgeHeadUI() {
                 textSizeAuto = 24
             }.lparams(wrapContent, wrapContent)
 
-        }.lparams(autoSize(200), autoSize(120)){
-
-        }
-        verticalLayout {
-
-            textView {
-                text = "结算币种"
-                textColorInt = R.color.hint_text_color
-                textSizeAuto = 24
-            }.lparams(wrapContent, wrapContent){
-                marginEnd = autoSize(36)
-            }
-
-        }.lparams(autoSize(170), wrapContent) {
-            topMargin = autoSize(10)
-        }
+        }.lparams(autoSize(225), autoSize(120))
+//        verticalLayout {
+//
+//            textView {
+//                text = "结算币种"
+//                textColorInt = R.color.hint_text_color
+//                textSizeAuto = 24
+//            }.lparams(wrapContent, wrapContent){
+//                marginEnd = autoSize(36)
+//            }
+//
+//        }.lparams(autoSize(170), wrapContent) {
+//            topMargin = autoSize(10)
+//        }
     }.lparams(matchParent, autoSize(92))
 }

+ 49 - 49
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/hedge/HedgePlanViewHolder.kt

@@ -86,53 +86,55 @@ class HedgePlanViewHolder(private val activity: AppCompatActivity,private val vi
                         topMargin = autoSize(15)
                     }
 
-                }.lparams(autoSize(230), autoSize(120))
+                }.lparams(autoSize(225), autoSize(120))
 
                 verticalLayout {
                     textView {
                         //现货品种
                         data.bindOptional(context){
-                            text = it?.deliverygoodsname
+                            text = it?.wrstandardname
                         }
                         textSizeAuto = 29
                         textColorInt = R.color.rma_black_33
                         maxLines = 1
                         ellipsize = TextUtils.TruncateAt.END
                     }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(35)
                         topMargin = autoSize(25)
                     }
 
                     textView {
                         data.bindOptional(context){
-                            text = it?.wrstandardname
+                            text = it?.convertfactor
                         }
                         textSizeAuto = 29
                         textColorInt = R.color.hint_text_color
                     }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(35)
                         topMargin = autoSize(15)
                     }
 
-                }.lparams(autoSize(150), autoSize(120)){
+                }.lparams(autoSize(225), autoSize(120)){
                     marginStart = autoSize(22)
                 }
 
                 verticalLayout {
                     gravity = Gravity.CENTER
 
-                    //标仓系数
-                    textView {
-                        visibility = View.GONE
-                        data.bindOptional(context){
-                            text = it?.convertfactor
-                        }
-                        textSizeAuto = 29
-                        textColorInt = R.color.rma_black_33
-                        maxLines = 1
-                        ellipsize = TextUtils.TruncateAt.END
-                    }.lparams(wrapContent, wrapContent) {
-
-                        topMargin = autoSize(25)
-                    }
+//                    //标仓系数
+//                    textView {
+//                        visibility = View.GONE
+//                        data.bindOptional(context){
+//                            text = it?.convertfactor
+//                        }
+//                        textSizeAuto = 29
+//                        textColorInt = R.color.rma_black_33
+//                        maxLines = 1
+//                        ellipsize = TextUtils.TruncateAt.END
+//                    }.lparams(wrapContent, wrapContent) {
+//
+//                        topMargin = autoSize(25)
+//                    }
 
                     textView {
                         data.bindOptional(context){
@@ -148,23 +150,24 @@ class HedgePlanViewHolder(private val activity: AppCompatActivity,private val vi
                     }.lparams(wrapContent, wrapContent){
 
                     }
-                }.lparams(autoSize(170), autoSize(120)){
+                }.lparams(autoSize(225), autoSize(120)){
 
                 }
 
                 verticalLayout {
 
-                    textView {
-                        //autoSizeMinTextSize 最小值;autoSizeMaxTextSize:最大值;autoSizeStepGranularity:增量;unit:类型,此处指定的是sp
-                        data.bindOptional(context){
-                            text = it?.tradeusername
-                        }
-                        textSizeAuto = 27
-                        textColorInt = R.color.rma_black_33
-                    }.lparams(wrapContent, wrapContent) {
-                        topMargin = autoSize(25)
-                        marginEnd = autoSize(35)
-                    }
+//                    textView {
+//                        //autoSizeMinTextSize 最小值;autoSizeMaxTextSize:最大值;autoSizeStepGranularity:增量;unit:类型,此处指定的是sp
+//                        data.bindOptional(context){
+//                            text = it?.tradeusername
+//                        }
+//                        textSizeAuto = 27
+//                        textColorInt = R.color.rma_black_33
+//                    }.lparams(wrapContent, wrapContent) {
+//                        topMargin = autoSize(25)
+//                        marginEnd = autoSize(35)
+//                    }
+                    gravity = Gravity.CENTER
                     //状态
                     textView {
                         data.bindOptional(context){
@@ -174,27 +177,24 @@ class HedgePlanViewHolder(private val activity: AppCompatActivity,private val vi
                         textColorInt = R.color.rma_black_33
                         maxLines = 1
                         ellipsize = TextUtils.TruncateAt.END
-                    }.lparams(wrapContent, wrapContent){
-                        marginEnd = autoSize(35)
-
-                    }
-                }.lparams(autoSize(200), autoSize(120)){
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(autoSize(225), autoSize(120)){
 
                 }
 
-                verticalLayout {
-
-                    textView {
-                        data.bindOptional(context){
-                            text = it?.currencyname
-                        }
-                        textColorInt = R.color.hint_text_color
-                        textSizeAuto = 24
-                    }.lparams(wrapContent, wrapContent){
-                        topMargin = autoSize(60)
-                    }
-
-                }.lparams(autoSize(170), wrapContent)
+//                verticalLayout {
+//
+//                    textView {
+//                        data.bindOptional(context){
+//                            text = it?.currencyname
+//                        }
+//                        textColorInt = R.color.hint_text_color
+//                        textSizeAuto = 24
+//                    }.lparams(wrapContent, wrapContent){
+//                        topMargin = autoSize(60)
+//                    }
+//
+//                }.lparams(autoSize(170), wrapContent)
 
             }.lparams(matchParent, autoSize(120))
 
@@ -247,7 +247,7 @@ class HedgePlanViewHolder(private val activity: AppCompatActivity,private val vi
                         ActivityUtils.startActivity(intent)
                     }
                     data.bindOptional(context) {
-                       if (type == "0") {
+                       if (type == "1") {
                            //判断是否有相应权限显示该功能
                            if (GlobalDataCollection.instance?.getFourLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_hedgeplan",threeCode = "client_spotsaduit_hedgeplan_unaduit",fourCode = "client_spotsaduit_hedgeplan_unaduit_cancel") == true){
                                if (it?.hedgeplanstatus == "1" || it?.hedgeplanstatus == "0") {

+ 3 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/hedge/HedgePlanViewModel.kt

@@ -162,21 +162,21 @@ class HedgePlanViewModel : BaseViewModel() {
                     "0" -> {
                         val newList = respData?.toArrayList()
                         newList?.sortWith(Comparator { t1, t2 ->
-                            (TimeUtils.string2Millis(t1.updatetime) - TimeUtils.string2Millis(t2.updatetime)).toInt()
+                            (TimeUtils.string2Millis(t2.updatetime) - TimeUtils.string2Millis(t1.updatetime)).toInt()
                         })
                         unSubmitList.postValue(newList)
                     }
                     "1" -> {
                         val newList = respData?.toArrayList()
                         newList?.sortWith(Comparator { t1, t2 ->
-                            (TimeUtils.string2Millis(t1.audittime) - TimeUtils.string2Millis(t2.audittime)).toInt()
+                            (TimeUtils.string2Millis(t2.audittime) - TimeUtils.string2Millis(t1.audittime)).toInt()
                         })
                         toAuditList.postValue(newList)
                     }
                     "2" -> {
                         val newList = respData?.toArrayList()
                         newList?.sortWith(Comparator { t1, t2 ->
-                            (TimeUtils.string2Millis(t1.updatetime) - TimeUtils.string2Millis(t2.updatetime)).toInt()
+                            (TimeUtils.string2Millis(t2.updatetime) - TimeUtils.string2Millis(t1.updatetime)).toInt()
                         })
                         executionList.postValue(newList)
                     }

+ 2 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/InventoryAuditActivity.kt

@@ -49,11 +49,11 @@ class InventoryAuditActivity : BaseActivity<InventoryAuditViewModel>(){
 
     fun initMenuData(){
 
-        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_stock_aduit",secondCode = "client_stock_in") == true){
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_stock",secondCode = "client_stock_in") == true){
             newTabsArray.add("入库")
             uiList.add(inStorage.root)
         }
-        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_stock_aduit",secondCode = "client_stock_out") == true){
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_stock",secondCode = "client_stock_out") == true){
             newTabsArray.add("出库")
             uiList.add(outStorage.root)
         }

+ 3 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/InventoryContentAdapter.java

@@ -108,18 +108,18 @@ public class InventoryContentAdapter extends RecyclerView.Adapter<InventoryConte
         });
         if (type.equals("1")){
             if (status.equals("1")){//入库
-                if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_stock_aduit","client_stock_in","client_stock_in_aduit")){
+                if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_stock","client_stock_in","client_stock_in_aduit")){
                     itemViewHolder.futures_subsidiary.setVisibility(View.VISIBLE);
                 }else {
                     itemViewHolder.futures_subsidiary.setVisibility(View.GONE);
                 }
-                if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_stock_aduit","client_stock_in","client_stock_aduit_cancel")){
+                if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_stock","client_stock_in","client_stock_aduit_cancel")){
                     itemViewHolder.spot_subsidiary.setVisibility(View.VISIBLE);
                 }else {
                     itemViewHolder.spot_subsidiary.setVisibility(View.GONE);
                 }
             }else {//出库
-                if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_stock_aduit","client_stock_out","client_stock_out_aduit")){
+                if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_stock","client_stock_out","client_stock_out_aduit")){
                     itemViewHolder.futures_subsidiary.setVisibility(View.VISIBLE);
                 }else {
                     itemViewHolder.futures_subsidiary.setVisibility(View.GONE);

+ 6 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/contract/ContractAuditFragment.kt

@@ -102,6 +102,12 @@ class ContractAuditFragment : BaseFragment<ContractViewModel>(){
 
     }
 
+    override fun onResume() {
+        super.onResume()
+        viewModel.queryContract("2")
+        viewModel.queryContract("3")
+    }
+
     override fun onCreateView(
         inflater: LayoutInflater,
         container: ViewGroup?,

+ 5 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/delivery/DeliveryAuditFragment.kt

@@ -92,6 +92,11 @@ class DeliveryAuditFragment : BaseFragment<DeliveryAuditViewModel>(){
 
     }
 
+    override fun onResume() {
+        super.onResume()
+        viewModel.queryBusinessJS()
+    }
+
 
     override fun onCreateView(
         inflater: LayoutInflater,

+ 6 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/hedgeplan/HedgePlanFragment.kt

@@ -97,6 +97,12 @@ class HedgePlanFragment : BaseFragment<HedgePlanViewModel>(){
 
     }
 
+    override fun onResume() {
+        super.onResume()
+        viewModel.queryHedegList("1")
+        viewModel.queryHedegList("2")
+    }
+
     override fun onCreateView(
         inflater: LayoutInflater,
         container: ViewGroup?,

+ 5 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/someprice/SomePriceFragment.kt

@@ -97,6 +97,11 @@ class SomePriceFragment : BaseFragment<SomePriceViewModel>(){
 
     }
 
+    override fun onResume() {
+        super.onResume()
+        viewModel.queryBusinessDJ()
+    }
+
     override fun onCreateView(
         inflater: LayoutInflater,
         container: ViewGroup?,

+ 1 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tjmd/TjmdHomeViewModel.kt

@@ -88,7 +88,7 @@ class TjmdHomeViewModel : BaseViewModel(){
             queryKChartData(list.get(0).goodsInfo?.goodscode ?: "","11")
         }
 
-        if (list.size > 4){
+        if (list.size > 10){
             queryQuoteDay(tag,0,10,list){isCompleted, err ->
                 callback(isCompleted, err)
             }

+ 1 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ContentAdapter.java

@@ -94,7 +94,7 @@ public class ContentAdapter extends RecyclerView.Adapter<ContentAdapter.ItemView
     @Override
     public void onBindViewHolder(@NonNull final ItemViewHolder itemViewHolder, int i) {
         this.index = i;
-        itemViewHolder.tvLeftTitle.setText(datas.get(i).getAccountname());
+        itemViewHolder.tvLeftTitle.setText(datas.get(i).getNickname());
         itemViewHolder.tv_left_bottom_title.setText(datas.get(i).getContractno());
         //右边滑动部分
         LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);

+ 4 - 40
RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ContractDetailActivity.kt

@@ -297,8 +297,6 @@ class ContractDetailsUI(
             }.lparams(matchParent, matchParent)
 
             val datalist = arrayListOf<ContractDetailsData>(
-
-
                 ContractDetailsData(
                     title = "合同编号",
                     content = data.contractno?.isBlankString() ?: ""
@@ -326,7 +324,7 @@ class ContractDetailsUI(
                     "套利"
                 }),
                 ContractDetailsData(title = "现货品种", content = data.deliverygoodsname ?: ""),
-                ContractDetailsData(title = "品",content = data.wrstandardname ?: ""),
+                ContractDetailsData(title = "品",content = data.wrstandardname ?: ""),
                 ContractDetailsData(title = "品牌",content = data.brandname ?: ""),
                 ContractDetailsData(
                     title = "产品类型",
@@ -365,48 +363,14 @@ class ContractDetailsUI(
                 ContractDetailsData(title = "",content =  ""),
                 ContractDetailsData(title = "",content =   ""),
                 ContractDetailsData(title = "",content =   ""),
+                ContractDetailsData(title = "",content =   ""),
+                ContractDetailsData(title = "",content =   ""),
+                ContractDetailsData(title = "",content =   ""),
                 ContractDetailsData(title = "",content =   "")
 
             )
 
             unSubmitAdapter.setNewData(datalist)
-
-
-//            scrollView {
-//                verticalLayout {
-//                    contentItem(itemTile = ViewEnumUtils.getContractType(data.contracttype ?: "") + "-" + ViewEnumUtils.getPriceType(data.pricetype ?: "") + "合同",itemContent = data.contractno?.isBlankString() ?: "")
-//                    viewItemUI()
-//                    contentItem(itemTile = if (data.contracttype == "1") { "销售方" }else{ "采购方" } ,itemContent = if (data.contracttype == "1") { data.sellusername ?: "" }else{ data.buyusername ?: "" })
-//                    viewItemUI()
-//                    contentItem(itemTile = "现货品种",itemContent = data.deliverygoodsname ?: "")
-//                    viewItemUI()
-//                    contentItem(itemTile = "产品类型",itemContent = ViewEnumUtils.getProductType(data.producttype ?: ""))
-//                    viewItemUI()
-//                    contentItem(itemTile = "产品规格",itemContent = data.spotgoodsdesc ?: "")
-//                    viewItemUI()
-//                    contentItem(itemTile = "定价类型",itemContent = ViewEnumUtils.getPriceType(data.pricetype ?: ""))
-//                    viewItemUI()
-//                    contentItem(itemTile = "期货合约",itemContent = data.goodsname ?: "")
-//                    viewItemUI()
-//                    contentItem(itemTile = "升贴水",itemContent = data.pricemove ?: "")
-//                    viewItemUI()
-//                    contentItem(itemTile = "标仓系数",itemContent = data.convertfactor ?: "")
-//                    viewItemUI()
-//                    contentItem(itemTile = "点价期",itemContent = data.startdate?.isShowTimeString("MM-dd") + "~" + data.enddate?.isShowTimeString("MM-dd"))
-//                    viewItemUI()
-//                    contentItem(itemTile = "点价期",itemContent = data.deliverystartdate?.isShowTimeString("MM-dd") + "~" + data.deliveryenddate?.isShowTimeString("MM-dd"))
-//                    viewItemUI()
-//                    contentItem(itemTile = "合同量",itemContent = data.qty ?: "" + data.enumdicname ?: "")
-//                    viewItemUI()
-//                    contentItem(itemTile = "初始保证金",itemContent = data.margin ?: "")
-//                    viewItemUI()
-//                    contentItem(itemTile = "初始保证金",itemContent = data.margin ?: "")
-//                    viewItemUI()
-//                    contentItem(itemTile = "初始保证金",itemContent = data.margin ?: "")
-//                    viewItemUI()
-//                    contentItem(itemTile = "初始保证金",itemContent = data.margin ?: "")
-//                }
-//            }.lparams(matchParent, matchParent)
         }.lparams(matchParent, matchParent)
     }
 }

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

@@ -25,6 +25,8 @@ import com.blankj.utilcode.util.SizeUtils
 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.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
@@ -155,6 +157,7 @@ class ProcurementFragment : BaseFragment<ProcurementViewModel>() {
         }
         indexFirst++
         return UI {
+            createLoadingDialog(hintStr = "").bindTaskStatus(getAppCompatActivity(), viewModel.loadingDialogStatus)
             verticalLayout {
                 tabSegment {
                     segment = this

+ 16 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ProcurementViewModel.kt

@@ -140,7 +140,7 @@ class ProcurementViewModel : BaseViewModel() {
                     "1" -> {
                         val newList = respData?.toArrayList()
                         newList?.sortWith(Comparator { t1, t2 ->
-                            (TimeUtils.string2Millis(t1.updatetime) - TimeUtils.string2Millis(t2.updatetime)).toInt()
+                            (TimeUtils.string2Millis(t2.updatetime) - TimeUtils.string2Millis(t1.updatetime)).toInt()
                         })
                         unSubmitList.postValue(resetContraData(newList ?: arrayListOf()))
                     }
@@ -299,19 +299,31 @@ class ProcurementViewModel : BaseViewModel() {
             if (isSuccess) {
                 when (type) {
                     "1" -> {
-                        allDataList.postValue(getAllRightData(respData ?: arrayListOf()))
+                        val newList = respData?.toArrayList()
+                        newList?.sortWith(Comparator { t1, t2 ->
+                            (TimeUtils.string2Millis(t2.audittime) - TimeUtils.string2Millis(t1.audittime)).toInt()
+                        })
+                        allDataList.postValue(getAllRightData(newList?.toList() ?: arrayListOf()))
                     }
                     "2" -> {
+                        val newList = respData?.toArrayList()
+                        newList?.sortWith(Comparator { t1, t2 ->
+                            (TimeUtils.string2Millis(t2.audittime) - TimeUtils.string2Millis(t1.audittime)).toInt()
+                        })
                         forSomePriceDataList.postValue(
                             getSomePriceRightData(
-                                respData ?: arrayListOf()
+                                newList?.toList() ?: arrayListOf()
                             )
                         )
                     }
                     "3" -> {
+                        val newList = respData?.toArrayList()
+                        newList?.sortWith(Comparator { t1, t2 ->
+                            (TimeUtils.string2Millis(t2.audittime) - TimeUtils.string2Millis(t1.audittime)).toInt()
+                        })
                         settlementDataList.postValue(
                             getSettlementRightData(
-                                respData ?: arrayListOf()
+                                newList?.toList() ?: arrayListOf()
                             )
                         )
                     }

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

@@ -25,6 +25,8 @@ import com.blankj.utilcode.util.SizeUtils
 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.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
@@ -136,6 +138,7 @@ class SaleFragment : BaseFragment<SaleViewModel>() {
 
 
         return UI {
+            createLoadingDialog(hintStr = "").bindTaskStatus(getAppCompatActivity(), viewModel.loadingDialogStatus)
             verticalLayout {
                 tabSegment {
                     segment = this

+ 15 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/SaleViewModel.kt

@@ -266,19 +266,31 @@ class SaleViewModel : BaseViewModel(){
             if (isSuccess) {
                 when (type) {
                     "1" -> {
-                        allDataList.postValue(getAllRightData(respData ?: arrayListOf()))
+                        val newList = respData?.toArrayList()
+                        newList?.sortWith(Comparator { t1, t2 ->
+                            (TimeUtils.string2Millis(t2.audittime) - TimeUtils.string2Millis(t1.audittime)).toInt()
+                        })
+                        allDataList.postValue(getAllRightData(newList?.toList() ?: arrayListOf()))
                     }
                     "2" -> {
+                        val newList = respData?.toArrayList()
+                        newList?.sortWith(Comparator { t1, t2 ->
+                            (TimeUtils.string2Millis(t2.audittime) - TimeUtils.string2Millis(t1.audittime)).toInt()
+                        })
                         forSomePriceDataList.postValue(
                             getSomePriceRightData(
-                                respData ?: arrayListOf()
+                                newList?.toList() ?: arrayListOf()
                             )
                         )
                     }
                     "3" -> {
+                        val newList = respData?.toArrayList()
+                        newList?.sortWith(Comparator { t1, t2 ->
+                            (TimeUtils.string2Millis(t2.audittime) - TimeUtils.string2Millis(t1.audittime)).toInt()
+                        })
                         settlementDataList.postValue(
                             getSettlementRightData(
-                                respData ?: arrayListOf()
+                                newList?.toList() ?: arrayListOf()
                             )
                         )
                     }

+ 17 - 5
RMA/app/src/main/java/cn/muchinfo/rma/view/base/spot/SpotFragment.kt

@@ -16,6 +16,7 @@ import cn.muchinfo.rma.global.data.ContractData
 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.home.commodity.AddHedgeGoodsActivity
 import cn.muchinfo.rma.view.base.home.commodity.newspot.NewAddSpotGoodsActivity
 import cn.muchinfo.rma.view.base.home.contract.AddContractActivity
 import cn.muchinfo.rma.view.base.procurement.ProcurementFragment
@@ -26,6 +27,8 @@ import com.blankj.utilcode.util.ConvertUtils
 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.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
@@ -102,6 +105,7 @@ class SpotFragment : BaseFragment<SpotViewModel>(){
         savedInstanceState: Bundle?
     ): View? {
         initMenuData()
+
         return UI {
 
             verticalLayout {
@@ -122,11 +126,19 @@ class SpotFragment : BaseFragment<SpotViewModel>(){
 
                     imageView {
                          onThrottleFirstClick {
-                             val intent = Intent()
-                             intent.putExtra("operationtype","1")
-                             intent.putExtra("data", ContractData())
-                             intent.setClass(context,AddContractActivity::class.java)
-                             ActivityUtils.startActivity(intent)
+                             if (selectedTabIndex == 2){
+                                 val intent = Intent()
+                                 intent.putExtra("type","1")
+                                 intent.setClass(context, AddHedgeGoodsActivity::class.java)
+                                 ActivityUtils.startActivity(intent)
+                             }else{
+                                 val intent = Intent()
+                                 intent.putExtra("operationtype","1")
+                                 intent.putExtra("data", ContractData())
+                                 intent.setClass(context,AddContractActivity::class.java)
+                                 ActivityUtils.startActivity(intent)
+                             }
+
                          }
                         imageResource = R.mipmap.rma_contract_add
                     }.lparams(autoSize(45), autoSize(45)) {

+ 4 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/chart/YrdzChartActivity.kt

@@ -67,6 +67,10 @@ class YrdzChartActivity : BaseActivity<YrdzChartViewModel>() , View.OnClickListe
      */
     val type by lazy { intent.getStringExtra("type") }
 
+    val thistag by lazy {
+        "YrdzChartActivity"
+    }
+
     companion object {
         // 启动页面
         fun start(goodsId: String?, goodsCode: String?, outGoodsCode: String?, context: Context) {

+ 31 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/chart/YrdzChartViewModel.kt

@@ -19,6 +19,8 @@ import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
 import cn.muchinfo.rma.view.base.chart.ChartDataAdapter
 import cn.muchinfo.rma.view.base.chart.old.timeCharts.TimeChartView
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
 
 /**
  * 分时图使用goodscode请求接口  用outgoodscode请求盘面
@@ -119,9 +121,38 @@ class YrdzChartViewModel : BaseViewModel() {
                 }
             }
         }
+        addSubscriptQuote(setOf(goodsCode))
+
       }
 
     /**
+     * 订阅行情
+     * @param tag String
+     * @param goodsInfoList List<GoodsInfo>
+     */
+    fun addSubscriptQuote(goodsCodes: Set<String>){
+        GlobalScope.launch {
+            MyApplication.getInstance()?.quoteManager?.addSubscriptQuote(
+                tag = "YrdzChartActivity",goodsCodeSet = goodsCodes
+            ){isCompleted, err ->
+
+            }
+        }
+    }
+
+    /**
+     * 取消订阅
+     * @param tag String
+     */
+    fun removeSubscriptQuote(tag : String){
+        GlobalScope.launch {
+            MyApplication.getInstance()?.quoteManager?.removeSubscriptQuote(
+                tag = "YrdzChartActivity"
+            )
+        }
+    }
+
+    /**
      * 请求k线数据
      */
     fun queryKChartData(goodsCode: String, type: String){

+ 35 - 7
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/listed/PurchaseListedActivity.kt

@@ -234,7 +234,7 @@ class SellListedUI(
                 viewModel.tradePositionData.bindOptional(context) {
                     val maxNumber = it?.enableqty?.toInt() ?: 0
                     //对最大可摘进行赋值
-                    viewModel.maxSellListedingNumber.postValue(maxNumber.toString())
+//                    viewModel.maxSellListedingNumber.postValue(maxNumber.toString())
                 }
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
@@ -297,11 +297,20 @@ class SellListedUI(
                             it?.getPrice()?.toString(),
                             viewModel.goodsInfo.value?.decimalplace ?: 2
                         )
+                        viewModel.maxSellListedingNumber.postValue(
+                            viewModel.usedAccountData.value?.canUserAmount?.div(
+                                NumberUtils.roundNum(
+                                    it?.getPrice()?.toString(),
+                                    viewModel.goodsInfo.value?.decimalplace ?: 2
+                                )?.toDouble() ?: 1.0
+                            )?.div(viewModel.goodsInfo.value?.agreeunit ?: 1)?.toInt()
+                                .toString()
+                        )
                     }
                     viewModel.goodsInfo.bindOptional(context) {
                         decimal = it?.decimalplace ?: 2
                     }
-                    text = "0"
+
                     onePriceInputEdittext = this
                     setOnTextChangeListener { view, value ->
                         if (value.isNullOrEmpty().not() && value.toString().toDouble() != 0.0) {
@@ -312,6 +321,14 @@ class SellListedUI(
                                     )?.times(viewModel.goodsInfo.value?.agreeunit ?: 1), 2
                                 )
                             }
+
+
+                            viewModel.maxSellListedingNumber.postValue(
+                                viewModel.usedAccountData.value?.canUserAmount?.div(
+                                    value?.toString()?.toDouble() ?: 1.0
+                                )?.div(viewModel.goodsInfo.value?.agreeunit ?: 1)?.toInt()
+                                    .toString()
+                            )
                         }
                     }
                     setTextColor(R.color.buy_hall_color)
@@ -355,10 +372,11 @@ class SellListedUI(
                                     ) {
                                         one_delisting_amount.text = NumberUtils.roundNum(
                                             value.toString().toDouble().times(
-                                                onePriceInputEdittext.text.toString()?.toDouble()
-                                            )?.times(viewModel.goodsInfo.value?.agreeunit ?: 1), 2
+                                                onePriceInputEdittext.text.toString().toDouble()
+                                            ).times(viewModel.goodsInfo.value?.agreeunit ?: 1), 2
                                         )
                                     }
+
                                 }
                             }
                             setTextColor(R.color.buy_hall_color)
@@ -397,7 +415,6 @@ class SellListedUI(
                                             .toString(), 0
                                     )
                                 }
-
                             }
 
                             override fun onStartTrackingTouch(p0: SeekBar?) {
@@ -460,6 +477,17 @@ class SellListedUI(
                 }.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()
 
@@ -496,7 +524,7 @@ class SellListedUI(
                         }
                     }
                     gravity = Gravity.CENTER
-                    backgroundResource = R.drawable.qhj_main_blue_bg
+                    backgroundResource = R.drawable.qhj_main_blue_five_bg
                     text = "卖出"
                     textSizeAuto = 38
                     textColorInt = R.color.white
@@ -842,7 +870,7 @@ class BuyListedUI(
                         }
                     }
                     gravity = Gravity.CENTER
-                    backgroundResource = R.drawable.qhj_main_blue_bg
+                    backgroundResource = R.drawable.qhj_main_blue_five_bg
                     text = "买入"
                     textSizeAuto = 38
                     textColorInt = R.color.white

+ 7 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/swaps/delisting/SwapsDelistingActivity.kt

@@ -107,6 +107,7 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
             goodsCodes = quoteGoodsListData.refgoodscode ?: "",
             isShowLoading = false
         )
+        viewModel.resetAccountData()
     }
 
     @SuppressLint("SetTextI18n")
@@ -512,7 +513,6 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
                                     }
                                 }
                             }
-
                         }else  if (data.pricemode == "2"){//挂牌单据为固定价时
                             var numberInput = 0.0
                             if (onePriceInputNumberEdittext.text.toString().isNullOrEmpty()){
@@ -527,7 +527,6 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
                             }else{
                                 text = NumberUtils.roundNum(amout ?: 0.0,2) + "  需履约保证金 : " + infoc?.getMargainValue(amout = amout ?: 0.0,number = numberInput,goodsid = goodsId ?: "0")
                             }
-
                         }
                     }
                     one_delisting_amount = this
@@ -536,7 +535,10 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
                 }.lparams(wrapContent, wrapContent)
             }.lparams(matchParent, autoSize(143))
 
-            textView {
+            linearLayout {
+                background = resources.getDrawable(R.color.white)
+                gravity = Gravity.CENTER_VERTICAL
+                textView {
                 viewModel.usedAccountData.bindOptional(context) {
                     text = "可用资金" + NumberUtils.roundNum(it?.canUserAmount.toString(), 2)
                 }
@@ -546,6 +548,8 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
                 topMargin = autoSize(20)
                 marginStart = autoSize(250)
             }
+            }.lparams(matchParent, autoSize(100))
+
 
             verticalEmptyView()
 

Some files were not shown because too many files changed in this diff