Sfoglia il codice sorgente

1. 优化竖屏岗位页面底部去除显示的文本

bjb 5 mesi fa
parent
commit
3c328bc0d1

+ 1 - 1
app/src/main/java/com/grkj/iscs_mars/util/NetApi.kt

@@ -657,7 +657,7 @@ object NetApi {
             mapOf(
                 "pages" to pages,
                 "size" to size,
-                // "workstationId" to workstationId, 拿到所有的工艺
+                "workstationId" to workstationId,
                 "machineryType" to "工艺"
             ),
             { res, _, _ ->

+ 12 - 8
app/src/main/java/com/grkj/iscs_mars/view/fragment/JobProgressFragment.kt

@@ -418,7 +418,8 @@ class JobProgressFragment(val goBack: () -> Unit, val changePage: (PageChangeBO)
                         // 这里执行一次切换导航,共锁处理切换到共锁页面
                         mBinding?.llLockInfo?.performClick()
                     }
-                } else if (ticketDetail?.ticketUserVOList?.filter { it.userRole == Constants.USER_ROLE_COLOCKER }?.any { it.jobStatus!! < 4 } == true) {
+                } else if (ticketDetail?.ticketUserVOList?.filter { it.userRole == Constants.USER_ROLE_COLOCKER }
+                        ?.any { it.jobStatus!! < 4 } == true) {
                     // 共锁人操作提示
                     lifecycleScope.launch(Dispatchers.Main) {
                         delay(500)
@@ -449,19 +450,22 @@ class JobProgressFragment(val goBack: () -> Unit, val changePage: (PageChangeBO)
                     }
                 }
                 // 如果是待共锁人处理,默认导航到待共锁列表
-                if (ticketDetail?.ticketUserVOList?.filter { it.userRole == Constants.USER_ROLE_COLOCKER }?.any { it.jobStatus!! != 5 } == true) {
-                    // 上锁人执行解锁操作
+                if (ticketDetail?.ticketUserVOList?.filter { it.userRole == Constants.USER_ROLE_COLOCKER }
+                        ?.any { it.jobStatus!! != 5 } == true) {
                     lifecycleScope.launch(Dispatchers.Main) {
                         delay(500)
                         // 这里执行一次切换导航,共锁处理切换到共锁页面
-                        mBinding?.llLockInfo?.performClick()
+                        mBinding?.llTogetherInfo?.performClick()
                     }
-                }
-                else if (ticketDetail?.ticketUserVOList?.filter { it.userRole == Constants.USER_ROLE_COLOCKER }?.any { it.jobStatus!! != 5 } == true) {
+                } else if (ticketDetail?.ticketPointsVOList?.filter {
+                        it.pointId !in (ticketDetail.noUnlockTicketPointsVOSet?.map { it.pointId }
+                            ?: mutableListOf())
+                    }?.any { it.pointStatus != "2" } == true) {
+                    // 上锁人执行解锁操作
                     lifecycleScope.launch(Dispatchers.Main) {
                         delay(500)
-                        // 这里执行一次切换导航,共锁处理切换到共锁页面
-                        mBinding?.llTogetherInfo?.performClick()
+                        // 这里执行一次切换导航,切换到上锁人
+                        mBinding?.llLockInfo?.performClick()
                     }
                 }
             }

+ 7 - 0
app/src/main/java/com/grkj/iscs_mars/view/fragment/StepFragment.kt

@@ -127,6 +127,13 @@ class StepFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> Uni
                 // 修改执行文案
                 val btnStr = if (t.index == 3) getString(R.string.common_go_settings) else getString(R.string.common_exec)
                 holder.setText(R.id.tv_setting,btnStr)
+                // 校验显示编辑共锁人是否可以重新选择
+                if (t.index == 3 && (mStep + 1) > 3) {
+                    // 清楚已完成图标
+                    holder.setImageResource(R.id.iv_status, 0)
+                    holder.setVisible(R.id.tv_setting, true)
+                    holder.setText(R.id.tv_setting, getString(R.string.common_update))
+                }
                 // 设置上锁人和共锁人
                 holder.setOnClickListener(R.id.tv_setting) {
                     mCanHandle ?: return@setOnClickListener

+ 38 - 38
app/src/main/java/com/grkj/iscs_mars/view/fragment/WorkerFragment.kt

@@ -1,5 +1,6 @@
 package com.grkj.iscs_mars.view.fragment
 
+import android.util.Log
 import android.view.View
 import com.grkj.iscs_mars.R
 import com.grkj.iscs_mars.databinding.FragmentWorkerBinding
@@ -145,45 +146,45 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
             ticketUserVOList.addAll(it?.ticketUserVOList ?: mutableListOf())
             mBinding?.tvTitle?.text = it?.ticketName
 
-            if (it?.ticketUserVOList.isNullOrEmpty()) {
-                return@getTicketDetail
-            }
-            it?.ticketUserVOList?.let { it1 -> mOriginalUserList.addAll(it1) }
-            it?.ticketUserVOList?.forEach { user ->
+            if (it?.ticketUserVOList.isNullOrEmpty()) return@getTicketDetail
+
+            it.ticketUserVOList.let { it1 -> mOriginalUserList.addAll(it1) }
+            it.ticketUserVOList.forEach { user ->
                 if (user.userRole == USER_ROLE_LOCKER) {
                     //mBinding?.layoutLocker?.root?.visibility = View.VISIBLE
                     //mBinding?.layoutLocker?.tvName?.text = user.userName
                 }
-                mLockerSelectedList.add(
-                    TicketUserReqVO(
-                        user.userId!!,
-                        user.userName!!,
-                        user.userType!!,
-                        user.userRole!!,
-                        user.jobStatus
+                if (mLockerSelectedList.find { f -> f.userId == user.userId } == null)
+                    mLockerSelectedList.add(
+                        TicketUserReqVO(
+                            user.userId!!,
+                            user.userName!!,
+                            user.userType!!,
+                            user.userRole!!,
+                            user.jobStatus
+                        )
                     )
-                )
             }
             // 上锁人默认选择自己
             if (mLockerSelectedList.none { it.userRole == USER_ROLE_LOCKER }) {
-                val user =
-                    it?.ticketUserVOList?.find { it.userId == SPUtils.getLoginUser(requireContext())?.userId }
+                val user = it.ticketUserVOList.find { it.userId == SPUtils.getLoginUser(requireContext())?.userId }
                 user?.let {
-                    mLockerSelectedList.add(
-                        TicketUserReqVO(
-                            it.userId!!,
-                            it.userName!!,
-                            it.userType!!,
-                            USER_ROLE_LOCKER,
-                            user.jobStatus
+                    if (mLockerSelectedList.find { f -> f.userId == user.userId } == null)
+                        mLockerSelectedList.add(
+                            TicketUserReqVO(
+                                it.userId!!,
+                                it.userName!!,
+                                it.userType!!,
+                                USER_ROLE_LOCKER,
+                                user.jobStatus
+                            )
                         )
-                    )
                     //mBinding?.layoutLocker?.root?.visibility = View.VISIBLE
                     //mBinding?.layoutLocker?.tvName?.text = it.userName
                 }
             }
-            mColockerSelectedShowList.addAll(mCoLockerSelectedList.filter { it.userRole == USER_ROLE_COLOCKER }
-                .toMutableList())
+            Log.d("xiaoming","1- $mLockerSelectedList")
+            mColockerSelectedShowList.addAll(mCoLockerSelectedList.filter { it.userRole == USER_ROLE_COLOCKER }.toMutableList())
             mBinding?.rvTogetherPersonal?.adapter?.notifyDataSetChanged()
             mBinding?.rvLockPersonal?.adapter?.notifyDataSetChanged()
             mBinding?.rvColockerInside?.adapter?.notifyDataSetChanged()
@@ -193,26 +194,25 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
         presenter?.getUserList(mPageChangeBO?.workstationId, 3, 9) {
             mLockerList.clear()
             if (!it?.rows.isNullOrEmpty()) {
-                mLockerList.addAll(it?.rows!!)
+                mLockerList.addAll(it.rows)
             }
             // 上锁人默认选择自己
             if (mLockerSelectedList.none { it.userRole == USER_ROLE_LOCKER }) {
-                val user =
-                    it?.rows?.find { it.userId == SPUtils.getLoginUser(requireContext())?.userId }
+                val user = it?.rows?.find { it.userId == SPUtils.getLoginUser(requireContext())?.userId }
                 user?.let {
-                    mLockerSelectedList.add(
-                        TicketUserReqVO(
-                            it.userId!!,
-                            it.nickName!!,
-                            "0",
-                            USER_ROLE_LOCKER,
-                            ticketUserVOList.find { ticketUser -> ticketUser.userId == it.userId }?.jobStatus
+                    if (mLockerSelectedList.find { f -> f.userId == user.userId } == null)
+                        mLockerSelectedList.add(
+                            TicketUserReqVO(
+                                it.userId!!,
+                                it.nickName!!,
+                                "0",
+                                USER_ROLE_LOCKER,
+                                ticketUserVOList.find { ticketUser -> ticketUser.userId == it.userId }?.jobStatus
+                            )
                         )
-                    )
-                    //mBinding?.layoutLocker?.root?.visibility = View.VISIBLE
-                    //mBinding?.layoutLocker?.tvName?.text = it.nickName
                 }
             }
+            Log.d("xiaoming","2- $mLockerSelectedList")
             mBinding?.rvLockPersonal?.adapter?.notifyDataSetChanged()
         }
 

+ 23 - 6
app/src/main/java/com/grkj/iscs_mars/view/fragment/WorkshopFragment.kt

@@ -1,7 +1,11 @@
 package com.grkj.iscs_mars.view.fragment
 
+import android.animation.ObjectAnimator
+import android.animation.ValueAnimator
 import android.graphics.PointF
+import android.view.View
 import android.widget.ImageView
+import androidx.core.animation.addListener
 import androidx.lifecycle.lifecycleScope
 import com.grkj.iscs_mars.R
 import com.grkj.iscs_mars.databinding.FragmentWorkshopBinding
@@ -55,7 +59,8 @@ class WorkshopFragment(val changePage: (PageChangeBO) -> Unit) :
                     holder.getView<ImageView>(R.id.iv).setImageResource(statistic.sopType.icon)
                     holder.setText(
                         R.id.tv_name,
-                        if (statistic.count == 0) statistic.sopType.title else "${statistic.sopType.title}(${statistic.count})"
+                        // if (statistic.count == 0) statistic.sopType.title else "${statistic.sopType.title}(${statistic.count})"
+                        if (statistic.count == 0) "0" else "${statistic.count}"
                     )
                 }
             }
@@ -76,11 +81,23 @@ class WorkshopFragment(val changePage: (PageChangeBO) -> Unit) :
                 }
             }
         }
-
+        val animator = ObjectAnimator.ofFloat(mBinding?.tvCreateTips, "alpha", 0f, 1f)
+        animator.addListener(onEnd = {
+            mBinding?.tvCreateTips?.visibility = View.INVISIBLE
+        })
         mBinding?.tvCreate?.setOnClickListener {
-            changePage(PageChangeBO(1, mPointList[0].workstationId, machineryName = mPointList[0].name))
+            // changePage(PageChangeBO(1, mPointList[0].workstationId, machineryName = mPointList[0].name))
+            if (!animator.isRunning) {
+                mBinding?.tvCreateTips?.visibility = View.VISIBLE
+                animator.duration = 2000
+                animator.repeatCount = 3
+                animator.repeatMode = ValueAnimator.REVERSE
+                animator.start()
+            }
         }
 
+
+
         initMap()
         refreshPage()
     }
@@ -171,9 +188,9 @@ class WorkshopFragment(val changePage: (PageChangeBO) -> Unit) :
                     markLayer = CustomMarkLayerSample(mBinding?.mapview, mPointList)
                     markLayer?.setMarkIsClickListener(object : CustomMarkLayerSample.MarkIsClickListener {
                         override fun markIsClick(index: Int, btnIndex: Int, isClickIcon: Boolean) {
-//                            if (btnIndex == -1) {
-//                                changePage(PageChangeBO(1, mPointList[index].workstationId, machineryName = mPointList[index].name))
-//                            }
+                            if (btnIndex == -1) {
+                                changePage(PageChangeBO(1, mPointList[index].workstationId, machineryName = mPointList[index].name))
+                            }
                         }
                     })
                     mBinding?.mapview?.addLayer(markLayer)

+ 3 - 2
app/src/main/java/com/grkj/iscs_mars/view/widget/CustomMarkLayerSample.kt

@@ -5,6 +5,7 @@ import android.graphics.Color
 import android.graphics.Matrix
 import android.graphics.Paint
 import android.graphics.RectF
+import android.util.Log
 import android.view.MotionEvent
 import com.grkj.iscs_mars.util.IconCache
 import com.grkj.iscs_mars.view.fragment.WorkshopFragment.CustomPoint
@@ -159,8 +160,8 @@ class CustomMarkLayerSample @JvmOverloads constructor(
 
             if (isClickMark) break
         }
-
-        if (listener != null && isClickMark) {
+        Log.d("xiaoming","COUNT ${event.pointerCount} ${event.action}")
+        if (listener != null && isClickMark && event.pointerCount == 1) {
             listener!!.markIsClick(num, btnIndex, isClickIcon)
             mapView.refreshWorld()
         }

+ 25 - 8
app/src/main/java/com/onlylemi/mapview/library/MapView.java

@@ -100,7 +100,8 @@ public class MapView extends TextureView implements TextureView.SurfaceTextureLi
     private volatile boolean renderEnabled = true;
 
     private final Runnable renderRunnable = new Runnable() {
-        @Override public void run() {
+        @Override
+        public void run() {
             try {
                 if (!renderEnabled) return;
                 drawScheduled.set(false);
@@ -114,7 +115,7 @@ public class MapView extends TextureView implements TextureView.SurfaceTextureLi
                 synchronized (stateLock) {
                     m.set(drawMatrix);
                     zoom = drawZoom;
-                    deg  = drawRotateDeg;
+                    deg = drawRotateDeg;
                 }
 
                 // 1) 世界缓冲(offscreen 双缓冲)
@@ -132,7 +133,9 @@ public class MapView extends TextureView implements TextureView.SurfaceTextureLi
                             if (layer.isVisible) layer.draw(backCanvas, IDENTITY, zoom, deg);
                         }
                         // 原子交换 front/back
-                        Bitmap tmp = frontBmp; frontBmp = backBmp; backBmp = tmp;
+                        Bitmap tmp = frontBmp;
+                        frontBmp = backBmp;
+                        backBmp = tmp;
                         backCanvas.setBitmap(backBmp);
                         worldDirty = false;
                     }
@@ -218,7 +221,10 @@ public class MapView extends TextureView implements TextureView.SurfaceTextureLi
     }
 
     private final Choreographer.FrameCallback vsyncCallback = frameTimeNanos -> {
-        if (!renderEnabled || renderHandler == null) { drawScheduled.set(false); return; }
+        if (!renderEnabled || renderHandler == null) {
+            drawScheduled.set(false);
+            return;
+        }
         renderHandler.post(renderRunnable);
         drawScheduled.set(false);
     };
@@ -275,7 +281,9 @@ public class MapView extends TextureView implements TextureView.SurfaceTextureLi
 
     private void runOrDeferCameraOp(Runnable op) {
         if (userGestureActive) {
-            synchronized (cameraOpLock) { pendingCameraOp = op; }
+            synchronized (cameraOpLock) {
+                pendingCameraOp = op;
+            }
         } else {
             // 放到主线程执行,避免线程问题
             post(op);
@@ -284,7 +292,10 @@ public class MapView extends TextureView implements TextureView.SurfaceTextureLi
 
     private void flushPendingCameraOp() {
         Runnable r;
-        synchronized (cameraOpLock) { r = pendingCameraOp; pendingCameraOp = null; }
+        synchronized (cameraOpLock) {
+            r = pendingCameraOp;
+            pendingCameraOp = null;
+        }
         if (r != null) post(r);
     }
 
@@ -352,12 +363,16 @@ public class MapView extends TextureView implements TextureView.SurfaceTextureLi
         }
     }
 
+    // 是否单指操作
+    private boolean isTouchSingle = true;
+
     @Override
     public boolean onTouchEvent(MotionEvent event) {
         if (!isMapLoadFinish) return false;
         int action = event.getAction() & MotionEvent.ACTION_MASK;
         switch (action) {
             case MotionEvent.ACTION_DOWN:
+                isTouchSingle = true;
                 setGestureActive(true);
                 if (cameraAnimator != null && cameraAnimator.isRunning()) cameraAnimator.cancel();
                 saveMatrix.set(currentMatrix);
@@ -365,10 +380,11 @@ public class MapView extends TextureView implements TextureView.SurfaceTextureLi
                 lastMove.set(event.getX(), event.getY());
                 currentTouchState = TOUCH_STATE_SCROLL;
                 for (MapBaseLayer layer : layers) {
-                    layer.onTouch(event);
+                    if (isTouchSingle) layer.onTouch(event);
                 }
                 break;
             case MotionEvent.ACTION_POINTER_DOWN:
+                isTouchSingle = false;
                 setGestureActive(true);
                 if (event.getPointerCount() == 2) {
                     saveMatrix.set(currentMatrix);
@@ -383,8 +399,9 @@ public class MapView extends TextureView implements TextureView.SurfaceTextureLi
                 setGestureActive(false);   // 这里会自动 flush 最后一次相机请求
                 if (withFloorPlan(event.getX(), event.getY())) {
                     for (MapBaseLayer layer : layers) {
-                        layer.onTouch(event);
+                        if (isTouchSingle) layer.onTouch(event);
                     }
+                    isTouchSingle = true;
                 }
                 currentTouchState = TOUCH_STATE_NO;
                 break;

+ 12 - 0
app/src/main/res/layout/fragment_workshop.xml

@@ -63,6 +63,18 @@
             android:layout_width="match_parent"
             android:layout_height="300dp" />
 
+        <TextView
+            android:id="@+id/tv_create_tips"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@drawable/common_btn_blue_bg"
+            android:paddingHorizontal="10dp"
+            android:paddingVertical="15dp"
+            android:text="@string/guide_create_job"
+            android:textColor="@color/white"
+            android:textSize="16sp"
+            android:visibility="invisible" />
+
     </com.google.android.material.card.MaterialCardView>
 
     <com.google.android.material.card.MaterialCardView

+ 21 - 20
app/src/main/res/values-en/strings.xml

@@ -143,7 +143,7 @@
     <string name="machinery_pic">Technology Diagram</string>
     <string name="lock_station">LOTO Station</string>
     <string name="locker">Locker</string>
-    <string name="colocker">group lock member</string>
+    <string name="colocker">Group Lock Member</string>
     <string name="select">Select</string>
     <string name="select_locker">Select Locker</string>
     <string name="select_coloker_mars">Select Internal Member</string>
@@ -289,7 +289,7 @@
     <string name="start_to_send_ticket">Starting to issue Job...</string>
     <string name="sending_ticket">Issuing Job...</string>
     <string name="send_ticket_fail">Failed to issue Job</string>
-    <string name="login_method_tip">● Scan Card to login derectly.</string>
+    <string name="login_method_tip">● Scan Card to login directly.</string>
     <string name="use_default_cabinet_id">Will use default CabinetId</string>
     <string name="please_set_url">Please enter URL, empty will use default</string>
     <string name="url_format_error">Please start with http:// or https://</string>
@@ -316,27 +316,27 @@
     <string name="no_key_to_repair">Key does not exist, cannot repair</string>
     <string name="key_take_error_tip">Key assignment failed, please check device status</string>
 
-    <string name="index_number">number</string>
-    <string name="icon">icons</string>
+    <string name="index_number">Number</string>
+    <string name="icon">Icons</string>
     <string name="ticket_name">Ticket Name</string>
-    <string name="check">view</string>
+    <string name="check">View</string>
     <string name="ticket_processing">Jobs In Progress</string>
     <string name="has_no_point_can_unlock">has no point can unlock</string>
     <string name="all_point_already_locked">all point already locked</string>
-    <string name="please_done_lock_action_and_colock_action">please done lock action and colock action</string>
-    <string name="please_done_all_unlock_action">please done all unlock action</string>
-    <string name="step_mode_select">select step mode</string>
-    <string name="mode_one">mode 1</string>
-    <string name="mode_two">mode 2</string>
-    <string name="step_mode_change_success">step mode change success</string>
-    <string name="user_already_unlock">user already unlock</string>
-    <string name="please_wait_all_colocker_unlocked">please wait all colocker unlocked</string>
-    <string name="current_colocker_already_locked">current colocker already locked</string>
-    <string name="current_colocker_already_unlocked">current colocker already unlocked</string>
-    <string name="can_not_remove_current_colocker">can not remove current colocker</string>
-    <string name="current_step_not_allowed_to_add_colocker">current step not allowed to add colocker</string>
-    <string name="keep_at_least_colocker">keep at least %1$d colocker</string>
-    <string name="action_hint">action hint</string>
+    <string name="please_done_lock_action_and_colock_action">Please done lock action and colock action</string>
+    <string name="please_done_all_unlock_action">Please done all unlock action</string>
+    <string name="step_mode_select">Select step mode</string>
+    <string name="mode_one">Mode 1</string>
+    <string name="mode_two">Mode 2</string>
+    <string name="step_mode_change_success">Step mode change success</string>
+    <string name="user_already_unlock">User already unlock</string>
+    <string name="please_wait_all_colocker_unlocked">Please wait all colocker unlocked</string>
+    <string name="current_colocker_already_locked">Current colocker already locked</string>
+    <string name="current_colocker_already_unlocked">Current colocker already unlocked</string>
+    <string name="can_not_remove_current_colocker">Can not remove current colocker</string>
+    <string name="current_step_not_allowed_to_add_colocker">Current step not allowed to add colocker</string>
+    <string name="keep_at_least_colocker">Keep at least %1$d colocker</string>
+    <string name="action_hint">Action hint</string>
     <string name="take_one_more_key_hint">I have already taken out the key, would you like to take out another one</string>
     <string name="current_user_does_not_have_the_authority_to_colock">The current user does not have the authority to colock</string>
     <string name="current_user_does_not_have_the_authority_to_unlock_colock">The current user does not have the authority to unlock colock</string>
@@ -357,7 +357,7 @@
     <string name="recovery_failed">recovery failed</string>
     <string name="no_permission">no permission</string>
     <string name="exception_select_hardware_tip">Please select hardware</string>
-    <string name="check_key_and_lock">check key and lock</string>
+    <string name="check_key_and_lock">Check key and lock ...</string>
     <string name="turn_read">read</string>
     <string name="lock_nfc_lost">挂锁nfc缺失!</string>
     <string name="key_exception_tag">Key is tag for exception</string>
@@ -444,4 +444,5 @@
     <string name="common_about">About</string>
     <string name="about_app_name">App Name</string>
     <string name="about_app_version">App Version</string>
+    <string name="common_update">Update</string>
 </resources>

+ 1 - 0
app/src/main/res/values-zh/strings.xml

@@ -444,4 +444,5 @@
     <string name="common_about">关于</string>
     <string name="about_app_name">应用名</string>
     <string name="about_app_version">版本号</string>
+    <string name="common_update">更新</string>
 </resources>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -444,4 +444,5 @@
     <string name="common_about">关于</string>
     <string name="about_app_name">应用名</string>
     <string name="about_app_version">版本号</string>
+    <string name="common_update">更新</string>
 </resources>