增加 更新

idata
wanghao 7 months ago
parent 55ed1c5cfb
commit 685451d5c9

@ -31,6 +31,7 @@ public class BFActivity extends BaseActivity {
ActivityBfactivityBinding dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_bfactivity); ActivityBfactivityBinding dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_bfactivity);
wm=new BFWm(); wm=new BFWm();
dataBinding.setVm(wm); dataBinding.setVm(wm);
setPower(17);
} }
@Override @Override

@ -32,6 +32,7 @@ public class FpInActivity extends BaseActivity {
ActivityFpInBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_fp_in); ActivityFpInBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_fp_in);
vm = new FpInVm(); vm = new FpInVm();
binding.setVm(vm); binding.setVm(vm);
setPower(17);
} }
@Override @Override

@ -43,6 +43,7 @@ public class FpOutActivity extends BaseActivity {
adapter = new OutAdapter(this); adapter = new OutAdapter(this);
binding.setAdapter(adapter); binding.setAdapter(adapter);
initRequest(); initRequest();
setPower(17);
} }
private List<String> tagList; private List<String> tagList;

@ -36,7 +36,6 @@ public class InActivity extends BaseActivity implements AdapterClickCall {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_in); binding = DataBindingUtil.setContentView(this, R.layout.activity_in);
vm = new InStoreVM(); vm = new InStoreVM();
binding.setVm(vm); binding.setVm(vm);
@ -46,6 +45,7 @@ public class InActivity extends BaseActivity implements AdapterClickCall {
adapter.setList(epcList); adapter.setList(epcList);
adapter.setAdapterClickCall(this); adapter.setAdapterClickCall(this);
binding.setAdapter(adapter); binding.setAdapter(adapter);
setPower(33);
} }
@Override @Override
@ -54,9 +54,12 @@ public class InActivity extends BaseActivity implements AdapterClickCall {
epcs.stream().forEach(t -> { epcs.stream().forEach(t -> {
var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length); var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length);
if (!epcList.contains(epc)) { if (!epcList.contains(epc)) {
if (epc.substring(0,8).equals("42574C44")){
epcList.add(epc); epcList.add(epc);
} }
}
}); });
vm.setSanLength(epcList.size()); vm.setSanLength(epcList.size());
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();

@ -40,6 +40,7 @@ public class OutActivity extends BaseActivity implements AdapterClickCall {
outVm=new OutStoreVm(); outVm=new OutStoreVm();
binding.setVm(outVm); binding.setVm(outVm);
initRequest(); initRequest();
setPower(17);
} }
@Override @Override
@ -47,8 +48,10 @@ public class OutActivity extends BaseActivity implements AdapterClickCall {
epcs.stream().forEach(t -> { epcs.stream().forEach(t -> {
var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length); var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length);
if (!epcList.contains(epc)) { if (!epcList.contains(epc)) {
if (epc.substring(0,8).equals("42574C44")) {
epcList.add(epc); epcList.add(epc);
} }
}
}); });
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }

@ -49,6 +49,7 @@ public class StoreCheckActivity extends BaseActivity {
checkAdapter = new StoreCheckAdapter(this); checkAdapter = new StoreCheckAdapter(this);
binding.setAdapter(checkAdapter); binding.setAdapter(checkAdapter);
initRequest(); initRequest();
setPower(33);
} }
private List<String> tagList; private List<String> tagList;
@ -56,12 +57,14 @@ public class StoreCheckActivity extends BaseActivity {
@Override @Override
protected void sanRfid(List<Reader.TAGINFO> epcs) { protected void sanRfid(List<Reader.TAGINFO> epcs) {
if (tagList == null) return; if (tagList == null) return;
Log.e("TAG", "sanRfid:");
epcs.forEach(t -> { epcs.forEach(t -> {
var epc = Tools.Bytes2HexString(t.EpcId, t.EpcId.length); var epc = Tools.Bytes2HexString(t.EpcId, t.EpcId.length);
if (tagList.contains(epc)) { if (tagList.contains(epc)) {
tagList.add(epc);
return; return;
} }
tagList.add(epc);
Log.e("TAG", "sanRfid:" + epc);
var stock = new Stock(); var stock = new Stock();
stock.setEpcCode(epc); stock.setEpcCode(epc);
var index = list.indexOf(stock); var index = list.indexOf(stock);
@ -96,7 +99,7 @@ public class StoreCheckActivity extends BaseActivity {
if (b) { if (b) {
handler.removeCallbacks(runnable); handler.removeCallbacks(runnable);
} else { } else {
handler.postDelayed(runnable, 0); handler.postDelayed(runnable, 100);
} }
checkState.set(!b); checkState.set(!b);
} }
@ -133,10 +136,10 @@ public class StoreCheckActivity extends BaseActivity {
private Runnable runnable = new Runnable() { private Runnable runnable = new Runnable() {
@Override @Override
public void run() { public void run() {
Log.e("TAG", "发送广播读取RFID"); // Log.e("TAG", "发送广播读取RFID");
// sendBroadcast(broadcastIntent); // sendBroadcast(broadcastIntent);
sanEpc(); sanEpc();
handler.postDelayed(runnable, 1000); handler.postDelayed(runnable, 0);
} }
}; };

@ -27,6 +27,7 @@ import okhttp3.MediaType;
public abstract class BaseActivity extends AppCompatActivity { public abstract class BaseActivity extends AppCompatActivity {
// public static String url = "http://192.168.0.102:8090/api"; // 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 static String url = "http://119.45.202.115:8090/api";
public ProgressDialog dialog; public ProgressDialog dialog;
public Gson gson; public Gson gson;
@ -65,7 +66,7 @@ public abstract class BaseActivity extends AppCompatActivity {
} }
public void sanEpc(){ public void sanEpc(){
List<Reader.TAGINFO> strings = uhfLongerManager.tagInventoryRealTime(); List<Reader.TAGINFO> strings = uhfLongerManager.tagInventoryRealTime();
Log.e("TAG", "驱动" + (uhfLongerManager == null)); // Log.e("TAG", "驱动" + (uhfLongerManager == null));
if (strings == null || strings.isEmpty()) { if (strings == null || strings.isEmpty()) {
return; return;
} }
@ -94,6 +95,12 @@ public abstract class BaseActivity extends AppCompatActivity {
mediaPlayer = MediaPlayer.create(this, R.raw.msg); 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 @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();

@ -45,6 +45,7 @@
android:adapter="@{adapter}" android:adapter="@{adapter}"
android:padding="10dp" android:padding="10dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@color/white"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<!-- <LinearLayout <!-- <LinearLayout
@ -135,6 +136,7 @@
android:layout_weight="1" android:layout_weight="1"
android:backgroundTint="@{checkState?@color/yellow:@color/black}" android:backgroundTint="@{checkState?@color/yellow:@color/black}"
android:onClick="offCheckRead" android:onClick="offCheckRead"
android:visibility="gone"
android:text='@{checkState?"停止读取":"开始扫描"}' android:text='@{checkState?"停止读取":"开始扫描"}'
android:textSize="20sp" /> android:textSize="20sp" />

@ -47,6 +47,7 @@
android:layout_marginEnd="15dp" android:layout_marginEnd="15dp"
android:backgroundTint="@{checkState?@color/yellow:@color/black}" android:backgroundTint="@{checkState?@color/yellow:@color/black}"
android:onClick="fp_out_read" android:onClick="fp_out_read"
android:visibility="gone"
android:text='@{checkState?"停止扫描":"自动扫描"}' android:text='@{checkState?"停止扫描":"自动扫描"}'
android:textSize="18sp" /> android:textSize="18sp" />

Loading…
Cancel
Save