Commit 055bbf52 authored by hywang's avatar hywang

1.修改登录后获取信息接口,增加了冻精数据获取;

2.基础信息保存后,自动查找父冻精的信息添加到系谱里;
3.修改保存数据库只能操作一个表,现在可以多表一起 操作;
4.优化了基础信息的数字输入判断,无法输入非法符号。
parent bdf9178e
...@@ -3,3 +3,10 @@ ...@@ -3,3 +3,10 @@
!/.idea/ !/.idea/
!/.idea/deploymentTargetDropDown.xml !/.idea/deploymentTargetDropDown.xml
!/.idea/libraries/
!/.idea/modules/
!/.idea/modules/AnchorCollect.iml
!/.idea/modules/mycontrol/
!/.idea/modules/mvvmhabit/
!/.idea/modules/appupdateX/
!/.idea/modules/app/
...@@ -9,8 +9,8 @@ android { ...@@ -9,8 +9,8 @@ android {
applicationId "com.phlx.anchorcollect" applicationId "com.phlx.anchorcollect"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 19 versionCode 20
versionName "2.2.0" versionName "2.2.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
......
...@@ -7,6 +7,7 @@ import android.graphics.Typeface; ...@@ -7,6 +7,7 @@ import android.graphics.Typeface;
import com.phlx.anchorcollect.entity.CattleResumeEntity; import com.phlx.anchorcollect.entity.CattleResumeEntity;
import com.phlx.anchorcollect.entity.DictEntity; import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.FrozenSemenEntity;
import com.phlx.anchorcollect.entity.GenTableColumn; import com.phlx.anchorcollect.entity.GenTableColumn;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -135,6 +136,8 @@ public class Configs { ...@@ -135,6 +136,8 @@ public class Configs {
//字典项 //字典项
public static List<DictEntity> dictList = new ArrayList<>(); public static List<DictEntity> dictList = new ArrayList<>();
public static List<FrozenSemenEntity> frozenSemenList = new ArrayList<>();
//临时存放列表查询可视耳标 //临时存放列表查询可视耳标
public static String tempTag = ""; public static String tempTag = "";
//临时存放列表查询电子耳标 //临时存放列表查询电子耳标
......
...@@ -14,6 +14,7 @@ import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity; ...@@ -14,6 +14,7 @@ import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity;
import com.phlx.anchorcollect.entity.ImmuneBatchEntity; import com.phlx.anchorcollect.entity.ImmuneBatchEntity;
import com.phlx.anchorcollect.entity.InspectEntity; import com.phlx.anchorcollect.entity.InspectEntity;
import com.phlx.anchorcollect.entity.LoginData; import com.phlx.anchorcollect.entity.LoginData;
import com.phlx.anchorcollect.entity.LoginInfoData;
import com.phlx.anchorcollect.entity.MedicalRecordEntity; import com.phlx.anchorcollect.entity.MedicalRecordEntity;
import com.phlx.anchorcollect.entity.PerformanceEntity; import com.phlx.anchorcollect.entity.PerformanceEntity;
import com.phlx.anchorcollect.entity.WeightManEntity; import com.phlx.anchorcollect.entity.WeightManEntity;
...@@ -79,7 +80,7 @@ public class Repository extends BaseModel implements HttpDataSource, LocalDataSo ...@@ -79,7 +80,7 @@ public class Repository extends BaseModel implements HttpDataSource, LocalDataSo
} }
@Override @Override
public Observable<ListResponse<DictEntity>> downloadDict() { public Observable<CollectResponse<LoginInfoData>> downloadDict() {
return mHttpDataSource.downloadDict(); return mHttpDataSource.downloadDict();
} }
......
...@@ -10,6 +10,7 @@ import com.phlx.anchorcollect.entity.ImmuneBatchEntity; ...@@ -10,6 +10,7 @@ import com.phlx.anchorcollect.entity.ImmuneBatchEntity;
import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity; import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity;
import com.phlx.anchorcollect.entity.InspectEntity; import com.phlx.anchorcollect.entity.InspectEntity;
import com.phlx.anchorcollect.entity.LoginData; import com.phlx.anchorcollect.entity.LoginData;
import com.phlx.anchorcollect.entity.LoginInfoData;
import com.phlx.anchorcollect.entity.MedicalRecordEntity; import com.phlx.anchorcollect.entity.MedicalRecordEntity;
import com.phlx.anchorcollect.entity.PerformanceEntity; import com.phlx.anchorcollect.entity.PerformanceEntity;
import com.phlx.anchorcollect.entity.WeightManEntity; import com.phlx.anchorcollect.entity.WeightManEntity;
...@@ -65,7 +66,7 @@ public interface ApiService { ...@@ -65,7 +66,7 @@ public interface ApiService {
* 获取字典项列表 * 获取字典项列表
*/ */
@POST("/api/dict/data/list") @POST("/api/dict/data/list")
Observable<ListResponse<DictEntity>> downloadDict(); Observable<CollectResponse<LoginInfoData>> downloadDict();
/** /**
* 获取基础信息列表 * 获取基础信息列表
......
...@@ -10,6 +10,7 @@ import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity; ...@@ -10,6 +10,7 @@ import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity;
import com.phlx.anchorcollect.entity.ImmuneBatchEntity; import com.phlx.anchorcollect.entity.ImmuneBatchEntity;
import com.phlx.anchorcollect.entity.InspectEntity; import com.phlx.anchorcollect.entity.InspectEntity;
import com.phlx.anchorcollect.entity.LoginData; import com.phlx.anchorcollect.entity.LoginData;
import com.phlx.anchorcollect.entity.LoginInfoData;
import com.phlx.anchorcollect.entity.MedicalRecordEntity; import com.phlx.anchorcollect.entity.MedicalRecordEntity;
import com.phlx.anchorcollect.entity.PerformanceEntity; import com.phlx.anchorcollect.entity.PerformanceEntity;
import com.phlx.anchorcollect.entity.WeightManEntity; import com.phlx.anchorcollect.entity.WeightManEntity;
...@@ -57,7 +58,7 @@ public interface HttpDataSource { ...@@ -57,7 +58,7 @@ public interface HttpDataSource {
/** /**
* 获取字典项列表 * 获取字典项列表
*/ */
Observable<ListResponse<DictEntity>> downloadDict(); Observable<CollectResponse<LoginInfoData>> downloadDict();
/** /**
* 获取基础信息列表 * 获取基础信息列表
......
...@@ -10,6 +10,7 @@ import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity; ...@@ -10,6 +10,7 @@ import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity;
import com.phlx.anchorcollect.entity.ImmuneBatchEntity; import com.phlx.anchorcollect.entity.ImmuneBatchEntity;
import com.phlx.anchorcollect.entity.InspectEntity; import com.phlx.anchorcollect.entity.InspectEntity;
import com.phlx.anchorcollect.entity.LoginData; import com.phlx.anchorcollect.entity.LoginData;
import com.phlx.anchorcollect.entity.LoginInfoData;
import com.phlx.anchorcollect.entity.MedicalRecordEntity; import com.phlx.anchorcollect.entity.MedicalRecordEntity;
import com.phlx.anchorcollect.entity.PerformanceEntity; import com.phlx.anchorcollect.entity.PerformanceEntity;
import com.phlx.anchorcollect.entity.WeightManEntity; import com.phlx.anchorcollect.entity.WeightManEntity;
...@@ -71,7 +72,7 @@ public class HttpDataSourceImpl implements HttpDataSource { ...@@ -71,7 +72,7 @@ public class HttpDataSourceImpl implements HttpDataSource {
} }
@Override @Override
public Observable<ListResponse<DictEntity>> downloadDict() { public Observable<CollectResponse<LoginInfoData>> downloadDict() {
return apiService.downloadDict(); return apiService.downloadDict();
} }
......
...@@ -32,13 +32,13 @@ import java.util.List; ...@@ -32,13 +32,13 @@ import java.util.List;
*/ */
public class DbUtil { public class DbUtil {
private static final String DEFAULT_DATABASE_NAME = "AnchorCollect.db"; private static final String DEFAULT_DATABASE_NAME = "BstManager.db";
private static final String DEFAULT_DATABASE_PASSWORD = "phx123456"; private static final String DEFAULT_DATABASE_PASSWORD = "phx123456";
private DaoSession mDaoSession; private DaoSession mDaoSession;
private DaoMaster mDaoMaster; private DaoMaster mDaoMaster;
private AbstractDao mAbstractDao; private AbstractDao mAbstractDao;
private static DbUtil mDbUtils; private static DbUtil mDbUtils;
private MyOpenHelper mHelper; private DaoMaster.DevOpenHelper mHelper;
private DbQueryCallBack mQueryCallBack; private DbQueryCallBack mQueryCallBack;
private DbIDUCallBack mIDUCallBack; private DbIDUCallBack mIDUCallBack;
...@@ -47,11 +47,9 @@ public class DbUtil { ...@@ -47,11 +47,9 @@ public class DbUtil {
mHelper = new MyOpenHelper(application, dbName, null); mHelper = new MyOpenHelper(application, dbName, null);
} }
if (passWord == null || passWord.isEmpty()) { if (passWord == null || passWord.isEmpty()) {
mDaoMaster = new DaoMaster(mHelper.getWritableDatabase()); mDaoMaster = new DaoMaster(mHelper.getWritableDb());
// mDaoMaster = new DaoMaster(mHelper.getWritableDb());
} else { } else {
mDaoMaster = new DaoMaster(mHelper.getEncryptedReadableDb(passWord)); mDaoMaster = new DaoMaster(mHelper.getEncryptedReadableDb(passWord));
// mDaoMaster = new DaoMaster(mHelper.getEncryptedReadableDb(passWord));
} }
mDaoSession = mDaoMaster.newSession(); mDaoSession = mDaoMaster.newSession();
...@@ -79,6 +77,21 @@ public class DbUtil { ...@@ -79,6 +77,21 @@ public class DbUtil {
return mDbUtils; return mDbUtils;
} }
/**
* 用于获取当前dao
* @param entityClass
* @return
*/
private AbstractDao getCurDao(Class entityClass){
AbstractDao curDao ;
if (mHelper == null) {
throw new NullPointerException("You need to init mHelper first!");
}
curDao = mDaoSession.getDao(entityClass);
return curDao;
}
public <T> Query<T> getQuery(Class<T> claz) { public <T> Query<T> getQuery(Class<T> claz) {
return getQueryBuilder(claz).build(); return getQueryBuilder(claz).build();
} }
...@@ -93,8 +106,8 @@ public class DbUtil { ...@@ -93,8 +106,8 @@ public class DbUtil {
* @return * @return
*/ */
public <T> Long count(Class<T> entityClaz) { public <T> Long count(Class<T> entityClaz) {
setCurrentDao(entityClaz); // setCurrentDao(entityClaz);
return mAbstractDao.count(); return getCurDao(entityClaz).count();
} }
/** /**
...@@ -103,8 +116,8 @@ public class DbUtil { ...@@ -103,8 +116,8 @@ public class DbUtil {
* @param dbEntity * @param dbEntity
*/ */
public <T> void insert(T dbEntity) { public <T> void insert(T dbEntity) {
setCurrentDao(dbEntity.getClass()); // setCurrentDao(dbEntity.getClass());
mAbstractDao.insert(dbEntity); getCurDao(dbEntity.getClass()).insert(dbEntity);
} }
/** /**
...@@ -113,8 +126,8 @@ public class DbUtil { ...@@ -113,8 +126,8 @@ public class DbUtil {
* @param dbEntity * @param dbEntity
*/ */
public <T> long insertOrReplace(T dbEntity) { public <T> long insertOrReplace(T dbEntity) {
setCurrentDao(dbEntity.getClass()); // setCurrentDao(dbEntity.getClass());
return mAbstractDao.insertOrReplace(dbEntity); return getCurDao(dbEntity.getClass()).insertOrReplace(dbEntity);
} }
/** /**
...@@ -127,16 +140,22 @@ public class DbUtil { ...@@ -127,16 +140,22 @@ public class DbUtil {
if (entities == null || entities.size() < 1) { if (entities == null || entities.size() < 1) {
return; return;
} }
setCurrentDaoOfList(entities); // setCurrentDaoOfList(entities);
mAbstractDao.insertInTx(entities); if(entities!=null && entities.size()>0) {
Iterator<T> iterator = entities.iterator();
T next = iterator.next();
getCurDao(next.getClass()).insertInTx(entities);
}
} }
public <T> void insertOrReplaceInTx(List<T> entities) { public <T> void insertOrReplaceInTx(List<T> entities) {
if (entities == null || entities.size() < 1) { if (entities == null || entities.size() < 1) {
return; return;
} }
setCurrentDaoOfList(entities); // setCurrentDaoOfList(entities);
mAbstractDao.insertOrReplaceInTx(entities); Iterator<T> iterator = entities.iterator();
T next = iterator.next();
getCurDao(next.getClass()).insertOrReplaceInTx(entities);
} }
/** /**
...@@ -145,8 +164,8 @@ public class DbUtil { ...@@ -145,8 +164,8 @@ public class DbUtil {
* @param entity * @param entity
*/ */
public <T> void delete(T entity) { public <T> void delete(T entity) {
setCurrentDao(entity.getClass()); // setCurrentDao(entity.getClass());
mAbstractDao.delete(entity); getCurDao(entity.getClass()).delete(entity);
} }
/** /**
...@@ -155,8 +174,8 @@ public class DbUtil { ...@@ -155,8 +174,8 @@ public class DbUtil {
* @param id * @param id
*/ */
public <T> void deleteById(Class<T> entityClaz, long id) { public <T> void deleteById(Class<T> entityClaz, long id) {
setCurrentDao(entityClaz); // setCurrentDao(entityClaz);
mAbstractDao.deleteByKey(id); getCurDao(entityClaz).deleteByKey(id);
} }
/** /**
...@@ -165,16 +184,18 @@ public class DbUtil { ...@@ -165,16 +184,18 @@ public class DbUtil {
* @param entities * @param entities
*/ */
public <T> void deleteList(List<T> entities) { public <T> void deleteList(List<T> entities) {
setCurrentDaoOfList(entities); // setCurrentDaoOfList(entities);
mAbstractDao.deleteInTx(entities); Iterator<T> iterator = entities.iterator();
T next = iterator.next();
getCurDao(next.getClass()).deleteInTx(entities);
} }
/** /**
* 全部删除 * 全部删除
*/ */
public <T> void deleteAll(Class<T> claz) { public <T> void deleteAll(Class<T> claz) {
setCurrentDao(claz); // setCurrentDao(claz);
mAbstractDao.deleteAll(); getCurDao(claz).deleteAll();
} }
/** /**
...@@ -183,8 +204,8 @@ public class DbUtil { ...@@ -183,8 +204,8 @@ public class DbUtil {
* @param entity * @param entity
*/ */
public <T> void updateData(final T entity) { public <T> void updateData(final T entity) {
setCurrentDao(entity.getClass()); // setCurrentDao(entity.getClass());
mAbstractDao.update(entity); getCurDao(entity.getClass()).update(entity);
} }
/** /**
...@@ -193,8 +214,10 @@ public class DbUtil { ...@@ -193,8 +214,10 @@ public class DbUtil {
* @param entities * @param entities
*/ */
public <T> void updateListData(Collection<T> entities) { public <T> void updateListData(Collection<T> entities) {
setCurrentDaoOfList(entities); // setCurrentDaoOfList(entities);
mAbstractDao.updateInTx(entities); Iterator<T> iterator = entities.iterator();
T next = iterator.next();
getCurDao(next.getClass()).updateInTx(entities);
} }
/** /**
...@@ -204,8 +227,8 @@ public class DbUtil { ...@@ -204,8 +227,8 @@ public class DbUtil {
* @return * @return
*/ */
public <T> T queryById(Class<T> claz, long id) { public <T> T queryById(Class<T> claz, long id) {
setCurrentDao(claz); // setCurrentDao(claz);
return (T) mAbstractDao.load(id); return (T) getCurDao(claz).load(id);
} }
/** /**
...@@ -214,24 +237,24 @@ public class DbUtil { ...@@ -214,24 +237,24 @@ public class DbUtil {
* @return * @return
*/ */
public <T> List<T> queryAll(Class<T> claz) { public <T> List<T> queryAll(Class<T> claz) {
setCurrentDao(claz); // setCurrentDao(claz);
return mAbstractDao.loadAll(); return getCurDao(claz).loadAll();
} }
public <T> List<T> queryAll(Class<T> claz, WhereCondition whereCondition) { public <T> List<T> queryAll(Class<T> claz, WhereCondition whereCondition) {
setCurrentDao(claz); // setCurrentDao(claz);
return mDaoSession.queryBuilder(claz) return mDaoSession.queryBuilder(claz)
.where(whereCondition) .where(whereCondition)
.list(); .list();
} }
public <T> List<T> queryAll(Class<T> claz, QueryBuilder<T> queryBuilder) { public <T> List<T> queryAll(Class<T> claz, QueryBuilder<T> queryBuilder) {
setCurrentDao(claz); // setCurrentDao(claz);
return queryBuilder.list(); return queryBuilder.list();
} }
public <T> List<T> queryAll(Class<T> claz, Query<T> query) { public <T> List<T> queryAll(Class<T> claz, Query<T> query) {
setCurrentDao(claz); // setCurrentDao(claz);
return query.list(); return query.list();
} }
...@@ -246,8 +269,8 @@ public class DbUtil { ...@@ -246,8 +269,8 @@ public class DbUtil {
* @return * @return
*/ */
public <T> List<T> queryRaw(Class<T> claz, String whereString, String[] params) { public <T> List<T> queryRaw(Class<T> claz, String whereString, String[] params) {
setCurrentDao(claz); // setCurrentDao(claz);
return mAbstractDao.queryRaw(whereString, params); return getCurDao(claz).queryRaw(whereString, params);
} }
/** /**
...@@ -280,17 +303,17 @@ public class DbUtil { ...@@ -280,17 +303,17 @@ public class DbUtil {
* @param cls * @param cls
* @return * @return
*/ */
public <T> void queryAsync(Class<T> cls, WhereCondition whereCondition) { public <T> void queryAsync(Class<T> cls, WhereCondition whereCondition, DbQueryCallBack mCallBack) {
setCurrentDao(cls); // setCurrentDao(cls);
AsyncSession asyncSession = mDaoSession.startAsyncSession(); AsyncSession asyncSession = mDaoSession.startAsyncSession();
asyncSession.setListenerMainThread(new AsyncOperationListener() { asyncSession.setListenerMainThread(new AsyncOperationListener() {
@Override @Override
public void onAsyncOperationCompleted(AsyncOperation operation) { public void onAsyncOperationCompleted(AsyncOperation operation) {
if (operation.isCompleted() && mQueryCallBack != null) { if (operation.isCompleted() && mCallBack != null) {
List<T> result = (List<T>) operation.getResult(); List<T> result = (List<T>) operation.getResult();
mQueryCallBack.onSuccess(result); mCallBack.onSuccess(result);
} else if (operation.isFailed() && mQueryCallBack != null) { } else if (operation.isFailed() && mCallBack != null) {
mQueryCallBack.onFailed(); mCallBack.onFailed();
} }
} }
}); });
...@@ -305,17 +328,17 @@ public class DbUtil { ...@@ -305,17 +328,17 @@ public class DbUtil {
* @param offset * @param offset
* @return * @return
*/ */
public <T> void queryAsyncOffset(Class<T> cls, int offset) { public <T> void queryAsyncOffset(Class<T> cls, int offset, DbQueryCallBack mCallBack) {
setCurrentDao(cls); // setCurrentDao(cls);
AsyncSession asyncSession = mDaoSession.startAsyncSession(); AsyncSession asyncSession = mDaoSession.startAsyncSession();
asyncSession.setListenerMainThread(new AsyncOperationListener() { asyncSession.setListenerMainThread(new AsyncOperationListener() {
@Override @Override
public void onAsyncOperationCompleted(AsyncOperation operation) { public void onAsyncOperationCompleted(AsyncOperation operation) {
if (operation.isCompleted() && mQueryCallBack != null) { if (operation.isCompleted() && mCallBack != null) {
List<T> result = (List<T>) operation.getResult(); List<T> result = (List<T>) operation.getResult();
mQueryCallBack.onSuccess(result); mCallBack.onSuccess(result);
} else if (operation.isFailed() && mQueryCallBack != null) { } else if (operation.isFailed() && mCallBack != null) {
mQueryCallBack.onFailed(); mCallBack.onFailed();
} }
} }
}); });
...@@ -330,17 +353,17 @@ public class DbUtil { ...@@ -330,17 +353,17 @@ public class DbUtil {
* @param builder * @param builder
* @param <T> * @param <T>
*/ */
public <T> void queryAsyncAll(Class<T> claz, QueryBuilder<T> builder) { public <T> void queryAsyncAll(Class<T> claz, QueryBuilder<T> builder, DbQueryCallBack mCallBack) {
setCurrentDao(claz); // setCurrentDao(claz);
AsyncSession asyncSession = mDaoSession.startAsyncSession(); AsyncSession asyncSession = mDaoSession.startAsyncSession();
asyncSession.setListenerMainThread(new AsyncOperationListener() { asyncSession.setListenerMainThread(new AsyncOperationListener() {
@Override @Override
public void onAsyncOperationCompleted(AsyncOperation operation) { public void onAsyncOperationCompleted(AsyncOperation operation) {
if (operation.isCompleted() && mQueryCallBack != null) { if (operation.isCompleted() && mCallBack != null) {
List<T> result = (List<T>) operation.getResult(); List<T> result = (List<T>) operation.getResult();
mQueryCallBack.onSuccess(result); mCallBack.onSuccess(result);
} else if (operation.isFailed() && mQueryCallBack != null) { } else if (operation.isFailed() && mCallBack != null) {
mQueryCallBack.onFailed(); mCallBack.onFailed();
} }
} }
}); });
...@@ -354,16 +377,16 @@ public class DbUtil { ...@@ -354,16 +377,16 @@ public class DbUtil {
/** /**
* 删除 * 删除
*/ */
public <T> void deleteAsyncSingle(T entry) { public <T> void deleteAsyncSingle(T entry, DbIDUCallBack mCallBack) {
setCurrentDao(entry.getClass()); // setCurrentDao(entry.getClass());
AsyncSession asyncSession = mDaoSession.startAsyncSession(); AsyncSession asyncSession = mDaoSession.startAsyncSession();
asyncSession.setListenerMainThread(new AsyncOperationListener() { asyncSession.setListenerMainThread(new AsyncOperationListener() {
@Override @Override
public void onAsyncOperationCompleted(AsyncOperation operation) { public void onAsyncOperationCompleted(AsyncOperation operation) {
if (operation.isCompletedSucessfully() && mIDUCallBack != null) { if (operation.isCompletedSucessfully() && mCallBack != null) {
mIDUCallBack.onNotification(true); mCallBack.onNotification(true);
} else if (operation.isFailed() && mIDUCallBack != null) { } else if (operation.isFailed() && mCallBack != null) {
mIDUCallBack.onNotification(false); mCallBack.onNotification(false);
} }
} }
}); });
...@@ -373,16 +396,16 @@ public class DbUtil { ...@@ -373,16 +396,16 @@ public class DbUtil {
/** /**
* 批量删除 * 批量删除
*/ */
public <T> void deleteAsyncBatch(Class<T> cls, final List<T> list) { public <T> void deleteAsyncBatch(Class<T> cls, final List<T> list,DbIDUCallBack mCallBack) {
setCurrentDao(cls); // setCurrentDao(cls);
AsyncSession asyncSession = mDaoSession.startAsyncSession(); AsyncSession asyncSession = mDaoSession.startAsyncSession();
asyncSession.setListenerMainThread(new AsyncOperationListener() { asyncSession.setListenerMainThread(new AsyncOperationListener() {
@Override @Override
public void onAsyncOperationCompleted(AsyncOperation operation) { public void onAsyncOperationCompleted(AsyncOperation operation) {
if (operation.isCompletedSucessfully() && mIDUCallBack != null) { if (operation.isCompletedSucessfully() && mCallBack != null) {
mIDUCallBack.onNotification(true); mCallBack.onNotification(true);
} else if (operation.isFailed() && mIDUCallBack != null) { } else if (operation.isFailed() && mCallBack != null) {
mIDUCallBack.onNotification(false); mCallBack.onNotification(false);
} }
} }
}); });
...@@ -394,23 +417,23 @@ public class DbUtil { ...@@ -394,23 +417,23 @@ public class DbUtil {
* 根据Id批量删除 * 根据Id批量删除
*/ */
public <T> void deleteByIdBatch(Class<T> claz, List<Long> longList) { public <T> void deleteByIdBatch(Class<T> claz, List<Long> longList) {
setCurrentDao(claz); // setCurrentDao(claz);
mAbstractDao.deleteByKeyInTx(longList); getCurDao(claz).deleteByKeyInTx(longList);
} }
/** /**
* 删除所有数据 * 删除所有数据
*/ */
public <T> void deleteAsyncAll(Class<T> cls) { public <T> void deleteAsyncAll(Class<T> cls, DbIDUCallBack mCallBack) {
setCurrentDao(cls); // setCurrentDao(cls);
final AsyncSession asyncSession = mDaoSession.startAsyncSession(); final AsyncSession asyncSession = mDaoSession.startAsyncSession();
asyncSession.setListenerMainThread(new AsyncOperationListener() { asyncSession.setListenerMainThread(new AsyncOperationListener() {
@Override @Override
public void onAsyncOperationCompleted(AsyncOperation operation) { public void onAsyncOperationCompleted(AsyncOperation operation) {
if (operation.isCompletedSucessfully() && mIDUCallBack != null) { if (operation.isCompletedSucessfully() && mCallBack != null) {
mIDUCallBack.onNotification(true); mCallBack.onNotification(true);
} else if (operation.isFailed() && mIDUCallBack != null) { } else if (operation.isFailed() && mCallBack != null) {
mIDUCallBack.onNotification(false); mCallBack.onNotification(false);
} }
} }
}); });
...@@ -420,16 +443,16 @@ public class DbUtil { ...@@ -420,16 +443,16 @@ public class DbUtil {
/** /**
* 插入一条数据 * 插入一条数据
*/ */
public <T> void insertAsyncSingle(final T entity) { public <T> void insertAsyncSingle(final T entity, DbIDUCallBack mCallBack) {
setCurrentDao(entity.getClass()); // setCurrentDao(entity.getClass());
AsyncSession asyncSession = mDaoSession.startAsyncSession(); AsyncSession asyncSession = mDaoSession.startAsyncSession();
asyncSession.setListenerMainThread(new AsyncOperationListener() { asyncSession.setListenerMainThread(new AsyncOperationListener() {
@Override @Override
public void onAsyncOperationCompleted(AsyncOperation operation) { public void onAsyncOperationCompleted(AsyncOperation operation) {
if (operation.isCompletedSucessfully() && mIDUCallBack != null) { if (operation.isCompletedSucessfully() && mCallBack != null) {
mIDUCallBack.onNotification(true); mCallBack.onNotification(true);
} else if (operation.isFailed() && mIDUCallBack != null) { } else if (operation.isFailed() && mCallBack != null) {
mIDUCallBack.onNotification(false); mCallBack.onNotification(false);
} }
} }
}); });
...@@ -444,24 +467,24 @@ public class DbUtil { ...@@ -444,24 +467,24 @@ public class DbUtil {
/** /**
* 批量插入 * 批量插入
*/ */
public <T> void insertAsyncBatch(final Class<T> cls, final List<T> list) { public <T> void insertAsyncBatch(final Class<T> cls, final List<T> list,DbIDUCallBack mCallBack) {
setCurrentDao(cls); // setCurrentDao(cls);
AsyncSession asyncSession = mDaoSession.startAsyncSession(); AsyncSession asyncSession = mDaoSession.startAsyncSession();
asyncSession.setListenerMainThread(new AsyncOperationListener() { asyncSession.setListenerMainThread(new AsyncOperationListener() {
@Override @Override
public void onAsyncOperationCompleted(AsyncOperation operation) { public void onAsyncOperationCompleted(AsyncOperation operation) {
if (operation.isCompletedSucessfully() && mIDUCallBack != null) { if (operation.isCompletedSucessfully() && mCallBack != null) {
mIDUCallBack.onNotification(true); mCallBack.onNotification(true);
} else if (operation.isFailed() && mIDUCallBack != null) { } else if (operation.isFailed() && mCallBack != null) {
mIDUCallBack.onNotification(false); mCallBack.onNotification(false);
} }
} }
}); });
asyncSession.runInTx(new Runnable() { asyncSession.runInTx(new Runnable() {
@Override @Override
public void run() { public void run() {
mAbstractDao.insertOrReplaceInTx(list); getCurDao(cls).insertOrReplaceInTx(list);
mAbstractDao.detachAll(); getCurDao(cls).detachAll();
} }
}); });
} }
...@@ -469,16 +492,16 @@ public class DbUtil { ...@@ -469,16 +492,16 @@ public class DbUtil {
/** /**
* 更新一个数据 * 更新一个数据
*/ */
public <T> void updateAsyncSingle(Class<T> cls, T entry) { public <T> void updateAsyncSingle(Class<T> cls, T entry, DbIDUCallBack mCallBack) {
setCurrentDao(cls); // setCurrentDao(cls);
AsyncSession asyncSession = mDaoSession.startAsyncSession(); AsyncSession asyncSession = mDaoSession.startAsyncSession();
asyncSession.setListenerMainThread(new AsyncOperationListener() { asyncSession.setListenerMainThread(new AsyncOperationListener() {
@Override @Override
public void onAsyncOperationCompleted(AsyncOperation operation) { public void onAsyncOperationCompleted(AsyncOperation operation) {
if (operation.isCompletedSucessfully() && mIDUCallBack != null) { if (operation.isCompletedSucessfully() && mCallBack != null) {
mIDUCallBack.onNotification(true); mCallBack.onNotification(true);
} else if (operation.isFailed() && mIDUCallBack != null) { } else if (operation.isFailed() && mCallBack != null) {
mIDUCallBack.onNotification(false); mCallBack.onNotification(false);
} }
} }
}); });
...@@ -488,16 +511,16 @@ public class DbUtil { ...@@ -488,16 +511,16 @@ public class DbUtil {
/** /**
* 批量更新数据 * 批量更新数据
*/ */
public <T> void updateAsyncBatch(final Class<T> cls, final List<T> tList) { public <T> void updateAsyncBatch(final Class<T> cls, final List<T> tList, DbIDUCallBack mCallBack) {
setCurrentDao(cls); // setCurrentDao(cls);
AsyncSession asyncSession = mDaoSession.startAsyncSession(); AsyncSession asyncSession = mDaoSession.startAsyncSession();
asyncSession.setListenerMainThread(new AsyncOperationListener() { asyncSession.setListenerMainThread(new AsyncOperationListener() {
@Override @Override
public void onAsyncOperationCompleted(AsyncOperation operation) { public void onAsyncOperationCompleted(AsyncOperation operation) {
if (operation.isCompletedSucessfully() && mIDUCallBack != null) { if (operation.isCompletedSucessfully() && mCallBack != null) {
mIDUCallBack.onNotification(true); mCallBack.onNotification(true);
} else if (operation.isFailed() && mIDUCallBack != null) { } else if (operation.isFailed() && mCallBack != null) {
mIDUCallBack.onNotification(false); mCallBack.onNotification(false);
} }
} }
}); });
...@@ -557,7 +580,7 @@ public class DbUtil { ...@@ -557,7 +580,7 @@ public class DbUtil {
} }
private <T> void setCurrentDaoOfList(Collection<T> entities) { private <T> void setCurrentDaoOfList(Collection<T> entities) {
if (entities != null && entities.size() >= 1) { if (entities != null && entities.size() > 1) {
Iterator<T> iterator = entities.iterator(); Iterator<T> iterator = entities.iterator();
T next = iterator.next(); T next = iterator.next();
setCurrentDao(next.getClass()); setCurrentDao(next.getClass());
......
...@@ -26,6 +26,7 @@ public class DaoMaster extends AbstractDaoMaster { ...@@ -26,6 +26,7 @@ public class DaoMaster extends AbstractDaoMaster {
BreedingRecordEntityDao.createTable(db, ifNotExists); BreedingRecordEntityDao.createTable(db, ifNotExists);
CattleResumeEntityDao.createTable(db, ifNotExists); CattleResumeEntityDao.createTable(db, ifNotExists);
DictEntityDao.createTable(db, ifNotExists); DictEntityDao.createTable(db, ifNotExists);
FrozenSemenEntityDao.createTable(db, ifNotExists);
GenTableDao.createTable(db, ifNotExists); GenTableDao.createTable(db, ifNotExists);
GenTableColumnDao.createTable(db, ifNotExists); GenTableColumnDao.createTable(db, ifNotExists);
ImmuneBatchDetailEntityDao.createTable(db, ifNotExists); ImmuneBatchDetailEntityDao.createTable(db, ifNotExists);
...@@ -43,6 +44,7 @@ public class DaoMaster extends AbstractDaoMaster { ...@@ -43,6 +44,7 @@ public class DaoMaster extends AbstractDaoMaster {
BreedingRecordEntityDao.dropTable(db, ifExists); BreedingRecordEntityDao.dropTable(db, ifExists);
CattleResumeEntityDao.dropTable(db, ifExists); CattleResumeEntityDao.dropTable(db, ifExists);
DictEntityDao.dropTable(db, ifExists); DictEntityDao.dropTable(db, ifExists);
FrozenSemenEntityDao.dropTable(db, ifExists);
GenTableDao.dropTable(db, ifExists); GenTableDao.dropTable(db, ifExists);
GenTableColumnDao.dropTable(db, ifExists); GenTableColumnDao.dropTable(db, ifExists);
ImmuneBatchDetailEntityDao.dropTable(db, ifExists); ImmuneBatchDetailEntityDao.dropTable(db, ifExists);
...@@ -74,6 +76,7 @@ public class DaoMaster extends AbstractDaoMaster { ...@@ -74,6 +76,7 @@ public class DaoMaster extends AbstractDaoMaster {
registerDaoClass(BreedingRecordEntityDao.class); registerDaoClass(BreedingRecordEntityDao.class);
registerDaoClass(CattleResumeEntityDao.class); registerDaoClass(CattleResumeEntityDao.class);
registerDaoClass(DictEntityDao.class); registerDaoClass(DictEntityDao.class);
registerDaoClass(FrozenSemenEntityDao.class);
registerDaoClass(GenTableDao.class); registerDaoClass(GenTableDao.class);
registerDaoClass(GenTableColumnDao.class); registerDaoClass(GenTableColumnDao.class);
registerDaoClass(ImmuneBatchDetailEntityDao.class); registerDaoClass(ImmuneBatchDetailEntityDao.class);
......
...@@ -13,6 +13,7 @@ import com.phlx.anchorcollect.entity.BreedingRecordDetailEntity; ...@@ -13,6 +13,7 @@ import com.phlx.anchorcollect.entity.BreedingRecordDetailEntity;
import com.phlx.anchorcollect.entity.BreedingRecordEntity; import com.phlx.anchorcollect.entity.BreedingRecordEntity;
import com.phlx.anchorcollect.entity.CattleResumeEntity; import com.phlx.anchorcollect.entity.CattleResumeEntity;
import com.phlx.anchorcollect.entity.DictEntity; import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.FrozenSemenEntity;
import com.phlx.anchorcollect.entity.GenTable; import com.phlx.anchorcollect.entity.GenTable;
import com.phlx.anchorcollect.entity.GenTableColumn; import com.phlx.anchorcollect.entity.GenTableColumn;
import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity; import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity;
...@@ -27,6 +28,7 @@ import com.phlx.anchorcollect.db.gen.BreedingRecordDetailEntityDao; ...@@ -27,6 +28,7 @@ import com.phlx.anchorcollect.db.gen.BreedingRecordDetailEntityDao;
import com.phlx.anchorcollect.db.gen.BreedingRecordEntityDao; import com.phlx.anchorcollect.db.gen.BreedingRecordEntityDao;
import com.phlx.anchorcollect.db.gen.CattleResumeEntityDao; import com.phlx.anchorcollect.db.gen.CattleResumeEntityDao;
import com.phlx.anchorcollect.db.gen.DictEntityDao; import com.phlx.anchorcollect.db.gen.DictEntityDao;
import com.phlx.anchorcollect.db.gen.FrozenSemenEntityDao;
import com.phlx.anchorcollect.db.gen.GenTableDao; import com.phlx.anchorcollect.db.gen.GenTableDao;
import com.phlx.anchorcollect.db.gen.GenTableColumnDao; import com.phlx.anchorcollect.db.gen.GenTableColumnDao;
import com.phlx.anchorcollect.db.gen.ImmuneBatchDetailEntityDao; import com.phlx.anchorcollect.db.gen.ImmuneBatchDetailEntityDao;
...@@ -50,6 +52,7 @@ public class DaoSession extends AbstractDaoSession { ...@@ -50,6 +52,7 @@ public class DaoSession extends AbstractDaoSession {
private final DaoConfig breedingRecordEntityDaoConfig; private final DaoConfig breedingRecordEntityDaoConfig;
private final DaoConfig cattleResumeEntityDaoConfig; private final DaoConfig cattleResumeEntityDaoConfig;
private final DaoConfig dictEntityDaoConfig; private final DaoConfig dictEntityDaoConfig;
private final DaoConfig frozenSemenEntityDaoConfig;
private final DaoConfig genTableDaoConfig; private final DaoConfig genTableDaoConfig;
private final DaoConfig genTableColumnDaoConfig; private final DaoConfig genTableColumnDaoConfig;
private final DaoConfig immuneBatchDetailEntityDaoConfig; private final DaoConfig immuneBatchDetailEntityDaoConfig;
...@@ -64,6 +67,7 @@ public class DaoSession extends AbstractDaoSession { ...@@ -64,6 +67,7 @@ public class DaoSession extends AbstractDaoSession {
private final BreedingRecordEntityDao breedingRecordEntityDao; private final BreedingRecordEntityDao breedingRecordEntityDao;
private final CattleResumeEntityDao cattleResumeEntityDao; private final CattleResumeEntityDao cattleResumeEntityDao;
private final DictEntityDao dictEntityDao; private final DictEntityDao dictEntityDao;
private final FrozenSemenEntityDao frozenSemenEntityDao;
private final GenTableDao genTableDao; private final GenTableDao genTableDao;
private final GenTableColumnDao genTableColumnDao; private final GenTableColumnDao genTableColumnDao;
private final ImmuneBatchDetailEntityDao immuneBatchDetailEntityDao; private final ImmuneBatchDetailEntityDao immuneBatchDetailEntityDao;
...@@ -92,6 +96,9 @@ public class DaoSession extends AbstractDaoSession { ...@@ -92,6 +96,9 @@ public class DaoSession extends AbstractDaoSession {
dictEntityDaoConfig = daoConfigMap.get(DictEntityDao.class).clone(); dictEntityDaoConfig = daoConfigMap.get(DictEntityDao.class).clone();
dictEntityDaoConfig.initIdentityScope(type); dictEntityDaoConfig.initIdentityScope(type);
frozenSemenEntityDaoConfig = daoConfigMap.get(FrozenSemenEntityDao.class).clone();
frozenSemenEntityDaoConfig.initIdentityScope(type);
genTableDaoConfig = daoConfigMap.get(GenTableDao.class).clone(); genTableDaoConfig = daoConfigMap.get(GenTableDao.class).clone();
genTableDaoConfig.initIdentityScope(type); genTableDaoConfig.initIdentityScope(type);
...@@ -121,6 +128,7 @@ public class DaoSession extends AbstractDaoSession { ...@@ -121,6 +128,7 @@ public class DaoSession extends AbstractDaoSession {
breedingRecordEntityDao = new BreedingRecordEntityDao(breedingRecordEntityDaoConfig, this); breedingRecordEntityDao = new BreedingRecordEntityDao(breedingRecordEntityDaoConfig, this);
cattleResumeEntityDao = new CattleResumeEntityDao(cattleResumeEntityDaoConfig, this); cattleResumeEntityDao = new CattleResumeEntityDao(cattleResumeEntityDaoConfig, this);
dictEntityDao = new DictEntityDao(dictEntityDaoConfig, this); dictEntityDao = new DictEntityDao(dictEntityDaoConfig, this);
frozenSemenEntityDao = new FrozenSemenEntityDao(frozenSemenEntityDaoConfig, this);
genTableDao = new GenTableDao(genTableDaoConfig, this); genTableDao = new GenTableDao(genTableDaoConfig, this);
genTableColumnDao = new GenTableColumnDao(genTableColumnDaoConfig, this); genTableColumnDao = new GenTableColumnDao(genTableColumnDaoConfig, this);
immuneBatchDetailEntityDao = new ImmuneBatchDetailEntityDao(immuneBatchDetailEntityDaoConfig, this); immuneBatchDetailEntityDao = new ImmuneBatchDetailEntityDao(immuneBatchDetailEntityDaoConfig, this);
...@@ -135,6 +143,7 @@ public class DaoSession extends AbstractDaoSession { ...@@ -135,6 +143,7 @@ public class DaoSession extends AbstractDaoSession {
registerDao(BreedingRecordEntity.class, breedingRecordEntityDao); registerDao(BreedingRecordEntity.class, breedingRecordEntityDao);
registerDao(CattleResumeEntity.class, cattleResumeEntityDao); registerDao(CattleResumeEntity.class, cattleResumeEntityDao);
registerDao(DictEntity.class, dictEntityDao); registerDao(DictEntity.class, dictEntityDao);
registerDao(FrozenSemenEntity.class, frozenSemenEntityDao);
registerDao(GenTable.class, genTableDao); registerDao(GenTable.class, genTableDao);
registerDao(GenTableColumn.class, genTableColumnDao); registerDao(GenTableColumn.class, genTableColumnDao);
registerDao(ImmuneBatchDetailEntity.class, immuneBatchDetailEntityDao); registerDao(ImmuneBatchDetailEntity.class, immuneBatchDetailEntityDao);
...@@ -151,6 +160,7 @@ public class DaoSession extends AbstractDaoSession { ...@@ -151,6 +160,7 @@ public class DaoSession extends AbstractDaoSession {
breedingRecordEntityDaoConfig.clearIdentityScope(); breedingRecordEntityDaoConfig.clearIdentityScope();
cattleResumeEntityDaoConfig.clearIdentityScope(); cattleResumeEntityDaoConfig.clearIdentityScope();
dictEntityDaoConfig.clearIdentityScope(); dictEntityDaoConfig.clearIdentityScope();
frozenSemenEntityDaoConfig.clearIdentityScope();
genTableDaoConfig.clearIdentityScope(); genTableDaoConfig.clearIdentityScope();
genTableColumnDaoConfig.clearIdentityScope(); genTableColumnDaoConfig.clearIdentityScope();
immuneBatchDetailEntityDaoConfig.clearIdentityScope(); immuneBatchDetailEntityDaoConfig.clearIdentityScope();
...@@ -181,6 +191,10 @@ public class DaoSession extends AbstractDaoSession { ...@@ -181,6 +191,10 @@ public class DaoSession extends AbstractDaoSession {
return dictEntityDao; return dictEntityDao;
} }
public FrozenSemenEntityDao getFrozenSemenEntityDao() {
return frozenSemenEntityDao;
}
public GenTableDao getGenTableDao() { public GenTableDao getGenTableDao() {
return genTableDao; return genTableDao;
} }
......
...@@ -65,6 +65,43 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -65,6 +65,43 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
/** 母登记号 */ /** 母登记号 */
private String motherReg; private String motherReg;
/** 祖父号 */
private String ffNum;
/** 祖母号 */
private String fmNum;
/** 外祖父号 */
private String mfNum;
/** 外祖母号 */
private String mmNum;
/** 曾祖父 */
private String fffNum;
/** 曾祖母 */
private String ffmNum;
/** 曾外祖父 */
private String fmfNum;
/** 曾外祖母 */
private String fmmNum;
/** 外曾祖父 */
private String mffNum;
/** 外曾祖母 */
private String mfmNum;
/** 外曾外祖父 */
private String mmfNum;
/** 外曾外祖母 */
private String mmmNum;
/** 离乳重 */ /** 离乳重 */
private Double fromMilkHeavy; private Double fromMilkHeavy;
...@@ -155,6 +192,18 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -155,6 +192,18 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
grade = in.readString(); grade = in.readString();
fatherReg = in.readString(); fatherReg = in.readString();
motherReg = in.readString(); motherReg = in.readString();
ffNum = in.readString();
fmNum = in.readString();
mfNum = in.readString();
mmNum = in.readString();
fffNum = in.readString();
ffmNum = in.readString();
fmfNum = in.readString();
fmmNum = in.readString();
mffNum = in.readString();
mfmNum = in.readString();
mmfNum = in.readString();
mmmNum = in.readString();
if (in.readByte() == 0) { if (in.readByte() == 0) {
fromMilkHeavy = null; fromMilkHeavy = null;
} else { } else {
...@@ -197,11 +246,13 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -197,11 +246,13 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
remark = in.readString(); remark = in.readString();
} }
@Generated(hash = 1557063295) @Generated(hash = 952388002)
public CattleResumeEntity(Long unid, String registrationNo, String individualNo, String circleNo, public CattleResumeEntity(Long unid, String registrationNo, String individualNo, String circleNo,
String raiseType, String raiseVarieties, String birthdate, Double birthHeavy, String sex, String raiseType, String raiseVarieties, String birthdate, Double birthHeavy, String sex,
String birthDifficulty, String isTwins, String childTime, String grade, String fatherReg, String birthDifficulty, String isTwins, String childTime, String grade, String fatherReg,
String motherReg, Double fromMilkHeavy, String health, String junHeavy, String decAppScore, String motherReg, String ffNum, String fmNum, String mfNum, String mmNum, String fffNum,
String ffmNum, String fmfNum, String fmmNum, String mffNum, String mfmNum, String mmfNum,
String mmmNum, Double fromMilkHeavy, String health, String junHeavy, String decAppScore,
String photo, String photoPath, String status, Long isOut, Integer age, String colour, String photo, String photoPath, String status, Long isOut, Integer age, String colour,
String inputTime, Long deptId, Long deptName, String uploadStatus, String uploadTime, String inputTime, Long deptId, Long deptName, String uploadStatus, String uploadTime,
String createBy, String createTime, String updateBy, String updateTime, String remark) { String createBy, String createTime, String updateBy, String updateTime, String remark) {
...@@ -220,6 +271,18 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -220,6 +271,18 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this.grade = grade; this.grade = grade;
this.fatherReg = fatherReg; this.fatherReg = fatherReg;
this.motherReg = motherReg; this.motherReg = motherReg;
this.ffNum = ffNum;
this.fmNum = fmNum;
this.mfNum = mfNum;
this.mmNum = mmNum;
this.fffNum = fffNum;
this.ffmNum = ffmNum;
this.fmfNum = fmfNum;
this.fmmNum = fmmNum;
this.mffNum = mffNum;
this.mfmNum = mfmNum;
this.mmfNum = mmfNum;
this.mmmNum = mmmNum;
this.fromMilkHeavy = fromMilkHeavy; this.fromMilkHeavy = fromMilkHeavy;
this.health = health; this.health = health;
this.junHeavy = junHeavy; this.junHeavy = junHeavy;
...@@ -269,6 +332,18 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -269,6 +332,18 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
dest.writeString(grade); dest.writeString(grade);
dest.writeString(fatherReg); dest.writeString(fatherReg);
dest.writeString(motherReg); dest.writeString(motherReg);
dest.writeString(ffNum);
dest.writeString(fmNum);
dest.writeString(mfNum);
dest.writeString(mmNum);
dest.writeString(fffNum);
dest.writeString(ffmNum);
dest.writeString(fmfNum);
dest.writeString(fmmNum);
dest.writeString(mffNum);
dest.writeString(mfmNum);
dest.writeString(mmfNum);
dest.writeString(mmmNum);
if (fromMilkHeavy == null) { if (fromMilkHeavy == null) {
dest.writeByte((byte) 0); dest.writeByte((byte) 0);
} else { } else {
...@@ -453,6 +528,102 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -453,6 +528,102 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this.motherReg = motherReg; this.motherReg = motherReg;
} }
public String getFfNum() {
return ffNum;
}
public void setFfNum(String ffNum) {
this.ffNum = ffNum;
}
public String getFmNum() {
return fmNum;
}
public void setFmNum(String fmNum) {
this.fmNum = fmNum;
}
public String getMfNum() {
return mfNum;
}
public void setMfNum(String mfNum) {
this.mfNum = mfNum;
}
public String getMmNum() {
return mmNum;
}
public void setMmNum(String mmNum) {
this.mmNum = mmNum;
}
public String getFffNum() {
return fffNum;
}
public void setFffNum(String fffNum) {
this.fffNum = fffNum;
}
public String getFfmNum() {
return ffmNum;
}
public void setFfmNum(String ffmNum) {
this.ffmNum = ffmNum;
}
public String getFmfNum() {
return fmfNum;
}
public void setFmfNum(String fmfNum) {
this.fmfNum = fmfNum;
}
public String getFmmNum() {
return fmmNum;
}
public void setFmmNum(String fmmNum) {
this.fmmNum = fmmNum;
}
public String getMffNum() {
return mffNum;
}
public void setMffNum(String mffNum) {
this.mffNum = mffNum;
}
public String getMfmNum() {
return mfmNum;
}
public void setMfmNum(String mfmNum) {
this.mfmNum = mfmNum;
}
public String getMmfNum() {
return mmfNum;
}
public void setMmfNum(String mmfNum) {
this.mmfNum = mmfNum;
}
public String getMmmNum() {
return mmmNum;
}
public void setMmmNum(String mmmNum) {
this.mmmNum = mmmNum;
}
public Double getFromMilkHeavy() { public Double getFromMilkHeavy() {
return fromMilkHeavy; return fromMilkHeavy;
} }
...@@ -613,47 +784,6 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -613,47 +784,6 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this.remark = remark; this.remark = remark;
} }
@Override
public String toString() {
return "CattleResumeEntity{" +
"unid=" + unid +
", registrationNo='" + registrationNo + '\'' +
", individualNo='" + individualNo + '\'' +
", circleNo='" + circleNo + '\'' +
", raiseType='" + raiseType + '\'' +
", raiseVarieties='" + raiseVarieties + '\'' +
", birthdate='" + birthdate + '\'' +
", birthHeavy=" + birthHeavy +
", sex='" + sex + '\'' +
", birthDifficulty='" + birthDifficulty + '\'' +
", isTwins='" + isTwins + '\'' +
", childTime='" + childTime + '\'' +
", grade='" + grade + '\'' +
", fatherReg='" + fatherReg + '\'' +
", motherReg='" + motherReg + '\'' +
", fromMilkHeavy=" + fromMilkHeavy +
", health='" + health + '\'' +
", junHeavy='" + junHeavy + '\'' +
", decAppScore='" + decAppScore + '\'' +
", photo='" + photo + '\'' +
", photoPath='" + photoPath + '\'' +
", status='" + status + '\'' +
", isOut=" + isOut +
", age=" + age +
", colour='" + colour + '\'' +
", inputTime='" + inputTime + '\'' +
", deptId=" + deptId +
", deptName=" + deptName +
", uploadStatus='" + uploadStatus + '\'' +
", uploadTime='" + uploadTime + '\'' +
", createBy='" + createBy + '\'' +
", createTime='" + createTime + '\'' +
", updateBy='" + updateBy + '\'' +
", updateTime='" + updateTime + '\'' +
", remark='" + remark + '\'' +
'}';
}
public void copyEntity(CattleResumeEntity cre) { public void copyEntity(CattleResumeEntity cre) {
this.unid= cre.getUnid(); this.unid= cre.getUnid();
...@@ -671,6 +801,18 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -671,6 +801,18 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this.grade= cre.getGrade(); this.grade= cre.getGrade();
this.fatherReg= cre.getFatherReg(); this.fatherReg= cre.getFatherReg();
this.motherReg= cre.getMotherReg(); this.motherReg= cre.getMotherReg();
this.ffNum= cre.getFfNum();
this.fmNum= cre.getFmNum();
this.mfNum= cre.getMfNum();
this.mmNum= cre.getMmNum();
this.fffNum= cre.getFffNum();
this.ffmNum= cre.getFfmNum();
this.fmfNum= cre.getFmfNum();
this.fmmNum= cre.getFmmNum();
this.mffNum= cre.getMffNum();
this.mfmNum= cre.getMfmNum();
this.mmfNum= cre.getMmfNum();
this.mmmNum= cre.getMmmNum();
this.fromMilkHeavy= cre.getFromMilkHeavy(); this.fromMilkHeavy= cre.getFromMilkHeavy();
this.health= cre.getHealth(); this.health= cre.getHealth();
this.junHeavy= cre.getJunHeavy(); this.junHeavy= cre.getJunHeavy();
......
package com.phlx.anchorcollect.entity;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.databinding.BaseObservable;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;
/**
* 冻精bean
*/
@Entity
public class FrozenSemenEntity extends BaseObservable implements Parcelable {
/** 主键 */
@Id(autoincrement = false)
private Long id;
/** 注册号 */
private String code;
/** 父本 */
private String fuCode;
/** 母本 */
private String muCode;
/** 祖父 */
private String zfCode;
/** 祖母 */
private String zmCode;
/** 外祖父 */
private String wzfCode;
/** 外祖母 */
private String wzmCode;
/** 照片 */
private String img;
/** 冻精信息 */
private String info;
/** 部门id */
private Long deptId;
public FrozenSemenEntity() {
}
protected FrozenSemenEntity(Parcel in) {
if (in.readByte() == 0) {
id = null;
} else {
id = in.readLong();
}
code = in.readString();
fuCode = in.readString();
muCode = in.readString();
zfCode = in.readString();
zmCode = in.readString();
wzfCode = in.readString();
wzmCode = in.readString();
img = in.readString();
info = in.readString();
if (in.readByte() == 0) {
deptId = null;
} else {
deptId = in.readLong();
}
}
@Generated(hash = 1187217824)
public FrozenSemenEntity(Long id, String code, String fuCode, String muCode, String zfCode,
String zmCode, String wzfCode, String wzmCode, String img, String info, Long deptId) {
this.id = id;
this.code = code;
this.fuCode = fuCode;
this.muCode = muCode;
this.zfCode = zfCode;
this.zmCode = zmCode;
this.wzfCode = wzfCode;
this.wzmCode = wzmCode;
this.img = img;
this.info = info;
this.deptId = deptId;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
if (id == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(id);
}
dest.writeString(code);
dest.writeString(fuCode);
dest.writeString(muCode);
dest.writeString(zfCode);
dest.writeString(zmCode);
dest.writeString(wzfCode);
dest.writeString(wzmCode);
dest.writeString(img);
dest.writeString(info);
if (deptId == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(deptId);
}
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<FrozenSemenEntity> CREATOR = new Creator<FrozenSemenEntity>() {
@Override
public FrozenSemenEntity createFromParcel(Parcel in) {
return new FrozenSemenEntity(in);
}
@Override
public FrozenSemenEntity[] newArray(int size) {
return new FrozenSemenEntity[size];
}
};
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getFuCode() {
return fuCode;
}
public void setFuCode(String fuCode) {
this.fuCode = fuCode;
}
public String getMuCode() {
return muCode;
}
public void setMuCode(String muCode) {
this.muCode = muCode;
}
public String getZfCode() {
return zfCode;
}
public void setZfCode(String zfCode) {
this.zfCode = zfCode;
}
public String getZmCode() {
return zmCode;
}
public void setZmCode(String zmCode) {
this.zmCode = zmCode;
}
public String getWzfCode() {
return wzfCode;
}
public void setWzfCode(String wzfCode) {
this.wzfCode = wzfCode;
}
public String getWzmCode() {
return wzmCode;
}
public void setWzmCode(String wzmCode) {
this.wzmCode = wzmCode;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
@Override
public String toString() {
return "FrozenSemenEntity{" +
"id=" + id +
", code='" + code + '\'' +
", fuCode='" + fuCode + '\'' +
", muCode='" + muCode + '\'' +
", zfCode='" + zfCode + '\'' +
", zmCode='" + zmCode + '\'' +
", wzfCode='" + wzfCode + '\'' +
", wzmCode='" + wzmCode + '\'' +
", img='" + img + '\'' +
", info='" + info + '\'' +
", deptId=" + deptId +
'}';
}
}
package com.phlx.anchorcollect.entity;
import java.util.List;
public class LoginInfoData {
private List<DictEntity> dictList;
private List<FrozenSemenEntity> frozenSemenList;
public LoginInfoData() {
}
public List<DictEntity> getDictList() {
return dictList;
}
public void setDictList(List<DictEntity> dictList) {
this.dictList = dictList;
}
public List<FrozenSemenEntity> getFrozenSemenList() {
return frozenSemenList;
}
public void setFrozenSemenList(List<FrozenSemenEntity> frozenSemenList) {
this.frozenSemenList = frozenSemenList;
}
@Override
public String toString() {
return "LoginInfoData{" +
"dictList=" + dictList +
", frozenSemenList=" + frozenSemenList +
'}';
}
}
...@@ -102,7 +102,7 @@ public class BindVM extends BackBarVM<Repository> implements OnInventoryListener ...@@ -102,7 +102,7 @@ public class BindVM extends BackBarVM<Repository> implements OnInventoryListener
QueryBuilder<CattleResumeEntity> builder0 = QueryBuilder<CattleResumeEntity> builder0 =
DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class) DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class)
.where(CattleResumeEntityDao.Properties.RegistrationNo.eq("")); .where(CattleResumeEntityDao.Properties.RegistrationNo.eq(""));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsyncAll(CattleResumeEntity.class, builder0, new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
...@@ -119,7 +119,7 @@ public class BindVM extends BackBarVM<Repository> implements OnInventoryListener ...@@ -119,7 +119,7 @@ public class BindVM extends BackBarVM<Repository> implements OnInventoryListener
ToastUtils.showShort("查询基础数据数量失败!"); ToastUtils.showShort("查询基础数据数量失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(CattleResumeEntity.class, builder0); });
} }
...@@ -147,11 +147,11 @@ public class BindVM extends BackBarVM<Repository> implements OnInventoryListener ...@@ -147,11 +147,11 @@ public class BindVM extends BackBarVM<Repository> implements OnInventoryListener
return; return;
} }
//判断是否已经绑定过高频耳标 //判断是否已经绑定过电子耳标
QueryBuilder<CattleResumeEntity> builder0 = QueryBuilder<CattleResumeEntity> builder0 =
DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class) DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class)
.where(CattleResumeEntityDao.Properties.RegistrationNo.eq(registrationNo.get())); .where(CattleResumeEntityDao.Properties.RegistrationNo.eq(registrationNo.get()));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsyncAll(CattleResumeEntity.class, builder0, new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
...@@ -168,7 +168,7 @@ public class BindVM extends BackBarVM<Repository> implements OnInventoryListener ...@@ -168,7 +168,7 @@ public class BindVM extends BackBarVM<Repository> implements OnInventoryListener
ToastUtils.showShort("查询基础数据数量失败!"); ToastUtils.showShort("查询基础数据数量失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(CattleResumeEntity.class, builder0); });
} }
private void bindRfid() { private void bindRfid() {
......
...@@ -13,7 +13,6 @@ import android.view.LayoutInflater; ...@@ -13,7 +13,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.Toast; import android.widget.Toast;
...@@ -47,7 +46,7 @@ import com.phlx.anchorcollect.event.EventTag; ...@@ -47,7 +46,7 @@ import com.phlx.anchorcollect.event.EventTag;
import com.phlx.anchorcollect.ui.fragment.vm.BasicsCollectVM; import com.phlx.anchorcollect.ui.fragment.vm.BasicsCollectVM;
import com.phlx.anchorcollect.ui.info.CattleActivity; import com.phlx.anchorcollect.ui.info.CattleActivity;
import com.phlx.anchorcollect.util.BaseImageUtils; import com.phlx.anchorcollect.util.BaseImageUtils;
import com.phlx.anchorcollect.util.DictUtils; import com.phlx.anchorcollect.util.LoginInfoUtils;
import com.phlx.anchorcollect.util.ImagePicker; import com.phlx.anchorcollect.util.ImagePicker;
import com.phlx.anchorcollect.widget.SpaceItemDecoration; import com.phlx.anchorcollect.widget.SpaceItemDecoration;
import com.tbruyelle.rxpermissions2.RxPermissions; import com.tbruyelle.rxpermissions2.RxPermissions;
...@@ -319,14 +318,14 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin ...@@ -319,14 +318,14 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
@Override @Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
// dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false); // dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
//高频耳标 //电子耳标
String registrationNo = dialog.getContentView().getText().toString(); String registrationNo = dialog.getContentView().getText().toString();
if (StringUtils.isEmpty(registrationNo)) { if (StringUtils.isEmpty(registrationNo)) {
ToastUtils.showShort("请扫描耳标!"); ToastUtils.showShort("请扫描耳标!");
return; return;
} }
if (!StringUtils.isEmpty(registrationNo) && registrationNo.length() > 50) { if (!StringUtils.isEmpty(registrationNo) && registrationNo.length() > 50) {
ToastUtils.showShort("高频耳标长度非法,请重新扫描!"); ToastUtils.showShort("电子耳标长度非法,请重新扫描!");
return; return;
} }
viewModel.forwardChangeLabel(registrationNo, ""); viewModel.forwardChangeLabel(registrationNo, "");
...@@ -390,13 +389,13 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin ...@@ -390,13 +389,13 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
.title(uiParamEntity.getColumnComment()) .title(uiParamEntity.getColumnComment())
// .positiveText("确认") // .positiveText("确认")
// .negativeText("取消") // .negativeText("取消")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallback(new MaterialDialog.ListCallback() { .itemsCallback(new MaterialDialog.ListCallback() {
@Override @Override
public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show();
viewModel.currentParamEntity.setShowName(text.toString()); viewModel.currentParamEntity.setShowName(text.toString());
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue()); viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue());
viewModel.currentParamEntity.notifyChange(); viewModel.currentParamEntity.notifyChange();
} }
...@@ -410,14 +409,14 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin ...@@ -410,14 +409,14 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!") new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false) .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定") .positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() { .itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
@Override @Override
public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) { public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {
String showName = ""; String showName = "";
String content = ""; String content = "";
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
if (which != null && which.length > 0) { if (which != null && which.length > 0) {
for (Integer i : which) { for (Integer i : which) {
showName += distTypeList.get(i).getDictLabel(); showName += distTypeList.get(i).getDictLabel();
...@@ -440,6 +439,7 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin ...@@ -440,6 +439,7 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
private void showInputDialog(GenTableColumn uiParamEntity) { private void showInputDialog(GenTableColumn uiParamEntity) {
int inputType = 0; int inputType = 0;
if (uiParamEntity.getJavaType().equals("Long") || uiParamEntity.getJavaType().equals("Integer")) { if (uiParamEntity.getJavaType().equals("Long") || uiParamEntity.getJavaType().equals("Integer")) {
inputType = InputType.TYPE_CLASS_NUMBER; inputType = InputType.TYPE_CLASS_NUMBER;
} else if (uiParamEntity.getJavaType().equals("BigDecimal") || uiParamEntity.getJavaType().equals("Duoble")) { } else if (uiParamEntity.getJavaType().equals("BigDecimal") || uiParamEntity.getJavaType().equals("Duoble")) {
...@@ -450,27 +450,86 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin ...@@ -450,27 +450,86 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
inputType = InputType.TYPE_CLASS_TEXT; inputType = InputType.TYPE_CLASS_TEXT;
} }
//判断下限制的长度
int columnSize = 500;//不限制的设置成500
int columnPointSize = -1;
if (uiParamEntity.getColumnType().indexOf("(") > -1 && uiParamEntity.getColumnType().indexOf(")") > -1) {
if (uiParamEntity.getColumnType().indexOf(",") > -1) {//有“,”说明是Duoble
columnSize = Integer.parseInt(
uiParamEntity.getColumnType().substring(
uiParamEntity.getColumnType().indexOf("(") + 1, uiParamEntity.getColumnType().indexOf(",")
)
) + 1;
columnPointSize = Integer.parseInt(
uiParamEntity.getColumnType().substring(
uiParamEntity.getColumnType().indexOf(",") + 1, uiParamEntity.getColumnType().indexOf(")")
)
);
} else {
columnSize = Integer.parseInt(
uiParamEntity.getColumnType().substring(
uiParamEntity.getColumnType().indexOf("(") + 1, uiParamEntity.getColumnType().indexOf(")")
)
);
}
}
int maxColumnSize = columnSize * 37;
if (maxColumnSize < 600) {
maxColumnSize = 600;
}
if (maxColumnSize > 1200) {
maxColumnSize = 1200;
}
int finalInputType = inputType; int finalInputType = inputType;
//设置字体大小 //设置字体大小
TextInfo textInfo = new TextInfo(); TextInfo textInfo = new TextInfo();
textInfo.setFontSize(10); textInfo.setFontSize(10);
int finalColumnSize = columnSize;
int finalColumnPointSize = columnPointSize;
InputDialog.show(uiParamEntity.getColumnComment(), "", "确定", "取消") InputDialog.show(uiParamEntity.getColumnComment(), "", "确定", "取消")
.setCancelable(false) .setCancelable(false)
.setInputInfo(new InputInfo().setTextInfo(textInfo).setInputType(finalInputType)) .setInputInfo(new InputInfo().setTextInfo(textInfo).setInputType(finalInputType).setMAX_LENGTH(columnSize))
.setTitleTextInfo(textInfo) .setTitleTextInfo(textInfo)
.setOkTextInfo(textInfo) .setOkTextInfo(textInfo)
.setCancelTextInfo(textInfo) .setCancelTextInfo(textInfo)
.setMaxWidth(600) .setMaxWidth(maxColumnSize)
.setInputHintText("输入" + uiParamEntity.getColumnComment()).setOkButton(new OnInputDialogButtonClickListener<InputDialog>() { .setInputHintText("输入" + uiParamEntity.getColumnComment()).setOkButton(new OnInputDialogButtonClickListener<InputDialog>() {
@Override @Override
public boolean onClick(InputDialog baseDialog, View v, String inputStr) { public boolean onClick(InputDialog baseDialog, View v, String inputStr) {
// baseDialog.getActionButton(DialogAction.POSITIVE).setEnabled(false); // baseDialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
// if (finalInputType == InputType.TYPE_CLASS_TEXT && inputStr.length() > 10) { // if((finalInputType & InputType.TYPE_CLASS_NUMBER) == InputType.TYPE_CLASS_NUMBER
// dialog.getInputEditText().setText(inputStr.subSequence(0, 10)); // || (finalInputType & InputType.TYPE_NUMBER_FLAG_DECIMAL) == InputType.TYPE_NUMBER_FLAG_DECIMAL
// ToastUtils.showShort("输入长度超长"); // || (finalInputType & InputType.TYPE_NUMBER_FLAG_SIGNED) == InputType.TYPE_NUMBER_FLAG_SIGNED){
// } else { // String regex = "[^0-9.]";
// if (inputStr.matches(".*" + regex + ".*")) {
// ToastUtils.showShort("只能输入数字和小数点!");
// return false;
// }
// String regex_ = ".*\\..*\\..*";
// if (inputStr.matches(regex_ )) {
// ToastUtils.showShort("只能输入一个小数点!");
// return false;
// }
// }
if (uiParamEntity.getJavaType().equals("BigDecimal") || uiParamEntity.getJavaType().equals("Duoble")) {
if (!inputStr.matches(
"^\\d{1," + (finalColumnSize - finalColumnPointSize - 1) + "}(\\.\\d{1," + (finalColumnPointSize < 1 ? 1 : finalColumnPointSize) + "})?$"
)) {
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位");
return true;
}
} else if (uiParamEntity.getJavaType().equals("Integer")) {
if (!inputStr.matches("^[1-9][0-9]{0," + (finalColumnSize) + "}$")) {
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize) + "位");
return true;
}
}
viewModel.currentParamEntity.setShowName(inputStr); viewModel.currentParamEntity.setShowName(inputStr);
viewModel.currentParamEntity.setContent(inputStr); viewModel.currentParamEntity.setContent(inputStr);
viewModel.currentParamEntity.notifyChange(); viewModel.currentParamEntity.notifyChange();
......
...@@ -30,7 +30,6 @@ import com.kongzue.dialogx.util.InputInfo; ...@@ -30,7 +30,6 @@ import com.kongzue.dialogx.util.InputInfo;
import com.kongzue.dialogx.util.TextInfo; import com.kongzue.dialogx.util.TextInfo;
import com.lingber.mycontrol.datagridview.DataGridView; import com.lingber.mycontrol.datagridview.DataGridView;
import com.lingber.mycontrol.datagridview.RecyclerviewAdapter; import com.lingber.mycontrol.datagridview.RecyclerviewAdapter;
import com.phlx.anchorcollect.App;
import com.phlx.anchorcollect.BR; import com.phlx.anchorcollect.BR;
import com.phlx.anchorcollect.Configs; import com.phlx.anchorcollect.Configs;
import com.phlx.anchorcollect.R; import com.phlx.anchorcollect.R;
...@@ -40,7 +39,7 @@ import com.phlx.anchorcollect.entity.BreedingRecordDetailEntity; ...@@ -40,7 +39,7 @@ import com.phlx.anchorcollect.entity.BreedingRecordDetailEntity;
import com.phlx.anchorcollect.entity.DictEntity; import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.GenTableColumn; import com.phlx.anchorcollect.entity.GenTableColumn;
import com.phlx.anchorcollect.ui.fragment.vm.BreedingRecordVM; import com.phlx.anchorcollect.ui.fragment.vm.BreedingRecordVM;
import com.phlx.anchorcollect.util.DictUtils; import com.phlx.anchorcollect.util.LoginInfoUtils;
import com.phlx.anchorcollect.util.ImagePicker; import com.phlx.anchorcollect.util.ImagePicker;
import com.phlx.anchorcollect.util.StringUtil; import com.phlx.anchorcollect.util.StringUtil;
import com.phlx.anchorcollect.widget.SpaceItemDecoration; import com.phlx.anchorcollect.widget.SpaceItemDecoration;
...@@ -191,13 +190,13 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB ...@@ -191,13 +190,13 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
.title(uiParamEntity.getColumnComment()) .title(uiParamEntity.getColumnComment())
// .positiveText("确认") // .positiveText("确认")
// .negativeText("取消") // .negativeText("取消")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallback(new MaterialDialog.ListCallback() { .itemsCallback(new MaterialDialog.ListCallback() {
@Override @Override
public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show();
viewModel.currentParamEntity.setShowName(text.toString()); viewModel.currentParamEntity.setShowName(text.toString());
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue()); viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue());
viewModel.currentParamEntity.notifyChange(); viewModel.currentParamEntity.notifyChange();
} }
...@@ -211,14 +210,14 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB ...@@ -211,14 +210,14 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!") new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
// .cancelable(false).canceledOnTouchOutside(false) // .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定") .positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() { .itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
@Override @Override
public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) { public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {
String showName = ""; String showName = "";
String content = ""; String content = "";
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
if (which != null && which.length > 0) { if (which != null && which.length > 0) {
for (Integer i : which) { for (Integer i : which) {
showName += distTypeList.get(i).getDictLabel(); showName += distTypeList.get(i).getDictLabel();
...@@ -309,6 +308,11 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB ...@@ -309,6 +308,11 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位"); ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位");
return true; return true;
} }
} else if (uiParamEntity.getJavaType().equals("Integer")) {
if (!inputStr.matches("^[1-9][0-9]{0," + (finalColumnSize) + "}$")) {
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize) + "位");
return true;
}
} }
viewModel.currentParamEntity.setShowName(inputStr); viewModel.currentParamEntity.setShowName(inputStr);
viewModel.currentParamEntity.setContent(inputStr); viewModel.currentParamEntity.setContent(inputStr);
......
...@@ -36,8 +36,7 @@ import com.phlx.anchorcollect.databinding.FragmentImmunRecordBinding; ...@@ -36,8 +36,7 @@ import com.phlx.anchorcollect.databinding.FragmentImmunRecordBinding;
import com.phlx.anchorcollect.entity.DictEntity; import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.GenTableColumn; import com.phlx.anchorcollect.entity.GenTableColumn;
import com.phlx.anchorcollect.ui.fragment.vm.ImmunRecordVM; import com.phlx.anchorcollect.ui.fragment.vm.ImmunRecordVM;
import com.phlx.anchorcollect.ui.fragment.vm.PerformanceVM; import com.phlx.anchorcollect.util.LoginInfoUtils;
import com.phlx.anchorcollect.util.DictUtils;
import com.phlx.anchorcollect.util.ImagePicker; import com.phlx.anchorcollect.util.ImagePicker;
import com.phlx.anchorcollect.widget.SpaceItemDecoration; import com.phlx.anchorcollect.widget.SpaceItemDecoration;
import com.tbruyelle.rxpermissions2.RxPermissions; import com.tbruyelle.rxpermissions2.RxPermissions;
...@@ -48,8 +47,6 @@ import java.util.List; ...@@ -48,8 +47,6 @@ import java.util.List;
import io.reactivex.functions.Consumer; import io.reactivex.functions.Consumer;
import me.goldze.mvvmhabit.base.BaseFragment; import me.goldze.mvvmhabit.base.BaseFragment;
import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.utils.StringUtils;
import me.goldze.mvvmhabit.utils.ToastUtils; import me.goldze.mvvmhabit.utils.ToastUtils;
public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding, ImmunRecordVM> { public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding, ImmunRecordVM> {
...@@ -176,13 +173,13 @@ public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding ...@@ -176,13 +173,13 @@ public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding
.title(uiParamEntity.getColumnComment()) .title(uiParamEntity.getColumnComment())
// .positiveText("确认") // .positiveText("确认")
// .negativeText("取消") // .negativeText("取消")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallback(new MaterialDialog.ListCallback() { .itemsCallback(new MaterialDialog.ListCallback() {
@Override @Override
public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show();
viewModel.currentParamEntity.setShowName(text.toString()); viewModel.currentParamEntity.setShowName(text.toString());
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue()); viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue());
viewModel.currentParamEntity.notifyChange(); viewModel.currentParamEntity.notifyChange();
} }
...@@ -196,14 +193,14 @@ public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding ...@@ -196,14 +193,14 @@ public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!") new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false) .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定") .positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() { .itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
@Override @Override
public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) { public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {
String showName = ""; String showName = "";
String content = ""; String content = "";
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
if (which != null && which.length > 0) { if (which != null && which.length > 0) {
for (Integer i : which) { for (Integer i : which) {
showName += distTypeList.get(i).getDictLabel(); showName += distTypeList.get(i).getDictLabel();
...@@ -294,6 +291,11 @@ public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding ...@@ -294,6 +291,11 @@ public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位"); ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位");
return true; return true;
} }
} else if (uiParamEntity.getJavaType().equals("Integer")) {
if (!inputStr.matches("^[1-9][0-9]{0," + (finalColumnSize) + "}$")) {
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize) + "位");
return true;
}
} }
viewModel.currentParamEntity.setShowName(inputStr); viewModel.currentParamEntity.setShowName(inputStr);
viewModel.currentParamEntity.setContent(inputStr); viewModel.currentParamEntity.setContent(inputStr);
...@@ -405,7 +407,7 @@ public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding ...@@ -405,7 +407,7 @@ public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding
Window dialogWindow = mDialog.getWindow(); Window dialogWindow = mDialog.getWindow();
if (dialogWindow != null) { if (dialogWindow != null) {
dialogWindow.setWindowAnimations(com.bigkoo.pickerview.R.style.picker_view_slide_anim);//修改动画样式 dialogWindow.setWindowAnimations(R.style.picker_view_slide_anim);//修改动画样式
dialogWindow.setGravity(Gravity.CENTER);//改成Bottom,底部显示 dialogWindow.setGravity(Gravity.CENTER);//改成Bottom,底部显示
dialogWindow.setDimAmount(0.3f); dialogWindow.setDimAmount(0.3f);
} }
......
...@@ -35,8 +35,7 @@ import com.phlx.anchorcollect.databinding.FragmentMedicalRecordBinding; ...@@ -35,8 +35,7 @@ import com.phlx.anchorcollect.databinding.FragmentMedicalRecordBinding;
import com.phlx.anchorcollect.entity.DictEntity; import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.GenTableColumn; import com.phlx.anchorcollect.entity.GenTableColumn;
import com.phlx.anchorcollect.ui.fragment.vm.MedicalRecordVM; import com.phlx.anchorcollect.ui.fragment.vm.MedicalRecordVM;
import com.phlx.anchorcollect.ui.fragment.vm.PerformanceVM; import com.phlx.anchorcollect.util.LoginInfoUtils;
import com.phlx.anchorcollect.util.DictUtils;
import com.phlx.anchorcollect.util.ImagePicker; import com.phlx.anchorcollect.util.ImagePicker;
import com.phlx.anchorcollect.widget.SpaceItemDecoration; import com.phlx.anchorcollect.widget.SpaceItemDecoration;
import com.tbruyelle.rxpermissions2.RxPermissions; import com.tbruyelle.rxpermissions2.RxPermissions;
...@@ -47,7 +46,6 @@ import java.util.List; ...@@ -47,7 +46,6 @@ import java.util.List;
import io.reactivex.functions.Consumer; import io.reactivex.functions.Consumer;
import me.goldze.mvvmhabit.base.BaseFragment; import me.goldze.mvvmhabit.base.BaseFragment;
import me.goldze.mvvmhabit.utils.StringUtils;
import me.goldze.mvvmhabit.utils.ToastUtils; import me.goldze.mvvmhabit.utils.ToastUtils;
import me.tatarka.bindingcollectionadapter2.BR; import me.tatarka.bindingcollectionadapter2.BR;
...@@ -174,13 +172,13 @@ public class MedicalRecordFragment extends BaseFragment<FragmentMedicalRecordBin ...@@ -174,13 +172,13 @@ public class MedicalRecordFragment extends BaseFragment<FragmentMedicalRecordBin
.title(uiParamEntity.getColumnComment()) .title(uiParamEntity.getColumnComment())
// .positiveText("确认") // .positiveText("确认")
// .negativeText("取消") // .negativeText("取消")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallback(new MaterialDialog.ListCallback() { .itemsCallback(new MaterialDialog.ListCallback() {
@Override @Override
public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show();
viewModel.currentParamEntity.setShowName(text.toString()); viewModel.currentParamEntity.setShowName(text.toString());
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue()); viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue());
viewModel.currentParamEntity.notifyChange(); viewModel.currentParamEntity.notifyChange();
} }
...@@ -194,14 +192,14 @@ public class MedicalRecordFragment extends BaseFragment<FragmentMedicalRecordBin ...@@ -194,14 +192,14 @@ public class MedicalRecordFragment extends BaseFragment<FragmentMedicalRecordBin
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!") new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false) .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定") .positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() { .itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
@Override @Override
public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) { public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {
String showName = ""; String showName = "";
String content = ""; String content = "";
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
if (which != null && which.length > 0) { if (which != null && which.length > 0) {
for (Integer i : which) { for (Integer i : which) {
showName += distTypeList.get(i).getDictLabel(); showName += distTypeList.get(i).getDictLabel();
...@@ -292,6 +290,11 @@ public class MedicalRecordFragment extends BaseFragment<FragmentMedicalRecordBin ...@@ -292,6 +290,11 @@ public class MedicalRecordFragment extends BaseFragment<FragmentMedicalRecordBin
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位"); ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位");
return true; return true;
} }
} else if (uiParamEntity.getJavaType().equals("Integer")) {
if (!inputStr.matches("^[1-9][0-9]{0," + (finalColumnSize) + "}$")) {
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize) + "位");
return true;
}
} }
viewModel.currentParamEntity.setShowName(inputStr); viewModel.currentParamEntity.setShowName(inputStr);
viewModel.currentParamEntity.setContent(inputStr); viewModel.currentParamEntity.setContent(inputStr);
...@@ -403,7 +406,7 @@ public class MedicalRecordFragment extends BaseFragment<FragmentMedicalRecordBin ...@@ -403,7 +406,7 @@ public class MedicalRecordFragment extends BaseFragment<FragmentMedicalRecordBin
Window dialogWindow = mDialog.getWindow(); Window dialogWindow = mDialog.getWindow();
if (dialogWindow != null) { if (dialogWindow != null) {
dialogWindow.setWindowAnimations(com.bigkoo.pickerview.R.style.picker_view_slide_anim);//修改动画样式 dialogWindow.setWindowAnimations(R.style.picker_view_slide_anim);//修改动画样式
dialogWindow.setGravity(Gravity.CENTER);//改成Bottom,底部显示 dialogWindow.setGravity(Gravity.CENTER);//改成Bottom,底部显示
dialogWindow.setDimAmount(0.3f); dialogWindow.setDimAmount(0.3f);
} }
......
...@@ -2,7 +2,6 @@ package com.phlx.anchorcollect.ui.fragment; ...@@ -2,7 +2,6 @@ package com.phlx.anchorcollect.ui.fragment;
import android.Manifest; import android.Manifest;
import android.app.Dialog; import android.app.Dialog;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.text.InputType; import android.text.InputType;
import android.util.Log; import android.util.Log;
...@@ -35,10 +34,8 @@ import com.phlx.anchorcollect.data.VMFactory; ...@@ -35,10 +34,8 @@ import com.phlx.anchorcollect.data.VMFactory;
import com.phlx.anchorcollect.databinding.FragmentPerformanceBinding; import com.phlx.anchorcollect.databinding.FragmentPerformanceBinding;
import com.phlx.anchorcollect.entity.DictEntity; import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.GenTableColumn; import com.phlx.anchorcollect.entity.GenTableColumn;
import com.phlx.anchorcollect.rfid.ModuleManager;
import com.phlx.anchorcollect.ui.fragment.vm.BasicsCollectVM;
import com.phlx.anchorcollect.ui.fragment.vm.PerformanceVM; import com.phlx.anchorcollect.ui.fragment.vm.PerformanceVM;
import com.phlx.anchorcollect.util.DictUtils; import com.phlx.anchorcollect.util.LoginInfoUtils;
import com.phlx.anchorcollect.util.ImagePicker; import com.phlx.anchorcollect.util.ImagePicker;
import com.phlx.anchorcollect.widget.SpaceItemDecoration; import com.phlx.anchorcollect.widget.SpaceItemDecoration;
import com.tbruyelle.rxpermissions2.RxPermissions; import com.tbruyelle.rxpermissions2.RxPermissions;
...@@ -49,7 +46,6 @@ import java.util.List; ...@@ -49,7 +46,6 @@ import java.util.List;
import io.reactivex.functions.Consumer; import io.reactivex.functions.Consumer;
import me.goldze.mvvmhabit.base.BaseFragment; import me.goldze.mvvmhabit.base.BaseFragment;
import me.goldze.mvvmhabit.utils.StringUtils;
import me.goldze.mvvmhabit.utils.ToastUtils; import me.goldze.mvvmhabit.utils.ToastUtils;
import me.tatarka.bindingcollectionadapter2.BR; import me.tatarka.bindingcollectionadapter2.BR;
...@@ -177,13 +173,13 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding ...@@ -177,13 +173,13 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding
.title(uiParamEntity.getColumnComment()) .title(uiParamEntity.getColumnComment())
// .positiveText("确认") // .positiveText("确认")
// .negativeText("取消") // .negativeText("取消")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallback(new MaterialDialog.ListCallback() { .itemsCallback(new MaterialDialog.ListCallback() {
@Override @Override
public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show();
viewModel.currentParamEntity.setShowName(text.toString()); viewModel.currentParamEntity.setShowName(text.toString());
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue()); viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue());
viewModel.currentParamEntity.notifyChange(); viewModel.currentParamEntity.notifyChange();
} }
...@@ -197,14 +193,14 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding ...@@ -197,14 +193,14 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!") new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false) .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定") .positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() { .itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
@Override @Override
public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) { public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {
String showName = ""; String showName = "";
String content = ""; String content = "";
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
if (which != null && which.length > 0) { if (which != null && which.length > 0) {
for (Integer i : which) { for (Integer i : which) {
showName += distTypeList.get(i).getDictLabel(); showName += distTypeList.get(i).getDictLabel();
...@@ -295,6 +291,11 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding ...@@ -295,6 +291,11 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位"); ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位");
return true; return true;
} }
} else if (uiParamEntity.getJavaType().equals("Integer")) {
if (!inputStr.matches("^[1-9][0-9]{0," + (finalColumnSize) + "}$")) {
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize) + "位");
return true;
}
} }
viewModel.currentParamEntity.setShowName(inputStr); viewModel.currentParamEntity.setShowName(inputStr);
viewModel.currentParamEntity.setContent(inputStr); viewModel.currentParamEntity.setContent(inputStr);
...@@ -406,7 +407,7 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding ...@@ -406,7 +407,7 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding
Window dialogWindow = mDialog.getWindow(); Window dialogWindow = mDialog.getWindow();
if (dialogWindow != null) { if (dialogWindow != null) {
dialogWindow.setWindowAnimations(com.bigkoo.pickerview.R.style.picker_view_slide_anim);//修改动画样式 dialogWindow.setWindowAnimations(R.style.picker_view_slide_anim);//修改动画样式
dialogWindow.setGravity(Gravity.CENTER);//改成Bottom,底部显示 dialogWindow.setGravity(Gravity.CENTER);//改成Bottom,底部显示
dialogWindow.setDimAmount(0.3f); dialogWindow.setDimAmount(0.3f);
} }
......
...@@ -44,7 +44,7 @@ import com.phlx.anchorcollect.entity.WeightManEntity; ...@@ -44,7 +44,7 @@ import com.phlx.anchorcollect.entity.WeightManEntity;
import com.phlx.anchorcollect.event.EventTag; import com.phlx.anchorcollect.event.EventTag;
import com.phlx.anchorcollect.ui.fragment.vm.WeightManVM; import com.phlx.anchorcollect.ui.fragment.vm.WeightManVM;
import com.phlx.anchorcollect.ui.info.CattleActivity; import com.phlx.anchorcollect.ui.info.CattleActivity;
import com.phlx.anchorcollect.util.DictUtils; import com.phlx.anchorcollect.util.LoginInfoUtils;
import com.phlx.anchorcollect.util.ImagePicker; import com.phlx.anchorcollect.util.ImagePicker;
import com.phlx.anchorcollect.util.TextUtil; import com.phlx.anchorcollect.util.TextUtil;
import com.phlx.anchorcollect.widget.SpaceItemDecoration; import com.phlx.anchorcollect.widget.SpaceItemDecoration;
...@@ -309,13 +309,13 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We ...@@ -309,13 +309,13 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We
.title(uiParamEntity.getColumnComment()) .title(uiParamEntity.getColumnComment())
// .positiveText("确认") // .positiveText("确认")
// .negativeText("取消") // .negativeText("取消")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallback(new MaterialDialog.ListCallback() { .itemsCallback(new MaterialDialog.ListCallback() {
@Override @Override
public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), which + ":" + text.toString(), Toast.LENGTH_SHORT).show();
viewModel.currentParamEntity.setShowName(text.toString()); viewModel.currentParamEntity.setShowName(text.toString());
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue()); viewModel.currentParamEntity.setContent(distTypeList.get(which).getDictValue());
viewModel.currentParamEntity.notifyChange(); viewModel.currentParamEntity.notifyChange();
} }
...@@ -329,14 +329,14 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We ...@@ -329,14 +329,14 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!") new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false) .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定") .positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType())) .items(LoginInfoUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() { .itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
@Override @Override
public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) { public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {
String showName = ""; String showName = "";
String content = ""; String content = "";
List<DictEntity> distTypeList = DictUtils.getDistList(uiParamEntity.getDictType()); List<DictEntity> distTypeList = LoginInfoUtils.getDistList(uiParamEntity.getDictType());
if (which != null && which.length > 0) { if (which != null && which.length > 0) {
for (Integer i : which) { for (Integer i : which) {
showName += distTypeList.get(i).getDictLabel(); showName += distTypeList.get(i).getDictLabel();
...@@ -427,6 +427,11 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We ...@@ -427,6 +427,11 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位"); ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize - finalColumnPointSize - 1) + "位,小数最大" + finalColumnPointSize + "位");
return true; return true;
} }
} else if (uiParamEntity.getJavaType().equals("Integer")) {
if (!inputStr.matches("^[1-9][0-9]{0," + (finalColumnSize) + "}$")) {
ToastUtils.showShort("输入异常,整数最大" + (finalColumnSize) + "位");
return true;
}
} }
viewModel.currentParamEntity.setShowName(inputStr); viewModel.currentParamEntity.setShowName(inputStr);
viewModel.currentParamEntity.setContent(inputStr); viewModel.currentParamEntity.setContent(inputStr);
......
...@@ -32,6 +32,7 @@ import com.phlx.anchorcollect.db.interf.DbIDUCallBack; ...@@ -32,6 +32,7 @@ import com.phlx.anchorcollect.db.interf.DbIDUCallBack;
import com.phlx.anchorcollect.db.interf.DbQueryCallBack; import com.phlx.anchorcollect.db.interf.DbQueryCallBack;
import com.phlx.anchorcollect.entity.CattleResumeEntity; import com.phlx.anchorcollect.entity.CattleResumeEntity;
import com.phlx.anchorcollect.entity.DictEntity; import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.FrozenSemenEntity;
import com.phlx.anchorcollect.entity.GenTableColumn; import com.phlx.anchorcollect.entity.GenTableColumn;
import com.phlx.anchorcollect.entity.WeightManEntity; import com.phlx.anchorcollect.entity.WeightManEntity;
import com.phlx.anchorcollect.event.EventMsg; import com.phlx.anchorcollect.event.EventMsg;
...@@ -41,11 +42,11 @@ import com.phlx.anchorcollect.ui.labelchange.LabelChangeActivity; ...@@ -41,11 +42,11 @@ import com.phlx.anchorcollect.ui.labelchange.LabelChangeActivity;
import com.phlx.anchorcollect.ui.fragment.list.CollectGridItem; import com.phlx.anchorcollect.ui.fragment.list.CollectGridItem;
import com.phlx.anchorcollect.ui.setting.SettingActivity; import com.phlx.anchorcollect.ui.setting.SettingActivity;
import com.phlx.anchorcollect.ui.setting.SyncActivity; import com.phlx.anchorcollect.ui.setting.SyncActivity;
import com.phlx.anchorcollect.util.LoginInfoUtils;
import com.phlx.anchorcollect.util.EntityUtils; import com.phlx.anchorcollect.util.EntityUtils;
import com.phlx.anchorcollect.util.TextUtil; import com.phlx.anchorcollect.util.TextUtil;
import com.uhf.structures.InventoryData; import com.uhf.structures.InventoryData;
import com.uhf.structures.OnInventoryListener; import com.uhf.structures.OnInventoryListener;
import com.uhf.structures.Rfid_Value;
import org.greenrobot.greendao.query.QueryBuilder; import org.greenrobot.greendao.query.QueryBuilder;
...@@ -326,7 +327,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve ...@@ -326,7 +327,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
DbUtil.getInstance().getQueryBuilder(WeightManEntity.class) DbUtil.getInstance().getQueryBuilder(WeightManEntity.class)
.where(WeightManEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid)) .where(WeightManEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid))
.orderDesc(WeightManEntityDao.Properties.WTime); .orderDesc(WeightManEntityDao.Properties.WTime);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<WeightManEntity>() { DbUtil.getInstance().queryAsyncAll(WeightManEntity.class, builder3, new DbQueryCallBack<WeightManEntity>() {
@Override @Override
public void onSuccess(List<WeightManEntity> result) { public void onSuccess(List<WeightManEntity> result) {
...@@ -379,7 +380,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve ...@@ -379,7 +380,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
cn.wandersnail.commons.util.ToastUtils.showShort("查询称重记录失败!"); cn.wandersnail.commons.util.ToastUtils.showShort("查询称重记录失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(WeightManEntity.class, builder3); });
} }
public void onItemClick(GenTableColumn entity) { public void onItemClick(GenTableColumn entity) {
...@@ -518,7 +519,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve ...@@ -518,7 +519,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
private void queryCattleResume(QueryBuilder<CattleResumeEntity> builder) { private void queryCattleResume(QueryBuilder<CattleResumeEntity> builder) {
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsyncAll(CattleResumeEntity.class, builder, new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
...@@ -604,7 +605,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve ...@@ -604,7 +605,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
onNotifyAllEvent.setValue(true); onNotifyAllEvent.setValue(true);
ToastUtils.showShort("基础档案数据库查询失败"); ToastUtils.showShort("基础档案数据库查询失败");
} }
}).queryAsyncAll(CattleResumeEntity.class, builder); });
} }
private void saveCattleresume() { private void saveCattleresume() {
...@@ -655,11 +656,23 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve ...@@ -655,11 +656,23 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
cattleResumeEntity.setRemark(remarkParamEntity.getContent()); cattleResumeEntity.setRemark(remarkParamEntity.getContent());
cattleResumeEntity.setUploadStatus("0"); cattleResumeEntity.setUploadStatus("0");
//添加冻精系谱到牛只系谱
if(!StringUtils.isEmpty(cattleResumeEntity.getFatherReg())){
FrozenSemenEntity frozenSemenEntity = LoginInfoUtils.getFrozenSemenForName(cattleResumeEntity.getFatherReg());
if(frozenSemenEntity!=null){
cattleResumeEntity.setFfNum(frozenSemenEntity.getFuCode());
cattleResumeEntity.setFmNum(frozenSemenEntity.getMuCode());
cattleResumeEntity.setFffNum(frozenSemenEntity.getZfCode());
cattleResumeEntity.setFfmNum(frozenSemenEntity.getZmCode());
cattleResumeEntity.setFmfNum(frozenSemenEntity.getWzfCode());
cattleResumeEntity.setFmmNum(frozenSemenEntity.getWzmCode());
}
}
uploadData = new ArrayList<>(); uploadData = new ArrayList<>();
uploadData.add(cattleResumeEntity); uploadData.add(cattleResumeEntity);
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(CattleResumeEntity.class, uploadData, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
dismissDialog(); dismissDialog();
...@@ -672,7 +685,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve ...@@ -672,7 +685,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
ToastUtils.showShort("保存基础信息失败"); ToastUtils.showShort("保存基础信息失败");
} }
} }
}).insertAsyncBatch(CattleResumeEntity.class, uploadData); });
} }
......
...@@ -148,7 +148,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -148,7 +148,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
// , BreedingRecordEntityDao.Properties.CreateTime.like(DateUtils.getYear() + "%") // , BreedingRecordEntityDao.Properties.CreateTime.like(DateUtils.getYear() + "%")
) )
.orderDesc(BreedingRecordEntityDao.Properties.CreateTime); .orderDesc(BreedingRecordEntityDao.Properties.CreateTime);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordEntity.class, builder, new DbQueryCallBack<BreedingRecordEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordEntity> result) { public void onSuccess(List<BreedingRecordEntity> result) {
...@@ -168,7 +168,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -168,7 +168,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
onNotifyAllEvent.setValue(false); onNotifyAllEvent.setValue(false);
ToastUtils.showShort("配种记录主表-数据库查询失败"); ToastUtils.showShort("配种记录主表-数据库查询失败");
} }
}).queryAsyncAll(BreedingRecordEntity.class, builder); });
} }
...@@ -231,7 +231,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -231,7 +231,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
QueryBuilder<BreedingRecordDetailEntity> builder = DbUtil.getInstance().getQueryBuilder(BreedingRecordDetailEntity.class) QueryBuilder<BreedingRecordDetailEntity> builder = DbUtil.getInstance().getQueryBuilder(BreedingRecordDetailEntity.class)
.where(BreedingRecordDetailEntityDao.Properties.Unid.eq(clikeUnid)); .where(BreedingRecordDetailEntityDao.Properties.Unid.eq(clikeUnid));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordDetailEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordDetailEntity.class, builder, new DbQueryCallBack<BreedingRecordDetailEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordDetailEntity> result) { public void onSuccess(List<BreedingRecordDetailEntity> result) {
if (result != null && result.size() > 0) if (result != null && result.size() > 0)
...@@ -244,7 +244,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -244,7 +244,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
onNotifyAllEvent.setValue(false); onNotifyAllEvent.setValue(false);
ToastUtils.showShort("配种记录子表-数据库查询失败"); ToastUtils.showShort("配种记录子表-数据库查询失败");
} }
}).queryAsyncAll(BreedingRecordDetailEntity.class, builder); });
} }
...@@ -302,7 +302,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -302,7 +302,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
// , BreedingRecordDetailEntityDao.Properties.CreateTime.like(DateUtils.getYear() + "%") // , BreedingRecordDetailEntityDao.Properties.CreateTime.like(DateUtils.getYear() + "%")
) )
.orderDesc(BreedingRecordDetailEntityDao.Properties.CreateTime); .orderDesc(BreedingRecordDetailEntityDao.Properties.CreateTime);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordDetailEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordDetailEntity.class, builder, new DbQueryCallBack<BreedingRecordDetailEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordDetailEntity> result) { public void onSuccess(List<BreedingRecordDetailEntity> result) {
...@@ -319,7 +319,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -319,7 +319,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
onNotifyAllEvent.setValue(true); onNotifyAllEvent.setValue(true);
ToastUtils.showShort("配种记录子表-数据库查询失败"); ToastUtils.showShort("配种记录子表-数据库查询失败");
} }
}).queryAsyncAll(BreedingRecordDetailEntity.class, builder); });
} }
//回显列表的数据 //回显列表的数据
...@@ -497,7 +497,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -497,7 +497,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
uploadData = new ArrayList<>(); uploadData = new ArrayList<>();
uploadData.add(breedingRecordEntity); uploadData.add(breedingRecordEntity);
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(BreedingRecordEntity.class, uploadData, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
dismissDialog(); dismissDialog();
...@@ -509,7 +509,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -509,7 +509,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
ToastUtils.showShort("保存-配种记录主表-失败"); ToastUtils.showShort("保存-配种记录主表-失败");
} }
} }
}).insertAsyncBatch(BreedingRecordEntity.class, uploadData); });
} }
//保存子表 //保存子表
...@@ -573,7 +573,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -573,7 +573,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
detailUploadData = new ArrayList<>(); detailUploadData = new ArrayList<>();
detailUploadData.add(breedingRecordDetailEntity); detailUploadData.add(breedingRecordDetailEntity);
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(BreedingRecordDetailEntity.class, detailUploadData, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
dismissDialog(); dismissDialog();
...@@ -584,7 +584,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -584,7 +584,7 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
ToastUtils.showShort("保存-配种记录子表-失败"); ToastUtils.showShort("保存-配种记录子表-失败");
} }
} }
}).insertAsyncBatch(BreedingRecordDetailEntity.class, detailUploadData); });
} }
//清空数据源 //清空数据源
......
...@@ -167,7 +167,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> { ...@@ -167,7 +167,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> {
QueryBuilder<ImmuneBatchEntity> builder = QueryBuilder<ImmuneBatchEntity> builder =
DbUtil.getInstance().getQueryBuilder(ImmuneBatchEntity.class) DbUtil.getInstance().getQueryBuilder(ImmuneBatchEntity.class)
.where(ImmuneBatchEntityDao.Properties.Unid.eq(Configs.resumeId)); .where(ImmuneBatchEntityDao.Properties.Unid.eq(Configs.resumeId));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<ImmuneBatchEntity>() { DbUtil.getInstance().queryAsyncAll(ImmuneBatchEntity.class, builder, new DbQueryCallBack<ImmuneBatchEntity>() {
@Override @Override
public void onSuccess(List<ImmuneBatchEntity> result) { public void onSuccess(List<ImmuneBatchEntity> result) {
...@@ -183,7 +183,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> { ...@@ -183,7 +183,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> {
onNotifyAllEvent.setValue(true); onNotifyAllEvent.setValue(true);
ToastUtils.showShort("免疫记录-数据库查询失败"); ToastUtils.showShort("免疫记录-数据库查询失败");
} }
}).queryAsyncAll(ImmuneBatchEntity.class, builder); });
} }
...@@ -291,7 +291,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> { ...@@ -291,7 +291,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> {
, CattleResumeEntityDao.Properties.DeptId.eq(Long.parseLong(SPUtils.getInstance().getString(Configs.SP_DEPT_ID))) , CattleResumeEntityDao.Properties.DeptId.eq(Long.parseLong(SPUtils.getInstance().getString(Configs.SP_DEPT_ID)))
); );
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsyncAll(CattleResumeEntity.class, builder, new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
//查询圈舍内的牲畜 //查询圈舍内的牲畜
...@@ -310,13 +310,13 @@ public class ImmunRecordVM extends BaseViewModel<Repository> { ...@@ -310,13 +310,13 @@ public class ImmunRecordVM extends BaseViewModel<Repository> {
} }
//保存免疫主、子表 //保存免疫主、子表
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(ImmuneBatchEntity.class, uploadData, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
dismissDialog(); dismissDialog();
if (result) { if (result) {
if (!isModify) { if (!isModify) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(ImmuneBatchDetailEntity.class, detailUploadData, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
dismissDialog(); dismissDialog();
...@@ -327,7 +327,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> { ...@@ -327,7 +327,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> {
ToastUtils.showShort("保存免疫记录子表失败"); ToastUtils.showShort("保存免疫记录子表失败");
} }
} }
}).insertAsyncBatch(ImmuneBatchDetailEntity.class, detailUploadData); });
} else { } else {
onNotifyAllEvent.setValue(true); onNotifyAllEvent.setValue(true);
onShowDialogEvent.setValue("修改免疫记录成功!"); onShowDialogEvent.setValue("修改免疫记录成功!");
...@@ -336,7 +336,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> { ...@@ -336,7 +336,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> {
ToastUtils.showShort("保存免疫记录失败"); ToastUtils.showShort("保存免疫记录失败");
} }
} }
}).insertAsyncBatch(ImmuneBatchEntity.class, uploadData); });
} }
@Override @Override
...@@ -344,7 +344,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> { ...@@ -344,7 +344,7 @@ public class ImmunRecordVM extends BaseViewModel<Repository> {
cn.wandersnail.commons.util.ToastUtils.showShort("查询-圈舍牲畜-失败!"); cn.wandersnail.commons.util.ToastUtils.showShort("查询-圈舍牲畜-失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(CattleResumeEntity.class, builder); });
} else { } else {
ToastUtils.showShort("无法对已生成的免疫记录做修改!"); ToastUtils.showShort("无法对已生成的免疫记录做修改!");
......
...@@ -156,7 +156,7 @@ public class MedicalRecordVM extends BaseViewModel<Repository> { ...@@ -156,7 +156,7 @@ public class MedicalRecordVM extends BaseViewModel<Repository> {
QueryBuilder<MedicalRecordEntity> builder = QueryBuilder<MedicalRecordEntity> builder =
DbUtil.getInstance().getQueryBuilder(MedicalRecordEntity.class) DbUtil.getInstance().getQueryBuilder(MedicalRecordEntity.class)
.where(MedicalRecordEntityDao.Properties.Unid.eq(Configs.resumeId)); .where(MedicalRecordEntityDao.Properties.Unid.eq(Configs.resumeId));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<MedicalRecordEntity>() { DbUtil.getInstance().queryAsyncAll(MedicalRecordEntity.class, builder, new DbQueryCallBack<MedicalRecordEntity>() {
@Override @Override
public void onSuccess(List<MedicalRecordEntity> result) { public void onSuccess(List<MedicalRecordEntity> result) {
...@@ -173,7 +173,7 @@ public class MedicalRecordVM extends BaseViewModel<Repository> { ...@@ -173,7 +173,7 @@ public class MedicalRecordVM extends BaseViewModel<Repository> {
onNotifyAllEvent.setValue(true); onNotifyAllEvent.setValue(true);
ToastUtils.showShort("诊疗记录-数据库查询失败"); ToastUtils.showShort("诊疗记录-数据库查询失败");
} }
}).queryAsyncAll(MedicalRecordEntity.class, builder); });
} }
...@@ -274,7 +274,7 @@ public class MedicalRecordVM extends BaseViewModel<Repository> { ...@@ -274,7 +274,7 @@ public class MedicalRecordVM extends BaseViewModel<Repository> {
uploadData = new ArrayList<>(); uploadData = new ArrayList<>();
uploadData.add(medicalRecordEntity); uploadData.add(medicalRecordEntity);
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(MedicalRecordEntity.class, uploadData, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
dismissDialog(); dismissDialog();
...@@ -285,7 +285,7 @@ public class MedicalRecordVM extends BaseViewModel<Repository> { ...@@ -285,7 +285,7 @@ public class MedicalRecordVM extends BaseViewModel<Repository> {
ToastUtils.showShort("保存诊疗记录失败"); ToastUtils.showShort("保存诊疗记录失败");
} }
} }
}).insertAsyncBatch(MedicalRecordEntity.class, uploadData); });
} }
......
...@@ -183,7 +183,7 @@ public class PerformanceVM extends BaseViewModel<Repository> { ...@@ -183,7 +183,7 @@ public class PerformanceVM extends BaseViewModel<Repository> {
QueryBuilder<PerformanceEntity> builder = QueryBuilder<PerformanceEntity> builder =
DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class) DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class)
.where(PerformanceEntityDao.Properties.Unid.eq(Configs.resumeId)); .where(PerformanceEntityDao.Properties.Unid.eq(Configs.resumeId));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<PerformanceEntity>() { DbUtil.getInstance().queryAsyncAll(PerformanceEntity.class, builder, new DbQueryCallBack<PerformanceEntity>() {
@Override @Override
public void onSuccess(List<PerformanceEntity> result) { public void onSuccess(List<PerformanceEntity> result) {
...@@ -200,7 +200,7 @@ public class PerformanceVM extends BaseViewModel<Repository> { ...@@ -200,7 +200,7 @@ public class PerformanceVM extends BaseViewModel<Repository> {
onNotifyAllEvent.setValue(true); onNotifyAllEvent.setValue(true);
ToastUtils.showShort("性能测定-数据库查询失败"); ToastUtils.showShort("性能测定-数据库查询失败");
} }
}).queryAsyncAll(PerformanceEntity.class, builder); });
} }
...@@ -284,7 +284,7 @@ public class PerformanceVM extends BaseViewModel<Repository> { ...@@ -284,7 +284,7 @@ public class PerformanceVM extends BaseViewModel<Repository> {
.where(PerformanceEntityDao.Properties.Age.eq(performanceEntity.getAge()) .where(PerformanceEntityDao.Properties.Age.eq(performanceEntity.getAge())
, PerformanceEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid) , PerformanceEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid)
); );
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<PerformanceEntity>() { DbUtil.getInstance().queryAsyncAll(PerformanceEntity.class, builder, new DbQueryCallBack<PerformanceEntity>() {
@Override @Override
public void onSuccess(List<PerformanceEntity> result) { public void onSuccess(List<PerformanceEntity> result) {
...@@ -304,7 +304,7 @@ public class PerformanceVM extends BaseViewModel<Repository> { ...@@ -304,7 +304,7 @@ public class PerformanceVM extends BaseViewModel<Repository> {
public void onFailed() { public void onFailed() {
ToastUtils.showShort("性能测定月龄数据-数据库查询失败"); ToastUtils.showShort("性能测定月龄数据-数据库查询失败");
} }
}).queryAsyncAll(PerformanceEntity.class, builder); });
} }
...@@ -332,7 +332,7 @@ public class PerformanceVM extends BaseViewModel<Repository> { ...@@ -332,7 +332,7 @@ public class PerformanceVM extends BaseViewModel<Repository> {
uploadData = new ArrayList<>(); uploadData = new ArrayList<>();
uploadData.add(performanceEntity); uploadData.add(performanceEntity);
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(PerformanceEntity.class, uploadData, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
dismissDialog(); dismissDialog();
...@@ -343,7 +343,7 @@ public class PerformanceVM extends BaseViewModel<Repository> { ...@@ -343,7 +343,7 @@ public class PerformanceVM extends BaseViewModel<Repository> {
ToastUtils.showShort("保存性能测定失败"); ToastUtils.showShort("保存性能测定失败");
} }
} }
}).insertAsyncBatch(PerformanceEntity.class, uploadData); });
} }
......
...@@ -287,7 +287,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor ...@@ -287,7 +287,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
DbUtil.getInstance().getQueryBuilder(WeightManEntity.class) DbUtil.getInstance().getQueryBuilder(WeightManEntity.class)
.where(WeightManEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid)) .where(WeightManEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid))
.orderDesc(WeightManEntityDao.Properties.WTime); .orderDesc(WeightManEntityDao.Properties.WTime);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<WeightManEntity>() { DbUtil.getInstance().queryAsyncAll(WeightManEntity.class, builder3, new DbQueryCallBack<WeightManEntity>() {
@Override @Override
public void onSuccess(List<WeightManEntity> result) { public void onSuccess(List<WeightManEntity> result) {
...@@ -340,7 +340,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor ...@@ -340,7 +340,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
cn.wandersnail.commons.util.ToastUtils.showShort("查询称重记录失败!"); cn.wandersnail.commons.util.ToastUtils.showShort("查询称重记录失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(WeightManEntity.class, builder3); });
} }
...@@ -435,7 +435,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor ...@@ -435,7 +435,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
.where(WeightManEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid) .where(WeightManEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid)
, WeightManEntityDao.Properties.WTime.eq(weightManEntity.getWTime()) , WeightManEntityDao.Properties.WTime.eq(weightManEntity.getWTime())
); );
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<WeightManEntity>() { DbUtil.getInstance().queryAsyncAll(WeightManEntity.class, builder3, new DbQueryCallBack<WeightManEntity>() {
@Override @Override
public void onSuccess(List<WeightManEntity> result) { public void onSuccess(List<WeightManEntity> result) {
...@@ -473,7 +473,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor ...@@ -473,7 +473,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
cn.wandersnail.commons.util.ToastUtils.showShort("查询称重记录失败!"); cn.wandersnail.commons.util.ToastUtils.showShort("查询称重记录失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(WeightManEntity.class, builder3); });
} }
}); });
...@@ -490,7 +490,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor ...@@ -490,7 +490,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
private void queryCattleResume(QueryBuilder<CattleResumeEntity> builder) { private void queryCattleResume(QueryBuilder<CattleResumeEntity> builder) {
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsyncAll(CattleResumeEntity.class, builder, new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
...@@ -561,7 +561,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor ...@@ -561,7 +561,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
onNotifyAllEvent.setValue(true); onNotifyAllEvent.setValue(true);
ToastUtils.showShort("基础档案数据库查询失败"); ToastUtils.showShort("基础档案数据库查询失败");
} }
}).queryAsyncAll(CattleResumeEntity.class, builder); });
} }
public void saveWeightMan(WeightManEntity weightManEntity) { public void saveWeightMan(WeightManEntity weightManEntity) {
...@@ -569,7 +569,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor ...@@ -569,7 +569,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
uploadData = new ArrayList<>(); uploadData = new ArrayList<>();
uploadData.add(weightManEntity); uploadData.add(weightManEntity);
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(WeightManEntity.class, uploadData, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
dismissDialog(); dismissDialog();
...@@ -594,7 +594,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor ...@@ -594,7 +594,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
ToastUtils.showShort("保存称重记录失败"); ToastUtils.showShort("保存称重记录失败");
} }
} }
}).insertAsyncBatch(WeightManEntity.class, uploadData); });
} }
......
...@@ -78,7 +78,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -78,7 +78,7 @@ public class CattleVM extends BackBarVM<Repository> {
DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class) DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class)
.where(PerformanceEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid)) .where(PerformanceEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid))
.orderDesc(PerformanceEntityDao.Properties.CreateTime); .orderDesc(PerformanceEntityDao.Properties.CreateTime);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<PerformanceEntity>() { DbUtil.getInstance().queryAsyncAll(PerformanceEntity.class, builder, new DbQueryCallBack<PerformanceEntity>() {
@Override @Override
public void onSuccess(List<PerformanceEntity> result) { public void onSuccess(List<PerformanceEntity> result) {
...@@ -93,7 +93,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -93,7 +93,7 @@ public class CattleVM extends BackBarVM<Repository> {
public void onFailed() { public void onFailed() {
ToastUtils.showShort("性能测定-数据库查询失败"); ToastUtils.showShort("性能测定-数据库查询失败");
} }
}).queryAsyncAll(PerformanceEntity.class, builder); });
} }
public void queryMedicalRecordList() { public void queryMedicalRecordList() {
...@@ -102,7 +102,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -102,7 +102,7 @@ public class CattleVM extends BackBarVM<Repository> {
DbUtil.getInstance().getQueryBuilder(MedicalRecordEntity.class) DbUtil.getInstance().getQueryBuilder(MedicalRecordEntity.class)
.where(MedicalRecordEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid)) .where(MedicalRecordEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid))
.orderDesc(MedicalRecordEntityDao.Properties.CreateTime); .orderDesc(MedicalRecordEntityDao.Properties.CreateTime);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<MedicalRecordEntity>() { DbUtil.getInstance().queryAsyncAll(MedicalRecordEntity.class, builder, new DbQueryCallBack<MedicalRecordEntity>() {
@Override @Override
public void onSuccess(List<MedicalRecordEntity> result) { public void onSuccess(List<MedicalRecordEntity> result) {
...@@ -117,7 +117,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -117,7 +117,7 @@ public class CattleVM extends BackBarVM<Repository> {
public void onFailed() { public void onFailed() {
ToastUtils.showShort("诊疗记录-数据库查询失败"); ToastUtils.showShort("诊疗记录-数据库查询失败");
} }
}).queryAsyncAll(MedicalRecordEntity.class, builder); });
} }
public void queryImmunRecordList() { public void queryImmunRecordList() {
...@@ -125,7 +125,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -125,7 +125,7 @@ public class CattleVM extends BackBarVM<Repository> {
QueryBuilder<ImmuneBatchDetailEntity> detailBuilder = QueryBuilder<ImmuneBatchDetailEntity> detailBuilder =
DbUtil.getInstance().getQueryBuilder(ImmuneBatchDetailEntity.class) DbUtil.getInstance().getQueryBuilder(ImmuneBatchDetailEntity.class)
.where(ImmuneBatchDetailEntityDao.Properties.CattleresumeUnid.eq(Configs.tempUnid)); .where(ImmuneBatchDetailEntityDao.Properties.CattleresumeUnid.eq(Configs.tempUnid));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<ImmuneBatchDetailEntity>() { DbUtil.getInstance().queryAsyncAll(ImmuneBatchDetailEntity.class, detailBuilder, new DbQueryCallBack<ImmuneBatchDetailEntity>() {
@Override @Override
public void onSuccess(List<ImmuneBatchDetailEntity> result) { public void onSuccess(List<ImmuneBatchDetailEntity> result) {
...@@ -141,7 +141,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -141,7 +141,7 @@ public class CattleVM extends BackBarVM<Repository> {
DbUtil.getInstance().getQueryBuilder(ImmuneBatchEntity.class) DbUtil.getInstance().getQueryBuilder(ImmuneBatchEntity.class)
.where(ImmuneBatchEntityDao.Properties.Unid.in(immuneIds)) .where(ImmuneBatchEntityDao.Properties.Unid.in(immuneIds))
.orderDesc(ImmuneBatchEntityDao.Properties.CreateTime); .orderDesc(ImmuneBatchEntityDao.Properties.CreateTime);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<ImmuneBatchEntity>() { DbUtil.getInstance().queryAsyncAll(ImmuneBatchEntity.class, builder, new DbQueryCallBack<ImmuneBatchEntity>() {
@Override @Override
public void onSuccess(List<ImmuneBatchEntity> result) { public void onSuccess(List<ImmuneBatchEntity> result) {
...@@ -156,7 +156,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -156,7 +156,7 @@ public class CattleVM extends BackBarVM<Repository> {
public void onFailed() { public void onFailed() {
ToastUtils.showShort("免疫记录-数据库查询失败"); ToastUtils.showShort("免疫记录-数据库查询失败");
} }
}).queryAsyncAll(ImmuneBatchEntity.class, builder); });
} }
} else { } else {
observableRefreshList.setValue(2); observableRefreshList.setValue(2);
...@@ -167,7 +167,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -167,7 +167,7 @@ public class CattleVM extends BackBarVM<Repository> {
public void onFailed() { public void onFailed() {
ToastUtils.showShort("免疫记录-子表-数据库查询失败"); ToastUtils.showShort("免疫记录-子表-数据库查询失败");
} }
}).queryAsyncAll(ImmuneBatchDetailEntity.class, detailBuilder); });
} }
...@@ -177,7 +177,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -177,7 +177,7 @@ public class CattleVM extends BackBarVM<Repository> {
DbUtil.getInstance().getQueryBuilder(BreedingRecordEntity.class) DbUtil.getInstance().getQueryBuilder(BreedingRecordEntity.class)
.where(BreedingRecordEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid)) .where(BreedingRecordEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid))
.orderDesc(BreedingRecordEntityDao.Properties.CreateTime); .orderDesc(BreedingRecordEntityDao.Properties.CreateTime);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordEntity.class, builder, new DbQueryCallBack<BreedingRecordEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordEntity> result) { public void onSuccess(List<BreedingRecordEntity> result) {
...@@ -192,7 +192,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -192,7 +192,7 @@ public class CattleVM extends BackBarVM<Repository> {
public void onFailed() { public void onFailed() {
ToastUtils.showShort("配种记录主表-数据库查询失败"); ToastUtils.showShort("配种记录主表-数据库查询失败");
} }
}).queryAsyncAll(BreedingRecordEntity.class, builder); });
} }
...@@ -204,7 +204,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -204,7 +204,7 @@ public class CattleVM extends BackBarVM<Repository> {
// , BreedingRecordEntityDao.Properties.CreateTime.like(DateUtils.getYear() + "%") // , BreedingRecordEntityDao.Properties.CreateTime.like(DateUtils.getYear() + "%")
) )
.orderDesc(BreedingRecordEntityDao.Properties.CreateTime); .orderDesc(BreedingRecordEntityDao.Properties.CreateTime);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordEntity.class, builder, new DbQueryCallBack<BreedingRecordEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordEntity> result) { public void onSuccess(List<BreedingRecordEntity> result) {
...@@ -216,7 +216,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -216,7 +216,7 @@ public class CattleVM extends BackBarVM<Repository> {
// , BreedingRecordDetailEntityDao.Properties.CreateTime.like(DateUtils.getYear() + "%") // , BreedingRecordDetailEntityDao.Properties.CreateTime.like(DateUtils.getYear() + "%")
) )
.orderDesc(BreedingRecordDetailEntityDao.Properties.CreateTime); .orderDesc(BreedingRecordDetailEntityDao.Properties.CreateTime);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordDetailEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordDetailEntity.class, builder2, new DbQueryCallBack<BreedingRecordDetailEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordDetailEntity> result) { public void onSuccess(List<BreedingRecordDetailEntity> result) {
...@@ -235,7 +235,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -235,7 +235,7 @@ public class CattleVM extends BackBarVM<Repository> {
public void onFailed() { public void onFailed() {
ToastUtils.showShort("配种记录子表-数据库查询失败"); ToastUtils.showShort("配种记录子表-数据库查询失败");
} }
}).queryAsyncAll(BreedingRecordDetailEntity.class, builder2); });
} }
} }
...@@ -243,7 +243,7 @@ public class CattleVM extends BackBarVM<Repository> { ...@@ -243,7 +243,7 @@ public class CattleVM extends BackBarVM<Repository> {
public void onFailed() { public void onFailed() {
ToastUtils.showShort("配种记录主表-数据库查询失败"); ToastUtils.showShort("配种记录主表-数据库查询失败");
} }
}).queryAsyncAll(BreedingRecordEntity.class, builder); });
} }
......
...@@ -130,7 +130,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL ...@@ -130,7 +130,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL
return; return;
} }
if (!StringUtils.isEmpty(epc.get()) && epc.get().length() > 50) { if (!StringUtils.isEmpty(epc.get()) && epc.get().length() > 50) {
ToastUtils.showShort("高频耳标长度非法,请重新扫描!"); ToastUtils.showShort("电子耳标长度非法,请重新扫描!");
return; return;
} }
if (!StringUtils.isEmpty(noticeNo.get()) && noticeNo.get().length() > 25) { if (!StringUtils.isEmpty(noticeNo.get()) && noticeNo.get().length() > 25) {
...@@ -143,7 +143,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL ...@@ -143,7 +143,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL
if (checkResult != 0) { if (checkResult != 0) {
switch (checkResult) { switch (checkResult) {
case 1: case 1:
ToastUtils.showShort("高频耳标已存在,请重新扫描!"); ToastUtils.showShort("电子耳标已存在,请重新扫描!");
return; return;
case 3: case 3:
ToastUtils.showShort("可视耳标已存在,请重新填写!"); ToastUtils.showShort("可视耳标已存在,请重新填写!");
...@@ -163,7 +163,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL ...@@ -163,7 +163,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL
entity.setDeptId(Long.parseLong(SPUtils.getInstance().getString(Configs.SP_DEPT_ID))); entity.setDeptId(Long.parseLong(SPUtils.getInstance().getString(Configs.SP_DEPT_ID)));
uploadData.add(entity); uploadData.add(entity);
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(CattleResumeEntity.class, uploadData, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -173,7 +173,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL ...@@ -173,7 +173,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL
ToastUtils.showShort("保存" + getApplication().getResources().getString(R.string.label_change) + "失败!"); ToastUtils.showShort("保存" + getApplication().getResources().getString(R.string.label_change) + "失败!");
} }
} }
}).insertAsyncBatch(CattleResumeEntity.class, uploadData); });
} }
...@@ -265,7 +265,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL ...@@ -265,7 +265,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL
String sql = sbf.toString(); String sql = sbf.toString();
WhereCondition.StringCondition stringCondition = new WhereCondition.StringCondition(sql); WhereCondition.StringCondition stringCondition = new WhereCondition.StringCondition(sql);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsync(CattleResumeEntity.class, stringCondition, new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -282,7 +282,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL ...@@ -282,7 +282,7 @@ public class LabelChangeVM extends BackBarVM<Repository> implements OnInventoryL
ToastUtils.showShort("查询数据库失败"); ToastUtils.showShort("查询数据库失败");
finish(); finish();
} }
}).queryAsync(CattleResumeEntity.class, stringCondition); });
} }
......
...@@ -68,7 +68,7 @@ public class ExchangeListVM extends BackBarVM<Repository> { ...@@ -68,7 +68,7 @@ public class ExchangeListVM extends BackBarVM<Repository> {
DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class) DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class)
.where(CattleResumeEntityDao.Properties.Unid.eq(inspectEntities.get(position).getUnid())); .where(CattleResumeEntityDao.Properties.Unid.eq(inspectEntities.get(position).getUnid()));
int finalI = position; int finalI = position;
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsyncAll(CattleResumeEntity.class, builder, new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -88,6 +88,6 @@ public class ExchangeListVM extends BackBarVM<Repository> { ...@@ -88,6 +88,6 @@ public class ExchangeListVM extends BackBarVM<Repository> {
cn.wandersnail.commons.util.ToastUtils.showShort("查询基础信息失败!"); cn.wandersnail.commons.util.ToastUtils.showShort("查询基础信息失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(CattleResumeEntity.class, builder); });
} }
} }
...@@ -83,8 +83,8 @@ public class LoginVM extends BaseViewModel<Repository> { ...@@ -83,8 +83,8 @@ public class LoginVM extends BaseViewModel<Repository> {
// userName.set("13664793087"); // userName.set("13664793087");
// password.set("Abgq3087@"); // password.set("Abgq3087@");
// userName.set("15047917803"); // userName.set("15047962756");
// password.set("Tpsq7803*"); // password.set("Tpsq2756*");
// userName.set("13847913985"); // userName.set("13847913985");
// password.set("Xlht3985*"); // password.set("Xlht3985*");
// userName.set("ewei"); // userName.set("ewei");
......
...@@ -14,6 +14,7 @@ import com.phlx.anchorcollect.db.gen.DictEntityDao; ...@@ -14,6 +14,7 @@ import com.phlx.anchorcollect.db.gen.DictEntityDao;
import com.phlx.anchorcollect.db.interf.DbQueryCallBack; import com.phlx.anchorcollect.db.interf.DbQueryCallBack;
import com.phlx.anchorcollect.entity.CattleResumeEntity; import com.phlx.anchorcollect.entity.CattleResumeEntity;
import com.phlx.anchorcollect.entity.DictEntity; import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.FrozenSemenEntity;
import com.phlx.anchorcollect.entity.GenTableColumn; import com.phlx.anchorcollect.entity.GenTableColumn;
import com.phlx.anchorcollect.ui.base.MainBarVM; import com.phlx.anchorcollect.ui.base.MainBarVM;
import com.phlx.anchorcollect.util.EntityUtils; import com.phlx.anchorcollect.util.EntityUtils;
...@@ -43,6 +44,7 @@ public class MainVM extends MainBarVM<Repository> { ...@@ -43,6 +44,7 @@ public class MainVM extends MainBarVM<Repository> {
public void init() { public void init() {
Configs.dictList = DbUtil.getInstance().queryAll(DictEntity.class); Configs.dictList = DbUtil.getInstance().queryAll(DictEntity.class);
Configs.frozenSemenList = DbUtil.getInstance().queryAll(FrozenSemenEntity.class);
} }
...@@ -163,7 +165,7 @@ public class MainVM extends MainBarVM<Repository> { ...@@ -163,7 +165,7 @@ public class MainVM extends MainBarVM<Repository> {
QueryBuilder<CattleResumeEntity> builder = QueryBuilder<CattleResumeEntity> builder =
DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class) DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class)
.where(CattleResumeEntityDao.Properties.Unid.eq(Configs.tempUnid)); .where(CattleResumeEntityDao.Properties.Unid.eq(Configs.tempUnid));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsyncAll(CattleResumeEntity.class, builder, new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
...@@ -181,7 +183,7 @@ public class MainVM extends MainBarVM<Repository> { ...@@ -181,7 +183,7 @@ public class MainVM extends MainBarVM<Repository> {
public void onFailed() { public void onFailed() {
ToastUtils.showShort("基础档案数据库查询失败"); ToastUtils.showShort("基础档案数据库查询失败");
} }
}).queryAsyncAll(CattleResumeEntity.class, builder); });
} }
}); });
......
...@@ -245,7 +245,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -245,7 +245,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ids.add(cre.getUnid()); ids.add(cre.getUnid());
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(CattleResumeEntity.class, response.getData(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -255,7 +255,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -255,7 +255,7 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEvent.setValue("保存基础数据失败!"); errorEvent.setValue("保存基础数据失败!");
} }
} }
}).insertAsyncBatch(CattleResumeEntity.class, response.getData()); });
} else { } else {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步基础数据成功!"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步基础数据成功!");
queryCattleResumeUploadCount(false, UPLOAD_STATUS_HAVE_NOT); queryCattleResumeUploadCount(false, UPLOAD_STATUS_HAVE_NOT);
...@@ -326,7 +326,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -326,7 +326,7 @@ public class SyncVM extends BaseViewModel<Repository> {
DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class) DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class)
.where(CattleResumeEntityDao.Properties.UploadStatus.eq("0")) .where(CattleResumeEntityDao.Properties.UploadStatus.eq("0"))
.limit(10); .limit(10);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsyncAll(CattleResumeEntity.class, builder,new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -341,7 +341,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -341,7 +341,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询基础信息失败!"); ToastUtils.showShort("查询基础信息失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(CattleResumeEntity.class, builder); });
} }
/** /**
...@@ -396,7 +396,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -396,7 +396,7 @@ public class SyncVM extends BaseViewModel<Repository> {
} }
} }
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().updateAsyncBatch(CattleResumeEntity.class, cattleResumeEntities, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -407,7 +407,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -407,7 +407,7 @@ public class SyncVM extends BaseViewModel<Repository> {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改基础信息数据失败"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改基础信息数据失败");
} }
} }
}).updateAsyncBatch(CattleResumeEntity.class, cattleResumeEntities); });
}else if(response.getCode() == 301){ }else if(response.getCode() == 301){
inspectEvent.setValue((ArrayList<InspectEntity>)response.getData()); inspectEvent.setValue((ArrayList<InspectEntity>)response.getData());
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
...@@ -418,7 +418,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -418,7 +418,7 @@ public class SyncVM extends BaseViewModel<Repository> {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录");
} else { } else {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg()); me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg());
requestBaseArchives(); requestSignMeasure();
} }
}, (Consumer<ResponseThrowable>) throwable -> { }, (Consumer<ResponseThrowable>) throwable -> {
dismissDialog(); dismissDialog();
...@@ -452,7 +452,6 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -452,7 +452,6 @@ public class SyncVM extends BaseViewModel<Repository> {
.subscribe((Consumer<ListResponse<PerformanceEntity>>) response -> { .subscribe((Consumer<ListResponse<PerformanceEntity>>) response -> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
//存下最后更新的时间 //存下最后更新的时间
SPUtils.getInstance().put(Configs.SP_PERFORMANCE_UPDATE_DATE, dateFormat.format(new Date())); SPUtils.getInstance().put(Configs.SP_PERFORMANCE_UPDATE_DATE, dateFormat.format(new Date()));
performanceDate.set(SPUtils.getInstance().getString(Configs.SP_PERFORMANCE_UPDATE_DATE)); performanceDate.set(SPUtils.getInstance().getString(Configs.SP_PERFORMANCE_UPDATE_DATE));
...@@ -466,7 +465,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -466,7 +465,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ids.add(cre.getUnid()); ids.add(cre.getUnid());
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(PerformanceEntity.class, response.getData(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -476,7 +475,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -476,7 +475,7 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEvent.setValue("保存性能测定数据失败!"); errorEvent.setValue("保存性能测定数据失败!");
} }
} }
}).insertAsyncBatch(PerformanceEntity.class, response.getData()); });
} else { } else {
// dismissDialog(); // dismissDialog();
ToastUtils.showShort("性能测定数据同步完成!"); ToastUtils.showShort("性能测定数据同步完成!");
...@@ -549,7 +548,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -549,7 +548,7 @@ public class SyncVM extends BaseViewModel<Repository> {
DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class) DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class)
.where(PerformanceEntityDao.Properties.UploadStatus.eq("0")) .where(PerformanceEntityDao.Properties.UploadStatus.eq("0"))
.limit(10); .limit(10);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<PerformanceEntity>() { DbUtil.getInstance().queryAsyncAll(PerformanceEntity.class, builder, new DbQueryCallBack<PerformanceEntity>() {
@Override @Override
public void onSuccess(List<PerformanceEntity> result) { public void onSuccess(List<PerformanceEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -564,7 +563,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -564,7 +563,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询性能测定失败!"); ToastUtils.showShort("查询性能测定失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(PerformanceEntity.class, builder); });
} }
/** /**
...@@ -599,7 +598,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -599,7 +598,7 @@ public class SyncVM extends BaseViewModel<Repository> {
} }
} }
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().updateAsyncBatch(PerformanceEntity.class, performanceEntities, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -610,7 +609,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -610,7 +609,7 @@ public class SyncVM extends BaseViewModel<Repository> {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改性能测定数据失败"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改性能测定数据失败");
} }
} }
}).updateAsyncBatch(PerformanceEntity.class, performanceEntities); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
...@@ -667,7 +666,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -667,7 +666,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ids.add(cre.getUnid()); ids.add(cre.getUnid());
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(BreedingRecordEntity.class, response.getData(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -677,7 +676,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -677,7 +676,7 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEvent.setValue("保存配种记录主表数据失败!"); errorEvent.setValue("保存配种记录主表数据失败!");
} }
} }
}).insertAsyncBatch(BreedingRecordEntity.class, response.getData()); });
} else { } else {
// dismissDialog(); // dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步配种主表数据成功!"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步配种主表数据成功!");
...@@ -748,7 +747,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -748,7 +747,7 @@ public class SyncVM extends BaseViewModel<Repository> {
DbUtil.getInstance().getQueryBuilder(BreedingRecordEntity.class) DbUtil.getInstance().getQueryBuilder(BreedingRecordEntity.class)
.where(BreedingRecordEntityDao.Properties.UploadStatus.eq("0")) .where(BreedingRecordEntityDao.Properties.UploadStatus.eq("0"))
.limit(10); .limit(10);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordEntity.class, builder, new DbQueryCallBack<BreedingRecordEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordEntity> result) { public void onSuccess(List<BreedingRecordEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -763,7 +762,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -763,7 +762,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询-配种记录主表-失败!"); ToastUtils.showShort("查询-配种记录主表-失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(BreedingRecordEntity.class, builder); });
} }
/** /**
...@@ -796,7 +795,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -796,7 +795,7 @@ public class SyncVM extends BaseViewModel<Repository> {
} }
} }
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().updateAsyncBatch(BreedingRecordEntity.class, breedingRecordEntities, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -806,7 +805,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -806,7 +805,7 @@ public class SyncVM extends BaseViewModel<Repository> {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-配种记录主表-数据失败"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-配种记录主表-数据失败");
} }
} }
}).updateAsyncBatch(BreedingRecordEntity.class, breedingRecordEntities); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
...@@ -864,7 +863,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -864,7 +863,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ids.add(cre.getUnid()); ids.add(cre.getUnid());
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(BreedingRecordDetailEntity.class, response.getData(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -874,7 +873,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -874,7 +873,7 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEvent.setValue("保存配种记录子表数据失败!"); errorEvent.setValue("保存配种记录子表数据失败!");
} }
} }
}).insertAsyncBatch(BreedingRecordDetailEntity.class, response.getData()); });
} else { } else {
// dismissDialog(); // dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步配种记录子表数据成功!"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步配种记录子表数据成功!");
...@@ -945,7 +944,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -945,7 +944,7 @@ public class SyncVM extends BaseViewModel<Repository> {
DbUtil.getInstance().getQueryBuilder(BreedingRecordDetailEntity.class) DbUtil.getInstance().getQueryBuilder(BreedingRecordDetailEntity.class)
.where(BreedingRecordDetailEntityDao.Properties.UploadStatus.eq("0")) .where(BreedingRecordDetailEntityDao.Properties.UploadStatus.eq("0"))
.limit(10); .limit(10);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordDetailEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordDetailEntity.class, builder, new DbQueryCallBack<BreedingRecordDetailEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordDetailEntity> result) { public void onSuccess(List<BreedingRecordDetailEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -960,7 +959,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -960,7 +959,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询-配种记录子表-失败!"); ToastUtils.showShort("查询-配种记录子表-失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(BreedingRecordDetailEntity.class, builder); });
} }
/** /**
...@@ -993,7 +992,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -993,7 +992,7 @@ public class SyncVM extends BaseViewModel<Repository> {
} }
} }
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().updateAsyncBatch(BreedingRecordDetailEntity.class, breedingRecordDetailEntities, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -1003,7 +1002,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1003,7 +1002,7 @@ public class SyncVM extends BaseViewModel<Repository> {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-配种记录子表-数据失败"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-配种记录子表-数据失败");
} }
} }
}).updateAsyncBatch(BreedingRecordDetailEntity.class, breedingRecordDetailEntities); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
...@@ -1062,7 +1061,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1062,7 +1061,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ids.add(cre.getUnid()); ids.add(cre.getUnid());
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(WeightManEntity.class, response.getData(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -1072,7 +1071,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1072,7 +1071,7 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEvent.setValue("保存称重管理数据失败!"); errorEvent.setValue("保存称重管理数据失败!");
} }
} }
}).insertAsyncBatch(WeightManEntity.class, response.getData()); });
} else { } else {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步称重管理数据成功!"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步称重管理数据成功!");
// dismissDialog(); // dismissDialog();
...@@ -1143,7 +1142,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1143,7 +1142,7 @@ public class SyncVM extends BaseViewModel<Repository> {
DbUtil.getInstance().getQueryBuilder(WeightManEntity.class) DbUtil.getInstance().getQueryBuilder(WeightManEntity.class)
.where(WeightManEntityDao.Properties.UploadStatus.eq("0")) .where(WeightManEntityDao.Properties.UploadStatus.eq("0"))
.limit(10); .limit(10);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<WeightManEntity>() { DbUtil.getInstance().queryAsyncAll(WeightManEntity.class, builder, new DbQueryCallBack<WeightManEntity>() {
@Override @Override
public void onSuccess(List<WeightManEntity> result) { public void onSuccess(List<WeightManEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -1158,7 +1157,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1158,7 +1157,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询-称重管理-失败!"); ToastUtils.showShort("查询-称重管理-失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(WeightManEntity.class, builder); });
} }
/** /**
...@@ -1191,7 +1190,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1191,7 +1190,7 @@ public class SyncVM extends BaseViewModel<Repository> {
} }
} }
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().updateAsyncBatch(WeightManEntity.class, weightManEntities, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -1202,7 +1201,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1202,7 +1201,7 @@ public class SyncVM extends BaseViewModel<Repository> {
dismissDialog(); dismissDialog();
} }
} }
}).updateAsyncBatch(WeightManEntity.class, weightManEntities); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
...@@ -1260,7 +1259,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1260,7 +1259,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ids.add(cre.getUnid()); ids.add(cre.getUnid());
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(MedicalRecordEntity.class, response.getData(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -1270,7 +1269,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1270,7 +1269,7 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEvent.setValue("保存诊疗记录数据失败!"); errorEvent.setValue("保存诊疗记录数据失败!");
} }
} }
}).insertAsyncBatch(MedicalRecordEntity.class, response.getData()); });
} else { } else {
// dismissDialog(); // dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步诊疗记录数据成功!"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步诊疗记录数据成功!");
...@@ -1341,7 +1340,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1341,7 +1340,7 @@ public class SyncVM extends BaseViewModel<Repository> {
DbUtil.getInstance().getQueryBuilder(MedicalRecordEntity.class) DbUtil.getInstance().getQueryBuilder(MedicalRecordEntity.class)
.where(MedicalRecordEntityDao.Properties.UploadStatus.eq("0")) .where(MedicalRecordEntityDao.Properties.UploadStatus.eq("0"))
.limit(10); .limit(10);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<MedicalRecordEntity>() { DbUtil.getInstance().queryAsyncAll(MedicalRecordEntity.class, builder, new DbQueryCallBack<MedicalRecordEntity>() {
@Override @Override
public void onSuccess(List<MedicalRecordEntity> result) { public void onSuccess(List<MedicalRecordEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -1356,7 +1355,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1356,7 +1355,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询-诊疗记录-失败!"); ToastUtils.showShort("查询-诊疗记录-失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(MedicalRecordEntity.class, builder); });
} }
/** /**
...@@ -1389,7 +1388,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1389,7 +1388,7 @@ public class SyncVM extends BaseViewModel<Repository> {
} }
} }
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().updateAsyncBatch(MedicalRecordEntity.class, medicalRecordEntities, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -1400,7 +1399,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1400,7 +1399,7 @@ public class SyncVM extends BaseViewModel<Repository> {
dismissDialog(); dismissDialog();
} }
} }
}).updateAsyncBatch(MedicalRecordEntity.class, medicalRecordEntities); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
...@@ -1459,7 +1458,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1459,7 +1458,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ids.add(cre.getUnid()); ids.add(cre.getUnid());
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(ImmuneBatchEntity.class, response.getData(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -1469,7 +1468,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1469,7 +1468,7 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEvent.setValue("保存免疫记录-主表数据失败!"); errorEvent.setValue("保存免疫记录-主表数据失败!");
} }
} }
}).insertAsyncBatch(ImmuneBatchEntity.class, response.getData()); });
} else { } else {
// dismissDialog(); // dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步免疫记录-主表数据成功!"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步免疫记录-主表数据成功!");
...@@ -1542,7 +1541,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1542,7 +1541,7 @@ public class SyncVM extends BaseViewModel<Repository> {
DbUtil.getInstance().getQueryBuilder(ImmuneBatchEntity.class) DbUtil.getInstance().getQueryBuilder(ImmuneBatchEntity.class)
.where(ImmuneBatchEntityDao.Properties.UploadStatus.eq("0")) .where(ImmuneBatchEntityDao.Properties.UploadStatus.eq("0"))
.limit(10); .limit(10);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<ImmuneBatchEntity>() { DbUtil.getInstance().queryAsyncAll(ImmuneBatchEntity.class, builder, new DbQueryCallBack<ImmuneBatchEntity>() {
@Override @Override
public void onSuccess(List<ImmuneBatchEntity> result) { public void onSuccess(List<ImmuneBatchEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -1557,7 +1556,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1557,7 +1556,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询-免疫记录-主表-失败!"); ToastUtils.showShort("查询-免疫记录-主表-失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(ImmuneBatchEntity.class, builder); });
} }
/** /**
...@@ -1590,7 +1589,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1590,7 +1589,7 @@ public class SyncVM extends BaseViewModel<Repository> {
} }
} }
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().updateAsyncBatch(ImmuneBatchEntity.class, immuneBatchEntities, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -1601,7 +1600,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1601,7 +1600,7 @@ public class SyncVM extends BaseViewModel<Repository> {
dismissDialog(); dismissDialog();
} }
} }
}).updateAsyncBatch(ImmuneBatchEntity.class, immuneBatchEntities); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
...@@ -1660,7 +1659,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1660,7 +1659,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ids.add(cre.getUnid()); ids.add(cre.getUnid());
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(ImmuneBatchDetailEntity.class, response.getData(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -1670,7 +1669,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1670,7 +1669,7 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEvent.setValue("保存免疫记录-子表数据失败!"); errorEvent.setValue("保存免疫记录-子表数据失败!");
} }
} }
}).insertAsyncBatch(ImmuneBatchDetailEntity.class, response.getData()); });
} else { } else {
// dismissDialog(); // dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步免疫记录-子表数据成功!"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("同步免疫记录-子表数据成功!");
...@@ -1741,7 +1740,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1741,7 +1740,7 @@ public class SyncVM extends BaseViewModel<Repository> {
DbUtil.getInstance().getQueryBuilder(ImmuneBatchDetailEntity.class) DbUtil.getInstance().getQueryBuilder(ImmuneBatchDetailEntity.class)
.where(ImmuneBatchDetailEntityDao.Properties.UploadStatus.eq("0")) .where(ImmuneBatchDetailEntityDao.Properties.UploadStatus.eq("0"))
.limit(10); .limit(10);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<ImmuneBatchDetailEntity>() { DbUtil.getInstance().queryAsyncAll(ImmuneBatchDetailEntity.class, builder, new DbQueryCallBack<ImmuneBatchDetailEntity>() {
@Override @Override
public void onSuccess(List<ImmuneBatchDetailEntity> result) { public void onSuccess(List<ImmuneBatchDetailEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -1756,7 +1755,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1756,7 +1755,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询-免疫记录-子表-失败!"); ToastUtils.showShort("查询-免疫记录-子表-失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(ImmuneBatchDetailEntity.class, builder); });
} }
/** /**
...@@ -1789,7 +1788,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1789,7 +1788,7 @@ public class SyncVM extends BaseViewModel<Repository> {
} }
} }
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().updateAsyncBatch(ImmuneBatchDetailEntity.class, immuneBatchEntities, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -1800,7 +1799,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1800,7 +1799,7 @@ public class SyncVM extends BaseViewModel<Repository> {
dismissDialog(); dismissDialog();
} }
} }
}).updateAsyncBatch(ImmuneBatchDetailEntity.class, immuneBatchEntities); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
...@@ -1845,7 +1844,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1845,7 +1844,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<CattleResumeEntity> builder0 = QueryBuilder<CattleResumeEntity> builder0 =
DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class) DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class)
.where(CattleResumeEntityDao.Properties.UploadStatus.eq(uploadType)); .where(CattleResumeEntityDao.Properties.UploadStatus.eq(uploadType));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsyncAll(CattleResumeEntity.class, builder0, new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
if (result != null) { if (result != null) {
...@@ -1873,7 +1872,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1873,7 +1872,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询基础数据数量失败!"); ToastUtils.showShort("查询基础数据数量失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(CattleResumeEntity.class, builder0); });
} }
...@@ -1884,7 +1883,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1884,7 +1883,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<PerformanceEntity> builder1 = QueryBuilder<PerformanceEntity> builder1 =
DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class) DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class)
.where(PerformanceEntityDao.Properties.UploadStatus.eq(uploadType)); .where(PerformanceEntityDao.Properties.UploadStatus.eq(uploadType));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<PerformanceEntity>() { DbUtil.getInstance().queryAsyncAll(PerformanceEntity.class, builder1, new DbQueryCallBack<PerformanceEntity>() {
@Override @Override
public void onSuccess(List<PerformanceEntity> result) { public void onSuccess(List<PerformanceEntity> result) {
if (result != null) { if (result != null) {
...@@ -1914,7 +1913,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1914,7 +1913,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询性能测定数量失败!"); ToastUtils.showShort("查询性能测定数量失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(PerformanceEntity.class, builder1); });
} }
...@@ -1925,7 +1924,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1925,7 +1924,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<WeightManEntity> builder2 = QueryBuilder<WeightManEntity> builder2 =
DbUtil.getInstance().getQueryBuilder(WeightManEntity.class) DbUtil.getInstance().getQueryBuilder(WeightManEntity.class)
.where(WeightManEntityDao.Properties.UploadStatus.eq(uploadType)); .where(WeightManEntityDao.Properties.UploadStatus.eq(uploadType));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<WeightManEntity>() { DbUtil.getInstance().queryAsyncAll(WeightManEntity.class, builder2, new DbQueryCallBack<WeightManEntity>() {
@Override @Override
public void onSuccess(List<WeightManEntity> result) { public void onSuccess(List<WeightManEntity> result) {
if (result != null) { if (result != null) {
...@@ -1954,7 +1953,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1954,7 +1953,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询称重管理数量失败!"); ToastUtils.showShort("查询称重管理数量失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(WeightManEntity.class, builder2); });
} }
...@@ -1965,7 +1964,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1965,7 +1964,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<MedicalRecordEntity> builder3 = QueryBuilder<MedicalRecordEntity> builder3 =
DbUtil.getInstance().getQueryBuilder(MedicalRecordEntity.class) DbUtil.getInstance().getQueryBuilder(MedicalRecordEntity.class)
.where(MedicalRecordEntityDao.Properties.UploadStatus.eq(uploadType)); .where(MedicalRecordEntityDao.Properties.UploadStatus.eq(uploadType));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<MedicalRecordEntity>() { DbUtil.getInstance().queryAsyncAll(MedicalRecordEntity.class, builder3, new DbQueryCallBack<MedicalRecordEntity>() {
@Override @Override
public void onSuccess(List<MedicalRecordEntity> result) { public void onSuccess(List<MedicalRecordEntity> result) {
if (result != null) { if (result != null) {
...@@ -1994,7 +1993,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1994,7 +1993,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询诊疗记录数量失败!"); ToastUtils.showShort("查询诊疗记录数量失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(MedicalRecordEntity.class, builder3); });
} }
...@@ -2005,7 +2004,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2005,7 +2004,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<ImmuneBatchEntity> builder4 = QueryBuilder<ImmuneBatchEntity> builder4 =
DbUtil.getInstance().getQueryBuilder(ImmuneBatchEntity.class) DbUtil.getInstance().getQueryBuilder(ImmuneBatchEntity.class)
.where(ImmuneBatchEntityDao.Properties.UploadStatus.eq(uploadType)); .where(ImmuneBatchEntityDao.Properties.UploadStatus.eq(uploadType));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<ImmuneBatchEntity>() { DbUtil.getInstance().queryAsyncAll(ImmuneBatchEntity.class, builder4, new DbQueryCallBack<ImmuneBatchEntity>() {
@Override @Override
public void onSuccess(List<ImmuneBatchEntity> result) { public void onSuccess(List<ImmuneBatchEntity> result) {
if (result != null) { if (result != null) {
...@@ -2034,7 +2033,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2034,7 +2033,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询免疫记录-主表数量失败!"); ToastUtils.showShort("查询免疫记录-主表数量失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(ImmuneBatchEntity.class, builder4); });
} }
...@@ -2045,7 +2044,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2045,7 +2044,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<ImmuneBatchDetailEntity> builder5 = QueryBuilder<ImmuneBatchDetailEntity> builder5 =
DbUtil.getInstance().getQueryBuilder(ImmuneBatchDetailEntity.class) DbUtil.getInstance().getQueryBuilder(ImmuneBatchDetailEntity.class)
.where(ImmuneBatchDetailEntityDao.Properties.UploadStatus.eq(uploadType)); .where(ImmuneBatchDetailEntityDao.Properties.UploadStatus.eq(uploadType));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<ImmuneBatchDetailEntity>() { DbUtil.getInstance().queryAsyncAll(ImmuneBatchDetailEntity.class, builder5, new DbQueryCallBack<ImmuneBatchDetailEntity>() {
@Override @Override
public void onSuccess(List<ImmuneBatchDetailEntity> result) { public void onSuccess(List<ImmuneBatchDetailEntity> result) {
if (result != null) { if (result != null) {
...@@ -2074,7 +2073,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2074,7 +2073,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询免疫记录-子表数量失败!"); ToastUtils.showShort("查询免疫记录-子表数量失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(ImmuneBatchDetailEntity.class, builder5); });
} }
...@@ -2085,7 +2084,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2085,7 +2084,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<BreedingRecordEntity> builder6 = QueryBuilder<BreedingRecordEntity> builder6 =
DbUtil.getInstance().getQueryBuilder(BreedingRecordEntity.class) DbUtil.getInstance().getQueryBuilder(BreedingRecordEntity.class)
.where(BreedingRecordEntityDao.Properties.UploadStatus.eq(uploadType)); .where(BreedingRecordEntityDao.Properties.UploadStatus.eq(uploadType));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordEntity.class, builder6, new DbQueryCallBack<BreedingRecordEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordEntity> result) { public void onSuccess(List<BreedingRecordEntity> result) {
if (result != null) { if (result != null) {
...@@ -2114,7 +2113,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2114,7 +2113,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询配种记录-主表数量失败!"); ToastUtils.showShort("查询配种记录-主表数量失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(BreedingRecordEntity.class, builder6); });
} }
...@@ -2125,7 +2124,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2125,7 +2124,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<BreedingRecordDetailEntity> builder7 = QueryBuilder<BreedingRecordDetailEntity> builder7 =
DbUtil.getInstance().getQueryBuilder(BreedingRecordDetailEntity.class) DbUtil.getInstance().getQueryBuilder(BreedingRecordDetailEntity.class)
.where(BreedingRecordDetailEntityDao.Properties.UploadStatus.eq(uploadType)); .where(BreedingRecordDetailEntityDao.Properties.UploadStatus.eq(uploadType));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordDetailEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordDetailEntity.class, builder7, new DbQueryCallBack<BreedingRecordDetailEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordDetailEntity> result) { public void onSuccess(List<BreedingRecordDetailEntity> result) {
if (result != null) { if (result != null) {
...@@ -2154,7 +2153,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2154,7 +2153,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询配种记录-子表数量失败!"); ToastUtils.showShort("查询配种记录-子表数量失败!");
dismissDialog(); dismissDialog();
} }
}).queryAsyncAll(BreedingRecordDetailEntity.class, builder7); });
} }
/** /**
...@@ -2169,7 +2168,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2169,7 +2168,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<CattleResumeEntity> builder = QueryBuilder<CattleResumeEntity> builder =
DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class) DbUtil.getInstance().getQueryBuilder(CattleResumeEntity.class)
.where(CattleResumeEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1); .where(CattleResumeEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<CattleResumeEntity>() { DbUtil.getInstance().queryAsyncAll(CattleResumeEntity.class, builder, new DbQueryCallBack<CattleResumeEntity>() {
@Override @Override
public void onSuccess(List<CattleResumeEntity> result) { public void onSuccess(List<CattleResumeEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -2193,7 +2192,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2193,7 +2192,7 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().deleteAsyncBatch(CattleResumeEntity.class, result, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -2202,7 +2201,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2202,7 +2201,7 @@ public class SyncVM extends BaseViewModel<Repository> {
uploadPerformanceError(); uploadPerformanceError();
} }
} }
}).deleteAsyncBatch(CattleResumeEntity.class, result); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
...@@ -2231,7 +2230,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2231,7 +2230,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询基础数据错误数据失败!"); ToastUtils.showShort("查询基础数据错误数据失败!");
uploadPerformanceError(); uploadPerformanceError();
} }
}).queryAsyncAll(CattleResumeEntity.class, builder); });
} }
private void uploadPerformanceError() { private void uploadPerformanceError() {
...@@ -2239,7 +2238,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2239,7 +2238,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<PerformanceEntity> builder = QueryBuilder<PerformanceEntity> builder =
DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class) DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class)
.where(PerformanceEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1); .where(PerformanceEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<PerformanceEntity>() { DbUtil.getInstance().queryAsyncAll(PerformanceEntity.class, builder, new DbQueryCallBack<PerformanceEntity>() {
@Override @Override
public void onSuccess(List<PerformanceEntity> result) { public void onSuccess(List<PerformanceEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -2263,7 +2262,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2263,7 +2262,7 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().deleteAsyncBatch(PerformanceEntity.class, result, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -2272,7 +2271,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2272,7 +2271,7 @@ public class SyncVM extends BaseViewModel<Repository> {
uploadWeightManError(); uploadWeightManError();
} }
} }
}).deleteAsyncBatch(PerformanceEntity.class, result); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
...@@ -2301,7 +2300,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2301,7 +2300,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询性能测定错误数据失败!"); ToastUtils.showShort("查询性能测定错误数据失败!");
uploadWeightManError(); uploadWeightManError();
} }
}).queryAsyncAll(PerformanceEntity.class, builder); });
} }
...@@ -2310,7 +2309,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2310,7 +2309,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<WeightManEntity> builder = QueryBuilder<WeightManEntity> builder =
DbUtil.getInstance().getQueryBuilder(WeightManEntity.class) DbUtil.getInstance().getQueryBuilder(WeightManEntity.class)
.where(WeightManEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1); .where(WeightManEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<WeightManEntity>() { DbUtil.getInstance().queryAsyncAll(WeightManEntity.class, builder, new DbQueryCallBack<WeightManEntity>() {
@Override @Override
public void onSuccess(List<WeightManEntity> result) { public void onSuccess(List<WeightManEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -2334,7 +2333,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2334,7 +2333,7 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().deleteAsyncBatch(WeightManEntity.class, result, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -2343,7 +2342,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2343,7 +2342,7 @@ public class SyncVM extends BaseViewModel<Repository> {
uploadMedicalRecordError(); uploadMedicalRecordError();
} }
} }
}).deleteAsyncBatch(WeightManEntity.class, result); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
...@@ -2372,7 +2371,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2372,7 +2371,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询称重错误数据失败!"); ToastUtils.showShort("查询称重错误数据失败!");
uploadMedicalRecordError(); uploadMedicalRecordError();
} }
}).queryAsyncAll(WeightManEntity.class, builder); });
} }
private void uploadMedicalRecordError() { private void uploadMedicalRecordError() {
...@@ -2380,7 +2379,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2380,7 +2379,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<MedicalRecordEntity> builder = QueryBuilder<MedicalRecordEntity> builder =
DbUtil.getInstance().getQueryBuilder(MedicalRecordEntity.class) DbUtil.getInstance().getQueryBuilder(MedicalRecordEntity.class)
.where(MedicalRecordEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1); .where(MedicalRecordEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<MedicalRecordEntity>() { DbUtil.getInstance().queryAsyncAll(MedicalRecordEntity.class, builder, new DbQueryCallBack<MedicalRecordEntity>() {
@Override @Override
public void onSuccess(List<MedicalRecordEntity> result) { public void onSuccess(List<MedicalRecordEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -2404,7 +2403,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2404,7 +2403,7 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().deleteAsyncBatch(MedicalRecordEntity.class, result, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -2413,7 +2412,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2413,7 +2412,7 @@ public class SyncVM extends BaseViewModel<Repository> {
uploadImmuneBatchError(); uploadImmuneBatchError();
} }
} }
}).deleteAsyncBatch(MedicalRecordEntity.class, result); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
...@@ -2442,7 +2441,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2442,7 +2441,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询诊疗记录错误数据失败!"); ToastUtils.showShort("查询诊疗记录错误数据失败!");
uploadImmuneBatchError(); uploadImmuneBatchError();
} }
}).queryAsyncAll(MedicalRecordEntity.class, builder); });
} }
...@@ -2452,7 +2451,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2452,7 +2451,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<ImmuneBatchEntity> builder = QueryBuilder<ImmuneBatchEntity> builder =
DbUtil.getInstance().getQueryBuilder(ImmuneBatchEntity.class) DbUtil.getInstance().getQueryBuilder(ImmuneBatchEntity.class)
.where(ImmuneBatchEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1); .where(ImmuneBatchEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<ImmuneBatchEntity>() { DbUtil.getInstance().queryAsyncAll(ImmuneBatchEntity.class, builder, new DbQueryCallBack<ImmuneBatchEntity>() {
@Override @Override
public void onSuccess(List<ImmuneBatchEntity> result) { public void onSuccess(List<ImmuneBatchEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -2476,7 +2475,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2476,7 +2475,7 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().deleteAsyncBatch(ImmuneBatchEntity.class, result, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -2485,7 +2484,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2485,7 +2484,7 @@ public class SyncVM extends BaseViewModel<Repository> {
uploadImmuneBatchDetailError(); uploadImmuneBatchDetailError();
} }
} }
}).deleteAsyncBatch(ImmuneBatchEntity.class, result); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
...@@ -2514,7 +2513,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2514,7 +2513,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询免疫记录错误数据失败!"); ToastUtils.showShort("查询免疫记录错误数据失败!");
uploadImmuneBatchDetailError(); uploadImmuneBatchDetailError();
} }
}).queryAsyncAll(ImmuneBatchEntity.class, builder); });
} }
...@@ -2525,7 +2524,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2525,7 +2524,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<ImmuneBatchDetailEntity> builder = QueryBuilder<ImmuneBatchDetailEntity> builder =
DbUtil.getInstance().getQueryBuilder(ImmuneBatchDetailEntity.class) DbUtil.getInstance().getQueryBuilder(ImmuneBatchDetailEntity.class)
.where(ImmuneBatchDetailEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1); .where(ImmuneBatchDetailEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<ImmuneBatchDetailEntity>() { DbUtil.getInstance().queryAsyncAll(ImmuneBatchDetailEntity.class, builder, new DbQueryCallBack<ImmuneBatchDetailEntity>() {
@Override @Override
public void onSuccess(List<ImmuneBatchDetailEntity> result) { public void onSuccess(List<ImmuneBatchDetailEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -2549,7 +2548,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2549,7 +2548,7 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().deleteAsyncBatch(ImmuneBatchDetailEntity.class, result, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -2558,7 +2557,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2558,7 +2557,7 @@ public class SyncVM extends BaseViewModel<Repository> {
uploadBreedingRecordError(); uploadBreedingRecordError();
} }
} }
}).deleteAsyncBatch(ImmuneBatchDetailEntity.class, result); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
...@@ -2587,7 +2586,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2587,7 +2586,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询免疫记录-子表错误数据失败!"); ToastUtils.showShort("查询免疫记录-子表错误数据失败!");
uploadBreedingRecordError(); uploadBreedingRecordError();
} }
}).queryAsyncAll(ImmuneBatchDetailEntity.class, builder); });
} }
...@@ -2597,7 +2596,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2597,7 +2596,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<BreedingRecordEntity> builder = QueryBuilder<BreedingRecordEntity> builder =
DbUtil.getInstance().getQueryBuilder(BreedingRecordEntity.class) DbUtil.getInstance().getQueryBuilder(BreedingRecordEntity.class)
.where(BreedingRecordEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1); .where(BreedingRecordEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordEntity.class, builder, new DbQueryCallBack<BreedingRecordEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordEntity> result) { public void onSuccess(List<BreedingRecordEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -2621,7 +2620,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2621,7 +2620,7 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().deleteAsyncBatch(BreedingRecordEntity.class, result, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -2630,7 +2629,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2630,7 +2629,7 @@ public class SyncVM extends BaseViewModel<Repository> {
uploadBreedingRecordDetailError(); uploadBreedingRecordDetailError();
} }
} }
}).deleteAsyncBatch(BreedingRecordEntity.class, result); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
...@@ -2659,7 +2658,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2659,7 +2658,7 @@ public class SyncVM extends BaseViewModel<Repository> {
ToastUtils.showShort("查询配种记录错误数据失败!"); ToastUtils.showShort("查询配种记录错误数据失败!");
uploadBreedingRecordDetailError(); uploadBreedingRecordDetailError();
} }
}).queryAsyncAll(BreedingRecordEntity.class, builder); });
} }
...@@ -2669,7 +2668,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2669,7 +2668,7 @@ public class SyncVM extends BaseViewModel<Repository> {
QueryBuilder<BreedingRecordDetailEntity> builder = QueryBuilder<BreedingRecordDetailEntity> builder =
DbUtil.getInstance().getQueryBuilder(BreedingRecordDetailEntity.class) DbUtil.getInstance().getQueryBuilder(BreedingRecordDetailEntity.class)
.where(BreedingRecordDetailEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1); .where(BreedingRecordDetailEntityDao.Properties.UploadStatus.eq(UPLOAD_STATUS_ERROR)).limit(1);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<BreedingRecordDetailEntity>() { DbUtil.getInstance().queryAsyncAll(BreedingRecordDetailEntity.class, builder, new DbQueryCallBack<BreedingRecordDetailEntity>() {
@Override @Override
public void onSuccess(List<BreedingRecordDetailEntity> result) { public void onSuccess(List<BreedingRecordDetailEntity> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
...@@ -2693,7 +2692,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2693,7 +2692,7 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().deleteAsyncBatch(BreedingRecordDetailEntity.class, result, new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -2703,7 +2702,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2703,7 +2702,7 @@ public class SyncVM extends BaseViewModel<Repository> {
queryCattleResumeUploadCount(true, UPLOAD_STATUS_HAVE_NOT); queryCattleResumeUploadCount(true, UPLOAD_STATUS_HAVE_NOT);
} }
} }
}).deleteAsyncBatch(BreedingRecordDetailEntity.class, result); });
} else if (response.getCode() == 401) { } else if (response.getCode() == 401) {
dismissDialog(); dismissDialog();
...@@ -2735,7 +2734,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2735,7 +2734,7 @@ public class SyncVM extends BaseViewModel<Repository> {
dismissDialog(); dismissDialog();
queryCattleResumeUploadCount(true, UPLOAD_STATUS_HAVE_NOT); queryCattleResumeUploadCount(true, UPLOAD_STATUS_HAVE_NOT);
} }
}).queryAsyncAll(BreedingRecordDetailEntity.class, builder); });
} }
......
...@@ -12,9 +12,11 @@ import com.phlx.anchorcollect.db.gen.GenTableColumnDao; ...@@ -12,9 +12,11 @@ import com.phlx.anchorcollect.db.gen.GenTableColumnDao;
import com.phlx.anchorcollect.db.gen.GenTableDao; import com.phlx.anchorcollect.db.gen.GenTableDao;
import com.phlx.anchorcollect.db.interf.DbIDUCallBack; import com.phlx.anchorcollect.db.interf.DbIDUCallBack;
import com.phlx.anchorcollect.entity.DictEntity; import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.FrozenSemenEntity;
import com.phlx.anchorcollect.entity.GenData; import com.phlx.anchorcollect.entity.GenData;
import com.phlx.anchorcollect.entity.GenTable; import com.phlx.anchorcollect.entity.GenTable;
import com.phlx.anchorcollect.entity.GenTableColumn; import com.phlx.anchorcollect.entity.GenTableColumn;
import com.phlx.anchorcollect.entity.LoginInfoData;
import com.phlx.anchorcollect.params.CollectResponse; import com.phlx.anchorcollect.params.CollectResponse;
import com.phlx.anchorcollect.params.ListResponse; import com.phlx.anchorcollect.params.ListResponse;
import com.phlx.anchorcollect.params.PostParams; import com.phlx.anchorcollect.params.PostParams;
...@@ -61,15 +63,16 @@ public class SplashVM extends MainBarVM<Repository> { ...@@ -61,15 +63,16 @@ public class SplashVM extends MainBarVM<Repository> {
.compose(RxUtils.exceptionTransformer()) .compose(RxUtils.exceptionTransformer())
.doOnSubscribe(disposable -> { .doOnSubscribe(disposable -> {
}) })
.subscribe((Consumer<ListResponse<DictEntity>>) response -> { .subscribe((Consumer<CollectResponse<LoginInfoData>>) response -> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
//清除之前的页面配置 //清除之前的字典项和冻精信息
DbUtil.getInstance().deleteAll(DictEntity.class); DbUtil.getInstance().deleteAll(DictEntity.class);
DbUtil.getInstance().deleteAll(FrozenSemenEntity.class);
if (response.getData() != null && response.getData().size() > 0) { if (response.getData() != null && !response.getData().getDictList().isEmpty()) {
KLog.e(response.getData().size()); KLog.e("getDictList:"+response.getData().getDictList().size());
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(DictEntity.class, response.getData().getDictList(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -78,13 +81,26 @@ public class SplashVM extends MainBarVM<Repository> { ...@@ -78,13 +81,26 @@ public class SplashVM extends MainBarVM<Repository> {
errorEvent.setValue("保存字典项数据失败"); errorEvent.setValue("保存字典项数据失败");
} }
} }
}).insertAsyncBatch(DictEntity.class, response.getData()); });
} else { }
if (response.getData() != null && !response.getData().getFrozenSemenList().isEmpty()) {
KLog.e("getFrozenSemenList:"+response.getData().getFrozenSemenList().size());
DbUtil.getInstance().insertAsyncBatch(FrozenSemenEntity.class, response.getData().getFrozenSemenList(), new DbIDUCallBack() {
@Override
public void onNotification(boolean result) {
if (result) {
ToastUtils.showShort("冻精数据同步完成!");
} else {
errorEvent.setValue("保存冻精数据失败");
}
} }
});
}
requestGen(); requestGen();
} else { } else {
errorEvent.setValue("同步字典项数据错误 :" + response.getMsg()); errorEvent.setValue("同步登陆信息数据错误 :" + response.getMsg());
} }
}, (Consumer<ResponseThrowable>) throwable -> { }, (Consumer<ResponseThrowable>) throwable -> {
dismissDialog(); dismissDialog();
...@@ -116,11 +132,11 @@ public class SplashVM extends MainBarVM<Repository> { ...@@ -116,11 +132,11 @@ public class SplashVM extends MainBarVM<Repository> {
if (response.getData().getGenTableColumns() != null && response.getData().getGenTables() != null) { if (response.getData().getGenTableColumns() != null && response.getData().getGenTables() != null) {
KLog.e(response.getData().getGenTables().size() + "|" + response.getData().getGenTableColumns().size()); KLog.e(response.getData().getGenTables().size() + "|" + response.getData().getGenTableColumns().size());
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(GenTable.class, response.getData().getGenTables(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().insertAsyncBatch(GenTableColumn.class, response.getData().getGenTableColumns(), new DbIDUCallBack() {
@Override @Override
public void onNotification(boolean result) { public void onNotification(boolean result) {
if (result) { if (result) {
...@@ -129,12 +145,12 @@ public class SplashVM extends MainBarVM<Repository> { ...@@ -129,12 +145,12 @@ public class SplashVM extends MainBarVM<Repository> {
errorEvent.setValue("保存页面配置详情数据失败"); errorEvent.setValue("保存页面配置详情数据失败");
} }
} }
}).insertAsyncBatch(GenTableColumn.class, response.getData().getGenTableColumns()); });
} else { } else {
errorEvent.setValue("保存页面配置数据失败"); errorEvent.setValue("保存页面配置数据失败");
} }
} }
}).insertAsyncBatch(GenTable.class, response.getData().getGenTables()); });
} else { } else {
dismissDialog(); dismissDialog();
} }
......
...@@ -2,17 +2,18 @@ package com.phlx.anchorcollect.util; ...@@ -2,17 +2,18 @@ package com.phlx.anchorcollect.util;
import com.phlx.anchorcollect.Configs; import com.phlx.anchorcollect.Configs;
import com.phlx.anchorcollect.entity.DictEntity; import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.FrozenSemenEntity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class DictUtils { public class LoginInfoUtils {
public static List<String> getDistNameList(String type){ public static List<String> getDistNameList(String type) {
List<String> distNames = new ArrayList<>(); List<String> distNames = new ArrayList<>();
for (DictEntity de:Configs.dictList) { for (DictEntity de : Configs.dictList) {
if(type.equals(de.getDictType())){ if (type.equals(de.getDictType())) {
distNames.add(de.getDictLabel()); distNames.add(de.getDictLabel());
} }
} }
...@@ -20,11 +21,11 @@ public class DictUtils { ...@@ -20,11 +21,11 @@ public class DictUtils {
return distNames; return distNames;
} }
public static List<DictEntity> getDistList(String type){ public static List<DictEntity> getDistList(String type) {
List<DictEntity> dists = new ArrayList<>(); List<DictEntity> dists = new ArrayList<>();
for (DictEntity de:Configs.dictList) { for (DictEntity de : Configs.dictList) {
if(type.equals(de.getDictType())){ if (type.equals(de.getDictType())) {
dists.add(de); dists.add(de);
} }
} }
...@@ -32,5 +33,19 @@ public class DictUtils { ...@@ -32,5 +33,19 @@ public class DictUtils {
return dists; return dists;
} }
public static FrozenSemenEntity getFrozenSemenForName(String code) {
for (FrozenSemenEntity frozenSemenEntity : Configs.frozenSemenList) {
String[] infos = frozenSemenEntity.getInfo().split("/");
if (infos != null && infos.length > 0) {
for (int i = 0; i < infos.length; i++) {
if (infos[i].equals(code)) {
return frozenSemenEntity;
}
}
}
}
return null;
}
} }
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
android:layout_height="@dimen/dp_40" android:layout_height="@dimen/dp_40"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:text="高频耳标" android:text="电子耳标"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/desc_text_size" /> android:textSize="@dimen/desc_text_size" />
......
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