소스 검색

SMT需求调整

RaoMeng 5 년 전
부모
커밋
2a5ef647a5

+ 9 - 0
app/src/main/java/com/uas/uaspda/bean/SmtDslBean.java

@@ -14,6 +14,8 @@ public class SmtDslBean {
     String dsl_barcode;
     @JSONField(name = "dsl_repcode")
     String dsl_repcode;
+    @JSONField(name = "dsl_fecode")
+    String dsl_fecode;
 
     public String getDsl_repcode() {
         return dsl_repcode;
@@ -47,4 +49,11 @@ public class SmtDslBean {
         this.dsl_barcode = dsl_barcode;
     }
 
+    public String getDsl_fecode() {
+        return dsl_fecode;
+    }
+
+    public void setDsl_fecode(String dsl_fecode) {
+        this.dsl_fecode = dsl_fecode;
+    }
 }

+ 149 - 0
app/src/main/java/com/uas/uaspda/fragment/SCSMTBindFragment.java

@@ -0,0 +1,149 @@
+package com.uas.uaspda.fragment;
+
+import android.text.TextUtils;
+import android.view.KeyEvent;
+import android.widget.TextView;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.android.volley.Request;
+import com.uas.uaspda.R;
+import com.uas.uaspda.application.PdaApplication;
+import com.uas.uaspda.bean.LineInfoBean;
+import com.uas.uaspda.global.GloableParams;
+import com.uas.uaspda.listener.MyEditorActionListener;
+import com.uas.uaspda.tools.SharedPreUtil;
+import com.uas.uaspda.util.CommonUtil;
+import com.uas.uaspda.util.Constants;
+import com.uas.uaspda.util.FastjsonUtil;
+import com.uas.uaspda.util.HttpCallback;
+import com.uas.uaspda.util.HttpParams;
+import com.uas.uaspda.util.VolleyRequest;
+import com.uas.uaspda.view.ClearableEditText;
+
+/**
+ * SMT飞达料盘绑定子页面
+ * modify:2017-05-15
+ */
+public class SCSMTBindFragment extends BaseFragment {
+    private TextView mLinecodeTv;
+    private TextView mTableTv;
+    private TextView mMacodeTv;
+    private ClearableEditText mFeederEt;
+    private ClearableEditText mMaterialEt;
+    private TextView mResultTv;
+    private LineInfoBean mLineInfoBean;
+    private String mSmtLocationCache;
+
+    @Override
+    protected int getLayout() {
+        return R.layout.fragment_scmake_smtfeeder_bind;
+    }
+
+    @Override
+    protected void initViews() {
+        setTitle("飞达料盘绑定");
+
+        mLinecodeTv = (TextView) root.findViewById(R.id.smt_feeding_bind_linecode_tv);
+        mTableTv = (TextView) root.findViewById(R.id.smt_feeding_bind_table_tv);
+        mMacodeTv = (TextView) root.findViewById(R.id.smt_feeding_bind_macode_tv);
+        mFeederEt = (ClearableEditText) root.findViewById(R.id.smt_feeding_bind_feeder_et);
+        mMaterialEt = (ClearableEditText) root.findViewById(R.id.smt_feeding_bind_material_et);
+        mResultTv = (TextView) root.findViewById(R.id.smt_feeding_bind_result_tv);
+
+        mLineInfoBean = (LineInfoBean) PdaApplication.getDataCacheFromMap(Constants.FLAG.SMT_DEVICE_LINE_CACHE);
+        mSmtLocationCache = SharedPreUtil.getString(mActivity, Constants.FLAG.SMT_LOCATION_CACHE, null);
+    }
+
+    @Override
+    protected void initEvents() {
+        CommonUtil.setEditorActionListener(mFeederEt, new MyEditorActionListener() {
+            @Override
+            public void MyEditorAction(String text, int actionId, KeyEvent event) {
+                mMaterialEt.requestFocus();
+            }
+        });
+
+        CommonUtil.setEditorActionListener(mMaterialEt, new MyEditorActionListener() {
+            @Override
+            public void MyEditorAction(String text, int actionId, KeyEvent event) {
+                bindMaterial();
+            }
+        });
+    }
+
+    private void bindMaterial() {
+        String feeder = mFeederEt.getText().toString().trim();
+        String material = mMaterialEt.getText().toString().trim();
+        if (TextUtils.isEmpty(feeder)) {
+            CommonUtil.toastNoRepeat(mActivity, "请采集飞达");
+            return;
+        }
+        if (TextUtils.isEmpty(material)) {
+            CommonUtil.toastNoRepeat(mActivity, "请采集料盘");
+            return;
+        }
+        mResultTv.setText("");
+        progressDialog.show();
+        VolleyRequest.getInstance()
+                .stringRequest(new HttpParams.Builder()
+                        .url(GloableParams.ADDRESS_SMT_BINDFEEDERBARCODE)
+                        .method(Request.Method.POST)
+                        .addParam("fe_code", feeder)
+                        .addParam("barcode", material)
+                        .build(), new HttpCallback() {
+                    @Override
+                    public void onSuccess(int flag, Object o) throws Exception {
+                        progressDialog.dismiss();
+                        try {
+                            String result = o.toString();
+                            JSONObject resultObject = JSON.parseObject(result);
+                            JSONObject dataObject = resultObject.getJSONObject("data");
+                            mResultTv.setTextColor(getResources().getColor(R.color.green));
+                            mResultTv.setText(
+                                    "飞达:" + FastjsonUtil.getText(dataObject, "fe_code")
+                                            + "  绑定料盘:" + FastjsonUtil.getText(dataObject, "barcode") + "成功");
+                            mFeederEt.setText("");
+                            mMaterialEt.setText("");
+                            mFeederEt.requestFocus();
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+
+                    }
+
+                    @Override
+                    public void onFail(int flag, String failStr) throws Exception {
+                        progressDialog.dismiss();
+                        CommonUtil.toastNoRepeat(mActivity, failStr);
+                        mResultTv.setTextColor(getResources().getColor(R.color.red));
+                        mResultTv.setText(failStr);
+                        mFeederEt.setText("");
+                        mMaterialEt.setText("");
+                        mFeederEt.requestFocus();
+                    }
+                });
+    }
+
+    @Override
+    protected void initDatas() {
+        if (mLineInfoBean != null) {
+            mLinecodeTv.setText(mLineInfoBean.getDL_LINECODE());
+            mTableTv.setText(mLineInfoBean.getDL_TABLE() + "面");
+            mMacodeTv.setText(mLineInfoBean.getDL_MACODE());
+        }
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        return false;
+    }
+
+    @Override
+    public boolean onFragmentBackPressed() {
+        return false;
+    }
+}
+
+
+

+ 77 - 17
app/src/main/java/com/uas/uaspda/fragment/SCSMTChangeFragment.java

@@ -30,7 +30,11 @@ import com.uas.uaspda.tools.SharedPreUtil;
 import com.uas.uaspda.tools.VolleyUtil;
 import com.uas.uaspda.util.CommonUtil;
 import com.uas.uaspda.util.Constants;
+import com.uas.uaspda.util.FastjsonUtil;
+import com.uas.uaspda.util.HttpCallback;
+import com.uas.uaspda.util.HttpParams;
 import com.uas.uaspda.util.JsonUtils;
+import com.uas.uaspda.util.VolleyRequest;
 import com.uas.uaspda.view.ClearableEditText;
 import com.uas.uaspda.view.TextViewWithButton;
 
@@ -46,7 +50,7 @@ import java.util.Map;
  */
 public class SCSMTChangeFragment extends BaseFragment implements TextViewWithButton.TvHintHelper, View.OnClickListener {
     JSONObject makeCraft;
-    TextViewWithButton tvLocation, tvBarcode, tvRemainqty, mLocationTextView;
+    TextViewWithButton tvLocation, tvBarcode, tvRemainqty, mLocationTextView, mFeederTextView;
     TextView tvMsgNotice, tvMsgLocation, tvMsgProdcode, tvMsgBarcode, tvMsgQuantity, tvMsgSpec;
     RelativeLayout rlCollect;
     int wrongColor, rightColor;
@@ -62,6 +66,8 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
     private String mSmtLocationCache;
     private SmtDslBean mSmtDslBean = new SmtDslBean();
     private StringRequest mStringRequest;
+    private TextViewWithButton.OnTextClearListener mLocationClearListener;
+    private TextViewWithButton.OnTextClearListener mFeederClearListener;
 
     @Override
     protected int getLayout() {
@@ -88,10 +94,11 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
         mMacodeTextView = (TextView) root.findViewById(R.id.smt_change_macode_tv);
         mLocationTextView = (TextViewWithButton) root.findViewById(R.id.smt_change_location_tv);
         mCollectEditText = (ClearableEditText) root.findViewById(R.id.smt_change_collect_et);
+        mFeederTextView = root.findViewById(R.id.smt_change_feeder_tv);
 
         mCollectEditText.requestFocus();
 
-        mCollectEditText.setHint("请采集换料站位");
+        mCollectEditText.setHint("请采集飞达编号");
         wrongColor = getResources().getColor(R.color.text_error);
         rightColor = getResources().getColor(R.color.green);
 
@@ -143,26 +150,37 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
             }
         });
 
-        mLocationTextView.setOnTextClearListener(new TextViewWithButton.OnTextClearListener() {
+        mFeederClearListener = new TextViewWithButton.OnTextClearListener() {
             @Override
             public void onTextClear() {
-                mCollectEditText.setHint("请采集换料站位");
+                mLocationTextView.setOnTextClearListener(null);
+                mLocationTextView.setText("");
+                mLocationTextView.setOnTextClearListener(mLocationClearListener);
+                mCollectEditText.setHint("请采集飞达编号");
                 mCollectEditText.setText("");
+            }
+        };
 
-//                tvMsgNotice.setText("");
-//                tvMsgProdcode.setText("");
-//                tvMsgLocation.setText("");
-//                tvMsgBarcode.setText("");
-//                tvMsgQuantity.setText("");
-//                tvMsgSpec.setText("");
+        mLocationClearListener = new TextViewWithButton.OnTextClearListener() {
+            @Override
+            public void onTextClear() {
+                mFeederTextView.setOnTextClearListener(null);
+                mFeederTextView.setText("");
+                mFeederTextView.setOnTextClearListener(mFeederClearListener);
+                mCollectEditText.setHint("请采集飞达编号");
+                mCollectEditText.setText("");
             }
-        });
+        };
+
+        mLocationTextView.setOnTextClearListener(mLocationClearListener);
+
+        mFeederTextView.setOnTextClearListener(mFeederClearListener);
     }
 
     private void confirmEvent(String collect) {
         String location = mLocationTextView.getText().toString().trim();
         if (TextUtils.isEmpty(location)) {
-            locationCheck(collect);
+            feederGetLocation(collect);
         } else {
             mSmtDslBean.setDsl_barcode(collect);
             //接料操作
@@ -170,7 +188,48 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
         }
     }
 
-    private void locationCheck(String collect) {
+    private void feederGetLocation(String collect) {
+        progressDialog.show();
+        VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
+                .url(GloableParams.ADDRESS_SMT_GETFEEDERBARCODE)
+                .method(Request.Method.POST)
+                .addParam("fe_code", 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 dataObject = resultObject.getJSONObject("data");
+                    if (dataObject != null) {
+                        String fe_code = FastjsonUtil.getText(dataObject, "fe_code");
+                        String fe_location = FastjsonUtil.getText(dataObject, "fe_location");
+
+                        locationCheck(fe_location, fe_code);
+                    } else {
+                        tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+                        tvMsgNotice.setText("数据为空");
+                        CommonUtil.makeNotice();
+                        mCollectEditText.setText("");
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+
+            @Override
+            public void onFail(int flag, String failStr) throws Exception {
+                progressDialog.dismiss();
+                tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+                tvMsgNotice.setText(failStr);
+                CommonUtil.makeNotice();
+                mCollectEditText.setText("");
+            }
+        });
+    }
+
+    private void locationCheck(String collect, String feeder) {
         tvMsgProdcode.setText("");
         tvMsgLocation.setText("");
         tvMsgBarcode.setText("");
@@ -187,6 +246,7 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
                     if (collect.equals(JsonUtils.optStringNotNull(locationObject, "PSL_LOCATION"))) {
                         isExist = true;
                         mLocationTextView.setText(collect);
+                        mFeederTextView.setText(feeder);
                         mCollectEditText.setText("");
 
                         String psl_prodcode = JsonUtils.optStringNotNull(locationObject, "PSL_PRODCODE");
@@ -200,7 +260,7 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
 //                                    tvMsgNotice.setText("站位采集成功,请采集首选料[" + psl_prodcode + "]的料卷编号");
 //                                else
                             String[] repcodes = psl_repcode.split(",");
-                            String notice = "站位采集成功,请采集物料\n";
+                            String notice = "飞达采集成功,请采集物料\n";
                             for (int j = 0; j < repcodes.length; j++) {
                                 String repcode = repcodes[j];
                                 notice = notice + repcode + "\n";
@@ -210,10 +270,10 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
                             tvMsgNotice.setText(notice);
                         } else if (!TextUtils.isEmpty(psl_prodcode)) {
                             tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                            tvMsgNotice.setText("站位采集成功,请采集物料\n" + psl_prodcode + "\n的料卷编号/物料编号");
+                            tvMsgNotice.setText("飞达采集成功,请采集物料\n" + psl_prodcode + "\n的料卷编号/物料编号");
                         } else {
                             tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                            tvMsgNotice.setText("站位采集成功,物料编号获取失败");
+                            tvMsgNotice.setText("飞达采集成功,物料编号获取失败");
                         }
                     }
                 }
@@ -270,7 +330,7 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
                                 mCollectEditText.setText("");
 
                                 mSmtDslBean = new SmtDslBean();
-                                mCollectEditText.setHint("请采集换料站位");
+                                mCollectEditText.setHint("请采集飞达编号");
                             }
                         } catch (JSONException e) {
                             e.printStackTrace();

+ 5 - 0
app/src/main/java/com/uas/uaspda/fragment/SCSMTDownFragment.java

@@ -9,6 +9,7 @@ import android.view.View;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.Button;
+import android.widget.CheckBox;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -56,6 +57,7 @@ public class SCSMTDownFragment extends BaseFragment implements View.OnClickListe
 
     private TextView mLinecodeTextView, mTableTextView, mMacodeTextView;
     private ClearableEditText mCollectEditText;
+    private CheckBox mUnbindCheckBox;
     private StringRequest mStringRequest;
     private MostListView mMostListView;
     private SmtDownResultAdapter mSmtDownResultAdapter;
@@ -79,6 +81,7 @@ public class SCSMTDownFragment extends BaseFragment implements View.OnClickListe
         tvMsgBarcode = (TextView) root.findViewById(R.id.tv_innernotice_3_scmake);
         tvMsgQuantity = (TextView) root.findViewById(R.id.tv_innernotice_4_scmake);
         tvMsgSpec = (TextView) root.findViewById(R.id.tv_innernotice_5_scmake);
+        mUnbindCheckBox = root.findViewById(R.id.smt_down_material_unbind_cb);
         mResultLinearLayout = (LinearLayout) root.findViewById(R.id.smt_down_material_result_ll);
 
         mResultLinearLayout.setVisibility(View.GONE);
@@ -138,6 +141,7 @@ public class SCSMTDownFragment extends BaseFragment implements View.OnClickListe
 
     /**
      * smt下料
+     *
      * @param collect 采集的物料号
      */
     private void downMaterial(final String collect) {
@@ -219,6 +223,7 @@ public class SCSMTDownFragment extends BaseFragment implements View.OnClickListe
                 Map<String, String> params = new HashMap<String, String>();
                 params.put("code", collect);
                 params.put("deviceLineMake", finalDeviceLineMake);
+                params.put("Untying", mUnbindCheckBox.isChecked() ? "-1" : "0");
                 return params;
             }
 

+ 4 - 3
app/src/main/java/com/uas/uaspda/fragment/SCSMTInFragment.java

@@ -188,7 +188,7 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
                     feedLoading();
                 }
             } else {*/
-            mSmtDslBean.setDsl_barcode(collect);
+            mSmtDslBean.setDsl_fecode(collect);
             feedLoading();
 //            }
         }
@@ -196,6 +196,7 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
 
     /**
      * 站位本地校验
+     *
      * @param collect 采集框采集内容
      */
     private void locationCheck(String collect) {
@@ -221,7 +222,7 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
                         mSmtDslBean = new SmtDslBean();
                         mSmtDslBean.setDsl_location(collect);
                         mSmtDslBean.setDsl_prodcode(psl_prodcode);
-                        mCollectEditText.setHint("请录入料卷编号/物料编号");
+                        mCollectEditText.setHint("请录入飞达编号");
                         if (!TextUtils.isEmpty(psl_repcode)) {
 //                                if (TextUtils.isEmpty(psl_repcode) || "null".equals(psl_repcode))
 //                                    tvMsgNotice.setText("站位采集成功,请采集首选料[" + psl_prodcode + "]的料卷编号");
@@ -237,7 +238,7 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
                             tvMsgNotice.setText(notice);
                         } else if (!TextUtils.isEmpty(psl_prodcode)) {
                             tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
-                            tvMsgNotice.setText("站位采集成功,请采集物料\n" + psl_prodcode + "\n的料卷编号/物料编号");
+                            tvMsgNotice.setText("站位采集成功,请采集物料\n" + psl_prodcode + "\n的飞达编号");
                         } else {
                             tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
                             tvMsgNotice.setText("站位采集成功,物料编号获取失败");

+ 16 - 21
app/src/main/java/com/uas/uaspda/fragment/SCSMTIndexFragment.java

@@ -290,6 +290,10 @@ public class SCSMTIndexFragment extends BaseFragment implements AdapterView.OnIt
                         fragment = new SMTPreMaterialQueryFragment();
                         FragmentUtils.switchFragment(this, fragment);
                         break;
+                    case GloableParams.LISTNAME_FEEDER_BIND:
+                        fragment = new SCSMTBindFragment();
+                        FragmentUtils.switchFragment(this, fragment);
+                        break;
                 }
             }
 
