Browse Source

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

Liu.bolan 4 years ago
parent
commit
92706aadab
19 changed files with 1391 additions and 206 deletions
  1. 2 0
      RMA/app/src/main/AndroidManifest.xml
  2. 49 8
      RMA/app/src/main/java/cn/muchinfo/rma/business/warehouse/WarehouseManager.kt
  3. 1 2
      RMA/app/src/main/java/cn/muchinfo/rma/business/warehouse/adapter/WarehouseAdapter.kt
  4. 5 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/HomeFragment.kt
  5. 56 16
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/BuySellInventoryActivity.kt
  6. 85 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/InventoryAuditViewModel.kt
  7. 4 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/InventoryContentAdapter.java
  8. 40 33
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/ProductionInventoryActivity.kt
  9. 201 18
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventorymanager/AddInventoryActivity.kt
  10. 74 19
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventorymanager/InventoryDetailsActivity.kt
  11. 6 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventorymanager/InventoryManagerActivity.kt
  12. 318 38
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventorymanager/InventoryManagerViewModel.kt
  13. 35 11
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventorymanager/adapter/InventoryCurrentAdapter.java
  14. 3 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventorymanager/adapter/InventoryDetailsAdapter.java
  15. 161 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/ReportQueryActivity.kt
  16. 10 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/SpotReportViewHolder.kt
  17. 259 43
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ContractDetailActivity.kt
  18. 80 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ProcurementViewModel.kt
  19. 2 1
      RMA/app/src/main/res/layout/layout_item_inventory_current.xml

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

@@ -215,6 +215,8 @@
 
         <activity android:name=".view.base.home.registration.WarehouseRegistrationActivity"/>
 
+        <activity android:name=".view.base.home.inventory.inventorymanager.InventoryDetailsActivity"/>
+
     </application>
 
 </manifest>

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

@@ -1,6 +1,5 @@
 package cn.muchinfo.rma.business.warehouse
 
-import cn.muchinfo.rma.business.contract.adapter.ContractAdapter
 import cn.muchinfo.rma.business.warehouse.adapter.WarehouseAdapter
 import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.netManage.base.ResponseCallback
