瀏覽代碼

风险管理10月16日提交代码-liu.bolan-天津麦顿/企业风管 bug

Liu.bolan 4 年之前
父節點
當前提交
28bba1d57d

+ 2 - 1
RMA/.idea/gradle.xml

@@ -4,7 +4,7 @@
   <component name="GradleSettings">
     <option name="linkedExternalProjectsSettings">
       <GradleProjectSettings>
-        <option name="testRunner" value="GRADLE" />
+        <option name="testRunner" value="PLATFORM" />
         <option name="distributionType" value="DEFAULT_WRAPPED" />
         <option name="externalProjectPath" value="$PROJECT_DIR$" />
         <option name="gradleJvm" value="1.8" />
@@ -16,6 +16,7 @@
           </set>
         </option>
         <option name="resolveModulePerSourceSet" value="false" />
+        <option name="useQualifiedModuleNames" value="true" />
       </GradleProjectSettings>
     </option>
     <option name="offlineMode" value="true" />

+ 2 - 0
RMA/app/src/main/AndroidManifest.xml

@@ -479,6 +479,8 @@
         <activity android:name=".view.base.spot.associated.externalorder.ExternalOrderAssociationActivity"/>
 
         <activity android:name=".view.base.spot.associated.externalorder.RemoveExternalOrderAssociationActivity"/>
+
+        <activity android:name=".view.base.spot.associated.perioddocuments.BusinessAssociationsActivity"/>
     </application>
 
 </manifest>

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

