Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
A
AnchorCollect_p
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hywang
AnchorCollect_p
Commits
7322ea62
Commit
7322ea62
authored
Dec 26, 2024
by
hywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.性能测定判断重量不低于上个年龄有称重的性能测定。
parent
17486fe8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
30 deletions
+85
-30
build.gradle
app/build.gradle
+3
-3
DaoMaster.java
.../main/java/com/phlx/anchorcollect_p/db/gen/DaoMaster.java
+2
-2
DictEntityDao.java
...n/java/com/phlx/anchorcollect_p/db/gen/DictEntityDao.java
+6
-14
DictEntity.java
...main/java/com/phlx/anchorcollect_p/entity/DictEntity.java
+7
-7
PerformanceVM.java
...om/phlx/anchorcollect_p/ui/fragment/vm/PerformanceVM.java
+62
-2
MainVM.java
...rc/main/java/com/phlx/anchorcollect_p/ui/main/MainVM.java
+5
-2
No files found.
app/build.gradle
View file @
7322ea62
...
...
@@ -9,8 +9,8 @@ android {
applicationId
"com.phlx.anchorcollect_p"
minSdkVersion
21
targetSdkVersion
29
versionCode
2
3
versionName
"2.
3.2
"
versionCode
2
4
versionName
"2.
4.0
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
...
...
@@ -50,7 +50,7 @@ android {
}
greendao
{
schemaVersion
7
//数据库版本号
schemaVersion
8
//数据库版本号
daoPackage
'com.phlx.anchorcollect_p.db.gen'
targetGenDir
'src/main/java'
}
...
...
app/src/main/java/com/phlx/anchorcollect_p/db/gen/DaoMaster.java
View file @
7322ea62
...
...
@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version
7
): knows all DAOs.
* Master of DAO (schema version
8
): knows all DAOs.
*/
public
class
DaoMaster
extends
AbstractDaoMaster
{
public
static
final
int
SCHEMA_VERSION
=
7
;
public
static
final
int
SCHEMA_VERSION
=
8
;
/** Creates underlying database table using DAOs. */
public
static
void
createAllTables
(
Database
db
,
boolean
ifNotExists
)
{
...
...
app/src/main/java/com/phlx/anchorcollect_p/db/gen/DictEntityDao.java
View file @
7322ea62
...
...
@@ -25,7 +25,7 @@ public class DictEntityDao extends AbstractDao<DictEntity, Void> {
*/
public
static
class
Properties
{
public
final
static
Property
DictCode
=
new
Property
(
0
,
String
.
class
,
"dictCode"
,
false
,
"DICT_CODE"
);
public
final
static
Property
DictSort
=
new
Property
(
1
,
String
.
class
,
"dictSort"
,
false
,
"DICT_SORT"
);
public
final
static
Property
DictSort
=
new
Property
(
1
,
int
.
class
,
"dictSort"
,
false
,
"DICT_SORT"
);
public
final
static
Property
DictLabel
=
new
Property
(
2
,
String
.
class
,
"dictLabel"
,
false
,
"DICT_LABEL"
);
public
final
static
Property
DictValue
=
new
Property
(
3
,
String
.
class
,
"dictValue"
,
false
,
"DICT_VALUE"
);
public
final
static
Property
DictType
=
new
Property
(
4
,
String
.
class
,
"dictType"
,
false
,
"DICT_TYPE"
);
...
...
@@ -54,7 +54,7 @@ public class DictEntityDao extends AbstractDao<DictEntity, Void> {
String
constraint
=
ifNotExists
?
"IF NOT EXISTS "
:
""
;
db
.
execSQL
(
"CREATE TABLE "
+
constraint
+
"\"DICT_ENTITY\" ("
+
//
"\"DICT_CODE\" TEXT,"
+
// 0: dictCode
"\"DICT_SORT\"
TEXT
,"
+
// 1: dictSort
"\"DICT_SORT\"
INTEGER NOT NULL
,"
+
// 1: dictSort
"\"DICT_LABEL\" TEXT,"
+
// 2: dictLabel
"\"DICT_VALUE\" TEXT,"
+
// 3: dictValue
"\"DICT_TYPE\" TEXT,"
+
// 4: dictType
...
...
@@ -83,11 +83,7 @@ public class DictEntityDao extends AbstractDao<DictEntity, Void> {
if
(
dictCode
!=
null
)
{
stmt
.
bindString
(
1
,
dictCode
);
}
String
dictSort
=
entity
.
getDictSort
();
if
(
dictSort
!=
null
)
{
stmt
.
bindString
(
2
,
dictSort
);
}
stmt
.
bindLong
(
2
,
entity
.
getDictSort
());
String
dictLabel
=
entity
.
getDictLabel
();
if
(
dictLabel
!=
null
)
{
...
...
@@ -158,11 +154,7 @@ public class DictEntityDao extends AbstractDao<DictEntity, Void> {
if
(
dictCode
!=
null
)
{
stmt
.
bindString
(
1
,
dictCode
);
}
String
dictSort
=
entity
.
getDictSort
();
if
(
dictSort
!=
null
)
{
stmt
.
bindString
(
2
,
dictSort
);
}
stmt
.
bindLong
(
2
,
entity
.
getDictSort
());
String
dictLabel
=
entity
.
getDictLabel
();
if
(
dictLabel
!=
null
)
{
...
...
@@ -234,7 +226,7 @@ public class DictEntityDao extends AbstractDao<DictEntity, Void> {
public
DictEntity
readEntity
(
Cursor
cursor
,
int
offset
)
{
DictEntity
entity
=
new
DictEntity
(
//
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getString
(
offset
+
0
),
// dictCode
cursor
.
isNull
(
offset
+
1
)
?
null
:
cursor
.
getString
(
offset
+
1
),
// dictSort
cursor
.
getInt
(
offset
+
1
),
// dictSort
cursor
.
isNull
(
offset
+
2
)
?
null
:
cursor
.
getString
(
offset
+
2
),
// dictLabel
cursor
.
isNull
(
offset
+
3
)
?
null
:
cursor
.
getString
(
offset
+
3
),
// dictValue
cursor
.
isNull
(
offset
+
4
)
?
null
:
cursor
.
getString
(
offset
+
4
),
// dictType
...
...
@@ -254,7 +246,7 @@ public class DictEntityDao extends AbstractDao<DictEntity, Void> {
@Override
public
void
readEntity
(
Cursor
cursor
,
DictEntity
entity
,
int
offset
)
{
entity
.
setDictCode
(
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getString
(
offset
+
0
));
entity
.
setDictSort
(
cursor
.
isNull
(
offset
+
1
)
?
null
:
cursor
.
getString
(
offset
+
1
));
entity
.
setDictSort
(
cursor
.
getInt
(
offset
+
1
));
entity
.
setDictLabel
(
cursor
.
isNull
(
offset
+
2
)
?
null
:
cursor
.
getString
(
offset
+
2
));
entity
.
setDictValue
(
cursor
.
isNull
(
offset
+
3
)
?
null
:
cursor
.
getString
(
offset
+
3
));
entity
.
setDictType
(
cursor
.
isNull
(
offset
+
4
)
?
null
:
cursor
.
getString
(
offset
+
4
));
...
...
app/src/main/java/com/phlx/anchorcollect_p/entity/DictEntity.java
View file @
7322ea62
...
...
@@ -20,7 +20,7 @@ public class DictEntity extends BaseObservable implements Parcelable {
private
String
dictCode
;
/** 字典排序 */
private
String
dictSort
;
private
int
dictSort
;
/** 字典标签 */
private
String
dictLabel
;
...
...
@@ -63,7 +63,7 @@ public class DictEntity extends BaseObservable implements Parcelable {
protected
DictEntity
(
Parcel
in
)
{
dictCode
=
in
.
readString
();
dictSort
=
in
.
read
String
();
dictSort
=
in
.
read
Int
();
dictLabel
=
in
.
readString
();
dictValue
=
in
.
readString
();
dictType
=
in
.
readString
();
...
...
@@ -78,8 +78,8 @@ public class DictEntity extends BaseObservable implements Parcelable {
remark
=
in
.
readString
();
}
@Generated
(
hash
=
517044936
)
public
DictEntity
(
String
dictCode
,
String
dictSort
,
String
dictLabel
,
@Generated
(
hash
=
794533722
)
public
DictEntity
(
String
dictCode
,
int
dictSort
,
String
dictLabel
,
String
dictValue
,
String
dictType
,
String
cssClass
,
String
listClass
,
String
isDefault
,
String
status
,
String
createBy
,
String
createTime
,
String
updateBy
,
String
updateTime
,
String
remark
)
{
...
...
@@ -102,7 +102,7 @@ public class DictEntity extends BaseObservable implements Parcelable {
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeString
(
dictCode
);
dest
.
write
String
(
dictSort
);
dest
.
write
Int
(
dictSort
);
dest
.
writeString
(
dictLabel
);
dest
.
writeString
(
dictValue
);
dest
.
writeString
(
dictType
);
...
...
@@ -142,11 +142,11 @@ public class DictEntity extends BaseObservable implements Parcelable {
this
.
dictCode
=
dictCode
;
}
public
String
getDictSort
()
{
public
int
getDictSort
()
{
return
dictSort
;
}
public
void
setDictSort
(
String
dictSort
)
{
public
void
setDictSort
(
int
dictSort
)
{
this
.
dictSort
=
dictSort
;
}
...
...
app/src/main/java/com/phlx/anchorcollect_p/ui/fragment/vm/PerformanceVM.java
View file @
7322ea62
...
...
@@ -81,6 +81,8 @@ public class PerformanceVM extends BaseViewModel<Repository> {
private
List
<
PerformanceEntity
>
uploadData
;
private
int
dictIndex
=
-
1
;
public
PerformanceVM
(
@NonNull
Application
application
,
Repository
model
)
{
super
(
application
,
model
);
...
...
@@ -253,6 +255,65 @@ public class PerformanceVM extends BaseViewModel<Repository> {
Gson
gson
=
new
Gson
();
PerformanceEntity
performanceEntity
=
gson
.
fromJson
(
jsonObject
,
PerformanceEntity
.
class
);
checkWeightRational
(
performanceEntity
);
}
//检验是否重量大于上一次性能测定的称重
private
void
checkWeightRational
(
PerformanceEntity
performanceEntity
)
{
List
<
DictEntity
>
ageDicts
=
LoginInfoUtils
.
getDistList
(
"zxgl_performance_age"
);
dictIndex
=
-
1
;
for
(
int
i
=
0
;
i
<
ageDicts
.
size
();
i
++)
{
if
(
performanceEntity
.
getAge
().
equals
(
ageDicts
.
get
(
i
).
getDictValue
()))
{
dictIndex
=
i
;
dictIndex
--;
break
;
}
}
if
(
dictIndex
==-
1
){
checkExistedAge
(
performanceEntity
);
return
;
}
QueryBuilder
<
PerformanceEntity
>
builder
=
DbUtil
.
getInstance
().
getQueryBuilder
(
PerformanceEntity
.
class
)
.
where
(
PerformanceEntityDao
.
Properties
.
Weight
.
isNotNull
()
,
PerformanceEntityDao
.
Properties
.
CattleresumeId
.
eq
(
Configs
.
tempUnid
)
);
DbUtil
.
getInstance
().
queryAsyncAll
(
PerformanceEntity
.
class
,
builder
,
new
DbQueryCallBack
<
PerformanceEntity
>()
{
@Override
public
void
onSuccess
(
List
<
PerformanceEntity
>
result
)
{
if
(
result
!=
null
&&
!
result
.
isEmpty
())
{
outer:
for
(
int
j
=
dictIndex
;
j
<
ageDicts
.
size
();
j
--)
{
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++)
{
if
(
result
.
get
(
i
).
getAge
().
equals
(
ageDicts
.
get
(
j
).
getDictValue
()))
{
if
(
result
.
get
(
i
).
getWeight
()
!=
null
)
{
if
(
result
.
get
(
i
).
getWeight
()
>
performanceEntity
.
getWeight
())
{
ToastUtils
.
showShort
(
"性能测定月龄重量必须高于上次称重!"
);
return
;
}
break
outer
;
}
}
}
}
}
checkExistedAge
(
performanceEntity
);
}
@Override
public
void
onFailed
()
{
ToastUtils
.
showShort
(
"性能测定月龄数据-数据库查询失败"
);
}
});
}
private
void
checkExistedAge
(
PerformanceEntity
performanceEntity
)
{
//查询此月龄是否存在,存在拿出主键 做覆盖
QueryBuilder
<
PerformanceEntity
>
builder
=
DbUtil
.
getInstance
().
getQueryBuilder
(
PerformanceEntity
.
class
)
...
...
@@ -263,7 +324,7 @@ public class PerformanceVM extends BaseViewModel<Repository> {
@Override
public
void
onSuccess
(
List
<
PerformanceEntity
>
result
)
{
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
if
(
result
!=
null
&&
!
result
.
isEmpty
()
)
{
isModify
=
true
;
Configs
.
resumeId
=
result
.
get
(
0
).
getUnid
();
performanceEntity
.
setUnid
(
result
.
get
(
0
).
getUnid
());
...
...
@@ -280,7 +341,6 @@ public class PerformanceVM extends BaseViewModel<Repository> {
ToastUtils
.
showShort
(
"性能测定月龄数据-数据库查询失败"
);
}
});
}
private
void
savePerformance
(
PerformanceEntity
performanceEntity
)
{
...
...
app/src/main/java/com/phlx/anchorcollect_p/ui/main/MainVM.java
View file @
7322ea62
...
...
@@ -10,6 +10,7 @@ import com.phlx.anchorcollect_p.Configs;
import
com.phlx.anchorcollect_p.data.Repository
;
import
com.phlx.anchorcollect_p.db.DbUtil
;
import
com.phlx.anchorcollect_p.db.gen.CattleResumeEntityDao
;
import
com.phlx.anchorcollect_p.db.gen.DictEntityDao
;
import
com.phlx.anchorcollect_p.db.interf.DbQueryCallBack
;
import
com.phlx.anchorcollect_p.entity.CattleResumeEntity
;
import
com.phlx.anchorcollect_p.entity.DictEntity
;
...
...
@@ -35,8 +36,10 @@ public class MainVM extends MainBarVM<Repository> {
}
public
void
init
()
{
Configs
.
dictList
=
DbUtil
.
getInstance
().
queryAll
(
DictEntity
.
class
);
QueryBuilder
<
DictEntity
>
builder
=
DbUtil
.
getInstance
().
getQueryBuilder
(
DictEntity
.
class
)
.
orderAsc
(
DictEntityDao
.
Properties
.
DictSort
);
Configs
.
dictList
=
DbUtil
.
getInstance
().
queryAll
(
DictEntity
.
class
,
builder
);
Configs
.
frozenSemenList
=
DbUtil
.
getInstance
().
queryAll
(
FrozenSemenEntity
.
class
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment