Browse Source

飞达料盘解绑

RaoMeng 5 years ago
parent
commit
9900b03e88

+ 4 - 0
app/src/main/java/com/uas/uaspda/fragment/SCSMTIndexFragment.java

@@ -294,6 +294,10 @@ public class SCSMTIndexFragment extends BaseFragment implements AdapterView.OnIt
                         fragment = new SCSMTBindFragment();
                         FragmentUtils.switchFragment(this, fragment);
                         break;
+                    case GloableParams.LISTNAME_FEEDER_UNBIND:
+                        fragment = new SCSMTUnBindFragment();
+                        FragmentUtils.switchFragment(this, fragment);
+                        break;
                 }
             }
 

+ 189 - 0
app/src/main/java/com/uas/uaspda/fragment/SCSMTUnBindFragment.java

@@ -0,0 +1,189 @@
+package com.uas.uaspda.fragment;
+
+import android.text.TextUtils;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.Button;
+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 SCSMTUnBindFragment extends BaseFragment {
+    private TextView mLinecodeTv;
+    private TextView mTableTv;
+    private TextView mMacodeTv;
+    private ClearableEditText mFeederEt;
+    private TextView mMaterialEt;
+    private TextView mResultTv;
+    private LineInfoBean mLineInfoBean;
+    private String mSmtLocationCache;
+    private Button mConfirmBtn;
+
+    @Override
+    protected int getLayout() {
+        return R.layout.fragment_scmake_smtfeeder_unbind;
+    }
+
+    @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 = (TextView) root.findViewById(R.id.smt_feeding_bind_material_et);
+        mResultTv = (TextView) root.findViewById(R.id.smt_feeding_bind_result_tv);
+        mConfirmBtn = root.findViewById(R.id.smt_feeding_unbind_confirm_btn);
+
+        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) {
+                getBarcodeByFeeder();
+            }
+        });
+
+        mConfirmBtn.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                unBindMaterial();
+            }
+        });
+    }
+
+
+    private void getBarcodeByFeeder() {
+        String feeder = mFeederEt.getText().toString().trim();
+        if (TextUtils.isEmpty(feeder)) {
+            CommonUtil.toastNoRepeat(mActivity, "请采集飞达");
+            return;
+        }
+        mResultTv.setText("");
+        progressDialog.show();
+        VolleyRequest.getInstance()
+                .stringRequest(new HttpParams.Builder()
+                        .url(GloableParams.ADDRESS_SMT_GETBARCODEBYFEEDER)
+                        .method(Request.Method.POST)
+                        .addParam("fe_code", feeder)
+                        .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");
+                            if (dataObject != null) {
+                                String fe_barcode = FastjsonUtil.getText(dataObject, "fe_barcode");
+                                mMaterialEt.setText(fe_barcode);
+                            }
+                        } 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);
+                    }
+                });
+    }
+
+    private void unBindMaterial() {
+        String feeder = mFeederEt.getText().toString().trim();
+        if (TextUtils.isEmpty(feeder)) {
+            CommonUtil.toastNoRepeat(mActivity, "请采集飞达");
+            return;
+        }
+        mResultTv.setText("");
+        progressDialog.show();
+        VolleyRequest.getInstance()
+                .stringRequest(new HttpParams.Builder()
+                        .url(GloableParams.ADDRESS_SMT_UNBINDFEEDER)
+                        .method(Request.Method.POST)
+                        .addParam("fe_code", feeder)
+                        .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")
+                                            + "  解绑成功");
+                            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;
+    }
+}
+
+
+

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

@@ -215,6 +215,8 @@ public class GloableParams {
     public static String ADDRESS_SMT_BINDFEEDERBARCODE;
     public static String ADDRESS_SMT_GETFEEDERBARCODE;
     public static String ADDRESS_MSD_CONFIRMSEALBARCODE;
+    public static String ADDRESS_SMT_UNBINDFEEDER;
+    public static String ADDRESS_SMT_GETBARCODEBYFEEDER;
 
 
     //连接服务器请求地址
@@ -368,8 +370,12 @@ public class GloableParams {
 
     //->SMT 飞达料盘绑定
     private static final String ADDRESSTAIL_SMT_BINDFEEDERBARCODE = "/api/pda/smt/bindFeederBarcode.action";
+    //->SMT 飞达料盘解绑
+    private static final String ADDRESSTAIL_SMT_UNBINDFEEDER = "/api/pda/smt/unBindFeeder.action";
     //SMT 通过飞达,获取站位
     private static final String ADDRESSTAIL_SMT_GETFEEDERBARCODE = "/api/pda/smt/getFeederLocation.action";
+    //SMT 通过飞达,获取料盘
+    private static final String ADDRESSTAIL_SMT_GETBARCODEBYFEEDER = "/api/pda/smt/getBarcodeByFeeder.action";
 
     //->SMT共用请求
     //SMT-child上料/接料/换料:获取详细信息
@@ -673,18 +679,20 @@ public class GloableParams {
     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 LISTNAME_FEEDER_UNBIND = "飞达料盘解绑";
 
     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_FEEDER_BIND};
+            LISTNAME_LOCATION_QUERY, LISTNAME_PREMATERIAL_QUERY, LISTNAME_FEEDER_BIND,
+            LISTNAME_FEEDER_UNBIND};
     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_prematerial_query};
+            R.drawable.index_prematerial_query, R.drawable.index_smt_query};
 
     //-->入库管理
     public static final String MENU_STORAGE_RECHARGE = "收料";
@@ -953,5 +961,7 @@ public class GloableParams {
         GloableParams.ADDRESS_SMT_BINDFEEDERBARCODE = uriHead + GloableParams.ADDRESSTAIL_SMT_BINDFEEDERBARCODE;
         GloableParams.ADDRESS_SMT_GETFEEDERBARCODE = uriHead + GloableParams.ADDRESSTAIL_SMT_GETFEEDERBARCODE;
         GloableParams.ADDRESS_MSD_CONFIRMSEALBARCODE = uriHead + GloableParams.ADDRESSTAIL_MSD_CONFIRMSEALBARCODE;
+        GloableParams.ADDRESS_SMT_UNBINDFEEDER = uriHead + GloableParams.ADDRESSTAIL_SMT_UNBINDFEEDER;
+        GloableParams.ADDRESS_SMT_GETBARCODEBYFEEDER = uriHead + GloableParams.ADDRESSTAIL_SMT_GETBARCODEBYFEEDER;
     }
 }

+ 128 - 0
app/src/main/res/layout/fragment_scmake_smtfeeder_unbind.xml

@@ -0,0 +1,128 @@
+<?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" />
+
+                    <TextView
+                        android:id="@+id/smt_feeding_bind_material_et"
+                        style="@style/EditTextLineStyle"
+                        android:layout_width="0dp"
+                        android:layout_marginRight="16dp"
+                        android:layout_weight="1"
+                        android:imeOptions="actionSend" />
+                </TableRow>
+            </TableLayout>
+
+            <Button
+                android:id="@+id/smt_feeding_unbind_confirm_btn"
+                style="@style/ButtonStyle"
+                android:layout_margin="24dp"
+                android:text="解绑" />
+
+            <!--下部:提示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>

+ 2 - 2
build.gradle

@@ -45,8 +45,8 @@ ext {
             targetSdkVersion : 28,
             compileSdkVersion: 28,
             buildToolsVersion: "28.0.3",
-            versionCode      : 8,
-            versionName      : "v2.4"
+            versionCode      : 9,
+            versionName      : "v2.5"
     ]
 
     depsVersion = [