Explorar o código

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

Liu.bolan %!s(int64=4) %!d(string=hai) anos
pai
achega
9a29e88533
Modificáronse 20 ficheiros con 1041 adicións e 180 borrados
  1. 2 0
      RMA/app/src/main/AndroidManifest.xml
  2. 48 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/performance/PerformanceAdapter.kt
  3. 34 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/performance/PerformanceManager.kt
  4. 26 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/warehouse/WarehouseManager.kt
  5. 15 14
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/PermancePlanTmpData.kt
  6. 109 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/WrTradeBargainApplyData.kt
  7. 4 0
      RMA/app/src/main/java/cn/muchinfo/rma/protobuf/funcode/FunCode.java
  8. 28 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/autoWidget/dialog/Dialog.kt
  9. 3 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/app/Constant.kt
  10. 184 98
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/AddPerformanceTempateActivity.kt
  11. 96 16
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/AddPerformanceViewHolder.kt
  12. 50 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/PerformanceItemViewHolder.kt
  13. 52 12
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/PerformanceTemplateViewHolder.kt
  14. 224 5
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/PerformanceTemplateViewModel.kt
  15. 87 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/SelectPerformanceTemplateActivity.kt
  16. 12 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/adapter/AreCancelContentAdapter.java
  17. 5 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/bargain/BargainActivity.kt
  18. 11 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/bargain/BargainViewModel.kt
  19. 38 35
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/listed/ListedActivity.kt
  20. 13 0
      RMA/app/src/main/res/layout/spot_warehouse_layout_item_content.xml

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

@@ -441,6 +441,8 @@
         <activity android:name=".view.base.hnstmain.performancetemplate.PerformanceTemplateActivity"/>
 
         <activity android:name=".view.base.hnstmain.performancetemplate.AddPerformanceTempateActivity"/>
+
+        <activity android:name=".view.base.hnstmain.performancetemplate.SelectPerformanceTemplateActivity"/>
     </application>
 
 </manifest>

+ 48 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/performance/PerformanceAdapter.kt

@@ -16,6 +16,54 @@ import java.lang.Exception
  */
 object PerformanceAdapter {
 
+    /**
+     * 删除模板信息操作请求
+     */
+    fun getDelPerformancePlanTemplateReqInfo(
+        autoid : Long = 0//履约计划模板主键
+    ) : Packet50{
+        val builder = ManageServiceMI3.DelPerformancePlanTemplateReq.newBuilder()
+        val loginInfo = GlobalDataCollection.instance?.loginRsp!!
+        builder.setHeader(
+            MessageHeadModel.getHead(
+                FunCode.FID_DelPerformancePlanTemplateReq,
+                loginInfo.userID,
+                0,
+                0,
+                18
+            )
+        )
+
+        builder.autoid = autoid
+        val arrayOutputStream = ByteArrayOutputStream();
+        builder.build().writeTo(arrayOutputStream)
+        return Packet50(FunCode.FID_DelPerformancePlanTemplateReq, arrayOutputStream.toByteArray())
+    }
+
+    /**
+     * 删除模板信息操作响应
+     * @param packet50 Packet50
+     * @return Triple<Boolean, Error?, ErmcpMI1.SpotContractOperateRsp?>
+     */
+    fun analysisDelPerformancePlanTemplateRsp(packet50: Packet50): Triple<Boolean, Error?, ManageServiceMI3.DelPerformancePlanTemplateRsp?> {
+        return try {
+            val resultRsp = ManageServiceMI3.DelPerformancePlanTemplateRsp.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)
+        }
+    }
+
 
     /**
      * 履约模版信息操作

+ 34 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/performance/PerformanceManager.kt

@@ -26,6 +26,40 @@ import java.lang.Exception
 class PerformanceManager {
 
     /**
+     * 删除模板信息操作请求
+     */
+    fun delPerformancePlanTemplateReq(
+        autoid : Long = 0,//履约计划模板主键
+        callback: (isCompleted: Boolean, err: Error?) -> Unit
+    ){
+        val tradeSocketManager = MyApplication.getInstance()?.tradeSocketManager.guard {
+            callback(false, Error("交易链路未初始化"))
+            return
+        }
+
+        val reqPacket = PerformanceAdapter.getDelPerformancePlanTemplateReqInfo(
+            autoid
+        )
+
+        tradeSocketManager.send(
+            reqPacket,
+            FunCode.FID_DelPerformancePlanTemplateRsp,
+            object : Callback<Packet50> {
+                override fun onSuccess(rsp: Packet50?) {
+                    val rst = PerformanceAdapter.analysisDelPerformancePlanTemplateRsp(rsp!!)
+                    callback(rst.first, rst.second)
+                }
+
+                override fun onFail(err: Error?) {
+                    // 发送数据失败
+                    callback(false, err)
+                }
+
+            }
+        )
+    }
+
+    /**
      * 履约模版信息操作
      */
     fun performancePlanTemplateReq(

+ 26 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/warehouse/WarehouseManager.kt

@@ -266,6 +266,32 @@ class WarehouseManager {
         )
     }
 
