|
|
|
@ -24,6 +24,7 @@ import com.example.jinyu_rfid.databinding.ActivityWriteUserBinding;
|
|
|
|
|
import com.example.jinyu_rfid.rfid.C5106Device;
|
|
|
|
|
import com.example.jinyu_rfid.rfid.RFIDModel;
|
|
|
|
|
import com.example.jinyu_rfid.uitls.ASCIIUtil;
|
|
|
|
|
import com.example.jinyu_rfid.uitls.SharedPreferencesUtils;
|
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
@ -46,11 +47,11 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
|
|
|
|
|
private List<ReadTyreNoResult> list;
|
|
|
|
|
private PopupMenu popupMenu;
|
|
|
|
|
|
|
|
|
|
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
binding = DataBindingUtil.setContentView(this, R.layout.activity_write_user);
|
|
|
|
|
rfidModel = new C5106Device(this);
|
|
|
|
|
intent1 = new Intent(this, ReadActivity.class);
|
|
|
|
|
intent1.putExtra("work", 1);
|
|
|
|
|
intent2 = new Intent(this, ConfigurationTableActivity.class);
|
|
|
|
@ -61,6 +62,7 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
|
|
|
|
|
popupMenu = new PopupMenu(this, binding.writeMenu);
|
|
|
|
|
popupMenu.setOnMenuItemClickListener(this);
|
|
|
|
|
getMenuInflater().inflate(R.menu.activity_menu, popupMenu.getMenu());
|
|
|
|
|
rfidModel = new C5106Device(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -68,6 +70,12 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
|
|
|
|
|
rfidModel.sanEpc(6);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onDestroy() {
|
|
|
|
|
super.onDestroy();
|
|
|
|
|
rfidModel.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean writeUserState = false;
|
|
|
|
|
|
|
|
|
|
// 写入
|
|
|
|
@ -104,6 +112,7 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
|
|
|
|
|
map.put("EpcCode", epcStr);
|
|
|
|
|
map.put("TyreNo", list.get(0).getPropertyContent());
|
|
|
|
|
map.put("token", "123456");
|
|
|
|
|
map.put("Language", SharedPreferencesUtils.getstring("languageIndex","0"));
|
|
|
|
|
Log.e("TAG", "writeUser:" + 2);
|
|
|
|
|
OkGo.<MyResult>post(url + "/write").upRequestBody(RequestBody.create(JSON, gson.toJson(map))).execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
|
@ -171,6 +180,7 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("TyreNo", erCode);
|
|
|
|
|
map.put("token", "123456");
|
|
|
|
|
map.put("Language", SharedPreferencesUtils.getstring("languageIndex","0"));
|
|
|
|
|
OkGo.<MyResult>post(url + "/readTyreNo").upRequestBody(RequestBody.create(JSON, gson.toJson(map))).execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
|
|
@Override
|
|
|
|
|