@@ -34,7 +34,9 @@ data class SCMiddleGoodsData(
     @SerializedName("wrstandardid")
     val wrstandardid : String? = "",//现货商品id
     @SerializedName("wrstandardname")
-    val wrstandardname : String? = ""//现货商品名称
+    val wrstandardname : String? = "",//现货商品名称
+    var inputNumber : String? = "",
+    val isClick : Int = 0//是否点击 1是点击状态
 ) : Parcelable{
     constructor(parcel: Parcel) : this(
         parcel.readString(),
@@ -51,7 +53,9 @@ data class SCMiddleGoodsData(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
-        parcel.readString()
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readInt()
     ) {
     }
 
@@ -71,6 +75,8 @@ data class SCMiddleGoodsData(
         parcel.writeString(wrstandardcode)
         parcel.writeString(wrstandardid)
         parcel.writeString(wrstandardname)
+        parcel.writeString(inputNumber)
+        parcel.writeInt(isClick)
     }
 
     override fun describeContents(): Int {

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

@@ -96,12 +96,12 @@ class SplashActivity : AppCompatActivity() {
 
                     // 外网调试环境 swagger: http://218.17.158.45:21003/swagger/index.html
 
-                    SPUtils.getInstance().put(Constant.goCommonSearchUrl, "http://218.17.158.45:21001/api")
-//                    SPUtils.getInstance().put(Constant.commSearchUrl,"http://218.17.158.45:21004/mtp2-search")
-                    SPUtils.getInstance().put(Constant.quoteHost,"218.17.158.45")
-                    SPUtils.getInstance().put(Constant.quotePort,"21003")
-                    SPUtils.getInstance().put(Constant.tradeHost,"218.17.158.45")
-                    SPUtils.getInstance().put(Constant.tradePort,"21002")
+//                    SPUtils.getInstance().put(Constant.goCommonSearchUrl, "http://218.17.158.45:21001/api")
+////                    SPUtils.getInstance().put(Constant.commSearchUrl,"http://218.17.158.45:21004/mtp2-search")
+//                    SPUtils.getInstance().put(Constant.quoteHost,"218.17.158.45")
+//                    SPUtils.getInstance().put(Constant.quotePort,"21003")
+//                    SPUtils.getInstance().put(Constant.tradeHost,"218.17.158.45")
+//                    SPUtils.getInstance().put(Constant.tradePort,"21002")
 //                    SPUtils.getInstance().put(Constant.uploadUrl,"http://218.17.158.45:21007/mtp2-onlineopen/upload")
 //                    SPUtils.getInstance().put(Constant.openApiUrl,"http://218.17.158.45:21007/mtp2-onlineopen")
                 }

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

@@ -32,7 +32,7 @@ object Constant {
 //    const val baseurl = "http://192.168.31.176:8080/cfg?key=test_176"//黄老板 天津麦顿调试
 //    const val baseurl = "http://192.168.31.167:8080/cfg?key=test_167"//黄老板 平安云平台(企业风管)
 
-    const val baseurl = "http://218.17.158.45:21001/cfg?key=test_139"// 邓工139外网环境 2100000003/123456
+//    const val baseurl = "http://218.17.158.45:21001/cfg?key=test_139"// 邓工139外网环境 2100000003/123456
 
     /**
      * 用sp存储基础url的key

+ 2 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reference/ReferenceAdapter.java

@@ -349,8 +349,8 @@ public class ReferenceAdapter extends RecyclerView.Adapter<ReferenceAdapter.Item
                 intent.putExtra("type","2");
 //                intent.putExtra("goodsGroupId", list?.get(position)?.goodsgroupid)
                 intent.putExtra("marketId", data.getMarketid());
-                intent.setClass(context, ChartActivity.class);
-//                intent.setClass(context, YrdzChartActivity.class);
+//                intent.setClass(context, ChartActivity.class);
+                intent.setClass(context, YrdzChartActivity.class);
                 ActivityUtils.startActivity(intent);
             }
         });

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

@@ -12,10 +12,7 @@ import androidx.viewpager.widget.PagerAdapter
 import androidx.viewpager.widget.ViewPager
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.ViewEnumUtils
-import cn.muchinfo.rma.global.data.BusinessData
-import cn.muchinfo.rma.global.data.ChangeLogData
-import cn.muchinfo.rma.global.data.ContractData
-import cn.muchinfo.rma.global.data.FinancialManageData
+import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.global.isBlankString
 import cn.muchinfo.rma.global.isShowTimeString
 import cn.muchinfo.rma.lifecycle.bindOptional
@@ -27,10 +24,7 @@ import cn.muchinfo.rma.view.base.home.commodity.viewholder.ChangeLogViewHolder
 import cn.muchinfo.rma.view.base.home.contract.viewItemUI
 import cn.muchinfo.rma.view.base.home.inventory.inventorymanager.adapter.ApplyRecordAdapter
 import cn.muchinfo.rma.view.base.procurement.data.ContractDetailsData
-import cn.muchinfo.rma.view.base.procurement.detailsviewholder.ChangeRecordViewHolder
-import cn.muchinfo.rma.view.base.procurement.detailsviewholder.ContractDetailsViewHolder
-import cn.muchinfo.rma.view.base.procurement.detailsviewholder.InvoiceRecordViewHolder
-import cn.muchinfo.rma.view.base.procurement.detailsviewholder.PriceRecordViewHolder
+import cn.muchinfo.rma.view.base.procurement.detailsviewholder.*
 import com.blankj.utilcode.util.ConvertUtils
 import com.blankj.utilcode.util.SizeUtils
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
@@ -61,9 +55,9 @@ class ContractDetailActivity : BaseActivity<ProcurementViewModel>() {
 
     private val tabsArray: List<String> by lazy {
         if (type == "1") {
-            arrayListOf("合同详情", "点价记录", "交收记录", "款项记录", "发票记录", "入库记录", "变更记录")
+            arrayListOf("合同详情", "点价记录", "交收记录", "款项记录", "发票记录", "入库记录", "变更记录","关联记录")
         } else {
-            arrayListOf("合同详情", "点价记录", "交收记录", "款项记录", "发票记录", "出库记录", "变更记录")
+            arrayListOf("合同详情", "点价记录", "交收记录", "款项记录", "发票记录", "出库记录", "变更记录","关联记录")
         }
 
     }
@@ -89,6 +83,9 @@ class ContractDetailActivity : BaseActivity<ProcurementViewModel>() {
     //变更登记
     private val changeRecordUI by lazy { ChangeRecordUI(this, viewModel, data) }
 
+    //关联记录
+    private val associatedRecordUI by lazy { AssociatedRecordUI(this,viewModel, data) }
+
     private val pagerAdapter: PagerAdapter by lazy {
         object : PagerAdapter() {
 
@@ -152,6 +149,14 @@ class ContractDetailActivity : BaseActivity<ProcurementViewModel>() {
                             )
                         }
                     }
+                    7 -> {//关联记录
+                        return associatedRecordUI.root.apply {
+                            container.addView(
+                                this,
+                                ViewGroup.LayoutParams(matchParent, matchParent)
+                            )
+                        }
+                    }
                     else -> return super.instantiateItem(container, position)
                 }
             }
@@ -901,6 +906,122 @@ class ChangeRecordUI(
 }
 
 /**
+ * 期限关联记录
+ */
+class AssociatedRecordUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: ProcurementViewModel,
+    private val data: ContractData
+){
+
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    private val associatedRecordAdapter: BaseAdapter<PaTradeLinkDetailData, AssociatedRecordViewHolder> =
+        BaseAdapter { _, _ -> AssociatedRecordViewHolder(activity) }
+
+    init {
+        viewModel.queryPaTradeLinkDetail()
+    }
+
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+
+            linearLayout {
+                verticalLayout {
+                    gravity = Gravity.CENTER_HORIZONTAL
+                    textView {
+                        text = "关联时间"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(20)
+                    }
+                    textView {
+                        text = "成交时间"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(10)
+                    }
+                }.lparams(0, autoSize(100),1.5f)
+
+                verticalLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        text = "业务类型"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(100),1f)
+
+                verticalLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        text = "订单类型"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(100),1f)
+
+                verticalLayout {
+                    gravity = Gravity.CENTER_HORIZONTAL
+                    textView {
+                        text = "成交价格"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(20)
+                    }
+                    textView {
+                        text = "关联数量"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(10)
+                    }
+                }.lparams(0, autoSize(100),1f)
+
+            }.lparams(matchParent, autoSize(100))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        viewModel.queryChangeLog(RelatedId = data.spotcontractid ?: "")
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = associatedRecordAdapter
+                    }.lparams(matchParent, matchParent)
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.associatedRecordDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    associatedRecordAdapter.setNewData(it)
+                }
+            }
+
+        }
+    }
+}
+
+/**
  *
  * @receiver _LinearLayout
  * @param type String 1 点价记录 2 交收记录 3 款项记录 4 发票记录

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

@@ -90,6 +90,27 @@ class ProcurementViewModel : BaseViewModel() {
      * 客户合同列表已完成数据
      */
     val finishList: MutableLiveData<List<ContractData>> = MutableLiveData()
