Ver código fonte

配合测试完成诸多BUG修复

JaycePC 7 meses atrás
pai
commit
d642a50c12
30 arquivos alterados com 408 adições e 154 exclusões
  1. 47 3
      HttpCoreLibrary/src/main/java/com/rc/httpcore/bean/HxpChemicalVo.java
  2. 9 7
      HttpCoreLibrary/src/main/java/com/rc/httpcore/bean/UserValidationBean.kt
  3. 2 0
      HttpCoreLibrary/src/main/java/com/rc/httpcore/client/HttpTool.java
  4. 2 2
      app/src/main/java/com/example/chemical/ChemicalApp.kt
  5. 0 1
      app/src/main/java/com/example/chemical/ui/MainActivity.kt
  6. 3 2
      app/src/main/java/com/example/chemical/ui/common/BaseCountDownActivity.kt
  7. 5 1
      app/src/main/java/com/example/chemical/ui/inquiry/InquiryActivity.kt
  8. 8 9
      app/src/main/java/com/example/chemical/ui/login/FacialCardActivity.kt
  9. 4 8
      app/src/main/java/com/example/chemical/ui/login/FacialLoginActivity.kt
  10. 4 7
      app/src/main/java/com/example/chemical/ui/login/ScanLoginActivity.kt
  11. 5 8
      app/src/main/java/com/example/chemical/ui/login/SwipeActivity.kt
  12. 0 3
      app/src/main/java/com/example/chemical/ui/plan/PlanAdapter.java
  13. 21 14
      app/src/main/java/com/example/chemical/ui/plan/PlanAddActivity.java
  14. 79 7
      app/src/main/java/com/example/chemical/ui/plan/PlanAddActivityHelp.java
  15. 23 4
      app/src/main/java/com/example/chemical/ui/plan/add/AddActivity.java
  16. 5 1
      app/src/main/java/com/example/chemical/ui/plan/add/AddActivityHelp.java
  17. 67 1
      app/src/main/java/com/example/chemical/ui/plan/locker/LockerFragment.java
  18. 1 1
      app/src/main/java/com/example/chemical/ui/plan/room/bean/locker/CabinetLayerSelect.java
  19. 8 3
      app/src/main/java/com/example/chemical/ui/plan/save_list/SaveListActivity.java
  20. 5 0
      app/src/main/java/com/example/chemical/ui/plan/save_list/SaveListAdapter.java
  21. 9 0
      app/src/main/java/com/example/chemical/ui/plan/save_list/SaveListBean.java
  22. 5 5
      app/src/main/java/com/example/chemical/ui/plan/unlock/UnlockActivityHelp.java
  23. 70 60
      app/src/main/java/com/example/chemical/ui/verify/DoubleVerifyActivityHelp.java
  24. 7 0
      app/src/main/java/com/example/chemical/ui/verify/include/FaceDetectView.java
  25. 12 1
      app/src/main/java/com/example/chemical/weidith/BluetoothWeighDialog.java
  26. 0 2
      app/src/main/java/com/example/chemical/weidith/prin_label_dialog/PrintLabelDialog.java
  27. 1 1
      app/src/main/res/layout/activity_double_verify.xml
  28. 1 0
      app/src/main/res/layout/dialog_bluetooth_weigh.xml
  29. 4 2
      app/src/main/res/layout/item_save_list.xml
  30. 1 1
      config/config.gradle

+ 47 - 3
HttpCoreLibrary/src/main/java/com/rc/httpcore/bean/HxpChemicalVo.java

