|
|
@@ -0,0 +1,578 @@
|
|
|
+package com.grkj.iscs_mars.view.fragment
|
|
|
+
|
|
|
+import android.view.GestureDetector
|
|
|
+import android.view.MotionEvent
|
|
|
+import android.view.View
|
|
|
+import android.widget.ImageView
|
|
|
+import androidx.lifecycle.Observer
|
|
|
+import com.bumptech.glide.Glide
|
|
|
+import com.google.android.material.card.MaterialCardView
|
|
|
+import com.grkj.iscs_mars.BusinessManager
|
|
|
+import com.grkj.iscs_mars.R
|
|
|
+import com.grkj.iscs_mars.databinding.FragmentStepBinding
|
|
|
+import com.grkj.iscs_mars.model.bo.PageChangeBO
|
|
|
+import com.grkj.iscs_mars.model.eventmsg.MsgEvent
|
|
|
+import com.grkj.iscs_mars.model.eventmsg.MsgEventConstants.MSG_EVENT_UPDATE_TICKET_PROGRESS
|
|
|
+import com.grkj.iscs_mars.model.eventmsg.UpdateTicketProgressMsg
|
|
|
+import com.grkj.iscs_mars.model.vo.machinery.MachineryDetailRespVO
|
|
|
+import com.grkj.iscs_mars.model.vo.ticket.LotoMapRespVO
|
|
|
+import com.grkj.iscs_mars.model.vo.ticket.StepDetailRespVO
|
|
|
+import com.grkj.iscs_mars.model.vo.ticket.TicketDetailRespVO
|
|
|
+import com.grkj.iscs_mars.util.SPUtils
|
|
|
+import com.grkj.iscs_mars.util.ToastUtils
|
|
|
+import com.grkj.iscs_mars.util.log.LogUtil
|
|
|
+import com.grkj.iscs_mars.view.base.BaseMvpFragment
|
|
|
+import com.grkj.iscs_mars.view.dialog.TipDialog
|
|
|
+import com.grkj.iscs_mars.view.iview.IStepView
|
|
|
+import com.grkj.iscs_mars.view.presenter.StepPresenter
|
|
|
+import com.grkj.iscs_mars.view.widget.CustomStationLayer
|
|
|
+import com.onlylemi.mapview.library.MapViewListener
|
|
|
+import com.sik.sikcore.extension.isNullOrEmpty
|
|
|
+import com.sik.sikcore.thread.ThreadUtils
|
|
|
+import com.zhy.adapter.recyclerview.CommonAdapter
|
|
|
+import com.zhy.adapter.recyclerview.base.ViewHolder
|
|
|
+
|
|
|
+/**
|
|
|
+ * 作业票执行步骤页 - 八大步骤
|
|
|
+ */
|
|
|
+class StepFragmentLand(val goBack: () -> Unit, val changePage: (PageChangeBO) -> Unit) :
|
|
|
+ BaseMvpFragment<IStepView, StepPresenter, FragmentStepBinding>() {
|
|
|
+
|
|
|
+ private lateinit var mStepList: MutableList<StepBO>
|
|
|
+ private var mLotoData: LotoMapRespVO? = null
|
|
|
+ private var mChangePage: PageChangeBO? = null
|
|
|
+ private var mMachineryDetail: MachineryDetailRespVO? = null
|
|
|
+ private var mStep: Int = 0
|
|
|
+ private lateinit var mTipDialog: TipDialog
|
|
|
+ private var stationLayer: CustomStationLayer? = null
|
|
|
+ private val mStationList = mutableListOf<CustomStationLayer.IsolationPoint>()
|
|
|
+ private var mMapPicWidth = 1
|
|
|
+ private var mTicketDetailData: TicketDetailRespVO? = null
|
|
|
+ private lateinit var observer: Observer<MsgEvent>
|
|
|
+ private var mCanHandle: Boolean? = null // 是否可以操作,创建人、上锁人至少符合一个才可操作
|
|
|
+ private var mapRatio: Float = 1f
|
|
|
+ private lateinit var gestureDetector: GestureDetector
|
|
|
+
|
|
|
+ override val viewBinding: FragmentStepBinding
|
|
|
+ get() = FragmentStepBinding.inflate(layoutInflater)
|
|
|
+
|
|
|
+ override fun initView() {
|
|
|
+ mTipDialog = TipDialog(requireActivity())
|
|
|
+ mStepList = mutableListOf(
|
|
|
+ StepBO(R.mipmap.step1, getString(R.string.recognize_work_content), 1, "①"),
|
|
|
+ StepBO(R.mipmap.step2, getString(R.string.power_isolation_way), 2, "②"),
|
|
|
+ StepBO(R.mipmap.step3, getString(R.string.notice_worker), 3, "③"),
|
|
|
+ StepBO(R.mipmap.step4, getString(R.string.shutdown), 4, "④"),
|
|
|
+ StepBO(R.mipmap.step5, getString(R.string.unlock_and_restore_switch), 8, "⑧"),
|
|
|
+ StepBO(R.mipmap.step6, getString(R.string.check_before_unlocking), 7, "⑦"),
|
|
|
+ StepBO(R.mipmap.step7, getString(R.string.ensure_power_isolation), 6, "⑥"),
|
|
|
+ StepBO(R.mipmap.step8, getString(R.string.lock_and_hang_a_sign), 5, "⑤")
|
|
|
+ )
|
|
|
+ mBinding?.rvStep?.adapter =
|
|
|
+ object : CommonAdapter<StepBO>(requireContext(), R.layout.item_rv_step, mStepList) {
|
|
|
+ override fun convert(holder: ViewHolder, step: StepBO, position: Int) {
|
|
|
+ if (step.stepDetail?.stepStatus == "1") {
|
|
|
+ holder.getView<MaterialCardView>(R.id.cv_step)
|
|
|
+ .setCardBackgroundColor(requireContext().getColor(R.color.item_rv_step_bg_done))
|
|
|
+ } else {
|
|
|
+ holder.getView<MaterialCardView>(R.id.cv_step).setCardBackgroundColor(
|
|
|
+ if (mStep + 1 == step.index) requireContext().getColor(R.color.item_rv_step_bg_doing)
|
|
|
+ else requireContext().getColor(R.color.common_bg_white_10)
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ holder.setVisible(R.id.iv_arrow_right, step.index !in 4..5)
|
|
|
+ holder.setVisible(R.id.iv_arrow_bottom, step.index == 4)
|
|
|
+ holder.getView<ImageView>(R.id.iv_arrow_right).rotation =
|
|
|
+ if (step.index > 5) 180f else 0f
|
|
|
+ holder.getView<ImageView>(R.id.iv_icon).setImageResource(step.pic)
|
|
|
+ holder.setText(R.id.tv_name, step.stepDetail?.androidStepContent)
|
|
|
+ holder.setText(R.id.tv_index, step.indexStr)
|
|
|
+ holder.getView<ImageView>(R.id.iv_status)
|
|
|
+ .setImageResource(if (step.stepDetail?.stepStatus == "1") R.mipmap.step_executed else R.mipmap.step_not_executed)
|
|
|
+ holder.setText(
|
|
|
+ R.id.tv_status, if (step.stepDetail?.stepStatus == "1") {
|
|
|
+ if (step.index == 3) getString(R.string.allocated) else getString(R.string.executed)
|
|
|
+ } else {
|
|
|
+ if (step.index == 3) getString(R.string.not_allocated) else getString(R.string.not_executed)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ holder.setOnClickListener(R.id.root) {
|
|
|
+ mCanHandle ?: return@setOnClickListener
|
|
|
+ if (mCanHandle == false) {
|
|
|
+ ToastUtils.tip(R.string.no_permission_to_handle)
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
+ handleStep(step.index)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mBinding?.cbBack?.setOnClickListener { goBack() }
|
|
|
+ initMap()
|
|
|
+ mBinding?.cbAction?.setOnClickListener {
|
|
|
+ mCanHandle ?: return@setOnClickListener
|
|
|
+ if (mCanHandle == false) {
|
|
|
+ ToastUtils.tip(R.string.no_permission_to_handle)
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
+ if (mStep in 1..5) {
|
|
|
+ presenter?.cancelTicket(mChangePage?.ticketId!!) {
|
|
|
+ if (it) {
|
|
|
+ presenter?.checkMyTodoForHandleKey()
|
|
|
+ changePage(PageChangeBO(-1))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (mStep == 8) {
|
|
|
+ if (mStepList.find { it.index == 8 }?.stepDetail?.conflictJobNum != 0) {
|
|
|
+ mTipDialog.setTip(getString(R.string.action_confirm_finish_ticket))
|
|
|
+ mTipDialog.setConfirmListener {
|
|
|
+ presenter?.finishTicket(mChangePage?.ticketId!!) {
|
|
|
+ if (it) changePage(PageChangeBO(-1))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mTipDialog.show()
|
|
|
+ } else {
|
|
|
+ presenter?.finishTicket(mChangePage?.ticketId!!) {
|
|
|
+ if (it) changePage(PageChangeBO(-1))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ mBinding?.llDetail?.setOnClickListener {
|
|
|
+ mCanHandle ?: return@setOnClickListener
|
|
|
+ if (mCanHandle == false) {
|
|
|
+ ToastUtils.tip(R.string.no_permission_to_handle)
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
+ if (mStep >= 4) {
|
|
|
+ changePage(
|
|
|
+ PageChangeBO(
|
|
|
+ 2,
|
|
|
+ mChangePage?.workstationId,
|
|
|
+ mChangePage?.ticketId,
|
|
|
+ mChangePage?.machineryId,
|
|
|
+ mChangePage?.machineryName
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ observer = Observer { newData ->
|
|
|
+ if (newData.code != MSG_EVENT_UPDATE_TICKET_PROGRESS) {
|
|
|
+ return@Observer
|
|
|
+ }
|
|
|
+ LogUtil.i("Update progress msg, isVisible : $isVisible")
|
|
|
+ if (!isVisible) {
|
|
|
+ return@Observer
|
|
|
+ }
|
|
|
+ val ticketId = (newData.data as UpdateTicketProgressMsg).ticketId
|
|
|
+ LogUtil.i("Update progress msg, ticketId : $ticketId")
|
|
|
+ refreshPage(mChangePage!!)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onResume() {
|
|
|
+ super.onResume()
|
|
|
+ mChangePage?.let {
|
|
|
+ refreshPage(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private fun initMap() {
|
|
|
+ gestureDetector =
|
|
|
+ GestureDetector(requireContext(), object : GestureDetector.SimpleOnGestureListener() {
|
|
|
+ override fun onDoubleTap(e: MotionEvent): Boolean {
|
|
|
+ mBinding?.mapview?.currentRotateDegrees = 0f
|
|
|
+ return super.onDoubleTap(e)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onFling(
|
|
|
+ e1: MotionEvent?,
|
|
|
+ e2: MotionEvent,
|
|
|
+ velocityX: Float,
|
|
|
+ velocityY: Float
|
|
|
+ ): Boolean {
|
|
|
+ mBinding?.mapview?.currentRotateDegrees = 0f
|
|
|
+ return super.onFling(e1, e2, velocityX, velocityY)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ mBinding?.mapview?.isScaleAndRotateTogether = false
|
|
|
+ mBinding?.mapview?.setOnTouchListener { _, event ->
|
|
|
+ gestureDetector.onTouchEvent(event)
|
|
|
+ false
|
|
|
+ }
|
|
|
+
|
|
|
+ // ★★★ 修正这里:== null,且创建后 setRatio 再 addLayer ★★★
|
|
|
+ if (stationLayer == null) {
|
|
|
+ stationLayer = CustomStationLayer(mBinding?.mapview, mStationList)
|
|
|
+ stationLayer?.setRatio(1f) // 没这句 bgBitmap 为 null,draw 不会画
|
|
|
+ mBinding?.mapview?.addLayer(stationLayer)
|
|
|
+ }
|
|
|
+
|
|
|
+ mBinding?.mapview?.setMapViewListener(object : MapViewListener {
|
|
|
+ override fun onMapLoadSuccess() {
|
|
|
+ mBinding?.mapview?.post {
|
|
|
+ mBinding?.mapview?.currentRotateDegrees = 0f
|
|
|
+ mBinding?.mapview?.refresh()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onMapLoadFail() {
|
|
|
+ ToastUtils.tip("onMapLoadFail")
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun refreshPage(pageChangeBO: PageChangeBO) {
|
|
|
+ LogUtil.i("$pageChangeBO")
|
|
|
+ mChangePage = pageChangeBO
|
|
|
+ mCanHandle = null
|
|
|
+
|
|
|
+ presenter?.getTicketDetail(pageChangeBO.ticketId) {
|
|
|
+ mTicketDetailData = it
|
|
|
+ mBinding?.tvTitle?.text = it?.ticketName
|
|
|
+ it?.createBy?.let { itCreator ->
|
|
|
+ if (itCreator.isEmpty()) {
|
|
|
+ return@let
|
|
|
+ }
|
|
|
+ mCanHandle = itCreator.toLong() == SPUtils.getLoginUser(requireContext())?.userId
|
|
|
+ }
|
|
|
+ mCanHandle = (mCanHandle == true) || it?.ticketUserVOList?.any {
|
|
|
+ it.userId != null && it.userId.toLong() == SPUtils.getLoginUser(requireContext())?.userId
|
|
|
+ } == true
|
|
|
+ }
|
|
|
+
|
|
|
+ presenter?.getStepDetail(pageChangeBO.ticketId!!) {
|
|
|
+ BusinessManager.sendLoadingEventMsg(null, false)
|
|
|
+ mBinding?.tvWorker?.text =
|
|
|
+ "${it?.get(2)?.userNum}/${it?.get(4)?.userNum}/${it?.get(7)?.userNum}"
|
|
|
+ mBinding?.tvLock?.text =
|
|
|
+ "${it?.get(2)?.lockNum}/${it?.get(4)?.lockNum}/${it?.get(7)?.lockNum}"
|
|
|
+ mStepList.forEach { step ->
|
|
|
+ step.stepDetail = it?.find { it.stepIndex == step.index }
|
|
|
+ step.title =
|
|
|
+ it?.find { it.stepIndex == step.index }?.androidStepContent ?: step.title
|
|
|
+ }
|
|
|
+ mBinding?.rvStep?.adapter?.notifyDataSetChanged()
|
|
|
+ it?.filter { it.stepStatus == "1" }?.maxByOrNull { it.stepIndex!! }?.stepIndex?.let {
|
|
|
+ mStep = it
|
|
|
+ }
|
|
|
+ if (mStep <= 5) {
|
|
|
+ mBinding?.cbAction?.visibility = View.VISIBLE
|
|
|
+ mBinding?.cbAction?.setText(getString(R.string.cancel_the_job))
|
|
|
+ } else if (mStep == 8) {
|
|
|
+ mBinding?.cbAction?.visibility = View.VISIBLE
|
|
|
+ mBinding?.cbAction?.setText(getString(R.string.finish_the_job))
|
|
|
+ } else {
|
|
|
+ mBinding?.cbAction?.visibility = View.GONE
|
|
|
+ }
|
|
|
+ presenter?.preOpenKeyCharge(requireContext(), mStep)
|
|
|
+ handleBottomTip()
|
|
|
+ }
|
|
|
+
|
|
|
+ presenter?.getMachineryDetail(
|
|
|
+ pageChangeBO.machineryId!!, {
|
|
|
+ mMachineryDetail = it
|
|
|
+ Glide.with(this).load(it?.machineryImg).into(mBinding?.ivMachinery!!)
|
|
|
+ }) {
|
|
|
+ mLotoData = it
|
|
|
+
|
|
|
+ if (!mLotoData.isNullOrEmpty()) {
|
|
|
+ mLotoData?.mapId?.let { itId ->
|
|
|
+ presenter?.getMapInfo(itId) { itMapInfo ->
|
|
|
+ ThreadUtils.runOnIO {
|
|
|
+ presenter?.mapDataHandleForStations(
|
|
|
+ requireContext(),
|
|
|
+ itMapInfo,
|
|
|
+ mMachineryDetail?.pointIdList ?: mutableListOf(),
|
|
|
+ { mBinding?.mapview },
|
|
|
+ stationLayer
|
|
|
+ ) { mapBmp ->
|
|
|
+ ThreadUtils.runOnMain {
|
|
|
+ mBinding?.mapview?.loadMap(mapBmp)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// // 如果没有图 URL,直接返回
|
|
|
+// val imageUrl = itMapInfo?.imageUrl ?: return@getMapInfo
|
|
|
+//
|
|
|
+// BitmapUtil.loadBitmapFromUrl(requireContext(), imageUrl) { mapBmp ->
|
|
|
+// if (mapBmp == null) {
|
|
|
+// LogUtil.e("Map pic is null")
|
|
|
+// return@loadBitmapFromUrl
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 清空旧点
|
|
|
+// mStationList.clear()
|
|
|
+//
|
|
|
+// // 1 格 对应的像素
|
|
|
+// val cellPx = 50f
|
|
|
+// // 后端给的“逻辑”子图原始尺寸(像素)
|
|
|
+// val backendW = itMapInfo.width!!.toFloat()
|
|
|
+// val backendH = itMapInfo.height!!.toFloat()
|
|
|
+// // 实际下载回来的 Bitmap 尺寸(像素)
|
|
|
+// val actualW = mapBmp.width.toFloat()
|
|
|
+// val actualH = mapBmp.height.toFloat()
|
|
|
+// // 计算缩放比例
|
|
|
+// val ratioX = actualW / backendW
|
|
|
+// val ratioY = actualH / backendH
|
|
|
+// mapRatio = ratioX
|
|
|
+// // 子图在全局坐标系里的左上角偏移(像素)
|
|
|
+// val offsetX = itMapInfo.x!!.toFloat()
|
|
|
+// val offsetY = itMapInfo.y!!.toFloat()
|
|
|
+// // 图标请求尺寸:逻辑 45px * 缩放比
|
|
|
+// val iconReqPx = (45f * ratioX).toInt().coerceAtLeast(1)
|
|
|
+//
|
|
|
+// itMapInfo.pointList?.forEach { pt ->
|
|
|
+// // 1) 格数 → 全局像素
|
|
|
+// val globalX = pt.x!!.toFloat() * cellPx
|
|
|
+// val globalY = pt.y!!.toFloat() * cellPx
|
|
|
+// // 2) 全局像素 - 子图偏移 = 子图内像素
|
|
|
+// val localX = globalX - offsetX
|
|
|
+// val localY = globalY - offsetY
|
|
|
+// // 3) 再乘缩放比,得到真实 Bitmap 上的像素坐标
|
|
|
+// val finalX = localX * ratioX
|
|
|
+// val finalY = localY * ratioY
|
|
|
+// // 异步加载点位图标,固定请求尺寸
|
|
|
+// BitmapUtil.loadBitmapFromUrl(
|
|
|
+// requireContext(),
|
|
|
+// pt.pointIcon!!,
|
|
|
+// reqWidth = iconReqPx,
|
|
|
+// reqHeight = iconReqPx
|
|
|
+// ) { bmpIcon ->
|
|
|
+// val icon = bmpIcon ?: BitmapUtil.getResizedBitmapFromMipmap(
|
|
|
+// requireContext(),
|
|
|
+// R.mipmap.ticket_type_placeholder,
|
|
|
+// iconReqPx,
|
|
|
+// iconReqPx
|
|
|
+// )
|
|
|
+//
|
|
|
+// mStationList.add(
|
|
|
+// CustomStationLayer.IsolationPoint(
|
|
|
+// PointF(finalX, finalY),
|
|
|
+// pt.entityName!!,
|
|
|
+// icon,
|
|
|
+// pt.entityId!!.toLong(),
|
|
|
+// pt.pointSerialNumber,
|
|
|
+// mMachineryDetail?.pointIdList?.contains(pt.entityId) == true
|
|
|
+// )
|
|
|
+// )
|
|
|
+//
|
|
|
+// // 全部点都加载完后,设置给 layer 并绘制
|
|
|
+// if (mStationList.size == itMapInfo.pointList.size) {
|
|
|
+// if (stationLayer?.inDraw == true) {
|
|
|
+// return@loadBitmapFromUrl
|
|
|
+// }
|
|
|
+// mBinding?.mapview?.loadMap(mapBmp)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun handleStep(step: Int) {
|
|
|
+ if (mStep == 0) return
|
|
|
+ when (step) {
|
|
|
+ 3 -> {
|
|
|
+ if (presenter?.canModifyColocker(requireContext(), step) == false) {
|
|
|
+ ToastUtils.tip(R.string.current_step_can_not_modify_colocker)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ changePage(
|
|
|
+ PageChangeBO(
|
|
|
+ 1,
|
|
|
+ mChangePage?.workstationId,
|
|
|
+ mChangePage?.ticketId,
|
|
|
+ mChangePage?.machineryId,
|
|
|
+ mChangePage?.machineryName
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ 4, 5, 6, 7, 8 -> {
|
|
|
+ if (mStep != step - 1) {
|
|
|
+ ToastUtils.tip(
|
|
|
+ getString(
|
|
|
+ R.string.please_done_operation,
|
|
|
+ mStepList.find { it.index == mStep + 1 }?.title
|
|
|
+ )
|
|
|
+ )
|
|
|
+ return
|
|
|
+ }
|
|
|
+ updateStep(step)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun updateStep(step: Int) {
|
|
|
+ val canContinue =
|
|
|
+ presenter?.checkCanContinue(requireContext(), step, mTicketDetailData) ?: ""
|
|
|
+ if (canContinue.isEmpty()) {
|
|
|
+ val str = when (step) {
|
|
|
+ 4 -> getString(R.string.action_confirm_shut_down)
|
|
|
+ 5 -> getString(R.string.action_confirm_lock)
|
|
|
+ 6 -> getString(R.string.action_confirm_power_isolation)
|
|
|
+ 7 -> getString(R.string.action_confirm_check_before_unlocking)
|
|
|
+ 8 -> getString(R.string.action_confirm_restore)
|
|
|
+ else -> ""
|
|
|
+ }
|
|
|
+ if (step == 8 && presenter?.checkCrossJobUnlockData(
|
|
|
+ requireContext(), mTicketDetailData
|
|
|
+ ) == true
|
|
|
+ ) {
|
|
|
+ mTipDialog.setTip(getString(R.string.all_point_have_other_job_not_finish))
|
|
|
+ mTipDialog.setType(TipDialog.TYPE_HINT)
|
|
|
+ mTipDialog.setConfirmListener {
|
|
|
+ mTicketDetailData?.noUnlockTicketPointsVOSet?.let {
|
|
|
+ presenter?.updateCoincideToUnLock(it) {
|
|
|
+ if (it) {
|
|
|
+ presenter?.updateStep(
|
|
|
+ mStepList.find { it.index == step }?.stepDetail?.stepId!!, "1"
|
|
|
+ ) {
|
|
|
+ presenter?.checkMyTodoForHandleKey()
|
|
|
+ mChangePage?.let {
|
|
|
+ refreshPage(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mTipDialog.showCancelCountdown(10)
|
|
|
+ } else {
|
|
|
+ mTipDialog.setTip(str)
|
|
|
+ mTipDialog.setType(TipDialog.TYPE_ALL)
|
|
|
+ mTipDialog.setConfirmListener {
|
|
|
+ BusinessManager.sendLoadingEventMsg(getString(R.string.is_processing_please_wait))
|
|
|
+ when (step) {
|
|
|
+ 4 -> {
|
|
|
+ presenter?.updateStep(mStepList[2].stepDetail?.stepId!!, "1") {
|
|
|
+ presenter?.updateStep(mStepList[3].stepDetail?.stepId!!, "1") {
|
|
|
+ BusinessManager.sendLoadingEventMsg(null, false)
|
|
|
+ refreshPage(mChangePage!!)
|
|
|
+ if (presenter?.jumpJobProgressPageCheck(
|
|
|
+ requireContext(), step
|
|
|
+ ) == true
|
|
|
+ ) {
|
|
|
+ // 自动跳转
|
|
|
+ changePage(
|
|
|
+ PageChangeBO(
|
|
|
+ 2,
|
|
|
+ mChangePage?.workstationId,
|
|
|
+ mChangePage?.ticketId,
|
|
|
+ mChangePage?.machineryId,
|
|
|
+ mChangePage?.machineryName
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else -> {
|
|
|
+ presenter?.updateStep(
|
|
|
+ mStepList.find { it.index == step }?.stepDetail?.stepId!!, "1"
|
|
|
+ ) {
|
|
|
+ refreshPage(mChangePage!!)
|
|
|
+ if (presenter?.jumpJobProgressPageCheck(
|
|
|
+ requireContext(), step
|
|
|
+ ) == true
|
|
|
+ ) {
|
|
|
+ // 自动跳转
|
|
|
+ changePage(
|
|
|
+ PageChangeBO(
|
|
|
+ 2,
|
|
|
+ mChangePage?.workstationId,
|
|
|
+ mChangePage?.ticketId,
|
|
|
+ mChangePage?.machineryId,
|
|
|
+ mChangePage?.machineryName
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mTipDialog.setType(TipDialog.TYPE_HINT)
|
|
|
+ mTipDialog.setTip(canContinue)
|
|
|
+ mTipDialog.setConfirmListener {
|
|
|
+ presenter?.tipToJobProgressPageCheck(requireContext(), mStep) {
|
|
|
+ changePage(
|
|
|
+ PageChangeBO(
|
|
|
+ 2,
|
|
|
+ mChangePage?.workstationId,
|
|
|
+ mChangePage?.ticketId,
|
|
|
+ mChangePage?.machineryId,
|
|
|
+ mChangePage?.machineryName
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mTipDialog.show()
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun handleBottomTip() {
|
|
|
+ mBinding?.llTip?.visibility = if (mStep >= 2) View.VISIBLE else View.GONE
|
|
|
+ when (mStep) {
|
|
|
+ 2 -> {
|
|
|
+ mBinding?.tvTip?.text = getString(R.string.waiting_for_allocating_worker)
|
|
|
+ }
|
|
|
+
|
|
|
+ 3 -> {
|
|
|
+ mBinding?.tvTip?.text = getString(R.string.waiting_for_shutting_down)
|
|
|
+ }
|
|
|
+
|
|
|
+ 4 -> {
|
|
|
+ mBinding?.tvTip?.text = getString(R.string.waiting_for_hanging_a_sign)
|
|
|
+ }
|
|
|
+
|
|
|
+ 5 -> {
|
|
|
+ mBinding?.tvTip?.text = getString(R.string.waiting_for_power_isolation)
|
|
|
+ }
|
|
|
+
|
|
|
+ 6 -> {
|
|
|
+ mBinding?.tvTip?.text = getString(R.string.waiting_for_checking_before_unlocking)
|
|
|
+ }
|
|
|
+
|
|
|
+ 7 -> {
|
|
|
+ mBinding?.tvTip?.text =
|
|
|
+ getString(R.string.waiting_for_restoring_switch_before_unlocking)
|
|
|
+ }
|
|
|
+
|
|
|
+ 8 -> {
|
|
|
+ mBinding?.tvTip?.text = getString(R.string.waiting_for_finishing)
|
|
|
+ }
|
|
|
+
|
|
|
+ else -> {
|
|
|
+ mBinding?.tvTip?.text = ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onPause() {
|
|
|
+ super.onPause()
|
|
|
+// mBinding?.mapview?.release()
|
|
|
+ mStep = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun initPresenter(): StepPresenter {
|
|
|
+ return StepPresenter()
|
|
|
+ }
|
|
|
+
|
|
|
+ data class StepBO(
|
|
|
+ val pic: Int,
|
|
|
+ var title: String,
|
|
|
+ val index: Int,
|
|
|
+ val indexStr: String,
|
|
|
+ var stepDetail: StepDetailRespVO? = null
|
|
|
+ )
|
|
|
+}
|