+
+
+    /**
+     * 关联记录数据列表
+     */
+    val associatedRecordDataList : MutableLiveData<List<PaTradeLinkDetailData>> = MutableLiveData()
+
+    /**
+     * 查询关联记录
+     */
+    fun queryPaTradeLinkDetail(){
+        val params = mutableMapOf<String,String>().apply {
+            put("userid",GlobalDataCollection.instance?.loginRsp?.userID.toString())
+        }
+        MyApplication.getInstance()?.spotManager?.queryPaTradeLinkDetail(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                associatedRecordDataList.postValue(respData)
+            }
+        }
+    }
+
     /**
      * 查询采购列表头部数据
      * @param tableKey String

+ 108 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/detailsviewholder/AssociatedRecordViewHolder.kt

@@ -0,0 +1,108 @@
+package cn.muchinfo.rma.view.base.procurement.detailsviewholder
+
+import android.annotation.SuppressLint
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.ViewEnumUtils
+import cn.muchinfo.rma.global.data.PaTradeLinkDetailData
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 合同详情下的关联记录
+ * @property activity AppCompatActivity
+ * @property itemSize IntArray
+ * @constructor
+ */
+class AssociatedRecordViewHolder(private val activity: AppCompatActivity) : BaseViewHolder<PaTradeLinkDetailData>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    @SuppressLint("SetTextI18n")
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            linearLayout {
+                verticalLayout {
+                    gravity = Gravity.CENTER_HORIZONTAL
+                    //关联时间
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.createtime
+                        }
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(20)
+                    }
+                    //成交时间
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.tradetime
+                        }
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(10)
+                    }
+                }.lparams(0, autoSize(100),1.5f)
+
+                verticalLayout {
+                    gravity = Gravity.CENTER
+                    //业务类型
+                    textView {
+                        data.bindOptional(context){
+                            text = ViewEnumUtils.gethedgeflagStatus(it?.hedgeflag ?: "")
+                        }
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(100),1f)
+
+                verticalLayout {
+                    gravity = Gravity.CENTER
+                    //订单类型
+                    textView {
+                        data.bindOptional(context){
+                            text = ViewEnumUtils.getDealOrderType(buyOrSell = it?.buyorsell ?: "",channelbuildtype = it?.channelbuildtype ?: "")
+                        }
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(0, autoSize(100),1f)
+
+                verticalLayout {
+                    gravity = Gravity.CENTER_HORIZONTAL
+                    //成交价格
+                    textView {
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.tradeprice,2)
+                        }
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(20)
+                    }
+                    //关联数量
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.relatedqty + it?.enumdicname
+                        }
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(10)
+                    }
+                }.lparams(0, autoSize(100),1f)
+
+            }.lparams(matchParent, autoSize(100))
+            itemView()
+        }.lparams(matchParent, autoSize(101))
+    }
+
+}

+ 405 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/spot/associated/perioddocuments/BusinessAssociationsActivity.kt

