Procházet zdrojové kódy

修改站位为接口校验

songw před 1 měsícem
rodič
revize
54a7d34a7d

+ 163 - 160
app/src/main/java/com/uas/pda_wps/fragment/SCSMTJointFragment.java

@@ -107,23 +107,23 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
 
         mLineInfoBean = (LineInfoBean) PdaApplication.getDataCacheFromMap(Constants.FLAG.SMT_DEVICE_LINE_CACHE);
 
-//        JSONObject paramJson = new JSONObject();
-//        try {
-//            makeCraft = new JSONObject(makeCraftStr);
-//            Log.e(TAG,"makeCraft"+makeCraft);
-//            String psId = makeCraft.getString("ps_id");
-//            String prodcode = makeCraft.getString("mc_prodcode");
-//            paramJson.put("ps_id",psId);
-//            paramJson.put("prodcode",prodcode);
-//        } catch (JSONException e) {
-//            e.printStackTrace();
-//        }
-//        //if(jobCode.equals("")||jobCode == null||jobCode.equals("null")){jobCode = "无";}
-//
-//        //获取网络数据
-//        requestType = VolleyUtil.FRAGMENT_SCMAKE_SMTJOINT_DETAIL;
-//        VolleyUtil.getVolleyUtil().requestJsonObject(getActivity(), GloableParams.ADDRESS_SMTDETAIL_APPLY,VolleyUtil.METHOD_POST,
-//                requestType,paramJson);
+        //        JSONObject paramJson = new JSONObject();
+        //        try {
+        //            makeCraft = new JSONObject(makeCraftStr);
+        //            Log.e(TAG,"makeCraft"+makeCraft);
+        //            String psId = makeCraft.getString("ps_id");
+        //            String prodcode = makeCraft.getString("mc_prodcode");
+        //            paramJson.put("ps_id",psId);
+        //            paramJson.put("prodcode",prodcode);
+        //        } catch (JSONException e) {
+        //            e.printStackTrace();
+        //        }
+        //        //if(jobCode.equals("")||jobCode == null||jobCode.equals("null")){jobCode = "无";}
+        //
+        //        //获取网络数据
+        //        requestType = VolleyUtil.FRAGMENT_SCMAKE_SMTJOINT_DETAIL;
+        //        VolleyUtil.getVolleyUtil().requestJsonObject(getActivity(), GloableParams.ADDRESS_SMTDETAIL_APPLY,VolleyUtil.METHOD_POST,
+        //                requestType,paramJson);
 
     }
 
@@ -155,12 +155,12 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
                 mCollectEditText.setHint(COLLECT_LOCATION);
                 mCollectEditText.setText("");
 
-//                tvMsgNotice.setText("");
-//                tvMsgProdcode.setText("");
-//                tvMsgLocation.setText("");
-//                tvMsgBarcode.setText("");
-//                tvMsgQuantity.setText("");
-//                tvMsgSpec.setText("");
+                //                tvMsgNotice.setText("");
+                //                tvMsgProdcode.setText("");
+                //                tvMsgLocation.setText("");
+                //                tvMsgBarcode.setText("");
+                //                tvMsgQuantity.setText("");
+                //                tvMsgSpec.setText("");
             }
         });
     }
