diff --git a/app/src/main/java/com/example/beijing_daxing/BFActivity.java b/app/src/main/java/com/example/beijing_daxing/BFActivity.java index ffd8eb5..d7f34a7 100644 --- a/app/src/main/java/com/example/beijing_daxing/BFActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/BFActivity.java @@ -31,6 +31,7 @@ public class BFActivity extends BaseActivity { ActivityBfactivityBinding dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_bfactivity); wm=new BFWm(); dataBinding.setVm(wm); + setPower(17); } @Override diff --git a/app/src/main/java/com/example/beijing_daxing/FpInActivity.java b/app/src/main/java/com/example/beijing_daxing/FpInActivity.java index ac67fea..69f1374 100644 --- a/app/src/main/java/com/example/beijing_daxing/FpInActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/FpInActivity.java @@ -32,6 +32,7 @@ public class FpInActivity extends BaseActivity { ActivityFpInBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_fp_in); vm = new FpInVm(); binding.setVm(vm); + setPower(17); } @Override diff --git a/app/src/main/java/com/example/beijing_daxing/FpOutActivity.java b/app/src/main/java/com/example/beijing_daxing/FpOutActivity.java index 55e34b8..e87d253 100644 --- a/app/src/main/java/com/example/beijing_daxing/FpOutActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/FpOutActivity.java @@ -43,6 +43,7 @@ public class FpOutActivity extends BaseActivity { adapter = new OutAdapter(this); binding.setAdapter(adapter); initRequest(); + setPower(17); } private List tagList; diff --git a/app/src/main/java/com/example/beijing_daxing/InActivity.java b/app/src/main/java/com/example/beijing_daxing/InActivity.java index e8e399a..fee8354 100644 --- a/app/src/main/java/com/example/beijing_daxing/InActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/InActivity.java @@ -36,7 +36,6 @@ public class InActivity extends BaseActivity implements AdapterClickCall { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - binding = DataBindingUtil.setContentView(this, R.layout.activity_in); vm = new InStoreVM(); binding.setVm(vm); @@ -46,6 +45,7 @@ public class InActivity extends BaseActivity implements AdapterClickCall { adapter.setList(epcList); adapter.setAdapterClickCall(this); binding.setAdapter(adapter); + setPower(33); } @Override @@ -54,8 +54,11 @@ public class InActivity extends BaseActivity implements AdapterClickCall { epcs.stream().forEach(t -> { var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length); + if (!epcList.contains(epc)) { - epcList.add(epc); + if (epc.substring(0,8).equals("42574C44")){ + epcList.add(epc); + } } }); vm.setSanLength(epcList.size()); diff --git a/app/src/main/java/com/example/beijing_daxing/OutActivity.java b/app/src/main/java/com/example/beijing_daxing/OutActivity.java index ffe7ece..25af8cc 100644 --- a/app/src/main/java/com/example/beijing_daxing/OutActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/OutActivity.java @@ -40,6 +40,7 @@ public class OutActivity extends BaseActivity implements AdapterClickCall { outVm=new OutStoreVm(); binding.setVm(outVm); initRequest(); + setPower(17); } @Override @@ -47,7 +48,9 @@ public class OutActivity extends BaseActivity implements AdapterClickCall { epcs.stream().forEach(t -> { var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length); if (!epcList.contains(epc)) { - epcList.add(epc); + if (epc.substring(0,8).equals("42574C44")) { + epcList.add(epc); + } } }); adapter.notifyDataSetChanged(); diff --git a/app/src/main/java/com/example/beijing_daxing/StoreCheckActivity.java b/app/src/main/java/com/example/beijing_daxing/StoreCheckActivity.java index 9d977a3..cd7f389 100644 --- a/app/src/main/java/com/example/beijing_daxing/StoreCheckActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/StoreCheckActivity.java @@ -49,6 +49,7 @@ public class StoreCheckActivity extends BaseActivity { checkAdapter = new StoreCheckAdapter(this); binding.setAdapter(checkAdapter); initRequest(); + setPower(33); } private List tagList; @@ -56,12 +57,14 @@ public class StoreCheckActivity extends BaseActivity { @Override protected void sanRfid(List epcs) { if (tagList == null) return; + Log.e("TAG", "sanRfid:"); epcs.forEach(t -> { var epc = Tools.Bytes2HexString(t.EpcId, t.EpcId.length); if (tagList.contains(epc)) { - tagList.add(epc); return; } + tagList.add(epc); + Log.e("TAG", "sanRfid:" + epc); var stock = new Stock(); stock.setEpcCode(epc); var index = list.indexOf(stock); @@ -96,7 +99,7 @@ public class StoreCheckActivity extends BaseActivity { if (b) { handler.removeCallbacks(runnable); } else { - handler.postDelayed(runnable, 0); + handler.postDelayed(runnable, 100); } checkState.set(!b); } @@ -133,10 +136,10 @@ public class StoreCheckActivity extends BaseActivity { private Runnable runnable = new Runnable() { @Override public void run() { - Log.e("TAG", "发送广播,读取RFID"); + // Log.e("TAG", "发送广播,读取RFID"); // sendBroadcast(broadcastIntent); sanEpc(); - handler.postDelayed(runnable, 1000); + handler.postDelayed(runnable, 0); } }; diff --git a/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java b/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java index af8c690..ec974a1 100644 --- a/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java @@ -27,6 +27,7 @@ import okhttp3.MediaType; public abstract class BaseActivity extends AppCompatActivity { // public static String url = "http://192.168.0.102:8090/api"; + // public static String url = "http://192.168.42.239:8090/api"; public static String url = "http://119.45.202.115:8090/api"; public ProgressDialog dialog; public Gson gson; @@ -65,7 +66,7 @@ public abstract class BaseActivity extends AppCompatActivity { } public void sanEpc(){ List strings = uhfLongerManager.tagInventoryRealTime(); - Log.e("TAG", "驱动" + (uhfLongerManager == null)); + // Log.e("TAG", "驱动" + (uhfLongerManager == null)); if (strings == null || strings.isEmpty()) { return; } @@ -94,6 +95,12 @@ public abstract class BaseActivity extends AppCompatActivity { mediaPlayer = MediaPlayer.create(this, R.raw.msg); } + public void setPower(int power){ + Reader.READER_ERR readerErr = uhfLongerManager.setPower(power, power); + Log.e("TAG", "setPower:" + readerErr.name()); + Log.e("TAG", "readPower:" + uhfLongerManager.getPower()[0]); + } + @Override protected void onDestroy() { super.onDestroy(); diff --git a/app/src/main/res/layout/activity_check.xml b/app/src/main/res/layout/activity_check.xml index fd58361..249b908 100644 --- a/app/src/main/res/layout/activity_check.xml +++ b/app/src/main/res/layout/activity_check.xml @@ -45,6 +45,7 @@ android:adapter="@{adapter}" android:padding="10dp" android:layout_weight="1" + android:background="@color/white" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />