Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
A
AnchorCollect
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
Commits
522fdd15
Commit
522fdd15
authored
Dec 26, 2024
by
hywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.性能测定判断重量不低于上个年龄有称重的性能测定。
parent
3af6a422
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
28 deletions
+91
-28
build.gradle
app/build.gradle
+3
-3
DaoMaster.java
...rc/main/java/com/phlx/anchorcollect/db/gen/DaoMaster.java
+2
-2
DictEntity.java
...c/main/java/com/phlx/anchorcollect/entity/DictEntity.java
+7
-7
PerformanceVM.java
.../com/phlx/anchorcollect/ui/fragment/vm/PerformanceVM.java
+72
-12
MainVM.java
app/src/main/java/com/phlx/anchorcollect/ui/main/MainVM.java
+6
-2
activity_setting.xml
app/src/main/res/layout/activity_setting.xml
+1
-2
No files found.
app/build.gradle
View file @
522fdd15
...
...
@@ -9,8 +9,8 @@ android {
applicationId
"com.phlx.anchorcollect"
minSdkVersion
21
targetSdkVersion
29
versionCode
2
2
versionName
"2.
3.2
"
versionCode
2
3
versionName
"2.
4.0
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
...
...
@@ -50,7 +50,7 @@ android {
}
greendao
{
schemaVersion
9
//数据库版本号
schemaVersion
10
//数据库版本号
daoPackage
'com.phlx.anchorcollect.db.gen'
targetGenDir
'src/main/java'
}
...
...
app/src/main/java/com/phlx/anchorcollect/db/gen/DaoMaster.java
View file @
522fdd15
...
...
@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version
9
): knows all DAOs.
* Master of DAO (schema version
10
): knows all DAOs.
*/
public
class
DaoMaster
extends
AbstractDaoMaster
{
public
static
final
int
SCHEMA_VERSION
=
9
;
public
static
final
int
SCHEMA_VERSION
=
10
;
/** Creates underlying database table using DAOs. */
public
static
void
createAllTables
(
Database
db
,
boolean
ifNotExists
)
{
...
...
app/src/main/java/com/phlx/anchorcollect/entity/DictEntity.java
View file @
522fdd15
...
...
@@ -21,7 +21,7 @@ public class DictEntity extends BaseObservable implements Parcelable {
private
String
dictCode
;
/** 字典排序 */
private
String
dictSort
;
private
int
dictSort
;
/** 字典标签 */
private
String
dictLabel
;
...
...
@@ -64,7 +64,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
();
...
...
@@ -79,8 +79,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
)
{
...
...
@@ -103,7 +103,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
);
...
...
@@ -143,11 +143,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/ui/fragment/vm/PerformanceVM.java
View file @
522fdd15
...
...
@@ -99,6 +99,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
);
...
...
@@ -295,6 +297,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
)
...
...
@@ -305,7 +366,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
());
...
...
@@ -322,7 +383,6 @@ public class PerformanceVM extends BaseViewModel<Repository> {
ToastUtils
.
showShort
(
"性能测定月龄数据-数据库查询失败"
);
}
});
}
private
void
savePerformance
(
PerformanceEntity
performanceEntity
)
{
...
...
@@ -389,17 +449,17 @@ public class PerformanceVM extends BaseViewModel<Repository> {
RxBus
.
getDefault
().
toObservable
(
EventMsg
.
class
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
// 确保在主线程中执行
.
subscribe
(
eventType
->
{
if
(
eventType
.
getAction
().
equals
(
EventTag
.
EVENT_BLE_LEN
))
{
if
(
eventType
.
getAction
().
equals
(
EventTag
.
EVENT_BLE_LEN
))
{
// cn.wandersnail.commons.util.ToastUtils.showShort("长度数据获取成功");
onInputDialogEvent
.
setValue
(
eventType
.
getObj
().
toString
());
//用于屏蔽普通蓝牙信息
}
else
if
(
eventType
.
getAction
().
equals
(
EventTag
.
EVENT_BT_SUCC
))
{
}
else
if
(
eventType
.
getAction
().
equals
(
EventTag
.
EVENT_BT_FAIL
))
{
onInputDialogEvent
.
setValue
(
eventType
.
getObj
().
toString
());
//用于屏蔽普通蓝牙信息
}
else
if
(
eventType
.
getAction
().
equals
(
EventTag
.
EVENT_BT_SUCC
))
{
}
else
if
(
eventType
.
getAction
().
equals
(
EventTag
.
EVENT_BT_FAIL
))
{
}
else
{
cn
.
wandersnail
.
commons
.
util
.
ToastUtils
.
showShort
(
"长度数据获取失败"
);
}
});
}
else
{
cn
.
wandersnail
.
commons
.
util
.
ToastUtils
.
showShort
(
"长度数据获取失败"
);
}
});
RxSubscriptions
.
add
(
lengthBus
);
}
...
...
@@ -411,7 +471,7 @@ public class PerformanceVM extends BaseViewModel<Repository> {
}
@SuppressLint
(
"HandlerLeak"
)
private
Handler
myHandler
=
new
Handler
(
Looper
.
getMainLooper
()){
private
Handler
myHandler
=
new
Handler
(
Looper
.
getMainLooper
())
{
@Override
public
void
handleMessage
(
@NonNull
Message
msg
)
{
super
.
handleMessage
(
msg
);
...
...
app/src/main/java/com/phlx/anchorcollect/ui/main/MainVM.java
View file @
522fdd15
...
...
@@ -11,11 +11,13 @@ import com.phlx.anchorcollect.data.Repository;
import
com.phlx.anchorcollect.db.DbUtil
;
import
com.phlx.anchorcollect.db.gen.CattleResumeEntityDao
;
import
com.phlx.anchorcollect.db.gen.DictEntityDao
;
import
com.phlx.anchorcollect.db.gen.PerformanceEntityDao
;
import
com.phlx.anchorcollect.db.interf.DbQueryCallBack
;
import
com.phlx.anchorcollect.entity.CattleResumeEntity
;
import
com.phlx.anchorcollect.entity.DictEntity
;
import
com.phlx.anchorcollect.entity.FrozenSemenEntity
;
import
com.phlx.anchorcollect.entity.GenTableColumn
;
import
com.phlx.anchorcollect.entity.PerformanceEntity
;
import
com.phlx.anchorcollect.ui.base.MainBarVM
;
import
com.phlx.anchorcollect.util.EntityUtils
;
import
com.uhf.structures.FilterParams
;
...
...
@@ -42,8 +44,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
);
...
...
app/src/main/res/layout/activity_setting.xml
View file @
522fdd15
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:binding=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/tools"
>
xmlns:binding=
"http://schemas.android.com/apk/res-auto"
>
<data>
...
...
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