Explorar el Código

去除本地站位相关校验,优化了SMT备料中的功能跳转与校验相关页面的数据逻辑,去除料卷号开关控制.SMT上料增加接口站位校验, 优化上料接料页提示功能, 修复SMT备料功能页面和数据问题,修复站位接口没有传数据问题, 修复SMT备料回退到主菜单问题

songw hace 1 mes
padre
commit
1ea245bfef

+ 2 - 0
app/src/main/java/com/uas/pda_wps/activity/FunctionActivity.java

@@ -26,6 +26,7 @@ import com.uas.pda_wps.global.GloableParams;
 import com.uas.pda_wps.interfaces.BackHandlerInterface;
 import com.uas.pda_wps.tools.DataSourceManager;
 import com.uas.pda_wps.util.CameraUtil;
+import com.uas.pda_wps.util.MyLog;
 
 public class FunctionActivity extends BaseActivity implements View.OnClickListener, BackHandlerInterface {
     private Button btnBack, mSearchBtn, mMoreBtn;
@@ -220,6 +221,7 @@ public class FunctionActivity extends BaseActivity implements View.OnClickListen
             }
         }*/
         if (fragment.onFragmentBackPressed()) {
+            MyLog.e("aaa","不弹出栈" + fragment.getTag());
             return;
         }
         backEvent();

+ 1 - 1
app/src/main/java/com/uas/pda_wps/bean/SmtDslBean.java

@@ -13,7 +13,7 @@ public class SmtDslBean {
     @JSONField(name = "dsl_barcode")
     String dsl_barcode;
     @JSONField(name = "dsl_repcode")
-    String dsl_repcode;
+    String dsl_repcode;             //### psl_repcode  物料
     @JSONField(name = "dsl_fecode")
     String dsl_fecode;      //飞达规格,这个目前客户都没有维护值
 

+ 218 - 217
app/src/main/java/com/uas/pda_wps/fragment/QualityVerificationFra.java

@@ -117,7 +117,7 @@ class QualityVerificationFra  extends BaseFragment implements View.OnClickListen
     private LineInfoBean mLineInfoBean;
     private AutoCompleteTextView mCollectEditText;
     private Button mConfirmButton;
-    private String mSmtLocationCache;
+//    private String mSmtLocationCache;
     private boolean mIgnoreFocusChange = false;
     private SmtDslBean mSmtDslBean = new SmtDslBean();
     private TextViewWithButton mLocationTextView;
@@ -479,17 +479,7 @@ class QualityVerificationFra  extends BaseFragment implements View.OnClickListen
             locationCheck(collect, location);
         } else {
             mSmtDslBean.setDsl_barcode(collect);
-            /*if (mUpRadioButton.isChecked() || (mJoinRadioButton.isChecked() && COLLECT_PRODCODE.equals(mCollectEditText.getHint().toString()))) {
-                smtCheck(collect, location);
-            } else {
-                joinDataCheck(collect, location);
-            }*/
-
-            if (mMaterialSwitch) {
-                requestCheck(collect, location);
-            } else {
-                smtCheck(collect, location);
-            }
+            requestCheck(collect, location);
         }
     }
 
@@ -545,144 +535,144 @@ class QualityVerificationFra  extends BaseFragment implements View.OnClickListen
         });
     }
 
-    private void joinDataCheck(final String collect, final String location) {
-        progressDialog.show();
-
-        PdaApplication.mRequestQueue.cancelAll(TAG + "datacheck");
-
-        mStringRequest = new StringRequest(Request.Method.POST, GloableParams.ADDRESS_SMT_JOIN_FORECASTDATA_CHECK,
-                new Response.Listener<String>() {
-                    @Override
-                    public void onResponse(String s) {
-                        if (progressDialog.isShowing())
-                            progressDialog.dismiss();
-                        joinDataCheck(collect, location, "原物料号校验正确", true);
-                    }
-                },
-                new Response.ErrorListener() {
-                    @Override
-                    public void onErrorResponse(VolleyError volleyError) {
-                        if (progressDialog.isShowing())
-                            progressDialog.dismiss();
-                        String errorToast = CommonUtil.showErrorToast(volleyError, false);
-                        joinDataCheck(collect, location, errorToast, false);
-                    }
-                }) {
-            @Override
-            public Map<String, String> getHeaders() throws AuthFailureError {
-                return VolleyUtil.getVolleyUtil().setCookies();
-            }
-
-            @Override
-            protected Map<String, String> getParams() throws AuthFailureError {
-                Map<String, String> params = new HashMap<>();
-                Map<String, Object> dslMap = new HashMap<>();
-                if (mUpRadioButton.isChecked()) {
-                    dslMap.put("type", "loading");
-                } else if (mJoinRadioButton.isChecked()) {
-                    dslMap.put("type", "join");
-                }
-                dslMap.put("dsl_location", location);
-                dslMap.put("dsl_prodcode", collect);
-                dslMap.put("success", true);
-
-                params.put("dsl", JSON.toJSONString(dslMap));
-                params.put("deviceLineMake", JSON.toJSONString(mLineInfoBean));
-                Log.d("paramjson", params.toString());
-                return params;
-            }
-        };
-        mStringRequest.setRetryPolicy(new DefaultRetryPolicy(10 * 1000, 0, 1f));
-        mStringRequest.setTag(TAG + "datacheck");
-        PdaApplication.mRequestQueue.add(mStringRequest);
-    }
-
-    private void joinDataCheck(String collect, String location, String dataCheckResult, boolean isSuccess) {
-        tvMsgProdcode.setText("");
-        tvMsgLocation.setText("");
-        tvMsgBarcode.setText("");
-        tvMsgQuantity.setText("");
-        tvMsgSpec.setText("");
-
-        collect = mLocationTextView.getText().toString().trim();
-
-        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);
-
-                        mAutoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());
-                        mCollectEditText.setAdapter(mAutoStringAdapter);
-
-                        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;
-                            }
-                            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);
-                            } else {
-                                SpannableString spannableString = CommonUtil.spanString(dataCheckResult + "\n请采集接料的物料号\n" + psl_prodcode, 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));
-                    String notice = "站位编号错误\n" + mNoticeStr;
-                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
-                    tvMsgNotice.setText(spannableString);
-                    CommonUtil.makeNotice();
-                    mCollectEditText.setText("");
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        } else {
-            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-            String notice = "站位编号错误\n" + mNoticeStr;
-            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
-            tvMsgNotice.setText(spannableString);
-            CommonUtil.makeNotice();
-            mCollectEditText.setText("");
-        }
-    }
+//    private void joinDataCheck(final String collect, final String location) {
+//        progressDialog.show();
+//
+//        PdaApplication.mRequestQueue.cancelAll(TAG + "datacheck");
+//
+//        mStringRequest = new StringRequest(Request.Method.POST, GloableParams.ADDRESS_SMT_JOIN_FORECASTDATA_CHECK,
+//                new Response.Listener<String>() {
+//                    @Override
+//                    public void onResponse(String s) {
+//                        if (progressDialog.isShowing())
+//                            progressDialog.dismiss();
+//                        joinDataCheck(collect, location, "原物料号校验正确", true);
+//                    }
+//                },
+//                new Response.ErrorListener() {
+//                    @Override
+//                    public void onErrorResponse(VolleyError volleyError) {
+//                        if (progressDialog.isShowing())
+//                            progressDialog.dismiss();
+//                        String errorToast = CommonUtil.showErrorToast(volleyError, false);
+//                        joinDataCheck(collect, location, errorToast, false);
+//                    }
+//                }) {
+//            @Override
+//            public Map<String, String> getHeaders() throws AuthFailureError {
+//                return VolleyUtil.getVolleyUtil().setCookies();
+//            }
+//
+//            @Override
+//            protected Map<String, String> getParams() throws AuthFailureError {
+//                Map<String, String> params = new HashMap<>();
+//                Map<String, Object> dslMap = new HashMap<>();
+//                if (mUpRadioButton.isChecked()) {
+//                    dslMap.put("type", "loading");
+//                } else if (mJoinRadioButton.isChecked()) {
+//                    dslMap.put("type", "join");
+//                }
+//                dslMap.put("dsl_location", location);
+//                dslMap.put("dsl_prodcode", collect);
+//                dslMap.put("success", true);
+//
+//                params.put("dsl", JSON.toJSONString(dslMap));
+//                params.put("deviceLineMake", JSON.toJSONString(mLineInfoBean));
+//                Log.d("paramjson", params.toString());
+//                return params;
+//            }
+//        };
+//        mStringRequest.setRetryPolicy(new DefaultRetryPolicy(10 * 1000, 0, 1f));
+//        mStringRequest.setTag(TAG + "datacheck");
+//        PdaApplication.mRequestQueue.add(mStringRequest);
+//    }
+
+//    private void joinDataCheck(String collect, String location, String dataCheckResult, boolean isSuccess) {
+//        tvMsgProdcode.setText("");
+//        tvMsgLocation.setText("");
+//        tvMsgBarcode.setText("");
+//        tvMsgQuantity.setText("");
+//        tvMsgSpec.setText("");
+//
+//        collect = mLocationTextView.getText().toString().trim();
+//
+//        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);
+//
+//                        mAutoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());
+//                        mCollectEditText.setAdapter(mAutoStringAdapter);
+//
+//                        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;
+//                            }
+//                            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);
+//                            } else {
+//                                SpannableString spannableString = CommonUtil.spanString(dataCheckResult + "\n请采集接料的物料号\n" + psl_prodcode, 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));
+//                    String notice = "站位编号错误\n" + mNoticeStr;
+//                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
+//                    tvMsgNotice.setText(spannableString);
+//                    CommonUtil.makeNotice();
+//                    mCollectEditText.setText("");
+//                }
+//            } catch (JSONException e) {
+//                e.printStackTrace();
+//            }
+//        } else {
+//            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+//            String notice = "站位编号错误\n" + mNoticeStr;
+//            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
+//            tvMsgNotice.setText(spannableString);
+//            CommonUtil.makeNotice();
+//            mCollectEditText.setText("");
+//        }
+//    }
 
     private void locationCheck(String collect, String location) {
         tvMsgProdcode.setText("");
@@ -691,72 +681,83 @@ class QualityVerificationFra  extends BaseFragment implements View.OnClickListen
         tvMsgQuantity.setText("");
         tvMsgSpec.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);
-
-                        mAutoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());
-                        mCollectEditText.setAdapter(mAutoStringAdapter);
-                        //no use
-                        if (mUpRadioButton.isChecked()) {
-                            mCollectEditText.setHint(COLLECT_PRODCODE);
-                            if (!TextUtils.isEmpty(psl_repcode)) {
-                                String[] repcodes = psl_repcode.split(",");
-                                String notice = "站位采集成功,请采集物料\n";
-                                for (int j = 0; j < repcodes.length; j++) {
-                                    String repcode = repcodes[j];
-                                    notice = notice + repcode + "\n";
-                                }
-                                notice = notice + "的物料编号";
-                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                                tvMsgNotice.setText(notice);
-                            } else if (!TextUtils.isEmpty(psl_prodcode)) {
-                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                                tvMsgNotice.setText("站位采集成功,请采集物料\n" + psl_prodcode + "\n的物料编号");
-                            } else {
-                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                                tvMsgNotice.setText("站位采集成功,物料编号获取失败");
-                            }
-                        } else {
-                            tvMsgNotice.setText("");
-                            mCollectEditText.setHint(COLLECT_OLD_PRODCODE);
-                        }
-                    }
-                }
-
-                if (!isExist) {
-                    tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-                    String notice = "站位编号错误\n" + mNoticeStr;
-                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
-                    tvMsgNotice.setText(spannableString);
-                    CommonUtil.makeNotice();
-                    mCollectEditText.setText("");
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        } else {
-            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-            String notice = "站位编号错误\n" + mNoticeStr;
-            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
-            tvMsgNotice.setText(spannableString);
-            CommonUtil.makeNotice();
-            mCollectEditText.setText("");
-        }
+        mLocationTextView.setText(collect);
+        mCollectEditText.setText("");
+
+        mSmtDslBean = new SmtDslBean();
+        mSmtDslBean.setDsl_location(location);
+        mSmtDslBean.setDsl_prodcode("");
+        mSmtDslBean.setDsl_repcode("");
+
+        mAutoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());
+        mCollectEditText.setAdapter(mAutoStringAdapter);
+
+//        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);
+//
+//                        mAutoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());
+//                        mCollectEditText.setAdapter(mAutoStringAdapter);
+//                        //no use
+//                        if (mUpRadioButton.isChecked()) {
+//                            mCollectEditText.setHint(COLLECT_PRODCODE);
+//                            if (!TextUtils.isEmpty(psl_repcode)) {
+//                                String[] repcodes = psl_repcode.split(",");
+//                                String notice = "站位采集成功,请采集物料\n";
+//                                for (int j = 0; j < repcodes.length; j++) {
+//                                    String repcode = repcodes[j];
+//                                    notice = notice + repcode + "\n";
+//                                }
+//                                notice = notice + "的物料编号";
+//                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+//                                tvMsgNotice.setText(notice);
+//                            } else if (!TextUtils.isEmpty(psl_prodcode)) {
+//                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+//                                tvMsgNotice.setText("站位采集成功,请采集物料\n" + psl_prodcode + "\n的物料编号");
+//                            } else {
+//                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+//                                tvMsgNotice.setText("站位采集成功,物料编号获取失败");
+//                            }
+//                        } else {
+//                            tvMsgNotice.setText("");
+//                            mCollectEditText.setHint(COLLECT_OLD_PRODCODE);
+//                        }
+//                    }
+//                }
+//
+//                if (!isExist) {
+//                    tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+//                    String notice = "站位编号错误\n" + mNoticeStr;
+//                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
+//                    tvMsgNotice.setText(spannableString);
+//                    CommonUtil.makeNotice();
+//                    mCollectEditText.setText("");
+//                }
+//            } catch (JSONException e) {
+//                e.printStackTrace();
+//            }
+//        } else {
+//            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+//            String notice = "站位编号错误\n" + mNoticeStr;
+//            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
+//            tvMsgNotice.setText(spannableString);
+//            CommonUtil.makeNotice();
+//            mCollectEditText.setText("");
+//        }
     }
 
     /**
@@ -1047,7 +1048,7 @@ class QualityVerificationFra  extends BaseFragment implements View.OnClickListen
 
     @Override
     protected void initDatas() {
-        mSmtLocationCache = SharedPreUtil.getString(mActivity, Constants.FLAG.SMT_LOCATION_CACHE, null);
+//        mSmtLocationCache = SharedPreUtil.getString(mActivity, Constants.FLAG.SMT_LOCATION_CACHE, null);
         if (mLineInfoBean != null) {
             mLinecodeTextView.setText(mLineInfoBean.getDL_LINECODE());
             mTableTextView.setText(mLineInfoBean.getDL_TABLE() + "面");

+ 268 - 268
app/src/main/java/com/uas/pda_wps/fragment/SCSMTCheckFragment.java

@@ -117,7 +117,7 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
     private LineInfoBean mLineInfoBean;
     private AutoCompleteTextView mCollectEditText;
     private Button mConfirmButton;
-    private String mSmtLocationCache;
+//    private String mSmtLocationCache;
     private boolean mIgnoreFocusChange = false;
     private SmtDslBean mSmtDslBean = new SmtDslBean();
     private TextViewWithButton mLocationTextView;
@@ -481,17 +481,7 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
             locationCheck(collect, location);
         } else {
             mSmtDslBean.setDsl_barcode(collect);
-            /*if (mUpRadioButton.isChecked() || (mJoinRadioButton.isChecked() && COLLECT_PRODCODE.equals(mCollectEditText.getHint().toString()))) {
-                smtCheck(collect, location);
-            } else {
-                joinDataCheck(collect, location);
-            }*/
-
-            if (mMaterialSwitch) {
-                requestCheck(collect, location);
-            } else {
-                smtCheck(collect, location);
-            }
+            requestCheck(collect, location);
         }
     }
 
@@ -547,144 +537,144 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
         });
     }
 
