Forráskód Böngészése

基于柯赛修改解除绑定功能.

songw 5 hónapja
szülő
commit
0bba35fdc0

+ 102 - 0
app/src/main/java/com/uas/baigang_workshop_workstation/activity/ProcessManagementActivity.java

@@ -22,6 +22,7 @@ import android.view.View;
 import android.view.Window;
 import android.view.inputmethod.EditorInfo;
 import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
 import android.widget.Button;
 import android.widget.CheckBox;
 import android.widget.CompoundButton;
@@ -31,6 +32,7 @@ import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.PopupWindow;
 import android.widget.SimpleAdapter;
+import android.widget.Spinner;
 import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
@@ -1234,6 +1236,7 @@ public class ProcessManagementActivity extends BaseActivity implements AdapterVi
                     dia.setContentView(R.layout.dialog_custom);
                     CheckBox check_alldelete = dia.findViewById(R.id.check_alldelete);
                     TextView tv_warning = dia.findViewById(R.id.tv_warning);
+                    Button bt_only_current_work_order = dia.findViewById(R.id.bt_only_current_work_order);
                     LinearLayout lineone = dia.findViewById(R.id.lineone);
                     LinearLayout linetwo = dia.findViewById(R.id.linetwo);
                     TextView tv_info = dia.findViewById(R.id.tv_info);
@@ -1253,6 +1256,13 @@ public class ProcessManagementActivity extends BaseActivity implements AdapterVi
                             }
                         }
                     });