@@ -0,0 +1,405 @@
+package cn.muchinfo.rma.view.base.spot.associated.perioddocuments
+
+import android.annotation.SuppressLint
+import android.os.Bundle
+import android.view.Gravity
+import android.view.inputmethod.EditorInfo
+import android.widget.EditText
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.MTPEnums
+import cn.muchinfo.rma.global.data.PaTradeLinkData
+import cn.muchinfo.rma.global.data.SCMiddleGoodsData
+import cn.muchinfo.rma.global.data.WrDeliveryAvalidHoldLBData
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.base.hnstmain.contractorders.delivery.DeliveryViewHolder
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import mtp.polymer.com.autowidget.dialog.SelectData
+import mtp.polymer.com.autowidget.dialog.creatBottomSheetDialog
+import org.jetbrains.anko.*
+
+/**
+ * 业务关联页面
+ */
+@Suppress("DEPRECATION")
+class BusinessAssociationsActivity : BaseActivity<BusinessAssociationsViewModel>(){
+
+    //传入的实体数据
+    val data by lazy { intent.getParcelableExtra<PaTradeLinkData>("data") as PaTradeLinkData }
+
+    //选择的业务类型
+    val selectBusinessType : MutableLiveData<SelectData> = MutableLiveData()
+
+    //输入的现货编号
+    lateinit var spot_number_edittext : EditText
+
+    //输入的对手方
+    lateinit var counterparty_edittext : EditText
+
+    //输入的现货商品
+    lateinit var spot_goods_edittext : EditText
+
+    private val businessAssociationsAdapter: BaseAdapter<SCMiddleGoodsData, BusinessAssociationsViewHolder> =
+        BaseAdapter { _, _ ->
+            BusinessAssociationsViewHolder(
+                this,
+                viewModel
+            )
+        }
+
+    @SuppressLint("SetTextI18n")
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+            background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "业务关联"
+                }
+            }
+
+            frameLayout {
+                scrollView {
+                    verticalLayout {
+                        linearLayout {
+                            linearLayout {
+                                background = resources.getDrawable(R.color.white)
+                                gravity = Gravity.CENTER_VERTICAL
+                                textView {
+                                    text = "账户"
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_gray_color
+                                }.lparams(wrapContent, wrapContent){
+                                    marginStart = autoSize(32)
+                                }
+
+                                textView {
+                                    text = data.taname + "/" + data.accountid
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_black_33
+                                }.lparams(wrapContent, wrapContent){
+                                    marginStart = autoSize(32)
+                                }
+                            }.lparams(0, autoSize(95),1f)
+
+                            view {
+                                background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                            }.lparams(autoSize(1), autoSize(95))
+
+                            linearLayout {
+                                gravity = Gravity.CENTER_VERTICAL
+                                textView {
+                                    text = "合约"
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_gray_color
+                                }.lparams(wrapContent, wrapContent){
+                                    marginStart = autoSize(10)
+                                }
+
+                                textView {
+                                    text = data.goodsname + "/" + data.goodscode
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_black_33
+                                }.lparams(wrapContent, wrapContent){
+                                    marginStart = autoSize(32)
+                                }
+                            }.lparams(0, autoSize(95),1f)
+                        }.lparams(matchParent, autoSize(95))
+
+                        itemView()
+
+                        linearLayout {
+                            background = resources.getDrawable(R.color.white)
+                            linearLayout {
+                                gravity = Gravity.CENTER_VERTICAL
+                                textView {
+                                    text = "方向"
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_gray_color
+                                }.lparams(wrapContent, wrapContent){
+                                    marginStart = autoSize(32)
+                                }
+
+                                textView {
+                                    text = if (data.buyorsell == "0"){"买入"}else{"卖出"}
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_black_33
+                                }.lparams(wrapContent, wrapContent){
+                                    marginStart = autoSize(32)
+                                }
+                            }.lparams(0, autoSize(95),1f)
+
+                            view {
+                                background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                            }.lparams(autoSize(1), autoSize(95))
+
+                            linearLayout {
+                                gravity = Gravity.CENTER_VERTICAL
+                                textView {
+                                    text = "期货数量"
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_gray_color
+                                }.lparams(wrapContent, wrapContent){
+                                    marginStart = autoSize(10)
+                                }
+
+                                textView {
+                                    text = data.tradelot + "手(" + data.tradelot?.toDouble()?.times(data.agreeunit?.toDouble() ?: 0.0) + data.enumdicname + ")"
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_black_33
+                                }.lparams(wrapContent, wrapContent){
+                                    marginStart = autoSize(32)
+                                }
+                            }.lparams(0, autoSize(95),1f)
+                        }.lparams(matchParent, autoSize(95))
+
+                        itemView()
+
+                        linearLayout {
+                            gravity = Gravity.CENTER_VERTICAL
+                            background = resources.getDrawable(R.color.white)
+                            onThrottleFirstClick {
+                                val selectDataList = arrayListOf(
+                                    SelectData(
+                                        id = "1",
+                                        value = "套期保值"
+                                    ),
+                                    SelectData(
+                                        id = "2",
+                                        value = "套利"
+                                    ),
+                                    SelectData(
+                                        id = "3",
+                                        value = "换月"
+                                    )
+                                )
+                                creatBottomSheetDialog("请选择交易类型", selectDataList) {
+                                    selectBusinessType.postValue(this)
+                                }
+                            }
+                            textView {
+                                text = "*"
+                                textColorInt = R.color.rma_star_color
+                                textSizeAuto = 31
+                            }.lparams(wrapContent, wrapContent) {
+                                marginStart = autoSize(37)
+                            }
+
+                            textView {
+                                text = "业务类型"
+                                textSizeAuto = 31
+                                textColorInt = R.color.rma_black_33
+                            }.lparams(wrapContent, wrapContent) {
+                                marginStart = autoSize(10)
+                            }
+
+                            textView {
+                                selectBusinessType.bindOptional(context) {
+                                    text = it?.value
+                                    textColorInt = R.color.rma_black_33
+                                }
+                                text = "请选择业务类型"
+                                textSizeAuto = 31
+                                textColorInt = R.color.rma_hint_text_color_ccc
+                            }.lparams(wrapContent, wrapContent) {
+                                marginStart = autoSize(80)
+                            }
+
+                            emptyView()
+
+                            imageView {
+                                imageResource = R.mipmap.rma_more
+                            }.lparams(autoSize(36), autoSize(36)) {
+                                marginEnd = autoSize(25)
+                            }
+                        }.lparams(matchParent, autoSize(95))
+
+                        view {
+                            background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+                        }.lparams(matchParent, autoSize(18))
+
+                        linearLayout {
+                            background = resources.getDrawable(R.color.white)
+                            gravity = Gravity.CENTER_VERTICAL
+                            textView {
+                                text = "现货订单"
+                                textSizeAuto = 34
+                                textColorInt = R.color.rma_black_33
+                            }.lparams(wrapContent, wrapContent){
+                                marginStart = autoSize(32)
+                            }
+
+                            emptyView()
+
+                            textView {
+                                textSizeAuto = 29
+                                textColorInt = R.color.rma_red_color
+                            }.lparams(wrapContent, wrapContent){
+                                marginEnd = autoSize(32)
+                            }
+
+                        }.lparams(matchParent, autoSize(95))
+
+                        linearLayout {
+                            background = resources.getDrawable(R.color.white)
+                            linearLayout {
+                                backgroundResource = R.drawable.qyfg_search_item_bg
+
+                                editText {
+                                    gravity = Gravity.CENTER_VERTICAL
+                                    spot_number_edittext = this
+                                    hint = "搜索现货编号"
+                                    background = null
+                                    hintColorStr = "#CCCCCC"
+                                    textSizeAuto = 31
+                                    inputType = EditorInfo.TYPE_CLASS_NUMBER
+                                    textColorStr = "#333333"
+                                }.lparams(matchParent, autoSize(90))
+
+                            }.lparams(0, autoSize(90),1f){
+                                marginStart = autoSize(28)
+                            }
+
+                            linearLayout {
+                                backgroundResource = R.drawable.qyfg_search_item_bg
+
+                                editText {
+                                    gravity = Gravity.CENTER_VERTICAL
+                                    counterparty_edittext = this
+                                    hint = "搜索对手方"
+                                    background = null
+                                    hintColorStr = "#CCCCCC"
+                                    textSizeAuto = 31
+                                    inputType = EditorInfo.TYPE_CLASS_NUMBER
+                                    textColorStr = "#333333"
+                                }.lparams(matchParent, autoSize(90))
+
+
+                            }.lparams(0, autoSize(90),1f){
+                                marginStart = autoSize(28)
+                                marginEnd = autoSize(28)
+                            }
+
+                            linearLayout {
+                                backgroundResource = R.drawable.qyfg_search_item_bg
+
+                                editText {
+                                    gravity = Gravity.CENTER_VERTICAL
+                                    spot_goods_edittext = this
+                                    hint = "搜索现货商品"
+                                    background = null
+                                    hintColorStr = "#CCCCCC"
+                                    textSizeAuto = 31
+                                    inputType = EditorInfo.TYPE_CLASS_NUMBER
+                                    textColorStr = "#333333"
+                                }.lparams(matchParent, autoSize(90))
+                            }.lparams(0, autoSize(90),1f){
+                                marginEnd = autoSize(28)
+                            }
+                        }.lparams(matchParent, autoSize(90))
+
+                        view {
+                            background = resources.getDrawable(R.color.white)
+                        }.lparams(matchParent, autoSize(18))
+
+                        linearLayout {
+                            background = resources.getDrawable(R.color.white)
+                            textView {
+                                backgroundResource = R.drawable.yrdz_item_click_bg
+                                gravity = Gravity.CENTER
+                                text = "查询"
+                                textSizeAuto = 34
+                                textColorInt = R.color.rma_blue_color
+                            }.lparams(matchParent, autoSize(68)){
+                                marginStart = autoSize(28)
+                                marginEnd = autoSize(28)
+                            }
+                        }.lparams(matchParent, autoSize(68))
+
+                        view {
+                            background = resources.getDrawable(R.color.white)
+                        }.lparams(matchParent, autoSize(18))
+
+                        linearLayout {
+                            verticalLayout {
+                                gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
+                                textView {
+                                    text = "商品"
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_hint_text_color_ccc
+                                }.lparams(wrapContent, wrapContent){
+                                    marginStart = autoSize(32)
+                                }
+                            }.lparams(0, autoSize(85),1f)
+
+                            verticalLayout {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                                textView {
+                                    text = "应套保数量/"
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_hint_text_color_ccc
+                                }.lparams(wrapContent, wrapContent){
+
+                                }
+
+                                textView {
+                                    text = "已关联数量"
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_hint_text_color_ccc
+                                }.lparams(wrapContent, wrapContent)
+                            }.lparams(0, autoSize(85),1f)
+
+                            verticalLayout {
+                                gravity = Gravity.CENTER_VERTICAL or Gravity.RIGHT
+                                textView {
+                                    text = "本次关联数量(期货)"
+                                    textSizeAuto = 31
+                                    textColorInt = R.color.rma_hint_text_color_ccc
+                                }.lparams(wrapContent, wrapContent){
+                                    marginEnd = autoSize(32)
+                                }
+                            }.lparams(0, autoSize(85),1f)
+                        }.lparams(matchParent, autoSize(85))
+
+                        recyclerView {
+                            background = resources.getDrawable(R.color.segtabment_bg_color)
+                            adapter = businessAssociationsAdapter
+                        }.lparams(matchParent, matchParent)
+
+                        viewModel.associationsSpotDataList.bindOptional(context) {
+                            businessAssociationsAdapter.setNewData(it)
+                        }
+                    }
+                }
+
+                linearLayout {
+                    background = resources.getDrawable(R.color.white)
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        onThrottleFirstClick {
+
+                        }
+                        gravity = Gravity.CENTER
+                        backgroundResource = R.mipmap.rma_submit_bg
+                        text = "确定"
+                        textColorInt = R.color.white
+                        textSizeAuto = 38
+                    }.lparams(matchParent, autoSize(119)) {
+                        marginStart = autoSize(36)
+                        marginEnd = autoSize(36)
+                    }
+                }.lparams(matchParent, autoSize(144)){
+                    gravity = Gravity.BOTTOM
+                }
+            }.lparams(matchParent, matchParent)
+
+        }
+    }
+
+}