-    private void joinDataCheck(final String collect, final String location) {
-        progressDialog.show();
-
-        PdaApplication.mRequestQueue.cancelAll(TAG + "datacheck");
-
-        mStringRequest = new StringRequest(Request.Method.POST, GloableParams.ADDRESS_SMT_JOIN_FORECASTDATA_CHECK,
-                new Response.Listener<String>() {
-                    @Override
-                    public void onResponse(String s) {
-                        if (progressDialog.isShowing())
-                            progressDialog.dismiss();
-                        joinDataCheck(collect, location, "原物料号校验正确", true);
-                    }
-                },
-                new Response.ErrorListener() {
-                    @Override
-                    public void onErrorResponse(VolleyError volleyError) {
-                        if (progressDialog.isShowing())
-                            progressDialog.dismiss();
-                        String errorToast = CommonUtil.showErrorToast(volleyError, false);
-                        joinDataCheck(collect, location, errorToast, false);
-                    }
-                }) {
-            @Override
-            public Map<String, String> getHeaders() throws AuthFailureError {
-                return VolleyUtil.getVolleyUtil().setCookies();
-            }
-
-            @Override
-            protected Map<String, String> getParams() throws AuthFailureError {
-                Map<String, String> params = new HashMap<>();
-                Map<String, Object> dslMap = new HashMap<>();
-                if (mUpRadioButton.isChecked()) {
-                    dslMap.put("type", "loading");
-                } else if (mJoinRadioButton.isChecked()) {
-                    dslMap.put("type", "join");
-                }
-                dslMap.put("dsl_location", location);
-                dslMap.put("dsl_prodcode", collect);
-                dslMap.put("success", true);
-
-                params.put("dsl", JSON.toJSONString(dslMap));
-                params.put("deviceLineMake", JSON.toJSONString(mLineInfoBean));
-                Log.d("paramjson", params.toString());
-                return params;
-            }
-        };
-        mStringRequest.setRetryPolicy(new DefaultRetryPolicy(10 * 1000, 0, 1f));
-        mStringRequest.setTag(TAG + "datacheck");
-        PdaApplication.mRequestQueue.add(mStringRequest);
-    }
-
-    private void joinDataCheck(String collect, String location, String dataCheckResult, boolean isSuccess) {
-        tvMsgProdcode.setText("");
-        tvMsgLocation.setText("");
-        tvMsgBarcode.setText("");
-        tvMsgQuantity.setText("");
-        tvMsgSpec.setText("");
-
-        collect = mLocationTextView.getText().toString().trim();
-
-        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);
-
-                        mAutoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());
-                        mCollectEditText.setAdapter(mAutoStringAdapter);
-
-                        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;
-                            }
-                            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);
-                            } else {
-                                SpannableString spannableString = CommonUtil.spanString(dataCheckResult + "\n请采集接料的物料号\n" + psl_prodcode, 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));
-                    String notice = "站位编号错误\n" + mNoticeStr;
-                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
-                    tvMsgNotice.setText(spannableString);
-                    CommonUtil.makeNotice();
-                    mCollectEditText.setText("");
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        } else {
-            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-            String notice = "站位编号错误\n" + mNoticeStr;
-            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
-            tvMsgNotice.setText(spannableString);
-            CommonUtil.makeNotice();
-            mCollectEditText.setText("");
-        }
-    }
+//    private void joinDataCheck(final String collect, final String location) {
+//        progressDialog.show();
+//
+//        PdaApplication.mRequestQueue.cancelAll(TAG + "datacheck");
+//
+//        mStringRequest = new StringRequest(Request.Method.POST, GloableParams.ADDRESS_SMT_JOIN_FORECASTDATA_CHECK,
+//                new Response.Listener<String>() {
+//                    @Override
+//                    public void onResponse(String s) {
+//                        if (progressDialog.isShowing())
+//                            progressDialog.dismiss();
+//                        joinDataCheck(collect, location, "原物料号校验正确", true);
+//                    }
+//                },
+//                new Response.ErrorListener() {
+//                    @Override
+//                    public void onErrorResponse(VolleyError volleyError) {
+//                        if (progressDialog.isShowing())
+//                            progressDialog.dismiss();
+//                        String errorToast = CommonUtil.showErrorToast(volleyError, false);
+//                        joinDataCheck(collect, location, errorToast, false);
+//                    }
+//                }) {
+//            @Override
+//            public Map<String, String> getHeaders() throws AuthFailureError {
+//                return VolleyUtil.getVolleyUtil().setCookies();
+//            }
+//
+//            @Override
+//            protected Map<String, String> getParams() throws AuthFailureError {
+//                Map<String, String> params = new HashMap<>();
+//                Map<String, Object> dslMap = new HashMap<>();
+//                if (mUpRadioButton.isChecked()) {
+//                    dslMap.put("type", "loading");
+//                } else if (mJoinRadioButton.isChecked()) {
+//                    dslMap.put("type", "join");
+//                }
+//                dslMap.put("dsl_location", location);
+//                dslMap.put("dsl_prodcode", collect);
+//                dslMap.put("success", true);
+//
+//                params.put("dsl", JSON.toJSONString(dslMap));
+//                params.put("deviceLineMake", JSON.toJSONString(mLineInfoBean));
+//                Log.d("paramjson", params.toString());
+//                return params;
+//            }
+//        };
+//        mStringRequest.setRetryPolicy(new DefaultRetryPolicy(10 * 1000, 0, 1f));
+//        mStringRequest.setTag(TAG + "datacheck");
+//        PdaApplication.mRequestQueue.add(mStringRequest);
+//    }
+//
+//    private void joinDataCheck(String collect, String location, String dataCheckResult, boolean isSuccess) {
+//        tvMsgProdcode.setText("");
+//        tvMsgLocation.setText("");
+//        tvMsgBarcode.setText("");
+//        tvMsgQuantity.setText("");
+//        tvMsgSpec.setText("");
+//
+//        collect = mLocationTextView.getText().toString().trim();
+//
+//        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);
+//
+//                        mAutoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());
+//                        mCollectEditText.setAdapter(mAutoStringAdapter);
+//
+//                        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;
+//                            }
+//                            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);
+//                            } else {
+//                                SpannableString spannableString = CommonUtil.spanString(dataCheckResult + "\n请采集接料的物料号\n" + psl_prodcode, 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));
+//                    String notice = "站位编号错误\n" + mNoticeStr;
+//                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
+//                    tvMsgNotice.setText(spannableString);
+//                    CommonUtil.makeNotice();
+//                    mCollectEditText.setText("");
+//                }
+//            } catch (JSONException e) {
+//                e.printStackTrace();
+//            }
+//        } else {
+//            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+//            String notice = "站位编号错误\n" + mNoticeStr;
+//            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
+//            tvMsgNotice.setText(spannableString);
+//            CommonUtil.makeNotice();
+//            mCollectEditText.setText("");
+//        }
+//    }
 
     private void locationCheck(String collect, String location) {
         tvMsgProdcode.setText("");
@@ -693,125 +683,135 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
         tvMsgQuantity.setText("");
         tvMsgSpec.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);
-
-                        mAutoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());
-                        mCollectEditText.setAdapter(mAutoStringAdapter);
-                         //no use
-                        if (mUpRadioButton.isChecked()) {
-                            mCollectEditText.setHint(COLLECT_PRODCODE);
-                            if (!TextUtils.isEmpty(psl_repcode)) {
-                                String[] repcodes = psl_repcode.split(",");
-                                String notice = "站位采集成功,请采集物料\n";
-                                for (int j = 0; j < repcodes.length; j++) {
-                                    String repcode = repcodes[j];
-                                    notice = notice + repcode + "\n";
-                                }
-                                notice = notice + "的物料编号";
-                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                                tvMsgNotice.setText(notice);
-                            } else if (!TextUtils.isEmpty(psl_prodcode)) {
-                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                                tvMsgNotice.setText("站位采集成功,请采集物料\n" + psl_prodcode + "\n的物料编号");
-                            } else {
-                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                                tvMsgNotice.setText("站位采集成功,物料编号获取失败");
-                            }
-                        } else {
-                            tvMsgNotice.setText("");
-                            mCollectEditText.setHint(COLLECT_OLD_PRODCODE);
-                        }
-                    }
-                }
-
-                if (!isExist) {
-                    tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-                    String notice = "站位编号错误\n" + mNoticeStr;
-                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
-                    tvMsgNotice.setText(spannableString);
-                    CommonUtil.makeNotice();
-                    mCollectEditText.setText("");
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        } else {
-            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-            String notice = "站位编号错误\n" + mNoticeStr;
-            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
-            tvMsgNotice.setText(spannableString);
-            CommonUtil.makeNotice();
-            mCollectEditText.setText("");
-        }
+        mLocationTextView.setText(collect);
+        mCollectEditText.setText("");
+
+        mSmtDslBean = new SmtDslBean();
+        mSmtDslBean.setDsl_location(location);
+        mSmtDslBean.setDsl_prodcode("");
+        mSmtDslBean.setDsl_repcode("");
+
+        mAutoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());
+        mCollectEditText.setAdapter(mAutoStringAdapter);
+
+//        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);
+//
+//                        mAutoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());
+//                        mCollectEditText.setAdapter(mAutoStringAdapter);
+//                         //no use
+//                        if (mUpRadioButton.isChecked()) {
+//                            mCollectEditText.setHint(COLLECT_PRODCODE);
+//                            if (!TextUtils.isEmpty(psl_repcode)) {
+//                                String[] repcodes = psl_repcode.split(",");
+//                                String notice = "站位采集成功,请采集物料\n";
+//                                for (int j = 0; j < repcodes.length; j++) {
+//                                    String repcode = repcodes[j];
+//                                    notice = notice + repcode + "\n";
+//                                }
+//                                notice = notice + "的物料编号";
+//                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+//                                tvMsgNotice.setText(notice);
+//                            } else if (!TextUtils.isEmpty(psl_prodcode)) {
+//                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+//                                tvMsgNotice.setText("站位采集成功,请采集物料\n" + psl_prodcode + "\n的物料编号");
+//                            } else {
+//                                tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+//                                tvMsgNotice.setText("站位采集成功,物料编号获取失败");
+//                            }
+//                        } else {
+//                            tvMsgNotice.setText("");
+//                            mCollectEditText.setHint(COLLECT_OLD_PRODCODE);
+//                        }
+//                    }
+//                }
+//
+//                if (!isExist) {
+//                    tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+//                    String notice = "站位编号错误\n" + mNoticeStr;
+//                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
+//                    tvMsgNotice.setText(spannableString);
+//                    CommonUtil.makeNotice();
+//                    mCollectEditText.setText("");
+//                }
+//            } catch (JSONException e) {
+//                e.printStackTrace();
+//            }
+//        } else {
+//            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+//            String notice = "站位编号错误\n" + mNoticeStr;
+//            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
+//            tvMsgNotice.setText(spannableString);
+//            CommonUtil.makeNotice();
+//            mCollectEditText.setText("");
+//        }
     }
 