+    /**
+     * 查询议价单
+     * @param params Map<String, String>
+     * @param responseBack Function3<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] List<BusinessData>?, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun queryWrTradeBargainApply(
+        params: Map<String, String>,
+        responseBack: (isSuccess: Boolean, respData: List<WrTradeBargainApplyData>?, error: Error?) -> Unit
+    ) {
+        MyOkHttpUtils().query(
+            URL = SPUtils.getInstance()
+                .getString(Constant.goCommonSearchUrl) + "/WrTrade2/QueryWrTradeBargainApply",
+            params = params,
+            type = "1",
+            callback = object : ResponseCallback<BaseResult<List<WrTradeBargainApplyData>>>() {
+                override fun onResponse(response: BaseResult<List<WrTradeBargainApplyData>>?, id: Int) {
+                    responseBack(true, response?.data, null)
+                }
+
+                override fun onError(call: Call?, e: Exception?, id: Int) {
+                    responseBack(false, null, Error(e?.message))
+                }
+            }
+        )
+    }
+
 
     /**
      * 查询现货(预售)仓单持仓 现货仓单->现货汇总/库存汇总/现货明细

+ 15 - 14
RMA/app/src/main/java/cn/muchinfo/rma/global/data/PermancePlanTmpData.kt

@@ -14,7 +14,7 @@ data class PermancePlanTmpData(
     val createtime : String? = "",//创建时间
     @SerializedName("creatorid")
     val creatorid : String? = "",//创建人
-    @SerializedName("lstStep")
+    @SerializedName("LstStep")
     val lstStep : List<WrGoodsPerformanceStepData>? = arrayListOf(),//步骤信息列表
     @SerializedName("paymenttype")
     val paymenttype : String? = "",//支付方式 - 1:冻结 2:扣款
@@ -74,30 +74,30 @@ data class PermancePlanTmpData(
 //履约步骤 步骤信息列表
 data class WrGoodsPerformanceStepData(
     @SerializedName("autoid")
-    var autoid : Int? = 0,//AutoID
+    var autoid : String? = "",//AutoID
     @SerializedName("isauto")
-    val isauto : String? = "",//是否自动 - 0:不自动 1:自动
+    var isauto : String? = "",//是否自动 - 0:不自动 1:自动
     @SerializedName("remark")
-    val remark : String? = "",//备注
+    var remark : String? = "",//备注
     @SerializedName("stepdate")
-    val stepdate : String? = "",//天数信息(T+N)
+    var stepdate : String? = "",//天数信息(T+N)
     @SerializedName("stepdays")
-    val stepdays : String? = "",//距离上一步天数
+    var stepdays : String? = "",//距离上一步天数
     @SerializedName("stepindex")
-    val stepindex : String? = "",//步骤序号
+    var stepindex : String? = "",//步骤序号
     @SerializedName("stepinfo")
-    val stepinfo : String? = "",//步骤信息(步骤名称+步骤值)
+    var stepinfo : String? = "",//步骤信息(步骤名称+步骤值)
     @SerializedName("steptypeid")
-    val steptypeid : String? = "",//履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结 10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款) 用于-1模板“
+    var steptypeid : String? = "",//履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结 10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款) 用于-1模板“
     @SerializedName("steptypename")
-    val steptypename : String? = "",//步骤名称
+    var steptypename : String? = "",//步骤名称
     @SerializedName("stepvalue")
-    val stepvalue : String? = "",//步骤值
+    var stepvalue : String? = "",//步骤值
     @SerializedName("templateid")
-    val templateid : String? = ""//履约计划模板ID
+    var templateid : String? = ""//履约计划模板ID
 ) : Parcelable{
     constructor(parcel: Parcel) : this(
-        parcel.readValue(Int::class.java.classLoader) as? Int,
+        parcel.readString(),
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
@@ -112,7 +112,7 @@ data class WrGoodsPerformanceStepData(
     }
 
     override fun writeToParcel(parcel: Parcel, flags: Int) {
-        parcel.writeValue(autoid)
+        parcel.writeString(autoid)
         parcel.writeString(isauto)
         parcel.writeString(remark)
         parcel.writeString(stepdate)
@@ -139,4 +139,5 @@ data class WrGoodsPerformanceStepData(
         }
     }
 
+
 }

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

@@ -0,0 +1,109 @@
+package cn.muchinfo.rma.global.data
+
+import android.os.Parcel
+import android.os.Parcelable
+import com.google.gson.annotations.SerializedName
+
+/**
+ * 议价单
+ */
+data class WrTradeBargainApplyData(
+    @SerializedName("accountid")
+    val accountid : String? = "",//摘牌资金账号
+    @SerializedName("applyprice")
+    val applyprice : String? = "",//申请价格
+    @SerializedName("applyqty")
+    val applyqty : String? = "",//摘牌数量
+    @SerializedName("applyremark")
+    val applyremark : String? = "",//申请备注
+    @SerializedName("applystatus")
+    val applystatus : String? = "",//申请状态 - 1:待确认 2:已确认 3:已拒绝 4:已撤销 5:系统撤销 6:处理失败 7:确认中
+    @SerializedName("applytime")
+    val applytime : String? = "",//申请时间
+    @SerializedName("buyorsell")
+    val buyorsell : String? = "",//买卖 - 0:买 1:卖
+    @SerializedName("confirmremark")
+    val confirmremark:  String? = "",//确认备注
+    @SerializedName("confirmtime")
+    val confirmtime : String? = "",//确认时间
+    @SerializedName("confirmuserid")
+    val confirmuserid : String? = "",//确认人
+    @SerializedName("handlestatus")
+    val handlestatus : String? = "",//处理状态
+    @SerializedName("marketid")
+    val marketid : String? = "",//市场ID
+    @SerializedName("refprice")
+    val refprice : String? = "",//参考价格
+    @SerializedName("retcode")
+    val retcode : String? = "",//委托返回代码
+    @SerializedName("tradedate")
+    val tradedate : String? = "",//交易日(yyyyMMdd)
+    @SerializedName("userid")
+    val userid : String? = "",//摘牌人用户ID(议价人ID)
+    @SerializedName("username")
+    val username : String? = "",//议价人名字(已脱敏)
+    @SerializedName("wrbargainid")
+    val wrbargainid : String? = "",//议价申请单ID(327+Unix秒时间戳(10位)+xxxxxx)
+    @SerializedName("wrtradeorderid")
+    val wrtradeorderid : String? = ""//关联委托单ID
+) : Parcelable{
+    constructor(parcel: Parcel) : this(
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString()
+    ) {
+    }
+
+    override fun writeToParcel(parcel: Parcel, flags: Int) {
+        parcel.writeString(accountid)
+        parcel.writeString(applyprice)
+        parcel.writeString(applyqty)
+        parcel.writeString(applyremark)
+        parcel.writeString(applystatus)
+        parcel.writeString(applytime)
+        parcel.writeString(buyorsell)
+        parcel.writeString(confirmremark)
+        parcel.writeString(confirmtime)
+        parcel.writeString(confirmuserid)
+        parcel.writeString(handlestatus)
+        parcel.writeString(marketid)
+        parcel.writeString(refprice)
+        parcel.writeString(retcode)
+        parcel.writeString(tradedate)
+        parcel.writeString(userid)
+        parcel.writeString(username)
+        parcel.writeString(wrbargainid)
+        parcel.writeString(wrtradeorderid)
+    }
+
+    override fun describeContents(): Int {
+        return 0
+    }
+
+    companion object CREATOR : Parcelable.Creator<WrTradeBargainApplyData> {
+        override fun createFromParcel(parcel: Parcel): WrTradeBargainApplyData {
+            return WrTradeBargainApplyData(parcel)
+        }
+
+        override fun newArray(size: Int): Array<WrTradeBargainApplyData?> {
+            return arrayOfNulls(size)
+        }
+    }
+
+}

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

