浏览代码

顺序上料

RaoMeng 5 年之前
父节点
当前提交
d1e078eefa

+ 9 - 0
app/src/main/java/com/uas/uaspda/fragment/DefaultSettingFragment.java

@@ -10,11 +10,13 @@ import com.uas.uaspda.tools.SharedPreUtil;
 import com.uas.uaspda.util.CommonUtil;
 import com.uas.uaspda.util.Constants;
 import com.uas.uaspda.view.ClearableEditText;
+import com.uas.uaspda.view.SwitchView;
 
 public class DefaultSettingFragment extends BaseFragment implements View.OnClickListener {
     private ClearableEditText defaultSettingWarehouseEt;
     private ClearableEditText defaultSettingLinecodeEt;
     private ClearableEditText mDefaultRejectsWarehouseEt;
+    private SwitchView mOrderSwitchView;
 
     @Override
     protected int getLayout() {
@@ -28,6 +30,8 @@ public class DefaultSettingFragment extends BaseFragment implements View.OnClick
         defaultSettingWarehouseEt = (ClearableEditText) root.findViewById(R.id.default_setting_warehouse_et);
         defaultSettingLinecodeEt = (ClearableEditText) root.findViewById(R.id.default_setting_linecode_et);
         mDefaultRejectsWarehouseEt = (ClearableEditText) root.findViewById(R.id.default_setting_rejects_warehouse_et);
+        mOrderSwitchView = root.findViewById(R.id.default_setting_order_sv);
+        mOrderSwitchView.setChecked(false);
     }
 
     @Override
@@ -54,6 +58,10 @@ public class DefaultSettingFragment extends BaseFragment implements View.OnClick
         if (defaultRejectsWarehouse != null) {
             mDefaultRejectsWarehouseEt.setText(defaultRejectsWarehouse);
         }
+
+        int orderSwitch = SharedPreUtil.getInt(mActivity, Constants.FLAG.CACHE_DEFAULT_ORDER_SWITCH + CommonUtil.getUserName(mActivity), 0);
+        mOrderSwitchView.setChecked(orderSwitch == 1);
+
     }
 
     @Override
@@ -67,6 +75,7 @@ public class DefaultSettingFragment extends BaseFragment implements View.OnClick
                 SharedPreUtil.saveString(mActivity, Constants.FLAG.DEFAULT_WAREHOUSE_CACHE + CommonUtil.getUserName(mActivity), defaultSettingWarehouseEt.getText().toString().trim());
                 SharedPreUtil.saveString(mActivity, Constants.FLAG.SMT_LINECODE_CACHE + CommonUtil.getUserName(mActivity) + CommonUtil.getFunMaster(mActivity), defaultSettingLinecodeEt.getText().toString().trim());
                 SharedPreUtil.saveString(mActivity, Constants.FLAG.CACHE_DEFAULT_REJECTS_WAREHOUSE + CommonUtil.getUserName(mActivity), mDefaultRejectsWarehouseEt.getText().toString().trim());
+                SharedPreUtil.saveInt(mActivity, Constants.FLAG.CACHE_DEFAULT_ORDER_SWITCH + CommonUtil.getUserName(mActivity), mOrderSwitchView.isChecked() ? 1 : 0);
                 Toast.makeText(getActivity(), "缺省项设置成功", Toast.LENGTH_SHORT).show();
 
 //                new Handler().postDelayed(new Runnable() {

+ 18 - 3
app/src/main/java/com/uas/uaspda/fragment/SCSMTCheckFragment.java

@@ -123,6 +123,7 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
     private MyArrayAdapter<String> mAutoStringAdapter;
     private TextView mRecalibrationTextView;
     private String mNoticeStr;
+    private boolean mOrderSwitch = false;
 
     @Override
     protected int getLayout() {
@@ -133,6 +134,7 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
     protected void initViews() {
         ((FunctionActivity) getActivity()).setSmtQueryIvVisible(true);
 
+        mOrderSwitch = SharedPreUtil.getInt(mActivity, Constants.FLAG.CACHE_DEFAULT_ORDER_SWITCH + CommonUtil.getUserName(mActivity), 0) == 1;
         //->校验方式
         tvCheckStyle = (TextView) root.findViewById(R.id.tvCurCheckContent);
         btnChange = (Button) root.findViewById(R.id.btn_changecheck_smtcheck);
@@ -362,6 +364,10 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
                                             JSONObject notCheckObject = notFeedArray.optJSONObject(i);
                                             if (notCheckObject != null) {
                                                 String psl_location = JsonUtils.optStringNotNull(notCheckObject, "PSL_LOCATION");
+                                                if (i == 0 && mOrderSwitch) {
+                                                    mCollectEditText.setText(psl_location);
+                                                    confirmEvent(psl_location);
+                                                }
                                                 notice = notice + psl_location + ",";
                                             }
                                         }
@@ -812,6 +818,10 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
                             JSONObject dataObject = resultObject.optJSONObject("data");
                             String notice = "站位[" + location + "]+物料[" + collect + "]匹配成功!";
                             if (dataObject != null) {
+                                mSmtDslBean = new SmtDslBean();
+                                mLocationTextView.setText("");
+                                mCollectEditText.setText("");
+
                                 double notCheckCount = JsonUtils.optDoubleNotNull(dataObject, "NotCheckCount");
                                 tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
                                 if (notCheckCount == 0) {
@@ -833,6 +843,10 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
                                             JSONObject notCheckObject = notCheckArray.optJSONObject(i);
                                             if (notCheckObject != null) {
                                                 String psl_location = JsonUtils.optStringNotNull(notCheckObject, "PSL_LOCATION");
+                                                if (i == 0 && mOrderSwitch) {
+                                                    mCollectEditText.setText(psl_location);
+                                                    confirmEvent(psl_location);
+                                                }
                                                 notice = notice + psl_location + ",";
                                                 noticeStr = noticeStr + psl_location + ",";
                                             }
@@ -846,9 +860,6 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
                                     tvMsgNotice.setText(spannableString);
                                 }
 
-                                mSmtDslBean = new SmtDslBean();
-                                mLocationTextView.setText("");
-                                mCollectEditText.setText("");
                                 mCollectEditText.postDelayed(new Runnable() {
                                     @Override
                                     public void run() {
@@ -1025,6 +1036,10 @@ public class SCSMTCheckFragment extends BaseFragment implements View.OnClickList
                                             JSONObject notCheckObject = notFeedArray.optJSONObject(i);
                                             if (notCheckObject != null) {
                                                 String psl_location = JsonUtils.optStringNotNull(notCheckObject, "PSL_LOCATION");
+                                                if (i == 0 && mOrderSwitch) {
+                                                    mCollectEditText.setText(psl_location);
+                                                    confirmEvent(psl_location);
+                                                }
                                                 notice = notice + psl_location + ",";
                                             }
                                         }

+ 16 - 6
app/src/main/java/com/uas/uaspda/fragment/SCSMTInFragment.java

@@ -64,6 +64,7 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
     private SmtDslBean mSmtDslBean = new SmtDslBean();
     private StringRequest mStringRequest;
     private String mNoticeStr = "";
+    private boolean mOrderSwitch = false;
 
     @Override
     protected int getLayout() {
@@ -72,6 +73,7 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
 
     @Override
     protected void initViews() {
+        mOrderSwitch = SharedPreUtil.getInt(mActivity, Constants.FLAG.CACHE_DEFAULT_ORDER_SWITCH + CommonUtil.getUserName(mActivity), 0) == 1;
         //获取组件
         //->采集信息
         btnCollect = (Button) root.findViewById(R.id.btn_collect_smtchildin);
@@ -290,6 +292,12 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
                             JSONObject jsonObject = new JSONObject(s);
                             JSONObject dataObject = jsonObject.optJSONObject("data");
                             if (dataObject != null) {
+                                mLocationTextView.setText("");
+                                mCollectEditText.setText("");
+                                mCollectEditText.setHint("请录入站位编号");
+
+                                mSmtDslBean = new SmtDslBean();
+
                                 tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
                                 tvMsgNotice.setText("上料成功");
                                 tvMsgProdcode.setText("料号:" + JsonUtils.optStringNotNull(dataObject, "DSL_PRODCODE"));
@@ -317,6 +325,10 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
                                             JSONObject notCheckObject = notFeedArray.optJSONObject(i);
                                             if (notCheckObject != null) {
                                                 String psl_location = JsonUtils.optStringNotNull(notCheckObject, "PSL_LOCATION");
+                                                if (i == 0 && mOrderSwitch) {
+                                                    mCollectEditText.setText(psl_location);
+                                                    confirmEvent(psl_location);
+                                                }
                                                 notice = notice + psl_location + ",";
                                                 noticeStr = noticeStr + psl_location + ",";
                                             }
@@ -328,12 +340,6 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
                                     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);
                                 }
-
-                                mLocationTextView.setText("");
-                                mCollectEditText.setText("");
-
-                                mSmtDslBean = new SmtDslBean();
-                                mCollectEditText.setHint("请录入站位编号");
                             }
                         } catch (JSONException e) {
                             e.printStackTrace();
@@ -434,6 +440,10 @@ public class SCSMTInFragment extends BaseFragment implements View.OnClickListene
                                             JSONObject notCheckObject = notFeedArray.optJSONObject(i);
                                             if (notCheckObject != null) {
                                                 String psl_location = JsonUtils.optStringNotNull(notCheckObject, "PSL_LOCATION");
+                                                if (i == 0 && mOrderSwitch) {
+                                                    mCollectEditText.setText(psl_location);
+                                                    confirmEvent(psl_location);
+                                                }
                                                 notice = notice + psl_location + ",";
                                             }
                                         }

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

@@ -180,6 +180,9 @@ public interface Constants {
         //登录数据缓存
         String CACHE_LOGIN_DATA_LIST = "cache_login_data_list";
 
+        //顺序上料设置缓存
+        String CACHE_DEFAULT_ORDER_SWITCH = "cache_default_order_switch";
+
         //iqc入库传入材料入库的json参数
         String FLAG_IQC_IN_JSON = "flag_iqc_in_json";
 

+ 28 - 4
app/src/main/res/layout/fragment_default_setting.xml

@@ -1,9 +1,9 @@
 <?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:orientation="vertical"
-              android:padding="16dp">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:padding="16dp">
 
     <TextView
         android:layout_width="wrap_content"
@@ -56,6 +56,30 @@
         android:hint="@string/default_linecode"
         android:textSize="@dimen/textsize_16" />
 
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dp"
+        android:background="@color/white"
+        android:gravity="center_vertical"
+        android:orientation="horizontal"
+        android:paddingTop="12dp"
+        android:paddingBottom="12dp">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="顺序上料"
+            android:textSize="@dimen/textsize_18"
+            android:textStyle="bold" />
+
+        <com.uas.uaspda.view.SwitchView
+            android:id="@+id/default_setting_order_sv"
+            android:layout_width="46dp"
+            android:layout_height="28dp" />
+    </LinearLayout>
+
     <Button
         android:id="@+id/default_setting_submit_btn"
         style="@style/ButtonStyle"