Commit 50287ea2 authored by hywang's avatar hywang

修改一些bug

parent 825466bc
......@@ -39,6 +39,7 @@ public class Configs {
public static final String SP_USER_NAME = "sp_user_name";
public static final String SP_ID = "sp_id";
public static final String SP_NAME = "sp_name";
public static final String SP_FREQUENCY = "sp_frequency";
public static final String SP_USER_PASSWORD = "sp_user_password";
public static final String SP_USER_EMAIL = "sp_user_email";
public static final String SP_FREQUENCY_CONFIG = "sp_frequency_config";
......
......@@ -32,7 +32,7 @@ import java.util.List;
*/
public class DbUtil {
private static final String DEFAULT_DATABASE_NAME = "CattleManager.db";
private static final String DEFAULT_DATABASE_NAME = "WoolManager.db";
private static final String DEFAULT_DATABASE_PASSWORD = "phx123456";
private DaoSession mDaoSession;
private DaoMaster mDaoMaster;
......
......@@ -50,7 +50,7 @@ public class Label extends BaseObservable implements Parcelable {
/**
* 耳标tid
*/
@Index(name = "LabelTid", unique = true)
@Index(name = "LabelTid", unique = false)
@SerializedName("innercode")
private String Tid;
......
......@@ -47,7 +47,7 @@ public class RetrofitClient {
//缓存时间
private static final int CACHE_TIMEOUT = 10 * 1024 * 1024;
//服务端根路径
public static String baseUrl = "192.168.8.182";
public static String baseUrl = "192.168.8.189";
public static String port = "80";
private static Context mContext = Utils.getContext();
......
......@@ -208,9 +208,10 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
legalCount = 0;
KLog.e(mList.toString());
for (int i = 0; i < mList.size(); i++) {
List<Label> allLablel = DbUtil.getInstance().queryAll(Label.class);
QueryBuilder<Label> builder =
DbUtil.getInstance().getQueryBuilder(Label.class)
.where(LabelDao.Properties.Tid.eq(mList.get(i).getTid()));
.where(LabelDao.Properties.Epc.eq(mList.get(i).getEpc()));
List<Label> labels = DbUtil.getInstance().queryAll(Label.class, builder);
//合法状态 0 非法 1 合法
if (labels.size() == 0) {
......
......@@ -127,7 +127,7 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding, LoginVM> {
//设置强制更新
.setForcedUpgrade(true);
DownloadManager manager = DownloadManager.getInstance(this);
manager.setApkName("CattleManager.apk")
manager.setApkName("WoolManager.apk")
.setApkUrl(downloadUrl)
.setSmallIcon(R.mipmap.ic_launcher)
.setShowNewerToast(true)
......
......@@ -141,6 +141,7 @@ public class LoginVM extends BackBarVM<Repository> {
model.saveBreed(response.getData().getUser().getDept().getDeptName());
SPUtils.getInstance().put(Configs.SP_ID, response.getData().getUser().getUserId());
SPUtils.getInstance().put(Configs.SP_NAME, response.getData().getUser().getUserName());
SPUtils.getInstance().put(Configs.SP_FREQUENCY, response.getData().getUser().getFrequencyConfig());
}
VMFactory.getInstance(getApplication()).refreshRepository();
if (SPUtils.getInstance().getBoolean("isFirst", true)) {
......@@ -191,6 +192,7 @@ public class LoginVM extends BackBarVM<Repository> {
ToastUtils.showShort("密码错误");
return;
}
Configs.FREQUENCY_CONFIG = SPUtils.getInstance().getString(Configs.SP_FREQUENCY);
startActivity(MainActivity.class);
finish();
} else {
......
......@@ -53,7 +53,7 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding, SplashVM
if (result != null && result.size() > 0) {
inputTime = result.get(0).getTimestamp();
}
viewModel.requestLabel(0, inputTime, 100000);
viewModel.requestLabel(1, inputTime, 100000);
}
@Override
......
......@@ -38,7 +38,7 @@ public class SplashVM extends MainBarVM<Repository> {
public SingleLiveEvent<String> errorEvent = new SingleLiveEvent<>();
private int labelPageIndex = 0;
private int labelPageIndex = 1;
private int unitPageIndex = 0;
public SplashVM(@NonNull Application application, Repository repository) {
......
......@@ -145,9 +145,9 @@ public class UploadVM extends BackBarVM<Repository> {
uploadHarmless();
} else if (isUploadQuarantine.get() && !isQuarantineUpload) {
uploadQuarantine();
} else if (isUploadMarking.get() && !isVillusBuyUpload) {
} else if (isUploadVillusBuy.get() && !isVillusBuyUpload) {
uploadVillusBuy();
} else if (isUploadMarking.get() && !isVillusGaugeUpload) {
} else if (isUploadVillusGauge.get() && !isVillusGaugeUpload) {
uploadVillusGauge();
} else {
ToastUtils.showShort("请选择上传的项目");
......
......@@ -5,6 +5,7 @@ import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Toast;
import androidx.annotation.NonNull;
......@@ -58,7 +59,7 @@ public class VillusBuyVM extends BackBarVM<Repository> {
public VillusBuyEntity entity;
public List<IKeyAndValue> superiorPertainItemData;
public List<IKeyAndValue> pertainItemData;
private List<String> lists ;
private List<String> lists;
private List<VillusBuyEntity> uploadData;
......@@ -71,10 +72,14 @@ public class VillusBuyVM extends BackBarVM<Repository> {
private ArrayAdapter<String> spinnerAdapter;
private Long id;
public VillusBuyVM(@NonNull Application application, Repository model) {
super(application, model);
id = IdUtil.createSnowflake(3, 1).nextId();
if (entity == null) {
entity = new VillusBuyEntity();
}
......@@ -144,7 +149,7 @@ public class VillusBuyVM extends BackBarVM<Repository> {
}
});
public ArrayAdapter getAdapter(VillusBuyActivity cls){
public ArrayAdapter getAdapter(VillusBuyActivity cls) {
spinnerAdapter = new ArrayAdapter<>(cls, R.layout.simple_spinner_item, lists);
spinnerAdapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
return spinnerAdapter;
......@@ -178,7 +183,7 @@ public class VillusBuyVM extends BackBarVM<Repository> {
}
uploadData = new ArrayList<>();
entity.setId(IdUtil.createSnowflake(3, 1).nextId());
entity.setId(id);
entity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_NAME));
entity.setCreateTime(dateFormat.format(new Date()));
entity.setStatus(1);
......@@ -199,6 +204,7 @@ public class VillusBuyVM extends BackBarVM<Repository> {
if (Configs.isOnLine) {
uploadVillusBuy();
} else {
ToastUtils.showShort("绒毛购买保存成功");
backMain();
}
}
......@@ -230,13 +236,14 @@ public class VillusBuyVM extends BackBarVM<Repository> {
public void onNotification(boolean result) {
if (result) {
dismissDialog();
ToastUtils.showShort("绒毛购买上传成功");
printEvent.call();
}
}
}).insertAsyncBatch(VillusBuyEntity.class, uploadData);
} else {
dismissDialog();
ToastUtils.showShort("上传失败");
ToastUtils.showShort("绒毛购买上传失败");
}
}, (Consumer<ResponseThrowable>) throwable -> {
dismissDialog();
......
......@@ -48,10 +48,13 @@ public class VillusGaugeVM extends BackBarVM<Repository> {
private List<VillusGaugeEntity> uploadData;
private Long id;
public VillusGaugeVM(@NonNull Application application, Repository model) {
super(application, model);
id = IdUtil.createSnowflake(3, 1).nextId();
if (entity == null) {
entity = new VillusGaugeEntity();
}
......@@ -123,7 +126,7 @@ public class VillusGaugeVM extends BackBarVM<Repository> {
}
uploadData = new ArrayList<>();
entity.setId(IdUtil.createSnowflake(3, 1).nextId());
entity.setId(id);
entity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_NAME));
entity.setCreateTime(dateFormat.format(new Date()));
entity.setStatus(1);
......
......@@ -52,7 +52,7 @@ public class HarmlessVM extends BackBarVM<Repository> {
public SingleLiveEvent<Boolean> showSearch = new SingleLiveEvent<>();
private ArrayList<Label> labels;
private SimpleDateFormat dateFormat;
private long parentId;
private long parentId= -1;
public HarmlessVM(@NonNull Application application, Repository repository) {
super(application, repository);
......@@ -184,13 +184,13 @@ public class HarmlessVM extends BackBarVM<Repository> {
QueryBuilder<HarmlessDetail> builder =
DbUtil.getInstance().getQueryBuilder(HarmlessDetail.class).
where(HarmlessDetailDao.Properties.HarmlessId.eq(parentId));
List<HarmlessDetail> harmlessDetails = DbUtil.getInstance().queryAll(HarmlessDetail.class
, builder);
List<HarmlessDetail> harmlessDetails = DbUtil.getInstance().queryAll(HarmlessDetail.class, builder);
harmless.setList(harmlessDetails);
String postInfoStr =
new GsonBuilder().serializeNulls().excludeFieldsWithoutExposeAnnotation().create().toJson(new UploadParams<Harmless>(harmless));
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"),
postInfoStr);
new GsonBuilder().serializeNulls()
// .excludeFieldsWithoutExposeAnnotation()
.create().toJson(new UploadParams<Harmless>(harmless));
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), postInfoStr);
KLog.e(postInfoStr);
addSubscribe(model.submitHarmless(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
......
......@@ -206,7 +206,9 @@ public class MarkingVM extends BackBarVM<Repository> {
*/
private void uploadMarking() {
String postInfoStr =
new GsonBuilder().serializeNulls().excludeFieldsWithoutExposeAnnotation().create().toJson(new UploadParams<List<Marking>>(uploadData));
new GsonBuilder().serializeNulls()
// .excludeFieldsWithoutExposeAnnotation()
.create().toJson(new UploadParams<List<Marking>>(uploadData));
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"),
postInfoStr);
KLog.e(postInfoStr);
......
......@@ -185,7 +185,9 @@ public class QuarantineVM extends BackBarVM<Repository> {
DbUtil.getInstance().queryAll(QuarantineDetail.class, builder);
quarantine.setList(quarantineDetails);
String postInfoStr =
new GsonBuilder().serializeNulls().excludeFieldsWithoutExposeAnnotation().create().toJson(new UploadParams<Quarantine>(quarantine));
new GsonBuilder().serializeNulls()
// .excludeFieldsWithoutExposeAnnotation()
.create().toJson(new UploadParams<Quarantine>(quarantine));
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"),
postInfoStr);
KLog.e(postInfoStr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment