Commit 15b33a45 authored by hywang's avatar hywang

Merge remote-tracking branch 'origin/master'

parents 9fb8460e 98c33772
......@@ -9,8 +9,8 @@ android {
applicationId "com.phlx.anchorcollect"
minSdkVersion 21
targetSdkVersion 29
versionCode 3
versionName "1.0.2"
versionCode 6
versionName "1.0.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
......@@ -48,7 +48,7 @@ android {
}
greendao {
schemaVersion 1 //数据库版本号
schemaVersion 3 //数据库版本号
daoPackage 'com.phlx.anchorcollect.db.gen'
targetGenDir 'src/main/java'
}
......
......@@ -53,6 +53,7 @@ public class Configs {
public static final String SP_NAME = "sp_name";
public static final String SP_LOGIN_NAME = "sp_login_name";
public static final String SP_DEPT_ID = "sp_dept_id";
public static final String SP_DEPT_NAME = "sp_dept_name";
public static final String SP_FREQUENCY = "sp_frequency";
public static final String SP_USER_PASSWORD = "sp_user_password";
public static final String SP_USER_EMAIL = "sp_user_email";
......@@ -112,6 +113,7 @@ public class Configs {
public static List<GenTableColumn> immunebatch;
public static List<GenTableColumn> cattlematingMaster;
public static List<GenTableColumn> cattlematingDetaill;
public static List<GenTableColumn> cattlematingDetaillList;
//字典项
public static List<DictEntity> dictList = new ArrayList<>();
......@@ -124,6 +126,8 @@ public class Configs {
public static Long tempUnid;
//临时存放耳标数据
public static CattleResumeEntity tempCattleResume;
//临时存放重量数据
public static Double tempWeight= 0.0;
//首页fragment标签
public static int mainPosition;
......
......@@ -72,7 +72,7 @@ public class BtService extends Service implements EventObserver {
Log.e(TAG, "onRead: " + data);
// ToastUtils.showShort("onRead: " + data);
String weightData = data.substring(data.indexOf("wn") + 3, data.indexOf("kg") - 2);
String weightData = data.substring(data.indexOf("wn") + 3, data.indexOf("kg"));
EventMsg eventMsg = new EventMsg();
eventMsg.setAction(Configs.currentEvent);
eventMsg.setObj(weightData);
......
......@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version 1): knows all DAOs.
* Master of DAO (schema version 3): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 1;
public static final int SCHEMA_VERSION = 3;
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
......
......@@ -76,6 +76,11 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
*/
private Long deptId;
/**
* 部门id
*/
private Long caId;
/** 是否上传 0未上传,1已上传 */
private String uploadStatus;
......@@ -129,6 +134,11 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
} else {
deptId = in.readLong();
}
if (in.readByte() == 0) {
caId = null;
} else {
caId = in.readLong();
}
uploadStatus = in.readString();
searchValue = in.readString();
createBy = in.readString();
......@@ -138,10 +148,10 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
remark = in.readString();
}
@Generated(hash = 933327768)
@Generated(hash = 1961071723)
public BreedingRecordDetailEntity(Long unid, Long fUnid, String matingStyle, Long cattleresumeId,
String frozenSemenBatch, String matingDate, String isReturn, String backLoveDate, String dueDate,
String pregnancy, Long deptId, String uploadStatus, String searchValue, String createBy,
String pregnancy, Long deptId, Long caId, String uploadStatus, String searchValue, String createBy,
String createTime, String updateBy, String updateTime, String remark) {
this.unid = unid;
this.fUnid = fUnid;
......@@ -154,6 +164,7 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
this.dueDate = dueDate;
this.pregnancy = pregnancy;
this.deptId = deptId;
this.caId = caId;
this.uploadStatus = uploadStatus;
this.searchValue = searchValue;
this.createBy = createBy;
......@@ -196,6 +207,12 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
dest.writeByte((byte) 1);
dest.writeLong(deptId);
}
if (caId == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(caId);
}
dest.writeString(uploadStatus);
dest.writeString(searchValue);
dest.writeString(createBy);
......@@ -310,6 +327,14 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
this.deptId = deptId;
}
public Long getCaId() {
return caId;
}
public void setCaId(Long caId) {
this.caId = caId;
}
public String getUploadStatus() {
return uploadStatus;
}
......@@ -369,17 +394,18 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
@Override
public String toString() {
return "BreedingRecordDetailEntity{" +
"unid='" + unid + '\'' +
", fUnid='" + fUnid + '\'' +
"unid=" + unid +
", fUnid=" + fUnid +
", matingStyle='" + matingStyle + '\'' +
", cattleresumeId='" + cattleresumeId + '\'' +
", cattleresumeId=" + cattleresumeId +
", frozenSemenBatch='" + frozenSemenBatch + '\'' +
", matingDate='" + matingDate + '\'' +
", isReturn='" + isReturn + '\'' +
", backLoveDate='" + backLoveDate + '\'' +
", dueDate='" + dueDate + '\'' +
", pregnancy='" + pregnancy + '\'' +
", deptId='" + deptId + '\'' +
", deptId=" + deptId +
", caId=" + caId +
", uploadStatus='" + uploadStatus + '\'' +
", searchValue='" + searchValue + '\'' +
", createBy='" + createBy + '\'' +
......@@ -397,6 +423,4 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
public void setFUnid(Long fUnid) {
this.fUnid = fUnid;
}
}
......@@ -87,12 +87,23 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
/** 是否淘汰;0,在用,1淘汰 */
private Long isOut;
/**
* 母牛年龄
*/
private Integer age;
/** 犊牛毛色 */
private String colour;
/** 时间戳 */
private String inputTime;
/** 部门id */
private Long deptId;
/** 所属种蓄站*/
private Long deptName;
/** 是否上传 0未上传,1已上传 */
private String uploadStatus;
......@@ -157,12 +168,23 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
} else {
isOut = in.readLong();
}
if (in.readByte() == 0) {
age = null;
} else {
age = in.readInt();
}
colour = in.readString();
inputTime = in.readString();
if (in.readByte() == 0) {
deptId = null;
} else {
deptId = in.readLong();
}
if (in.readByte() == 0) {
deptName = null;
} else {
deptName = in.readLong();
}
uploadStatus = in.readString();
uploadTime = in.readString();
createBy = in.readString();
......@@ -172,14 +194,14 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
remark = in.readString();
}
@Generated(hash = 2055075095)
@Generated(hash = 1106807371)
public CattleResumeEntity(Long unid, String registrationNo, String individualNo, String circleNo,
String raiseType, String raiseVarieties, String birthdate, Double birthHeavy, String sex,
String birthDifficulty, String isTwins, String childTime, String grade, String fatherReg,
String motherReg, Double fromMilkHeavy, String health, String junHeavy, String decAppScore,
String photo, String status, Long isOut, String inputTime, Long deptId, String uploadStatus,
String uploadTime, String createBy, String createTime, String updateBy, String updateTime,
String remark) {
String photo, String status, Long isOut, Integer age, String colour, String inputTime,
Long deptId, Long deptName, String uploadStatus, String uploadTime, String createBy,
String createTime, String updateBy, String updateTime, String remark) {
this.unid = unid;
this.registrationNo = registrationNo;
this.individualNo = individualNo;
......@@ -202,8 +224,11 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this.photo = photo;
this.status = status;
this.isOut = isOut;
this.age = age;
this.colour = colour;
this.inputTime = inputTime;
this.deptId = deptId;
this.deptName = deptName;
this.uploadStatus = uploadStatus;
this.uploadTime = uploadTime;
this.createBy = createBy;
......@@ -257,6 +282,13 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
dest.writeByte((byte) 1);
dest.writeLong(isOut);
}
if (age == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeInt(age);
}
dest.writeString(colour);
dest.writeString(inputTime);
if (deptId == null) {
dest.writeByte((byte) 0);
......@@ -264,6 +296,12 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
dest.writeByte((byte) 1);
dest.writeLong(deptId);
}
if (deptName == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(deptName);
}
dest.writeString(uploadStatus);
dest.writeString(uploadTime);
dest.writeString(createBy);
......@@ -470,6 +508,22 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this.isOut = isOut;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getColour() {
return colour;
}
public void setColour(String colour) {
this.colour = colour;
}
public String getInputTime() {
return inputTime;
}
......@@ -486,6 +540,14 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this.deptId = deptId;
}
public Long getDeptName() {
return deptName;
}
public void setDeptName(Long deptName) {
this.deptName = deptName;
}
public String getUploadStatus() {
return uploadStatus;
}
......@@ -545,14 +607,14 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
@Override
public String toString() {
return "CattleResumeEntity{" +
"unid='" + unid + '\'' +
"unid=" + unid +
", registrationNo='" + registrationNo + '\'' +
", individualNo='" + individualNo + '\'' +
", circleNo='" + circleNo + '\'' +
", raiseType='" + raiseType + '\'' +
", raiseVarieties='" + raiseVarieties + '\'' +
", birthdate='" + birthdate + '\'' +
", birthHeavy='" + birthHeavy + '\'' +
", birthHeavy=" + birthHeavy +
", sex='" + sex + '\'' +
", birthDifficulty='" + birthDifficulty + '\'' +
", isTwins='" + isTwins + '\'' +
......@@ -560,15 +622,18 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
", grade='" + grade + '\'' +
", fatherReg='" + fatherReg + '\'' +
", motherReg='" + motherReg + '\'' +
", fromMilkHeavy='" + fromMilkHeavy + '\'' +
", fromMilkHeavy=" + fromMilkHeavy +
", health='" + health + '\'' +
", junHeavy='" + junHeavy + '\'' +
", decAppScore='" + decAppScore + '\'' +
", photo='" + photo + '\'' +
", status='" + status + '\'' +
", isOut='" + isOut + '\'' +
", isOut=" + isOut +
", age=" + age +
", colour='" + colour + '\'' +
", inputTime='" + inputTime + '\'' +
", deptId='" + deptId + '\'' +
", deptId=" + deptId +
", deptName=" + deptName +
", uploadStatus='" + uploadStatus + '\'' +
", uploadTime='" + uploadTime + '\'' +
", createBy='" + createBy + '\'' +
......
package com.phlx.anchorcollect.entity;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.databinding.BaseObservable;
/**
* 部门表 sys_dept
*
* @author ruoyi
*/
public class DeptEntity extends BaseObservable implements Parcelable {
/** 部门ID */
private Long deptId;
/** 父部门ID */
private Long parentId;
/** 祖级列表 */
private String ancestors;
/** 部门名称 */
private String deptName;
/** 显示顺序 */
private String orderNum;
/** 负责人 */
private String leader;
/** 联系电话 */
private String phone;
/** 邮箱 */
private String email;
/** 部门状态:0正常,1停用 */
private String status;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
/** 父部门名称 */
private String parentName;
/** 排除编号 */
private Long excludeId;
public DeptEntity() {
}
protected DeptEntity(Parcel in) {
if (in.readByte() == 0) {
deptId = null;
} else {
deptId = in.readLong();
}
if (in.readByte() == 0) {
parentId = null;
} else {
parentId = in.readLong();
}
ancestors = in.readString();
deptName = in.readString();
orderNum = in.readString();
leader = in.readString();
phone = in.readString();
email = in.readString();
status = in.readString();
delFlag = in.readString();
parentName = in.readString();
if (in.readByte() == 0) {
excludeId = null;
} else {
excludeId = in.readLong();
}
}
@Override
public void writeToParcel(Parcel dest, int flags) {
if (deptId == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(deptId);
}
if (parentId == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(parentId);
}
dest.writeString(ancestors);
dest.writeString(deptName);
dest.writeString(orderNum);
dest.writeString(leader);
dest.writeString(phone);
dest.writeString(email);
dest.writeString(status);
dest.writeString(delFlag);
dest.writeString(parentName);
if (excludeId == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(excludeId);
}
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<DeptEntity> CREATOR = new Creator<DeptEntity>() {
@Override
public DeptEntity createFromParcel(Parcel in) {
return new DeptEntity(in);
}
@Override
public DeptEntity[] newArray(int size) {
return new DeptEntity[size];
}
};
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
public String getLeader() {
return leader;
}
public void setLeader(String leader) {
this.leader = leader;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public Long getExcludeId() {
return excludeId;
}
public void setExcludeId(Long excludeId) {
this.excludeId = excludeId;
}
@Override
public String toString() {
return "DeptEntity{" +
"deptId=" + deptId +
", parentId=" + parentId +
", ancestors='" + ancestors + '\'' +
", deptName='" + deptName + '\'' +
", orderNum='" + orderNum + '\'' +
", leader='" + leader + '\'' +
", phone='" + phone + '\'' +
", email='" + email + '\'' +
", status='" + status + '\'' +
", delFlag='" + delFlag + '\'' +
", parentName='" + parentName + '\'' +
", excludeId=" + excludeId +
'}';
}
}
......@@ -15,7 +15,6 @@ import java.util.List;
* @author ruoyi
*/
public class UserEntity extends BaseObservable implements Parcelable {
private static final long serialVersionUID = 1L;
/** 用户ID */
private String userId;
......@@ -71,9 +70,9 @@ public class UserEntity extends BaseObservable implements Parcelable {
/** 密码最后更新时间 */
private String pwdUpdateDate;
// /** 部门对象 */
// private SysDept dept;
//
/** 部门对象 */
private DeptEntity dept;
private List<UserRoleEntity> roles;
/** 角色组 */
......@@ -105,6 +104,7 @@ public class UserEntity extends BaseObservable implements Parcelable {
loginIp = in.readString();
loginDate = in.readString();
pwdUpdateDate = in.readString();
dept = in.readParcelable(DeptEntity.class.getClassLoader());
roles = in.createTypedArrayList(UserRoleEntity.CREATOR);
}
......@@ -128,6 +128,7 @@ public class UserEntity extends BaseObservable implements Parcelable {
dest.writeString(loginIp);
dest.writeString(loginDate);
dest.writeString(pwdUpdateDate);
dest.writeParcelable(dept, flags);
dest.writeTypedList(roles);
}
......@@ -148,10 +149,6 @@ public class UserEntity extends BaseObservable implements Parcelable {
}
};
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getUserId() {
return userId;
}
......@@ -296,6 +293,14 @@ public class UserEntity extends BaseObservable implements Parcelable {
this.pwdUpdateDate = pwdUpdateDate;
}
public DeptEntity getDept() {
return dept;
}
public void setDept(DeptEntity dept) {
this.dept = dept;
}
public List<UserRoleEntity> getRoles() {
return roles;
}
......@@ -307,10 +312,10 @@ public class UserEntity extends BaseObservable implements Parcelable {
@Override
public String toString() {
return "UserEntity{" +
"userId=" + userId +
", deptId=" + deptId +
", parentId=" + parentId +
", roleId=" + roleId +
"userId='" + userId + '\'' +
", deptId='" + deptId + '\'' +
", parentId='" + parentId + '\'' +
", roleId='" + roleId + '\'' +
", loginName='" + loginName + '\'' +
", userName='" + userName + '\'' +
", userType='" + userType + '\'' +
......@@ -325,6 +330,7 @@ public class UserEntity extends BaseObservable implements Parcelable {
", loginIp='" + loginIp + '\'' +
", loginDate='" + loginDate + '\'' +
", pwdUpdateDate='" + pwdUpdateDate + '\'' +
", dept=" + dept +
", roles=" + roles +
'}';
}
......
......@@ -50,15 +50,15 @@ public class RetrofitClient {
private static final int CACHE_TIMEOUT = 10 * 1024 * 1024;
//服务端根路径
public static String baseUrl =
"serve.xlglmnmyzspt.org.cn"//正式
// "serve.xlglmnmyzspt.org.cn"//正式
// "39.101.170.186"//阿里云测试
// "192.168.8.135"//董
"192.168.8.135"//董
// "192.168.43.154"//张敏
;
public static String port =
""//正式
// ""//正式
// "9000"//阿里云测试
// "9000"//董
"9000"//董
;
private static Context mContext = Utils.getContext();
......
......@@ -65,6 +65,8 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
private ImagePicker mImagePicker;
private MaterialDialog showEpcDialog;
private static class SingletonClassInstance {
private static final BasicsCollectFragment instance = new BasicsCollectFragment();
}
......@@ -260,7 +262,13 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
@Override
public void onChanged(List<String> stringList) {
new MaterialDialog.Builder(getActivity())
if (showEpcDialog != null) {
if (showEpcDialog.isShowing()) {//弹窗前先给上一次的取消了
showEpcDialog.dismiss();
}
showEpcDialog = null;
}
showEpcDialog = new MaterialDialog.Builder(getActivity())
.title("请选择耳标")
// .positiveText("确认")
// .negativeText("取消")
......
......@@ -97,7 +97,7 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
viewModel.initGen();
binding.rvCollect.addItemDecoration(new SpaceItemDecoration(10));
// binding.rvCollect.addItemDecoration(new SpaceItemDecoration(10));
binding.rvCollectDetail.addItemDecoration(new SpaceItemDecoration(10));
initTimePicker();
......@@ -154,7 +154,7 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
gtc.notifyChange();
}
viewModel.remarkParamEntity.notifyChange();
binding.rvCollect.getAdapter().notifyDataSetChanged();
// binding.rvCollect.getAdapter().notifyDataSetChanged();
binding.rvCollectDetail.getAdapter().notifyDataSetChanged();
if (aBoolean) {
......@@ -383,7 +383,7 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
//初始化表头
List<String> headerStr = new ArrayList<>();
List<String> fieldNameStr = new ArrayList<>();
for (GenTableColumn gtc : Configs.cattlematingDetaill) {
for (GenTableColumn gtc : Configs.cattlematingDetaillList) {
if ("1".equals(gtc.getIsList())) {
headerStr.add(gtc.getColumnComment());
fieldNameStr.add(gtc.getJavaField());
......@@ -465,7 +465,7 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
if (this != null && !hidden) {
viewModel.clearParamList();
viewModel.clearDetailParamList();
viewModel.queryBreedingRecord();
viewModel.initBreedingRecord();
viewModel.rfid.set(Configs.tempRfid);
} else {
viewModel.rfid.set("");
......
......@@ -373,6 +373,7 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding
viewModel.isModify = true;
viewModel.queryPerformance();
} else {
viewModel.refreshWeight();//把扫标签时的重量带过去
//清除一下数据
viewModel.isModify = false;
binding.rvCollect.getAdapter().notifyDataSetChanged();
......
......@@ -66,6 +66,8 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We
private ImagePicker mImagePicker;
private MaterialDialog showEpcDialog;
private static class SingletonClassInstance {
private static final WeightManFragment instance = new WeightManFragment();
}
......@@ -261,7 +263,6 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We
viewModel.onShowDialogEvent.observe(getActivity(), new Observer<String>() {
@Override
public void onChanged(String s) {
new MaterialDialog.Builder(getActivity()).title("系统提示").content(s).positiveText("确定").onAny(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
......@@ -277,7 +278,13 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We
@Override
public void onChanged(List<String> stringList) {
new MaterialDialog.Builder(getActivity())
if (showEpcDialog != null) {
if (showEpcDialog.isShowing()) {//弹窗前先给上一次的取消了
showEpcDialog.dismiss();
}
showEpcDialog = null;
}
showEpcDialog = new MaterialDialog.Builder(getActivity())
.title("请选择耳标")
// .positiveText("确认")
// .negativeText("取消")
......
......@@ -270,7 +270,8 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
if (result != null && result.size() > 0) {
//总增重
if (Configs.tempCattleResume != null && Configs.tempCattleResume.getBirthHeavy() != null) {
totalGainWeight.set(result.get(0).getWeight() - Configs.tempCattleResume.getBirthHeavy());
double doubleTotal = result.get(0).getWeight() - Configs.tempCattleResume.getBirthHeavy();
totalGainWeight.set(Double.parseDouble(new DecimalFormat("0.0").format(doubleTotal)));
lastGainDate.set(result.get(0).getWTime());
adgGainDate.set(result.get(0).getWTime());
......@@ -279,7 +280,8 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
}
if (result.size() >= 1) {
lastGainWeight.set(result.get(0).getWeight());
double doublelastGain = result.get(0).getWeight();
lastGainWeight.set(Double.parseDouble(new DecimalFormat("0.0").format(doublelastGain)));
//// Log.e("weight", "lastGainWeight:" + lastGainWeight.get());
if (result.size() > 1) {//两条以上记录
dateFormat = new SimpleDateFormat("yyyy-MM-dd");
......@@ -573,6 +575,8 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
Double weightNum = Double.parseDouble(eventType.getObj().toString().trim());
if (weightNum > 25) {
scanRfid();
if (isWeightScan)
Configs.tempWeight = weightNum;
isWeightScan = false;
} else {
String lastWeight = weight.get();
......@@ -586,7 +590,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
}
isWeightScan = true;
}
weight.set(eventType.getObj().toString());
weight.set(weightNum + "");
}
});
RxSubscriptions.add(weightBus);
......@@ -604,6 +608,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
Configs.tempUnid = null;
Configs.tempRfid = "";
Configs.tempCattleResume = null;
Configs.tempWeight = 0.0;
tag.set("");
rfid.set("");
rfidTag = "";
......
......@@ -26,6 +26,7 @@ import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.GenTableColumn;
import com.phlx.anchorcollect.entity.PerformanceEntity;
import com.phlx.anchorcollect.ui.fragment.list.CollectGridItem;
import com.phlx.anchorcollect.util.DateUtils;
import com.phlx.anchorcollect.util.EntityUtils;
import com.phlx.anchorcollect.util.StringUtil;
......@@ -96,6 +97,13 @@ public class PerformanceVM extends BaseViewModel<Repository> {
imgFile = new File(imgUrl);
for (GenTableColumn gtc : Configs.performance) {
//强制赋值为扫标签时的重量
if (gtc.getJavaField().equals("weight")) {
gtc.setShowName(Configs.tempWeight + "");
gtc.setContent(Configs.tempWeight + "");
}
CollectGridItem cgi = new CollectGridItem(this, gtc, Configs.SIGN_MEASURE);
observableList.add(cgi);
}
......@@ -112,6 +120,18 @@ public class PerformanceVM extends BaseViewModel<Repository> {
}
public void refreshWeight() {
for (GenTableColumn gtc : Configs.performance) {
//强制赋值为扫标签时的重量
if (gtc.getJavaField().equals("weight")) {
gtc.setShowName(Configs.tempWeight + "");
gtc.setContent(Configs.tempWeight + "");
}
}
}
private void initData(PerformanceEntity performanceEntity) {
remarkParamEntity.setShowName(performanceEntity.getRemark());
......@@ -146,6 +166,11 @@ public class PerformanceVM extends BaseViewModel<Repository> {
e.printStackTrace();
}
}
//强制赋值为扫标签时的重量
if (gtc.getJavaField().equals("weight")) {
gtc.setShowName(Configs.tempWeight + "");
gtc.setContent(Configs.tempWeight + "");
}
}
onNotifyAllEvent.setValue(false);
......@@ -228,11 +253,11 @@ public class PerformanceVM extends BaseViewModel<Repository> {
}
}
savePerformance();
checkPerformance();
}
});
private void savePerformance() {
private void checkPerformance() {
JsonObject jsonObject = new JsonObject();
for (GenTableColumn gtc : Configs.performance) {
......@@ -253,6 +278,35 @@ public class PerformanceVM extends BaseViewModel<Repository> {
Gson gson = new Gson();
PerformanceEntity performanceEntity = gson.fromJson(jsonObject, PerformanceEntity.class);
//查询此月龄是否存在,存在拿出主键 做覆盖
QueryBuilder<PerformanceEntity> builder =
DbUtil.getInstance().getQueryBuilder(PerformanceEntity.class)
.where(PerformanceEntityDao.Properties.Age.eq(performanceEntity.getAge())
, PerformanceEntityDao.Properties.CattleresumeId.eq(Configs.tempUnid)
);
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<PerformanceEntity>() {
@Override
public void onSuccess(List<PerformanceEntity> result) {
if (result != null && result.size() > 0) {
isModify = true;
Configs.resumeId = result.get(0).getUnid();
performanceEntity.setUnid(result.get(0).getUnid());
}
savePerformance(performanceEntity);
ToastUtils.showShort("查询-性能测定月龄数据-成功!");
}
@Override
public void onFailed() {
ToastUtils.showShort("性能测定月龄数据-数据库查询失败");
}
}).queryAsyncAll(PerformanceEntity.class, builder);
}
private void savePerformance(PerformanceEntity performanceEntity) {
dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (!isModify) {//新增
uuid = IdUtil.createSnowflake(3, 1).nextId();
......@@ -301,6 +355,7 @@ public class PerformanceVM extends BaseViewModel<Repository> {
remarkParamEntity.setShowName("");
currentParamEntity = new GenTableColumn();
uuid = 0;
refreshWeight();
for (GenTableColumn gtc : Configs.performance) {
gtc.setShowName("");
gtc.setContent("");
......
......@@ -170,7 +170,14 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
// imgFile = new File(imgUrl);
uiList.clear();
int i = 0;
dateFormat = new SimpleDateFormat("yyyy-MM-dd");
for (GenTableColumn gtc : Configs.weightMan) {
if (gtc.getHtmlType().equals("datetime")) {
if (gtc.getContent() == null || "".equals(gtc.getContent())) {
gtc.setContent(dateFormat.format(new Date()));
gtc.setShowName(dateFormat.format(new Date()));
}
}
if (i < 4) {
uiList.add(gtc);
} else {
......@@ -287,7 +294,9 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
if (result != null && result.size() > 0) {
//总增重
if (Configs.tempCattleResume != null && Configs.tempCattleResume.getBirthHeavy() != null) {
totalGainWeight.set(result.get(0).getWeight() - Configs.tempCattleResume.getBirthHeavy());
double doubleTotal = result.get(0).getWeight() - Configs.tempCattleResume.getBirthHeavy();
totalGainWeight.set(Double.parseDouble(new DecimalFormat("0.0").format(doubleTotal)));
lastGainDate.set(result.get(0).getWTime());
adgGainDate.set(result.get(0).getWTime());
totalGainDate.set(result.get(0).getWTime());
......@@ -295,7 +304,8 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
}
if (result.size() >= 1) {
lastGainWeight.set(result.get(0).getWeight());
double doublelastGain = result.get(0).getWeight();
lastGainWeight.set(Double.parseDouble(new DecimalFormat("0.0").format(doublelastGain)));
// Log.e("weight", "lastGainWeight:" + lastGainWeight.get());
if (result.size() > 1) {//两条以上记录
dateFormat = new SimpleDateFormat("yyyy-MM-dd");
......@@ -382,6 +392,11 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
@Override
public void call() {
if (Configs.tempUnid == null) {
onShowDialogEvent.setValue("请先扫描耳标!");
return;
}
if (weight.get() < 25) {
onShowDialogEvent.setValue("重量非法!请先称重!");
return;
......@@ -499,12 +514,19 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
for (GenTableColumn gtc : Configs.weightMan) {
if (gtc.getHtmlType() != null && gtc.getHtmlType().equals("datetime")) {
if (gtc.getContent() == null || "".equals(gtc.getContent())) {
dateFormat = new SimpleDateFormat("yyyy-MM-dd");
gtc.setContent(dateFormat.format(new Date()));
gtc.setShowName(dateFormat.format(new Date()));
}
}
if (name.equals(gtc.getJavaField())) {
try {
Log.e("key:", name);
// Log.e("key:", name);
Object fieldValueByName = EntityUtils.getFieldValueByName(name, result.get(0));
String value = fieldValueByName == null ? "" : fieldValueByName.toString();
Log.e("value:", value);
// Log.e("value:", value);
gtc.setContent(value);
String showName = value;
// 如果是选择的,查字典项
......@@ -527,7 +549,6 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
}
}
onNotifyAllEvent.setValue(false);
} else {
onNotifyAllEvent.setValue(true);
......@@ -557,6 +578,14 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
gtc.setContent("");
gtc.setShowName("");
gtc.notifyChange();
if (gtc.getHtmlType() != null && gtc.getHtmlType().equals("datetime")) {
if (gtc.getContent() == null || "".equals(gtc.getContent())) {
dateFormat = new SimpleDateFormat("yyyy-MM-dd");
gtc.setContent(dateFormat.format(new Date()));
gtc.setShowName(dateFormat.format(new Date()));
}
}
}
queryGainWeight();//刷新一下增重数据
......@@ -628,9 +657,11 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
Double weightNum = Double.parseDouble(eventType.getObj().toString().trim());
if (weightNum > 25) {
scanRfid();
if (isWeightScan)
Configs.tempWeight = weightNum;
isWeightScan = false;
} else {
if (weight.get()!=null && weight.get() > 25) {
if (weight.get() != null && weight.get() > 25) {
lastGainWeight.set(0.0);
adgGainWeight.set(0.0);
......@@ -669,6 +700,7 @@ public class WeightManVM extends BaseViewModel<Repository> implements OnInventor
Configs.tempUnid = null;
Configs.tempRfid = "";
Configs.tempCattleResume = null;
Configs.tempWeight = 0.0;
tag.set("");
rfid.set("");
rfidTag = "";
......
......@@ -154,6 +154,8 @@ public class CattleVM extends BackBarVM<Repository> {
}
}).queryAsyncAll(ImmuneBatchEntity.class, builder);
}
}else{
observableRefreshList.setValue(2);
}
}
......
......@@ -157,6 +157,7 @@ public class LoginVM extends BaseViewModel<Repository> {
SPUtils.getInstance().put(Configs.SP_NAME, response.getData().getUser().getUserName());
SPUtils.getInstance().put(Configs.SP_LOGIN_NAME, response.getData().getUser().getLoginName());
SPUtils.getInstance().put(Configs.SP_DEPT_ID, response.getData().getUser().getDeptId());
SPUtils.getInstance().put(Configs.SP_DEPT_NAME, response.getData().getUser().getDept().getDeptName());
String roleIds = "";
List<UserRoleEntity> roles = response.getData().getUser().getRoles();
......@@ -248,7 +249,7 @@ public class LoginVM extends BaseViewModel<Repository> {
DbUtil.getInstance().getQueryBuilder(GenTableColumn.class)
.where(GenTableColumnDao.Properties.TableId.eq(gt.getTableId())
, GenTableColumnDao.Properties.IsQuery.eq("1"))
.orderDesc(GenTableColumnDao.Properties.Sort);
.orderAsc(GenTableColumnDao.Properties.Sort);
Configs.cattleresume = DbUtil.getInstance().queryAll(GenTableColumn.class, builderDetaile0);
break;
case "zxgl_performance":
......@@ -295,9 +296,18 @@ public class LoginVM extends BaseViewModel<Repository> {
QueryBuilder<GenTableColumn> builderDetaile6 =
DbUtil.getInstance().getQueryBuilder(GenTableColumn.class)
.where(GenTableColumnDao.Properties.TableId.eq(gt.getTableId())
, GenTableColumnDao.Properties.IsQuery.eq("1"))
, GenTableColumnDao.Properties.IsQuery.eq("1")
)
.orderAsc(GenTableColumnDao.Properties.Sort);
Configs.cattlematingDetaill = DbUtil.getInstance().queryAll(GenTableColumn.class, builderDetaile6);
//取详情列表表头
QueryBuilder<GenTableColumn> builderDetaile7 =
DbUtil.getInstance().getQueryBuilder(GenTableColumn.class)
.where(GenTableColumnDao.Properties.TableId.eq(gt.getTableId())
, GenTableColumnDao.Properties.IsList.eq("1")
)
.orderAsc(GenTableColumnDao.Properties.Sort);
Configs.cattlematingDetaillList = DbUtil.getInstance().queryAll(GenTableColumn.class, builderDetaile7);
break;
}
......
......@@ -27,6 +27,7 @@ import com.phlx.anchorcollect.ui.fragment.ImmunRecordFragment;
import com.phlx.anchorcollect.ui.fragment.MedicalRecordFragment;
import com.phlx.anchorcollect.ui.fragment.PerformanceFragment;
import com.phlx.anchorcollect.ui.fragment.WeightManFragment;
import com.uhf.structures.DynamicQParams;
import com.uhf.structures.InventoryParams;
import me.goldze.mvvmhabit.utils.ToastUtils;
......@@ -170,8 +171,39 @@ public class MainActivity extends BaseActivity<ActivityMainBinding, MainVM> {
inventoryParams.inventoryArea = 2;
inventoryParams.len = 6;
App.getInstance().getLinkage().Radio_SetInventoryParams(inventoryParams);
setAlgorithm();
}
/**
* 获取算法
*/
private void setAlgorithm() {
DynamicQParams dynamicQParams = new DynamicQParams();
int dynamic_state =
App.getInstance().getLinkage().Radio_GetSingulationAlgorithmDyParameters(dynamicQParams);
if (dynamic_state == 0) {
dynamicQParams.thresholdMultiplier = 4;
int dynamicResult =
App.getInstance().getLinkage().Radio_SetSingulationAlgorithmDyParameters(dynamicQParams);
if (dynamicResult == 0) {
// ToastUtils.showShort("设置动态算法成功");
// int saveStatue = App.getInstance().getLinkage().saveR2000Setting();
// if (saveStatue == 0) {
//// ToastUtils.showShort("参数保存成功");
// } else {
// ToastUtils.showShort("参数保存失败");
// }
} else {
ToastUtils.showShort("设置动态算法失败");
}
// ToastUtils.showShort("获取动态算法成功");
}else {
ToastUtils.showShort("获取动态算法失败");
}
}
@Override
......@@ -181,6 +213,7 @@ public class MainActivity extends BaseActivity<ActivityMainBinding, MainVM> {
viewModel.onTabClickEvent.observe(this, new Observer<Integer>() {
@Override
public void onChanged(Integer integer) {
Configs.resumeId = null;
labelSwitching(integer);
Configs.mainPosition = integer;
......
......@@ -25,6 +25,7 @@ import com.phlx.anchorcollect.util.StringUtil;
import org.greenrobot.greendao.query.QueryBuilder;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import io.reactivex.functions.Consumer;
......@@ -220,9 +221,18 @@ public class SplashVM extends MainBarVM<Repository> {
QueryBuilder<GenTableColumn> builderDetaile6 =
DbUtil.getInstance().getQueryBuilder(GenTableColumn.class)
.where(GenTableColumnDao.Properties.TableId.eq(gt.getTableId())
, GenTableColumnDao.Properties.IsQuery.eq("1"))
, GenTableColumnDao.Properties.IsQuery.eq("1")
)
.orderAsc(GenTableColumnDao.Properties.Sort);
Configs.cattlematingDetaill = DbUtil.getInstance().queryAll(GenTableColumn.class, builderDetaile6);
//取详情列表表头
QueryBuilder<GenTableColumn> builderDetaile7 =
DbUtil.getInstance().getQueryBuilder(GenTableColumn.class)
.where(GenTableColumnDao.Properties.TableId.eq(gt.getTableId())
, GenTableColumnDao.Properties.IsList.eq("1")
)
.orderAsc(GenTableColumnDao.Properties.Sort);
Configs.cattlematingDetaillList = DbUtil.getInstance().queryAll(GenTableColumn.class, builderDetaile7);
break;
}
......
......@@ -441,6 +441,18 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_one_click_upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/one_click_sync"
android:layout_marginBottom="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_150"
binding:layout_constraintLeft_toLeftOf="parent"
binding:layout_constraintBottom_toBottomOf="parent"
binding:onClickCommand="@{viewModel.OnOneClickUploadClickCommand}"
/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_error_data_upload"
android:layout_width="wrap_content"
......
......@@ -67,7 +67,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="tag"
android:text="可视耳标"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp_10" />
......@@ -338,7 +338,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:src="@mipmap/ic_set"
android:src="@mipmap/icon_sync"
binding:layout_constraintRight_toLeftOf="@+id/iv_setting"
binding:layout_constraintTop_toTopOf="parent"
binding:onClickCommand="@{viewModel.onSyncClick}" />
......
......@@ -60,21 +60,89 @@
binding:layout_constraintRight_toRightOf="parent"
binding:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/rv_collect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-5dp"
android:layout_marginTop="5dp"
android:nestedScrollingEnabled="false"
binding:adapter="@{adapter}"
binding:itemBinding="@{viewModel.itemBinding}"
binding:items="@{viewModel.observableList}"
binding:layoutManager="@{LayoutManagers.grid(5)}"
android:orientation="horizontal"
binding:layout_constraintBottom_toTopOf="@+id/ll_detail_title"
binding:layout_constraintLeft_toLeftOf="parent"
binding:layout_constraintRight_toRightOf="parent"
binding:layout_constraintTop_toBottomOf="@+id/tv_rfid_text" />
binding:layout_constraintTop_toBottomOf="@+id/tv_rfid_text" >
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/cl_title_1"
android:layout_width="@dimen/dp_112"
android:layout_height="@dimen/dp_45"
android:gravity="center_vertical"
android:orientation="vertical"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:padding="@dimen/dp_5"
android:background="@drawable/bg_radius_white_5"
binding:layout_constraintLeft_toLeftOf="parent"
binding:layout_constraintRight_toRightOf="parent"
binding:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center|start"
android:maxLines="1"
android:text="饲养品种"
android:textSize="@dimen/sp_8"
android:textColor="@color/colorPrimary" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center|end"
android:maxLines="1"
android:text="@{viewModel.raiseVarieties}"
android:textSize="@dimen/sp_8"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/cl_title_2"
android:layout_width="@dimen/dp_112"
android:layout_height="@dimen/dp_45"
android:gravity="center_vertical"
android:orientation="vertical"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_5"
android:padding="@dimen/dp_5"
android:background="@drawable/bg_radius_white_5"
binding:layout_constraintLeft_toLeftOf="parent"
binding:layout_constraintRight_toRightOf="parent"
binding:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center|start"
android:maxLines="1"
android:text="所属种蓄站"
android:textSize="@dimen/sp_8"
android:textColor="@color/colorPrimary"/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center|end"
android:maxLines="1"
android:text="@{viewModel.deptName}"
android:textSize="@dimen/sp_8"/>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
<com.lingber.mycontrol.datagridview.DataGridView
android:id="@+id/ll_detail_title"
......
......@@ -67,7 +67,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="tag"
android:text="可视耳标号"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp_10" />
......
......@@ -28,6 +28,7 @@
<string name="error_data_upload">错误上报</string>
<string name="one_click_sync">一键同步</string>
......
1.称重页面:时间强制默认当天
2.性能测定:写死重量从扫码页面带过来
\ No newline at end of file
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