增加 解绑功能

fengshen
wanghao 3 months ago
parent 5722c0f6fc
commit 1d216c6e86

@ -70,11 +70,11 @@
<activity
android:name=".MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
</activity>
</application>

@ -22,9 +22,17 @@ public class HomeActivity extends BaseActivity {
MyApplication.getApplication().setUhfrManager(uhfrManager);
RadioButton button1 = this.findViewById(R.id.home_1);
RadioButton button2 = this.findViewById(R.id.home_2);
RadioButton button1_1 = this.findViewById(R.id.home_1_1);
Intent intent = new Intent(this, ShuangqianActivity.class);
button1.setOnClickListener(v -> {
startActivity(new Intent(this, ShuangqianActivity.class));
intent.putExtra("type",true);
startActivity(intent);
});
button1_1.setOnClickListener(v -> {
intent.putExtra("type",false);
startActivity(intent);
});
button2.setOnClickListener(v -> {
startActivity(new Intent(this, ShuangqianActivity2.class));
});

@ -21,7 +21,7 @@ public class ShuangqianActivity extends BaseActivity implements MyScannerCall {
private ActivityShuangqianBinding binding;
private MyScannerReceiver myReceiver;
private String uriLastStr;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -35,8 +35,10 @@ public class ShuangqianActivity extends BaseActivity implements MyScannerCall {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("com.rfid.SCAN");
registerReceiver(myReceiver, intentFilter);
boolean type = getIntent().getBooleanExtra("type", true);
binding.setTitle(type ? "MES轮胎绑定" : "解绑");
binding.setType(type);
uriLastStr = type ? "barcodeAndRFIDBinding" : "unBinding";
}
// 读取
@ -65,30 +67,38 @@ public class ShuangqianActivity extends BaseActivity implements MyScannerCall {
// callWebService(buildSoapRequest(epc, code));//双钱
}
private void haohuaSubmit(String epc, String code) {
OkGo.<MyResult>post("http://192.168.26.26:5050/UMInterface/RFID/barcodeAndRFIDBinding")
.params("rfid", epc).params("barCode", code).execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
MyResult body = response.body();
try {
if (body.getCode() == 200) {
tipsDialog.setTip(true, body.getInfo());
tipsDialog.show();
binding.socketBarcode.setText(null);
binding.socketEpc.setText(null);
} else {
tipsDialog.setTip(false, body.getInfo());
tipsDialog.show();
}
} catch (Exception e) {
tipsDialog.setTip(false, "接口返回信息异常");
tipsDialog.show();
}
// 解绑
public void unBindingSubmit(View view) {
String epc = binding.socketEpc.getText().toString();
String code = binding.socketBarcode.getText().toString();
}
});
haohuaSubmit(epc, code);
}
private void haohuaSubmit(String epc, String code) {
OkGo.<MyResult>post("http://192.168.26.26:5050/UMInterface/RFID/" + uriLastStr)
.params("rfid", epc).params("barCode", code).execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
MyResult body = response.body();
try {
if (body.getCode() == 200) {
tipsDialog.setTip(true, body.getInfo());
tipsDialog.show();
binding.socketBarcode.setText(null);
binding.socketEpc.setText(null);
} else {
tipsDialog.setTip(false, body.getInfo());
tipsDialog.show();
}
} catch (Exception e) {
tipsDialog.setTip(false, "接口返回信息异常");
tipsDialog.show();
}
}
});
}

@ -55,9 +55,39 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:visibility="gone"
android:orientation="horizontal">
<RadioButton
android:id="@+id/home_1_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:drawableTop="@mipmap/ic_un"
android:drawablePadding="10dp"
android:gravity="center"
android:text="解绑"
android:textSize="20sp" />
<RadioButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:drawablePadding="10dp"
android:gravity="center"
android:textSize="20sp" />
</RadioGroup>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:visibility="gone">
<RadioButton
android:id="@+id/home_3"
android:layout_width="match_parent"

@ -4,6 +4,14 @@
<data>
<variable
name="title"
type="String" />
<import type="android.view.View" />
<variable
name="type"
type="Boolean" />
</data>
<LinearLayout
@ -21,7 +29,7 @@
android:layout_gravity="center"
android:background="#6750A4"
android:letterSpacing="0.2"
android:text="MES轮胎绑定"
android:text="@{title}"
android:textColor="@color/white"
android:textSize="22sp"
android:textStyle="bold" />
@ -40,7 +48,7 @@
android:layout_gravity="center"
android:text="扫描条码:" />
<TextView
<EditText
android:id="@+id/socket_barcode"
style="@style/san_text"
android:layout_width="match_parent"
@ -90,9 +98,18 @@
android:layout_width="match_parent"
android:layout_height="65dp"
android:onClick="submit"
android:visibility="@{type?View.VISIBLE:View.GONE}"
android:text="数据提交" />
<Button
style="@style/button_style"
android:layout_width="match_parent"
android:layout_height="65dp"
android:onClick="unBindingSubmit"
android:backgroundTint="#DD2C00"
android:visibility="@{type?View.GONE:View.VISIBLE}"
android:text="解绑提交" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

@ -45,7 +45,8 @@
<item name="android:letterSpacing">0.2</item>
<item name="android:layout_marginStart">20dp</item>
<item name="android:layout_marginEnd">20dp</item>
<item name="android:layout_marginTop">10dp</item>
<item name="android:layout_marginTop">5dp</item>
<item name="android:layout_marginBottom">5dp</item>
</style>
<style name="button_style1">
<item name="android:textColor">@color/white</item>

Loading…
Cancel
Save