增加 更新

idata
wanghao
parent 55ed1c5cfb
commit 685451d5c9

@ -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

@ -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

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

@ -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());

@ -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();

@ -49,6 +49,7 @@ public class StoreCheckActivity extends BaseActivity {
checkAdapter = new StoreCheckAdapter(this);
binding.setAdapter(checkAdapter);
initRequest();
setPower(33);
}
private List<String> tagList;
@ -56,12 +57,14 @@ public class StoreCheckActivity extends BaseActivity {
@Override
protected void sanRfid(List<Reader.TAGINFO> 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);
}
};

@ -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<Reader.TAGINFO> 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();

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

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

Loading…
Cancel
Save