+ 176 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/spot/associated/perioddocuments/BusinessAssociationsViewHolder.kt

@@ -0,0 +1,176 @@
+package cn.muchinfo.rma.view.base.spot.associated.perioddocuments
+
+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.SCMiddleGoodsData
+import cn.muchinfo.rma.global.data.WrDeliveryAvalidHoldLBData
+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.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 BusinessAssociationsViewModel
+ * @property itemSize IntArray
+ * @constructor
+ */
+class BusinessAssociationsViewHolder(private val activity : AppCompatActivity, private val viewModel: BusinessAssociationsViewModel) : BaseViewHolder<SCMiddleGoodsData>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            backgroundDrawable = createRoundRectDrawable("#ffffff", 24)
+            linearLayout {
+                onThrottleFirstClick {
+                    viewModel.setOnItemOnClick(data.value?.contractno ?: "")
+                }
+                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?.customername
+                    }
+                    textSizeAuto = 34
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent){
+                    marginStart = autoSize(28)
+                }
+
+                emptyView()
+
+                textView {
+                    data.bindOptional(context){
+                        text = it?.contractno
+                    }
+                    textSizeAuto = 34
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent){
+                    marginEnd = autoSize(23)
+                }
+            }.lparams(matchParent, autoSize(76))
+
+            itemView()
+
+            linearLayout {
+                verticalLayout {
+                    gravity = Gravity.BOTTOM
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.wrstandardname
+                        }
+                        textSizeAuto = 28
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(20)
+                    }
+
+                }.lparams(0, autoSize(100),1.3f)
+
+                linearLayout {
+                    gravity = Gravity.BOTTOM
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.middlegoodspricedqty3 + "/"
+                        }
+                        textSizeAuto = 34
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(25)
+                    }
+
+                    emptyView()
+
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.pricedqty
+                        }
+                        textSizeAuto = 34
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        marginEnd = autoSize(23)
+                    }
+                }.lparams(0, autoSize(100),1f)
+
+                linearLayout {
+                    gravity = Gravity.BOTTOM
+                    data.bindOptional(context){
+                        if (it?.isClick == 0){
+                            visibility = View.INVISIBLE
+                        }else{
+                            visibility = View.VISIBLE
+                        }
+                    }
+                    numberEditText {
+
+                        data.bindOptional(context){
+//                            val deliveryRelationData = GlobalDataCollection.instance?.deliveryRelationDataArrayList?.find { data1?.goodsid == it.goodsid }
+//                            val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(data1?.goodsid?.toInt() ?: 0)
+//                            val multiple = goodsInfo.agreeunit.times(deliveryRelationData?.mindeliveryqty?.toDouble() ?: 1.0).times(deliveryRelationData?.rratio2?.toDouble() ?: 1.0)
+//                            setChangeValue(multiple)
+                            text =  it?.middlegoodspricedqty3?.toLong()?.minus(it.pricedqty?.toLong() ?: 0).toString()
+                        }
+                        setOnTextChangeListener { view, value ->
+                            if (value.isNullOrEmpty().not()) {
+                                if (data.value?.isClick == 1){
+                                    viewModel.resetNumberForAssciaotionDataList(contractno = data.value?.contractno ?: "",number = value.toString())
+                                }
+                            }
+                        }
+                        setTextColor(R.color.buy_hall_color)
+                    }.lparams(0, autoSize(72), 1f) {
+                        marginStart = autoSize(23)
+                    }
+
+                    textView {
+                        text = "手"
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_yellow_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        marginEnd = autoSize(23)
+                    }
+                }.lparams(0, autoSize(100),1f)
+            }.lparams(matchParent, autoSize(100))
+
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                emptyView()
+
+                textView {
+                    // TODO 缺少现货数量
+                    data.bindOptional(context){
+                        text = it?.contracttype
+                    }
+                    textSizeAuto = 27
+                    textColorInt = R.color.rma_hint_text_color_ccc
+                }.lparams(wrapContent, wrapContent){
+                    marginEnd = autoSize(23)
+                }
+            }.lparams(matchParent, autoSize(39))
+        }.lparams(matchParent, autoSize(216)){
+            marginStart = autoSize(25)
+            marginEnd = autoSize(25)
+            topMargin = autoSize(24)
+        }
+    }
+}