@@ -618,7 +622,6 @@ public class SCSMTIndexFragment extends BaseFragment implements AdapterView.OnIt
             @Override
             public void onClick(View v) {
                 verificationPassword(whichFunc);
-
             }
         });
 
@@ -1111,6 +1114,8 @@ public class SCSMTIndexFragment extends BaseFragment implements AdapterView.OnIt
      */
     private void showConfirmAllDownDialog() {
         final ClearableEditText quantityEditText = (ClearableEditText) downAllView.findViewById(R.id.pop_smt_down_all_et);
+        CheckBox unbindCheckBox = downAllView.findViewById(R.id.pop_smt_down_unbind_cb);
+        unbindCheckBox.setChecked(false);
         final TextView mConfirmTextView = (TextView) downAllView.findViewById(R.id.pop_smt_down_all_confirm_tv);
         TextView mCancelTextView = (TextView) downAllView.findViewById(R.id.pop_smt_down_all_cancel_tv);
 
@@ -1145,7 +1150,7 @@ public class SCSMTIndexFragment extends BaseFragment implements AdapterView.OnIt
                 try {
                     int quantity = (int) Long.parseLong(quantityStr);
                     if (quantity >= dl_madeqty && quantity <= ma_qty) {
-                        disposeAllDown(quantity);
+                        disposeAllDown(quantity, unbindCheckBox.isChecked());
                     } else {
                         CommonUtil.toastNoRepeat(mActivity, "数量必须介于产出数和工单数之间");
                         CommonUtil.makeNotice();
@@ -1183,31 +1188,21 @@ public class SCSMTIndexFragment extends BaseFragment implements AdapterView.OnIt
     }
 
     //全部下料
-    private void disposeAllDown(int quantity) {
+    private void disposeAllDown(int quantity, boolean unbind) {
         showLoadingView();
-        VolleyUtil.getVolleyUtil().requestSMTAllDown(getActivity(), GloableParams.ADDRESS_SMT_CUTTING_ALLSTOCK, VolleyUtil.METHOD_POST,
-                VolleyUtil.FRAGMENT_SCMAKE_SMTALLDOWN, mLineInfoBean.getDL_MACODE(), mLineInfoBean.getDL_LINECODE(), quantity);
+        VolleyUtil.getVolleyUtil().requestSMTAllDown(getActivity(),
+                GloableParams.ADDRESS_SMT_CUTTING_ALLSTOCK,
+                VolleyUtil.METHOD_POST,
+                VolleyUtil.FRAGMENT_SCMAKE_SMTALLDOWN,
+                mLineInfoBean.getDL_MACODE(),
+                mLineInfoBean.getDL_LINECODE(),
+                quantity,
+                unbind);
     }
 
     /*======================ConfirmDialog==========================================*/
     ConfirmDialog confirmDialog;
     boolean isOk = false;
-    //导入确认:对话框交互Handler,判断用户选择的是确定还是取消
-    Handler alldownHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            isOk = (boolean) msg.obj;
-            //如果点击确认
-            if (isOk) {
-                //如果确认全部下料
-                disposeAllDown(0);
-                closeConfirmDialog();
-                return;
-            }
-            //如果取消
-            closeConfirmDialog();
-        }
-    };
 
     //关闭确认对话框
     public void closeConfirmDialog() {

+ 80 - 15
app/src/main/java/com/uas/uaspda/fragment/SCSMTJointFragment.java

@@ -31,7 +31,11 @@ import com.uas.uaspda.tools.SharedPreUtil;
 import com.uas.uaspda.tools.VolleyUtil;
 import com.uas.uaspda.util.CommonUtil;
 import com.uas.uaspda.util.Constants;
+import com.uas.uaspda.util.FastjsonUtil;
+import com.uas.uaspda.util.HttpCallback;
+import com.uas.uaspda.util.HttpParams;
 import com.uas.uaspda.util.JsonUtils;
+import com.uas.uaspda.util.VolleyRequest;
 import com.uas.uaspda.view.ClearableEditText;
 import com.uas.uaspda.view.TextViewWithButton;
 
@@ -47,12 +51,12 @@ import java.util.Map;
  * @note:SMTChild接料操作
  */
 public class SCSMTJointFragment extends BaseFragment implements View.OnClickListener, TextViewWithButton.TvHintHelper {
-    private static final String COLLECT_LOCATION = "请录入站位编号";
-    private static final String COLLECT_PRODCODE = "请录入料卷编号/物料编号";
-    private static final String COLLECT_OLD_PRODCODE = "站位采集成功,请采集原物料号";
+    private static final String COLLECT_FEEDER = "请采集飞达编号";
+    private static final String COLLECT_PRODCODE = "请采集料卷编号/物料编号";
+    private static final String COLLECT_OLD_PRODCODE = "飞达采集成功,请采集原物料号";
 
     JSONObject makeCraft;
-    TextViewWithButton tvLocation, tvBarcode, tvRemainqty, mLocationTextView;
+    TextViewWithButton tvLocation, tvBarcode, tvRemainqty, mLocationTextView, mFeederTextView;
     TextView tvMsgNotice, tvMsgLocation, tvMsgProdcode, tvMsgQuantity, tvMsgBarcode, tvMsgSpec;
     RelativeLayout rlCollect;
     int wrongColor, rightColor;
@@ -67,6 +71,8 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
     private String mSmtLocationCache;
     private SmtDslBean mSmtDslBean = new SmtDslBean();
     private StringRequest mStringRequest;
+    private TextViewWithButton.OnTextClearListener mLocationClearListener;
+    private TextViewWithButton.OnTextClearListener mFeederClearListener;
 
     @Override
     protected int getLayout() {
@@ -94,6 +100,7 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
         mTableTextView = (TextView) root.findViewById(R.id.smt_change_table_tv);
         mMacodeTextView = (TextView) root.findViewById(R.id.smt_change_macode_tv);
         mLocationTextView = (TextViewWithButton) root.findViewById(R.id.smt_change_location_tv);
+        mFeederTextView = root.findViewById(R.id.smt_change_feeder_tv);
         mCollectEditText = (ClearableEditText) root.findViewById(R.id.smt_change_collect_et);
 
         mCollectEditText.requestFocus();
@@ -148,26 +155,38 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
             }
         });
 
-        mLocationTextView.setOnTextClearListener(new TextViewWithButton.OnTextClearListener() {
+
+        mFeederClearListener = new TextViewWithButton.OnTextClearListener() {
             @Override
             public void onTextClear() {
-                mCollectEditText.setHint(COLLECT_LOCATION);
+                mLocationTextView.setOnTextClearListener(null);
+                mLocationTextView.setText("");
+                mLocationTextView.setOnTextClearListener(mLocationClearListener);
+                mCollectEditText.setHint(COLLECT_FEEDER);
                 mCollectEditText.setText("");
+            }
+        };
 
-//                tvMsgNotice.setText("");
-//                tvMsgProdcode.setText("");
-//                tvMsgLocation.setText("");
-//                tvMsgBarcode.setText("");
-//                tvMsgQuantity.setText("");
-//                tvMsgSpec.setText("");
+        mLocationClearListener = new TextViewWithButton.OnTextClearListener() {
+            @Override
+            public void onTextClear() {
+                mFeederTextView.setOnTextClearListener(null);
+                mFeederTextView.setText("");
+                mFeederTextView.setOnTextClearListener(mFeederClearListener);
+                mCollectEditText.setHint(COLLECT_FEEDER);
+                mCollectEditText.setText("");
             }
-        });
+        };
+
+        mLocationTextView.setOnTextClearListener(mLocationClearListener);
+
+        mFeederTextView.setOnTextClearListener(mFeederClearListener);
     }
 
     private void confirmEvent(String collect) {
         String location = mLocationTextView.getText().toString().trim();
         if (TextUtils.isEmpty(location)) {
-            locationCheck(collect);
+            feederGetLocation(collect);
         } else {
             mSmtDslBean.setDsl_barcode(collect);
 
@@ -180,7 +199,50 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
         }
     }
 