+                    bt_only_current_work_order.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            dia.dismiss();
+                            initCurrentDialog();
+                        }
+                    });
 
                     dia.setCanceledOnTouchOutside(true);
                         btn_confirm.setOnClickListener(new View.OnClickListener() {
@@ -1319,6 +1329,98 @@ public class ProcessManagementActivity extends BaseActivity implements AdapterVi
 
     }
 
+    private String selctStr;
+    //仅删除当前工单
+    private void initCurrentDialog() {
+        Dialog dia = new Dialog(ProcessManagementActivity.this);
+        dia.setContentView(R.layout.dialog_only_work_order);
+
+        Spinner sp_reason = dia.findViewById(R.id.sp_reason);
+        ClearableEditText cet_notes = dia.findViewById(R.id.cet_notes);
+        Button btn_cancel = dia.findViewById(R.id.btn_cancel);//取消
+        Button btn_confirm = dia.findViewById(R.id.btn_confirm);//确定
+        dia.show();
+        dia.setCanceledOnTouchOutside(true);
+
+        ArrayList<String> arrayList = new ArrayList<>();
+        arrayList.add("欠料");
+        arrayList.add("换线");
+        arrayList.add("设备异常");
+        arrayList.add("人员变动");
+        arrayList.add("品质异常");
+        arrayList.add("其它");
+        ArrayAdapter reasonAdapter = new ArrayAdapter<String>(ProcessManagementActivity.this, android.R.layout.simple_spinner_item, arrayList);
+        reasonAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+        sp_reason.setAdapter(reasonAdapter);
+        sp_reason.setSelection(0);
+        selctStr = "欠料";
+
+        sp_reason.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+            @Override
+            public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
+                selctStr = arrayList.get(pos);  //取出选中的值
+            }
+
+            @Override
+            public void onNothingSelected(AdapterView<?> parent) {
+            }
+        });
+
+        btn_confirm.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                String ma_code = mCurDoc.getText().toString().trim();
+                String sc_code = ct_indexgangwei.getText().toString().trim();
+                String type = selctStr;
+                String remark = cet_notes.getText().toString().trim();
+                getCurrentDeltes(ma_code, sc_code, type, remark);
+                dia.dismiss();
+            }
+        });
+
+        btn_cancel.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                dia.dismiss();
+            }
+        });
+    }
+
+    private void getCurrentDeltes(String ma_code, String sc_code, String type, String remark) {
+        progressDialog.show();
+        VolleyRequest.getInstance().stringRequest(mStringRequest,
+                new HttpParams.Builder()
+                        .url(GloableParams.ADDRESS_PDA_STOPMA)
+                        .method(Request.Method.POST)
+                        .tag("stopMa")
+                        .flag(0)
+                        .addParam("ma_code", ma_code)
+                        .addParam("sc_code", sc_code)
+                        .addParam("type", type)
+                        .addParam("remark", remark)
+                        .build(), new HttpCallback() {
+                    @Override
+                    public void onSuccess(int flag, Object o) throws Exception {
+                        Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
+                        if (isSuccess) {
+                            CommonUtil.toastNoRepeat(ProcessManagementActivity.this, "解绑成功!");
+                            JSONObject dataObject = FastjsonUtil.getJSONObject(o.toString(), "data");
+                            Intent intent = new Intent(ProcessManagementActivity.this, ProcessManagementActivity.class);
+                            intent.putExtra(Constants.FLAG.SC_CODE, sc_code);
+                            startActivity(intent);
+                        } else {
+                            CommonUtil.toastNoRepeat(ProcessManagementActivity.this, "解绑失败!");
+                        }
+                        progressDialog.dismiss();
+                    }
+
+                    @Override
+                    public void onFail(int flag, String failStr) throws Exception {
+                        progressDialog.dismiss();
+                        CommonUtil.toastNoRepeat(ProcessManagementActivity.this, failStr);
+                    }
+                });
+    }
 
     //全部删除
     public void getalldeltes(String workOrder){

+ 11 - 0
app/src/main/res/layout/dialog_custom.xml

@@ -110,6 +110,17 @@
                 android:background="#F5F8F8"
                 android:textColor="@color/actionbar"
                 android:textSize="@dimen/sp_14" />
+
+            <Button
+                android:id="@+id/bt_only_current_work_order"
+                android:layout_width="0dp"
+                android:layout_height="40dp"
+                android:layout_weight="1"
+                android:background="#F5F8F8"
+                android:text="仅当前工单"
+                android:textColor="@color/actionbar"
+                android:textSize="@dimen/sp_14" />
+
         </LinearLayout>
     </LinearLayout>
 

+ 118 - 0
app/src/main/res/layout/dialog_only_work_order.xml

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:gravity="center"
+    android:orientation="vertical">
+    <LinearLayout
+        android:layout_width="300dp"
+        android:layout_height="wrap_content"
+        android:background="#ffff"
+        android:orientation="vertical">
+
+        <RelativeLayout
+            android:visibility="gone"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/dp_10"
+            android:layout_marginBottom="@dimen/dp_10"
+            android:orientation="horizontal">
+
+            <TextView
+                android:id="@+id/tv_title"
+                android:layout_centerHorizontal="true"
+                android:text="提示"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="30dp"
+                android:textStyle="bold" />
+        </RelativeLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="32dp"
+            android:layout_marginTop="15dp"
+            android:gravity="center_vertical">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="原因:"
+                android:textSize="16sp"
+                android:layout_marginStart="10dp"
+                />
+
+            <Spinner
+                android:id="@+id/sp_reason"
+                android:layout_width="match_parent"
+                android:layout_height="30dp"
+                android:gravity="center"
+                android:layout_gravity="center"
+                android:layout_marginStart="10dp"
+                android:layout_marginEnd="10dp"
+                />
+
+        </LinearLayout>
+
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="32dp"
+            android:layout_marginTop="10dp"
+            android:gravity="center_vertical">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="备注:"
+                android:textSize="16sp"
+                android:layout_marginStart="10dp"
+                />
+
+            <com.uas.baigang_workshop_workstation.view.ClearableEditText
+                android:id="@+id/cet_notes"
+                style="@style/EditTextLineStyle"
+                android:layout_marginStart="10dp"
+                android:layout_marginEnd="10dp"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:textSize="16sp"
+                android:hint=""
+                />
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/dp_10"
+            android:layout_marginBottom="@dimen/dp_10"
+            android:orientation="horizontal"
+            android:padding="@dimen/dp_10">
+
+            <Button
+                android:text="确定"
+                android:id="@+id/btn_confirm"
+                android:layout_width="0dp"
+                android:layout_weight="1"
+                android:layout_height="40dp"
+                android:background="#F5F8F8"
+                android:textColor="@color/actionbar"
+                android:layout_marginEnd="10dp"
+                android:textSize="@dimen/sp_14" />
+
+            <Button
+                android:text="取消"
+                android:id="@+id/btn_cancel"
+                android:layout_width="0dp"
+                android:layout_weight="1"
+                android:layout_height="40dp"
+                android:layout_marginEnd="10dp"
+                android:background="#F5F8F8"
+                android:textColor="@color/actionbar"
+                android:textSize="@dimen/sp_14" />
+
+        </LinearLayout>
+    </LinearLayout>
+
+</LinearLayout>