@@ -45,7 +45,7 @@ public class HxpChemicalVo implements Serializable {
     // 净含量
     private double netContent;
     // 重量
-    private String weigh;
+    private double weigh;
 
     // 归属人id
     private long belongId;
@@ -90,6 +90,50 @@ public class HxpChemicalVo implements Serializable {
     // 存储到哪层层数
     private String layers;
 
+    /**
+     * 是否全新
+     * 1.扫码国瑞码调用接口会返回
+     * 2.手动录入都是旧的 false
+     */
+    private boolean isNew = false;
+
+    /**
+     * 1系统申购 2 待入库添加(待入库2和3) 4采购系统 5危化品系统 6终端新增
+     * 国瑞扫码是4,手动录入是6
+     */
+    private int stockType = 6;
+
+    /**
+     * 入库方式1 称重,2 录入
+     * 如果称重了为1
+     * 没有称重为2
+     */
+    private int joinType = 2;
+
+    public int getStockType() {
+        return stockType;
+    }
+
+    public void setStockType(int stockType) {
+        this.stockType = stockType;
+    }
+
+    public int getJoinType() {
+        return joinType;
+    }
+
+    public void setJoinType(int joinType) {
+        this.joinType = joinType;
+    }
+
+    public boolean isNew() {
+        return isNew;
+    }
+
+    public void setNew(boolean aNew) {
+        isNew = aNew;
+    }
+
     public long getCabinetId() {
         return cabinetId;
     }
@@ -186,11 +230,11 @@ public class HxpChemicalVo implements Serializable {
         this.adminUser = adminUser;
     }
 
-    public String getWeigh() {
+    public double getWeigh() {
         return weigh;
     }
 
-    public void setWeigh(String weigh) {
+    public void setWeigh(double weigh) {
         this.weigh = weigh;
     }
 

+ 9 - 7
HttpCoreLibrary/src/main/java/com/rc/httpcore/bean/UserValidationBean.kt

@@ -9,16 +9,18 @@ data class UserValidationBean(
     val collegeAdmin: Boolean? = false,         //院级管理员
     val schoolLevelAdmin: Boolean? = false,     //校级管理员
     val adminUser: Boolean? = false,            //实验室负责人
+    val apply: Boolean? = false,                // 实验室准入
+    val white: Boolean? = false,                // 白名单
     val userId: String,
     val userName: String,
     var faceImg: String?,  //人员图片
 
-    //校级管理员 schoolLevelAdmin
-    //院级管理员  collegeAdmin
-    //实验室负责人 adminUser
-    //安全负责人 safeUser
-    //柜锁管理员 cabinetAdmin
-    //是否化学品归属人 belongUser
-    //是否化学品归属课题组下成员  toipcUser
+//校级管理员 schoolLevelAdmin
+//院级管理员  collegeAdmin
+//实验室负责人 adminUser
+//安全负责人 safeUser
+//柜锁管理员 cabinetAdmin
+//是否化学品归属人 belongUser
+//是否化学品归属课题组下成员  toipcUser
 
 )

+ 2 - 0
HttpCoreLibrary/src/main/java/com/rc/httpcore/client/HttpTool.java

@@ -95,6 +95,7 @@ public final class HttpTool {
         map.put("cardNum", card);
         map.put("subId", subjectId);
         map.put("doorIds", doorIds);
+        LogUtils.json(map);
         return OkHttpUtils.postSync(HttpConfig.Companion.getAPI_BASE_URL() + "chemical/aio/verify/useCardVerify1", GsonUtils.toJson(map));
     }
 
@@ -107,6 +108,7 @@ public final class HttpTool {
         map.put("code", time);
         map.put("subId", subjectId);
         map.put("doorIds", doorIds);
+        LogUtils.json(map);
         return OkHttpUtils.postSync(HttpConfig.Companion.getAPI_BASE_URL() + "chemical/aio/verify/aioScanLogin1", GsonUtils.toJson(map));
     }
 

+ 2 - 2
app/src/main/java/com/example/chemical/ChemicalApp.kt

@@ -42,10 +42,10 @@ class ChemicalApp : Application() {
         var subRoom: String? = null     //房间号
 
         @JvmField
-        var administrators = false      //是否是校院级管理员  管控类的仅校级管理员或院级管理员可操作  新增入库  操作管控or非管控
+        var administrators = true      //是否是校院级管理员  管控类的仅校级管理员或院级管理员可操作  新增入库  操作管控or非管控
 
         @JvmField
-        var responsibles = false        //是否是 责任人      实验室负责人或安全责任人、柜门管理员   新增入库  只能操作非管控
+        var responsibles = true        //是否是 责任人      实验室负责人或安全责任人、柜门管理员   新增入库  只能操作非管控
     }
 
     override fun onCreate() {

+ 0 - 1
app/src/main/java/com/example/chemical/ui/MainActivity.kt

@@ -604,7 +604,6 @@ class MainActivity : RcBaseActivity<ActivityMainBinding>() {
     private fun basicConfLog() {
         val disposable = ApiRepository.basicConfig(ChemicalApp.subjectId!!)
             .subscribe({ data ->
-                LogUtils.json(data)
                 ChemicalApp.confs = data
                 mLoginType = data.loginType     //登陆方式
                 if (mLoginType == null) {

+ 3 - 2
app/src/main/java/com/example/chemical/ui/common/BaseCountDownActivity.kt

@@ -96,12 +96,13 @@ abstract class BaseCountDownActivity<VB : ViewBinding> : RcBaseActivity<VB>() {
         override fun handleMessage(msg: Message) {
             if (WHAT_COUNT_DOWN == msg.what) {
                 val countDown = MAX_TIME - mCounter
-                LogUtils.d(MAX_TIME, mCounter, countDown)
                 if (isDestroyed) return
                 if (countDown <= 0) {
                     if (Constants.VIEW_TYPE) {
                         //当前在废弃or领用页面
-                        mIBankTeps!!.onViewLint()
+                        if (null != mIBankTeps) {
+                            mIBankTeps!!.onViewLint()
+                        }
                     } else {
                         UiManager.switcherCashier(
                             this@BaseCountDownActivity,

+ 5 - 1
app/src/main/java/com/example/chemical/ui/inquiry/InquiryActivity.kt

@@ -11,6 +11,7 @@ import android.view.LayoutInflater
 import android.view.View
 import android.widget.AdapterView
 import androidx.recyclerview.widget.LinearLayoutManager
+import com.blankj.utilcode.util.LogUtils
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -284,7 +285,7 @@ class InquiryActivity : BaseCountDownActivity<ActivityInquiryBinding>() {
 
 
                 }
-
+                LogUtils.d()
                 //第一个页面
                 goQueryTwoFragment()
             }, { throwable ->
@@ -611,11 +612,13 @@ class InquiryActivity : BaseCountDownActivity<ActivityInquiryBinding>() {
                             map["mtypes"] = "1"
                             UiManager.switcher(this, map, FacialLoginActivity::class.java)
                         }
+
                         "2" -> {
                             //刷卡
                             map["mtypes"] = "1"
                             UiManager.switcher(this, map, SwipeActivity::class.java)
                         }
+
                         else -> {
                             //扫码
                             map["mtypes"] = "1"
@@ -647,6 +650,7 @@ class InquiryActivity : BaseCountDownActivity<ActivityInquiryBinding>() {
                             }
 
                         }
+
                         else -> {
                             //3条
                             try {

+ 8 - 9
app/src/main/java/com/example/chemical/ui/login/FacialCardActivity.kt

@@ -52,7 +52,8 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
     private var mUsbReceiver: UsbReceiver? = null  // 刷卡广播注册
     private var mHandleScanEvent = false //当前是否已经获取过 usb返回的参数
     private lateinit var mFotoapparat: Fotoapparat
-//    private lateinit var mCountDownTimer: CountDownTimer
+
+    //    private lateinit var mCountDownTimer: CountDownTimer
     private var alertDialog: AlertDialog? = null
     private var faceList: String? = null
     private var mFaceImg: String? = null
@@ -116,7 +117,6 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
     }
 
 
-
     private fun takePicture() {
         val format = SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.getDefault())
         val fileName = "${format.format(Calendar.getInstance().time)}.jpg"
@@ -159,7 +159,7 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
     private fun getFaceBack() {
         viewBinding.radio.visibility = View.GONE
         viewBinding.rlResult.visibility = View.VISIBLE
-        viewBinding.imgFace.visibility=View.GONE
+        viewBinding.imgFace.visibility = View.GONE
 //        viewBinding.through.visibility = View.VISIBLE
 //        viewBinding.userName.text = "$mUserName"
 //        Glide.with(this)
@@ -258,9 +258,9 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
                             collegeAdmin == false &&
                             schoolLevelAdmin == false &&
                             adminUser == false
+                    apply == false &&
+                            white == false
                 }
-                ChemicalApp.responsibles = false
-                ChemicalApp.administrators = false
                 if (allFalse) {
                     HttpClient.token = null
                     ChemicalApp.userData = null
@@ -275,19 +275,17 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
                     //是否化学品归属课题组下成员  toipcUser
                     if (data.schoolLevelAdmin == true || data.collegeAdmin == true) {
                         //院级管理员 or 校级管理员
-                        ChemicalApp.administrators = true
                         mFaceImg = data.faceImg
                         getFaceBack()
                     } else if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
                         //实验室负责人 or  安全负责人 or 柜锁管理员
-                        ChemicalApp.responsibles = true
                         mFaceImg = data.faceImg
                         getFaceBack()
                     } else if (data.belongUser == true || data.toipcUser == true) {  //当前身份 归属人or课题组
-                        ChemicalApp.responsibles = false
-                        ChemicalApp.administrators = false
                         mFaceImg = data.faceImg
                         getFaceBack()
+                    } else if (data.white == true || data.apply == true) {// 白名单和实验室准入
+                        getFaceBack()
                     } else {
                         HttpClient.token = null
                         ChemicalApp.userData = null
@@ -450,6 +448,7 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
                     throwable.message!!
                 }
             }
+
             is SocketTimeoutException -> "请求超时,请稍后重试"
             is ConnectException -> "无法连接服务器,请检查网络"
             is HttpException -> "服务器繁忙,请稍后重试"

+ 4 - 8
app/src/main/java/com/example/chemical/ui/login/FacialLoginActivity.kt

@@ -229,7 +229,6 @@ class FacialLoginActivity : BaseCountDownActivity<ActivityFacialLoginBinding>()
         val disposable = ApiRepository.faceCompare(featureData, param)
             .subscribe({ success ->
                 dismissLoading()
-                LogUtils.json(success)
                 ChemicalApp.userData = success
                 LogUtils.d(success.userId, ChemicalApp.subjectId)
                 authenticationInfo(success.userId, ChemicalApp.subjectId!!)
@@ -246,7 +245,6 @@ class FacialLoginActivity : BaseCountDownActivity<ActivityFacialLoginBinding>()
         showLoading("验证中...")
         val disposable = ApiRepository.userCardValidation(userId, subId)
             .subscribe({ data ->
-                LogUtils.json(data)
                 dismissLoading()
                 val allFalse = with(data) {
                     cabinetAdmin == false &&
@@ -256,9 +254,9 @@ class FacialLoginActivity : BaseCountDownActivity<ActivityFacialLoginBinding>()
                             collegeAdmin == false &&
                             schoolLevelAdmin == false &&
                             adminUser == false
+                    apply == false &&
+                            white == false
                 }
-                ChemicalApp.responsibles = false
-                ChemicalApp.administrators = false
                 if (allFalse) {
                     HttpClient.token = null
                     ChemicalApp.userData = null
@@ -273,15 +271,13 @@ class FacialLoginActivity : BaseCountDownActivity<ActivityFacialLoginBinding>()
                     //是否化学品归属课题组下成员  toipcUser
                     if (data.schoolLevelAdmin == true || data.collegeAdmin == true) {
                         //院级管理员 or 校级管理员
-                        ChemicalApp.administrators = true
                         authenticationDialog(data.faceImg, data.userName)
                     } else if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
                         //实验室负责人 or  安全负责人 or 柜锁管理员
-                        ChemicalApp.responsibles = true
                         authenticationDialog(data.faceImg, data.userName)
                     } else if (data.belongUser == true || data.toipcUser == true) {  //当前身份 归属人or课题组
-                        ChemicalApp.responsibles = false
-                        ChemicalApp.administrators = false
+                        authenticationDialog(data.faceImg, data.userName)
+                    } else if (data.white == true || data.apply == true) {// 白名单和实验室准入
                         authenticationDialog(data.faceImg, data.userName)
                     } else {
                         HttpClient.token = null

+ 4 - 7
app/src/main/java/com/example/chemical/ui/login/ScanLoginActivity.kt

@@ -172,9 +172,9 @@ class ScanLoginActivity : BaseCountDownActivity<ActivityScanLoginBinding>() {
                             collegeAdmin == false &&
                             schoolLevelAdmin == false &&
                             adminUser == false
+                    apply == false &&
+                            white == false
                 }
-                ChemicalApp.responsibles = false
-                ChemicalApp.administrators = false
                 if (allFalse) {
                     HttpClient.token = null
                     ChemicalApp.userData = null
@@ -189,16 +189,13 @@ class ScanLoginActivity : BaseCountDownActivity<ActivityScanLoginBinding>() {
                     //是否化学品归属课题组下成员  toipcUser
 
                     if (data.schoolLevelAdmin == true || data.collegeAdmin == true) {
-                        //院级管理员 or 校级管理员
-                        ChemicalApp.administrators = true
                         authenticationDialog(data.faceImg, data.userName)
                     } else if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
                         //实验室负责人 or  安全负责人 or 柜锁管理员
-                        ChemicalApp.responsibles = true
                         authenticationDialog(data.faceImg, data.userName)
                     } else if (data.belongUser == true || data.toipcUser == true) {  //当前身份 归属人or课题组
-                        ChemicalApp.responsibles = false
-                        ChemicalApp.administrators = false
+                        authenticationDialog(data.faceImg, data.userName)
+                    } else if (data.white == true || data.apply == true) {// 白名单和实验室准入
                         authenticationDialog(data.faceImg, data.userName)
                     } else {
                         HttpClient.token = null

+ 5 - 8
app/src/main/java/com/example/chemical/ui/login/SwipeActivity.kt

@@ -170,10 +170,10 @@ class SwipeActivity : BaseCountDownActivity<ActivitySwipeBinding>() {
                             safeUser == false &&
                             collegeAdmin == false &&
                             schoolLevelAdmin == false &&
-                            adminUser == false
+                            adminUser == false &&
+                            apply == false &&
+                            white == false
                 }
-                ChemicalApp.responsibles = false
-                ChemicalApp.administrators = false
                 if (allFalse) {
                     HttpClient.token = null
                     ChemicalApp.userData = null
@@ -188,16 +188,13 @@ class SwipeActivity : BaseCountDownActivity<ActivitySwipeBinding>() {
                     //是否化学品归属人 belongUser
                     //是否化学品归属课题组下成员  toipcUser
                     if (data.schoolLevelAdmin == true || data.collegeAdmin == true) {
-                        //院级管理员 or 校级管理员
-                        ChemicalApp.administrators = true
                         authenticationDialog(data.faceImg, data.userName)
                     } else if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
                         //实验室负责人 or  安全负责人 or 柜锁管理员
-                        ChemicalApp.responsibles = true
                         authenticationDialog(data.faceImg, data.userName)
                     } else if (data.belongUser == true || data.toipcUser == true) {  //当前身份 归属人or课题组
-                        ChemicalApp.responsibles = false
-                        ChemicalApp.administrators = false
+                        authenticationDialog(data.faceImg, data.userName)
+                    } else if (data.white == true || data.apply == true) {// 白名单和实验室准入
                         authenticationDialog(data.faceImg, data.userName)
                     } else {
                         HttpClient.token = null

+ 0 - 3
app/src/main/java/com/example/chemical/ui/plan/PlanAdapter.java

@@ -54,9 +54,6 @@ public class PlanAdapter extends BaseAdapter {
             convertView.setTag(viewHolder);
             binding.itemDelIV.setOnClickListener(v -> {
                 InventoryItemBean inventoryItemBean = inventoryItemBeanList.get(position);
-                LogUtils.json(inventoryItemBean);
-                LogUtils.json(inventoryItemBeanList);
-                LogUtils.json(hxpInventoryDAO.getAll());
                 for (int i = 0; i < inventoryItemBeanList.size(); i++) {
                     InventoryItemBean inventoryItem = inventoryItemBeanList.get(i);
                     if (inventoryItem.getId() == inventoryItemBean.getId()) {

+ 21 - 14
app/src/main/java/com/example/chemical/ui/plan/PlanAddActivity.java

@@ -150,9 +150,9 @@ public class PlanAddActivity extends BaseCountDownActivity<ActivityPlanAddBindin
                     return;
                 }
                 showLoading("加载中...", false);
-                ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<String>() {
+                ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<PlanAddData>() {
                     @Override
-                    public String doInBackground() throws Throwable {
+                    public PlanAddData doInBackground() throws Throwable {
                         List<InventoryItemBean> inventoryItemBeanList = hxpInventoryDAO.getAll();
                         List<HxpCabinetVo> cabinetList = hxpCabinetDAO.getAll();
                         List<HxpCabinetDoorVo> doorList = hxpDoorDAO.getAll();
@@ -206,16 +206,22 @@ public class PlanAddActivity extends BaseCountDownActivity<ActivityPlanAddBindin
                         PlanAddData planAddData = new PlanAddData();
                         planAddData.setCabinetList(cabinetList);
                         planAddData.setDoorList(doorList);
-                        String json = GsonUtils.toJson(planAddData);
-                        LogUtils.d(json);
-                        return json;
+                        return planAddData;
                     }
 
                     @Override
-                    public void onSuccess(String result) {
+                    public void onSuccess(PlanAddData planAddData) {
                         dismissLoading();
+                        List<HxpCabinetVo> cabinetList = planAddData.getCabinetList();
+                        List<HxpCabinetDoorVo> doorList = planAddData.getDoorList();
+                        // 不需要开门
+                        if (null == doorList || cabinetList == null || cabinetList.isEmpty() || doorList.isEmpty()) {
+                            planAddActivityHelp.save();
+                            return;
+                        }
+                        String json = GsonUtils.toJson(planAddData);
                         Intent intent = new Intent(PlanAddActivity.this, UnlockActivity.class);
-                        intent.putExtra("data", result);
+                        intent.putExtra("data", json);
                         startActivity(intent);
                         finish();
                     }
@@ -244,19 +250,20 @@ public class PlanAddActivity extends BaseCountDownActivity<ActivityPlanAddBindin
             String roomNum = ChemicalApp.subRoom;
             roomNum = TextUtils.isEmpty(roomNum) ? "" : roomNum;
             binding.deptName.setText(subName + "-" + roomNum);
-            // 退出
-            binding.tvOutLogin.setOnClickListener(v -> callLogoutApi(aBoolean -> {
-                ChemicalApp.userData = null;
-                ChemicalApp.subjectId = null;
-                UiManager.INSTANCE.switcherCashier(PlanAddActivity.this, SplashActivity.class);
-                return null;
-            }));
 
             //获取实验室基本信息
             getLabInfo();
         } catch (Exception e) {
             LogUtils.e(Log.getStackTraceString(e));
         }
+        // 退出
+        binding.tvOutLogin.setOnClickListener(v -> callLogoutApi(aBoolean -> {
+            ChemicalApp.userData = null;
+            ChemicalApp.subjectId = null;
+            UiManager.INSTANCE.switcherCashier(PlanAddActivity.this, SplashActivity.class);
+            return null;
+        }));
+        binding.tvReturn.setOnClickListener(v -> finish());
     }
 
 

+ 79 - 7
app/src/main/java/com/example/chemical/ui/plan/PlanAddActivityHelp.java

@@ -5,13 +5,10 @@ import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
 
-import androidx.annotation.NonNull;
-
 import com.blankj.utilcode.util.GsonUtils;
 import com.blankj.utilcode.util.LogUtils;
 import com.blankj.utilcode.util.ThreadUtils;
 import com.example.chemical.ChemicalApp;
-import com.example.chemical.receiver.OnSerialScanListener;
 import com.example.chemical.receiver.PortScanHelper;
 import com.example.chemical.ui.plan.add.AddActivity;
 import com.example.chemical.ui.plan.locker.LockerAdapter;
@@ -23,11 +20,17 @@ import com.example.chemical.ui.plan.room.bean.locker.HxpCabinetDoorVo;
 import com.example.chemical.ui.plan.room.bean.locker.HxpCabinetVo;
 import com.example.chemical.ui.plan.room.bean.locker.HxpLabCabinetListVo;
 import com.example.chemical.ui.plan.room.bean.locker.HxpLabCabinetVo;
+import com.example.chemical.ui.plan.room.dao.HxpCabinetDAO;
+import com.example.chemical.ui.plan.room.dao.HxpDoorDAO;
+import com.example.chemical.ui.plan.room.dao.HxpInventoryDAO;
+import com.example.chemical.ui.plan.save_list.SaveListActivity;
 import com.kongzue.dialogx.dialogs.PopTip;
 import com.rc.httpcore.HttpConfig;
+import com.rc.httpcore.bean.BelongingPersonBean;
 import com.rc.httpcore.bean.ChemicalInfoBean;
 import com.rc.httpcore.bean.HxpChemicalVo;
 import com.rc.httpcore.bean.StockDetailsModel;
+import com.rc.httpcore.bean.TopicDataBean;
 import com.rc.httpcore.client.ApiRepository;
 import com.rc.httpcore.client.HttpTool;
 import com.rc.httpcore.exception.NetException;
@@ -147,7 +150,6 @@ public class PlanAddActivityHelp {
         // 选择柜层数据库更新
         activity.hxpLayerDAO.insert(lastSelectInfo);
         activity.hxpLayerDAO.change(lastSelectInfo.getCabinetId(), lastSelectInfo.getDoorId(), lastSelectInfo.getLayer());
-        LogUtils.json(activity.hxpLayerDAO.getAll());
         // 更新待存储列表
         updateInventoryUi();
     }
@@ -188,6 +190,7 @@ public class PlanAddActivityHelp {
                 Response response = HttpTool.scanCodeChemical(code, ChemicalApp.subjectId);
                 if (response.isSuccessful()) {
                     String json = response.body().string();
+                    LogUtils.d(json);
                     JSONObject jsonObject = new JSONObject(json);
                     if (200 == jsonObject.getInt("code")) {
                         return GsonUtils.fromJson(jsonObject.getJSONObject("data").toString(), HxpChemicalVo.class);
@@ -203,9 +206,7 @@ public class PlanAddActivityHelp {
 
             @Override
             public void onSuccess(HxpChemicalVo result) {
-                if (result == null) {
-                    PopTip.show("未找到该化学品!");
-                } else {
+                if (result != null) {
                     List<StockDetailsModel> stockDetailsModelList = result.getStockDetailsModelList();
                     if (null == stockDetailsModelList) {
                         stockDetailsModelList = new ArrayList<>();
@@ -287,4 +288,75 @@ public class PlanAddActivityHelp {
         return null;
     }
 
+    public void save() {
+        ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<String>() {
+            @Override
+            public String doInBackground() throws Throwable {
+                HxpInventoryDAO hxpInventoryDAO = RoomTool.getInstance().hxpInventoryDAO();
+                HxpCabinetDAO cabinetDAO = RoomTool.getInstance().hxpCabinetDAO();
+                HxpDoorDAO doorDAO = RoomTool.getInstance().hxpDoorDAO();
+                List<InventoryItemBean> inventoryItemBeanList = hxpInventoryDAO.getAll();
+                List<HxpChemicalVo> hxpChemicalVoList = new ArrayList<>();
+                for (int i = 0; i < inventoryItemBeanList.size(); i++) {
+                    InventoryItemBean inventoryItemBean = inventoryItemBeanList.get(i);
+                    BelongingPersonBean belongingPersonBean = inventoryItemBean.getBelongingPersonBean();
+                    TopicDataBean topicDataBean = inventoryItemBean.getTopicDataBean();
+                    HxpChemicalVo hxpChemicalVo = inventoryItemBean.getHxpChemicalVo();
+                    if (null == belongingPersonBean) {
+                        hxpChemicalVo.setBelongId(Long.parseLong(topicDataBean.getTopicId()));
+                        hxpChemicalVo.setBelongName(topicDataBean.getTopicName());
+                        hxpChemicalVo.setBelongType(1);
+                    } else {
+                        hxpChemicalVo.setBelongId(Long.parseLong(belongingPersonBean.getUserId()));
+                        hxpChemicalVo.setBelongName(belongingPersonBean.getUserName());
+                        hxpChemicalVo.setBelongType(2);
+                    }
+                    hxpChemicalVo.setSubId(Long.parseLong(ChemicalApp.subjectId));
+
+                    hxpChemicalVo.setChemicalNumber(inventoryItemBean.getSize());
+                    HxpCabinetVo cabinetVo = cabinetDAO.getById(inventoryItemBean.getCabinetId());
+                    hxpChemicalVo.setCabinetId(cabinetVo.getCabinetId());
+                    hxpChemicalVo.setCabinetName(cabinetVo.getCabinetName());
+
+                    HxpCabinetDoorVo doorVo = doorDAO.getById(inventoryItemBean.getDoorId());
+                    // 后台要求这么传
+                    hxpChemicalVo.setDoorId(doorVo.getDoorUniqueId());
+                    hxpChemicalVo.setDoorName(doorVo.getDoorName());
+
+                    hxpChemicalVo.setLayers(String.valueOf(inventoryItemBean.getLayer()));
+                    hxpChemicalVoList.add(hxpChemicalVo);
+                }
+                Response response = HttpTool.addChemical(hxpChemicalVoList);
+                if (response.isSuccessful()) {
+                    String json = response.body().string();
+                    JSONObject jsonObject = new JSONObject(json);
+                    int code = jsonObject.getInt("code");
+                    if (code == 200) {
+                        return "";
+                    } else {
+                        return jsonObject.getString("message");
+                    }
+                } else {
+                    return response.message();
+                }
+            }
+
+            @Override
+            public void onSuccess(String result) {
+                activity.dismissLoading();
+                if (!TextUtils.isEmpty(result)) {
+                    PopTip.show(result);
+                } else {
+                    activity.finish();
+                    activity.startActivity(new Intent(activity, SaveListActivity.class));
+                }
+            }
+
+            @Override
+            public void onFail(Throwable t) {
+                super.onFail(t);
+                activity.dismissLoading();
+            }
+        });
+    }
 }

+ 23 - 4
app/src/main/java/com/example/chemical/ui/plan/add/AddActivity.java

@@ -68,9 +68,9 @@ public class AddActivity extends BaseCountDownActivity<ActivityAddBinding> {
 
     private AddActivityHelp addActivityHelp;
 
-    private HxpCabinetDAO hxpCabinetDAO;
-    private HxpDoorDAO hxpDoorDAO;
-    private HxpLayerDAO hxpLayerDAO;
+    protected HxpCabinetDAO hxpCabinetDAO;
+    protected HxpDoorDAO hxpDoorDAO;
+    protected HxpLayerDAO hxpLayerDAO;
 
     private ActivityResultLauncher<Intent> intentActivityResultLauncher;
 
@@ -195,6 +195,10 @@ public class AddActivity extends BaseCountDownActivity<ActivityAddBinding> {
                             CabinetLayerSelect cabinetLayerSelect = (CabinetLayerSelect) bundle.getSerializable("Change");
                             if (null != cabinetLayerSelect) {
                                 hxpLayerDAO.change(cabinetLayerSelect.getCabinetId(), cabinetLayerSelect.getDoorId(), cabinetLayerSelect.getLayer());
+                                inventoryItemBean.setCabinetId(cabinetLayerSelect.getCabinetId());
+                                inventoryItemBean.setDoorId(cabinetLayerSelect.getDoorId());
+                                inventoryItemBean.setLayer(cabinetLayerSelect.getLayer());
+
                                 HxpCabinetVo hxpCabinetVo = hxpCabinetDAO.getById(cabinetLayerSelect.getCabinetId());
                                 String cabinetName = hxpCabinetVo.getCabinetName();
                                 cabinetName = TextUtils.isEmpty(cabinetName) ? "" : cabinetName;
@@ -210,7 +214,12 @@ public class AddActivity extends BaseCountDownActivity<ActivityAddBinding> {
                 }
             }
         });
-        binding.changeCabinetBT.setOnClickListener(v -> intentActivityResultLauncher.launch(new Intent(AddActivity.this, ChangeCabinetActivity.class)));
+        binding.changeCabinetBT.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                intentActivityResultLauncher.launch(new Intent(AddActivity.this, ChangeCabinetActivity.class));
+            }
+        });
 
         // 返回
         binding.tvReturn.setOnClickListener(v -> finish());
@@ -243,6 +252,16 @@ public class AddActivity extends BaseCountDownActivity<ActivityAddBinding> {
             PopTip.show("化学品类别获取失败!");
         }));
         addActivityHelp = new AddActivityHelp(AddActivity.this);
+        // 默认归属人是登录人信息
+        if (ChemicalApp.userData != null) {
+            belongingPerson = new BelongingPersonBean(ChemicalApp.userData.getUserId(), ChemicalApp.userData.getUserName(), ChemicalApp.userData.getAccount(), "", "");
+            String userName = belongingPerson.getUserName();
+            userName = TextUtils.isEmpty(userName) ? "" : userName;
+            String account = belongingPerson.getAccount();
+            account = TextUtils.isEmpty(account) ? "" : account;
+            binding.belongET.setText(userName + "-" + account);
+            binding.belongET.setTag(belongingPerson.getUserId());
+        }
     }
 
     private void initUi() {

+ 5 - 1
app/src/main/java/com/example/chemical/ui/plan/add/AddActivityHelp.java

@@ -11,6 +11,10 @@ import com.blankj.utilcode.util.GsonUtils;
 import com.blankj.utilcode.util.LogUtils;
 import com.blankj.utilcode.util.ThreadUtils;
 import com.example.chemical.ui.plan.room.bean.input_add.HxpChemical;
+import com.example.chemical.ui.plan.room.bean.input_add.InventoryItemBean;
+import com.example.chemical.ui.plan.room.bean.locker.CabinetLayerSelect;
+import com.example.chemical.ui.plan.room.bean.locker.HxpCabinetDoorVo;
+import com.example.chemical.ui.plan.room.bean.locker.HxpCabinetVo;
 import com.example.chemical.weidith.BelongingPersonDialog;
 import com.example.chemical.weidith.BluetoothWeighDialog;
 import com.example.chemical.weidith.SelectChemicalDialog;
@@ -501,7 +505,7 @@ public class AddActivityHelp {
 
         // 归属人
         if (2 == chemicalVo.getBelongType()) {
-            activity.belongingPerson = new BelongingPersonBean(String.valueOf(chemicalVo.getBelongId()), chemicalVo.getBelongName(), chemicalVo.getBelongAccount(), null, null);
+            activity.belongingPerson = new BelongingPersonBean(String.valueOf(chemicalVo.getBelongId()), chemicalVo.getBelongName(), chemicalVo.getBelongAccount(), "", "");
             String belongName = activity.belongingPerson.getUserName();
             String belongAccount = activity.belongingPerson.getAccount();
             belongName = TextUtils.isEmpty(belongName) ? "" : belongName;

+ 67 - 1
app/src/main/java/com/example/chemical/ui/plan/locker/LockerFragment.java

@@ -1,5 +1,6 @@
 package com.example.chemical.ui.plan.locker;
 
+import android.graphics.Color;
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
@@ -15,11 +16,13 @@ import com.example.chemical.R;
 import com.example.chemical.databinding.FragmentLockerBinding;
 import com.example.chemical.ui.plan.FragmentCallBack;
 import com.example.chemical.ui.plan.room.RoomTool;
+import com.example.chemical.ui.plan.room.bean.input_add.InventoryItemBean;
 import com.example.chemical.ui.plan.room.bean.locker.HxpCabinetDoorVo;
 import com.example.chemical.ui.plan.room.bean.locker.HxpCabinetVo;
 import com.example.chemical.ui.plan.room.bean.locker.CabinetLayerSelect;
 import com.example.chemical.ui.plan.room.dao.HxpCabinetDAO;
 import com.example.chemical.ui.plan.room.dao.HxpDoorDAO;
+import com.example.chemical.ui.plan.room.dao.HxpInventoryDAO;
 import com.example.chemical.ui.plan.room.dao.HxpLayerDAO;
 
 import java.util.LinkedList;
@@ -42,6 +45,7 @@ public class LockerFragment extends Fragment {
     private HxpDoorDAO hxpDoorDAO;
     private HxpLayerDAO hxpLayerDAO;
     private HxpCabinetVo hxpCabinetVo;
+    private HxpInventoryDAO hxpInventoryDAO;
 
     public LockerFragment(long cabinetId, FragmentCallBack fragmentCallBack) {
         this.cabinetId = cabinetId;
@@ -91,9 +95,13 @@ public class LockerFragment extends Fragment {
         hxpCabinetDAO = RoomTool.getInstance().hxpCabinetDAO();
         hxpDoorDAO = RoomTool.getInstance().hxpDoorDAO();
         hxpLayerDAO = RoomTool.getInstance().hxpLayerDAO();
+        hxpInventoryDAO = RoomTool.getInstance().hxpInventoryDAO();
         hxpCabinetVo = hxpCabinetDAO.getById(cabinetId);
         // 所有柜门
         doorVoList = hxpDoorDAO.getByCabinetId(cabinetId);
+        // 所有待存储清单
+        List<InventoryItemBean> inventoryItemBeanList = hxpInventoryDAO.getAll();
+
         for (int i = 0; i < drawerUiUpList.size(); i++) {
             drawerUiUpList.get(i).getRadioButton().setOnClickListener(onClickDoorUpListener);
         }
@@ -103,7 +111,13 @@ public class LockerFragment extends Fragment {
         if (null != doorVoList) {
             // 柜子名称
             String cabinetName = hxpCabinetVo.getCabinetName();
-            binding.lockerNameTV.setText(TextUtils.isEmpty(cabinetName) ? "" : cabinetName);
+            // 库存总数
+            int stockCount = 0;
+            for (int i = 0; i < doorVoList.size(); i++) {
+                HxpCabinetDoorVo hxpCabinetDoorVo = doorVoList.get(i);
+                stockCount = stockCount + hxpCabinetDoorVo.getStockNum();
+            }
+            binding.lockerNameTV.setText(TextUtils.isEmpty(cabinetName) ? "" : cabinetName + "(" + stockCount + ")");
             // 选中的柜层信息
             CabinetLayerSelect cabinetLayerSelect = hxpLayerDAO.getCabinetChanged(cabinetId);
             // 一个柜门
@@ -135,6 +149,24 @@ public class LockerFragment extends Fragment {
                         if (layer > 0 && (i + 1) == layer) {
                             drawerUiBean.getRadioButton().setChecked(true);
                         }
+                        if (null != inventoryItemBeanList && !inventoryItemBeanList.isEmpty()) {
+                            boolean isHasHxp = false;
+                            for (int j = 0; j < inventoryItemBeanList.size(); j++) {
+                                InventoryItemBean inventoryItemBean = inventoryItemBeanList.get(j);
+                                if (hxpCabinetDoorVo.getDoorId() == inventoryItemBean.getDoorId()) {
+                                    if (inventoryItemBean.getLayer() == (i + 1)) {
+                                        isHasHxp = true;
+                                        break;
+                                    }
+                                }
+                            }
+                            if (isHasHxp) {
+                                drawerUiBean.getTextView().setTextColor(Color.parseColor("#FFFF8C00"));
+                            } else {
+                                drawerUiBean.getTextView().setTextColor(Color.WHITE);
+                            }
+                        }
+
                     }
                 }
             }
@@ -167,6 +199,23 @@ public class LockerFragment extends Fragment {
                             drawerUiBean.getRadioButton().setChecked(true);
                         }
                     }
+                    if (null != inventoryItemBeanList && !inventoryItemBeanList.isEmpty()) {
+                        boolean isHasHxp = false;
+                        for (int j = 0; j < inventoryItemBeanList.size(); j++) {
+                            InventoryItemBean inventoryItemBean = inventoryItemBeanList.get(j);
+                            if (hxpCabinetDoorUpVo.getDoorId() == inventoryItemBean.getDoorId()) {
+                                if (inventoryItemBean.getLayer() == (i + 1)) {
+                                    isHasHxp = true;
+                                    break;
+                                }
+                            }
+                        }
+                        if (isHasHxp) {
+                            drawerUiBean.getTextView().setTextColor(Color.parseColor("#FFFF8C00"));
+                        } else {
+                            drawerUiBean.getTextView().setTextColor(Color.WHITE);
+                        }
+                    }
                 }
 
                 binding.lockerDownDrawerLL.setVisibility(View.VISIBLE);
@@ -198,6 +247,23 @@ public class LockerFragment extends Fragment {
                             drawerUiBean.getRadioButton().setChecked(true);
                         }
                     }
+                    if (null != inventoryItemBeanList && !inventoryItemBeanList.isEmpty()) {
+                        boolean isHasHxp = false;
+                        for (int j = 0; j < inventoryItemBeanList.size(); j++) {
+                            InventoryItemBean inventoryItemBean = inventoryItemBeanList.get(j);
+                            if (hxpCabinetDoorDownVo.getDoorId() == inventoryItemBean.getDoorId()) {
+                                if (inventoryItemBean.getLayer() == (i + 1)) {
+                                    isHasHxp = true;
+                                    break;
+                                }
+                            }
+                        }
+                        if (isHasHxp) {
+                            drawerUiBean.getTextView().setTextColor(Color.parseColor("#FFFF8C00"));
+                        } else {
+                            drawerUiBean.getTextView().setTextColor(Color.WHITE);
+                        }
+                    }
                 }
 
             }

+ 1 - 1
app/src/main/java/com/example/chemical/ui/plan/room/bean/locker/CabinetLayerSelect.java

@@ -13,8 +13,8 @@ import java.io.Serializable;
 public class CabinetLayerSelect implements Serializable {
 
     // 当前选择存储的柜子ID
-    @PrimaryKey
     private long cabinetId;
+    @PrimaryKey
     // 当前选择存储柜子的柜门ID
     private long doorId;
     // 当前选择存储柜子的哪一层

+ 8 - 3
app/src/main/java/com/example/chemical/ui/plan/save_list/SaveListActivity.java

@@ -123,6 +123,9 @@ public class SaveListActivity extends BaseCountDownActivity<ActivitySaveListBind
             } else {
                 saveListBean.setTitle(false);
             }
+            List<HxpCabinetLockVo> hxpCabinetLockVoList = doorVo.getCabinetLockVoList();
+            saveListBean.setUnlock(null != hxpCabinetLockVoList && !hxpCabinetLockVoList.isEmpty());
+
             saveListBeanList.add(saveListBean);
             saveListBeanMap.put(doorVo.getDoorId(), saveListBeanList);
         }
@@ -135,9 +138,11 @@ public class SaveListActivity extends BaseCountDownActivity<ActivitySaveListBind
         }
 
         Intent getIntent = getIntent();
-        planAddData = GsonUtils.fromJson(getIntent.getStringExtra("data"), PlanAddData.class);
-        userValidation1 = GsonUtils.fromJson(getIntent.getStringExtra("userValidation1"), UserValidationBean.class);
-        userValidation2 = GsonUtils.fromJson(getIntent.getStringExtra("userValidation2"), UserValidationBean.class);
+        if (null != getIntent && getIntent.hasExtra("data")) {
+            planAddData = GsonUtils.fromJson(getIntent.getStringExtra("data"), PlanAddData.class);
+            userValidation1 = GsonUtils.fromJson(getIntent.getStringExtra("userValidation1"), UserValidationBean.class);
+            userValidation2 = GsonUtils.fromJson(getIntent.getStringExtra("userValidation2"), UserValidationBean.class);
+        }
 
         binding.exit.setOnClickListener(v -> UiManager.INSTANCE.switcher(SaveListActivity.this, MainActivity.class));
 

+ 5 - 0
app/src/main/java/com/example/chemical/ui/plan/save_list/SaveListAdapter.java

@@ -91,6 +91,11 @@ public class SaveListAdapter extends BaseAdapter {
                 } else {
                     viewHolder.binding.titlleLL.setVisibility(View.GONE);
                 }
+                if (saveListBean.isUnlock()) {
+                    viewHolder.binding.unlockBT.setVisibility(View.VISIBLE);
+                } else {
+                    viewHolder.binding.unlockBT.setVisibility(View.GONE);
+                }
                 String cabinetName = saveListBean.getCabinetName();
                 cabinetName = TextUtils.isEmpty(cabinetName) ? "" : cabinetName;
                 String doorName = saveListBean.getDoorName();

+ 9 - 0
app/src/main/java/com/example/chemical/ui/plan/save_list/SaveListBean.java

@@ -8,6 +8,15 @@ public class SaveListBean {
     private long doorId;
     private String doorName;
     private boolean isTitle;
+    private boolean isUnlock;
+
+    public boolean isUnlock() {
+        return isUnlock;
+    }
+
+    public void setUnlock(boolean unlock) {
+        isUnlock = unlock;
+    }
 
     private InventoryItemBean inventoryItemBean;
 

+ 5 - 5
app/src/main/java/com/example/chemical/ui/plan/unlock/UnlockActivityHelp.java

@@ -504,7 +504,6 @@ public class UnlockActivityHelp {
                 HxpCabinetDAO cabinetDAO = RoomTool.getInstance().hxpCabinetDAO();
                 HxpDoorDAO doorDAO = RoomTool.getInstance().hxpDoorDAO();
                 List<InventoryItemBean> inventoryItemBeanList = hxpInventoryDAO.getAll();
-                LogUtils.json(inventoryItemBeanList);
                 List<HxpChemicalVo> hxpChemicalVoList = new ArrayList<>();
                 for (int i = 0; i < inventoryItemBeanList.size(); i++) {
                     InventoryItemBean inventoryItemBean = inventoryItemBeanList.get(i);
@@ -514,11 +513,11 @@ public class UnlockActivityHelp {
                     if (null == belongingPersonBean) {
                         hxpChemicalVo.setBelongId(Long.parseLong(topicDataBean.getTopicId()));
                         hxpChemicalVo.setBelongName(topicDataBean.getTopicName());
-                        hxpChemicalVo.setBelongType(2);
+                        hxpChemicalVo.setBelongType(1);
                     } else {
                         hxpChemicalVo.setBelongId(Long.parseLong(belongingPersonBean.getUserId()));
-                        hxpChemicalVo.setBelongName(belongingPersonBean.getUserId());
-                        hxpChemicalVo.setBelongType(1);
+                        hxpChemicalVo.setBelongName(belongingPersonBean.getUserName());
+                        hxpChemicalVo.setBelongType(2);
                     }
                     hxpChemicalVo.setOneUserId(Long.parseLong(userValidation1.getUserId()));
                     hxpChemicalVo.setOneUserName(userValidation1.getUserName());
@@ -532,7 +531,8 @@ public class UnlockActivityHelp {
                     hxpChemicalVo.setCabinetName(cabinetVo.getCabinetName());
 
                     HxpCabinetDoorVo doorVo = doorDAO.getById(inventoryItemBean.getDoorId());
-                    hxpChemicalVo.setDoorId(doorVo.getDoorId());
+                    // 后台要求这么干
+                    hxpChemicalVo.setDoorId(doorVo.getDoorUniqueId());
                     hxpChemicalVo.setDoorName(doorVo.getDoorName());
 
                     hxpChemicalVo.setLayers(String.valueOf(inventoryItemBean.getLayer()));

+ 70 - 60
app/src/main/java/com/example/chemical/ui/verify/DoubleVerifyActivityHelp.java

@@ -121,10 +121,17 @@ public class DoubleVerifyActivityHelp {
         boolean isAdmin = Boolean.TRUE.equals(userValidation.getSafeUser()) || Boolean.TRUE.equals(userValidation.getAdminUser()) || Boolean.TRUE.equals(userValidation.getCabinetAdmin());
         Triple<Boolean, Boolean, Long> first = activity.doubleVerifyList.get(0);
         Triple<Boolean, Boolean, Long> second = activity.doubleVerifyList.get(1);
+        // 第一个人必须是登录人
+        if (!first.getFirst()) {
+            if (!userValidation.getUserId().equals(ChemicalApp.userData.getUserId())) {
+                PopTip.show("请登录人验证!");
+                return;
+            }
+        }
         // 第一个人是否已认证通过 第二个人未通过
         if (!first.getFirst() && !second.getFirst()) {
-            binding.hint1IV.setText("第一位验证已通过");
-            PopTip.show("第一位验证已通过!");
+            binding.hint1IV.setText("登录人验证已通过");
+            PopTip.show("登录人验证已通过!");
             userValidation1 = userValidation;
             activity.doubleVerifyList.set(0, new Triple<>(true, isAdmin, Long.valueOf(userValidation.getUserId())));
             // 切换到第二位验证人 默认人脸方式
@@ -178,7 +185,7 @@ public class DoubleVerifyActivityHelp {
         // 是否第一位
         if (isFirst) {
             if (first.getFirst()) {
-                PopTip.show("第一位验证已通过!");
+                PopTip.show("登录人验证已通过!");
                 return;
             }
             binding.include1LL.removeAllViewsInLayout();
@@ -192,8 +199,8 @@ public class DoubleVerifyActivityHelp {
                                 ImageView imageView = new ImageView(activity);
                                 imageView.setImageBitmap(faceBitmap);
                                 binding.include1LL.addView(imageView);
-                                binding.hint1IV.setText("第一位验证已通过");
-                                PopTip.show("第一位验证已通过!");
+                                binding.hint1IV.setText("登录人验证已通过");
+                                PopTip.show("登录人验证已通过!");
                                 userValidation1 = userValidationBean;
                                 switchShowDetect(DetectType.FACE_DETECT, false, true);
                             }
@@ -242,7 +249,7 @@ public class DoubleVerifyActivityHelp {
             }
         } else {
             if (!first.getFirst()) {
-                PopTip.show("第一位验证未通过!");
+                PopTip.show("登录人验证未通过!");
                 return;
             }
             binding.include2LL.removeAllViewsInLayout();
@@ -310,63 +317,66 @@ public class DoubleVerifyActivityHelp {
         switchDetectUi(faceDetect, isFirst);
     }
 
-    private CountDownTimer qrTimer = new CountDownTimer(1000, 1000) {
-        @Override
-        public void onTick(long millisUntilFinished) {
+    private CountDownTimer qrTimer;
 
-        }
+    private void startQrTimer() {
+        if (null != qrTimer) {
+            qrTimer.cancel();
+            qrTimer.start();
+        } else {
+            qrTimer = new CountDownTimer(3000, 1000) {
+                @Override
+                public void onTick(long millisUntilFinished) {
 
-        @Override
-        public void onFinish() {
-            if (activity.detectType != DetectType.SCAN_DETECT) {
-                qrTimer.cancel();
-                qrTimer = null;
-            } else {
-                ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<UserValidationBean>() {
-                    @Override
-                    public UserValidationBean doInBackground() throws Throwable {
-                        List<HxpCabinetDoorVo> planAddDataDoorList = activity.planAddData.getDoorList();
-                        List<String> doorIdList = new ArrayList<>();
-                        if (null != planAddDataDoorList && !planAddDataDoorList.isEmpty()) {
-                            for (int i = 0; i < planAddDataDoorList.size(); i++) {
-                                doorIdList.add(String.valueOf(planAddDataDoorList.get(i).getDoorId()));
-                            }
-                        }
-                        Response response = HttpTool.aioScanLogin1(qrScanTime, ChemicalApp.subjectId, doorIdList);
-                        LogUtils.json(response);
-                        LogUtils.d(response.body().string());
-                        if (response.isSuccessful()) {
-                            String json = response.body().string();
-                            JSONObject jsonObject = new JSONObject(json);
-                            int code = jsonObject.getInt("code");
-                            if (200 == code) {
-                                return GsonUtils.fromJson(jsonObject.getJSONObject("data").toString(), UserValidationBean.class);
-                            } else {
-                                PopTip.show(jsonObject.getString("message"));
+                }
+
+                @Override
+                public void onFinish() {
+                    if (activity.detectType != DetectType.SCAN_DETECT) {
+                        qrTimer.cancel();
+                        qrTimer = null;
+                    } else {
+                        ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<UserValidationBean>() {
+                            @Override
+                            public UserValidationBean doInBackground() throws Throwable {
+                                List<HxpCabinetDoorVo> planAddDataDoorList = activity.planAddData.getDoorList();
+                                List<String> doorIdList = new ArrayList<>();
+                                if (null != planAddDataDoorList && !planAddDataDoorList.isEmpty()) {
+                                    for (int i = 0; i < planAddDataDoorList.size(); i++) {
+                                        doorIdList.add(String.valueOf(planAddDataDoorList.get(i).getDoorId()));
+                                    }
+                                }
+                                Response response = HttpTool.aioScanLogin1(qrScanTime, ChemicalApp.subjectId, doorIdList);
+                                if (response.isSuccessful()) {
+                                    String json = response.body().string();
+                                    JSONObject jsonObject = new JSONObject(json);
+                                    int code = jsonObject.getInt("code");
+                                    if (200 == code) {
+                                        return GsonUtils.fromJson(jsonObject.getJSONObject("data").toString(), UserValidationBean.class);
+                                    } else {
+                                        PopTip.show(jsonObject.getString("message"));
+                                    }
+                                } else {
+                                    PopTip.show(response.message());
+                                }
+                                return null;
                             }
-                        } else {
-                            PopTip.show(response.message());
-                        }
-                        return null;
-                    }
 
-                    @Override
-                    public void onSuccess(UserValidationBean result) {
-                        if (null != result) {
-                            qrTimer.cancel();
-                            qrTimer = null;
-                            verifyProcess(result);
-                        }
+                            @Override
+                            public void onSuccess(UserValidationBean result) {
+                                if (null != result) {
+                                    qrTimer.cancel();
+                                    qrTimer = null;
+                                    verifyProcess(result);
+                                }
+                            }
+                        });
+                        qrTimer.start();
                     }
-                });
-                qrTimer.start();
-            }
+                }
+            };
+            qrTimer.start();
         }
-    };
-
-    private void startQrTimer() {
-        qrTimer.cancel();
-        qrTimer.start();
     }
 
     private void switchDetectUi(DetectType detectType, boolean isFirst) {
@@ -376,21 +386,21 @@ public class DoubleVerifyActivityHelp {
                     binding.face1IB.setVisibility(View.GONE);
                     binding.scan1IB.setVisibility(View.VISIBLE);
                     binding.card1IB.setVisibility(View.VISIBLE);
-                    binding.hint1IV.setText("请第一位人脸验证");
+                    binding.hint1IV.setText("请登录人人脸验证");
                     binding.hintBottom1IV.setText("请正对屏幕并使脸位于取景框内");
                     break;
                 case CARD_DETECT:
                     binding.face1IB.setVisibility(View.VISIBLE);
                     binding.scan1IB.setVisibility(View.VISIBLE);
                     binding.card1IB.setVisibility(View.GONE);
-                    binding.hint1IV.setText("请第一位刷卡验证");
+                    binding.hint1IV.setText("请登录人刷卡验证");
                     binding.hintBottom1IV.setText("请在刷卡区域进行刷卡验证");
                     break;
                 case SCAN_DETECT:
                     binding.face1IB.setVisibility(View.VISIBLE);
                     binding.scan1IB.setVisibility(View.GONE);
                     binding.card1IB.setVisibility(View.VISIBLE);
-                    binding.hint1IV.setText("请第一位扫码验证");
+                    binding.hint1IV.setText("请登录人扫码验证");
                     binding.hintBottom1IV.setText("请打开微信扫描屏幕二维码");
                     break;
             }

+ 7 - 0
app/src/main/java/com/example/chemical/ui/verify/include/FaceDetectView.java

@@ -209,6 +209,13 @@ public class FaceDetectView extends RelativeLayout {
                                 boolean isAdmin = Boolean.TRUE.equals(result.getSafeUser()) || Boolean.TRUE.equals(result.getAdminUser()) || Boolean.TRUE.equals(result.getCabinetAdmin());
                                 Triple<Boolean, Boolean, Long> first = doubleVerifyList.get(0);
                                 Triple<Boolean, Boolean, Long> second = doubleVerifyList.get(1);
+                                // 第一个人必须是登录人
+                                if (!first.getFirst()) {
+                                    if (!result.getUserId().equals(ChemicalApp.userData.getUserId())) {
+                                        PopTip.show("请登录人验证!");
+                                        return;
+                                    }
+                                }
                                 // 第一个人是否已认证通过 第二个人未通过
                                 if (!first.getFirst() && !second.getFirst()) {
                                     doubleVerifyList.set(0, new Triple<>(true, isAdmin, Long.valueOf(result.getUserId())));

+ 12 - 1
app/src/main/java/com/example/chemical/weidith/BluetoothWeighDialog.java

@@ -88,6 +88,16 @@ public class BluetoothWeighDialog extends AppCompatDialog {
                 binding.netWtET.setError("请检查净含量内容正确");
                 return;
             }
+            // 净含量不可大于规格
+            if (netWt > hxpChemicalVo.getSpecNum()) {
+                binding.netWtET.setError("净含量不能大于规格");
+                return;
+            }
+            // 净含量不可大于称重
+            if (netWt > hxpChemicalVo.getWeigh()) {
+                binding.netWtET.setError("净含量不能大于称重");
+                return;
+            }
             hxpChemicalVo.setNetContent(netWt);
             WaitDialog.show("校验中...");
             ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<String>() {
@@ -112,6 +122,7 @@ public class BluetoothWeighDialog extends AppCompatDialog {
                 public void onSuccess(String result) {
                     WaitDialog.dismiss();
                     if ("ok".equals(result)) {
+                        hxpChemicalVo.setJoinType(1);
                         dismiss();
                     } else if (null == result || result.isEmpty()) {
                         PopTip.show("系统异常!");
@@ -137,7 +148,7 @@ public class BluetoothWeighDialog extends AppCompatDialog {
         @Override
         public Object doInBackground() throws Throwable {
             BluetoothTool.INSTANCE.connect(weight -> {
-                hxpChemicalVo.setWeigh(weight);
+                hxpChemicalVo.setWeigh(Double.parseDouble(weight));
                 ThreadUtils.runOnUiThread(() -> {
                     binding.weighTV.setText(weight + "g");
                     if (binding.weightRL.getVisibility() != View.VISIBLE) {

+ 0 - 2
app/src/main/java/com/example/chemical/weidith/prin_label_dialog/PrintLabelDialog.java

@@ -199,8 +199,6 @@ public class PrintLabelDialog extends AppCompatDialog {
                 }
             });
         });
-        // 请扫描标签音频播放
-        AudioPlayer.getInstance().play(R.raw.saomiaobiaoqian);
     }
 
     /**

+ 1 - 1
app/src/main/res/layout/activity_double_verify.xml

@@ -152,7 +152,7 @@
                     android:drawablePadding="10dp"
                     android:gravity="center_vertical"
                     android:paddingStart="10dp"
-                    android:text="请第一位人脸验证"
+                    android:text="请登录人人脸验证"
                     android:textColor="@color/white"
                     android:textSize="18sp"
                     app:drawableStartCompat="@mipmap/icon_smrz_sfrz"

+ 1 - 0
app/src/main/res/layout/dialog_bluetooth_weigh.xml

@@ -154,6 +154,7 @@
                         android:drawableEnd="@mipmap/icon_bqgl_xg"
                         android:gravity="center"
                         android:hint="手动输入"
+                        android:imeOptions="actionDone"
                         android:inputType="numberDecimal"
                         android:textAppearance="@style/input_hint_text_size"
                         android:textSize="30px" />

+ 4 - 2
app/src/main/res/layout/item_save_list.xml

@@ -37,7 +37,8 @@
                 android:background="@drawable/selector_input_bt"
                 android:text="再次开门"
                 android:textColor="@color/white"
-                android:textSize="26px" />
+                android:textSize="26px"
+                android:visibility="gone" />
 
             <TextView
                 android:id="@+id/sum_TV"
@@ -48,7 +49,8 @@
                 android:layout_gravity="end"
                 android:layout_marginEnd="40px"
                 android:text="数量:3"
-                android:textColor="#333" />
+                android:textColor="#333"
+                android:visibility="gone" />
         </RelativeLayout>
 
         <LinearLayout

+ 1 - 1
config/config.gradle

@@ -10,7 +10,7 @@ ext {
             targetSdkVersion : 28,
             applicationId    : "com.zhong.che",
             versionCode      : 20,
-            versionName      : "1.30"
+            versionName      : "1.31"
     ]
 
     test = [