@@ -386,6 +386,10 @@ public class FunCode {
     public static final int FID_PerformancePlanTemplateReq = 1900746;
     //模板信息操作响应
     public static final int FID_PerformancePlanTemplateRsp = 1900747;
+    //删除模板信息操作请求
+    public static final int FID_DelPerformancePlanTemplateReq = 1900748;
+    //删除模板信息操作响应
+    public static final int FID_DelPerformancePlanTemplateRsp = 1900749;
 
     /**
      * 交易委托请求(196639)

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

@@ -325,6 +325,34 @@ fun AppCompatActivity.creatGoodsHedgeBottomSheetDialog(
     builder.build().show()
 }
 
+
+/**
+ * 专门用新增履约模版时的步骤类型
+ * @receiver AppCompatActivity
+ * @param titleStr 头部内容
+ * @param selectList List<WrPerformanceStepTypeData> 选择的实体列表
+ * @param select [@kotlin.ExtensionFunctionType] Function1<MiddleGoodsData, Unit>?
+ */
+fun AppCompatActivity.creatPerformanceBottomSheetDialog(
+    titleStr: String,
+    selectList: List<WrPerformanceStepTypeData>,
+    select: (WrPerformanceStepTypeData.() -> Unit)? = null
+) {
+    val builder: QMUIBottomSheet.BottomListSheetBuilder =
+        QMUIBottomSheet.BottomListSheetBuilder(this)
+    builder.setGravityCenter(true)
+        .setTitle(titleStr)
+        .setAddCancelBtn(true)
+    selectList.forEach {
+        builder.addItem(it.steptypename)
+    }
+    builder.setOnSheetItemClickListener { dialog, itemView, position, tag ->
+        select?.invoke(selectList.get(position))
+        dialog.dismiss()
+    }
+    builder.build().show()
+}
+
 /**
  * 查询单据用的时间选择器
  * @receiver AppCompatActivity

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

@@ -300,6 +300,9 @@ object Constant {
     /** 华南顺通-履约信息-卖履约 **/
     const val table_mobile_hnst_lyxx_sell = "table_mobile_hnst_lyxx_sell"
 
+    /** 云融大宗-现货仓单_挂单_议价单 **/
+    const val table_mobile_hnst_xhcd_yjd = "table_mobile_hnst_xhcd_yjd"
+
     /**--------------------------------------------------------------------------------------**/
 
     const val FISTOPENAPP = "first_open_app"

+ 184 - 98
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/AddPerformanceTempateActivity.kt

@@ -6,12 +6,15 @@ import android.view.View
 import android.view.inputmethod.EditorInfo
 import android.widget.EditText
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.PermancePlanTmpData
 import cn.muchinfo.rma.global.data.WrGoodsPerformanceStepData
 import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI3
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.future.trade.itemView
+import com.blankj.utilcode.util.ToastUtils
 import mtp.polymer.com.autowidget.adapter.BaseAdapter
 import mtp.polymer.com.autowidget.dialog.createLoadingDialog
 import mtp.polymer.com.autowidget.utils.bindTaskStatus
@@ -27,6 +30,9 @@ class AddPerformanceTempateActivity : BaseActivity<PerformanceTemplateViewModel>
      */
     val type by lazy { intent.getStringExtra("type") }
 
+
+    val data by lazy { intent.getParcelableExtra<PermancePlanTmpData>("data") as PermancePlanTmpData }
+
     // 下拉刷新
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
@@ -48,11 +54,13 @@ class AddPerformanceTempateActivity : BaseActivity<PerformanceTemplateViewModel>
     fun initializeData(){
         if (type == "1"){
             val newDataList = arrayListOf<WrGoodsPerformanceStepData>()
-            newDataList.add(WrGoodsPerformanceStepData(autoid = 1))
+            newDataList.add(WrGoodsPerformanceStepData(stepindex = "1"))
             viewModel.wrGoodsPerformanceStepDataList.postValue(newDataList)
             viewModel.wrGoodsPerformanceStepCashDataList.postValue(newDataList)
         }else{
-
+            val newDataList = data.lstStep
+            viewModel.wrGoodsPerformanceStepDataList.postValue(newDataList)
+            viewModel.wrGoodsPerformanceStepCashDataList.postValue(newDataList)
         }
     }
 
@@ -73,118 +81,196 @@ class AddPerformanceTempateActivity : BaseActivity<PerformanceTemplateViewModel>
                 }
             }
 
-            linearLayout {
-                background = resources.getDrawable(R.color.white)
-                gravity = Gravity.CENTER_VERTICAL
-
-                textView {
-                    visibility = View.INVISIBLE
-                    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)
-                }
+            frameLayout {
+                scrollView {
+                    verticalLayout {
+                        linearLayout {
+                            background = resources.getDrawable(R.color.white)
+                            gravity = Gravity.CENTER_VERTICAL
 
-                editText {
-                    performance_name = this
-                    hint = "请输入模版名称"
-                    background = null
-                    inputType = EditorInfo.TYPE_CLASS_TEXT
-                    hintColorStr = "#CCCCCC"
-                    textSizeAuto = 31
-                    textColorStr = "#333333"
-                }.lparams(0, autoSize(132), 1f) {
-                    marginStart = autoSize(80)
-                }
-            }.lparams(matchParent, autoSize(132))
+                            textView {
+                                visibility = View.INVISIBLE
+                                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)
+                            }
 
-            itemView()
+                            editText {
+                                performance_name = this
+                                hint = "请输入模版名称"
+                                background = null
+                                inputType = EditorInfo.TYPE_CLASS_TEXT
+                                hintColorStr = "#CCCCCC"
+                                textSizeAuto = 31
+                                textColorStr = "#333333"
+                            }.lparams(0, autoSize(132), 1f) {
+                                marginStart = autoSize(80)
+                            }
+                        }.lparams(matchParent, autoSize(132))
 
-            linearLayout {
-                background = resources.getDrawable(R.color.white)
-                gravity = Gravity.CENTER_VERTICAL
-                linearLayout {
-                    gravity = Gravity.CENTER
-                    textView {
-                        text = "步骤类型"
-                        textSizeAuto = 32
-                        textColorInt = R.color.rma_black_33
-                    }.lparams(wrapContent, wrapContent)
-                }.lparams(0, autoSize(80),1.5f)
+                        itemView()
 
-                linearLayout {
-                    gravity = Gravity.CENTER
-                    textView {
-                        text = "步骤值(%)"
-                        textSizeAuto = 32
-                        textColorInt = R.color.rma_black_33
-                    }.lparams(wrapContent, wrapContent)
-                }.lparams(0, autoSize(80),1f)
+                        linearLayout {
+                            background = resources.getDrawable(R.color.white)
+                            gravity = Gravity.CENTER_VERTICAL
+                            linearLayout {
+                                gravity = Gravity.CENTER
+                                textView {
+                                    text = "步骤类型"
+                                    textSizeAuto = 32
+                                    textColorInt = R.color.rma_black_33
+                                }.lparams(wrapContent, wrapContent)
+                            }.lparams(0, autoSize(80),1.5f)
 
-                linearLayout {
-                    gravity = Gravity.CENTER
-                    textView {
-                        text = "距离上一步天数"
-                        textSizeAuto = 32
-                        textColorInt = R.color.rma_black_33
-                    }.lparams(wrapContent, wrapContent)
-                }.lparams(0, autoSize(80),1.5f)
+                            linearLayout {
+                                gravity = Gravity.CENTER
+                                textView {
+                                    text = "步骤值(%)"
+                                    textSizeAuto = 32
+                                    textColorInt = R.color.rma_black_33
+                                }.lparams(wrapContent, wrapContent)
+                            }.lparams(0, autoSize(80),1f)
 
-                linearLayout {
-                    gravity = Gravity.CENTER
-                    textView {
-                        text = "操作"
-                        textSizeAuto = 32
-                        textColorInt = R.color.rma_black_33
-                    }.lparams(wrapContent, wrapContent)
-                }.lparams(0, autoSize(80),1f)
-            }.lparams(matchParent, autoSize(80))
+                            linearLayout {
+                                gravity = Gravity.CENTER
+                                textView {
+                                    text = "距离上一步天数"
+                                    textSizeAuto = 32
+                                    textColorInt = R.color.rma_black_33
+                                }.lparams(wrapContent, wrapContent)
+                            }.lparams(0, autoSize(80),1.5f)
 
-            statusLayout(contentBlock = {
-                statusLayout = this
-                setRetryAction {
+                            linearLayout {
+                                gravity = Gravity.CENTER
+                                textView {
+                                    text = "操作"
+                                    textSizeAuto = 32
+                                    textColorInt = R.color.rma_black_33
+                                }.lparams(wrapContent, wrapContent)
+                            }.lparams(0, autoSize(80),1f)
+                        }.lparams(matchParent, autoSize(80))
 
-                }
-                swipeToLoadLayout {
-                    swipeToLayout = this
-                    setEnableRefresh(false)
-                    setEnableLoadMore(false)
-                    setOnRefreshListener {
+                        statusLayout(contentBlock = {
+                            statusLayout = this
+                            setRetryAction {
+
+                            }
+                            swipeToLoadLayout {
+                                swipeToLayout = this
+                                setEnableRefresh(false)
+                                setEnableLoadMore(false)
+                                setOnRefreshListener {
 
+                                }
+                                setEnableScrollContentWhenLoaded(false)
+                                setEnableLoadMoreWhenContentNotFull(false)
+                                // 未提交列表
+                                recyclerView {
+                                    background = resources.getDrawable(R.color.white)
+                                    adapter = addPerformanceAdapter
+                                }.lparams(matchParent, matchParent)
+                            }
+                        }, emptyBlock = {
+                            emptyView(hint = resources.getString(R.string.now_no_data))
+                        }).lparams(matchParent, matchParent)
+
+                        viewModel.wrGoodsPerformanceStepDataList.bindOptional(context) {
+                            if (it?.isEmpty() == true || it?.size == 0) {
+                                statusLayout.showEmpty()
+                            } else {
+                                if (swipeToLayout.getIsRefreshing()) {
+                                    swipeToLayout.finishRefresh()
+                                }
+                                statusLayout.showSuccess()
+                                addPerformanceAdapter.setNewData(it)
+                            }
+                        }
                     }
-                    setEnableScrollContentWhenLoaded(false)
-                    setEnableLoadMoreWhenContentNotFull(false)
-                    // 未提交列表
-                    recyclerView {
-                        background = resources.getDrawable(R.color.white)
-                        adapter = addPerformanceAdapter
-                    }.lparams(matchParent, matchParent)
                 }
-            }, emptyBlock = {
-                emptyView(hint = resources.getString(R.string.now_no_data))
-            }).lparams(matchParent, matchParent)
-
-            viewModel.wrGoodsPerformanceStepDataList.bindOptional(context) {
-                if (it?.isEmpty() == true || it?.size == 0) {
-                    statusLayout.showEmpty()
-                } else {
-                    if (swipeToLayout.getIsRefreshing()) {
-                        swipeToLayout.finishRefresh()
+                linearLayout {
+                    background = resources.getDrawable(R.color.white)
+                    gravity = Gravity.CENTER_VERTICAL
+
+                    if (type == "4") {
+                        visibility = View.GONE
+                    } else {
+                        visibility = View.VISIBLE
                     }
-                    statusLayout.showSuccess()
-                    addPerformanceAdapter.setNewData(it)
+                    textView {
+                        onThrottleFirstClick {
+
+                            if (performance_name.text.toString().isNullOrEmpty()){
+                                ToastUtils.showLong("请输入履约模版名称")
+                                return@onThrottleFirstClick
+                            }
+
+                            if (check().not()){
+                                ToastUtils.showLong("请输入完成步骤信息")
+                                return@onThrottleFirstClick
+                            }
+                            viewModel.performancePlanTemplateReq(templatename = performance_name.text.toString(),performancesteps = getTemplateInfo(),userid = GlobalDataCollection.instance?.loginRsp?.userID?.toLong() ?: 0){
+                                finish()
+                            }
+                        }
+                        gravity = Gravity.CENTER
+                        backgroundResource = R.mipmap.rma_submit_bg
+                        text = "提交"
+                        textColorInt = R.color.white
+                        textSizeAuto = 38
+                    }.lparams(matchParent, autoSize(119)) {
+                        marginStart = autoSize(59)
+                        marginEnd = autoSize(59)
+                    }
+                }.lparams(matchParent, autoSize(144)) {
+                    gravity = Gravity.BOTTOM
                 }
+            }.lparams(matchParent, matchParent)
+        }
+    }
+
+
+    fun getTemplateInfo() : List<ManageServiceMI3.EPerformanceStepTemplateInfo>{
+        val tempateInfoList = arrayListOf<ManageServiceMI3.EPerformanceStepTemplateInfo>()
+        viewModel.wrGoodsPerformanceStepCashDataList.value?.forEach {
+            val tempateInfo = ManageServiceMI3.EPerformanceStepTemplateInfo.newBuilder()
+            tempateInfo.steptypeid = it.steptypeid?.toInt() ?: 0
+            tempateInfo.stepindex = it.stepindex?.toInt() ?: 0
+            if (it.stepvalue.isNullOrEmpty().not()){
+                tempateInfo.stepvalue = it.stepvalue?.toDouble() ?: 0.0
             }
+            tempateInfo.isauto = 2
+            tempateInfo.stepdays = it.stepdays?.toInt() ?: 0
+            tempateInfoList.add(tempateInfo.build())
+        }
+        return tempateInfoList
+    }
 
+
+    fun check() : Boolean{
+        var returnBooble = false
+        val cashDataList = viewModel.wrGoodsPerformanceStepCashDataList.value
+        cashDataList?.forEach {
+            if (it.steptypeid.isNullOrEmpty()){
+                returnBooble = false
+            }else{
+                if (it.steptypeid == "1" || it.steptypeid == "2"){
+                    returnBooble = !(it.stepdays.isNullOrEmpty() || it.stepvalue.isNullOrEmpty())
+                }else{
+                    returnBooble = !it.stepdays.isNullOrEmpty()
+                }
+            }
         }
+
+        return returnBooble
     }
 
 }

+ 96 - 16
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/AddPerformanceViewHolder.kt

@@ -2,21 +2,25 @@ package cn.muchinfo.rma.view.base.hnstmain.performancetemplate
 
 import android.view.Gravity
 import android.view.View
+import android.view.inputmethod.EditorInfo
+import android.widget.TextView
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.data.WrGoodsPerformanceStepData
 import cn.muchinfo.rma.lifecycle.bindOptional
-import cn.muchinfo.rma.view.autoWidget.autoSize
-import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
-import cn.muchinfo.rma.view.autoWidget.textColorInt
-import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.ToastUtils
 import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import mtp.polymer.com.autowidget.dialog.creatPerformanceBottomSheetDialog
 import org.jetbrains.anko.*
+import org.jetbrains.anko.sdk25.coroutines.textChangedListener
 
 class AddPerformanceViewHolder(private val activity : AppCompatActivity,private val viewModel: PerformanceTemplateViewModel) : BaseViewHolder<WrGoodsPerformanceStepData>(activity){
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
+    lateinit var stepname : TextView
+
     override fun _FrameLayout.createContentView() {
         verticalLayout {
             linearLayout {
@@ -25,13 +29,24 @@ class AddPerformanceViewHolder(private val activity : AppCompatActivity,private
                 linearLayout {
                     gravity = Gravity.CENTER
                     onThrottleFirstClick {
-
+                        activity.creatPerformanceBottomSheetDialog(titleStr = "请选择步骤",
+                            selectList = viewModel.getSelectPerformanceDataList()
+                        ){
+                            viewModel.setPerformanceStepDataList(operationType = "4",stepindex = data.value?.stepindex ?: "",steptypeid = this.steptypeid ?: "")
+                            stepname.text = this.steptypename
+                        }
                     }
                     textView {
-                        text = "请选择步骤类型"
-                        textSizeAuto = 32
+                        data.bindOptional(context){
+                            text = it?.steptypename
+                        }
+                        stepname = this
+                        text = "请选择步骤"
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_black_33
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(20)
+                    }
 
                     emptyView()
 
@@ -42,8 +57,41 @@ class AddPerformanceViewHolder(private val activity : AppCompatActivity,private
 
                 linearLayout {
                     gravity = Gravity.CENTER
+
+                    editText {
+                        gravity = Gravity.CENTER
+                        data.bindOptional(context){
+                            if (it?.steptypeid == "1" || it?.steptypeid == "2"){
+                                visibility = View.VISIBLE
+                                setText(it.stepvalue)
+                            }else{
+                                visibility = View.GONE
+                            }
+                        }
+                        textChangedListener {
+                            afterTextChanged {
+                                if (it.toString().isNotEmpty()) {
+                                    viewModel.setPerformanceStepDataList(operationType = "3",stepindex = data.value?.stepindex ?: "",stepValue = it.toString())
+                                }
+                            }
+                        }
+                        hint = "0"
+                        background = null
+                        hintColorStr = "#CCCCCC"
+                        textSizeAuto = 29
+                        inputType = EditorInfo.TYPE_CLASS_NUMBER
+                        textColorStr = "#333333"
+                    }.lparams(0, autoSize(100),1f)
+
                     textView {
-                        text = "步骤值(%)"
+                        data.bindOptional(context){
+                            if (it?.steptypeid == "1" || it?.steptypeid == "2"){
+                                visibility = View.GONE
+                            }else{
+                                visibility = View.VISIBLE
+                            }
+                        }
+                        text = "--"
                         textSizeAuto = 32
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent)
@@ -51,22 +99,52 @@ class AddPerformanceViewHolder(private val activity : AppCompatActivity,private
 
                 linearLayout {
                     gravity = Gravity.CENTER
-                    textView {
-                        text = "距离上一步天数"
-                        textSizeAuto = 32
-                        textColorInt = R.color.rma_black_33
-                    }.lparams(wrapContent, wrapContent)
+                    editText {
+                        data.bindOptional(context){
+                            setText(it?.stepdays)
+                        }
+                        gravity = Gravity.CENTER
+                        hint = "0"
+                        textChangedListener {
+                            afterTextChanged {
+                                if (it.toString().isNotEmpty()) {
+                                    viewModel.setPerformanceStepDataList(operationType = "3",stepindex = data.value?.stepindex ?: "",stepdays = it.toString())
+                                }
+                            }
+                        }
+                        background = null
+                        hintColorStr = "#CCCCCC"
+                        textSizeAuto = 29
+                        inputType = EditorInfo.TYPE_CLASS_NUMBER
+                        textColorStr = "#333333"
+                    }.lparams(matchParent, autoSize(100))
                 }.lparams(0, autoSize(100),1.5f)
 
                 linearLayout {
                     gravity = Gravity.CENTER_VERTICAL
                     imageView {
+                        onThrottleFirstClick {
+                            if (viewModel.wrGoodsPerformanceStepDataList.value?.size.toString() == "1") {
+                                ToastUtils.showLong("最少选择一个套保品种")
+                                return@onThrottleFirstClick
+                            }
+                            viewModel.setPerformanceStepDataList(
+                                "2",
+                                dataIndex.plus(1).toString()
+                            )
+
+                        }
                         imageResource = R.mipmap.yrdz_delete_icon
-                    }.lparams(autoSize(36), autoSize(36))
+                    }.lparams(autoSize(36), autoSize(36)){
+                        marginStart = autoSize(20)
+                    }
 
                     emptyView()
 
                     imageView {
+                        onThrottleFirstClick {
+                            viewModel.setPerformanceStepDataList("1",viewModel.wrGoodsPerformanceStepDataList.value?.size?.plus(1).toString())
+                        }
                         data.bindOptional(context){
                             if (dataIndex.plus(1) == dataCount){
                                 visibility = View.VISIBLE
@@ -75,7 +153,9 @@ class AddPerformanceViewHolder(private val activity : AppCompatActivity,private
                             }
                         }
                         imageResource = R.mipmap.yrdz_performance_add_icon
-                    }.lparams(autoSize(36), autoSize(36))
+                    }.lparams(autoSize(36), autoSize(36)){
+                        marginEnd = autoSize(20)
+                    }
                 }.lparams(0, autoSize(100),1f)
             }.lparams(matchParent, autoSize(100))
         }.lparams(matchParent, wrapContent)

+ 50 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/PerformanceItemViewHolder.kt

@@ -0,0 +1,50 @@
+package cn.muchinfo.rma.view.base.hnstmain.performancetemplate
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.WrGoodsPerformanceStepData
+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.textColorStr
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+class PerformanceItemViewHolder(private val activity : AppCompatActivity,private val viewModel: PerformanceTemplateViewModel) : BaseViewHolder<WrGoodsPerformanceStepData>(activity){
+    override val itemSize: IntArray = intArrayOf(wrapContent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            linearLayout {
+                backgroundResource = R.drawable.yrdz_item_bg
+                gravity = Gravity.CENTER_VERTICAL
+                setPadding(autoSize(10),0, autoSize(10),0)
+                textView {
+                    data.bindOptional(context){
+                        text = it?.stepinfo
+                    }
+                    textSizeAuto = 34
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent)
+            }.lparams(wrapContent, autoSize(72)){
+                topMargin = autoSize(20)
+            }
+
+            linearLayout {
+                gravity = Gravity.CENTER_HORIZONTAL
+                textView {
+                    data.bindOptional(context){
+                        text = it?.stepdate
+                    }
+                    textSizeAuto = 29
+                    textColorStr = "#2481DD"
+                }.lparams(wrapContent, wrapContent)
+            }.lparams(matchParent, autoSize(52))
+        }.lparams(wrapContent, autoSize(175)){
+            marginStart = autoSize(20)
+        }
+    }
+
+}

+ 52 - 12
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/PerformanceTemplateViewHolder.kt

@@ -1,29 +1,43 @@
 package cn.muchinfo.rma.view.base.hnstmain.performancetemplate
 
+import android.content.Intent
 import android.graphics.Typeface
 import android.view.Gravity
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.PermancePlanTmpData
+import cn.muchinfo.rma.global.data.WrGoodsPerformanceStepData
 import cn.muchinfo.rma.lifecycle.bindOptional
-import cn.muchinfo.rma.view.autoWidget.autoSize
-import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
-import cn.muchinfo.rma.view.autoWidget.textColorInt
-import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.warehousereceipt.BusinessItemView
 import cn.muchinfo.rma.view.base.warehousereceipt.RulesItem
+import com.blankj.utilcode.util.ActivityUtils
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
 import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import mtp.polymer.com.autowidget.dialog.createWarningDialog
 import org.jetbrains.anko.*
 
 class PerformanceTemplateViewHolder(private val activity : AppCompatActivity,private val viewModel: PerformanceTemplateViewModel,private val type : String) : BaseViewHolder<PermancePlanTmpData>(activity){
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
+    private val performanceItemTemplateAdapter: BaseAdapter<WrGoodsPerformanceStepData, PerformanceItemViewHolder> =
+        BaseAdapter { _, _ ->
+            PerformanceItemViewHolder(
+                activity,
+                viewModel
+            )
+        }
+
     override fun _FrameLayout.createContentView() {
         verticalLayout {
-
+           onThrottleFirstClick {
+               viewModel.setOnItemClick(autoid = data.value?.autoid ?: "")
+           }
             linearLayout {
                 gravity = Gravity.CENTER_VERTICAL
                 textView {
@@ -38,6 +52,11 @@ class PerformanceTemplateViewHolder(private val activity : AppCompatActivity,pri
                 }
                 emptyView()
                 textView {
+                    if (type == "1"){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         text = it?.createtime
                     }
@@ -49,14 +68,16 @@ class PerformanceTemplateViewHolder(private val activity : AppCompatActivity,pri
             }.lparams(matchParent, autoSize(100))
 
             horizontalScrollView {
+
                 isHorizontalScrollBarEnabled = false
 
-                linearLayout {
-                    data.bindOptional(context){
-                        it?.lstStep?.forEach { data ->
-                            RulesItem(name = data.stepinfo ?: "",value = data.stepdate ?: "")
-                        }
-                    }
+                recyclerView {
+                    background = resources.getDrawable(R.color.white)
+                    adapter = performanceItemTemplateAdapter
+                    layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
+                }
+                data.bindOptional(context){
+                    performanceItemTemplateAdapter.setNewData(it?.lstStep)
                 }
 
             }.lparams(matchParent, autoSize(175))
@@ -79,6 +100,11 @@ class PerformanceTemplateViewHolder(private val activity : AppCompatActivity,pri
 
                 textView {
                     onThrottleFirstClick {
+                       val intent = Intent()
+                        intent.putExtra("type","2")
+                        intent.setClass(context,AddPerformanceTempateActivity::class.java)
+                        intent.putExtra("data",data.value)
+                        ActivityUtils.startActivity(intent)
 
                     }
                     backgroundResource = R.drawable.rma_item_click_bg
@@ -92,7 +118,21 @@ class PerformanceTemplateViewHolder(private val activity : AppCompatActivity,pri
 
                 textView {
                     onThrottleFirstClick {
-
+                        activity.createWarningDialog {
+                            setTitle("温馨提示")
+                            setMessage("确定删除此履约模版吗?")
+                            addAction("取消") { dialog, _ ->
+                                dialog.dismiss()
+                            }
+                            addAction("确定") { dialog, _ ->
+                                viewModel.delPerformancePlanTemplateReq(
+                                     autoid = data.value?.autoid?.toLong() ?: 0
+                                ){
+                                    viewModel.queryPermancePlanTmp()
+                                }
+                                dialog.dismiss()
+                            }
+                        }.show()
                     }
                     backgroundResource = R.drawable.rma_item_click_bg
                     gravity = Gravity.CENTER

+ 224 - 5
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/PerformanceTemplateViewModel.kt

@@ -5,8 +5,16 @@ import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.PermancePlanTmpData
 import cn.muchinfo.rma.global.data.WrGoodsPerformanceStepData
 import cn.muchinfo.rma.global.data.WrPerformanceStepTypeData
+import cn.muchinfo.rma.global.data.WrUserFriendData
+import cn.muchinfo.rma.netManage.base.InteractiveException
+import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI3
 import cn.muchinfo.rma.view.MyApplication
+import cn.muchinfo.rma.view.autoWidget.remove
+import cn.muchinfo.rma.view.autoWidget.toArrayList
 import cn.muchinfo.rma.view.base.BaseViewModel
+import cn.muchinfo.rma.view.base.home.commodity.viewholder.SpotInfoData
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
 import mtp.polymer.com.autowidget.utils.TaskUiModel
 
 /**
@@ -39,17 +47,228 @@ class PerformanceTemplateViewModel : BaseViewModel(){
     val wrGoodsPerformanceStepCashDataList : MutableLiveData<List<WrGoodsPerformanceStepData>> = MutableLiveData()
 
     /**
+     * 履约模版的item点击事件
+     */
+    fun setOnItemClick(autoid : String){
+        val newFriendDataList = arrayListOf<PermancePlanTmpData>()
+        permancePlanTmpDataList.value?.forEach {
+            if (it.autoid == autoid){
+                if (it.isClick == 1){
+                    newFriendDataList.add(it.copy(isClick = 0))
+                }else{
+                    newFriendDataList.add(it.copy(isClick = 1))
+                }
+            }else{
+                newFriendDataList.add(it.copy(isClick = 0))
+            }
+        }
+        permancePlanTmpDataList.postValue(newFriendDataList)
+    }
+
+    /**
+     * 删除模板信息操作请求
+     * @param autoid Long
+     */
+    fun delPerformancePlanTemplateReq(
+        autoid: Long,
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.performanceManager?.delPerformancePlanTemplateReq(
+                autoid = autoid
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+    /**
+     * 新增修改履约模版
+     * @param autoid Long
+     * @param templatename String
+     * @param performancesteps List<EPerformanceStepTemplateInfo>
+     * @param userid Long
+     * @param isSuccess Function1<[@kotlin.ParameterName] Boolean, Unit>
+     */
+    fun performancePlanTemplateReq(
+        autoid : Long = 0,//履约计划模板主键不为0且不为空修改否则新增
+        templatename : String = "",//模板名称
+        performancesteps : List<ManageServiceMI3.EPerformanceStepTemplateInfo>,
+        userid : Long = 0,//所属用户
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.performanceManager?.performancePlanTemplateReq(
+                autoid = autoid,
+                templatename = templatename,
+                takemode = 1,
+                type = 2,
+                performancesteps = performancesteps,
+                userid = userid,
+                paymenttype = 2
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+    /**
+     * 组装可供选择的履约步骤
+     */
+    fun getSelectPerformanceDataList() : List<WrPerformanceStepTypeData>{
+        val data = wrGoodsPerformanceStepCashDataList.value?.find { it.steptypeid == "1" }
+        val cashDataList = wrPerformanceStepTypeDataList.value
+        val newDataList = arrayListOf<WrPerformanceStepTypeData>()
+        if (data?.steptypeid.isNullOrEmpty()){
+            cashDataList?.forEach {
+                if (it.steptypeid != "2"){
+                    newDataList.add(it)
+                }
+            }
+        }else{
+            cashDataList?.forEach {
+                    newDataList.add(it)
+            }
+        }
+        return newDataList
+    }
+
+    /**
      * 对履约模版添加修改时每部操作后进行数据的更新
-     * operationType 1 修改相应资料 2 新增item
+     * operationType 1为添加,2为删除 ,3为更换资料
      * dataIndex item变更的索引
      * steptypename 步骤名
      * stepValue 步骤值
      * stepdays 距离上一步天数
      */
-    fun setPerformanceStepDataList(operationType : String,dataIndex : Int,steptypename : String = "",stepValue : String = "",stepdays : String = ""){
-//        if (operationType == "1"){
-//            val showDataList =
-//        }
+    fun setPerformanceStepDataList(operationType : String,stepindex : String,steptypename : String = "",stepValue : String = "",stepdays : String = "",steptypeid : String = ""){
+        val oldDataCacheList = wrGoodsPerformanceStepCashDataList.value?.toArrayList()
+        val oldDataList = wrGoodsPerformanceStepDataList.value?.toArrayList()
+        val newDataList = arrayListOf<WrGoodsPerformanceStepData>()
+        if (operationType == "1") {//增加一个套保品种
+            oldDataCacheList?.forEach {
+                newDataList.add(it)
+            }
+            newDataList.add(WrGoodsPerformanceStepData(stepindex = stepindex))
+            wrGoodsPerformanceStepDataList.postValue(newDataList)
+            wrGoodsPerformanceStepCashDataList.postValue(newDataList)
+        } else if (operationType == "2") {//删除相应的套保品种
+            oldDataCacheList?.forEach {
+                if (stepindex != it.stepindex) {
+                    newDataList.add(it.copy(stepindex = oldDataCacheList.indexOf(it).toString()))
+                }
+            }
+            wrGoodsPerformanceStepDataList.postValue(newDataList)
+            wrGoodsPerformanceStepCashDataList.postValue(newDataList)
+        } else if (operationType == "3") {//更换资料
+            oldDataCacheList?.forEach {
+                var newSteptypename = ""
+                var newStepValue = ""
+                var newStepdays = ""
+                var newSteptypeid = ""
+                var newData: WrGoodsPerformanceStepData
+                if (it.stepindex == stepindex) {
+                    newSteptypename = if (steptypename.isNullOrEmpty()) {
+                        it.steptypename ?: ""
+                    } else {
+                        steptypename
+                    }
+                    newStepValue = if (stepValue.isNullOrEmpty()) {
+                        it.stepvalue ?: ""
+                    } else {
+                        stepValue
+                    }
+                    newStepdays = if (stepdays.isNullOrEmpty()) {
+                        it.stepdays ?: ""
+                    } else {
+                        stepdays
+                    }
+                    newSteptypeid = if (steptypeid.isNullOrEmpty()) {
+                        it.steptypeid ?: ""
+                    } else {
+                        steptypeid
+                    }
+                    newData = it.copy(
+                        stepindex = stepindex,
+                        steptypename = newSteptypename,
+                        stepvalue = newStepValue,
+                        stepdays = newStepdays,
+                        steptypeid = newSteptypeid
+                    )
+                    newDataList.add(newData)
+                } else {
+                    newDataList.add(it)
+                }
+            }
+            wrGoodsPerformanceStepCashDataList.postValue(newDataList)
+        } else if (operationType == "4") {//用于选择套保品种
+            oldDataList?.forEach {
+                var newSteptypename = ""
+                var newStepValue = ""
+                var newStepdays = ""
+                var newSteptypeid = ""
+                var newData: WrGoodsPerformanceStepData
+                if (it.stepindex == stepindex) {
+                    newSteptypename = if (steptypename.isNullOrEmpty()) {
+                        it.steptypename ?: ""
+                    } else {
+                        steptypename
+                    }
+                    newStepValue = if (stepValue.isNullOrEmpty()) {
+                        it.stepvalue ?: ""
+                    } else {
+                        stepValue
+                    }
+                    newStepdays = if (stepdays.isNullOrEmpty()) {
+                        it.stepdays ?: ""
+                    } else {
+                        stepdays
+                    }
+                    newSteptypeid = if (steptypeid.isNullOrEmpty()) {
+                        it.steptypeid ?: ""
+                    } else {
+                        steptypeid
+                    }
+                    newData = it.copy(
+                        stepindex = stepindex,
+                        steptypename = newSteptypename,
+                        stepvalue = newStepValue,
+                        stepdays = newStepdays,
+                        steptypeid = newSteptypeid
+                    )
+                    newDataList.add(newData)
+                } else {
+                    newDataList.add(it)
+                }
+            }
+            wrGoodsPerformanceStepDataList.postValue(newDataList)
+            wrGoodsPerformanceStepCashDataList.postValue(newDataList)
+        }
+
     }
 
     /**

+ 87 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/performancetemplate/SelectPerformanceTemplateActivity.kt

@@ -0,0 +1,87 @@
+package cn.muchinfo.rma.view.base.hnstmain.performancetemplate
+
+import android.content.Intent
+import android.os.Bundle
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.PermancePlanTmpData
+import cn.muchinfo.rma.global.data.WrUserFriendData
+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.hnstmain.friend.FriendViewHolder
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.verticalLayout
+
+class SelectPerformanceTemplateActivity : BaseActivity<PerformanceTemplateViewModel>(){
+
+    // 下拉刷新
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    private val performanceTemplateAdapter: BaseAdapter<PermancePlanTmpData, PerformanceTemplateViewHolder> =
+        BaseAdapter { _, _ ->
+            PerformanceTemplateViewHolder(
+                this,
+                viewModel,
+                "2"
+            )
+        }
+
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        viewModel.queryPermancePlanTmp()
+        verticalLayout {
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "选择履约模版"
+                }
+            }
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+                setRetryAction {
+
+                }
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(false)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+                    // 未提交列表
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = performanceTemplateAdapter
+                    }.lparams(matchParent, matchParent)
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.permancePlanTmpDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    performanceTemplateAdapter.setNewData(it)
+                }
+            }
+            performanceTemplateAdapter.setOnItemClickListener { adapter, view, position ->
+                val intent = Intent()
+                intent.putExtra("data",viewModel.permancePlanTmpDataList.value?.get(position))
+                setResult(1005, intent)
+                finish()
+            }
+        }
+    }
+
+}

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

@@ -28,6 +28,7 @@ import cn.muchinfo.rma.global.data.WrOrderDetailData;
 import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
 import cn.muchinfo.rma.view.base.hnstmain.spotwarehouse.SpotWareHouseViewModel;
 import cn.muchinfo.rma.view.base.hnstmain.spotwarehouse.arecancelled.AreCancelledActivity;
+import cn.muchinfo.rma.view.base.hnstmain.spotwarehouse.bargain.BargainActivity;
 import cn.muchinfo.rma.view.base.procurement.RightScrollAdapter;
 
 /**
@@ -126,6 +127,15 @@ public class AreCancelContentAdapter extends RecyclerView.Adapter<AreCancelConte
             itemViewHolder.invoice_register.setVisibility(View.GONE);
         }
 
+        itemViewHolder.bargain.setVisibility(View.VISIBLE);
+
+        itemViewHolder.bargain.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("data",data);
+            intent.setClass(context, BargainActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+
         //详情
         itemViewHolder.details.setOnClickListener(view -> {
             Intent intent = new Intent();
@@ -181,6 +191,7 @@ public class AreCancelContentAdapter extends RecyclerView.Adapter<AreCancelConte
         TextView midpoints_registration;
         TextView settlement_of_registration;
         TextView payment_registration;
+        TextView bargain;//议价单
         TextView warehouse_register;//挂牌
         TextView fanacel_register;//提货
         ImageView load_more;//更多
@@ -203,6 +214,7 @@ public class AreCancelContentAdapter extends RecyclerView.Adapter<AreCancelConte
         public ItemViewHolder(@NonNull View itemView) {
             super(itemView);
             details = itemView.findViewById(R.id.details);
+            bargain = itemView.findViewById(R.id.bargain);
             midpoints_registration = itemView.findViewById(R.id.midpoints_registration);
             settlement_of_registration = itemView.findViewById(R.id.settlement_of_registration);
             payment_registration = itemView.findViewById(R.id.payment_registration);

+ 5 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/bargain/BargainActivity.kt

@@ -1,6 +1,7 @@
 package cn.muchinfo.rma.view.base.hnstmain.spotwarehouse.bargain
 
 import android.os.Bundle
+import cn.muchinfo.rma.global.data.WrOrderDetailData
 import cn.muchinfo.rma.view.autoWidget.commonLeftButton
 import cn.muchinfo.rma.view.autoWidget.commonTitle
 import cn.muchinfo.rma.view.autoWidget.topBar
@@ -12,6 +13,10 @@ import org.jetbrains.anko.verticalLayout
  */
 class BargainActivity : BaseActivity<BargainViewModel>(){
 
+
+    //传入的挂单数据
+    val data by lazy { intent.getParcelableExtra<WrOrderDetailData>("data") as WrOrderDetailData }
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {

+ 11 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/bargain/BargainViewModel.kt

@@ -1,5 +1,8 @@
 package cn.muchinfo.rma.view.base.hnstmain.spotwarehouse.bargain
 
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.global.data.ColumnsData
+import cn.muchinfo.rma.global.data.WrTradeBargainApplyData
 import cn.muchinfo.rma.view.base.BaseViewModel
 
 /**
@@ -7,6 +10,14 @@ import cn.muchinfo.rma.view.base.BaseViewModel
  */
 class BargainViewModel : BaseViewModel(){
 
+    /**
+     * 议价单头部数据
+     */
+    val wrTradeBargainApplyTitleList : MutableLiveData<List<ColumnsData>> = MutableLiveData()
 
+    /**
+     * 议价单数据
+     */
+    val wrTradeBargainApplyDataList : MutableLiveData<List<WrTradeBargainApplyData>> = MutableLiveData()
 
 }

+ 38 - 35
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/spotwarehouse/listed/ListedActivity.kt

@@ -694,6 +694,44 @@ class ListedActivity : BaseActivity<ListedViewModel>() {
 
                         }.lparams(matchParent, autoSize(167))
 
+                        itemView()
+
+                        linearLayout {
+                            if (type == "2") {
+                                visibility = View.VISIBLE
+                            } else {
+                                visibility = View.GONE
+                            }
+                            onThrottleFirstClick {
+                                showDataSelectDialog(type = "2") {
+                                    month_text.text = this
+                                }
+                            }
+                            gravity = Gravity.CENTER_VERTICAL
+                            textView {
+                                text = "交收月"
+                                textSizeAuto = 34
+                                textColorInt = R.color.rma_hint_text_color_ccc
+                            }.lparams(autoSize(214), wrapContent) {
+                                marginStart = autoSize(36)
+                            }
+
+                            textView {
+                                text = TimeUtils.getNowTime("yyyy-MM")
+                                month_text = this
+                                textSizeAuto = 34
+                                textColorInt = R.color.rma_black_33
+                            }.lparams(wrapContent, wrapContent)
+
+                            emptyView()
+
+                            imageView {
+                                imageResource = R.mipmap.rma_search_by_time
+                            }.lparams(autoSize(38), autoSize(38)) {
+                                marginEnd = autoSize(36)
+                            }
+                        }.lparams(matchParent, autoSize(143))
+
 
                         itemView()
 
@@ -763,41 +801,6 @@ class ListedActivity : BaseActivity<ListedViewModel>() {
                             marginStart = autoSize(250)
                         }
 
-                        linearLayout {
-                            if (type == "2") {
-                                visibility = View.VISIBLE
-                            } else {
-                                visibility = View.GONE
-                            }
-                            onThrottleFirstClick {
-                                showDataSelectDialog(type = "2") {
-                                    month_text.text = this
-                                }
-                            }
-                            gravity = Gravity.CENTER_VERTICAL
-                            textView {
-                                text = "交收月"
-                                textSizeAuto = 34
-                                textColorInt = R.color.rma_hint_text_color_ccc
-                            }.lparams(autoSize(214), wrapContent) {
-                                marginStart = autoSize(36)
-                            }
-
-                            textView {
-                                text = TimeUtils.getNowTime("yyyy-MM")
-                                month_text = this
-                                textSizeAuto = 34
-                                textColorInt = R.color.rma_black_33
-                            }.lparams(wrapContent, wrapContent)
-
-                            emptyView()
-
-                            imageView {
-                                imageResource = R.mipmap.rma_search_by_time
-                            }.lparams(autoSize(38), autoSize(38)) {
-                                marginEnd = autoSize(36)
-                            }
-                        }.lparams(matchParent, autoSize(143))
 
                         view {
 

+ 13 - 0
RMA/app/src/main/res/layout/spot_warehouse_layout_item_content.xml

@@ -75,6 +75,19 @@
         android:layout_height="40dp"
         android:gravity="end|center_vertical"
         android:orientation="horizontal">
+
+        <TextView
+            android:visibility="gone"
+            android:id="@+id/bargain"
+            android:layout_marginEnd="10dp"
+            android:gravity="center"
+            android:textSize="12sp"
+            android:layout_width="90dp"
+            android:layout_height="25dp"
+            android:text="议价单"
+            android:textColor="@color/rma_blue_color"
+            android:background="@drawable/rma_item_click_bg"/>
+
         <TextView
             android:visibility="gone"
             android:id="@+id/midpoints_registration"