Commit ac95bc6d authored by hywang's avatar hywang

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

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