Sfoglia il codice sorgente

风险管理4月10日提交代码-liu.bolan-二期仓库出库入库功能

Liu.bolan 4 anni fa
parent
commit
fe3a7bd2a9

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

@@ -29,7 +29,8 @@ data class AreaStockReportData(
     val warehousetype : String? = "",//仓库类型 - 1 厂库 2 自有库 3 合作库
     val wrstandardcode : String? = "",//现货商品代码
     val wrstandardid : String? = "",//现货商品ID
-    val wrstandardname : String? = ""//现货商品名称
+    val wrstandardname : String? = "",//现货商品名称
+    var rightData : List<String>? = arrayListOf()//组装的右侧数据
 ) : Parcelable{
     constructor(parcel: Parcel) : this(
         parcel.readString(),
@@ -54,7 +55,8 @@ data class AreaStockReportData(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
-        parcel.readString()
+        parcel.readString(),
+        parcel.createStringArrayList()
     ) {
     }
 
@@ -82,6 +84,7 @@ data class AreaStockReportData(
         parcel.writeString(wrstandardcode)
         parcel.writeString(wrstandardid)
         parcel.writeString(wrstandardname)
+        parcel.writeStringList(rightData)
     }
 
     override fun describeContents(): Int {

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

@@ -75,5 +75,6 @@ data class FinancialReportData(
     val paymoneyamount : String? = "",//今日付款金额
     val payinvoicecount : String? = "",//今日收票笔数
     val payinvoiceamount : String? = "",//今日收票金额
+    val updatetime : String? = "",
     val dayFr : List<FinancialReportData>? = arrayListOf()//日报表明细
 )

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

@@ -211,7 +211,7 @@ fun AppCompatActivity.showDataSelectDialog(
             if (type == "1") {
                 selectTime?.invoke("$year-${monthOfYear.monthformatting()}-$dayOfMonth")//月份要加1
             } else {
-                selectTime?.invoke("$year-${monthOfYear.plus(1)}")//月份要加1
+                selectTime?.invoke("$year-${monthOfYear.monthformatting()}")//月份要加1
             }
         },
         calendar.get(Calendar.YEAR),

+ 7 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventorymanager/InventoryDetailsActivity.kt

@@ -8,6 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.data.AreaStockData
+import cn.muchinfo.rma.global.data.AreaStockReportData
 import cn.muchinfo.rma.global.data.AreaStockReportDetailData
 import cn.muchinfo.rma.global.isBlankString
 import cn.muchinfo.rma.lifecycle.bindOptional
@@ -41,7 +42,11 @@ class InventoryDetailsActivity : BaseActivity<InventoryManagerViewModel>(),
      */
     private val isFrom by lazy { intent.getStringExtra("isFrom") }
 
-    private val data by lazy { intent.getParcelableExtra<AreaStockData>("data") as AreaStockData }
+    /**
+     * 现货名称
+     */
+    private val wrstandardname by lazy { intent.getStringExtra("wrstandardname")}
+
 
     //列头
     private val title by lazy { intent.getStringExtra("title") }
@@ -132,7 +137,7 @@ class InventoryDetailsActivity : BaseActivity<InventoryManagerViewModel>(),
                 gravity = Gravity.CENTER_VERTICAL
                 background = resources.getDrawable(R.color.rma_blue_color)
                 textView {
-                    text = "现货品种:" + data.wrstandardname?.isBlankString()
+                    text = "现货品种:" + wrstandardname?.isBlankString()
                     textSizeAuto = 31
                     textColorInt = R.color.white
                 }.lparams(wrapContent, wrapContent) {

+ 9 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventorymanager/InventoryManagerViewModel.kt

@@ -5,6 +5,7 @@ import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.global.inouttype
 import cn.muchinfo.rma.global.inventoryapplystatus
+import cn.muchinfo.rma.global.isShowTimeString
 import cn.muchinfo.rma.netManage.base.InteractiveException
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.autoWidget.toArrayList
@@ -70,7 +71,7 @@ class InventoryManagerViewModel : BaseViewModel() {
     val normalWarehouseInfo: MutableLiveData<List<WarehouseInfoData>> = MutableLiveData()
 
     /**
-     * 查询实时敞口列表头部数据 type 1 当前库存 2 申请记录
+     * 查询列表头部数据 type 1 当前库存 2 申请记录
      * @param tableKey String
      */
     fun queryTitle(title: String, type: String) {
@@ -133,7 +134,13 @@ class InventoryManagerViewModel : BaseViewModel() {
                 if (isFrom == "1"){
                     queryAreaStockApply(detailtype)
                 }else{
-                    queryAreaStockReportDetail(querytype = querytype,detailtype = detailtype,querydate = querydate,wrstandardid = wrstandardid,spotgoodsbrandid = spotgoodsbrandid,spotgoodsmodelid = spotgoodsmodelid,warehouseinfoid = warehouseinfoid)
+                    var queryData = ""
+                    if (querytype == "1"){
+                        queryData = querydate.isShowTimeString("yyyyMMdd")
+                    }else{
+                        queryData = querydate.isShowTimeString("yyyyMM")
+                    }
+                    queryAreaStockReportDetail(querytype = querytype,detailtype = detailtype,querydate = queryData,wrstandardid = wrstandardid,spotgoodsbrandid = spotgoodsbrandid,spotgoodsmodelid = spotgoodsmodelid,warehouseinfoid = warehouseinfoid)
                 }
             }
         }

+ 3 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventorymanager/adapter/InventoryCurrentAdapter.java

@@ -122,8 +122,8 @@ public class InventoryCurrentAdapter extends RecyclerView.Adapter<InventoryCurre
         itemViewHolder.futures_subsidiary.setOnClickListener(view -> {
             Intent intent = new Intent();
             intent.putExtra("isFrom","1");//从仓库管理页面进入
-            intent.putExtra("detailtype","1");//库明细
-            intent.putExtra("data",datas.get(i));
+            intent.putExtra("detailtype","1");//库明细
+            intent.putExtra("wrstandardname",datas.get(i).getWrstandardname());
             intent.putExtra("title", Constant.table_mobile_stock_report_in_detail);//出库明细的列头
             intent.putExtra("querytype","");//日报表/月报表  这里不需要传入值
             intent.putExtra("querydate","");//查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM) 此处不需要传
@@ -139,7 +139,7 @@ public class InventoryCurrentAdapter extends RecyclerView.Adapter<InventoryCurre
             Intent intent = new Intent();
             intent.putExtra("isFrom","1");//从仓库管理页面进入
             intent.putExtra("detailtype","2");//出库明细
-            intent.putExtra("data",datas.get(i));
+            intent.putExtra("wrstandardname",datas.get(i).getWrstandardname());
             intent.putExtra("title", Constant.table_mobile_stock_report_out_detail);//出库明细的列头
             intent.putExtra("querytype","");//日报表/月报表  这里不需要传入值
             intent.putExtra("querydate","");//查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM) 此处不需要传

+ 39 - 9
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/FinancialMonthViewholder.kt

@@ -4,6 +4,7 @@ import android.view.Gravity
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.data.FinancialReportData
+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
@@ -19,24 +20,33 @@ class FinancialMonthViewholder(
     override fun _FrameLayout.createContentView() {
          linearLayout {
              verticalLayout {
+                 gravity = Gravity.CENTER
                  textView {
-                     text = "日期"
+                     data.bindOptional(context){
+                         text = it?.updatetime
+                     }
                      textSizeAuto = 24
                      textColorInt = R.color.text_hit_color
-                 }.lparams(wrapContent, wrapContent)
+                 }.lparams(wrapContent, wrapContent){
+                     marginStart = autoSize(30)
+                 }
              }.lparams(autoSize(180), autoSize(100))
 
 
              verticalLayout {
                  gravity = Gravity.END
                  textView {
-                     text = "4"
+                     data.bindOptional(context){
+                         text = it?.collectmoneycount
+                     }
                      textSizeAuto = 29
                      textColorInt = R.color.rma_black_33
                  }.lparams(wrapContent, wrapContent)
 
                  textView {
-                     text = "12333"
+                     data.bindOptional(context){
+                         text = it?.collectmoneyamount
+                     }
                      textSizeAuto = 24
                      textColorInt = R.color.text_hit_color
                  }.lparams(wrapContent, wrapContent)
@@ -45,13 +55,17 @@ class FinancialMonthViewholder(
              verticalLayout {
                  gravity = Gravity.END
                  textView {
-                     text = "2"
+                     data.bindOptional(context){
+                         text = it?.paymoneycount
+                     }
                      textSizeAuto = 29
                      textColorInt = R.color.rma_black_33
                  }.lparams(wrapContent, wrapContent)
 
                  textView {
-                     text = "12121"
+                     data.bindOptional(context){
+                         text = it?.paymoneyamount
+                     }
                      textSizeAuto = 24
                      textColorInt = R.color.text_hit_color
                  }.lparams(wrapContent, wrapContent)
@@ -60,12 +74,18 @@ class FinancialMonthViewholder(
              verticalLayout {
                  gravity = Gravity.END
                  textView {
-                     text = "5"
+                     data.bindOptional(context){
+                         text = it?.collectmoneycount
+                     }
+
                      textSizeAuto = 29
                      textColorInt = R.color.rma_black_33
                  }.lparams(wrapContent, wrapContent)
 
                  textView {
+                     data.bindOptional(context){
+                         text = it?.collectmoneyamount
+                     }
                      text = "423144"
                      textSizeAuto = 24
                      textColorInt = R.color.text_hit_color
@@ -75,16 +95,26 @@ class FinancialMonthViewholder(
              verticalLayout {
                  gravity = Gravity.END
                  textView {
+                     data.bindOptional(context){
+                         text = it?.collectinvoicecount
+                     }
                      text = "6"
                      textSizeAuto = 29
                      textColorInt = R.color.rma_black_33
-                 }.lparams(wrapContent, wrapContent)
+                 }.lparams(wrapContent, wrapContent){
+                     marginEnd = autoSize(30)
+                 }
 
                  textView {
+                     data.bindOptional(context){
+                         text = it?.collectinvoiceamount
+                     }
                      text = "123132"
                      textSizeAuto = 24
                      textColorInt = R.color.text_hit_color
-                 }.lparams(wrapContent, wrapContent)
+                 }.lparams(wrapContent, wrapContent){
+                     marginEnd = autoSize(30)
+                 }
              }.lparams(autoSize(180), autoSize(100))
          }.lparams(matchParent, autoSize(100))
     }

+ 230 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/InventoryRecordAdapter.java

@@ -0,0 +1,230 @@
+package cn.muchinfo.rma.view.base.home.reportquery;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.Intent;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+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;
+
+import cn.muchinfo.rma.R;
+import cn.muchinfo.rma.global.ViewEnumUtils;
+import cn.muchinfo.rma.global.data.AreaStockApplyData;
+import cn.muchinfo.rma.global.data.AreaStockReportData;
+import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
+import cn.muchinfo.rma.view.base.app.Constant;
+import cn.muchinfo.rma.view.base.home.inventory.inventorymanager.InventoryDetailsActivity;
+import cn.muchinfo.rma.view.base.procurement.RightScrollAdapter;
+
+/**
+ * 用于库存管理当前库存的列表adapter
+ */
+public class InventoryRecordAdapter extends RecyclerView.Adapter<InventoryRecordAdapter.ItemViewHolder> {
+
+    private Context context;
+    private List<AreaStockReportData> datas;
+    private int index = -1;
+    private int position = -1;
+    private List<ItemViewHolder> mViewHolderList = new ArrayList<>();
+    public int offestX = 0;
+    private OnContentScrollListener onContentScrollListener;
+    private String querytype = "1";
+    private String querydate;
+
+
+    public interface OnContentScrollListener {
+        void onScroll(MotionEvent event);
+    }
+
+    public void setOnContentScrollListener(OnContentScrollListener onContentScrollListener) {
+        this.onContentScrollListener = onContentScrollListener;
+    }
+
+    public InventoryRecordAdapter(Context context) {
+        this.context = context;
+    }
+
+    public void setDatas(List<AreaStockReportData> datas) {
+        this.datas = datas;
+        notifyDataSetChanged();
+    }
+
+    /**
+     * 设置是日报表还是月报表 1是日报表 2是月报表
+     * @param querytype
+     */
+    public void setquerytype(String querytype){
+        this.querytype = querytype;
+    }
+
+    /**
+     * 设置查询的时间
+     * @param querydate
+     */
+    public void setquerydate(String querydate){
+        this.querydate = querydate;
+    }
+
+    private void setPosition(int position){
+        if (this.position == position) {
+            this.position = -1;
+            notifyItemChanged(index);
+        } else {
+            this.position = position;
+            notifyItemChanged(position);
+        }
+    }
+
+    @NonNull
+    @Override
+    public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
+        View view = LayoutInflater.from(context).inflate(R.layout.layout_item_inventory_current, viewGroup, false);
+        return new ItemViewHolder(view);
+    }
+
+    @SuppressLint("SetTextI18n")
+    @Override
+    public void onBindViewHolder(@NonNull final ItemViewHolder itemViewHolder, int i) {
+        this.index = i;
+        if (TextUtils.isEmpty(datas.get(i).getWrstandardname())){
+            itemViewHolder.exposure_tvLeftTitle.setText("--");
+        }else {
+            itemViewHolder.exposure_tvLeftTitle.setText(datas.get(i).getWrstandardname());
+        }
+//        itemViewHolder.exposure_tv_left_bottom_title.setText(ViewEnumUtils.INSTANCE.isShowTimeString(datas.get(i).getAudittime(),"MM/dd HH:mm"));
+        //右边滑动部分
+        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
+        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
+        itemViewHolder.exposure_rvItemRight.setLayoutManager(linearLayoutManager);
+        itemViewHolder.exposure_rvItemRight.setHasFixedSize(true);
+        RightScrollAdapter rightScrollAdapter = new RightScrollAdapter(context);
+        rightScrollAdapter.setDatas(datas.get(i).getRightData());
+        itemViewHolder.exposure_rvItemRight.setAdapter(rightScrollAdapter);
+        //缓存当前holder
+        if (!mViewHolderList.contains(itemViewHolder)) {
+            mViewHolderList.add(itemViewHolder);
+        }
+        if (i == this.position){
+            itemViewHolder.exposure_roots_view.setBackgroundColor(context.getResources().getColor(R.color.rma_list_select_color));
+            itemViewHolder.exposure_allView.setVisibility(View.VISIBLE);
+        }else {
+            itemViewHolder.exposure_roots_view.setBackgroundColor(context.getResources().getColor(R.color.white));
+            itemViewHolder.exposure_allView.setVisibility(View.GONE);
+        }
+
+        itemViewHolder.exposure_all_click_View.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                setPosition(i);
+            }
+        });
+
+        //入库明细
+        itemViewHolder.futures_subsidiary.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("isFrom","2");//从仓库管理页面进入
+            intent.putExtra("detailtype","1");//入库明细
+            intent.putExtra("wrstandardname",datas.get(i).getWrstandardname());
+            intent.putExtra("title", Constant.table_mobile_stock_report_in_detail);//出库明细的列头
+            intent.putExtra("querytype",querytype);//日报表/月报表  这里不需要传入值
+            intent.putExtra("querydate",datas.get(i).getUpdatetime());//查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)
+            intent.putExtra("wrstandardid",datas.get(i).getWrstandardid());//现货商品ID 此处不需要传
+            intent.putExtra("spotgoodsbrandid",datas.get(i).getSpotgoodsbrandid());//通过报表页面进入需要的参数 : 品牌ID 此处不需要传
+            intent.putExtra("spotgoodsmodelid",datas.get(i).getSpotgoodsmodelid());//通过报表页面进入需要的参数 : 型号ID 此处不需要传
+            intent.putExtra("warehouseinfoid",datas.get(i).getWarehouseinfoid());//通过报表页面进入需要的参数 : 仓库ID 此处不需要传
+            intent.setClass(context, InventoryDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        //出库明细
+        itemViewHolder.place_the_order.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("isFrom","2");//从仓库管理页面进入
+            intent.putExtra("detailtype","2");//出库明细
+            intent.putExtra("wrstandardname",datas.get(i).getWrstandardname());
+            intent.putExtra("title", Constant.table_mobile_stock_report_in_detail);//出库明细的列头
+            intent.putExtra("querytype",querytype);//日报表/月报表  这里不需要传入值
+            intent.putExtra("querydate",datas.get(i).getUpdatetime());//查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)
+            intent.putExtra("wrstandardid",datas.get(i).getWrstandardid());//现货商品ID
+            intent.putExtra("spotgoodsbrandid",datas.get(i).getSpotgoodsbrandid());//通过报表页面进入需要的参数 : 品牌ID
+            intent.putExtra("spotgoodsmodelid",datas.get(i).getSpotgoodsmodelid());//通过报表页面进入需要的参数 : 型号ID
+            intent.putExtra("warehouseinfoid",datas.get(i).getWarehouseinfoid());//通过报表页面进入需要的参数 : 仓库ID
+            intent.setClass(context, InventoryDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+
+        itemViewHolder.exposure_horItemScrollview.setEventListener(event -> {
+            if (null != onContentScrollListener) onContentScrollListener.onScroll(event);
+        });
+        //由于viewHolder的缓存,在1级缓存取出来是2个viewholder,并且不会被重新赋值,所以这里需要处理缓存的viewholder的位移
+        itemViewHolder.exposure_horItemScrollview.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+            @Override
+            public void onGlobalLayout() {
+                if (!itemViewHolder.isLayoutFinish()) {
+                    itemViewHolder.exposure_horItemScrollview.scrollTo(offestX, 0);
+                    itemViewHolder.setLayoutFinish(true);
+                }
+            }
+        });
+    }
+
+    @Override
+    public int getItemCount() {
+        return null == datas ? 0 : datas.size();
+    }
+
+    public List<ItemViewHolder> getViewHolderCacheList() {
+        return mViewHolderList;
+    }
+
+    public int getOffestX() {
+        return offestX;
+    }
+
+    public static class ItemViewHolder extends RecyclerView.ViewHolder {
+        LinearLayout exposure_roots_view;//根部布局
+        TextView futures_subsidiary;//
+        TextView place_the_order;//
+        LinearLayout exposure_allView;//隐藏的底部操作空间
+        LinearLayout exposure_all_click_View;//item左侧点击控件
+        TextView exposure_tvLeftTitle;//左边
+        TextView exposure_tv_left_bottom_title;//合同编号
+        RecyclerView exposure_rvItemRight;//右方的列表
+        public CustomHorizontalScrollView exposure_horItemScrollview;//右方的滑动控件
+        private boolean isLayoutFinish;//自定义字段,用于标记layout
+
+        public boolean isLayoutFinish() {
+            return isLayoutFinish;
+        }
+
+        public void setLayoutFinish(boolean layoutFinish) {
+            isLayoutFinish = layoutFinish;
+        }
+
+        public ItemViewHolder(@NonNull View itemView) {
+            super(itemView);
+            futures_subsidiary = itemView.findViewById(R.id.futures_subsidiary);
+            place_the_order = itemView.findViewById(R.id.place_the_order);
+            exposure_tvLeftTitle = itemView.findViewById(R.id.exposure_tv_left_title);
+            exposure_rvItemRight = itemView.findViewById(R.id.exposure_rv_item_right);
+            exposure_horItemScrollview = itemView.findViewById(R.id.exposure_hor_item_scrollview);
+            exposure_allView = itemView.findViewById(R.id.exposure_all_view);
+            exposure_tv_left_bottom_title = itemView.findViewById(R.id.exposure_tv_left_bottom_title);
+            exposure_all_click_View = itemView.findViewById(R.id.exposure_all_click_View);
+            exposure_roots_view = itemView.findViewById(R.id.exposure_roots_view);
+        }
+    }
+}

+ 451 - 111
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/ReportQueryActivity.kt

@@ -11,15 +11,13 @@ import android.view.ViewGroup
 import android.widget.TextView
 import androidx.annotation.RequiresApi
 import androidx.appcompat.app.AppCompatActivity
+import androidx.lifecycle.MutableLiveData
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 import androidx.viewpager.widget.PagerAdapter
 import androidx.viewpager.widget.ViewPager
 import cn.muchinfo.rma.R
-import cn.muchinfo.rma.global.data.ExposureReportData
-import cn.muchinfo.rma.global.data.FinancialManageData
-import cn.muchinfo.rma.global.data.FinancialReportData
-import cn.muchinfo.rma.global.data.SpotReportData
+import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.global.isBlankString
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
@@ -29,6 +27,7 @@ import cn.muchinfo.rma.view.base.exposure.ExposureContentAdapter
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.home.financial.FinancialViewholder
 import cn.muchinfo.rma.view.base.home.financial.InvoiceRegisterActivity
+import cn.muchinfo.rma.view.base.home.inventory.inventorymanager.adapter.ApplyRecordAdapter
 import cn.muchinfo.rma.view.base.procurement.ContentAdapter
 import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
 import com.blankj.utilcode.util.*
@@ -36,7 +35,11 @@ import com.qmuiteam.qmui.util.QMUIDisplayHelper
 import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
 import com.qmuiteam.qmui.widget.tab.QMUITabSegment
 import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import mtp.polymer.com.autowidget.dialog.SelectData
+import mtp.polymer.com.autowidget.dialog.creatBottomSheetDialog
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
 import mtp.polymer.com.autowidget.dialog.showDataSelectDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
 import org.jetbrains.anko.*
 import org.jetbrains.anko.support.v4.viewPager
 import java.text.SimpleDateFormat
@@ -52,7 +55,7 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
 
     /** tab标题 **/
     private val tabsArray: List<String> by lazy {
-        arrayListOf("财务报表", "敞口报表", "现货报表","库存报表")
+        arrayListOf("财务报表", "敞口报表", "现货报表", "库存报表")
     }
 
     /** 财务报表 **/
@@ -65,7 +68,7 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
     private val spotReportUI by lazy { SpotReportUI(this, viewModel) }
 
     /** 库存报表 ***/
-    private val invertoryReportUI by lazy { InvertoryReportUI(this,viewModel) }
+    private val invertoryReportUI by lazy { InvertoryReportUI(this, viewModel) }
 
     private val pagerAdapter: PagerAdapter by lazy {
         object : PagerAdapter() {
@@ -121,9 +124,14 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
         }
     }
 
+
+    private val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
+
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            dialog.bindTaskStatus(context, viewModel.loadingDialogStatus)
             topBar {
                 commonLeftButton()
                 commonTitle {
@@ -200,7 +208,10 @@ class FinancialReportUI(
     /**
      * 查询所用的date 注意(页面显示时间规则yyyy-MM-dd,而接口请求规则yyyyMMdd,简直无fuck可说)
      */
-    var tradedate: String = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400000),SimpleDateFormat("yyyy-MM-dd"))
+    var tradedate: String = TimeUtils.millis2String(
+        TimeUtils.getNowMills().minus(86400000),
+        SimpleDateFormat("yyyy-MM-dd")
+    )
 
     /** 查询时间textview **/
     lateinit var tradedatetextview: TextView
@@ -262,24 +273,24 @@ class FinancialReportUI(
     @RequiresApi(Build.VERSION_CODES.N)
     val root = _FrameLayout(activity).apply {
         verticalLayout {
-            viewModel.qryReportDayFinance(tradedate = tradedate.replace("-",""))
+            viewModel.qryReportDayFinance(tradedate = tradedate.replace("-", ""))
             linearLayout {
                 gravity = Gravity.CENTER_VERTICAL
                 linearLayout {
                     onThrottleFirstClick {
-                        if (viewModel.isselectFinancialMonthOrDay.value == "1"){
+                        if (viewModel.isselectFinancialMonthOrDay.value == "1") {
                             viewModel.isselectFinancialMonthOrDay.postValue("2")
-                        }else{
+                        } else {
                             viewModel.isselectFinancialMonthOrDay.postValue("1")
                         }
                     }
                     backgroundResource = R.drawable.rma_time_click_bg
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
-                        viewModel.isselectFinancialMonthOrDay.bindOptional(context){
-                            if (it == "1"){
+                        viewModel.isselectFinancialMonthOrDay.bindOptional(context) {
+                            if (it == "1") {
                                 text = "日报表"
-                            }else if (it == "2"){
+                            } else if (it == "2") {
                                 text = "月报表"
                             }
                         }
@@ -311,7 +322,10 @@ class FinancialReportUI(
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
                         tradedatetextview = this
-                        text = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400000),SimpleDateFormat("yyyy-MM-dd"))
+                        text = TimeUtils.millis2String(
+                            TimeUtils.getNowMills().minus(86400000),
+                            SimpleDateFormat("yyyy-MM-dd")
+                        )
                         textColorInt = R.color.rma_hint_text_color_ccc
                         textSizeAuto = 31
                     }.lparams(wrapContent, wrapContent) {
@@ -329,13 +343,13 @@ class FinancialReportUI(
 
                 textView {
                     onThrottleFirstClick {
-                        if (viewModel.isselectFinancialMonthOrDay.value == "1"){//日报表数据请求
-                            viewModel.qryReportDayFinance(tradedate = tradedate.replace("-",""))
+                        if (viewModel.isselectFinancialMonthOrDay.value == "1") {//日报表数据请求
+                            viewModel.qryReportDayFinance(tradedate = tradedate.replace("-", ""))
 //                            viewModel.qryReportDayFinance(tradedate = "20210310")
                             financialPaymentUI.queryRefrashByTime(tradeDate = tradedate)
                             financialInvoiceUI.queryRefrashByTime(tradeDate = tradedate)
-                        }else{//月报表数据请求
-                            viewModel.qryReportMonthFinance(cycletime = tradedate)
+                        } else {//月报表数据请求
+                            viewModel.qryReportMonthFinance(cycletime = tradedate.replace("-", ""))
                         }
                     }
                     gravity = Gravity.CENTER
@@ -418,9 +432,9 @@ class FinancialReportUI(
                         gravity = Gravity.START
                         textView {
                             viewModel.financialReportTitleData.bindOptional(context) {
-                                if (it?.collectmoneycount.isNullOrEmpty()){
+                                if (it?.collectmoneycount.isNullOrEmpty()) {
                                     text = "--"
-                                }else{
+                                } else {
                                     text = it?.collectmoneycount?.isBlankString() + "笔"
                                 }
 
@@ -437,9 +451,9 @@ class FinancialReportUI(
                         gravity = Gravity.START
                         textView {
                             viewModel.financialReportTitleData.bindOptional(context) {
-                                if (it?.paymoneycount.isNullOrEmpty()){
+                                if (it?.paymoneycount.isNullOrEmpty()) {
                                     text = "--"
-                                }else{
+                                } else {
                                     text = it?.paymoneycount?.isBlankString() + "笔"
                                 }
 
@@ -457,9 +471,9 @@ class FinancialReportUI(
                         gravity = Gravity.START
                         textView {
                             viewModel.financialReportTitleData.bindOptional(context) {
-                                if (it?.collectinvoicecount.isNullOrEmpty()){
+                                if (it?.collectinvoicecount.isNullOrEmpty()) {
                                     text = "--"
-                                }else{
+                                } else {
                                     text = it?.collectinvoicecount?.isBlankString() + "笔"
                                 }
 
@@ -476,9 +490,9 @@ class FinancialReportUI(
                         gravity = Gravity.START
                         textView {
                             viewModel.financialReportTitleData.bindOptional(context) {
-                                if (it?.payinvoicecount.isNullOrEmpty()){
+                                if (it?.payinvoicecount.isNullOrEmpty()) {
                                     text = "--"
-                                }else{
+                                } else {
                                     text = it?.payinvoicecount?.isBlankString() + "笔"
                                 }
 
@@ -557,10 +571,10 @@ class FinancialReportUI(
             }
             /** 在选择日报表时显示此页面 **/
             verticalLayout {
-                viewModel.isselectFinancialMonthOrDay.bindOptional(context){
-                    visibility = if (it == "1"){
+                viewModel.isselectFinancialMonthOrDay.bindOptional(context) {
+                    visibility = if (it == "1") {
                         View.VISIBLE
-                    }else{
+                    } else {
                         View.GONE
                     }
                 }
@@ -599,10 +613,10 @@ class FinancialReportUI(
 
             /** 在选择月报表时显示此页面 **/
             verticalLayout {
-                viewModel.isselectFinancialMonthOrDay.bindOptional(context){
-                    visibility = if (it == "2"){
+                viewModel.isselectFinancialMonthOrDay.bindOptional(context) {
+                    visibility = if (it == "2") {
                         View.VISIBLE
-                    }else{
+                    } else {
                         View.GONE
                     }
                 }
@@ -629,7 +643,17 @@ class FinancialReportUI(
                     emptyView(hint = resources.getString(R.string.now_no_data))
                 }).lparams(matchParent, matchParent)
 
-
+                viewModel.financialReportMonthDataList.bindOptional(context) {
+                    if (it?.isEmpty() == true || it?.size == 0) {
+                        statusLayout.showEmpty()
+                    } else {
+                        if (swipeToLayout.getIsRefreshing()) {
+                            swipeToLayout.finishRefresh()
+                        }
+                        statusLayout.showSuccess()
+                        financialReportMonthAdapter.setNewData(it)
+                    }
+                }
             }.lparams(matchParent, matchParent)
         }
     }
@@ -644,7 +668,7 @@ class FinancialReportUI(
 class ExposureReportUI(
     private val activity: AppCompatActivity,
     private val viewModel: ReportQueryViewModel
-): ExposureReportContentAdapter.OnContentScrollListener {
+) : ExposureReportContentAdapter.OnContentScrollListener {
 
 //    private lateinit var swipeToLayout: SwipeToLoadLayout
 //    private lateinit var statusLayout: StatusLayout
@@ -667,7 +691,10 @@ class ExposureReportUI(
     /**
      * 查询所用的date 注意(页面显示时间规则yyyy-MM-dd,而接口请求规则yyyyMMdd,简直无fuck可说)
      */
-    var tradedate: String = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400000),SimpleDateFormat("yyyy-MM-dd"))
+    var tradedate: String = TimeUtils.millis2String(
+        TimeUtils.getNowMills().minus(86400000),
+        SimpleDateFormat("yyyy-MM-dd")
+    )
 
     /** 查询时间textview **/
     lateinit var tradedatetextview: TextView
@@ -678,7 +705,6 @@ class ExposureReportUI(
     }
 
 
-
     @RequiresApi(Build.VERSION_CODES.N)
     val root = _FrameLayout(activity).apply {
         verticalLayout {
@@ -712,7 +738,10 @@ class ExposureReportUI(
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
                         tradedatetextview = this
-                        text = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400000),SimpleDateFormat("yyyy-MM-dd"))
+                        text = TimeUtils.millis2String(
+                            TimeUtils.getNowMills().minus(86400000),
+                            SimpleDateFormat("yyyy-MM-dd")
+                        )
                         textColorInt = R.color.rma_hint_text_color_ccc
                         textSizeAuto = 31
                     }.lparams(wrapContent, wrapContent) {
@@ -730,7 +759,7 @@ class ExposureReportUI(
 
                 textView {
                     onThrottleFirstClick {
-                        viewModel.qryReportDayExposure(tradedate = tradedate.replace("-",""))
+                        viewModel.qryReportDayExposure(tradedate = tradedate.replace("-", ""))
                     }
                     gravity = Gravity.CENTER
                     backgroundDrawable = createCommonBottomRoundBg(color = "#2481DD", corner = 5)
@@ -742,7 +771,7 @@ class ExposureReportUI(
                 }
 
             }.lparams(matchParent, autoSize(100))
-            viewModel.queryTitle(Constant.table_mobile_report_expose,tradedate.replace("-",""))
+            viewModel.queryTitle(Constant.table_mobile_report_expose, tradedate.replace("-", ""))
             contentAdapter.setOnContentScrollListener(this@ExposureReportUI)
             linearLayout {
                 linearLayout {
@@ -753,7 +782,7 @@ class ExposureReportUI(
                         }
                         textColorStr = "#AAAAAA"
                         textSizeAuto = 24
-                    }.lparams(wrapContent, wrapContent){
+                    }.lparams(wrapContent, wrapContent) {
                         marginStart = autoSize(30)
                     }
                 }.lparams(autoSize(SizeUtils.dp2px(135f)), autoSize(100))
@@ -805,7 +834,7 @@ class ExposureReportUI(
                         /**
                          * 下拉刷新
                          */
-                        viewModel.qryReportDayExposure(tradedate = tradedate.replace("-",""))
+                        viewModel.qryReportDayExposure(tradedate = tradedate.replace("-", ""))
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)
@@ -976,7 +1005,10 @@ class SpotReportUI(
     /**
      * 查询所用的date 注意(页面显示时间规则yyyy-MM-dd,而接口请求规则yyyyMMdd,简直无fuck可说)
      */
-    var tradedate: String = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400000),SimpleDateFormat("yyyy-MM-dd"))
+    var tradedate: String = TimeUtils.millis2String(
+        TimeUtils.getNowMills().minus(86400000),
+        SimpleDateFormat("yyyy-MM-dd")
+    )
 
     /** 查询时间textview **/
     lateinit var tradedatetextview: TextView
@@ -984,24 +1016,24 @@ class SpotReportUI(
     @RequiresApi(Build.VERSION_CODES.N)
     val root = _FrameLayout(activity).apply {
         verticalLayout {
-            viewModel.qryReportDaySpot(tradedate = tradedate.replace("-",""))
+            viewModel.qryReportDaySpot(tradedate = tradedate.replace("-", ""))
             linearLayout {
                 gravity = Gravity.CENTER_VERTICAL
                 linearLayout {
                     onThrottleFirstClick {
-                        if (viewModel.isselectSpotMonthOrDay.value == "1"){
+                        if (viewModel.isselectSpotMonthOrDay.value == "1") {
                             viewModel.isselectSpotMonthOrDay.postValue("2")
-                        }else{
+                        } else {
                             viewModel.isselectSpotMonthOrDay.postValue("1")
                         }
                     }
                     backgroundResource = R.drawable.rma_time_click_bg
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
-                        viewModel.isselectSpotMonthOrDay.bindOptional(context){
-                            if (it == "1"){
+                        viewModel.isselectSpotMonthOrDay.bindOptional(context) {
+                            if (it == "1") {
                                 text = "日报表"
-                            }else if (it == "2"){
+                            } else if (it == "2") {
                                 text = "月报表"
                             }
                         }
@@ -1033,7 +1065,10 @@ class SpotReportUI(
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
                         tradedatetextview = this
-                        text = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400000),SimpleDateFormat("yyyy-MM-dd"))
+                        text = TimeUtils.millis2String(
+                            TimeUtils.getNowMills().minus(86400000),
+                            SimpleDateFormat("yyyy-MM-dd")
+                        )
                         textColorInt = R.color.rma_hint_text_color_ccc
                         textSizeAuto = 31
                     }.lparams(wrapContent, wrapContent) {
@@ -1051,10 +1086,10 @@ class SpotReportUI(
 
                 textView {
                     onThrottleFirstClick {
-                        if (viewModel.isselectSpotMonthOrDay.value == "1"){
-                            viewModel.qryReportDaySpot(tradedate = tradedate.replace("-",""))
-                        }else{
-                            viewModel.qryReportMonthSpot(tradedate = tradedate.replace("-",""))
+                        if (viewModel.isselectSpotMonthOrDay.value == "1") {
+                            viewModel.qryReportDaySpot(tradedate = tradedate.replace("-", ""))
+                        } else {
+                            viewModel.qryReportMonthSpot(tradedate = tradedate.replace("-", ""))
                         }
                     }
                     gravity = Gravity.CENTER
@@ -1075,7 +1110,7 @@ class SpotReportUI(
                         text = "现货品种"
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent){
+                    }.lparams(wrapContent, wrapContent) {
                         marginStart = autoSize(36)
                         topMargin = autoSize(15)
                     }
@@ -1117,7 +1152,7 @@ class SpotReportUI(
                         text = "采购入库量"
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent){
+                    }.lparams(wrapContent, wrapContent) {
                         marginEnd = autoSize(36)
                         topMargin = autoSize(15)
                     }
@@ -1126,7 +1161,7 @@ class SpotReportUI(
                         text = "销售出库量"
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent){
+                    }.lparams(wrapContent, wrapContent) {
                         marginEnd = autoSize(36)
                     }
                 }.lparams(autoSize(225), autoSize(97))
@@ -1140,10 +1175,10 @@ class SpotReportUI(
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-                        if (viewModel.isselectSpotMonthOrDay.value == "1"){
-                            viewModel.qryReportDaySpot(tradedate = tradedate.replace("-",""))
-                        }else{
-                            viewModel.qryReportMonthSpot(tradedate = tradedate.replace("-",""))
+                        if (viewModel.isselectSpotMonthOrDay.value == "1") {
+                            viewModel.qryReportDaySpot(tradedate = tradedate.replace("-", ""))
+                        } else {
+                            viewModel.qryReportMonthSpot(tradedate = tradedate.replace("-", ""))
                         }
                     }
                     setEnableScrollContentWhenLoaded(false)
@@ -1157,11 +1192,11 @@ class SpotReportUI(
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            viewModel.spotReportDataList.bindOptional(context){
-                if (it?.isEmpty() == true || it?.size == 0){
+            viewModel.spotReportDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
                     statusLayout.showEmpty()
-                }else {
-                    if (swipeToLayout.getIsRefreshing()){
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
                         swipeToLayout.finishRefresh()
                     }
                     statusLayout.showSuccess()
@@ -1181,16 +1216,51 @@ class SpotReportUI(
 class InvertoryReportUI(
     private val activity: AppCompatActivity,
     private val viewModel: ReportQueryViewModel
-){
+) : InventoryRecordAdapter.OnContentScrollListener {
+
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+    lateinit var horScrollview: CustomHorizontalScrollView
+    lateinit var recyclerView: RecyclerView
+
+    //列表头部的数据adapter
+    val topAdapter by lazy {
+        TopTabAdpater(activity)
+    }
+
+    //列表adapter
+    val exposureContentAdapter by lazy {
+        InventoryRecordAdapter(activity)
+    }
+
+    /** 选择的现货商品类型 */
+    private val selectWrStandardData: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "") }
+
+    /** 选择的型号类型/品类 **/
+    private val selectWrStandModel: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "") }
+
+    /** 选择的品牌 ***/
+    private val selectWrStandBrand: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "") }
+
+    /** 选择的仓库 **/
+    private val selectWareHouse: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "") }
 
     /**
      * 查询所用的date 注意(页面显示时间规则yyyy-MM-dd,而接口请求规则yyyyMMdd,简直无fuck可说)
      */
-    var tradedate: String = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400000),SimpleDateFormat("yyyy-MM-dd"))
+    var tradedate: String = TimeUtils.millis2String(
+        TimeUtils.getNowMills().minus(86400000),
+        SimpleDateFormat("yyyy-MM-dd")
+    )
 
     /** 查询时间textview **/
     lateinit var tradedatetextview: TextView
 
+    init {
+        viewModel.queryWrStandardList()//查询现货列表
+        viewModel.queryWarehouseInfo()//查询可选择的仓库信息
+    }
+
     @RequiresApi(Build.VERSION_CODES.N)
     val root = _FrameLayout(activity).apply {
         verticalLayout {
@@ -1198,20 +1268,22 @@ class InvertoryReportUI(
                 gravity = Gravity.CENTER_VERTICAL
                 linearLayout {
                     onThrottleFirstClick {
-                        if (viewModel.isselectSpotMonthOrDay.value == "1"){
-                            viewModel.isselectSpotMonthOrDay.postValue("2")
-                        }else{
-                            viewModel.isselectSpotMonthOrDay.postValue("1")
+                        if (viewModel.isSelectInventoryMonthOrDay.value == "1") {
+                            viewModel.isSelectInventoryMonthOrDay.postValue("2")
+                        } else {
+                            viewModel.isSelectInventoryMonthOrDay.postValue("1")
                         }
                     }
                     backgroundResource = R.drawable.rma_time_click_bg
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
-                        viewModel.isselectSpotMonthOrDay.bindOptional(context){
-                            if (it == "1"){
+                        viewModel.isSelectInventoryMonthOrDay.bindOptional(context) {
+                            if (it == "1") {
                                 text = "日报表"
-                            }else if (it == "2"){
+                                exposureContentAdapter.setquerytype("1")
+                            } else if (it == "2") {
                                 text = "月报表"
+                                exposureContentAdapter.setquerytype("2")
                             }
                         }
                         text = "日报表"
@@ -1225,7 +1297,9 @@ class InvertoryReportUI(
 
                     imageView {
                         imageResource = R.mipmap.rma_down
-                    }.lparams(autoSize(25), autoSize(25))
+                    }.lparams(autoSize(25), autoSize(25)){
+                        marginEnd = autoSize(10)
+                    }
 
                 }.lparams(autoSize(264), autoSize(67)) {
                     marginStart = autoSize(36)
@@ -1235,6 +1309,7 @@ class InvertoryReportUI(
                     onThrottleFirstClick {
                         activity.showDataSelectDialog(type = viewModel.isselectSpotMonthOrDay.value.toString()) {
                             tradedate = this
+                            exposureContentAdapter.setquerydate(this)
                             tradedatetextview.text = this
                         }
                     }
@@ -1242,7 +1317,10 @@ class InvertoryReportUI(
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
                         tradedatetextview = this
-                        text = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400000),SimpleDateFormat("yyyy-MM-dd"))
+                        text = TimeUtils.millis2String(
+                            TimeUtils.getNowMills().minus(86400000),
+                            SimpleDateFormat("yyyy-MM-dd")
+                        )
                         textColorInt = R.color.rma_hint_text_color_ccc
                         textSizeAuto = 31
                     }.lparams(wrapContent, wrapContent) {
@@ -1253,22 +1331,32 @@ class InvertoryReportUI(
 
                     imageView {
                         imageResource = R.mipmap.rma_search_by_time
-                    }.lparams(autoSize(38), autoSize(38))
+                    }.lparams(autoSize(38), autoSize(38)){
+                        marginEnd = autoSize(10)
+                    }
                 }.lparams(autoSize(264), autoSize(67)) {
                     marginStart = autoSize(12)
                 }
 
                 linearLayout {
                     onThrottleFirstClick {
-                        activity.showDataSelectDialog(type = viewModel.isselectSpotMonthOrDay.value.toString()) {
-                            tradedate = this
-                            tradedatetextview.text = this
+                        activity.creatBottomSheetDialog(
+                            "请选择现货品种",
+                            viewModel.selectSpotVarietiesList(
+                                viewModel.wrStandardDataList.value ?: arrayListOf()
+                            )
+                        ) {
+                            selectWrStandardData.postValue(this)
+                            viewModel.queryWrStandardDetail(this.id)
                         }
                     }
                     backgroundResource = R.drawable.rma_time_click_bg
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
-                        tradedatetextview = this
+                        selectWrStandardData.bindOptional(context) {
+                            text = it?.value
+                            textColorInt = R.color.rma_black_33
+                        }
                         text = "现货品种"
                         textColorInt = R.color.rma_hint_text_color_ccc
                         textSizeAuto = 31
@@ -1279,37 +1367,281 @@ class InvertoryReportUI(
                     emptyView()
 
                     imageView {
-                        imageResource = R.mipmap.rma_search_by_time
-                    }.lparams(autoSize(38), autoSize(38))
+                        imageResource = R.mipmap.rma_down
+                    }.lparams(autoSize(38), autoSize(38)){
+                        marginEnd = autoSize(10)
+                    }
                 }.lparams(autoSize(264), autoSize(67)) {
                     marginStart = autoSize(12)
                 }
 
+
+            }.lparams(matchParent, autoSize(100))
+
+            linearLayout {
+                linearLayout {
+                    onThrottleFirstClick {
+                        activity.creatBottomSheetDialog(
+                            "请选择品类",
+                            viewModel.selectWrStandardModel(
+                                viewModel.wrStandardDataDetail.value
+                                    ?: WrStandardDetail()
+                            )
+                        ) {
+                            selectWrStandModel.postValue(this)
+                        }
+                    }
+                    backgroundResource = R.drawable.rma_time_click_bg
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        selectWrStandModel.bindOptional(context) {
+                            text = it?.value
+                            textColorInt = R.color.rma_black_33
+                        }
+                        text = "品类"
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                        textSizeAuto = 31
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(18)
+                    }
+
+                    emptyView()
+
+                    imageView {
+                        imageResource = R.mipmap.rma_down
+                    }.lparams(autoSize(38), autoSize(38)){
+                        marginEnd = autoSize(10)
+                    }
+                }.lparams(0, autoSize(67), 1f) {
+                    marginStart = autoSize(12)
+                }
+                linearLayout {
+                    onThrottleFirstClick {
+                        activity.creatBottomSheetDialog(
+                            "请选择品牌",
+                            viewModel.selectWrStandardBrand(
+                                viewModel.wrStandardDataDetail.value
+                                    ?: WrStandardDetail()
+                            )
+                        ) {
+                            selectWrStandBrand.postValue(this)
+                        }
+                    }
+                    backgroundResource = R.drawable.rma_time_click_bg
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        selectWrStandBrand.bindOptional(context) {
+                            text = it?.value
+                            textColorInt = R.color.rma_black_33
+                        }
+                        text = "品牌"
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                        textSizeAuto = 31
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(18)
+                    }
+
+                    emptyView()
+
+                    imageView {
+                        imageResource = R.mipmap.rma_down
+                    }.lparams(autoSize(38), autoSize(38)){
+                        marginEnd = autoSize(10)
+                    }
+                }.lparams(0, autoSize(67), 1f) {
+                    marginStart = autoSize(12)
+                }
+                linearLayout {
+                    onThrottleFirstClick {
+                        val selectDataList = viewModel.setSelectWarehouseList(
+                            viewModel.normalWarehouseInfo.value ?: arrayListOf()
+                        )
+                        activity.creatBottomSheetDialog("请选择仓库", selectDataList) {
+                            selectWareHouse.postValue(this)
+                        }
+                    }
+                    backgroundResource = R.drawable.rma_time_click_bg
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        selectWareHouse.bindOptional(context) {
+                            text = it?.value
+                            textColorInt = R.color.rma_black_33
+                        }
+                        text = "仓库"
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                        textSizeAuto = 31
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(18)
+                    }
+
+                    emptyView()
+
+                    imageView {
+                        imageResource = R.mipmap.rma_down
+                    }.lparams(autoSize(38), autoSize(38)){
+                        marginEnd = autoSize(10)
+                    }
+                }.lparams(0, autoSize(67), 1f) {
+                    marginStart = autoSize(12)
+                }
+
                 textView {
-                    visibility = View.GONE
                     onThrottleFirstClick {
-                        if (viewModel.isselectSpotMonthOrDay.value == "1"){
-                            viewModel.qryReportDaySpot(tradedate = tradedate.replace("-",""))
-                        }else{
-                            viewModel.qryReportMonthSpot(tradedate = tradedate.replace("-",""))
+                        var querydate = ""
+                        if (viewModel.isSelectInventoryMonthOrDay.value == "1"){//日报表
+                            querydate = tradedate.replace("-", "")
+                        }else{//月报表
+                            querydate = tradedate.replace("-", "")
                         }
+                        viewModel.queryAreaStockReport(
+                            querytype = viewModel.isSelectInventoryMonthOrDay.value ?: "1",
+                            querydate = querydate,
+                            wrstandardid = selectWrStandardData.value?.id ?: "",
+                            spotgoodsbrandid = selectWrStandBrand.value?.id ?: "",
+                            spotgoodsmodelid = selectWrStandModel.value?.id ?: "",
+                            warehouseinfoid = selectWareHouse.value?.id ?: ""
+                        )
                     }
                     gravity = Gravity.CENTER
                     backgroundDrawable = createCommonBottomRoundBg(color = "#2481DD", corner = 5)
                     text = "查询"
                     textSizeAuto = 31
                     textColorInt = R.color.white
-                }.lparams(autoSize(144), autoSize(67)) {
+                }.lparams(autoSize(122), autoSize(67)) {
                     marginStart = autoSize(12)
                 }
-
             }.lparams(matchParent, autoSize(100))
-
+            //初始化数据进行头部数据请求
+            viewModel.queryInventoryTitle(
+                querytype = viewModel.isSelectInventoryMonthOrDay.value ?: "1",
+                querydate = tradedate.replace("-", "")
+            )
+            exposureContentAdapter.setOnContentScrollListener(this@InvertoryReportUI)
             linearLayout {
+                linearLayout {
+                    gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
+                    textView {//头部右侧数据
+                        viewModel.inventoryRecordTitle.bindOptional(context) {
+                            text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
+                        }
+                        textColorStr = "#AAAAAA"
+                        textSizeAuto = 24
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(30)
+                    }
+                }.lparams(autoSize(SizeUtils.dp2px(90f)), autoSize(100))
 
+                inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
+                    horScrollview = this
+                    /**
+                     * 用来同步内容列表的item左右滑动
+                     */
+                    setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
+                        exposureContentAdapter.offestX = scrollX
+                        val viewHolderCacheList: List<InventoryRecordAdapter.ItemViewHolder> =
+                            exposureContentAdapter.viewHolderCacheList
+                        if (null != viewHolderCacheList) {
+                            val size = viewHolderCacheList.size
+                            for (i in 0 until size) {
+                                viewHolderCacheList[i].exposure_horItemScrollview.scrollTo(
+                                    scrollX,
+                                    0
+                                )
+                            }
+                        }
+                    }
+                    relativeLayout {
+                        recyclerView {//头部右侧数据
+                            val linearLayoutManager = LinearLayoutManager(context)
+                            linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
+                            layoutManager = linearLayoutManager
+                            background = resources.getDrawable(R.color.white)
+                            adapter = topAdapter
+                        }
+                        viewModel.inventoryRecordTitle.bindOptional(context) {
+                            val titleStringList = arrayListOf<String>()
+                            it?.subList(1, it.size)?.forEach { data ->
+                                titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
+                            }
+                            topAdapter.setDatas(titleStringList)
+                        }
+                    }
+                }.lparams(matchParent, matchParent)
             }.lparams(matchParent, autoSize(100))
+            statusLayout(contentBlock = {
+                statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        var querydate = ""
+                        if (viewModel.isSelectInventoryMonthOrDay.value == "1"){//日报表
+                            querydate = tradedate.replace("-", "")
+                        }else{//月报表
+                            querydate = tradedate.replace("-", "")
+                        }
+                        /**
+                         * 下拉刷新
+                         */
+                        viewModel.queryAreaStockReport(
+                            querytype = viewModel.isSelectInventoryMonthOrDay.value ?: "1",
+                            querydate = querydate,
+                            wrstandardid = selectWrStandardData.value?.id ?: "",
+                            spotgoodsbrandid = selectWrStandBrand.value?.id ?: "",
+                            spotgoodsmodelid = selectWrStandModel.value?.id ?: "",
+                            warehouseinfoid = selectWareHouse.value?.id ?: ""
+
+                        )
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = exposureContentAdapter
+                        addOnScrollListener(object : RecyclerView.OnScrollListener() {
+                            override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
+                                super.onScrolled(recyclerView, dx, dy)
+                                val viewHolderCacheList: List<InventoryRecordAdapter.ItemViewHolder> =
+                                    exposureContentAdapter.viewHolderCacheList
+                                if (null != viewHolderCacheList) {
+                                    val size = viewHolderCacheList.size
+                                    for (i in 0 until size) {
+                                        viewHolderCacheList[i].exposure_horItemScrollview.scrollTo(
+                                            exposureContentAdapter.getOffestX(),
+                                            0
+                                        )
+                                    }
+                                }
+                            }
+                        })
+                    }
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.inventoryDetailsDataList.bindOptional(context) {
+
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    exposureContentAdapter.setDatas(it)
+                }
+            }
         }
     }
+
+    override fun onScroll(event: MotionEvent?) {
+        //处理单个item滚动时,顶部tab需要联动
+        if (null != horScrollview) horScrollview.onTouchEvent(event)
+    }
 }
 
 /**
@@ -1326,10 +1658,10 @@ class FinancialPaymentUI(
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
     private val financialReportDayAdapter: BaseAdapter<FinancialReportData, FinancialDayViewHolder> =
-        BaseAdapter { _, _ -> FinancialDayViewHolder(activity, viewModel,"1") }
+        BaseAdapter { _, _ -> FinancialDayViewHolder(activity, viewModel, "1") }
 
-    fun queryRefrashByTime(tradeDate : String){
-        viewModel.qryReportDayFinanceKx(tradedate = tradeDate.replace("-",""))
+    fun queryRefrashByTime(tradeDate: String) {
+        viewModel.qryReportDayFinanceKx(tradedate = tradeDate.replace("-", ""))
     }
 
     val root = _FrameLayout(activity).apply {
@@ -1357,11 +1689,11 @@ class FinancialPaymentUI(
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            viewModel.financialReportDayPaymentDataList.bindOptional(context){
-                if (it?.isEmpty() == true || it?.size == 0){
+            viewModel.financialReportDayPaymentDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
                     statusLayout.showEmpty()
-                }else {
-                    if (swipeToLayout.getIsRefreshing()){
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
                         swipeToLayout.finishRefresh()
                     }
                     statusLayout.showSuccess()
@@ -1386,10 +1718,10 @@ class FinancialInvoiceUI(
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
     private val financialReportDayAdapter: BaseAdapter<FinancialReportData, FinancialDayViewHolder> =
-        BaseAdapter { _, _ -> FinancialDayViewHolder(activity, viewModel,"1") }
+        BaseAdapter { _, _ -> FinancialDayViewHolder(activity, viewModel, "1") }
 
-    fun queryRefrashByTime(tradeDate : String){
-        viewModel.qryReportDayFinanceFp(tradedate = tradeDate.replace("-",""))
+    fun queryRefrashByTime(tradeDate: String) {
+        viewModel.qryReportDayFinanceFp(tradedate = tradeDate.replace("-", ""))
     }
 
     val root = _FrameLayout(activity).apply {
@@ -1417,11 +1749,11 @@ class FinancialInvoiceUI(
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            viewModel.financialReportDayInvoiceDataList.bindOptional(context){
-                if (it?.isEmpty() == true || it?.size == 0){
+            viewModel.financialReportDayInvoiceDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
                     statusLayout.showEmpty()
-                }else {
-                    if (swipeToLayout.getIsRefreshing()){
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
                         swipeToLayout.finishRefresh()
                     }
                     statusLayout.showSuccess()
@@ -1433,20 +1765,23 @@ class FinancialInvoiceUI(
 }
 
 
-
 /**
  * 财务报表日报表头部
  * type  1 款项 2 发票
  */
-fun _LinearLayout.FinanciclReportDayTitleUI(type : String){
+fun _LinearLayout.FinanciclReportDayTitleUI(type: String) {
     linearLayout {
         verticalLayout {
             gravity = Gravity.START
             textView {
-                text = if (type == "1"){ "款项发生时间" }else{ "发票发生时间" }
+                text = if (type == "1") {
+                    "款项发生时间"
+                } else {
+                    "发票发生时间"
+                }
                 textSizeAuto = 24
                 textColorInt = R.color.hint_text_color
-            }.lparams(wrapContent, wrapContent){
+            }.lparams(wrapContent, wrapContent) {
                 marginStart = autoSize(36)
                 topMargin = autoSize(15)
             }
@@ -1486,7 +1821,7 @@ fun _LinearLayout.FinanciclReportDayTitleUI(type : String){
                 text = "操作人"
                 textSizeAuto = 24
                 textColorInt = R.color.hint_text_color
-            }.lparams(wrapContent, wrapContent){
+            }.lparams(wrapContent, wrapContent) {
                 marginEnd = autoSize(36)
                 topMargin = autoSize(15)
             }
@@ -1501,6 +1836,7 @@ fun _LinearLayout.FinanciclReportDayTitleUI(type : String){
 fun _LinearLayout.FinancialReportUiTitle() {
     linearLayout {
         verticalLayout {
+            gravity = Gravity.CENTER
             textView {
                 text = "日期"
                 textSizeAuto = 24
@@ -1559,13 +1895,17 @@ fun _LinearLayout.FinancialReportUiTitle() {
                 text = "开票笔数"
                 textSizeAuto = 24
                 textColorInt = R.color.text_hit_color
-            }.lparams(wrapContent, wrapContent)
+            }.lparams(wrapContent, wrapContent){
+                marginEnd = autoSize(30)
+            }
 
             textView {
                 text = "开票金额"
                 textSizeAuto = 24
                 textColorInt = R.color.text_hit_color
-            }.lparams(wrapContent, wrapContent)
+            }.lparams(wrapContent, wrapContent){
+                marginEnd = autoSize(30)
+            }
         }.lparams(autoSize(180), autoSize(97))
     }.lparams(matchParent, autoSize(97))
 }

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

@@ -9,6 +9,8 @@ import cn.muchinfo.rma.view.autoWidget.toArrayList
 import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import cn.muchinfo.rma.view.base.BaseViewModel
 import cn.muchinfo.rma.view.base.app.Constant
+import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.dialog.SelectData
 import mtp.polymer.com.autowidget.utils.TaskUiModel
 
 class ReportQueryViewModel : BaseViewModel(){
@@ -69,10 +71,40 @@ class ReportQueryViewModel : BaseViewModel(){
     val spotReportDetailsDataList : MutableLiveData<List<SpotReportData>> = MutableLiveData()
 
     /**
+     * 库存报表选择的日报表还是月报表 1为日报表 2为月报表
+     */
+    val isSelectInventoryMonthOrDay : MutableLiveData<String> = MutableLiveData<String>().apply { value = "1" }
+
+    /**
+     * 库存报表数据
+     */
+    val inventoryDetailsDataList: MutableLiveData<List<AreaStockReportData>> = MutableLiveData()
+
+    /**
+     * 库存报表数据头部数据
+     */
+    val inventoryRecordTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
+
+    /**
+     * 现货品种列表
+     */
+    val wrStandardDataList: MutableLiveData<List<WrStandardData>> = MutableLiveData()
+
+    /**
+     * 仓库信息的正常列表
+     */
+    val normalWarehouseInfo: MutableLiveData<List<WarehouseInfoData>> = MutableLiveData()
+
+    /**
+     * 现货品种详情
+     */
+    val wrStandardDataDetail: MutableLiveData<WrStandardDetail> = MutableLiveData()
+
+    /**
      * 查询财务日报表(菜单:报表查询/财务报表/日报表)
      * @param tradedate String
      */
-    fun qryReportDayFinance(tradedate : String,isFirstLoading : Boolean = true){
+    fun qryReportDayFinance(tradedate : String,isFirstLoading : Boolean = false){
 
         if (isFirstLoading){
             loadingDialogStatus.postValue(TaskUiModel.inFlight())
@@ -301,4 +333,215 @@ class ReportQueryViewModel : BaseViewModel(){
         }
         return newList
     }
+
+    /**
+     * 从报表页面进入出入库报表明细
+     */
+    fun queryAreaStockReport(
+        querytype: String = "",
+        querydate: String = "",
+        wrstandardid: String = "",
+        spotgoodsbrandid: String = "",
+        spotgoodsmodelid: String = "",
+        warehouseinfoid: String = ""
+    ) {
+        val params = mutableMapOf<String, String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+            put("querytype", querytype)
+            put("querydate", querydate)
+            if (wrstandardid.isNotEmpty()){
+                put("wrstandardid",wrstandardid)
+            }
+            if (spotgoodsbrandid.isNotEmpty()){
+                put("spotgoodsbrandid",spotgoodsbrandid)
+            }
+            if (spotgoodsmodelid.isNotEmpty()){
+                put("spotgoodsmodelid",spotgoodsmodelid)
+            }
+            if (warehouseinfoid.isNotEmpty()){
+                put("warehouseinfoid",warehouseinfoid)
+            }
+        }
+        MyApplication.getInstance()?.warehouseManager?.queryAreaStockReport(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                /**
+                 * 对数据进行组装
+                 */
+                inventoryDetailsDataList.postValue(
+                    getInventoryAuditRightData(
+                        respData ?: arrayListOf()
+                    )
+                )
+            }
+        }
+    }
+
+    /**
+     * querytype 查询类型 1-日报表 2-月报表
+     * querydate 查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)
+     * wrstandardid 现货商品ID
+     * spotgoodsbrandid 品牌ID
+     * spotgoodsmodelid 型号ID
+     * warehouseinfoid 仓库ID
+     * 查询列表头部数据
+     * @param tableKey String
+     */
+    fun queryInventoryTitle(
+        querytype: String = "",
+        querydate: String = "",
+        wrstandardid: String = "",
+        spotgoodsbrandid: String = "",
+        spotgoodsmodelid: String = "",
+        warehouseinfoid: String = ""
+    ) {
+        val params = mutableMapOf<String, String>().apply {
+            put("tableKey", Constant.table_mobile_stock_report)
+            put("tableType", "3")
+        }
+        MyApplication.getInstance()?.commonManager?.queryTableDefine(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                val newlist = respData?.get(0)?.columns?.toArrayList()
+                newlist?.sortWith(Comparator { t1, t2 ->
+                    t1.orderindex?.toInt()?.minus(t2.orderindex?.toInt() ?: 0) ?: 0
+                })
+                inventoryRecordTitle.postValue(newlist)
+                queryAreaStockReport(querytype = querytype,querydate = querydate)
+            }
+        }
+    }
+
+    /**
+     * 库存报表组装右部数据
+     * @param respData List<RealExposureData>
+     * @return List<RealExposureData>
+     */
+    private fun getInventoryAuditRightData(respData: List<AreaStockReportData>): List<AreaStockReportData> {
+        val newList = arrayListOf<AreaStockReportData>()
+        respData.forEach {
+            val newRightData = arrayListOf<String>()
+            newRightData.add(it.modelname + "\n" + it.brandname)
+            newRightData.add(it.warehousename ?: "--")
+            newRightData.add(it.oristock + it.enumdicname + "\n" + it.curstock + it.enumdicname)
+            newRightData.add(it.todayproduceinqty + it.enumdicname + "\n" + it.todayproduceoutqty + it.enumdicname)
+            val newData = it.copy(rightData = newRightData)
+            newList.add(newData)
+        }
+        return newList
+    }
+
+    /**
+     * 查询现货品种列表
+     */
+    fun queryWrStandardList() {
+        val params = mutableMapOf<String, String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+            put("status", "1")
+        }
+        MyApplication.getInstance()?.commodityManager?.queryWrStandard(params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                wrStandardDataList.postValue(respData)
+            }
+        }
+    }
+
+    /**
+     * 查询仓库信息
+     * type 1 正常
+     * @param status String 仓库状态(可多项,逗号隔开) 1:正常 2:注销 3:待审核 4:审核拒绝 正常传入1,3  停用传入2,4
+     */
+    fun queryWarehouseInfo() {
+        val params = mutableMapOf<String, String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+            put("status", "1")
+        }
+
+        MyApplication.getInstance()?.warehouseManager?.queryWarehouseInfo(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                normalWarehouseInfo.postValue(respData)
+            } else {
+                ToastUtils.showLong("数据请求失败")
+            }
+        }
+    }
+
+    /**
+     * 根据选择控件进行数据重新组装(现货品种列表)
+     * @param dataList List<UserInfoData>
+     * @return ArrayList<SelectData>
+     */
+    fun selectSpotVarietiesList(dataList: List<WrStandardData>): ArrayList<SelectData> {
+        val newSpotVarietiesList = arrayListOf<SelectData>()
+        dataList.forEach {
+            newSpotVarietiesList.add(
+                SelectData(
+                    id = it.wrstandardid ?: "",
+                    value = it.wrstandardname ?: "",
+                    deliverygoodsid = it.deliverygoodsid ?: "",
+                    enumdicname = it.enumdicname ?: ""
+                )
+            )
+        }
+        return newSpotVarietiesList
+    }
+
+    /**
+     * 用来请求选择现货品种后的型号和品牌信息
+     * @param wrstandardid String
+     */
+    fun queryWrStandardDetail(wrstandardid: String) {
+        val params = mutableMapOf<String, String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+            put("wrstandardid", wrstandardid)
+        }
+
+        MyApplication.getInstance()?.commodityManager?.queryWrStandardDetail(params) { isSuccess, respData, _ ->
+            if (isSuccess) {
+                wrStandardDataDetail.postValue(respData?.get(0))
+            }
+        }
+    }
+
+    /**
+     * 根据选择控件进行数据重新组装(型号)
+     * @param data WrStandardDetail
+     * @return ArrayList<SelectData>
+     */
+    fun selectWrStandardModel(data: WrStandardDetail): ArrayList<SelectData> {
+        val wrstandardModel = arrayListOf<SelectData>()
+        data.gtList.forEach {
+            wrstandardModel.add(SelectData(id = it.modelid, value = it.modelname))
+        }
+        return wrstandardModel
+    }
+
+    /**
+     * 根据选择控件进行数据重新组装(品牌)
+     * @param data WrStandardDetail
+     * @return ArrayList<SelectData>
+     */
+    fun selectWrStandardBrand(data: WrStandardDetail): ArrayList<SelectData> {
+        val wrstandardBrand = arrayListOf<SelectData>()
+        data.gbList.forEach {
+            wrstandardBrand.add(SelectData(id = it.brandid, value = it.brandname))
+        }
+        return wrstandardBrand
+    }
+
+    /**
+     * 根据选择控件进行数据重新组装(客户)
+     * @param dataList List<UserInfoData>
+     * @return ArrayList<SelectData>
+     */
+    fun setSelectWarehouseList(dataList: List<WarehouseInfoData>): ArrayList<SelectData> {
+        val newCustomerList = arrayListOf<SelectData>()
+        dataList.forEach {
+            newCustomerList.add(
+                SelectData(
+                    id = it.autoid.toString() ?: "",
+                    value = it.warehousename ?: ""
+                )
+            )
+        }
+        return newCustomerList
+    }
 }

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

@@ -816,7 +816,6 @@ class ChangeRecordUI(
                 }.lparams(autoSize(300), autoSize(70))
             }.lparams(matchParent, autoSize(70))
 
-
             statusLayout(contentBlock = {
                 statusLayout = this
 //                bindTaskStatus(viewModule.status)