Commit ac95bc6d authored by hywang's avatar hywang

1.修改上传数据为多次上传

parent 920acb04
......@@ -39,6 +39,7 @@
android:resource="@xml/file_paths" />
</provider>
<!-- android:name=".ui.cattle.activity.CattleMainActivity"-->
<activity
android:name=".ui.login.LoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
......@@ -122,12 +123,12 @@
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".ui.cattle.activity.CattleMainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<!-- <activity-->
<!-- android:name=".ui.cattle.activity.CattleMainActivity"-->
<!-- android:configChanges="keyboardHidden|orientation|screenSize"-->
<!-- android:launchMode="singleTask"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:windowSoftInputMode="stateHidden|adjustResize" />-->
<activity
android:name=".ui.cattle.activity.CattleMarkActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
......
......@@ -3,6 +3,8 @@ package com.phlx.wool;
import com.uhf.linkage.Linkage;
import org.greenrobot.greendao.query.QueryBuilder;
import me.goldze.mvvmhabit.base.BaseApplication;
import me.goldze.mvvmhabit.crash.CaocConfig;
import me.goldze.mvvmhabit.utils.KLog;
......@@ -20,6 +22,8 @@ public class App extends BaseApplication {
instance = this;
//是否开启打印日志
KLog.init(true);
QueryBuilder.LOG_SQL = true;
QueryBuilder.LOG_VALUES = true;
//初始化全局异常崩溃
initCrash();
link = new Linkage();
......
......@@ -69,8 +69,8 @@ public class Configs {
public static PrinterInstance myPrinter;
//是否是锡盟临时项目
public static boolean isCattle = true;
//是否是毛登牧场临时项目
public static boolean isCattle = false;
// public static boolean ISCONNECTED;
......
......@@ -99,7 +99,7 @@ public class VMFactory extends ViewModelProvider.NewInstanceFactory {
return (T) new SlaughterEntryVM(mApplication, repository);
//锡盟临时项目
//毛登牧场临时项目
}else if (modelClass.isAssignableFrom(CattleMainVM.class)) {
return (T) new CattleMainVM(mApplication, repository);
}else if (modelClass.isAssignableFrom(CattleMarkVM.class)) {
......
......@@ -48,14 +48,14 @@ public class RetrofitClient {
private static final int CACHE_TIMEOUT = 10 * 1024 * 1024;
//服务端根路径
public static String baseUrl =
// "58.18.92.126"//阿拉善正式
"39.101.170.186"//锡盟正式
"58.18.92.126"//阿拉善正式
// "39.101.170.186"//锡盟正式
// "192.168.12.105"//锡盟张敏测试
// "192.168.8.189"//张敏
;
public static String port =
// "899"//阿拉善正式
"8999"//锡盟正式/ 张敏
"899"//阿拉善正式
// "8999"//锡盟正式/ 张敏
// "80"
;
......
......@@ -94,11 +94,11 @@ public class CattleMainVM extends BackBarVM<Repository> {
public BindingCommand onDownloadClickCommand = new BindingCommand(new BindingAction() {
@Override
public void call() {
if (Configs.isOnLine) {
// if (Configs.isOnLine) {
DbUtil.getInstance().deleteAll(Unit.class);
farmerPageIndex = 0;
queryFarmerInputTime(farmerPageIndex, 10000);
}
// }
}
});
......
......@@ -92,6 +92,9 @@ public class CattleMarkVM extends BackBarVM<Repository> {
long idNo = IdUtil.createSnowflake(3, 1).nextId();
entity.setId(idNo + "");
entity.setPastureUnitId(SPUtils.getInstance().getString(Configs.SP_UNIT_CODE, ""));
dateFormat = new SimpleDateFormat("yyyy-MM-dd");
entity.setBirthdate(dateFormat.format(new Date()));
entity.setWeight(100 + "");
markeImgUrl = Environment.getExternalStorageDirectory().getAbsolutePath() +
"/tracing/picture/"
......
......@@ -54,7 +54,7 @@ public class CattleUploadVM extends BackBarVM<Repository> {
private void uploadMarking() {
QueryBuilder<CattleLabelEntity> builder =
DbUtil.getInstance().getQueryBuilder(CattleLabelEntity.class);
DbUtil.getInstance().getQueryBuilder(CattleLabelEntity.class).limit(20);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleLabelEntity>() {
@Override
public void onSuccess(List<CattleLabelEntity> result) {
......@@ -67,35 +67,36 @@ public class CattleUploadVM extends BackBarVM<Repository> {
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), postInfoStr);
KLog.e(postInfoStr);
addSubscribe(model.uploadCattleMark(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
.compose(RxUtils.schedulersTransformer())
.compose(RxUtils.exceptionTransformer())
.doOnSubscribe(disposable -> showDialog("正在上传基础数据..."))
.subscribe((Consumer<CattleResponse<List<CattleLabelEntity>>>) response -> {
KLog.e(response.getCode() + response.getMsg());
if (response.getCode() == 0) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() {
@Override
public void onNotification(boolean result) {
if (result) {
dismissDialog();
refreshUploadCount();
}else{
ToastUtils.showShort("删除基础数据失败");
}
.compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
.compose(RxUtils.schedulersTransformer())
.compose(RxUtils.exceptionTransformer())
.doOnSubscribe(disposable -> showDialog("正在上传基础数据..."))
.subscribe((Consumer<CattleResponse<List<CattleLabelEntity>>>) response -> {
KLog.e(response.getCode() + response.getMsg());
if (response.getCode() == 0) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() {
@Override
public void onNotification(boolean result) {
if (result) {
dismissDialog();
uploadMarking();
} else {
ToastUtils.showShort("删除基础数据失败");
}
}).deleteAsyncAll(CattleLabelEntity.class);
} else {
dismissDialog();
ToastUtils.showShort("基础数据上传失败");
}
}, (Consumer<ResponseThrowable>) throwable -> {
dismissDialog();
ToastUtils.showShort(throwable.message);
})
}
}).deleteAsyncBatch(CattleLabelEntity.class, result);
} else {
dismissDialog();
ToastUtils.showShort("基础数据上传失败");
}
}, (Consumer<ResponseThrowable>) throwable -> {
dismissDialog();
ToastUtils.showShort(throwable.message);
})
);
} else {
dismissDialog();
refreshUploadCount();
}
}
......
......@@ -25,10 +25,7 @@ import com.phlx.wool.db.gen.LabelDao;
import com.phlx.wool.db.interf.DbIDUCallBack;
import com.phlx.wool.db.interf.DbQueryCallBack;
import com.phlx.wool.entity.CacheLabel;
import com.phlx.wool.entity.EntryRegistrationEntity;
import com.phlx.wool.entity.Label;
import com.phlx.wool.entity.Marking;
import com.phlx.wool.entity.VillusBuyEntity;
import com.phlx.wool.event.EventMsg;
import com.phlx.wool.event.EventTag;
import com.phlx.wool.rfid.ModuleManager;
......@@ -400,7 +397,6 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
ToastUtils.showShort("请扫描耳标");
}
}
/**
......
......@@ -205,6 +205,7 @@
android:hint="请输入体重"
android:inputType="numberDecimal"
android:maxLines="1"
android:maxLength="10"
android:text="@={viewModel.entity.weight}"
android:textSize="@dimen/edit_size"
binding:layout_constraintBottom_toTopOf="@+id/weight_edit"
......@@ -232,6 +233,7 @@
android:background="@drawable/input_frame_bg"
android:hint="请输入胸围"
android:maxLines="1"
android:maxLength="10"
android:inputType="numberDecimal"
android:text="@={viewModel.entity.bust}"
android:textSize="@dimen/edit_size"
......@@ -260,6 +262,7 @@
android:background="@drawable/input_frame_bg"
android:hint="请输入管维"
android:maxLines="1"
android:maxLength="10"
android:inputType="numberDecimal"
android:text="@={viewModel.entity.tubeCircumference}"
android:textSize="@dimen/edit_size"
......@@ -289,6 +292,7 @@
android:background="@drawable/input_frame_bg"
android:hint="请输入体高"
android:maxLines="1"
android:maxLength="10"
android:inputType="numberDecimal"
android:text="@={viewModel.entity.bodyHeight}"
android:textSize="@dimen/edit_size"
......@@ -319,6 +323,7 @@
android:hint="请输入体斜长"
android:maxLines="1"
android:inputType="numberDecimal"
android:maxLength="10"
android:text="@={viewModel.entity.bodyObliqueLength}"
android:textSize="@dimen/edit_size"
binding:layout_constraintBottom_toTopOf="@+id/twin_sheep_cb"
......
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