-    /**
-     * 物料号本地校验
-     *
-     * @param collect  采集的物料号
-     * @param location 站位编号
-     */
-    private void smtCheck(final String collect, final String location) {
-        boolean isExist = false;
-        String repcode = mSmtDslBean.getDsl_repcode();
-        MyLog.e("aaa","采集的物料号:" + collect + ",站位编号:" + location);
-        MyLog.e("aaa","数据:repcode:" + repcode + ",数据:mSmtDslBean.getDsl_prodcode()" + mSmtDslBean.getDsl_prodcode());
-        if (collect.contains(mSmtDslBean.getDsl_prodcode())) {
-            isExist = true;
-        } else {
-            if (!TextUtils.isEmpty(repcode)) {
-                String[] repcodes = repcode.split(",");
-                if (repcodes != null && repcodes.length != 0) {
-                    for (int i = 0; i < repcodes.length; i++) {
-                        if (collect.contains(repcodes[i])) {
-                            isExist = true;
-                        }
-                    }
-                }
-            }
-        }
-
-        if (isExist) {
-            successCheckData(collect, location);
-        } else {
-            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-
-            String notice = "校验失败,物料号错误!\n" + mNoticeStr;
-            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "校验失败,物料号错误!\n".length(), notice.length(), R.color.green);
-            tvMsgNotice.setText(spannableString);
-
-            CommonUtil.makeNotice();
-            mCollectEditText.setText("");
-            mCollectEditText.postDelayed(new Runnable() {
-                @Override
-                public void run() {
-                    mCollectEditText.requestFocus();
-                }
-            }, 100);
-
-            int smtCheckErr = SharedPreUtil.getInt(mActivity, Constants.FLAG.SMT_CHECK_ERROR, 0);
-            if (smtCheckErr == 1) {
-                failCheckData(collect, location);
-            }
-
-        }
-    }
+//    /**
+//     * 物料号本地校验
+//     * @param collect  采集的物料号
+//     * @param location 站位编号
+//     */
+//    private void smtCheck(final String collect, final String location) {
+//        boolean isExist = false;
+//        String repcode = mSmtDslBean.getDsl_repcode();
+//        MyLog.e("aaa","采集的物料号:" + collect + ",站位编号:" + location);
+//        MyLog.e("aaa","数据:repcode:" + repcode + ",数据:mSmtDslBean.getDsl_prodcode()" + mSmtDslBean.getDsl_prodcode());
+//        if (collect.contains(mSmtDslBean.getDsl_prodcode())) {
+//            isExist = true;
+//        } else {
+//            if (!TextUtils.isEmpty(repcode)) {
+//                String[] repcodes = repcode.split(",");
+//                if (repcodes != null && repcodes.length != 0) {
+//                    for (int i = 0; i < repcodes.length; i++) {
+//                        if (collect.contains(repcodes[i])) {
+//                            isExist = true;
+//                        }
+//                    }
+//                }
+//            }
+//        }
+//
+//        if (isExist) {
+//            successCheckData(collect, location);
+//        } else {
+//            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+//
+//            String notice = "校验失败,物料号错误!\n" + mNoticeStr;
+//            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "校验失败,物料号错误!\n".length(), notice.length(), R.color.green);
+//            tvMsgNotice.setText(spannableString);
+//
+//            CommonUtil.makeNotice();
+//            mCollectEditText.setText("");
+//            mCollectEditText.postDelayed(new Runnable() {
+//                @Override
+//                public void run() {
+//                    mCollectEditText.requestFocus();
+//                }
+//            }, 100);
+//
+//            int smtCheckErr = SharedPreUtil.getInt(mActivity, Constants.FLAG.SMT_CHECK_ERROR, 0);
+//            if (smtCheckErr == 1) {
+//                failCheckData(collect, location);
+//            }
+//
+//        }
+//    }
 
     private void failCheckData(final String collect, final String location) {
         PdaApplication.mRequestQueue.cancelAll(TAG + "check");
@@ -1053,7 +1053,7 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
     protected void initDatas() {
         ((TextView) (getActivity().findViewById(R.id.tv_actionbar_withback))).setText(R.string.title_feedercheck_smt);
 
-        mSmtLocationCache = SharedPreUtil.getString(mActivity, Constants.FLAG.SMT_LOCATION_CACHE, null);
+//        mSmtLocationCache = SharedPreUtil.getString(mActivity, Constants.FLAG.SMT_LOCATION_CACHE, null);
         if (mLineInfoBean != null) {
             mLinecodeTextView.setText(mLineInfoBean.getDL_LINECODE());
             mTableTextView.setText(mLineInfoBean.getDL_TABLE() + "面");

+ 157 - 115
app/src/main/java/com/uas/pda_wps/fragment/SCSMTInFragment.java

@@ -31,9 +31,14 @@ import com.uas.pda_wps.tools.SharedPreUtil;
 import com.uas.pda_wps.tools.VolleyUtil;
 import com.uas.pda_wps.util.CommonUtil;
 import com.uas.pda_wps.util.Constants;
+import com.uas.pda_wps.util.FastjsonUtil;
+import com.uas.pda_wps.util.HttpCallback;
+import com.uas.pda_wps.util.HttpParams;
 import com.uas.pda_wps.util.JsonUtils;
 import com.uas.pda_wps.util.LogUtil;
+import com.uas.pda_wps.util.MyLog;
 import com.uas.pda_wps.util.SoundUtil;
+import com.uas.pda_wps.util.VolleyRequest;
 import com.uas.pda_wps.view.ClearableEditText;
 import com.uas.pda_wps.view.TextViewWithButton;
 
@@ -60,11 +65,12 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
 
     private Button btnCollect;
     private LineInfoBean mLineInfoBean;
-    private String mSmtLocationCache;
+
     private SmtDslBean mSmtDslBean = new SmtDslBean();
     private StringRequest mStringRequest;
     private String mNoticeStr = "";
     private boolean mOrderSwitch = false;
+    private String mSmtLocationCache;
 
     @Override
     protected int getLayout() {
@@ -102,24 +108,6 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
         VolleyUtil.setVolleyHandler(handler);
 
         mLineInfoBean = (LineInfoBean) PdaApplication.getDataCacheFromMap(Constants.FLAG.SMT_DEVICE_LINE_CACHE);
-
-//        JSONObject paramJson = new JSONObject();
-//        try {
-//            makeCraft = new JSONObject(makeCraftStr);
-//            String ps_id = makeCraft.get("ps_id").toString();
-//            String mcjob = makeCraft.get("mc_prodcode").toString();
-//            paramJson.put("ps_id", ps_id);
-//            paramJson.put("prodcode", mcjob);
-//        } catch (JSONException e) {
-//            e.printStackTrace();
-//        }
-//        Log.e("SMTINCHILD", "makecraft" + makeCraft.toString());
-//        //获取网络数据
-//        showLoadingView();
-//        requestType = VolleyUtil.FRAGMENT_SCMAKE_SMTINDETAIL;
-//        VolleyUtil.getVolleyUtil().requestJsonObject(getActivity(), GloableParams.ADDRESS_SMTDETAIL_APPLY, VolleyUtil.METHOD_POST,
-//                VolleyUtil.FRAGMENT_SCMAKE_SMTINDETAIL, paramJson);
-
     }
 
     @Override
@@ -154,13 +142,6 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
             public void onTextClear() {
                 mCollectEditText.setHint("请录入站位编号");
                 mCollectEditText.setText("");
-
-//                tvMsgNotice.setText("");
-//                tvMsgProdcode.setText("");
-//                tvMsgLocation.setText("");
-//                tvMsgBarcode.setText("");
-//                tvMsgQuantity.setText("");
-//                tvMsgSpec.setText("");
             }
         });
 
@@ -168,38 +149,89 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
 
     private void confirmEvent(String collect) {
         String location = mLocationTextView.getText().toString().trim();
+        MyLog.e("aaa","是否进入设置:" + location);
         if (TextUtils.isEmpty(location)) {
-            locationCheck(collect);
-            //mLocationTextView.setText(location);
-        } else {
-         /*   mSmtDslBean.setDsl_barcode(collect);
-            String dsl_repcode = mSmtDslBean.getDsl_repcode();
-            if (!TextUtils.isEmpty(dsl_repcode)) {
-                boolean isExist = false;
-                String[] repcodes = dsl_repcode.split(",");
-                for (int j = 0; j < repcodes.length; j++) {
-                    String repcode = repcodes[j];
-                    if (repcode != null && repcode.equals(collect)) {
-                        isExist = true;
-                    }
-                }
-
-                if (isExist) {
+            //locationCheck(collect);
+            mLocationTextView.setText(collect);
+            mCollectEditText.setText("");
 
-                } else {
-                    //上料操作
-                    feedLoading();
-                }
-            } else {*/
+            mSmtDslBean = new SmtDslBean();
+            mSmtDslBean.setDsl_location(collect);
+            mSmtDslBean.setDsl_prodcode("");
+            mCollectEditText.setHint("请录入条码号");
+
+            tvMsgNotice.setText("");
+            tvMsgProdcode.setText("");
+            tvMsgLocation.setText("");
+            tvMsgBarcode.setText("");
+            tvMsgQuantity.setText("");
+            tvMsgSpec.setText("");
+            setLocationCheck(collect);  //接口站位校验
+        } else {
             mSmtDslBean.setDsl_barcode(collect);
             feedLoading();
-//            }
         }
     }
 
+    /**
+     *   接口: 站位校验
+     */
+    private void setLocationCheck(String collect) {
+//        mLinecodeTextView.setText(mLineInfoBean.getDL_LINECODE());  //线别
+//        mTableTextView.setText(mLineInfoBean.getDL_TABLE() + "面");  //板面
+//        mMacodeTextView.setText(mLineInfoBean.getDL_MACODE());      //工单
+
+        progressDialog.show();
+        VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
+                .url(GloableParams.ADDRESS_LOADING_CHECKLOC)
+                .method(Request.Method.GET)
+                .addParam("li_code", mLineInfoBean.getDL_LINECODE())    //线别
+                .addParam("ma_code", mLineInfoBean.getDL_MACODE())      //工单
+                .addParam("dl_table", mLineInfoBean.getDL_TABLE())      //板面
+                .addParam("location", collect)         //站位
+                .build(), new HttpCallback() {
+            @Override
+            public void onSuccess(int flag, Object o) throws Exception {
+                try {
+                    progressDialog.dismiss();
+                    String result = o.toString();
+
+                    com.alibaba.fastjson.JSONObject resultObject = JSON.parseObject(result);
+                    com.alibaba.fastjson.JSONObject data = resultObject.getJSONObject("data");
+                    if (data != null) {
+                        String fecode = FastjsonUtil.getText(data, "fecode");
+                        String prodcode = FastjsonUtil.getText(data, "prodcode");
+                        String location = FastjsonUtil.getText(data, "location");
+
+                        mLocationTextView.setText(location);
+                        mCollectEditText.setText("");
+
+                        tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+                        String text = "校验成功" + "\n";
+                        text += "站位: " + location + "\n"
+                                + "飞达: " + fecode + "\n"
+                                + "请采集物料: " + prodcode + "的料卷编号/物料编号";
+                                tvMsgNotice.setText(text);
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+
+            @Override
+            public void onFail(int flag, String failStr) throws Exception {
+                progressDialog.dismiss();
+                CommonUtil.toastNoRepeat(getActivity(), failStr);
+                mLocationTextView.setText("");
+                mCollectEditText.setText("");
+                tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+                tvMsgNotice.setText(failStr);
+            }
+        });
+    }
+
     /**
      * 站位本地校验
-     *
      * @param collect 采集框采集内容
      */
     private void locationCheck(String collect) {
@@ -209,65 +241,71 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
         tvMsgQuantity.setText("");
         tvMsgSpec.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);
-                        mCollectEditText.setHint("请录入飞达编号");
-                        if (!TextUtils.isEmpty(psl_repcode)) {
-//                                if (TextUtils.isEmpty(psl_repcode) || "null".equals(psl_repcode))
-//                                    tvMsgNotice.setText("站位采集成功,请采集首选料[" + psl_prodcode + "]的料卷编号");
-//                                else
-                            String[] repcodes = psl_repcode.split(",");
-                            String notice = "站位采集成功,请采集物料\n";
-                            for (int j = 0; j < repcodes.length; j++) {
-                                String repcode = repcodes[j];
-                                notice = notice + repcode + "\n";
-                            }
-                            notice = notice + "的料卷编号/物料编号";
-                            tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                            tvMsgNotice.setText(notice);
-                        } else if (!TextUtils.isEmpty(psl_prodcode)) {
-                            tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                            tvMsgNotice.setText("站位采集成功,请采集物料\n" + psl_prodcode + "\n的飞达编号");
-                        } else {
-                            tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                            tvMsgNotice.setText("站位采集成功,物料编号获取失败");
-                        }
-                    }
-                }
-
-                if (!isExist) {
-                    tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-                    String notice = "站位编号错误\n" + mNoticeStr;
-                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
-                    tvMsgNotice.setText(spannableString);
-                    CommonUtil.makeNotice();
-                    mCollectEditText.setText("");
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        } else {
-            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
-            String notice = "站位编号错误\n" + mNoticeStr;
-            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
-            tvMsgNotice.setText(spannableString);
-            CommonUtil.makeNotice();
-            mCollectEditText.setText("");
-        }
+        mLocationTextView.setText(collect);
+        mCollectEditText.setText("");
+
+        mSmtDslBean = new SmtDslBean();
+        mSmtDslBean.setDsl_location(collect);
+        mSmtDslBean.setDsl_prodcode("");
+        mCollectEditText.setHint("请录入条码号");
+
+//        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);
+//                        mCollectEditText.setHint("请录入飞达编号");
+//
+//                        if (!TextUtils.isEmpty(psl_repcode)) {
+//                            String[] repcodes = psl_repcode.split(",");
+//                            String notice = "站位采集成功,请采集物料\n";
+//                            for (int j = 0; j < repcodes.length; j++) {
+//                                String repcode = repcodes[j];
+//                                notice = notice + repcode + "\n";
+//                            }
+//                            notice = notice + "的料卷编号/物料编号";
+//                            tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+//                            tvMsgNotice.setText(notice);
+//                        } else if (!TextUtils.isEmpty(psl_prodcode)) {
+//                            tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+//                            tvMsgNotice.setText("站位采集成功,请采集物料\n" + psl_prodcode + "\n的飞达编号");
+//                        } else {
+//                            tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
+//                            tvMsgNotice.setText("站位采集成功,物料编号获取失败");
+//                        }
+//                    }
+//                }
+//
+//                if (!isExist) {
+//                    tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+//                    String notice = "站位编号错误\n" + mNoticeStr;
+//                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
+//                    tvMsgNotice.setText(spannableString);
+//                    CommonUtil.makeNotice();
+//                    mCollectEditText.setText("");
+//                }
+//            } catch (JSONException e) {
+//                e.printStackTrace();
+//            }
+//        } else {
+//            tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+//            String notice = "站位编号错误\n" + mNoticeStr;
+//            SpannableString spannableString = CommonUtil.spanString(notice, mActivity, "站位编号错误\n".length(), notice.length(), R.color.green);
+//            tvMsgNotice.setText(spannableString);
+//            CommonUtil.makeNotice();
+//            mCollectEditText.setText("");
+//        }
     }
 
     /**
@@ -279,8 +317,9 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
 
         final String smtDsl = JSON.toJSONString(mSmtDslBean);
         String deviceLineMake = "";
-        if (mLineInfoBean != null)
+        if (mLineInfoBean != null) {
             deviceLineMake = JSON.toJSONString(mLineInfoBean);
+        }
         final String finalDeviceLineMake = deviceLineMake;
         mStringRequest = new StringRequest(Request.Method.POST, GloableParams.ADDRESS_SMT_LOADING,
                 new Response.Listener<String>() {
@@ -345,7 +384,8 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
                                         //noticeStr = noticeStr.substring(0, noticeStr.length() - 1);
                                     }
                                     mNoticeStr = noticeStr;
-                                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, (buffer + "\n\n未上料站位").length(), (buffer + "\n\n未上料站位").length() + CommonUtil.doubleFormat(notCheckCount).length(), R.color.blue_800);
+                                    SpannableString spannableString = CommonUtil.spanString(notice, mActivity, (buffer + "\n\n未上料站位").length(),
+                                            (buffer + "\n\n未上料站位").length() + CommonUtil.doubleFormat(notCheckCount).length(), R.color.blue_800);
                                     tvMsgSpec.setText(spannableString);
                                 }
                             }
@@ -363,7 +403,8 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
                         if (errorToast != null) {
                             tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
                             String errorNotice = errorToast + "\n" + mNoticeStr;
-                            SpannableString spannableString = CommonUtil.spanString(errorNotice, mActivity, (errorToast + "\n").length(), errorNotice.length(), R.color.green);
+                            SpannableString spannableString = CommonUtil.spanString(errorNotice,
+                                    mActivity, (errorToast + "\n").length(), errorNotice.length(), R.color.green);
                             tvMsgNotice.setText(spannableString);
                             if (errorToast.contains("站位已经有在线料卷号")) {
                                 mLocationTextView.setText("");
@@ -403,9 +444,9 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
             Log.d("smtLocation", mSmtLocationCache);
         }
         if (mLineInfoBean != null) {
-            mLinecodeTextView.setText(mLineInfoBean.getDL_LINECODE());
-            mTableTextView.setText(mLineInfoBean.getDL_TABLE() + "面");
-            mMacodeTextView.setText(mLineInfoBean.getDL_MACODE());
+            mLinecodeTextView.setText(mLineInfoBean.getDL_LINECODE());  //线别
+            mTableTextView.setText(mLineInfoBean.getDL_TABLE() + "面");  //板面
+            mMacodeTextView.setText(mLineInfoBean.getDL_MACODE());      //工单
         }
 
         getUnloadingLocation();
@@ -416,7 +457,8 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
      */
     private void getUnloadingLocation() {
         progressDialog.show();
-        String url = GloableParams.ADDRESS_SMT_GET_UNLOADING_LOCATION + "?linecode=" + (mLineInfoBean == null ? "" : mLineInfoBean.getDL_LINECODE());
+        String url = GloableParams.ADDRESS_SMT_GET_UNLOADING_LOCATION + "?linecode="
+                + (mLineInfoBean == null ? "" : mLineInfoBean.getDL_LINECODE());
         PdaApplication.mRequestQueue.cancelAll(TAG + "unloading");
 
         mStringRequest = new StringRequest(Request.Method.GET, url,

+ 11 - 5
app/src/main/java/com/uas/pda_wps/fragment/SCSMTIndexFragment.java

@@ -135,10 +135,10 @@ public class SCSMTIndexFragment extends BaseFragment implements AdapterView.OnIt
         if (mLineInfoBean != null) {
             mDecodeTextView.setText(mLineInfoBean.getDL_DECODE());
             mStatusTextView.setText(mLineInfoBean.getDL_STATUS());
-            mLinecodeTextView.setText(mLineInfoBean.getDL_LINECODE());
-            mTableTextView.setText(mLineInfoBean.getDL_TABLE() + "面");
-            mMacodeTextView.setText(mLineInfoBean.getDL_MACODE());
-            mProdcodeTextView.setText(mLineInfoBean.getDL_PRODCODE());
+            mLinecodeTextView.setText(mLineInfoBean.getDL_LINECODE());      //线别
+            mTableTextView.setText(mLineInfoBean.getDL_TABLE() + "面");      //板面
+            mMacodeTextView.setText(mLineInfoBean.getDL_MACODE());          //工单号
+            mProdcodeTextView.setText(mLineInfoBean.getDL_PRODCODE());      //产品编号
 
             if (CommonUtil.isNetWorkConnected(mActivity)) {
                 getSmtLocation();
@@ -242,6 +242,12 @@ public class SCSMTIndexFragment extends BaseFragment implements AdapterView.OnIt
                     //上料
                     case GloableParams.LISTNAME_FEEDER_IN:
                         fragment = new SCSMTInFragment();
+//                        Bundle bundle = new Bundle();
+//                        bundle.putString("DL_LINECODE",mLineInfoBean.getDL_LINECODE());
+//                        bundle.putString("DL_TABLE",mLineInfoBean.getDL_TABLE() + "面");
+//                        bundle.putString("DL_MACODE",mLineInfoBean.getDL_MACODE());
+//                        bundle.putString("DL_PRODCODE",mLineInfoBean.getDL_PRODCODE());
+//                        fragment.setArguments(bundle);
                         FragmentUtils.switchFragment(this, fragment);
                         break;
                     //接料
@@ -299,7 +305,7 @@ public class SCSMTIndexFragment extends BaseFragment implements AdapterView.OnIt
                     //飞达料盘绑定
                     case GloableParams.LISTNAME_FEEDER_BIND:
                         fragment = new SCSMTBindFragment();
-                        Bundle bundle=new Bundle();
+                        Bundle bundle = new Bundle();
                         bundle.putString("prodcode",mLineInfoBean.getDL_PRODCODE());
                         fragment.setArguments(bundle);
                         FragmentUtils.switchFragment(this, fragment);

+ 128 - 109
app/src/main/java/com/uas/pda_wps/fragment/SCSMTJointFragment.java

@@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
 import android.content.Context;
 import android.os.Handler;
 import android.os.Message;
-import android.text.SpannableString;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.KeyEvent;
@@ -65,9 +64,10 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
     private LineInfoBean mLineInfoBean;
     private TextView mLinecodeTextView, mTableTextView, mMacodeTextView;
     private ClearableEditText mCollectEditText;
-    private String mSmtLocationCache;
+
     private SmtDslBean mSmtDslBean = new SmtDslBean();
     private StringRequest mStringRequest;
+    private String mSmtLocationCache;
 
     @Override
     protected int getLayout() {
@@ -189,46 +189,57 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
         tvMsgQuantity.setText("");
         tvMsgSpec.setText("");
 
-        //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("");
+        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);
+        mSmtDslBean = new SmtDslBean();
+        mSmtDslBean.setDsl_location(collect);
+        mSmtDslBean.setDsl_prodcode("");
 
-                        joinForcast(collect);
-                        break;
-                    }
-                }
+        tvMsgNotice.setText("");
+        mCollectEditText.setHint(COLLECT_OLD_PRODCODE);
 
-                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("");
-        }
+        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("");
+//        }
     }
 
     private void joinForcast(String collect) {
@@ -325,7 +336,7 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
                         if (progressDialog.isShowing())
                             progressDialog.dismiss();
                         String errorToast = CommonUtil.showErrorToast(volleyError, false);
-//                        joinDataCheck(collect, location, errorToast, false);
+                        joinDataCheck(collect, location, errorToast, false);
                         mCollectEditText.setText("");
                         tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
                         tvMsgNotice.setText(errorToast);
@@ -367,75 +378,83 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
 
         collect = mLocationTextView.getText().toString().trim();
 
-        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("");
-        }
+        mSmtDslBean = new SmtDslBean();
+        mSmtDslBean.setDsl_location(location);
+        mSmtDslBean.setDsl_prodcode("");
+        mSmtDslBean.setDsl_repcode(collect);
+
+        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("");
+//        }
     }
 
     /**

+ 24 - 11
app/src/main/java/com/uas/pda_wps/fragment/SMTMaterialPreparation.java

@@ -38,6 +38,7 @@ import com.uas.pda_wps.tools.SharedPreUtil;
 import com.uas.pda_wps.tools.VolleyUtil;
 import com.uas.pda_wps.util.CommonUtil;
 import com.uas.pda_wps.util.Constants;
+import com.uas.pda_wps.util.FragmentUtils;
 import com.uas.pda_wps.util.JsonUtils;
 import com.uas.pda_wps.util.MyArrayAdapter;
 import com.uas.pda_wps.view.ClearableEditText;
@@ -109,7 +110,19 @@ class SMTMaterialPreparation extends BaseFragment implements View.OnClickListene
         tvNotice = (TextView) root.findViewById(R.id.tv_notice_smt);
         mConfirmButton = (Button) root.findViewById(R.id.btn_device_ok_smt);
         makeCraft = new JSONObject();
-        mLineInfo = new LineInfoBean();
+
+//        mLineInfo = new LineInfoBean();
+//        mLineInfo.setPS_ID(11);
+//        mLineInfo.setMA_ID(22);
+//        mLineInfo.setDL_TABLE("aaa");
+//        mLineInfo.setDL_STATUSCODE("aaa");
+//        mLineInfo.setDL_STATUS("aaa");
+//        mLineInfo.setDL_PRODCODE("aaa");
+//        mLineInfo.setDL_MACODE("aaa");
+//        mLineInfo.setDL_LINECODE("aaa");
+//        mLineInfo.setDL_ID(333);
+//        mLineInfo.setDL_DECODE("aaa");
+//        mLineInfo.setDL_MAINLINE("aaa");
     }
 
     @Override
@@ -319,7 +332,6 @@ class SMTMaterialPreparation extends BaseFragment implements View.OnClickListene
         //回调配置
         DataSourceManager.getDataSourceManager().setNotifyData(this);
         VolleyUtil.getVolleyUtil().setVolleyHandler(handler);
-       //        editTextGetFocus(etLineCode);
     }
 
 
@@ -327,7 +339,7 @@ class SMTMaterialPreparation extends BaseFragment implements View.OnClickListene
     public void onResume() {
         super.onResume();
         mIgnoreFocusChange = false;
-        mCacheLine = SharedPreUtil.getString(mActivity, Constants.FLAG.SMT_LINECODE_CACHE + CommonUtil.getUserName(mActivity) + CommonUtil.getFunMaster(mActivity), "");
+        mCacheLine = SharedPreUtil.getString(mActivity, Constants.FLAG.SMT_material_preparation_CACHE + CommonUtil.getUserName(mActivity) + CommonUtil.getFunMaster(mActivity), "");
         etLineCode.setText(mCacheLine);
         if (!TextUtils.isEmpty(mCacheLine))
             etLineCode.setSelection(mCacheLine.length());
@@ -469,8 +481,7 @@ class SMTMaterialPreparation extends BaseFragment implements View.OnClickListene
 
     //跳转到SMT采集页面 上料操作主页面
     private void gotoSMTContentFragment() {
-        //        etLineCode.setText("");
-        SharedPreUtil.saveString(mActivity, Constants.FLAG.SMT_LINECODE_CACHE + CommonUtil.getUserName(mActivity) + CommonUtil.getFunMaster(mActivity), mLineInfo.getDL_LINECODE());
+        SharedPreUtil.saveString(mActivity, Constants.FLAG.SMT_material_preparation_CACHE + CommonUtil.getUserName(mActivity) + CommonUtil.getFunMaster(mActivity), mLineInfo.getDL_LINECODE());
         etJobCode.setText("");
 
         Fragment smtStandbyFunction = new SMTStandbyFunction();
@@ -481,11 +492,13 @@ class SMTMaterialPreparation extends BaseFragment implements View.OnClickListene
             b.putString("DL_TABLE",mLineInfo.getDL_TABLE());   //板面
             b.putString("DL_MACODE",mLineInfo.getDL_MACODE());   //工单号
             b.putString("DL_PRODCODE",mLineInfo.getDL_PRODCODE());   //产品编号
-            smtStandbyFunction.setArguments(b);
+            //smtStandbyFunction.setArguments(b);
+            FragmentUtils.switchFragment2(SMTMaterialPreparation.this,smtStandbyFunction,b);
         }
-        getActivity().getSupportFragmentManager().beginTransaction()
-                .add(R.id.container_function_fragment, smtStandbyFunction)
-                .commitAllowingStateLoss();
+
+//        getActivity().getSupportFragmentManager().beginTransaction()
+//                .add(R.id.container_function_fragment, smtStandbyFunction)
+//                .commitAllowingStateLoss();
 
 //        getFragmentManager().beginTransaction().addToBackStack(null)
 //                .replace(R.id.container_function_fragment, tmpFragment, null)
@@ -592,10 +605,10 @@ class SMTMaterialPreparation extends BaseFragment implements View.OnClickListene
 
     @Override
     public void onClick(View v) {
-        //        disposeClick();
-        //        confirmDevice();
         String lineCode = etLineCode.getText().toString().trim();
         getLineInfo(lineCode);
+
+        //gotoSMTContentFragment();
     }
 
 

+ 33 - 22
app/src/main/java/com/uas/pda_wps/fragment/SMTStandbyFunction.java

@@ -51,6 +51,7 @@ import com.uas.pda_wps.util.HttpCallback;
 import com.uas.pda_wps.util.HttpParams;
 import com.uas.pda_wps.util.JsonUtils;
 import com.uas.pda_wps.util.MyArrayAdapter;
+import com.uas.pda_wps.util.MyLog;
 import com.uas.pda_wps.util.VolleyRequest;
 import com.uas.pda_wps.view.ClearableEditText;
 import com.uas.pda_wps.view.ConfirmDialog;
@@ -123,6 +124,21 @@ class SMTStandbyFunction extends BaseFragment implements AdapterView.OnItemClick
         operationIndexList = DataSourceManager.getDataSourceManager().getFeederOperationIndex2();
 
         mLineInfoBean = (LineInfoBean) PdaApplication.getDataCacheFromMap(Constants.FLAG.SMT_DEVICE_LINE_CACHE);
+
+        //测试数据
+//        mLineInfoBean = new LineInfoBean();
+//        mLineInfoBean.setDL_DECODE("aa");
+//        mLineInfoBean.setDL_MAINLINE("aa");
+//        mLineInfoBean.setDL_ID(111);
+//        mLineInfoBean.setDL_LINECODE("aa");
+//        mLineInfoBean.setDL_MACODE("aa");
+//        mLineInfoBean.setDL_PRODCODE("aa");
+//        mLineInfoBean.setDL_STATUS("aa");
+//        mLineInfoBean.setDL_STATUSCODE("aa");
+//        mLineInfoBean.setDL_TABLE("aa");
+//        mLineInfoBean.setMA_ID(222);
+//        mLineInfoBean.setPS_ID(333);
+
     }
 
     @Override
@@ -250,37 +266,41 @@ class SMTStandbyFunction extends BaseFragment implements AdapterView.OnItemClick
             } else {
                 //获取选择的列表Name
                 String selectedName = operationIndexList.get(position).get(DataSourceManager.KEY_GRID_ITEMNAME).toString();
-                Fragment fragment;
+                if (!TextUtils.isEmpty(selectedName)) {
+                    if (selectedName.equals(GloableParams.LISTNAME_GO_ONLINE)){     //上线
+                        confirmOnline();
+                        return;
+                    }else if (selectedName.equals(GloableParams.LISTNAME_FEEDER_DOWNALL2)){     //全部下料
+                        queryMakeqty(1);
+                        return;
+                    }
+                }
+                MyLog.e("aaa", "值是:" + selectedName);
+                Fragment fragment = null;
                 switch (selectedName) {
                     //上料
                     case GloableParams.LISTNAME_FEEDER_IN2:
                         fragment = new SCSMTInFragment();
-                        FragmentUtils.switchFragment(this, fragment);
                         break;
                     //下料
                     case GloableParams.LISTNAME_FEEDER_DOWN2:
                         fragment = new SCSMTDownFragment();
-                        FragmentUtils.switchFragment(this, fragment);
-                        break;
-                    //全部下料
-                    case GloableParams.LISTNAME_FEEDER_DOWNALL2:
-                        queryMakeqty(1);
                         break;
                     //料卷查询
                     case GloableParams.LISTNAME_FEEDER_QUERY2:
                         fragment = new SCSMTQueryFragment();
-                        FragmentUtils.switchFragment(this, fragment);
                         break;
                     //品质校验
                     case GloableParams.LISTNAME_QUALITY_VERIFICATION2:
                         fragment = new QualityVerificationFra();
-                        FragmentUtils.switchFragment(this, fragment);
                         break;
-                    //上线
-                    case GloableParams.LISTNAME_GO_ONLINE:
-                        confirmOnline();
+                    default:
                         break;
                 }
+                if (fragment != null) {
+                    //FragmentUtils.switchFragment(this, fragment);
+                    FragmentUtils.switchFragment2(this, fragment,null);
+                }
             }
         }
     }
@@ -327,13 +347,7 @@ class SMTStandbyFunction extends BaseFragment implements AdapterView.OnItemClick
                         CommonUtil.toastNoRepeat(mActivity, "上线成功");
 
                         Fragment tmpFragment = new SMTMaterialPreparation();
-                        getFragmentManager().beginTransaction()
-                                .addToBackStack(null)
-                                .replace(R.id.container_function_fragment, tmpFragment, null)
-                                .commit();
-
-                        //                        SMTMaterialPreparation fragment = new SMTMaterialPreparation();
-                        //                        FragmentUtils.switchFragment(SMTStandbyFunction.this, fragment);
+                        FragmentUtils.removeFragment(SMTStandbyFunction.this,tmpFragment);
 
                         String data = resultObject.optString("data");
                     }
@@ -537,7 +551,6 @@ class SMTStandbyFunction extends BaseFragment implements AdapterView.OnItemClick
         jobsEditText.addTextChangedListener(new TextWatcher() {
             @Override
             public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
             }
 
             @Override
@@ -563,7 +576,6 @@ class SMTStandbyFunction extends BaseFragment implements AdapterView.OnItemClick
                         }
                     }
                 }
-
             }
 
             @Override
@@ -593,7 +605,6 @@ class SMTStandbyFunction extends BaseFragment implements AdapterView.OnItemClick
             }
         });
 
-
         mConfirmTextView.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {

+ 9 - 0
app/src/main/java/com/uas/pda_wps/global/GloableParams.java

@@ -260,6 +260,10 @@ public class GloableParams {
     public static String ADDRESS_PRE_ONLINE;      //上线
 
 
+    public static String ADDRESS_LOADING_CHECKLOC;      //SMT上料-->校验站位
+
+
+
     //连接服务器请求地址
     private static final String ADDRESSTAIL_CONNECT_SERVER = "/api/pda/getAllMasters.action";
     //登录页面请求地址
@@ -542,6 +546,9 @@ public class GloableParams {
     //上线
     private static final String ADDRESSTAIL_PRE_ONLINE = "/api/pda/smt/preOnline.action";
 
+    //SMT上料-->站位校验
+    private static final String ADDRESSTAIL_LOADING_CHECKLOC = "/api/pda/smt/loadingCheckLoc.action";
+
     /**
      * 材料入库
      */
@@ -1170,6 +1177,8 @@ public class GloableParams {
 
         GloableParams.ADDRESS_PRE_ONLINE = uriHead + GloableParams.ADDRESSTAIL_PRE_ONLINE;
 
+        GloableParams.ADDRESS_LOADING_CHECKLOC = uriHead + GloableParams.ADDRESSTAIL_LOADING_CHECKLOC;
+
 
     }
 }

+ 3 - 0
app/src/main/java/com/uas/pda_wps/util/Constants.java

@@ -193,6 +193,9 @@ public interface Constants {
         String SMT_DEVICE_LINE_CACHE = "smt_device_line_cache";
         String SMT_LINECODE_CACHE = "smt_linecode_cache";
 
+        //SMT备料-->线别的缓存
+        String SMT_material_preparation_CACHE = "smt_material_preparation_cache";
+
         //加料列表缓存
         String SMT_REQUEST_CACHE = "smt_request_cache";
 

+ 47 - 0
app/src/main/java/com/uas/pda_wps/util/FragmentUtils.java

@@ -1,5 +1,6 @@
 package com.uas.pda_wps.util;
 
+import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
@@ -28,4 +29,50 @@ public class FragmentUtils {
             transaction.hide(from).show(to).commit(); // 隐藏当前的fragment,显示下一个
         }
     }