+ 91 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/spot/associated/perioddocuments/BusinessAssociationsViewModel.kt

@@ -0,0 +1,91 @@
+package cn.muchinfo.rma.view.base.spot.associated.perioddocuments
+
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.PaTradeLinkData
+import cn.muchinfo.rma.global.data.SCMiddleGoodsData
+import cn.muchinfo.rma.global.data.WrDeliveryAvalidHoldLBData
+import cn.muchinfo.rma.view.MyApplication
+import cn.muchinfo.rma.view.base.BaseViewModel
+
+/**
+ * 业务关联viewmodel
+ */
+class BusinessAssociationsViewModel : BaseViewModel(){
+
+    //现货订单列表数据
+    val associationsSpotDataList : MutableLiveData<List<SCMiddleGoodsData>> = MutableLiveData()
+
+    //缓存的用于提交的现货订单数据
+    val associationsSpotCashDataList : MutableLiveData<List<SCMiddleGoodsData>> = MutableLiveData()
+
+
+    /**
+     * 查询现货订单
+     * @param data PaTradeLinkData
+     * @param contractno String
+     * @param customername String
+     * @param wrstandardname String
+     */
+    fun querySCMiddleGoods(data : PaTradeLinkData,contractno : String = "",customername : String = "",wrstandardname : String = ""){
+        val params = mutableMapOf<String,String>().apply {
+            put("userid",GlobalDataCollection.instance?.loginRsp?.userID.toString())
+            put("buyorsell",if (data.buyorsell == "0"){"1"}else{"0"})
+            put("goodsgroupid",data.goodsgroupid ?: "")
+            if (contractno.isNotEmpty()){
+                put("contractno",contractno)
+            }
+            if (customername.isNotEmpty()){
+                put("customername",customername)
+            }
+            if (wrstandardname.isNotEmpty()){
+                put("wrstandardname",wrstandardname)
+            }
+        }
+        MyApplication.getInstance()?.spotManager?.querySCMiddleGoods(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                associationsSpotDataList.postValue(respData)
+                associationsSpotCashDataList.postValue(respData)
+            }
+        }
+    }
+
+
+    /**
+     * item的点击事件
+     */
+    fun setOnItemOnClick(contractno : String){
+        val newWrStandardFactoryItemDataList = arrayListOf<SCMiddleGoodsData>()
+        associationsSpotCashDataList.value?.forEach {
+            if (it.contractno == contractno){
+                if (it.isClick == 0){
+                    newWrStandardFactoryItemDataList.add(it.copy(isClick = 1))
+                }else{
+                    newWrStandardFactoryItemDataList.add(it.copy(isClick = 0))
+                }
+            }else{
+                newWrStandardFactoryItemDataList.add(it)
+            }
+        }
+        associationsSpotDataList.postValue(newWrStandardFactoryItemDataList)
+        associationsSpotCashDataList.postValue(newWrStandardFactoryItemDataList)
+    }
+
+    /**
+     * 每个item的输入框进行输入时对缓存的现货订单进行赋值
+     */
+    fun resetNumberForAssciaotionDataList(contractno : String,number : String){
+        val newWrStandardFactoryItemDataList = arrayListOf<SCMiddleGoodsData>()
+        associationsSpotCashDataList.value?.forEach {
+            if (it.contractno == contractno){
+                newWrStandardFactoryItemDataList.add(it.copy(inputNumber = number))
+            }else{
+                newWrStandardFactoryItemDataList.add(it)
+            }
+        }
+        associationsSpotCashDataList.postValue(newWrStandardFactoryItemDataList)
+    }
+
+
+
+}

