ソースを参照

业务工单当前部门人员数据获取异常处理

YEJAVON\Tfly 3 年 前
コミット
319461e915

+ 66 - 52
app/src/main/java/com/tofly/tyuan/ui/activity/MeterInputActivity.java

@@ -184,12 +184,12 @@ public class MeterInputActivity extends TakePhotoActivity implements TextWatcher
         public void handleMessage(@NonNull Message msg) {
             super.handleMessage(msg);
             if (msg.what == 666) {
-              //  ToastUtil.showToast("当前水量异常,请核对...");
+                //  ToastUtil.showToast("当前水量异常,请核对...");
             } else if (msg.what == DATA_UNDER) {
-              //  ToastUtil.showToast("当前水量异常:水量负数");
+                //  ToastUtil.showToast("当前水量异常:水量负数");
             } else if (msg.what == DATA_MORE) {
                 String msgStr = (String) msg.obj;
-             //   ToastUtil.showToast("" + msgStr);
+                //   ToastUtil.showToast("" + msgStr);
             }
         }
     };
@@ -445,7 +445,7 @@ public class MeterInputActivity extends TakePhotoActivity implements TextWatcher
             //抄表方式
             if (!TextUtils.isEmpty(cbyhEntity.getCbfsName())) {
                 tv_cbfs.setText(cbyhEntity.getCbfsName());
-                cbfsCode =  TextUtils.isEmpty(cbyhEntity.getCbfsCode()) ? 0 : Long.valueOf(cbyhEntity.getCbfsCode());
+                cbfsCode = TextUtils.isEmpty(cbyhEntity.getCbfsCode()) ? 0 : Long.valueOf(cbyhEntity.getCbfsCode());
             } else {
                 if (cbfs != null && cbfs.size() > 0) {
                     tv_cbfs.setText(cbfs.get(0));
@@ -675,7 +675,7 @@ public class MeterInputActivity extends TakePhotoActivity implements TextWatcher
                 .setSingleChoiceItems(items, ss, (dialog, which) -> {
                     tv_cbfs.setText(items[which]);
                     cbfsCode = cbfsList.get(which).getId();
-
+                    mEditNum.setEnabled(true);
                     //抄表方式设计到满度的时候 才展示 旧表相关数据
                     if (cbfsCode == 955 || cbfsCode == 956) {
                         //旧表数据栏
@@ -689,6 +689,15 @@ public class MeterInputActivity extends TakePhotoActivity implements TextWatcher
                         llInputWaterNumber.setVisibility(View.VISIBLE);
                         //起度框
                         llStartInputWaterNumber.setVisibility(View.GONE);
+                    } else if (cbfsCode == 67 || cbfsCode == 961) {
+                        //估抄
+                        int currentNum = getCurrentNum();
+                        Integer scds = cbyhEntity.getScds();
+                        if (scds != null) {
+                            currentNum += scds;
+                        }
+                        mEditNum.setText("" + currentNum);
+                        mEditNum.setEnabled(false);
                     } else {
                         //起度框
                         llStartInputWaterNumber.setVisibility(View.VISIBLE);
@@ -757,53 +766,8 @@ public class MeterInputActivity extends TakePhotoActivity implements TextWatcher
                 if (cbfsCode == 67 || cbfsCode == 961) {
                     /**
                      * 估抄: Q n1~ n3 ÷ D n1~ n3× D估=本次抄表水量
-                     */
-                    //前三月水量
-                    String month11 = cbyhEntity.getMonth1();
-                    Float aFloat = Float.valueOf(month11 == null ? 0.0f : Float.valueOf(month11));
-                    String month21 = cbyhEntity.getMonth2();
-                    Float aFloat1 = Float.valueOf(month21 == null ? 0.0f : Float.valueOf(month21));
-                    String month31 = cbyhEntity.getMonth3();
-                    Float aFloat2 = Float.valueOf(month31 == null ? 0.0f : Float.valueOf(month31));
-
-                    //如果用户抄表次数不够2次, 无法进行抄表估算, 提示用户
-                    if (aFloat + aFloat1 == 0 || aFloat + aFloat2 == 0 || aFloat1 + aFloat2 == 0) {
-                        //  如果任意2次 为了 返回一个上次登记水量 如果三次0 返回0
-                        currentNum = (int) (aFloat + aFloat2 + aFloat2);
-                    } else {
-                        // Float allNum = aFloat + aFloat1 + aFloat2;
-                        float averageValue = 0.0f;
-                        long timeOffsetDays = 0l;
-                        //当前日期
-                        String date = com.tofly.route.util.date.DateUtils.getCurrentDate2();
-
-                        String cbrq1 = cbyhEntity.getCbrq1();
-                        String cbrq2 = cbyhEntity.getCbrq2();
-                        String cbrq3 = cbyhEntity.getCbrq3();
-
-                        //这里首先要确认2个 不为0 水量登记
-                        if (aFloat == 0.0f) {
-                            //如果前一次水量登记为 0 取第二次 到第三次抄表时间 作为计算
-                            averageValue = (aFloat2) / com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq3, cbrq2);
-                            //当前日期距离上次登记周期
-                            timeOffsetDays = com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq2, date);
-                        } else if (aFloat1 == 0.0f) {
-                            //如果是前二次登记为0  这样的计算会对均值有一定的影响
-                            averageValue = (aFloat) / com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq3, cbrq1);
-                            timeOffsetDays = com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq1, date);
-                        } else if (aFloat2 == 0.0f) {
-                            //如果前三次登记为0  这样的估算有意义吗????
-                            averageValue = (aFloat) / com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq2, cbrq1);
-                            timeOffsetDays = com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq1, date);
-                        } else {
-                            //没有登记水量 0  现象
-                            averageValue = (aFloat + aFloat1) / com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq3, cbrq1);
-                            timeOffsetDays = com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq1, date);
-                        }
-                        averageValue = new BigDecimal(averageValue).setScale(1, BigDecimal.ROUND_HALF_UP).floatValue();
-                        currentNum = (int) (averageValue * timeOffsetDays);
+                     */currentNum = getCurrentNum();
 
-                    }
 
                 } else if (962 == cbfsCode) {
                     //无换表日期故障换表
@@ -826,7 +790,7 @@ public class MeterInputActivity extends TakePhotoActivity implements TextWatcher
                         currentNum = Integer.valueOf(inputWater); //不为空的情况 强转整型
                     else {
                         currentNum = 0;
-                       // ToastUtil.showToast("请选输入本次水量");
+                        // ToastUtil.showToast("请选输入本次水量");
                     }
 
                 } else if (cbfsCode == 954 || cbfsCode == 956) {
@@ -979,6 +943,56 @@ public class MeterInputActivity extends TakePhotoActivity implements TextWatcher
         }
     }
 
+    private int getCurrentNum() {
+        int currentNum;//前三月水量
+        String month11 = cbyhEntity.getMonth1();
+        Float aFloat = Float.valueOf(month11 == null ? 0.0f : Float.valueOf(month11));
+        String month21 = cbyhEntity.getMonth2();
+        Float aFloat1 = Float.valueOf(month21 == null ? 0.0f : Float.valueOf(month21));
+        String month31 = cbyhEntity.getMonth3();
+        Float aFloat2 = Float.valueOf(month31 == null ? 0.0f : Float.valueOf(month31));
+
+        //如果用户抄表次数不够2次, 无法进行抄表估算, 提示用户
+        if (aFloat + aFloat1 == 0 || aFloat + aFloat2 == 0 || aFloat1 + aFloat2 == 0) {
+            //  如果任意2次 为了 返回一个上次登记水量 如果三次0 返回0
+            currentNum = (int) (aFloat + aFloat2 + aFloat2);
+        } else {
+            // Float allNum = aFloat + aFloat1 + aFloat2;
+            float averageValue = 0.0f;
+            long timeOffsetDays = 0l;
+            //当前日期
+            String date = com.tofly.route.util.date.DateUtils.getCurrentDate2();
+
+            String cbrq1 = cbyhEntity.getCbrq1();
+            String cbrq2 = cbyhEntity.getCbrq2();
+            String cbrq3 = cbyhEntity.getCbrq3();
+
+            //这里首先要确认2个 不为0 水量登记
+            if (aFloat == 0.0f) {
+                //如果前一次水量登记为 0 取第二次 到第三次抄表时间 作为计算
+                averageValue = (aFloat2) / com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq3, cbrq2);
+                //当前日期距离上次登记周期
+                timeOffsetDays = com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq2, date);
+            } else if (aFloat1 == 0.0f) {
+                //如果是前二次登记为0  这样的计算会对均值有一定的影响
+                averageValue = (aFloat) / com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq3, cbrq1);
+                timeOffsetDays = com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq1, date);
+            } else if (aFloat2 == 0.0f) {
+                //如果前三次登记为0  这样的估算有意义吗????
+                averageValue = (aFloat) / com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq2, cbrq1);
+                timeOffsetDays = com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq1, date);
+            } else {
+                //没有登记水量 0  现象
+                averageValue = (aFloat + aFloat1) / com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq3, cbrq1);
+                timeOffsetDays = com.tofly.route.util.date.DateUtils.getTimeOffsetDays(cbrq1, date);
+            }
+            averageValue = new BigDecimal(averageValue).setScale(1, BigDecimal.ROUND_HALF_UP).floatValue();
+            currentNum = (int) (averageValue * timeOffsetDays);
+
+        }
+        return currentNum;
+    }
+
     private boolean checkData() {
         boolean isSuccess = false;
         if (TextUtils.isEmpty(tv_cbfs.getText())) {

+ 8 - 8
app/src/main/java/com/tofly/tyuan/ui/activity/MeterKgjlActivity.java

@@ -219,14 +219,14 @@ public class MeterKgjlActivity extends LatteActivity {
                 tvUserAddress.setText(data.getYhdz());
             if (!TextUtils.isEmpty(data.getLxdh()))
                 tvPhone.setText(data.getLxdh());
-            if (!TextUtils.isEmpty(data.getYsxz()))
-                tvYsxz.setText(data.getYsxz());
-            if (!TextUtils.isEmpty(data.getSblx()))
-                tvSblx.setText(data.getSblx());
-            if (!TextUtils.isEmpty(data.getSbcj()))
-                tvCbkh.setText(data.getSbcj());
-            if (!TextUtils.isEmpty(data.getSbkj()))
-                tvSbkj.setText(data.getSbkj());
+            if (!TextUtils.isEmpty(data.getYsxzName()))
+                tvYsxz.setText(data.getYsxzName());
+            if (!TextUtils.isEmpty(data.getSblxName()))
+                tvSblx.setText(data.getSblxName());
+            if (!TextUtils.isEmpty(data.getSbcjName()))
+                tvCbkh.setText(data.getSbcjName());
+            if (!TextUtils.isEmpty(data.getSbkjName()))
+                tvSbkj.setText(data.getSbkjName());
 
 
             if (!TextUtils.isEmpty(data.getAddress()))

+ 1 - 1
app/src/main/java/com/tofly/tyuan/ui/activity/RepairLcrzActivity.java

@@ -234,7 +234,7 @@ public class RepairLcrzActivity extends TakePhotoActivity {
     private RepairGdBhAdapter adapter;
     private List<Integer> stateList, userList;
     private Integer zprId;
-    private List<GdlcBean.GdPerson> departmentBeans;
+    private List<GdlcBean.GdPerson> departmentBeans = new ArrayList<>() ;
     private List<YwgdZpBean> zpBeans;
     private RepairZpAdapter zpAdapter;
     private List<RepairTypeBean> repairTypeBeanList;

+ 1 - 1
app/src/main/java/com/tofly/tyuan/ui/activity/RepairgdshActivity.java

@@ -239,7 +239,7 @@ public class RepairgdshActivity extends LatteActivity {
     private Integer zprId;
     // private List<DepartPerssionUserBean> departmentBeans;
     private List<DepartPerssionUserBean.UserPerssion> userEntities;
-    private List<GdlcBean.GdPerson> departmentBeans;
+    private List<GdlcBean.GdPerson> departmentBeans = new ArrayList<>() ;
     private List<YwgdZpBean> zpBeans;
     private RepairZpAdapter zpAdapter;
     private List<RepairTypeBean> repairTypeBeanList;

+ 1 - 1
app/src/main/java/com/tofly/tyuan/ui/activity/RepairgdzjActivity.java

@@ -261,7 +261,7 @@ public class RepairgdzjActivity extends LatteActivity {
     private List<DepartPerssionUserBean> departmentBeans1;
     private List<DepartPerssionUserBean.DepartPerssion> departPerssionList;
     private List<DepartPerssionUserBean.UserPerssion> userEntities, userEntities1;
-    private List<GdlcBean.GdPerson> departmentBeans;
+    private List<GdlcBean.GdPerson> departmentBeans = new ArrayList<>() ;
     private Integer zprId;
     private List<YwgdZpBean> zpBeans;
     private RepairZpAdapter zpAdapter;

+ 1 - 1
app/src/main/java/com/tofly/tyuan/ui/activity/RepairjgczActivity.java

@@ -1060,7 +1060,7 @@ RepairjgczActivity extends TakePhotoActivity {
     }
 
     StringBuffer stringBuffer = new StringBuffer();
-    private List<GdlcBean.GdPerson> departmentBeans;
+    private List<GdlcBean.GdPerson> departmentBeans = new ArrayList<>() ;
 
     private void getUserByDeptId() {
 

+ 3 - 3
app/src/main/res/layout/activity_meter_input.xml

@@ -613,8 +613,8 @@
                             android:id="@+id/ll_inputWaterNumber"
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
-                            android:visibility="gone"
-                            android:orientation="vertical">
+                            android:orientation="vertical"
+                            android:visibility="gone">
 
                             <View
                                 android:layout_width="match_parent"
@@ -649,6 +649,7 @@
                                     android:textSize="14sp" />
                             </androidx.appcompat.widget.LinearLayoutCompat>
                         </LinearLayout>
+
                         <View
                             android:layout_width="match_parent"
                             android:layout_height="1dp"
@@ -683,7 +684,6 @@
                         </androidx.appcompat.widget.LinearLayoutCompat>
 
 
-
                         <View
                             android:layout_width="match_parent"
                             android:layout_height="1dp"