+
+    public static void switchFragment2(Fragment from, Fragment to, Bundle bundle) {
+        try{
+            FragmentManager fragmentManager = from.getFragmentManager();
+            FragmentTransaction transaction = fragmentManager.beginTransaction();
+            if (bundle != null) {
+                to.setArguments(bundle);
+            }
+            if (to.isAdded()) { // 先判断是否被add过
+                transaction.hide(from)
+                        .replace(R.id.container_function_fragment, to)
+                        .commit(); // 隐藏当前的fragment,add下一个到Activity中
+            } else {
+                transaction.hide(from)
+                        .add(R.id.container_function_fragment, to)
+                        .addToBackStack(to.getClass().getSimpleName())
+                        .commit(); // 隐藏当前的fragment,add下一个到Activity中
+                //transaction.hide(from).show(to).commit(); // 隐藏当前的fragment,显示下一个
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void removeFragment(Fragment from, Fragment to) {
+        try{
+            FragmentManager fragmentManager = from.getFragmentManager();
+            FragmentTransaction transaction = fragmentManager.beginTransaction();
+
+            // 移除所有Fragment
+            for (Fragment fragment : fragmentManager.getFragments()) {
+                if (fragment != null) {
+                    transaction.remove(fragment);
+                }
+            }
+            // 提交事务
+            transaction.commit();
+            // 清空回退栈
+            fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
+
+            transaction.replace(R.id.container_function_fragment, to);
+
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 }

+ 31 - 0
app/src/main/java/com/uas/pda_wps/util/MyLog.java

@@ -2,6 +2,7 @@ package com.uas.pda_wps.util;
 
 import android.annotation.SuppressLint;
 import android.os.Build;
+import android.os.Environment;
 import android.support.annotation.RequiresApi;
 import android.util.Log;
 
@@ -44,6 +45,36 @@ public class MyLog {
     private static boolean isDebug = true;        //普通log的开关
     private static String TAG = "英唐" + "-----------";
 
+    private static volatile MyLog myLog; // 使用 volatile 关键字确保多线程环境下的可见性
+
+    private MyLog() {
+    }
+
+    public static MyLog getInstance() {
+        if (myLog == null) { // 第一次检查,提高效率,避免每次都进行同步
+            synchronized (MyLog.class) { // 同步代码块,保证线程安全
+                if (myLog == null) { // 第二次检查,防止多个线程同时进入同步块时重复创建实例
+                    myLog = new MyLog();
+                    //兼容不同版本分区处理
+                    File downloadDir = null;
+                    if (Build.VERSION.SDK_INT >= 29) {
+                        // Android 10+ 使用私有目录
+                        downloadDir = PdaApplication.getmContext().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
+                    } else {
+                        downloadDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
+                    }
+                    if (!downloadDir.exists()) {
+                        downloadDir.mkdirs();
+                    }
+                    MYLOG_PATH_SDCARD_DIR1 = downloadDir.getAbsolutePath() + File.separator + PdaApplication.getmContext().getPackageName();
+
+                    //Log.e("aaa", "MyLog被创建了: " + MYLOG_PATH_SDCARD_DIR1);
+                }
+            }
+        }
+        return myLog;
+    }
+
     public static void e(String msg) {
         if (isDebug) {
             Log.e(TAG, msg);

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

@@ -72,4 +72,5 @@
         android:layout_marginTop="10dp"
         android:numColumns="3"
         android:padding="16dp" />
+
 </LinearLayout>

+ 4 - 4
app/src/main/res/layout/fragment_scmake_smtcontent.xml

@@ -35,7 +35,7 @@
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:textSize="@dimen/textsize_16"
-            tools:text="LINE01" />
+            tools:text="线别" />
     </LinearLayout>
 
     <LinearLayout
@@ -51,7 +51,7 @@
             android:layout_marginRight="5dp"
             android:layout_weight="1"
             android:textSize="@dimen/textsize_16"
-            tools:text="A面" />
+            tools:text="板面:A面" />
 
         <TextView
             android:id="@+id/smt_content_macode_tv"
@@ -60,7 +60,7 @@
             android:layout_marginRight="5dp"
             android:layout_weight="1"
             android:textSize="@dimen/textsize_16"
-            tools:text="BZMB15232832" />
+            tools:text="工单号:BZMB15232832" />
 
         <TextView
             android:id="@+id/smt_content_prodcode_tv"
@@ -68,7 +68,7 @@
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:textSize="@dimen/textsize_16"
-            tools:text="SDIE2423" />
+            tools:text="产品编号:SDIE2423" />
     </LinearLayout>
 
     <View style="@style/view_gray_line" />

+ 2 - 2
build.gradle

@@ -50,8 +50,8 @@ ext {
             targetSdkVersion : 28,
             compileSdkVersion: 28,
             buildToolsVersion: "28.0.3",
-            versionCode      : 11,
-            versionName      : "v1.1.1"
+            versionCode      : 17,
+            versionName      : "v1.1.6"
     ]
 
     depsVersion = [