+ 12 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/spot/associated/perioddocuments/PeriodAssociationContentAdapter.java

@@ -2,6 +2,7 @@ package cn.muchinfo.rma.view.base.spot.associated.perioddocuments;
 
 import android.annotation.SuppressLint;
 import android.content.Context;
+import android.content.Intent;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
@@ -14,6 +15,8 @@ import androidx.annotation.NonNull;
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
 
+import com.blankj.utilcode.util.ActivityUtils;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -22,6 +25,7 @@ import cn.muchinfo.rma.global.data.OutTradeLinkData;
 import cn.muchinfo.rma.global.data.PaTradeLinkData;
 import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
 import cn.muchinfo.rma.view.base.procurement.RightScrollAdapter;
+import cn.muchinfo.rma.view.base.spot.associated.externalorder.ExternalOrderAssociationActivity;
 
 /**
  * 期现单据关联adapter
@@ -118,6 +122,14 @@ public class PeriodAssociationContentAdapter extends RecyclerView.Adapter<Period
             }
         });
 
+        itemViewHolder.associated.setVisibility(View.VISIBLE);
+
+        itemViewHolder.associated.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("data",data);
+            intent.setClass(context, BusinessAssociationsActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
 
 
         itemViewHolder.horItemScrollview.setEventListener(new CustomHorizontalScrollView.EventListener() {

+ 9 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/spot/associated/perioddocuments/PeriodDocumentsFragment.kt

@@ -15,6 +15,15 @@ import com.blankj.utilcode.util.SizeUtils
 import org.jetbrains.anko.*
 import org.jetbrains.anko.support.v4.UI
 
+/**
+ * 期现单据关联页面
+ * @property swipeToLayout SwipeToLoadLayout
+ * @property statusLayout StatusLayout
+ * @property horScrollview CustomHorizontalScrollView
+ * @property recyclerView RecyclerView
+ * @property topAdapter TopTabAdpater
+ * @property contentAdapter PeriodAssociationContentAdapter
+ */
 class PeriodDocumentsFragment : BaseFragment<PeriodDocumentsViewModel>(),
     PeriodAssociationContentAdapter.OnContentScrollListener {
 

+ 8 - 0
RMA/app/src/main/res/drawable/qyfg_search_item_bg.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+    <stroke
+        android:color="#CCCCCC"
+        android:width="1dp" />
+    <solid android:color="#ffffff"/>
+    <corners android:radius="3dp"/>
+</shape>