@@ -173,7 +172,7 @@ class WarehouseManager {
 
 
     /**
-     * 查询已登记出入库信息(入库登记/已入库信息 | 出库登记/已出库信息)
+     * 查询库存报表明细
      * @param params Map<String, String>
      *     userid 用户ID
      *     querytype 查询类型 1-日报表明细 2-月报表明细
@@ -187,16 +186,16 @@ class WarehouseManager {
      */
     fun queryAreaStockReportDetail(
         params: Map<String, String>,
-        responseBack: (isSuccess: Boolean, respData: List<AreaStockReportDetailData>?, error: Error?) -> Unit
+        responseBack: (isSuccess: Boolean, respData: List<AreaStockApplyData>?, error: Error?) -> Unit
     ) {
         MyOkHttpUtils().query(
             URL = SPUtils.getInstance()
                 .getString(Constant.goCommonSearchUrl) + "/Ermcp/QueryAreaStockReportDetail",
             params = params,
             type = "1",
-            callback = object : ResponseCallback<BaseResult<List<AreaStockReportDetailData>>>() {
+            callback = object : ResponseCallback<BaseResult<List<AreaStockApplyData>>>() {
                 override fun onResponse(
-                    response: BaseResult<List<AreaStockReportDetailData>>?,
+                    response: BaseResult<List<AreaStockApplyData>>?,
                     id: Int
                 ) {
                     responseBack(true, response?.data, null)
@@ -272,6 +271,50 @@ class WarehouseManager {
     }
 
     /**
+     * 机构出入库申请审核通过请求报文装箱
+     * @param InOutApplyID Long
+     * @param Remark String
+     *  optional MessageHead Header = 1; // MessageHead
+    optional uint64 InOutApplyID = 2; // uint64 操作申请ID(607+Unix秒时间戳(10位)+xxxxxx)
+    optional uint64 AuditID = 3; // uint64 操作用户ID
+    optional uint32 AuditSrc = 4; // uint32 操作来源-1:管理端2:终端
+    optional string Remark = 5; // string 备注
+    optional string ClientTicket = 6; // string 客户端流水号
+     */
+    fun getAreaInOutApplyAuditPassReq(
+        InOutApplyID : Long,
+        Remark : String = "",
+        callback: (isCompleted: Boolean, err: Error?) -> Unit
+    ){
+        val tradeSocketManager = MyApplication.getInstance()?.tradeSocketManager.guard {
+            callback(false, Error("交易链路未初始化"))
+            return
+        }
+        val reqPacket = WarehouseAdapter.getAreaInOutApplyAuditPassReqInfo(
+            InOutApplyID,
+            Remark
+        )
+
+        tradeSocketManager.send(
+            reqPacket,
+            FunCode.AreaInOutApplyAuditPassRsp,
+            object : Callback<Packet50> {
+                override fun onSuccess(rsp: Packet50?) {
+                    val rst = WarehouseAdapter.analysisAreaInOutApplyAuditPassRsq(rsp!!)
+                    callback(rst.first, rst.second)
+                }
+
+                override fun onFail(err: Error?) {
+                    // 发送数据失败
+                    callback(false, err)
+                }
+
+            }
+        )
+
+    }
+
+    /**
      * 机构出入库申请审核拒绝撤回请求报文装箱
      * @param InOutApplyID Long uint64 申请ID
      * @param AuditID Long uint64 审核人
@@ -281,7 +324,6 @@ class WarehouseManager {
      */
     fun auditAreaInOutStockApplyReq(
         InOutApplyID: Long,
-        AuditID: Long,
         AuditRemark: String = "",
         AuditTradeDate: String = "",
         ApplyStatus: Int,
@@ -294,7 +336,6 @@ class WarehouseManager {
 
         val reqPacket = WarehouseAdapter.getAuditAreaInOutStockApplyReqInfo(
             InOutApplyID,
-            AuditID,
             AuditRemark,
             AuditTradeDate,
             ApplyStatus
@@ -302,7 +343,7 @@ class WarehouseManager {
 
         tradeSocketManager.send(
             reqPacket,
-            FunCode.SpotContractOperateRsp,
+            FunCode.AduitInOutStockApplyRsp,
             object : Callback<Packet50> {
                 override fun onSuccess(rsp: Packet50?) {
                     val rst = WarehouseAdapter.analysisAuditAreaInOutStockApplyRsq(rsp!!)

+ 1 - 2
RMA/app/src/main/java/cn/muchinfo/rma/business/warehouse/adapter/WarehouseAdapter.kt

@@ -117,7 +117,6 @@ object WarehouseAdapter {
      */
     fun getAuditAreaInOutStockApplyReqInfo(
         InOutApplyID : Long,
-        AuditID : Long,
         AuditRemark : String = "",
         AuditTradeDate : String = "",
         ApplyStatus : Int
@@ -135,7 +134,7 @@ object WarehouseAdapter {
             )
         )
         builder.inOutApplyID = InOutApplyID
-        builder.auditID = AuditID
+        builder.auditID = loginInfo.loginID
         builder.auditRemark = AuditRemark
         builder.auditTradeDate = AuditTradeDate
         builder.applyStatus = ApplyStatus

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

@@ -31,6 +31,7 @@ import cn.muchinfo.rma.view.base.home.customerdata.CustomerDataActivity
 import cn.muchinfo.rma.view.base.home.financial.FinancialActivity
 import cn.muchinfo.rma.view.base.home.hedge.HedgePlanActivity
 import cn.muchinfo.rma.view.base.home.inventory.inventoryaudit.InventoryAuditActivity
+import cn.muchinfo.rma.view.base.home.inventory.inventorymanager.InventoryManagerActivity
 import cn.muchinfo.rma.view.base.home.reportquery.ReportQueryActivity
 import cn.muchinfo.rma.view.base.home.set.SettingActivity
 import cn.muchinfo.rma.view.base.home.tradingquery.TradingQueryActivity
@@ -1025,7 +1026,9 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
                     relativeLayout {
                         verticalLayout {
                             onThrottleFirstClick {
-                                ToastUtils.showLong("库存管理")
+                                val intent = Intent()
+                                intent.setClass(context, InventoryManagerActivity::class.java)
+                                ActivityUtils.startActivity(intent)
                             }
                             imageView {
                                 imageResource = R.mipmap.rma_inventory_management
@@ -1077,7 +1080,7 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
                     relativeLayout {
                         verticalLayout {
                             onThrottleFirstClick {
-                                ToastUtils.showLong("账户管理")
+
                             }
                             imageView {
                                 imageResource = R.mipmap.rma_account_management

+ 56 - 16
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/BuySellInventoryActivity.kt

@@ -16,7 +16,12 @@ import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.TimeUtils
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
 import org.jetbrains.anko.*
+import java.text.DateFormat
+import java.text.SimpleDateFormat
 
 /**
  * 采购/销售出入库审核
@@ -38,6 +43,8 @@ class BuySellInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
         intent.getParcelableExtra<AreaStockApplyData>("data") as AreaStockApplyData
     }
 
+    private val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
+
     /**
      * 审核意见
      */
@@ -46,17 +53,22 @@ class BuySellInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            dialog.bindTaskStatus(context, viewModel.loadingDialogStatus)
             background = resources.getDrawable(R.color.main_hit_bg_color)
             val margingPadding = autoSize(47)
             topBar {
                 commonLeftButton()
                 commonTitle {
-                    if (type == "1"){
-                        text = "审核"
-                    }else if (type == "2"){
-                        text = "撤回"
-                    }else if (type == "3"){
-                        text = "详情"
+                    when (type) {
+                        "1" -> {
+                            text = "审核"
+                        }
+                        "2" -> {
+                            text = "撤回"
+                        }
+                        "3" -> {
+                            text = "详情"
+                        }
                     }
                 }
             }
@@ -621,7 +633,7 @@ class BuySellInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
                                 background = resources.getDrawable(R.drawable.rma_item_click_bg)
                                 editText {
                                     ramask_edittext = this
-                                    setPadding(0, 10, 0, 0)
+                                    setPadding(20, 10, 0, 0)
                                     hint = "请输入审核意见"
                                     gravity = Gravity.LEFT or Gravity.TOP
                                     background = null
@@ -632,28 +644,40 @@ class BuySellInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
                                 }.lparams(matchParent, matchParent) {
 
                                 }
-                            }.lparams(autoSize(432), autoSize(220)) {
+                            }.lparams(matchParent, autoSize(220)) {
+                                marginEnd = autoSize(47)
                                 marginStart = autoSize(138)
                             }
                         }.lparams(matchParent, autoSize(220)){
                             topMargin = autoSize(50)
                             bottomMargin = autoSize(40)
                         }
-                    }
+                    }.lparams(autoSize(900), matchParent)
                 }
 
                 linearLayout {
                     background = resources.getDrawable(R.color.white)
                     gravity = Gravity.CENTER_VERTICAL
-                    visibility = if (type == "1"){
+                    visibility = if (type == "1" || type == "2"){
                         View.VISIBLE
                     }else{
                         View.GONE
                     }
                     textView {
                         onThrottleFirstClick {
-
-
+                            viewModel.auditAreaInOutStockApply(
+                                InOutApplyID = data.inoutapplyid?.toLong() ?: 0,
+                                AuditRemark = ramask_edittext.text.toString(),
+                                AuditTradeDate = TimeUtils.getNowString(SimpleDateFormat("yyyyMMdd")),
+                                ApplyStatus = 3
+                            ){
+                                finish()
+                            }
+                        }
+                         visibility = if (type == "1"){
+                            View.VISIBLE
+                        }else{
+                            View.GONE
                         }
                         gravity = Gravity.CENTER
                         backgroundResource = R.mipmap.rma_save_info_bg
@@ -666,8 +690,17 @@ class BuySellInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
 
                     textView {
                         onThrottleFirstClick {
-
-
+                            viewModel.getAreaInOutApplyAuditPass(
+                                InOutApplyID = data.inoutapplyid?.toLong() ?: 0,
+                                Remark = ramask_edittext.text.toString()
+                            ){
+                                finish()
+                            }
+                        }
+                         visibility = if (type == "1"){
+                            View.VISIBLE
+                        }else{
+                            View.GONE
                         }
                         gravity = Gravity.CENTER
                         backgroundResource = R.mipmap.rma_submit_bg
@@ -680,7 +713,14 @@ class BuySellInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
 
                     textView {
                         onThrottleFirstClick {
-
+                            viewModel.auditAreaInOutStockApply(
+                                InOutApplyID = data.inoutapplyid?.toLong() ?: 0,
+                                AuditRemark = ramask_edittext.text.toString(),
+                                AuditTradeDate = TimeUtils.getNowString(SimpleDateFormat("yyyyMMdd")),
+                                ApplyStatus = 5
+                            ){
+                                finish()
+                            }
                         }
                         visibility = if (type == "2"){
                             View.VISIBLE
@@ -698,7 +738,7 @@ class BuySellInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
                 }.lparams(matchParent, autoSize(144)) {
                     gravity = Gravity.BOTTOM
                 }
-            }
+            }.lparams(matchParent, matchParent)
         }
     }
 

+ 85 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/InventoryAuditViewModel.kt

@@ -4,15 +4,24 @@ import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.global.*
 import cn.muchinfo.rma.global.data.AreaStockApplyData
 import cn.muchinfo.rma.global.data.ColumnsData
+import cn.muchinfo.rma.netManage.base.InteractiveException
 import cn.muchinfo.rma.view.MyApplication
 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 kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+import mtp.polymer.com.autowidget.utils.TaskUiModel
 
 class InventoryAuditViewModel : BaseViewModel(){
 
     /**
+     * 加载状态控制
+     */
+    val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
+
+    /**
      * 库存审核部数据
      */
     val inventoryToAuditTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
@@ -115,5 +124,81 @@ class InventoryAuditViewModel : BaseViewModel(){
         return newList
     }
 
+    /**
+     * 机构出入库申请审核拒绝撤回请求
+     * @param InOutApplyID Long uint64 申请ID
+     * @param AuditID Long uint64 审核人
+     * @param AuditRemark String string 审核备注
+     * @param AuditTradeDate String string 审核交易日(yyyyMMdd)
+     * @param ApplyStatus Int int32 审核状态:3-审核拒绝 5-已撤回
+     */
+    fun auditAreaInOutStockApply(
+        InOutApplyID: Long,
+        AuditRemark: String = "",
+        AuditTradeDate: String = "",
+        ApplyStatus: Int,
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.warehouseManager?.auditAreaInOutStockApplyReq(
+                InOutApplyID = InOutApplyID,
+                AuditRemark = AuditRemark,
+                AuditTradeDate = AuditTradeDate,
+                ApplyStatus = ApplyStatus
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+    /**
+     * 机构出入库申请审核通过请求报文装箱
+     * @param InOutApplyID Long
+     * @param Remark String
+     *  optional MessageHead Header = 1; // MessageHead
+    optional uint64 InOutApplyID = 2; // uint64 操作申请ID(607+Unix秒时间戳(10位)+xxxxxx)
+    optional uint64 AuditID = 3; // uint64 操作用户ID
+    optional uint32 AuditSrc = 4; // uint32 操作来源-1:管理端2:终端
+    optional string Remark = 5; // string 备注
+    optional string ClientTicket = 6; // string 客户端流水号
+     */
+    fun getAreaInOutApplyAuditPass(
+        InOutApplyID : Long,
+        Remark : String = "",
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.warehouseManager?.getAreaInOutApplyAuditPassReq(
+                InOutApplyID = InOutApplyID,
+                Remark = Remark
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
 
 }

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

@@ -99,7 +99,7 @@ public class InventoryContentAdapter extends RecyclerView.Adapter<InventoryConte
             itemViewHolder.exposure_allView.setVisibility(View.GONE);
         }
 
-        itemViewHolder.exposure_all_click_View.setOnClickListener(new View.OnClickListener() {
+        itemViewHolder.exposure_roots_view.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
                 setPosition(i);
@@ -187,9 +187,9 @@ public class InventoryContentAdapter extends RecyclerView.Adapter<InventoryConte
 
     public static class ItemViewHolder extends RecyclerView.ViewHolder {
         LinearLayout exposure_roots_view;//根部布局
-        TextView spot_subsidiary;//现货明细
-        TextView futures_subsidiary;//期货明细
-        TextView place_the_order;//下单
+        TextView spot_subsidiary;//撤回
+        TextView futures_subsidiary;//审核
+        TextView place_the_order;//详情
         LinearLayout exposure_allView;//隐藏的底部操作空间
         LinearLayout exposure_all_click_View;//item左侧点击控件
         TextView exposure_tvLeftTitle;//左边

+ 40 - 33
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventoryaudit/ProductionInventoryActivity.kt

@@ -13,7 +13,11 @@ import cn.muchinfo.rma.global.isBlankString
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.TimeUtils
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
 import org.jetbrains.anko.*
+import java.text.SimpleDateFormat
 
 /**
  * 生产入库/出库审核
@@ -35,6 +39,8 @@ class ProductionInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
         intent.getParcelableExtra<AreaStockApplyData>("data") as AreaStockApplyData
     }
 
+    private val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
+
     /**
      * 审核意见
      */
@@ -43,6 +49,7 @@ class ProductionInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            dialog.bindTaskStatus(context, viewModel.loadingDialogStatus)
             background = resources.getDrawable(R.color.main_hit_bg_color)
             val margingPadding = autoSize(47)
             topBar {
@@ -413,33 +420,6 @@ class ProductionInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
                                 }.lparams(matchParent, wrapContent)
                             }.lparams(autoSize(450), wrapContent)
 
-
-                             linearLayout {
-                                textView {
-                                    text = "审核意见"
-                                    textColorInt = R.color.p_normal_summary_txt_color
-                                    textSizeAuto = 29
-                                }.lparams(wrapContent, wrapContent) {
-                                    marginStart = margingPadding
-                                }
-
-                                linearLayout {
-                                    emptyView()
-                                    textView {
-                                        text = data.audittime?.split(" ")?.get(0)
-                                        textSizeAuto = 29
-                                        textColorInt = R.color.rma_black_33
-                                    }.lparams(wrapContent, wrapContent)
-
-                                    textView {
-                                        text = data.audittime?.split(" ")?.get(1)
-                                        textSizeAuto = 17
-                                        textColorInt = R.color.rma_black_33
-                                    }.lparams(wrapContent, wrapContent)
-
-                                }.lparams(matchParent, wrapContent)
-
-                            }.lparams(autoSize(450), wrapContent)
                         }.lparams(matchParent, autoSize(60))
 
                         linearLayout {
@@ -514,15 +494,26 @@ class ProductionInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
                 linearLayout {
                     background = resources.getDrawable(R.color.white)
                     gravity = Gravity.CENTER_VERTICAL
-                    visibility = if (type == "1"){
+                    visibility = if (type == "1" || type == "2"){
                         View.VISIBLE
                     }else{
                         View.GONE
                     }
                     textView {
                         onThrottleFirstClick {
-
-
+                            viewModel.auditAreaInOutStockApply(
+                                InOutApplyID = data.inoutapplyid?.toLong() ?: 0,
+                                AuditRemark = ramask_edittext.text.toString(),
+                                AuditTradeDate = TimeUtils.getNowString(SimpleDateFormat("yyyyMMdd")),
+                                ApplyStatus = 3
+                            ){
+                                finish()
+                            }
+                        }
+                        visibility = if (type == "1"){
+                            View.VISIBLE
+                        }else{
+                            View.GONE
                         }
                         gravity = Gravity.CENTER
                         backgroundResource = R.mipmap.rma_save_info_bg
@@ -535,8 +526,17 @@ class ProductionInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
 
                     textView {
                         onThrottleFirstClick {
-
-
+                            viewModel.getAreaInOutApplyAuditPass(
+                                InOutApplyID = data.inoutapplyid?.toLong() ?: 0,
+                                Remark = ramask_edittext.text.toString()
+                            ){
+                                finish()
+                            }
+                        }
+                        visibility = if (type == "1"){
+                            View.VISIBLE
+                        }else{
+                            View.GONE
                         }
                         gravity = Gravity.CENTER
                         backgroundResource = R.mipmap.rma_submit_bg
@@ -549,7 +549,14 @@ class ProductionInventoryActivity : BaseActivity<InventoryAuditViewModel>(){
 
                     textView {
                         onThrottleFirstClick {
-
+                            viewModel.auditAreaInOutStockApply(
+                                InOutApplyID = data.inoutapplyid?.toLong() ?: 0,
+                                AuditRemark = ramask_edittext.text.toString(),
+                                AuditTradeDate = TimeUtils.getNowString(SimpleDateFormat("yyyyMMdd")),
+                                ApplyStatus = 5
+                            ){
+                                finish()
+                            }
                         }
                         visibility = if (type == "2"){
                             View.VISIBLE

+ 201 - 18
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/inventory/inventorymanager/AddInventoryActivity.kt

@@ -5,34 +5,62 @@ import android.view.Gravity
 import android.view.View
 import android.view.inputmethod.EditorInfo
 import android.widget.EditText
+import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.WrStandardDetail
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import cn.muchinfo.rma.view.base.home.contract.baseInformationView
 import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.ToastUtils
+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.utils.bindTaskStatus
 import org.jetbrains.anko.*
 
 /**
  *  入库登记/出库登记
  */
-class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
+class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>() {
 
     /**
      * 输入的数量
      */
-    lateinit var contact_edittext : EditText
+    private lateinit var contact_edittext: EditText
 
+    /**
+     * 选择的出入库类型
+     */
+    private val inventoryTypeSelect: MutableLiveData<SelectData> = MutableLiveData()
+
+    /** 选择的现货商品类型 */
+    private val selectWrStandardData: MutableLiveData<SelectData> = MutableLiveData()
+
+    /** 选择的型号类型/品类 **/
+    private val selectWrStandModel: MutableLiveData<SelectData> = MutableLiveData()
 
+    /** 选择的品牌 ***/
+    private val selectWrStandBrand: MutableLiveData<SelectData> = MutableLiveData()
+
+    /** 选择的仓库 **/
+    private val selectWareHouse: MutableLiveData<SelectData> = MutableLiveData()
+
+    private val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            dialog.bindTaskStatus(context, viewModel.loadingDialogStatus)
+            viewModel.queryWrStandardList()//查询现货列表
+            viewModel.queryWarehouseInfo()//查询可选择的仓库信息
             background = resources.getDrawable(R.color.main_hit_bg_color)
             topBar {
                 commonLeftButton()
                 commonTitle {
-                    text = "入库登记"
+                    text = "入库登记"
                 }
             }
 
@@ -40,7 +68,14 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
+                    val selectDataList = arrayListOf(
+                        SelectData(id = "3", value = "生产入库"),
+                        SelectData(id = "4", value = "生产出库")
+                    )
 
+                    creatBottomSheetDialog("请选择入库类型", selectDataList) {
+                        inventoryTypeSelect.postValue(this)
+                    }
                 }
                 textView {
                     text = "*"
@@ -59,6 +94,10 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 }
 
                 textView {
+                    inventoryTypeSelect.bindOptional(context) {
+                        text = it?.value
+                        textColorInt = R.color.rma_black_33
+                    }
                     text = "请选择入库类型"
                     textSizeAuto = 31
                     textColorInt = R.color.rma_hint_text_color_ccc
@@ -81,7 +120,15 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
-
+                    creatBottomSheetDialog(
+                        "请选择现货品种",
+                        viewModel.selectSpotVarietiesList(
+                            viewModel.wrStandardDataList.value ?: arrayListOf()
+                        )
+                    ) {
+                        selectWrStandardData.postValue(this)
+                        viewModel.queryWrStandardDetail(this.id)
+                    }
                 }
                 textView {
                     text = "*"
@@ -100,6 +147,10 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 }
 
                 textView {
+                    selectWrStandardData.bindOptional(context) {
+                        text = it?.value
+                        textColorInt = R.color.rma_black_33
+                    }
                     text = "请选择入库现货品种"
                     textSizeAuto = 31
                     textColorInt = R.color.rma_hint_text_color_ccc
@@ -122,7 +173,15 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
-
+                    creatBottomSheetDialog(
+                        "请选择品类",
+                        viewModel.selectWrStandardModel(
+                            viewModel.wrStandardDataDetail.value
+                                ?: WrStandardDetail()
+                        )
+                    ) {
+                        selectWrStandModel.postValue(this)
+                    }
                 }
                 textView {
                     text = "*"
@@ -141,6 +200,10 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 }
 
                 textView {
+                    selectWrStandModel.bindOptional(context) {
+                        text = it?.value
+                        textColorInt = R.color.rma_black_33
+                    }
                     text = "请选择品类"
                     textSizeAuto = 31
                     textColorInt = R.color.rma_hint_text_color_ccc
@@ -163,7 +226,15 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
-
+                    creatBottomSheetDialog(
+                        "请选择品牌",
+                        viewModel.selectWrStandardBrand(
+                            viewModel.wrStandardDataDetail.value
+                                ?: WrStandardDetail()
+                        )
+                    ) {
+                        selectWrStandBrand.postValue(this)
+                    }
                 }
                 textView {
                     text = "*"
@@ -182,6 +253,10 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 }
 
                 textView {
+                    selectWrStandBrand.bindOptional(context) {
+                        text = it?.value
+                        textColorInt = R.color.rma_black_33
+                    }
                     text = "请选择品牌"
                     textSizeAuto = 31
                     textColorInt = R.color.rma_hint_text_color_ccc
@@ -204,7 +279,12 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
-
+                    val selectDataList = viewModel.setSelectWarehouseList(
+                        viewModel.normalWarehouseInfo.value ?: arrayListOf()
+                    )
+                    creatBottomSheetDialog("请选择出入库仓库", selectDataList) {
+                        selectWareHouse.postValue(this)
+                    }
                 }
                 textView {
                     text = "*"
@@ -215,7 +295,14 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 }
 
                 textView {
-                    text = "入库仓库"
+                    inventoryTypeSelect.bindOptional(context) {
+                        if (it?.id == "3") {
+                            text = "入库仓库"
+                        } else if (it?.id == "4") {
+                            text = "出库仓库"
+                        }
+                    }
+                    text = "出入库仓库"
                     textSizeAuto = 31
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent) {
@@ -223,7 +310,18 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 }
 
                 textView {
-                    text = "请选择入库仓库"
+                    selectWareHouse.bindOptional(context) {
+                        text = it?.value
+                        textColorInt = R.color.rma_black_33
+                    }
+                    inventoryTypeSelect.bindOptional(context) {
+                        if (it?.id == "3") {
+                            text = "请选择入库仓库"
+                        } else if (it?.id == "4") {
+                            text = "请选择出库仓库"
+                        }
+                    }
+                    text = "请选择出入库仓库"
                     textSizeAuto = 31
                     textColorInt = R.color.rma_hint_text_color_ccc
                 }.lparams(wrapContent, wrapContent) {
@@ -246,7 +344,6 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 gravity = Gravity.CENTER_VERTICAL
 
                 textView {
-                    visibility = View.INVISIBLE
                     text = "*"
                     textColorInt = R.color.rma_star_color
                     textSizeAuto = 31
@@ -254,7 +351,14 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                     marginStart = autoSize(37)
                 }
                 textView {
-                    text = "联  系  人"
+                    inventoryTypeSelect.bindOptional(context) {
+                        if (it?.id == "3") {
+                            text = "入库数量"
+                        } else if (it?.id == "4") {
+                            text = "出库数量"
+                        }
+                    }
+                    text = "出入库数量"
                     textSizeAuto = 31
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent) {
@@ -262,10 +366,18 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
                 }
 
                 editText {
+                    inventoryTypeSelect.bindOptional(context) {
+                        if (it?.id == "3") {
+                            hint = "请输入入库数量"
+                        } else if (it?.id == "4") {
+                            hint = "请输入出库数量"
+                        }
+                    }
                     contact_edittext = this
-                    hint = "请输入联系人"
+                    hint = "请输入出入库数量"
                     background = null
-                    inputType = EditorInfo.TYPE_CLASS_TEXT
+                    inputType = EditorInfo.TYPE_CLASS_NUMBER
+                    setDecimalInputType()
                     hintColorStr = "#CCCCCC"
                     textSizeAuto = 31
                     textColorStr = "#333333"
@@ -287,29 +399,100 @@ class AddInventoryActivity : BaseActivity<InventoryManagerViewModel>(){
             }.lparams(matchParent, autoSize(132))
 
 
-            view { }.lparams(autoSize(1),0 , 1f)
+            view { }.lparams(autoSize(1), 0, 1f)
 
 
             linearLayout {
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
 
-
                 onThrottleFirstClick {
-
+                    if (checkUpdate().not()) {
+                        return@onThrottleFirstClick
+                    }
+                    /**
+                     * 机构出入库申请请求
+                     * @param InOutType Int int32 出入库类型 - 1:采购入库 2:销售出库 3:生产入库 4:生产出库
+                     * @param WRStandardID Long uint64 现货商品ID
+                     * @param SpotGoodsModelID Long uint64 现货型号ID/品类
+                     * @param SpotGoodsBrandID Long uint64 现货品牌ID
+                     * @param DeliveryGoodsID Long uint64 现货品种ID
+                     * @param SpotContractID Long uint64 关联现货合同ID [1:采购入库 2:销售出库 ](1,2状态必填)
+                     * @param WarehouseInfo Long uint64 现货仓库ID
+                     * @param Qty Double double 数量
+                     * @param ApplyId Long uint64 申请人
+                     * @param ApplyRemark String string 申请备注
+                     */
+                    viewModel.areaInOutStockApply(
+                        InOutType = inventoryTypeSelect.value?.id?.toInt() ?: 0,
+                        WRStandardID = selectWrStandardData.value?.id?.toLong() ?: 0,
+                        SpotGoodsModelID = selectWrStandModel.value?.id?.toLong() ?: 0,
+                        SpotGoodsBrandID = selectWrStandBrand.value?.id?.toLong() ?: 0,
+                        DeliveryGoodsID = selectWrStandardData.value?.deliverygoodsid?.toLong()
+                            ?: 0,
+                        WarehouseInfo = selectWareHouse.value?.id?.toLong() ?: 0,
+                        Qty = contact_edittext.text.toString().toDouble()
+                    ) {
+                        finish()
+                    }
                 }
 
                 textView {
-                    text = "入库登记"
+                    inventoryTypeSelect.bindOptional(context) {
+                        if (it?.id == "3") {
+                            text = "入库登记"
+                        } else if (it?.id == "4") {
+                            text = "出库登记"
+                        }
+                    }
+                    text = "出入库登记"
                     gravity = Gravity.CENTER
                     backgroundResource = R.mipmap.rma_save_info_bg
                     textSizeAuto = 38
                     textColorInt = R.color.rma_star_color
-                }.lparams(autoSize(780), autoSize(119)) {
+                }.lparams(matchParent, autoSize(119)) {
                     marginStart = autoSize(24)
+                    marginEnd = autoSize(24)
                 }
             }.lparams(matchParent, autoSize(144))
         }
     }
 
+    /**
+     * 出入库登记前的校验
+     * @return Boolean
+     */
+    private fun checkUpdate(): Boolean {
+        if (inventoryTypeSelect.value?.id.isNullOrEmpty()) {
+            ToastUtils.showLong("请选择出入库类型")
+            return false
+        }
+
+        if (selectWrStandardData.value?.id.isNullOrEmpty()) {
+            ToastUtils.showLong("请选择现货品种")
+            return false
+        }
+
+        if (selectWrStandModel.value?.id.isNullOrEmpty()) {
+            ToastUtils.showLong("请选择现货品种品类")
+            return false
+        }
+
+        if (selectWrStandBrand.value?.id.isNullOrEmpty()) {
+            ToastUtils.showLong("请选择现货品种型号")
+            return false
+        }
+
+        if (selectWareHouse.value?.id.isNullOrEmpty()) {
+            ToastUtils.showLong("请选择仓库")
+            return false
+        }
+
+        if (contact_edittext.text.toString().isNullOrEmpty()) {
+            ToastUtils.showLong("请输入数量")
+            return false
+        }
+        return true
+    }
+
 }

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

@@ -1,12 +1,15 @@
 package cn.muchinfo.rma.view.base.home.inventory.inventorymanager
 
+import android.annotation.SuppressLint
 import android.os.Bundle
 import android.view.Gravity
 import android.view.MotionEvent
 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.AreaStockReportDetailData
+import cn.muchinfo.rma.global.isBlankString
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
@@ -17,31 +20,72 @@ import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
 import com.blankj.utilcode.util.SizeUtils
 import org.jetbrains.anko.*
 
-class InventoryDetailsActivity : BaseActivity<InventoryManagerViewModel>(),InventoryDetailsAdapter.OnContentScrollListener {
+/**
+ * 出入库明细列表页面
+ * @property type String?
+ * @property data AreaStockReportDetailData
+ * @property titleType String?
+ * @property querytype String?
+ * @property swipeToLayout SwipeToLoadLayout
+ * @property statusLayout StatusLayout
+ * @property horScrollview CustomHorizontalScrollView
+ * @property recyclerView RecyclerView
+ * @property topAdapter TopTabAdpater
+ * @property exposureContentAdapter InventoryDetailsAdapter
+ */
+class InventoryDetailsActivity : BaseActivity<InventoryManagerViewModel>(),
+    InventoryDetailsAdapter.OnContentScrollListener {
 
     /**
-     * type 1 入库明细 2 出库明细
+     * isFrom 1 是通过库存管理跳转过来的  2 是通过报表查询页面跳转过来的
      */
-    private val type by lazy { intent.getStringExtra("type") }
+    private val isFrom by lazy { intent.getStringExtra("isFrom") }
 
-    private val data by lazy { intent.getParcelableExtra<AreaStockReportDetailData>("data") as AreaStockReportDetailData }
+    private val data by lazy { intent.getParcelableExtra<AreaStockData>("data") as AreaStockData }
 
+    //列头
+    private val title by lazy { intent.getStringExtra("title") }
 
     /**
-     *
-      库存报表-入库明细
-      const val table_mobile_stock_report_in_detail = "table_mobile_stock_report_in_detail"
+     * 通过报表页面进入需要的参数 明细类型 1:入库明细(采购入库+生产入库) 2:出库明细(销售出库+生产出库)
+    库存报表-入库明细
+    const val table_mobile_stock_report_in_detail = "table_mobile_stock_report_in_detail"
 
-      库存报表-出库明细
-      const val table_mobile_stock_report_out_detail = "table_mobile_stock_report_out_detail"
+    库存报表-出库明细
+    const val table_mobile_stock_report_out_detail = "table_mobile_stock_report_out_detail"
      */
-    private val titleType by lazy { intent.getStringExtra("titleType") }
+    private val detailtype by lazy { intent.getStringExtra("detailtype") }
 
     /**
-     * 是日报表明细还是月报表明细 1 日报表 2月报表
+     *  通过报表页面进入需要的参数 是日报表明细还是月报表明细 1 日报表 2月报表
      */
     private val querytype by lazy { intent.getStringExtra("querytype") }
 
+    /**
+     * 通过报表页面进入需要的参数 查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)
+     */
+    private val querydate by lazy { intent.getStringExtra("querydate") }
+
+    /**
+     * 通过报表页面进入需要的参数 : 现货商品ID
+     */
+    private val wrstandardid by lazy { intent.getStringExtra("wrstandardid") }
+
+    /**
+     * 通过报表页面进入需要的参数 : 品牌ID
+     */
+    private val spotgoodsbrandid by lazy { intent.getStringExtra("spotgoodsbrandid") }
+
+    /**
+     * 通过报表页面进入需要的参数 : 型号ID
+     */
+    private val spotgoodsmodelid by lazy { intent.getStringExtra("spotgoodsmodelid") }
+
+    /**
+     * 通过报表页面进入需要的参数 : 仓库ID
+     */
+    private val warehouseinfoid by lazy { intent.getStringExtra("warehouseinfoid") }
+
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
     lateinit var horScrollview: CustomHorizontalScrollView
@@ -52,22 +96,33 @@ class InventoryDetailsActivity : BaseActivity<InventoryManagerViewModel>(),Inven
     }
 
     val exposureContentAdapter by lazy {
-        InventoryDetailsAdapter(this,type)
+        InventoryDetailsAdapter(this, detailtype)
     }
 
+    @SuppressLint("SetTextI18n")
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
-
-            viewModel.queryDetailsTitle(title = titleType ?: "")
+            //进入页面查询列头
+            viewModel.queryDetailsTitle(
+                title = title ?: "",
+                isFrom = isFrom ?: "",
+                detailtype = detailtype ?: "",
+                querytype = querytype ?: "",
+                querydate = querydate ?: "",
+                wrstandardid = wrstandardid ?: "",
+                spotgoodsbrandid = spotgoodsbrandid ?: "",
+                spotgoodsmodelid = spotgoodsmodelid ?: "",
+                warehouseinfoid = warehouseinfoid ?: ""
+            )
             exposureContentAdapter.setOnContentScrollListener(this@InventoryDetailsActivity)
-            background = resources.getDrawable(R.color.main_hit_bg_color)
+            background = resources.getDrawable(R.color.white)
             topBar {
                 commonLeftButton()
                 commonTitle {
-                    if (type == "1"){
+                    if (detailtype == "1") {
                         text = "库存报表-入库明细"
-                    }else{
+                    } else {
                         text = "库存报表-出库明细"
                     }
                 }
@@ -77,10 +132,10 @@ class InventoryDetailsActivity : BaseActivity<InventoryManagerViewModel>(),Inven
                 gravity = Gravity.CENTER_VERTICAL
                 background = resources.getDrawable(R.color.rma_blue_color)
                 textView {
-                    text = "现货品种:" + data.wrstandardname
+                    text = "现货品种:" + data.wrstandardname?.isBlankString()
                     textSizeAuto = 31
                     textColorInt = R.color.white
-                }.lparams(wrapContent, wrapContent){
+                }.lparams(wrapContent, wrapContent) {
                     marginStart = autoSize(47)
                 }
             }.lparams(matchParent, autoSize(60))

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

@@ -1,5 +1,6 @@
 package cn.muchinfo.rma.view.base.home.inventory.inventorymanager
 
+import android.content.Intent
 import android.os.Bundle
 import android.view.Gravity
 import android.view.MotionEvent
@@ -20,6 +21,7 @@ import cn.muchinfo.rma.view.base.home.inventory.inventoryaudit.InventoryContentA
 import cn.muchinfo.rma.view.base.home.inventory.inventorymanager.adapter.ApplyRecordAdapter
 import cn.muchinfo.rma.view.base.home.inventory.inventorymanager.adapter.InventoryCurrentAdapter
 import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
+import com.blankj.utilcode.util.ActivityUtils
 import com.blankj.utilcode.util.ConvertUtils
 import com.blankj.utilcode.util.SizeUtils
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
@@ -95,7 +97,9 @@ class InventoryManagerActivity : BaseActivity<InventoryManagerViewModel>() {
                 }
                 // 新增客户申请
                 commonMenuButton(R.mipmap.add_new) {
-
+                    val intent = Intent()
+                    intent.setClass(context,AddInventoryActivity::class.java)
+                    ActivityUtils.startActivity(intent)
                 }
             }
 
@@ -323,7 +327,7 @@ class ApplyRecordUI(
 
     val root = _FrameLayout(activity).apply {
         verticalLayout {
-            viewModel.queryTitle(title = Constant.table_mobile_stock_manage_applylog, type = "1")
+            viewModel.queryTitle(title = Constant.table_mobile_stock_manage_applylog, type = "2")
             exposureContentAdapter.setOnContentScrollListener(this@ApplyRecordUI)
 
             linearLayout {

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

@@ -2,19 +2,27 @@ package cn.muchinfo.rma.view.base.home.inventory.inventorymanager
 
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.global.GlobalDataCollection
-import cn.muchinfo.rma.global.data.AreaStockApplyData
-import cn.muchinfo.rma.global.data.AreaStockData
-import cn.muchinfo.rma.global.data.AreaStockReportDetailData
-import cn.muchinfo.rma.global.data.ColumnsData
+import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.global.inouttype
 import cn.muchinfo.rma.global.inventoryapplystatus
+import cn.muchinfo.rma.netManage.base.InteractiveException
 import cn.muchinfo.rma.view.MyApplication
 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 kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+import mtp.polymer.com.autowidget.dialog.SelectData
+import mtp.polymer.com.autowidget.utils.TaskUiModel
 
-class InventoryManagerViewModel : BaseViewModel(){
+class InventoryManagerViewModel : BaseViewModel() {
+
+    /**
+     * 加载状态控制
+     */
+    val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
 
     /**
      * 库存管理当前库存头部数据
@@ -22,19 +30,19 @@ class InventoryManagerViewModel : BaseViewModel(){
     val inventoryCurrentTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
 
     /**
-     * 库存管理当前库存头部数据
+     * 库存管理申请记录头部数据
      */
     val applyRecordTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
 
     /**
      * 库存管理当前库存列表数据
      */
-    val inventoryCurrenttDataList : MutableLiveData<List<AreaStockData>> = MutableLiveData()
+    val inventoryCurrenttDataList: MutableLiveData<List<AreaStockData>> = MutableLiveData()
 
     /**
-     * 库存管理当前库存列表数据
+     * 库存管理申请记录列表数据
      */
-    val applyRecordDataList : MutableLiveData<List<AreaStockApplyData>> = MutableLiveData()
+    val applyRecordDataList: MutableLiveData<List<AreaStockApplyData>> = MutableLiveData()
 
     /**
      * 报表明细头部列表
@@ -44,13 +52,28 @@ class InventoryManagerViewModel : BaseViewModel(){
     /**
      * 报表明细列表数据
      */
-    val inventoryDetailsDataList: MutableLiveData<List<AreaStockReportDetailData>> = MutableLiveData()
+    val inventoryDetailsDataList: MutableLiveData<List<AreaStockApplyData>> = MutableLiveData()
+
+    /**
+     * 现货品种列表
+     */
+    val wrStandardDataList: MutableLiveData<List<WrStandardData>> = MutableLiveData()
+
+    /**
+     * 现货品种详情
+     */
+    val wrStandardDataDetail: MutableLiveData<WrStandardDetail> = MutableLiveData()
+
+    /**
+     * 仓库信息的正常列表
+     */
+    val normalWarehouseInfo: MutableLiveData<List<WarehouseInfoData>> = MutableLiveData()
 
     /**
      * 查询实时敞口列表头部数据 type 1 当前库存 2 申请记录
      * @param tableKey String
      */
-    fun queryTitle(title : String,type: String) {
+    fun queryTitle(title: String, type: String) {
         val params = mutableMapOf<String, String>().apply {
             put("tableKey", title)
             put("tableType", "3")
@@ -64,7 +87,7 @@ class InventoryManagerViewModel : BaseViewModel(){
                 if (type == "1") {
                     inventoryCurrentTitle.postValue(newlist)
                     queryAreaStock()
-                }else{
+                } else {
                     applyRecordTitle.postValue(newlist)
                     queryAreaStockApply()
                 }
@@ -74,10 +97,28 @@ class InventoryManagerViewModel : BaseViewModel(){
 
     /**
      * 列表头部数据 type 1 入库明细 2 出库明细
+     * isFrom 1 是通过库存管理跳转过来的  2 是通过报表查询页面跳转过来的
+     * querytype 通过报表页面进入需要的参数 是日报表明细还是月报表明细 1 日报表 2月报表
+     * detailtype 通过报表页面进入需要的参数 明细类型 1:入库明细(采购入库+生产入库) 2:出库明细(销售出库+生产出库)
+     * querydate 通过报表页面进入需要的参数 查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)
+     * wrstandardid 通过报表页面进入需要的参数 : 现货商品ID
+     * spotgoodsbrandid 通过报表页面进入需要的参数 : 品牌ID
+     * spotgoodsmodelid 通过报表页面进入需要的参数 : 型号ID
+     * warehouseinfoid 通过报表页面进入需要的参数 : 仓库ID
      * @param tableKey String
      */
     // TODO 这里的参数不知道传不传
-    fun queryDetailsTitle(title : String,querytype : String = "",detailtype : String = "",querydate : String = "") {
+    fun queryDetailsTitle(
+        title: String,
+        isFrom: String,
+        querytype: String = "",
+        detailtype: String = "",
+        querydate: String = "",
+        wrstandardid: String = "",
+        spotgoodsbrandid: String = "",
+        spotgoodsmodelid: String = "",
+        warehouseinfoid: String = ""
+    ) {
         val params = mutableMapOf<String, String>().apply {
             put("tableKey", title)
             put("tableType", "3")
@@ -89,27 +130,82 @@ class InventoryManagerViewModel : BaseViewModel(){
                     t1.orderindex?.toInt()?.minus(t2.orderindex?.toInt() ?: 0) ?: 0
                 })
                 inventoryDetailsTitle.postValue(newlist)
-                queryAreaStockReportDetail(querytype  ,detailtype ,querydate)
+                if (isFrom == "1"){
+                    queryAreaStockApply(detailtype)
+                }else{
+                    queryAreaStockReportDetail(querytype = querytype,detailtype = detailtype,querydate = querydate,wrstandardid = wrstandardid,spotgoodsbrandid = spotgoodsbrandid,spotgoodsmodelid = spotgoodsmodelid,warehouseinfoid = warehouseinfoid)
+                }
+            }
+        }
+    }
+
+    /**
+     * 查询库存申请(出入库记录|库存审核)从仓库管理页面进入的明细用这个接口
+     * detailtype 1 入库 2 出库
+     */
+    fun queryAreaStockApply(detailtype: String) {
+        val params = mutableMapOf<String, String>()
+        params.put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+        if (detailtype == "1") {
+            params.put("inouttype", "1,3")
+        } else {
+            params.put("inouttype", "2,4")
+        }
+
+        MyApplication.getInstance()?.warehouseManager?.queryAreaStockApply(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                /**
+                 * 对数据进行组装
+                 */
+                inventoryDetailsDataList.postValue(
+                    getinventoryDetailsRightData(
+                        respData ?: arrayListOf()
+                    )
+                )
             }
         }
     }
 
     /**
-     * 出入库报表明细
+     * 从报表页面进入出入库报表明细
      */
-    fun queryAreaStockReportDetail(querytype : String,detailtype : String,querydate : String){
+    fun queryAreaStockReportDetail(
+        querytype: String = "",
+        detailtype: 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("detailtype",detailtype)
-            put("querydate",querydate)
+            put("detailtype", detailtype)
+            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?.queryAreaStockReportDetail(params = params){isSuccess, respData, error ->
-            if (isSuccess){
+        MyApplication.getInstance()?.warehouseManager?.queryAreaStockReportDetail(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
                 /**
                  * 对数据进行组装
                  */
-                inventoryDetailsDataList.postValue(getinventoryDetailsRightData(respData ?: arrayListOf()))
+                inventoryDetailsDataList.postValue(
+                    getinventoryDetailsRightData(
+                        respData ?: arrayListOf()
+                    )
+                )
             }
         }
     }
@@ -118,12 +214,12 @@ class InventoryManagerViewModel : BaseViewModel(){
     /**
      * 查询库存申请(出入库记录|库存审核)
      */
-    fun queryAreaStockApply(){
+    fun queryAreaStockApply() {
         val params = mutableMapOf<String, String>()
-        params.put("userid",GlobalDataCollection.instance?.loginRsp?.userID.toString())
+        params.put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
 
-        MyApplication.getInstance()?.warehouseManager?.queryAreaStockApply(params = params){isSuccess, respData, error ->
-            if (isSuccess){
+        MyApplication.getInstance()?.warehouseManager?.queryAreaStockApply(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
                 applyRecordDataList.postValue(getapplyRecordRightData(respData ?: arrayListOf()))
             }
         }
@@ -132,13 +228,17 @@ class InventoryManagerViewModel : BaseViewModel(){
     /**
      * 查询机构库存(库存管理/当前库存)
      */
-    fun queryAreaStock(){
+    fun queryAreaStock() {
         val params = mutableMapOf<String, String>()
         params.put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
 
-        MyApplication.getInstance()?.warehouseManager?.queryAreaStock(params = params){isSuccess, respData, error ->
-            if (isSuccess){
-                inventoryCurrenttDataList.postValue(getInventoryAuditRightData(respData ?: arrayListOf()))
+        MyApplication.getInstance()?.warehouseManager?.queryAreaStock(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                inventoryCurrenttDataList.postValue(
+                    getInventoryAuditRightData(
+                        respData ?: arrayListOf()
+                    )
+                )
             }
         }
     }
@@ -148,11 +248,11 @@ class InventoryManagerViewModel : BaseViewModel(){
      * @param respData List<RealExposureData>
      * @return List<RealExposureData>
      */
-    private fun getInventoryAuditRightData(respData: List<AreaStockData>) : List<AreaStockData>{
+    private fun getInventoryAuditRightData(respData: List<AreaStockData>): List<AreaStockData> {
         val newList = arrayListOf<AreaStockData>()
         respData.forEach {
             val newRightData = arrayListOf<String>()
-            newRightData.add(it.modelname +"\n" +it.brandname)
+            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)
@@ -167,15 +267,20 @@ class InventoryManagerViewModel : BaseViewModel(){
      * @param respData List<RealExposureData>
      * @return List<RealExposureData>
      */
-    private fun getapplyRecordRightData(respData: List<AreaStockApplyData>) : List<AreaStockApplyData>{
+    private fun getapplyRecordRightData(respData: List<AreaStockApplyData>): List<AreaStockApplyData> {
         val newList = arrayListOf<AreaStockApplyData>()
         respData.forEach {
             val newRightData = arrayListOf<String>()
             newRightData.add(it.wrstandardname ?: "--")
-            newRightData.add(it.inouttype?.inouttype() + "\n" + NumberUtils.roundNum(it.qty,2) + it.enumdicname)
+            newRightData.add(
+                it.inouttype?.inouttype() + "\n" + NumberUtils.roundNum(
+                    it.qty,
+                    2
+                ) + it.enumdicname
+            )
             newRightData.add(it.applystatus?.inventoryapplystatus() ?: "--")
             newRightData.add(it.contractno ?: "--")
-            newRightData.add(it.modelname +"\n" +it.brandname)
+            newRightData.add(it.modelname + "\n" + it.brandname)
             newRightData.add(it.warehousename ?: "--")
             newRightData.add(it.applyname + "\n" + it.auditname)
             val newData = it.copy(rightData = newRightData)
@@ -190,13 +295,18 @@ class InventoryManagerViewModel : BaseViewModel(){
      *     type 1 入库明细 2出库明细
      * @return List<RealExposureData>
      */
-    private fun getinventoryDetailsRightData(respData: List<AreaStockReportDetailData>) : List<AreaStockReportDetailData>{
-        val newList = arrayListOf<AreaStockReportDetailData>()
+    private fun getinventoryDetailsRightData(respData: List<AreaStockApplyData>): List<AreaStockApplyData> {
+        val newList = arrayListOf<AreaStockApplyData>()
         respData.forEach {
             val newRightData = arrayListOf<String>()
-            newRightData.add(it.modelname +"\n" +it.brandname)
+            newRightData.add(it.modelname + "\n" + it.brandname)
             newRightData.add(it.warehousename ?: "--")
-            newRightData.add(it.inouttype?.inouttype() + "\n" + NumberUtils.roundNum(it.qty,2) + it.enumdicname)
+            newRightData.add(
+                it.inouttype?.inouttype() + "\n" + NumberUtils.roundNum(
+                    it.qty,
+                    2
+                ) + it.enumdicname
+            )
             newRightData.add(it.contractno ?: "--")
             newRightData.add(it.applyname + "\n" + it.auditname)
             val newData = it.copy(rightData = newRightData)
@@ -205,4 +315,174 @@ class InventoryManagerViewModel : BaseViewModel(){
         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)
+            }
+        }
+    }
+
+    /**
+     * 根据选择控件进行数据重新组装(现货品种列表)
+     * @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
+    }
+
+    /**
+     * 查询仓库信息
+     * 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 setSelectWarehouseList(dataList: List<WarehouseInfoData>): ArrayList<SelectData> {
+        val newCustomerList = arrayListOf<SelectData>()
+        dataList.forEach {
+            newCustomerList.add(
+                SelectData(
+                    id = it.autoid.toString() ?: "",
+                    value = it.warehousename ?: ""
+                )
+            )
+        }
+        return newCustomerList
+    }
+
+    /**
+     * 机构出入库申请请求
+     * @param InOutType Int int32 出入库类型 - 1:采购入库 2:销售出库 3:生产入库 4:生产出库
+     * @param WRStandardID Long uint64 现货商品ID
+     * @param SpotGoodsModelID Long uint64 现货型号ID
+     * @param SpotGoodsBrandID Long uint64 现货品牌ID
+     * @param DeliveryGoodsID Long uint64 现货品种ID
+     * @param SpotContractID Long uint64 关联现货合同ID [1:采购入库 2:销售出库 ](1,2状态必填)
+     * @param WarehouseInfo Long uint64 现货仓库ID
+     * @param Qty Double double 数量
+     * @param ApplyId Long uint64 申请人
+     * @param ApplyRemark String string 申请备注
+     */
+    fun areaInOutStockApply(
+        InOutType: Int = 0,
+        WRStandardID: Long = 0L,
+        SpotGoodsModelID: Long = 0L,
+        SpotGoodsBrandID: Long = 0L,
+        DeliveryGoodsID: Long = 0L,
+        SpotContractID: Long = 0L,
+        WarehouseInfo: Long = 0L,
+        Qty: Double,
+        ApplyId: Long = 0,
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ) {
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.warehouseManager?.areaInOutStockApplyReq(
+                InOutType = InOutType,
+                WRStandardID = WRStandardID,
+                SpotGoodsModelID = SpotGoodsModelID,
+                SpotGoodsBrandID = SpotGoodsBrandID,
+                DeliveryGoodsID = DeliveryGoodsID,
+                SpotContractID = SpotContractID,
+                WarehouseInfo = WarehouseInfo,
+                Qty = Qty,
+                ApplyId = ApplyId
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
 }

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

@@ -3,6 +3,7 @@ package cn.muchinfo.rma.view.base.home.inventory.inventorymanager.adapter;
 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;
@@ -25,8 +26,10 @@ import cn.muchinfo.rma.global.ViewEnumUtils;
 import cn.muchinfo.rma.global.data.AreaStockApplyData;
 import cn.muchinfo.rma.global.data.AreaStockData;
 import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
+import cn.muchinfo.rma.view.base.app.Constant;
 import cn.muchinfo.rma.view.base.home.inventory.inventoryaudit.BuySellInventoryActivity;
 import cn.muchinfo.rma.view.base.home.inventory.inventoryaudit.ProductionInventoryActivity;
+import cn.muchinfo.rma.view.base.home.inventory.inventorymanager.InventoryDetailsActivity;
 import cn.muchinfo.rma.view.base.procurement.RightScrollAdapter;
 
 /**
@@ -81,7 +84,12 @@ public class InventoryCurrentAdapter extends RecyclerView.Adapter<InventoryCurre
     @Override
     public void onBindViewHolder(@NonNull final ItemViewHolder itemViewHolder, int i) {
         this.index = i;
-        itemViewHolder.exposure_tvLeftTitle.setText(datas.get(i).getWrstandardname());
+        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);
@@ -112,19 +120,35 @@ 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("title", Constant.table_mobile_stock_report_in_detail);//出库明细的列头
+            intent.putExtra("querytype","");//日报表/月报表  这里不需要传入值
+            intent.putExtra("querydate","");//查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM) 此处不需要传
+            intent.putExtra("wrstandardid","");//现货商品ID 此处不需要传
+            intent.putExtra("spotgoodsbrandid","");//通过报表页面进入需要的参数 : 品牌ID 此处不需要传
+            intent.putExtra("spotgoodsmodelid","");//通过报表页面进入需要的参数 : 型号ID 此处不需要传
+            intent.putExtra("warehouseinfoid","");//通过报表页面进入需要的参数 : 仓库ID 此处不需要传
+            intent.setClass(context, InventoryDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
         });
         //出库明细
         itemViewHolder.place_the_order.setOnClickListener(view -> {
-//            Intent intent = new Intent();
-//            intent.putExtra("type","3");
-//            intent.putExtra("status",this.status);
-//            if (datas.get(i).getInouttype().equals("1") || datas.get(i).getInouttype().equals("2")){
-//                intent.setClass(context,BuySellInventoryActivity.class);
-//            }else {
-//                intent.setClass(context,ProductionInventoryActivity.class);
-//            }
-//            ActivityUtils.startActivity(intent);
+            Intent intent = new Intent();
+            intent.putExtra("isFrom","1");//从仓库管理页面进入
+            intent.putExtra("detailtype","2");//出库明细
+            intent.putExtra("data",datas.get(i));
+            intent.putExtra("title", Constant.table_mobile_stock_report_out_detail);//出库明细的列头
+            intent.putExtra("querytype","");//日报表/月报表  这里不需要传入值
+            intent.putExtra("querydate","");//查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM) 此处不需要传
+            intent.putExtra("wrstandardid","");//现货商品ID 此处不需要传
+            intent.putExtra("spotgoodsbrandid","");//通过报表页面进入需要的参数 : 品牌ID 此处不需要传
+            intent.putExtra("spotgoodsmodelid","");//通过报表页面进入需要的参数 : 型号ID 此处不需要传
+            intent.putExtra("warehouseinfoid","");//通过报表页面进入需要的参数 : 仓库ID 此处不需要传
+            intent.setClass(context, InventoryDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
         });
 
         itemViewHolder.exposure_horItemScrollview.setEventListener(event -> {

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

@@ -30,7 +30,7 @@ import cn.muchinfo.rma.view.base.procurement.RightScrollAdapter;
 public class InventoryDetailsAdapter extends RecyclerView.Adapter<InventoryDetailsAdapter.ItemViewHolder> {
 
     private Context context;
-    private List<AreaStockReportDetailData> datas;
+    private List<AreaStockApplyData> datas;
     private int index = -1;
     private int position = -1;
     private List<ItemViewHolder> mViewHolderList = new ArrayList<>();
@@ -52,7 +52,7 @@ public class InventoryDetailsAdapter extends RecyclerView.Adapter<InventoryDetai
         this.context = context;
     }
 
-    public void setDatas(List<AreaStockReportDetailData> datas) {
+    public void setDatas(List<AreaStockApplyData> datas) {
         this.datas = datas;
         notifyDataSetChanged();
     }
@@ -113,11 +113,10 @@ public class InventoryDetailsAdapter extends RecyclerView.Adapter<InventoryDetai
             }
         });
 
-        //入库明细
         itemViewHolder.futures_subsidiary.setOnClickListener(view -> {
 
         });
-        //出库明细
+
         itemViewHolder.place_the_order.setOnClickListener(view -> {
 //            Intent intent = new Intent();
 //            intent.putExtra("type","3");

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

@@ -52,7 +52,7 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
 
     /** tab标题 **/
     private val tabsArray: List<String> by lazy {
-        arrayListOf("财务报表", "敞口报表", "现货报表")
+        arrayListOf("财务报表", "敞口报表", "现货报表","库存报表")
     }
 
     /** 财务报表 **/
@@ -64,6 +64,9 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
     /** 现货报表 **/
     private val spotReportUI by lazy { SpotReportUI(this, viewModel) }
 
+    /** 库存报表 ***/
+    private val invertoryReportUI by lazy { InvertoryReportUI(this,viewModel) }
+
     private val pagerAdapter: PagerAdapter by lazy {
         object : PagerAdapter() {
 
@@ -95,6 +98,14 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
                             )
                         }
                     }
+                    3 -> {
+                        return invertoryReportUI.root.apply {//库存报表
+                            container.addView(
+                                this,
+                                ViewGroup.LayoutParams(matchParent, matchParent)
+                            )
+                        }
+                    }
                     else -> return super.instantiateItem(container, position)
                 }
             }
@@ -1126,10 +1137,14 @@ class SpotReportUI(
 //                bindTaskStatus(viewModule.status)
                 swipeToLoadLayout {
                     swipeToLayout = this
-                    setEnableRefresh(false)
+                    setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-
+                        if (viewModel.isselectSpotMonthOrDay.value == "1"){
+                            viewModel.qryReportDaySpot(tradedate = tradedate.replace("-",""))
+                        }else{
+                            viewModel.qryReportMonthSpot(tradedate = tradedate.replace("-",""))
+                        }
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)
@@ -1158,6 +1173,146 @@ class SpotReportUI(
 }
 
 /**
+ * 仓库报表
+ * @property activity AppCompatActivity
+ * @property viewModel ReportQueryViewModel
+ * @constructor
+ */
+class InvertoryReportUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: ReportQueryViewModel
+){
+
+    /**
+     * 查询所用的date 注意(页面显示时间规则yyyy-MM-dd,而接口请求规则yyyyMMdd,简直无fuck可说)
+     */
+    var tradedate: String = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400000),SimpleDateFormat("yyyy-MM-dd"))
+
+    /** 查询时间textview **/
+    lateinit var tradedatetextview: TextView
+
+    @RequiresApi(Build.VERSION_CODES.N)
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                linearLayout {
+                    onThrottleFirstClick {
+                        if (viewModel.isselectSpotMonthOrDay.value == "1"){
+                            viewModel.isselectSpotMonthOrDay.postValue("2")
+                        }else{
+                            viewModel.isselectSpotMonthOrDay.postValue("1")
+                        }
+                    }
+                    backgroundResource = R.drawable.rma_time_click_bg
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        viewModel.isselectSpotMonthOrDay.bindOptional(context){
+                            if (it == "1"){
+                                text = "日报表"
+                            }else if (it == "2"){
+                                text = "月报表"
+                            }
+                        }
+                        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(25), autoSize(25))
+
+                }.lparams(autoSize(264), autoSize(67)) {
+                    marginStart = autoSize(36)
+                }
+
+                linearLayout {
+                    onThrottleFirstClick {
+                        activity.showDataSelectDialog(type = viewModel.isselectSpotMonthOrDay.value.toString()) {
+                            tradedate = this
+                            tradedatetextview.text = this
+                        }
+                    }
+                    backgroundResource = R.drawable.rma_time_click_bg
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        tradedatetextview = this
+                        text = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400000),SimpleDateFormat("yyyy-MM-dd"))
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                        textSizeAuto = 31
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(18)
+                    }
+
+                    emptyView()
+
+                    imageView {
+                        imageResource = R.mipmap.rma_search_by_time
+                    }.lparams(autoSize(38), autoSize(38))
+                }.lparams(autoSize(264), autoSize(67)) {
+                    marginStart = autoSize(12)
+                }
+
+                linearLayout {
+                    onThrottleFirstClick {
+                        activity.showDataSelectDialog(type = viewModel.isselectSpotMonthOrDay.value.toString()) {
+                            tradedate = this
+                            tradedatetextview.text = this
+                        }
+                    }
+                    backgroundResource = R.drawable.rma_time_click_bg
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        tradedatetextview = this
+                        text = "现货品种"
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                        textSizeAuto = 31
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(18)
+                    }
+
+                    emptyView()
+
+                    imageView {
+                        imageResource = R.mipmap.rma_search_by_time
+                    }.lparams(autoSize(38), autoSize(38))
+                }.lparams(autoSize(264), autoSize(67)) {
+                    marginStart = autoSize(12)
+                }
+
+                textView {
+                    visibility = View.GONE
+                    onThrottleFirstClick {
+                        if (viewModel.isselectSpotMonthOrDay.value == "1"){
+                            viewModel.qryReportDaySpot(tradedate = tradedate.replace("-",""))
+                        }else{
+                            viewModel.qryReportMonthSpot(tradedate = tradedate.replace("-",""))
+                        }
+                    }
+                    gravity = Gravity.CENTER
+                    backgroundDrawable = createCommonBottomRoundBg(color = "#2481DD", corner = 5)
+                    text = "查询"
+                    textSizeAuto = 31
+                    textColorInt = R.color.white
+                }.lparams(autoSize(144), autoSize(67)) {
+                    marginStart = autoSize(12)
+                }
+
+            }.lparams(matchParent, autoSize(100))
+
+            linearLayout {
+
+            }.lparams(matchParent, autoSize(100))
+        }
+    }
+}
+
+/**
  * 财务报表-款项UI
  * @property activity AppCompatActivity
  * @property viewModel ReportQueryViewModel
@@ -1277,6 +1432,8 @@ class FinancialInvoiceUI(
     }
 }
 
+
+
 /**
  * 财务报表日报表头部
  * type  1 款项 2 发票
@@ -1411,4 +1568,4 @@ fun _LinearLayout.FinancialReportUiTitle() {
             }.lparams(wrapContent, wrapContent)
         }.lparams(autoSize(180), autoSize(97))
     }.lparams(matchParent, autoSize(97))
-}
+}

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

@@ -3,9 +3,11 @@ package cn.muchinfo.rma.view.base.home.reportquery
 import android.annotation.SuppressLint
 import android.content.Intent
 import android.view.Gravity
+import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.data.SpotReportData
+import cn.muchinfo.rma.global.isBlankString
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.autoSize
 import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
@@ -48,7 +50,7 @@ class SpotReportViewHolder(
                     gravity = Gravity.START
                     textView {
                         data.bindOptional(context) {
-                            text = it?.wrstandardname
+                            text = it?.wrstandardname?.isBlankString()
                         }
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
@@ -117,6 +119,13 @@ class SpotReportViewHolder(
                 }.lparams(autoSize(225), autoSize(97))
             }.lparams(matchParent, autoSize(100))
             linearLayout {
+                data.bindOptional(context) {
+                    if (it?.indexSelect == 0) {
+                        visibility = View.GONE
+                    } else if (it?.indexSelect == 1) {
+                        visibility = View.VISIBLE
+                    }
+                }
                 emptyView()
 
                 textView {

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

@@ -2,9 +2,12 @@ package cn.muchinfo.rma.view.base.procurement
 
 import android.os.Bundle
 import android.view.Gravity
+import android.view.MotionEvent
 import android.view.View
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
+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
@@ -18,15 +21,18 @@ import cn.muchinfo.rma.global.isShowTimeString
 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.app.Constant
 import cn.muchinfo.rma.view.base.home.business.BusinessManagementViewholder
 import cn.muchinfo.rma.view.base.home.commodity.viewholder.ChangeLogViewHolder
 import cn.muchinfo.rma.view.base.home.contract.viewItemUI
+import cn.muchinfo.rma.view.base.home.inventory.inventorymanager.adapter.ApplyRecordAdapter
 import cn.muchinfo.rma.view.base.procurement.data.ContractDetailsData
 import cn.muchinfo.rma.view.base.procurement.detailsviewholder.ChangeRecordViewHolder
 import cn.muchinfo.rma.view.base.procurement.detailsviewholder.ContractDetailsViewHolder
 import cn.muchinfo.rma.view.base.procurement.detailsviewholder.InvoiceRecordViewHolder
 import cn.muchinfo.rma.view.base.procurement.detailsviewholder.PriceRecordViewHolder
 import com.blankj.utilcode.util.ConvertUtils
+import com.blankj.utilcode.util.SizeUtils
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
 import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
 import com.qmuiteam.qmui.widget.tab.QMUITabSegment
@@ -47,8 +53,16 @@ class ContractDetailActivity : BaseActivity<ProcurementViewModel>() {
         intent.getParcelableExtra<ContractData>("data") as ContractData
     }
 
+    // type 1 采购 2 销售
+    private val type by lazy { intent.getStringExtra("type") }
+
     private val tabsArray: List<String> by lazy {
-        arrayListOf("合同详情", "点价登记", "结算登记", "款项登记", "发票登记", "变更记录")
+        if (type == "1") {
+            arrayListOf("合同详情", "点价登记", "结算登记", "款项登记", "发票登记","入库登记", "变更记录")
+        } else {
+            arrayListOf("合同详情", "点价登记", "结算登记", "款项登记", "发票登记","出库登记", "变更记录")
+        }
+
     }
 
     //合同详情
@@ -66,6 +80,9 @@ class ContractDetailActivity : BaseActivity<ProcurementViewModel>() {
     //发票登记
     private val invoiceRecordUI by lazy { InvoiceRecordUI(this, viewModel, data) }
 
+    //出入库记录
+    private val inventoryRecordUI by lazy { InventoryRecordUI(this, viewModel, data, type ?: "1") }
+
     //变更登记
     private val changeRecordUI by lazy { ChangeRecordUI(this, viewModel, data) }
 
@@ -117,6 +134,14 @@ class ContractDetailActivity : BaseActivity<ProcurementViewModel>() {
                         }
                     }
                     5 -> {
+                        return inventoryRecordUI.root.apply {
+                            container.addView(
+                                this,
+                                ViewGroup.LayoutParams(matchParent, matchParent)
+                            )
+                        }
+                    }
+                    6 -> {
                         return changeRecordUI.root.apply {
                             container.addView(
                                 this,
@@ -163,6 +188,7 @@ class ContractDetailActivity : BaseActivity<ProcurementViewModel>() {
                         selectedTabIndex = index
                     }
                 })
+                mode = QMUITabSegment.MODE_FIXED
                 setIndicator(
                     QMUITabIndicator(
                         QMUIDisplayHelper.dp2px(context, 2),
@@ -209,7 +235,8 @@ class ContractDetailsUI(
     private val data: ContractData
 ) {
 
-    private val unSubmitAdapter: BaseAdapter<ContractDetailsData, ContractDetailsViewHolder> = BaseAdapter { _, _ -> ContractDetailsViewHolder(activity) }
+    private val unSubmitAdapter: BaseAdapter<ContractDetailsData, ContractDetailsViewHolder> =
+        BaseAdapter { _, _ -> ContractDetailsViewHolder(activity) }
     val root = _FrameLayout(activity).apply {
         verticalLayout {
 
@@ -219,19 +246,49 @@ class ContractDetailsUI(
             }.lparams(matchParent, autoSize(1600))
 
             val datalist = arrayListOf<ContractDetailsData>(
-                ContractDetailsData(title = ViewEnumUtils.getContractType(data.contracttype ?: "") + "-" + ViewEnumUtils.getPriceType(data.pricetype ?: "") + "合同",content = data.contractno?.isBlankString() ?: ""),
-                ContractDetailsData(title = if (data.contracttype == "1") { "销售方" }else{ "采购方" },content = data.accountname ?: "" ),
-                ContractDetailsData(title = "现货品种",content = data.deliverygoodsname ?: ""),
-                ContractDetailsData(title = "产品类型",content = ViewEnumUtils.getProductType(data.producttype ?: "")),
-                ContractDetailsData(title = "产品规格",content = data.spotgoodsdesc ?: ""),
-                ContractDetailsData(title = "定价类型",content = ViewEnumUtils.getPriceType(data.pricetype ?: "")),
-                ContractDetailsData(title = "期货合约",content = data.goodsname ?: ""),
-                ContractDetailsData(title = "升贴水",content = data.pricemove ?: ""),
-                ContractDetailsData(title = "标仓系数",content = data.convertfactor ?: ""),
-                ContractDetailsData(title = "点价期",content = data.startdate?.isShowTimeString("MM-dd") + "~" + data.enddate?.isShowTimeString("MM-dd")),
-                ContractDetailsData(title = "交收期",content = data.deliverystartdate?.isShowTimeString("MM-dd") + "~" + data.deliveryenddate?.isShowTimeString("MM-dd")),
-                ContractDetailsData(title = "合同量",content = data.qty ?: "" + data.enumdicname ?: ""),
-                ContractDetailsData(title = "初始保证金",content = data.margin ?: "")
+                ContractDetailsData(
+                    title = ViewEnumUtils.getContractType(
+                        data.contracttype ?: ""
+                    ) + "-" + ViewEnumUtils.getPriceType(data.pricetype ?: "") + "合同",
+                    content = data.contractno?.isBlankString() ?: ""
+                ),
+                ContractDetailsData(
+                    title = if (data.contracttype == "1") {
+                        "销售方"
+                    } else {
+                        "采购方"
+                    }, content = data.accountname ?: ""
+                ),
+                ContractDetailsData(title = "现货品种", content = data.deliverygoodsname ?: ""),
+                ContractDetailsData(
+                    title = "产品类型",
+                    content = ViewEnumUtils.getProductType(data.producttype ?: "")
+                ),
+                ContractDetailsData(title = "产品规格", content = data.spotgoodsdesc ?: ""),
+                ContractDetailsData(
+                    title = "定价类型",
+                    content = ViewEnumUtils.getPriceType(data.pricetype ?: "")
+                ),
+                ContractDetailsData(title = "期货合约", content = data.goodsname ?: ""),
+                ContractDetailsData(title = "升贴水", content = data.pricemove ?: ""),
+                ContractDetailsData(title = "标仓系数", content = data.convertfactor ?: ""),
+                ContractDetailsData(
+                    title = "点价期",
+                    content = data.startdate?.isShowTimeString("MM-dd") + "~" + data.enddate?.isShowTimeString(
+                        "MM-dd"
+                    )
+                ),
+                ContractDetailsData(
+                    title = "交收期",
+                    content = data.deliverystartdate?.isShowTimeString("MM-dd") + "~" + data.deliveryenddate?.isShowTimeString(
+                        "MM-dd"
+                    )
+                ),
+                ContractDetailsData(
+                    title = "合同量",
+                    content = data.qty ?: "" + data.enumdicname ?: ""
+                ),
+                ContractDetailsData(title = "初始保证金", content = data.margin ?: "")
             )
             unSubmitAdapter.setNewData(datalist)
 
@@ -273,8 +330,9 @@ class ContractDetailsUI(
         }.lparams(matchParent, matchParent)
     }
 }
+
 //合同详情的item
-fun _LinearLayout.contentItem(itemTile : String,itemContent : String){
+fun _LinearLayout.contentItem(itemTile: String, itemContent: String) {
     linearLayout {
         gravity = Gravity.CENTER_VERTICAL
         background = resources.getDrawable(R.color.white)
@@ -284,7 +342,7 @@ fun _LinearLayout.contentItem(itemTile : String,itemContent : String){
                 text = itemTile
                 textSizeAuto = 31
                 textColorInt = R.color.rma_gray_color
-            }.lparams(wrapContent, wrapContent){
+            }.lparams(wrapContent, wrapContent) {
                 marginStart = autoSize(35)
             }
         }.lparams(autoSize(250), autoSize(120))
@@ -293,7 +351,7 @@ fun _LinearLayout.contentItem(itemTile : String,itemContent : String){
             text = itemContent
             textSizeAuto = 31
             textColorInt = R.color.rma_black_33
-        }.lparams(wrapContent, wrapContent){
+        }.lparams(wrapContent, wrapContent) {
             marginStart = autoSize(35)
         }
 
@@ -316,7 +374,8 @@ class PriceRecordUI(
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
 
-    private val unSubmitAdapter: BaseAdapter<BusinessData, PriceRecordViewHolder> = BaseAdapter { _, _ -> PriceRecordViewHolder(activity,"1") }
+    private val unSubmitAdapter: BaseAdapter<BusinessData, PriceRecordViewHolder> =
+        BaseAdapter { _, _ -> PriceRecordViewHolder(activity, "1") }
 
     init {
         viewModel.queryBusinessDJ(relatedid = data.spotcontractid ?: "")
@@ -346,11 +405,11 @@ class PriceRecordUI(
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            viewModel.somePriceList.bindOptional(context){
-                if (it?.isEmpty() == true || it?.size == 0){
+            viewModel.somePriceList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
                     statusLayout.showEmpty()
-                }else {
-                    if (swipeToLayout.getIsRefreshing()){
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
                         swipeToLayout.finishRefresh()
                     }
                     statusLayout.showSuccess()
@@ -378,7 +437,8 @@ class SettlementRecordUI(
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
 
-    private val unSubmitAdapter: BaseAdapter<BusinessData, PriceRecordViewHolder> = BaseAdapter { _, _ -> PriceRecordViewHolder(activity,"2") }
+    private val unSubmitAdapter: BaseAdapter<BusinessData, PriceRecordViewHolder> =
+        BaseAdapter { _, _ -> PriceRecordViewHolder(activity, "2") }
 
     init {
         viewModel.queryBusinessJS(relatedid = data.spotcontractid ?: "")
@@ -409,11 +469,11 @@ class SettlementRecordUI(
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            viewModel.settlementList.bindOptional(context){
-                if (it?.isEmpty() == true || it?.size == 0){
+            viewModel.settlementList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
                     statusLayout.showEmpty()
-                }else {
-                    if (swipeToLayout.getIsRefreshing()){
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
                         swipeToLayout.finishRefresh()
                     }
                     statusLayout.showSuccess()
@@ -441,7 +501,8 @@ class PaymentRecordUI(
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
 
-    private val unSubmitAdapter: BaseAdapter<FinancialManageData, InvoiceRecordViewHolder> = BaseAdapter { _, _ -> InvoiceRecordViewHolder(activity,"1") }
+    private val unSubmitAdapter: BaseAdapter<FinancialManageData, InvoiceRecordViewHolder> =
+        BaseAdapter { _, _ -> InvoiceRecordViewHolder(activity, "1") }
 
     init {
         viewModel.queryBusinessKx(relatedid = data.spotcontractid ?: "")
@@ -472,11 +533,11 @@ class PaymentRecordUI(
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            viewModel.paymentList.bindOptional(context){
-                if (it?.isEmpty() == true || it?.size == 0){
+            viewModel.paymentList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
                     statusLayout.showEmpty()
-                }else {
-                    if (swipeToLayout.getIsRefreshing()){
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
                         swipeToLayout.finishRefresh()
                     }
                     statusLayout.showSuccess()
@@ -488,6 +549,159 @@ class PaymentRecordUI(
 }
 
 /**
+ * 出入库记录
+ * @property activity AppCompatActivity
+ * @property viewModel ProcurementViewModel
+ * @property type String
+ * @property root _FrameLayout
+ * @constructor
+ */
+class InventoryRecordUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: ProcurementViewModel,
+    private val data: ContractData,
+    private val type: String
+) : ApplyRecordAdapter.OnContentScrollListener {
+
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+    lateinit var horScrollview: CustomHorizontalScrollView
+    lateinit var recyclerView: RecyclerView
+
+    val topAdapter by lazy {
+        TopTabAdpater(activity)
+    }
+
+    val exposureContentAdapter by lazy {
+        ApplyRecordAdapter(activity)
+    }
+
+    fun refresh() {
+        viewModel.queryAreaStockApply(type = type)
+    }
+
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            viewModel.queryInventoryTitle(title = Constant.table_mobile_stock_manage_applylog, type = type)
+            exposureContentAdapter.setOnContentScrollListener(this@InventoryRecordUI)
+
+            linearLayout {
+                linearLayout {
+                    gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
+                    textView {//头部右侧数据
+                        viewModel.applyRecordTitle.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<ApplyRecordAdapter.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.applyRecordTitle.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 {
+                        /**
+                         * 下拉刷新
+                         */
+                        viewModel.queryAreaStockApply(type = type)
+                    }
+                    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<ApplyRecordAdapter.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.applyRecordDataList.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)
+
+    }
+}
+
+
+/**
  * 发票记录
  * @property activity AppCompatActivity
  * @property viewModel ProcurementViewModel
@@ -505,7 +719,8 @@ class InvoiceRecordUI(
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
 
-    private val unSubmitAdapter: BaseAdapter<FinancialManageData, InvoiceRecordViewHolder> = BaseAdapter { _, _ -> InvoiceRecordViewHolder(activity,"2") }
+    private val unSubmitAdapter: BaseAdapter<FinancialManageData, InvoiceRecordViewHolder> =
+        BaseAdapter { _, _ -> InvoiceRecordViewHolder(activity, "2") }
 
     init {
         viewModel.queryBusinessFp(relatedid = data.spotcontractid ?: "")
@@ -536,11 +751,11 @@ class InvoiceRecordUI(
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            viewModel.paymentList.bindOptional(context){
-                if (it?.isEmpty() == true || it?.size == 0){
+            viewModel.paymentList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
                     statusLayout.showEmpty()
-                }else {
-                    if (swipeToLayout.getIsRefreshing()){
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
                         swipeToLayout.finishRefresh()
                     }
                     statusLayout.showSuccess()
@@ -568,7 +783,8 @@ class ChangeRecordUI(
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
 
-    private val spotVarietiesNormalAdapter: BaseAdapter<ChangeLogData, ChangeRecordViewHolder> = BaseAdapter { _, _ -> ChangeRecordViewHolder(activity) }
+    private val spotVarietiesNormalAdapter: BaseAdapter<ChangeLogData, ChangeRecordViewHolder> =
+        BaseAdapter { _, _ -> ChangeRecordViewHolder(activity) }
 
     init {
         viewModel.queryChangeLog(RelatedId = data.spotcontractid ?: "")
@@ -622,11 +838,11 @@ class ChangeRecordUI(
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            viewModel.changeLogDataList.bindOptional(context){
-                if (it?.isEmpty() == true || it?.size == 0){
+            viewModel.changeLogDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
                     statusLayout.showEmpty()
-                }else {
-                    if (swipeToLayout.getIsRefreshing()){
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
                         swipeToLayout.finishRefresh()
                     }
                     statusLayout.showSuccess()

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

@@ -5,8 +5,11 @@ import cn.muchinfo.rma.global.GlobalDataCollection
 
 import cn.muchinfo.rma.global.ViewEnumUtils
 import cn.muchinfo.rma.global.data.*
+import cn.muchinfo.rma.global.inouttype
+import cn.muchinfo.rma.global.inventoryapplystatus
 import cn.muchinfo.rma.view.MyApplication
 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.TimeUtils
@@ -61,6 +64,16 @@ class ProcurementViewModel : BaseViewModel() {
      */
     val changeLogDataList : MutableLiveData<List<ChangeLogData>> = MutableLiveData()
 
+    /**
+     * 库存管理申请记录列表数据
+     */
+    val applyRecordDataList: MutableLiveData<List<AreaStockApplyData>> = MutableLiveData()
+
+    /**
+     * 库存管理申请记录头部数据
+     */
+    val applyRecordTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
+
 
     /**
      * 查询采购列表头部数据
@@ -398,5 +411,72 @@ class ProcurementViewModel : BaseViewModel() {
         }
     }
 
+    /**
+     * 查询库存申请(出入库记录|库存审核)
+     */
+    fun queryAreaStockApply(type: String) {
+        val params = mutableMapOf<String, String>()
+        params.put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+
+        if (type == "1"){
+            params.put("inouttype","1,3")
+        }else{
+            params.put("inouttype","2,4")
+        }
+        MyApplication.getInstance()?.warehouseManager?.queryAreaStockApply(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                applyRecordDataList.postValue(getapplyRecordRightData(respData ?: arrayListOf()))
+            }
+        }
+    }
+
+    /**
+     * 申请记录
+     * @param respData List<RealExposureData>
+     * @return List<RealExposureData>
+     */
+    private fun getapplyRecordRightData(respData: List<AreaStockApplyData>): List<AreaStockApplyData> {
+        val newList = arrayListOf<AreaStockApplyData>()
+        respData.forEach {
+            val newRightData = arrayListOf<String>()
+            newRightData.add(it.wrstandardname ?: "--")
+            newRightData.add(
+                it.inouttype?.inouttype() + "\n" + NumberUtils.roundNum(
+                    it.qty,
+                    2
+                ) + it.enumdicname
+            )
+            newRightData.add(it.applystatus?.inventoryapplystatus() ?: "--")
+            newRightData.add(it.contractno ?: "--")
+            newRightData.add(it.modelname + "\n" + it.brandname)
+            newRightData.add(it.warehousename ?: "--")
+            newRightData.add(it.applyname + "\n" + it.auditname)
+            val newData = it.copy(rightData = newRightData)
+            newList.add(newData)
+        }
+        return newList
+    }
+
+    /**
+     * 查询记录头部
+     * @param tableKey String
+     */
+    fun queryInventoryTitle(title: String,type: String) {
+        val params = mutableMapOf<String, String>().apply {
+            put("tableKey", title)
+            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
+                })
+                applyRecordTitle.postValue(newlist)
+                queryAreaStockApply(type)
+            }
+        }
+    }
+
 
 }

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

@@ -18,6 +18,7 @@
             android:layout_height="match_parent">
 
             <TextView
+                android:text="--"
                 android:layout_marginStart="10dp"
                 android:id="@+id/exposure_tv_left_title"
                 android:layout_width="wrap_content"
@@ -81,7 +82,7 @@
             android:layout_marginEnd="10dp"
             android:gravity="center"
             android:textSize="12sp"
-            android:layout_width="40dp"
+            android:layout_width="70dp"
             android:layout_height="25dp"
             android:text="出库明细"
             android:textColor="@color/rma_blue_color"