From 6a059fa2b966eaa2035a8dc18469d52fdaf0e59a Mon Sep 17 00:00:00 2001 From: wangh <123456> Date: Wed, 16 Aug 2023 09:16:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E5=B0=8F=E6=96=99?= =?UTF-8?q?=E9=87=8D=E9=87=8F=E6=A0=B8=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 +- .../main/java/com/example/pulit/X1Activity.java | 14 ++++++++++++-- .../main/java/com/example/pulit/X2Activity.java | 4 ++-- app/src/main/res/layout/activity_x1.xml | 1 + 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 88f43bc..b573dc9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,7 +10,7 @@ android { applicationId "com.example.pulit" minSdkVersion 26 targetSdkVersion 30 - versionCode 2 + versionCode 3 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/com/example/pulit/X1Activity.java b/app/src/main/java/com/example/pulit/X1Activity.java index c89d0b3..8dc35ff 100644 --- a/app/src/main/java/com/example/pulit/X1Activity.java +++ b/app/src/main/java/com/example/pulit/X1Activity.java @@ -3,6 +3,9 @@ package com.example.pulit; import android.os.Bundle; import android.util.Log; import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.LinearLayout; +import android.widget.ListPopupWindow; import android.widget.TextView; import android.widget.Toast; @@ -20,6 +23,7 @@ import com.example.pulit.util.SharedPreferencesUtils; import com.lzy.okgo.OkGo; import com.lzy.okgo.model.Response; +import java.util.Arrays; import java.util.List; import butterknife.BindView; @@ -42,13 +46,15 @@ public class X1Activity extends BaseActivity { TextView x1GoodsCode; @BindView(R.id.x1_goods_Weight) TextView x1GoodsWeight; + @BindView(R.id.x1_code1) + LinearLayout x1Code1; private boolean scanStates; private List items; private ItemAdapter adapter; private X1Submit entrySubmit; - + private ListPopupWindow lpw; @Override protected void onCreate(Bundle savedInstanceState) { @@ -58,6 +64,10 @@ public class X1Activity extends BaseActivity { scanStates = true; x1RecyclerView.setLayoutManager(new LinearLayoutManager(this)); adapter = new ItemAdapter(this); + lpw = new ListPopupWindow(this); + lpw.setAnchorView(x1Code1); + lpw.setAdapter(new ArrayAdapter(this, R.layout.support_simple_spinner_dropdown_item, Arrays.asList("B20230011", "B20230300", "B20230221", "B20230192", "B20230223"))); + lpw.setOnItemClickListener((adapterView, view, i, l) -> lpw.dismiss()); } @Override @@ -68,7 +78,6 @@ public class X1Activity extends BaseActivity { dialog.show(); //反应釜查询 getF(info); - } else { x1Tong.setText(info); if (info.contains("kg")) { @@ -148,6 +157,7 @@ public class X1Activity extends BaseActivity { adapter.setList(items); x1RecyclerView.setAdapter(adapter); scanStates = false;//扫描 + lpw.show(); } else { Toast.makeText(X1Activity.this, "请求失败,条码不正确", Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/com/example/pulit/X2Activity.java b/app/src/main/java/com/example/pulit/X2Activity.java index 3c6551c..6893f8a 100644 --- a/app/src/main/java/com/example/pulit/X2Activity.java +++ b/app/src/main/java/com/example/pulit/X2Activity.java @@ -42,7 +42,7 @@ public class X2Activity extends BaseActivity { ButterKnife.bind(this); sanType = true; } - +//1A000001、000524 @Override public void scanInfo(String info) { if (sanType) { @@ -94,7 +94,7 @@ public class X2Activity extends BaseActivity { if (state == 0) return; dialog.show(); - OkGo.post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/xl_material/ExecPlcCode") + OkGo.get("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/xl_material/ExecPlcCode") .params("code",Bin_Serial) .params("state",state) .execute(new MyOkGoCallback() { diff --git a/app/src/main/res/layout/activity_x1.xml b/app/src/main/res/layout/activity_x1.xml index aeabada..04ce41e 100644 --- a/app/src/main/res/layout/activity_x1.xml +++ b/app/src/main/res/layout/activity_x1.xml @@ -30,6 +30,7 @@