-    private void locationCheck(String collect) {
+
+    private void feederGetLocation(String collect) {
+        progressDialog.show();
+        VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
+                .url(GloableParams.ADDRESS_SMT_GETFEEDERBARCODE)
+                .method(Request.Method.POST)
+                .addParam("fe_code", 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 dataObject = resultObject.getJSONObject("data");
+                    if (dataObject != null) {
+                        String fe_code = FastjsonUtil.getText(dataObject, "fe_code");
+                        String fe_location = FastjsonUtil.getText(dataObject, "fe_location");
+
+                        locationCheck(fe_location, fe_code);
+                    } else {
+                        tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+                        tvMsgNotice.setText("数据为空");
+                        CommonUtil.makeNotice();
+                        mCollectEditText.setText("");
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+
+            @Override
+            public void onFail(int flag, String failStr) throws Exception {
+                progressDialog.dismiss();
+                tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
+                tvMsgNotice.setText(failStr);
+                CommonUtil.makeNotice();
+                mCollectEditText.setText("");
+            }
+        });
+    }
+
+
+    private void locationCheck(String collect, String feeder) {
         tvMsgProdcode.setText("");
         tvMsgLocation.setText("");
         tvMsgBarcode.setText("");
@@ -196,6 +258,7 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
                     if (collect.equals(JsonUtils.optStringNotNull(locationObject, "PSL_LOCATION"))) {
                         isExist = true;
                         mLocationTextView.setText(collect);
+                        mFeederTextView.setText(feeder);
                         mCollectEditText.setText("");
 
                         String psl_prodcode = JsonUtils.optStringNotNull(locationObject, "PSL_PRODCODE");
@@ -482,6 +545,7 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
                                 tvMsgSpec.setText("飞达规格:" + JsonUtils.optStringNotNull(dataObject, "DSL_FESPEC"));
 
                                 mLocationTextView.setText("");
+                                mFeederTextView.setText("");
                                 mCollectEditText.setText("");
 
                                 mSmtDslBean = new SmtDslBean();
@@ -503,6 +567,7 @@ public class SCSMTJointFragment extends BaseFragment implements View.OnClickList
                             tvMsgNotice.setText(errorToast);
                             if (errorToast.contains("站位已经有在线料卷号")) {
                                 mLocationTextView.setText("");
+                                mFeederTextView.setText("");
                                 mCollectEditText.setText("");
                             } else {
                                 mCollectEditText.setText("");

+ 14 - 2
app/src/main/java/com/uas/uaspda/global/GloableParams.java

@@ -212,6 +212,9 @@ public class GloableParams {
     public static String ADDRESS_SMT_PREBARCODEGETLOCATION;
     public static String ADDRESS_INMATERIAL_GETBARACCEPTCODE;
     public static String ADDRESS_INMATERIAL_SAVEBARACCEPTCODE;
+    public static String ADDRESS_SMT_BINDFEEDERBARCODE;
+    public static String ADDRESS_SMT_GETFEEDERBARCODE;
+
 
     //连接服务器请求地址
     private static final String ADDRESSTAIL_CONNECT_SERVER = "/api/pda/getAllMasters.action";
@@ -362,6 +365,11 @@ public class GloableParams {
     //->SMT 备料查询
     private static final String ADDRESSTAIL_SMT_PREBARCODEGETLOCATION = "/api/pda/smt/prebarcodeGetLocation.action";
 
+    //->SMT 飞达料盘绑定
+    private static final String ADDRESSTAIL_SMT_BINDFEEDERBARCODE = "/api/pda/smt/bindFeederBarcode.action";
+    //SMT 通过飞达,获取站位
+    private static final String ADDRESSTAIL_SMT_GETFEEDERBARCODE = "/api/pda/smt/getFeederLocation.action";
+
     //->SMT共用请求
     //SMT-child上料/接料/换料:获取详细信息
     private static final String ADDRESSTAIL_SMT_GET_SMT_LOCATION = "/api/pda/smt/getSmtLocation.action";
@@ -661,17 +669,19 @@ public class GloableParams {
     public static final String LISTNAME_REQUEST_MACHINE = "叫料";
     public static final String LISTNAME_LOCATION_QUERY = "站位反查";
     public static final String LISTNAME_PREMATERIAL_QUERY = "备料查询";
+    public static final String LISTNAME_FEEDER_BIND = "飞达料盘绑定";
 
     public static final String[] feederListNames = {LISTNAME_FEEDER_IN, LISTNAME_FEEDER_JOIN, LISTNAME_FEEDER_CHANGE, LISTNAME_FEEDER_DOWN,
             LISTNAME_FEEDER_DOWNALL, LISTNAME_FEEDER_QUERY, LISTNAME_FEEDER_SWITCH,
             LISTNAME_FEEDER_CHECK, LISTNAME_FEEDER_MACHINE, LISTNAME_REQUEST_MACHINE,
-            LISTNAME_LOCATION_QUERY, LISTNAME_PREMATERIAL_QUERY};
+            LISTNAME_LOCATION_QUERY, LISTNAME_PREMATERIAL_QUERY, LISTNAME_FEEDER_BIND};
     public static final int[] feederListImgs = {R.drawable.index_smt_up, R.drawable.index_smt_joint,
             R.drawable.index_smt_change, R.drawable.index_smt_down,
             R.drawable.index_smt_downall, R.drawable.index_smt_query,
             R.drawable.index_smt_switch, R.drawable.index_smt_check,
             R.drawable.index_smt_machine, R.drawable.index_smt_request,
-            R.drawable.index_location_query, R.drawable.index_prematerial_query};
+            R.drawable.index_location_query, R.drawable.index_prematerial_query,
+            R.drawable.index_prematerial_query};
 
     //-->入库管理
     public static final String MENU_STORAGE_RECHARGE = "收料";
@@ -937,5 +947,7 @@ public class GloableParams {
         GloableParams.ADDRESS_SMT_PREBARCODEGETLOCATION = uriHead + GloableParams.ADDRESSTAIL_SMT_PREBARCODEGETLOCATION;
         GloableParams.ADDRESS_INMATERIAL_GETBARACCEPTCODE = uriHead + GloableParams.ADDRESSTAIL_INMATERIAL_GETBARACCEPTCODE;
         GloableParams.ADDRESS_INMATERIAL_SAVEBARACCEPTCODE = uriHead + GloableParams.ADDRESSTAIL_INMATERIAL_SAVEBARACCEPTCODE;
+        GloableParams.ADDRESS_SMT_BINDFEEDERBARCODE = uriHead + GloableParams.ADDRESSTAIL_SMT_BINDFEEDERBARCODE;
+        GloableParams.ADDRESS_SMT_GETFEEDERBARCODE = uriHead + GloableParams.ADDRESSTAIL_SMT_GETFEEDERBARCODE;
     }
 }

+ 9 - 1
app/src/main/java/com/uas/uaspda/tools/VolleyUtil.java

@@ -393,7 +393,14 @@ public class VolleyUtil {
     /**
      * @注释:SMT:全部下料
      */
-    public void requestSMTAllDown(Context pContext, String pUrl, int method, int pRequestType, final String dlMacode, final String dlLinecode, final int quantity) {
+    public void requestSMTAllDown(Context pContext,
+                                  String pUrl,
+                                  int method,
+                                  int pRequestType,
+                                  final String dlMacode,
+                                  final String dlLinecode,
+                                  final int quantity,
+                                  boolean unbind) {
         getVolleyUtil();
         context = pContext;
         requestType = pRequestType;
@@ -411,6 +418,7 @@ public class VolleyUtil {
                     map.put("dl_macode", "" + dlMacode);
                     map.put("dl_linecode", "" + dlLinecode);
                     map.put("dl_madeqty", "" + quantity);
+                    map.put("Untying", unbind ? "-1" : "0");
                     return map;
                 }
             };

+ 3 - 3
app/src/main/java/com/uas/uaspda/view/TextViewWithButton.java

@@ -137,9 +137,9 @@ public class TextViewWithButton extends AppCompatTextView implements View.OnTouc
     @Override
     public void beforeTextChanged(CharSequence s, int start, int count, int after) {
         setClearIconVisible(s.length() > 0);
-        if (onTextClearListener != null && (s == null || s.length() == 0)) {
-            onTextClearListener.onTextClear();
-        }
+//        if (onTextClearListener != null && (s == null || s.length() == 0)) {
+//            onTextClearListener.onTextClear();
+//        }
     }
 
     @Override

+ 123 - 0
app/src/main/res/layout/fragment_scmake_smtfeeder_bind.xml

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?><!--SMTChild上料界面模板-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="10dp"
+        android:padding="10dp">
+
+        <TextView
+            android:id="@+id/smt_feeding_bind_linecode_tv"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:gravity="center_vertical"
+            android:textSize="@dimen/textsize_16"
+            tools:text="LINE01" />
+
+        <TextView
+            android:id="@+id/smt_feeding_bind_table_tv"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_marginLeft="10dp"
+            android:layout_weight="1"
+            android:gravity="center_vertical"
+            android:textSize="@dimen/textsize_16"
+            tools:text="A面" />
+
+        <TextView
+            android:id="@+id/smt_feeding_bind_macode_tv"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_marginLeft="10dp"
+            android:layout_weight="2"
+            android:gravity="center_vertical"
+            android:textSize="@dimen/textsize_16"
+            tools:text="BZBD23083333333ddddddd9" />
+    </LinearLayout>
+
+    <View style="@style/view_gray_line" />
+
+    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dp">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical">
+
+            <TableLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:stretchColumns="1">
+
+                <TableRow android:background="@color/white">
+
+                    <TextView
+                        style="@style/tl_tv_style"
+                        android:layout_height="match_parent"
+                        android:gravity="center"
+                        android:paddingLeft="20dp"
+                        android:paddingRight="20dp"
+                        android:text="飞达"
+                        android:textColor="@color/body_text_1"
+                        android:textSize="16sp" />
+
+                    <com.uas.uaspda.view.ClearableEditText
+                        android:id="@+id/smt_feeding_bind_feeder_et"
+                        style="@style/EditTextLineStyle"
+                        android:layout_width="0dp"
+                        android:layout_marginRight="16dp"
+                        android:layout_weight="1"
+                        android:hint="请采集飞达"
+                        android:imeOptions="actionUnspecified" />
+                </TableRow>
+
+                <TableRow
+                    android:layout_marginTop="5dp"
+                    android:background="@color/white">
+
+                    <TextView
+                        style="@style/tl_tv_style"
+                        android:layout_height="match_parent"
+                        android:gravity="center"
+                        android:paddingLeft="20dp"
+                        android:paddingRight="20dp"
+                        android:text="料盘"
+                        android:textColor="@color/body_text_1"
+                        android:textSize="16sp" />
+
+                    <com.uas.uaspda.view.ClearableEditText
+                        android:id="@+id/smt_feeding_bind_material_et"
+                        style="@style/EditTextLineStyle"
+                        android:layout_width="0dp"
+                        android:layout_marginRight="16dp"
+                        android:layout_weight="1"
+                        android:hint="请采集料盘"
+                        android:imeOptions="actionSend" />
+                </TableRow>
+            </TableLayout>
+
+            <!--下部:提示TEXTView+显示TextView-->
+            <LinearLayout
+                style="@style/CardWhiteSytle_fillheight"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+                <TextView
+                    android:id="@+id/smt_feeding_bind_result_tv"
+                    style="@style/CardContentTextStyle"
+                    android:textColor="@color/green"
+                    tools:text="xxxxxxxxxxxxxxxxxxxxx" />
+
+            </LinearLayout>
+        </LinearLayout>
+    </ScrollView>
+</LinearLayout>

+ 23 - 10
app/src/main/res/layout/fragment_scmake_smtfeederchild_down.xml

@@ -15,8 +15,8 @@
             android:id="@+id/smt_down_material_linecode_tv"
             android:layout_width="0dp"
             android:layout_height="match_parent"
-            android:gravity="center_vertical"
             android:layout_weight="1"
+            android:gravity="center_vertical"
             android:textSize="@dimen/textsize_16"
             tools:text="LINE01" />
 
@@ -24,9 +24,9 @@
             android:id="@+id/smt_down_material_table_tv"
             android:layout_width="0dp"
             android:layout_height="match_parent"
-            android:gravity="center_vertical"
             android:layout_marginLeft="10dp"
             android:layout_weight="1"
+            android:gravity="center_vertical"
             android:textSize="@dimen/textsize_16"
             tools:text="A面" />
 
@@ -34,9 +34,9 @@
             android:id="@+id/smt_down_material_macode_tv"
             android:layout_width="0dp"
             android:layout_height="match_parent"
-            android:gravity="center_vertical"
             android:layout_marginLeft="10dp"
             android:layout_weight="2"
+            android:gravity="center_vertical"
             android:textSize="@dimen/textsize_16"
             tools:text="BZBD230844432423423349" />
     </LinearLayout>
@@ -56,12 +56,25 @@
                 layout="@layout/include_scmake_smtfeederchild_down"
                 android:visibility="gone" />
             <!--下部:提示TEXTView+显示TextView-->
-            <com.uas.uaspda.view.ClearableEditText
-                android:id="@+id/smt_down_material_collect_et"
-                style="@style/EditTextLineStyle"
-                android:layout_margin="16dp"
-                android:hint="请采集站位或者料卷号"
-                android:imeOptions="actionSend" />
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_margin="16dp">
+
+                <com.uas.uaspda.view.ClearableEditText
+                    android:id="@+id/smt_down_material_collect_et"
+                    style="@style/EditTextLineStyle"
+                    android:layout_width="0dp"
+                    android:layout_weight="1"
+                    android:hint="请采集站位或者飞达"
+                    android:imeOptions="actionSend" />
+
+                <CheckBox
+                    android:id="@+id/smt_down_material_unbind_cb"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="料盘飞达解绑" />
+            </LinearLayout>
 
             <LinearLayout
                 android:id="@+id/smt_down_material_result_ll"
@@ -71,8 +84,8 @@
 
                 <TextView
                     style="@style/CardTitleStyle"
-                    android:layout_marginBottom="5dp"
                     android:layout_marginTop="5dp"
+                    android:layout_marginBottom="5dp"
                     android:text="@string/text_search_collect_fragment_scmake"
                     android:visibility="gone" />
 

+ 29 - 5
app/src/main/res/layout/fragment_scmake_smtfeederchild_jointchange.xml

@@ -19,8 +19,8 @@
             android:id="@+id/smt_change_linecode_tv"
             android:layout_width="0dp"
             android:layout_height="match_parent"
-            android:gravity="center_vertical"
             android:layout_weight="1"
+            android:gravity="center_vertical"
             android:textSize="@dimen/textsize_16"
             tools:text="LINE01" />
 
@@ -28,9 +28,9 @@
             android:id="@+id/smt_change_table_tv"
             android:layout_width="0dp"
             android:layout_height="match_parent"
-            android:gravity="center_vertical"
             android:layout_marginLeft="10dp"
             android:layout_weight="1"
+            android:gravity="center_vertical"
             android:textSize="@dimen/textsize_16"
             tools:text="A面" />
 
@@ -38,9 +38,9 @@
             android:id="@+id/smt_change_macode_tv"
             android:layout_width="0dp"
             android:layout_height="match_parent"
-            android:gravity="center_vertical"
             android:layout_marginLeft="10dp"
             android:layout_weight="2"
+            android:gravity="center_vertical"
             android:textSize="@dimen/textsize_16"
             tools:text="BZBD23089" />
     </LinearLayout>
@@ -88,6 +88,30 @@
                         android:textColor="@color/black" />
                 </TableRow>
 
+                <TableRow
+                    android:layout_marginTop="5dp"
+                    android:background="@color/white">
+
+                    <TextView
+                        style="@style/tl_tv_style"
+                        android:layout_height="match_parent"
+                        android:gravity="center"
+                        android:paddingLeft="20dp"
+                        android:paddingRight="20dp"
+                        android:text="飞达"
+                        android:textColor="@color/body_text_1"
+                        android:textSize="16sp" />
+
+                    <com.uas.uaspda.view.TextViewWithButton
+                        android:id="@+id/smt_change_feeder_tv"
+                        style="@style/EditTextLineEnableStyle"
+                        android:layout_width="0dp"
+                        android:layout_marginRight="16dp"
+                        android:layout_weight="1"
+                        android:imeOptions="actionSend"
+                        android:textColor="@color/black" />
+                </TableRow>
+
                 <TableRow
                     android:layout_marginTop="5dp"
                     android:background="@color/white">
@@ -108,7 +132,7 @@
                         android:layout_width="0dp"
                         android:layout_marginRight="16dp"
                         android:layout_weight="1"
-                        android:hint="请采集接料站位"
+                        android:hint="请采集飞达编号"
                         android:imeOptions="actionSend" />
                 </TableRow>
             </TableLayout>
@@ -121,8 +145,8 @@
 
                 <TextView
                     style="@style/CardTitleStyle"
-                    android:layout_marginBottom="5dp"
                     android:layout_marginTop="5dp"
+                    android:layout_marginBottom="5dp"
                     android:text="@string/text_search_collect_fragment_scmake"
                     android:visibility="gone" />
 

+ 8 - 2
app/src/main/res/layout/pop_smt_down_all.xml

@@ -16,8 +16,8 @@
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="43dp"
-        android:orientation="horizontal"
-        android:layout_marginTop="10dp">
+        android:layout_marginTop="10dp"
+        android:orientation="horizontal">
 
         <TextView
             android:layout_width="wrap_content"
@@ -34,6 +34,12 @@
             android:hint="请输入产出数" />
     </LinearLayout>
 
+    <CheckBox
+        android:id="@+id/pop_smt_down_unbind_cb"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_margin="6dp"
+        android:text="料盘飞达解绑" />
 
     <View
         style="@style/view_gray_line"

+ 2 - 2
build.gradle

@@ -44,8 +44,8 @@ ext {
             targetSdkVersion : 28,
             compileSdkVersion: 28,
             buildToolsVersion: "28.0.3",
-            versionCode      : 6,
-            versionName      : "v2.2"
+            versionCode      : 7,
+            versionName      : "v2.3"
     ]
 
     depsVersion = [