修改 过滤

master
wanghao
parent 66f811b5de
commit 018149bbb6

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\wanghao\.android\avd\Pixel_XL_API_33.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2025-01-09T11:21:07.708219300Z" />
</component>
</project>

@ -10,8 +10,8 @@ android {
applicationId "com.example.beijing_daxing" applicationId "com.example.beijing_daxing"
minSdk 24 minSdk 24
targetSdk 33 targetSdk 33
versionCode 4 versionCode 5
versionName "1.4" versionName "1.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk { ndk {

@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.example.beijing_daxing",
"variantName": "debug",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 5,
"versionName": "1.5",
"outputFile": "app-debug.apk"
}
],
"elementType": "File"
}

@ -61,9 +61,7 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<activity
android:name=".OffLineCheckActivity"
android:exported="false" />
<activity <activity
android:name=".FpOutActivity" android:name=".FpOutActivity"
android:exported="false" /> android:exported="false" />

@ -49,7 +49,7 @@ public class BFActivity extends BaseActivity implements TakePictureDialog.dialog
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
setPower(SharedPreferencesUtils.getInt("powerScrapIn",17)); setPower(SharedPreferencesUtils.getInt("powerScrap",17));
uhfLongerManager.setGen2session(true); uhfLongerManager.setGen2session(true);
uhfLongerManager.asyncStartReading(); uhfLongerManager.asyncStartReading();
} }

@ -53,6 +53,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
private long inspectionId; private long inspectionId;
private int backIndex; private int backIndex;
private String code; private String code;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -105,7 +106,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
Toast.makeText(CheckActivity.this, "没有维护巡检区域", Toast.LENGTH_SHORT).show(); Toast.makeText(CheckActivity.this, "没有维护巡检区域", Toast.LENGTH_SHORT).show();
return; return;
}*/ }*/
binding.setListNumber(list.size()+""); binding.setListNumber(list.size() + "");
list1 = new ArrayList<>(); list1 = new ArrayList<>();
adapter.setList(list1); adapter.setList(list1);
// adapter.notifyDataSetChanged(); // adapter.notifyDataSetChanged();
@ -125,32 +126,18 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
public void sanRfid(List<Reader.TAGINFO> epcs) { public void sanRfid(List<Reader.TAGINFO> epcs) {
epcs.forEach(t -> { epcs.forEach(t -> {
var epc = Tools.Bytes2HexString(t.EpcId, t.EpcId.length); var epc = Tools.Bytes2HexString(t.EpcId, t.EpcId.length);
try { if (!tagList.contains(epc)) {
if (!epc.substring(0,8).equals("53574C44")) return; tagList.add(epc);
}catch (Exception e){ String s = HexAscii.hex2Str(epc);
return; var stock = new Stock();
} stock.setEpcCode(s);
stock.setLocationCode(code);
if (tagList.contains(epc)) { stock.setState("正常");
return; list1.add(stock);
} }
tagList.add(epc);
String s = HexAscii.hex2Str(epc);
var stock = new Stock();
stock.setEpcCode(s);
stock.setLocationCode(code);
stock.setState("正常");
list1.add(stock);
// var stock = new Stock();
// stock.setEpcCode(HexAscii.hex2Str(epc));
// var index = list.indexOf(stock);
// if (index != -1) {
// list.get(index).setState("正常");
// }
}); });
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
binding.setSanNumber(list1.size()+""); binding.setSanNumber(list1.size() + "");
} }
@ -159,7 +146,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
// var type = list.stream().anyMatch(t -> t.getState().equals("未检")); // var type = list.stream().anyMatch(t -> t.getState().equals("未检"));
// if (type) { // if (type) {
// 数量必须相同 // 数量必须相同
if (list.size()>list1.size()&&files.size()==0) { if (list.size() > list1.size() && files.size() == 0) {
Toast.makeText(this, "未检完全部轮挡,不允许提交", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "未检完全部轮挡,不允许提交", Toast.LENGTH_SHORT).show();
return; return;
} }
@ -167,19 +154,19 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
.params("json", gson.toJson(list1)) .params("json", gson.toJson(list1))
.params("inspectionId", inspectionId) .params("inspectionId", inspectionId)
.params("user", SharedPreferencesUtils.getstring("user", "")) .params("user", SharedPreferencesUtils.getstring("user", ""))
.params("locationCode",code) .params("locationCode", code)
.addFileParams("files", files).execute(new MyRecultCall(dialog, this) { .addFileParams("files", files).execute(new MyRecultCall(dialog, this) {
@Override @Override
public void onSuccess(Response<MyResult> response) { public void onSuccess(Response<MyResult> response) {
super.onSuccess(response); super.onSuccess(response);
Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show(); Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
Intent resultIntent = new Intent(); Intent resultIntent = new Intent();
resultIntent.putExtra("backIndex", backIndex); resultIntent.putExtra("backIndex", backIndex);
files.forEach(File::delete); files.forEach(File::delete);
setResult(RESULT_OK, resultIntent); setResult(RESULT_OK, resultIntent);
finish(); finish();
} }
}); });
} }
// 一条数据保存 // 一条数据保存
// public void check_stock(View view) { // public void check_stock(View view) {