@@ -183,63 +183,47 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
 
     @SuppressLint("SetTextI18n")
     private void locationCheck(String collect) {
-        tvMsgProdcode.setText("");
-        tvMsgLocation.setText("");
-        tvMsgBarcode.setText("");
-        tvMsgQuantity.setText("");
-        tvMsgSpec.setText("");
-
-        mLocationTextView.setText(collect);
-        mCollectEditText.setText("");
-
-        mSmtDslBean = new SmtDslBean();
-        mSmtDslBean.setDsl_location(collect);
-        mSmtDslBean.setDsl_prodcode("");
-
-        tvMsgNotice.setText("");
-        mCollectEditText.setHint(COLLECT_OLD_PRODCODE);
-
         joinForcast(collect);
 
-//        if (!TextUtils.isEmpty(mSmtLocationCache)) {
-//            try {
-//                JSONArray locationArray = new JSONArray(mSmtLocationCache);
-//                boolean isExist = false;
-//                for (int i = 0; i < locationArray.length(); i++) {
-//                    JSONObject locationObject = locationArray.getJSONObject(i);
-//                    if (collect.equals(JsonUtils.optStringNotNull(locationObject, "PSL_LOCATION"))) {
-//                        isExist = true;
-//                        mLocationTextView.setText(collect);
-//                        mCollectEditText.setText("");
-//
-//                        String psl_prodcode = JsonUtils.optStringNotNull(locationObject, "PSL_PRODCODE");
-//                        String psl_repcode = JsonUtils.optStringNotNull(locationObject, "PSL_REPCODE");
-//                        mSmtDslBean = new SmtDslBean();
-//                        mSmtDslBean.setDsl_location(collect);
-//                        mSmtDslBean.setDsl_prodcode(psl_prodcode);
-//                        tvMsgNotice.setText("");
-//                        mCollectEditText.setHint(COLLECT_OLD_PRODCODE);
-//
-//                        joinForcast(collect);
-//                        break;
-//                    }
-//                }
-//
-//                if (!isExist) {
-//                    tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-//                    tvMsgNotice.setText("站位编号"+mCollectEditText.getText().toString().trim()+"错误");
-//                    CommonUtil.makeNotice();
-//                    mCollectEditText.setText("");
-//                }
-//            } catch (JSONException e) {
-//                e.printStackTrace();
-//            }
-//        } else {
-//            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-//            tvMsgNotice.setText("站位编号"+mCollectEditText.getText().toString().trim()+"错误");
-//            CommonUtil.makeNotice();
-//            mCollectEditText.setText("");
-//        }
+        //        if (!TextUtils.isEmpty(mSmtLocationCache)) {
+        //            try {
+        //                JSONArray locationArray = new JSONArray(mSmtLocationCache);
+        //                boolean isExist = false;
+        //                for (int i = 0; i < locationArray.length(); i++) {
+        //                    JSONObject locationObject = locationArray.getJSONObject(i);
+        //                    if (collect.equals(JsonUtils.optStringNotNull(locationObject, "PSL_LOCATION"))) {
+        //                        isExist = true;
+        //                        mLocationTextView.setText(collect);
+        //                        mCollectEditText.setText("");
+        //
+        //                        String psl_prodcode = JsonUtils.optStringNotNull(locationObject, "PSL_PRODCODE");
+        //                        String psl_repcode = JsonUtils.optStringNotNull(locationObject, "PSL_REPCODE");
+        //                        mSmtDslBean = new SmtDslBean();
+        //                        mSmtDslBean.setDsl_location(collect);
+        //                        mSmtDslBean.setDsl_prodcode(psl_prodcode);
+        //                        tvMsgNotice.setText("");
+        //                        mCollectEditText.setHint(COLLECT_OLD_PRODCODE);
+        //
+        //                        joinForcast(collect);
+        //                        break;
+        //                    }
+        //                }
+        //
+        //                if (!isExist) {
+        //                    tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+        //                    tvMsgNotice.setText("站位编号"+mCollectEditText.getText().toString().trim()+"错误");
+        //                    CommonUtil.makeNotice();
+        //                    mCollectEditText.setText("");
+        //                }
+        //            } catch (JSONException e) {
+        //                e.printStackTrace();
+        //            }
+        //        } else {
+        //            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+        //            tvMsgNotice.setText("站位编号"+mCollectEditText.getText().toString().trim()+"错误");
+        //            CommonUtil.makeNotice();
+        //            mCollectEditText.setText("");
+        //        }
     }
 
     private void joinForcast(String collect) {
@@ -260,9 +244,27 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
                 new Response.Listener<String>() {
                     @Override
                     public void onResponse(String s) {
-                        if (progressDialog.isShowing())
+                        if (progressDialog.isShowing()) {
                             progressDialog.dismiss();
+                        }
+
                         try {
+                            tvMsgProdcode.setText("");
+                            tvMsgLocation.setText("");
+                            tvMsgBarcode.setText("");
+                            tvMsgQuantity.setText("");
+                            tvMsgSpec.setText("");
+
+                            mLocationTextView.setText(collect);
+                            mCollectEditText.setText("");
+
+                            mSmtDslBean = new SmtDslBean();
+                            mSmtDslBean.setDsl_location(collect);
+                            mSmtDslBean.setDsl_prodcode("");
+
+                            tvMsgNotice.setText("");
+                            mCollectEditText.setHint(COLLECT_OLD_PRODCODE);
+
                             JSONObject resultObject = new JSONObject(s);
                             JSONObject dataObject = resultObject.optJSONObject("data");
                             if (dataObject != null) {
@@ -271,16 +273,16 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
 
                                 tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
                                 if ("product".equals(type)) {
-//                                    mCollectEditText.setText(code);
+                                    //                                    mCollectEditText.setText(code);
                                     mCollectEditText.requestFocus();
                                     mCollectEditText.setSelection(mCollectEditText.getText().toString().length());
                                     tvMsgNotice.setText("请采集原物料号:" + code);
-//                                    confirmEvent(mCollectEditText.getText().toString().trim());
+                                    //                                    confirmEvent(mCollectEditText.getText().toString().trim());
                                 } else if ("barcode".equals(type)) {
-//                                    mCollectEditText.setText(code);
+                                    //                                    mCollectEditText.setText(code);
                                     mCollectEditText.requestFocus();
                                     mCollectEditText.setSelection(mCollectEditText.getText().toString().length());
-//                                    confirmEvent(mCollectEditText.getText().toString().trim());
+                                    //                                    confirmEvent(mCollectEditText.getText().toString().trim());
                                     tvMsgNotice.setText("请采集原料卷号:" + code);
                                 }
                             }
@@ -325,21 +327,24 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
                 new Response.Listener<String>() {
                     @Override
                     public void onResponse(String s) {
-                        if (progressDialog.isShowing())
+                        if (progressDialog.isShowing()) {
                             progressDialog.dismiss();
+                        }
                         joinDataCheck(collect, location, "原物料号校验正确", true);
                     }
                 },
                 new Response.ErrorListener() {
                     @Override
                     public void onErrorResponse(VolleyError volleyError) {
-                        if (progressDialog.isShowing())
+                        if (progressDialog.isShowing()) {
                             progressDialog.dismiss();
+                        }
                         String errorToast = CommonUtil.showErrorToast(volleyError, false);
-                        joinDataCheck(collect, location, errorToast, false);
                         mCollectEditText.setText("");
                         tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
                         tvMsgNotice.setText(errorToast);
+
+                        //joinDataCheck(collect, location, errorToast, false);
                     }
                 }) {
             @Override
@@ -376,8 +381,6 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
         tvMsgQuantity.setText("");
         tvMsgSpec.setText("");
 
-        collect = mLocationTextView.getText().toString().trim();
-
         mSmtDslBean = new SmtDslBean();
         mSmtDslBean.setDsl_location(location);
         mSmtDslBean.setDsl_prodcode("");
@@ -386,75 +389,75 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
         mCollectEditText.setText("");
         mCollectEditText.setHint(COLLECT_PRODCODE);
 
-//        if (!TextUtils.isEmpty(mSmtLocationCache)) {
-//            try {
-//                JSONArray locationArray = new JSONArray(mSmtLocationCache);
-//                boolean isExist = false;
-//                for (int i = 0; i < locationArray.length(); i++) {
-//                    JSONObject locationObject = locationArray.getJSONObject(i);
-//                    if (collect.equals(JsonUtils.optStringNotNull(locationObject, "PSL_LOCATION"))) {
-//                        isExist = true;
-//                        mLocationTextView.setText(collect);
-//                        mCollectEditText.setText("");
-//
-//                        String psl_prodcode = JsonUtils.optStringNotNull(locationObject, "PSL_PRODCODE");
-//                        String psl_repcode = JsonUtils.optStringNotNull(locationObject, "PSL_REPCODE");
-//                        mSmtDslBean = new SmtDslBean();
-//                        mSmtDslBean.setDsl_location(location);
-//                        mSmtDslBean.setDsl_prodcode(psl_prodcode);
-//                        mSmtDslBean.setDsl_repcode(psl_repcode);
-//
-//                        mCollectEditText.setHint(COLLECT_PRODCODE);
-//                        if (!TextUtils.isEmpty(psl_repcode)) {
-//                            String[] repcodes = psl_repcode.split(",");
-//                            String notice = dataCheckResult + "\n请采集物料";
-//                            for (int j = 0; j < repcodes.length; j++) {
-//                                String repcode = repcodes[j];
-//                                notice = notice + "\n" + repcode;
-//                            }
-//                            notice = notice + "\n的料卷编号/物料编号";
-//                            tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-//                            if (isSuccess) {
-//                                tvMsgNotice.setText(notice);
-//                            } else {
-//                                SpannableString spannableString = CommonUtil.spanString(notice, mActivity, 0, dataCheckResult.length(), R.color.red);
-//                                tvMsgNotice.setText(spannableString);
-//                            }
-//                        } else if (!TextUtils.isEmpty(psl_prodcode)) {
-//                            tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-//                            if (isSuccess) {
-//                                tvMsgNotice.setText(dataCheckResult + "\n请采集物料\n" + psl_prodcode + "\n的料卷编号/物料编号");
-//                            } else {
-//                                SpannableString spannableString = CommonUtil.spanString(dataCheckResult + "\n请采集物料\n" + psl_prodcode + "\n的料卷编号/物料编号", mActivity, 0, dataCheckResult.length(), R.color.red);
-//                                tvMsgNotice.setText(spannableString);
-//                            }
-//                        } else {
-//                            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-//                            if (isSuccess) {
-//                                CommonUtil.spanString(dataCheckResult + "\n物料编号获取失败", mActivity, 0, dataCheckResult.length(), R.color.green);
-//                                tvMsgNotice.setText(dataCheckResult + "\n物料编号获取失败");
-//                            } else {
-//                                tvMsgNotice.setText(dataCheckResult + "\n物料编号获取失败");
-//                            }
-//                        }
-//                    }
-//                }
-//
-//                if (!isExist) {
-//                    tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-//                    tvMsgNotice.setText("站位编号"+mCollectEditText.getText().toString().trim()+"错误");
-//                    CommonUtil.makeNotice();
-//                    mCollectEditText.setText("");
-//                }
-//            } catch (JSONException e) {
-//                e.printStackTrace();
-//            }
-//        } else {
-//            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-//            tvMsgNotice.setText("站位编号"+mCollectEditText.getText().toString().trim()+"错误");
-//            CommonUtil.makeNotice();
-//            mCollectEditText.setText("");
-//        }
+        //        if (!TextUtils.isEmpty(mSmtLocationCache)) {
+        //            try {
+        //                JSONArray locationArray = new JSONArray(mSmtLocationCache);
+        //                boolean isExist = false;
+        //                for (int i = 0; i < locationArray.length(); i++) {
+        //                    JSONObject locationObject = locationArray.getJSONObject(i);
+        //                    if (collect.equals(JsonUtils.optStringNotNull(locationObject, "PSL_LOCATION"))) {
+        //                        isExist = true;
+        //                        mLocationTextView.setText(collect);
+        //                        mCollectEditText.setText("");
+        //
+        //                        String psl_prodcode = JsonUtils.optStringNotNull(locationObject, "PSL_PRODCODE");
+        //                        String psl_repcode = JsonUtils.optStringNotNull(locationObject, "PSL_REPCODE");
+        //                        mSmtDslBean = new SmtDslBean();
+        //                        mSmtDslBean.setDsl_location(location);
+        //                        mSmtDslBean.setDsl_prodcode(psl_prodcode);
+        //                        mSmtDslBean.setDsl_repcode(psl_repcode);
+        //
+        //                        mCollectEditText.setHint(COLLECT_PRODCODE);
+        //                        if (!TextUtils.isEmpty(psl_repcode)) {
+        //                            String[] repcodes = psl_repcode.split(",");
+        //                            String notice = dataCheckResult + "\n请采集物料";
+        //                            for (int j = 0; j < repcodes.length; j++) {
+        //                                String repcode = repcodes[j];
+        //                                notice = notice + "\n" + repcode;
+        //                            }
+        //                            notice = notice + "\n的料卷编号/物料编号";
+        //                            tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+        //                            if (isSuccess) {
+        //                                tvMsgNotice.setText(notice);
+        //                            } else {
+        //                                SpannableString spannableString = CommonUtil.spanString(notice, mActivity, 0, dataCheckResult.length(), R.color.red);
+        //                                tvMsgNotice.setText(spannableString);
+        //                            }
+        //                        } else if (!TextUtils.isEmpty(psl_prodcode)) {
+        //                            tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+        //                            if (isSuccess) {
+        //                                tvMsgNotice.setText(dataCheckResult + "\n请采集物料\n" + psl_prodcode + "\n的料卷编号/物料编号");
+        //                            } else {
+        //                                SpannableString spannableString = CommonUtil.spanString(dataCheckResult + "\n请采集物料\n" + psl_prodcode + "\n的料卷编号/物料编号", mActivity, 0, dataCheckResult.length(), R.color.red);
+        //                                tvMsgNotice.setText(spannableString);
+        //                            }
+        //                        } else {
+        //                            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+        //                            if (isSuccess) {
+        //                                CommonUtil.spanString(dataCheckResult + "\n物料编号获取失败", mActivity, 0, dataCheckResult.length(), R.color.green);
+        //                                tvMsgNotice.setText(dataCheckResult + "\n物料编号获取失败");
+        //                            } else {
+        //                                tvMsgNotice.setText(dataCheckResult + "\n物料编号获取失败");
+        //                            }
+        //                        }
+        //                    }
+        //                }
+        //
+        //                if (!isExist) {
+        //                    tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+        //                    tvMsgNotice.setText("站位编号"+mCollectEditText.getText().toString().trim()+"错误");
+        //                    CommonUtil.makeNotice();
+        //                    mCollectEditText.setText("");
+        //                }
+        //            } catch (JSONException e) {
+        //                e.printStackTrace();
+        //            }
+        //        } else {
+        //            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+        //            tvMsgNotice.setText("站位编号"+mCollectEditText.getText().toString().trim()+"错误");
+        //            CommonUtil.makeNotice();
+        //            mCollectEditText.setText("");
+        //        }
     }
 
     /**
@@ -568,7 +571,7 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
     //采集栏enter事件、按钮点击事件
     private void disposeOnClick() {
         //->获取输入框文字内容
-//        code = etCollect.getText().toString().trim();
+        //        code = etCollect.getText().toString().trim();
         if (code.equals("") || code == null) {
             return;
         }
@@ -887,8 +890,8 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
             if (progressDialog != null && progressDialog.isShowing()) {
-//                loadingView.dismiss();
-//                VolleyUtil.distoryVolley();
+                //                loadingView.dismiss();
+                //                VolleyUtil.distoryVolley();
                 return true;
             }
         }

+ 2 - 2
build.gradle

@@ -50,8 +50,8 @@ ext {
             targetSdkVersion : 28,
             compileSdkVersion: 28,
             buildToolsVersion: "28.0.3",
-            versionCode      : 21,
-            versionName      : "v1.2.0"
+            versionCode      : 22,
+            versionName      : "v1.2.1"
     ]
 
     depsVersion = [