@ -28,8 +28,10 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import cn.pda.serialport.Tools;
public class HomePageActivity extends AppCompatActivity { public class HomePageActivity extends AppCompatActivity {
private MyNetWorkReceiver myNetWorkReceiver; // private MyNetWorkReceiver myNetWorkReceiver;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -37,9 +39,17 @@ public class HomePageActivity extends AppCompatActivity {
ActivityHomePageBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_home_page); ActivityHomePageBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_home_page);
initUi(binding); initUi(binding);
UHFRManager instance = UHFRManager.getInstance(); UHFRManager instance = UHFRManager.getInstance();
MyApplication.getApplication().setUhfrManager(instance); try {
instance.setRegion(Reader.Region_Conf.RG_PRC); MyApplication.getApplication().setUhfrManager(instance);
instance.setPower(33,33); instance.setRegion(Reader.Region_Conf.RG_PRC);
instance.setPower(33,33);
boolean b = instance.setInventoryFilter(Tools.HexString2Bytes("53574C44"), 1, 2, true);
Log.e("TAG", "设置过滤:" + b);
}catch (NullPointerException e){
Toast.makeText(this, "扫描驱动异常,重新启动程序加载", Toast.LENGTH_SHORT).show();
finish();
}
} }

@ -38,12 +38,12 @@ public class InActivity extends BaseActivity implements AdapterClickCall {
private InAdapter adapter; private InAdapter adapter;
private List<String> epcList; private List<String> epcList;
private List<String> tagList; private List<String> tagList;
private ActivityInBinding binding;
private ObservableBoolean checkState; private ObservableBoolean checkState;
@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); ActivityInBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_in);
vm = new InStoreVM(); vm = new InStoreVM();
binding.setVm(vm); binding.setVm(vm);
initRequest(); initRequest();
@ -52,32 +52,28 @@ 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);
checkState=new ObservableBoolean(); checkState = new ObservableBoolean();
binding.setCheckState(checkState); binding.setCheckState(checkState);
tagList=new ArrayList<>(); tagList = new ArrayList<>();
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
setPower(SharedPreferencesUtils.getInt("powerIn",33)); setPower(SharedPreferencesUtils.getInt("powerIn", 33));
} }
@SuppressLint("NotifyDataSetChanged")
@Override @Override
public void sanRfid(List<Reader.TAGINFO> epcs) { public void sanRfid(List<Reader.TAGINFO> epcs) {
epcs.stream().forEach(t -> { epcs.forEach(t->{
var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length); var epc = Tools.Bytes2HexString(t.EpcId, t.EpcId.length);
Log.e("TAG", "sanRfid:" + epc); if (!tagList.contains(epc)) {
try {
if (!epc.substring(0,8).equals("53574C44")) return;
if (tagList.contains(epc)) return;
tagList.add(epc); tagList.add(epc);
epcList.add(HexAscii.hex2Str(epc)); epcList.add(HexAscii.hex2Str(epc));
}catch (Exception e){
} }
}); });
vm.setSanLength(epcList.size()); vm.setSanLength(epcList.size());
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
@ -94,6 +90,7 @@ public class InActivity extends BaseActivity implements AdapterClickCall {
}); });
} }
@SuppressLint("NotifyDataSetChanged")
@Override @Override
public void clickItem(int index) { public void clickItem(int index) {
tagList.remove(HexAscii.str2Hex(epcList.get(index))); tagList.remove(HexAscii.str2Hex(epcList.get(index)));
@ -133,9 +130,10 @@ public class InActivity extends BaseActivity implements AdapterClickCall {
@Override @Override
public void run() { public void run() {
sanEpc(); sanEpc();
handler.postDelayed(runnable, 10); handler.postDelayed(runnable, 50);
} }
}; };
public void instore_check(View view) { public void instore_check(View view) {
var b = checkState.get(); var b = checkState.get();
if (b) { if (b) {
@ -150,7 +148,7 @@ public class InActivity extends BaseActivity implements AdapterClickCall {
checkState.set(!b); checkState.set(!b);
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();

@ -60,11 +60,10 @@ public class OutActivity extends BaseActivity implements AdapterClickCall {
public void sanRfid(List<Reader.TAGINFO> epcs) { public void sanRfid(List<Reader.TAGINFO> epcs) {
epcs.forEach(t -> { epcs.forEach(t -> {
var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length); var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length);
Log.e("TAG", "sanRfid:" + epc); if (!tagList.contains(epc)){
if (!epc.startsWith("53574C44")) return; tagList.add(epc);
if (tagList.contains(epc)) return; epcList.add(HexAscii.hex2Str(epc));
tagList.add(epc); }
epcList.add(HexAscii.hex2Str(epc));
}); });
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }

@ -41,7 +41,7 @@
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="50dp" android:layout_marginTop="50dp"
android:gravity="left|center" android:gravity="left|center"
android:text="登录RFID机场轮挡管理系统" android:text="登录RFID机场轮挡管理系统v1.5"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="22sp" /> android:textSize="22sp" />

Loading…
Cancel
Save