Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
W
WoolTrace
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
WoolTrace
Commits
a3365a7f
Commit
a3365a7f
authored
Apr 29, 2022
by
hywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修改上传数据超时时间20s
2.增加打标数量查询功能
parent
ac95bc6d
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
601 additions
and
74 deletions
+601
-74
build.gradle
app/build.gradle
+2
-2
Repository.java
app/src/main/java/com/phlx/wool/data/Repository.java
+6
-0
ApiService.java
app/src/main/java/com/phlx/wool/data/http/ApiService.java
+8
-0
HttpDataSource.java
...src/main/java/com/phlx/wool/data/http/HttpDataSource.java
+6
-0
HttpDataSourceImpl.java
...main/java/com/phlx/wool/data/http/HttpDataSourceImpl.java
+6
-0
Marke.java
app/src/main/java/com/phlx/wool/entity/Marke.java
+293
-0
RetrofitClient.java
app/src/main/java/com/phlx/wool/net/RetrofitClient.java
+4
-2
InventoryActivity.java
...in/java/com/phlx/wool/ui/inventory/InventoryActivity.java
+20
-3
InventoryVM.java
...src/main/java/com/phlx/wool/ui/inventory/InventoryVM.java
+13
-3
MainActivity.java
app/src/main/java/com/phlx/wool/ui/main/MainActivity.java
+35
-0
MainVM.java
app/src/main/java/com/phlx/wool/ui/main/MainVM.java
+61
-0
SplashVM.java
app/src/main/java/com/phlx/wool/ui/splash/SplashVM.java
+1
-1
UploadActivity.java
...n/java/com/phlx/wool/ui/sync/activity/UploadActivity.java
+26
-0
DownloadVM.java
app/src/main/java/com/phlx/wool/ui/sync/vm/DownloadVM.java
+3
-3
UploadVM.java
app/src/main/java/com/phlx/wool/ui/sync/vm/UploadVM.java
+78
-60
MarkingActivity.java
...main/java/com/phlx/wool/ui/work/mark/MarkingActivity.java
+24
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+14
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/build.gradle
View file @
a3365a7f
...
@@ -8,8 +8,8 @@ android {
...
@@ -8,8 +8,8 @@ android {
applicationId
"com.phlx.wool"
applicationId
"com.phlx.wool"
minSdkVersion
21
minSdkVersion
21
targetSdkVersion
29
targetSdkVersion
29
versionCode
19
versionCode
20
versionName
"
1.1.9
"
versionName
"
2.0.0
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
}
...
...
app/src/main/java/com/phlx/wool/data/Repository.java
View file @
a3365a7f
...
@@ -15,6 +15,7 @@ import com.phlx.wool.entity.DivisionEntity;
...
@@ -15,6 +15,7 @@ import com.phlx.wool.entity.DivisionEntity;
import
com.phlx.wool.entity.EntryRegistrationEntity
;
import
com.phlx.wool.entity.EntryRegistrationEntity
;
import
com.phlx.wool.entity.Harmless
;
import
com.phlx.wool.entity.Harmless
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.entity.Marke
;
import
com.phlx.wool.entity.Marking
;
import
com.phlx.wool.entity.Marking
;
import
com.phlx.wool.entity.Quarantine
;
import
com.phlx.wool.entity.Quarantine
;
import
com.phlx.wool.entity.TreatmentMethod
;
import
com.phlx.wool.entity.TreatmentMethod
;
...
@@ -113,6 +114,11 @@ public class Repository extends BaseModel implements HttpDataSource, LocalDataSo
...
@@ -113,6 +114,11 @@ public class Repository extends BaseModel implements HttpDataSource, LocalDataSo
return
mHttpDataSource
.
getDivisionList
(
body
);
return
mHttpDataSource
.
getDivisionList
(
body
);
}
}
@Override
public
Observable
<
CattleResponse
<
Marke
>>
getMarkeInfo
(
RequestBody
body
)
{
return
mHttpDataSource
.
getMarkeInfo
(
body
);
}
@Override
@Override
public
Observable
<
CattleResponse
<
List
<
Marking
>>>
submitMarking
(
RequestBody
body
)
{
public
Observable
<
CattleResponse
<
List
<
Marking
>>>
submitMarking
(
RequestBody
body
)
{
return
mHttpDataSource
.
submitMarking
(
body
);
return
mHttpDataSource
.
submitMarking
(
body
);
...
...
app/src/main/java/com/phlx/wool/data/http/ApiService.java
View file @
a3365a7f
...
@@ -8,6 +8,7 @@ import com.phlx.wool.entity.DivisionEntity;
...
@@ -8,6 +8,7 @@ import com.phlx.wool.entity.DivisionEntity;
import
com.phlx.wool.entity.EntryRegistrationEntity
;
import
com.phlx.wool.entity.EntryRegistrationEntity
;
import
com.phlx.wool.entity.Harmless
;
import
com.phlx.wool.entity.Harmless
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.entity.Marke
;
import
com.phlx.wool.entity.Marking
;
import
com.phlx.wool.entity.Marking
;
import
com.phlx.wool.entity.Quarantine
;
import
com.phlx.wool.entity.Quarantine
;
import
com.phlx.wool.entity.Unit
;
import
com.phlx.wool.entity.Unit
;
...
@@ -95,6 +96,13 @@ public interface ApiService {
...
@@ -95,6 +96,13 @@ public interface ApiService {
@POST
(
"/app/basicsInfo/findDivisionsList"
)
@POST
(
"/app/basicsInfo/findDivisionsList"
)
Observable
<
CattleResponse
<
List
<
DivisionEntity
>>>
getDivisionList
(
@Body
RequestBody
body
);
Observable
<
CattleResponse
<
List
<
DivisionEntity
>>>
getDivisionList
(
@Body
RequestBody
body
);
/**
* 获取牧户打标信息
*/
@Headers
({
"Content-Type: application/json"
,
"Accept: application/json"
})
@POST
(
"/app/marke/findCount"
)
Observable
<
CattleResponse
<
Marke
>>
getMarkeInfo
(
@Body
RequestBody
body
);
/**
/**
* 上传打标信息
* 上传打标信息
*/
*/
...
...
app/src/main/java/com/phlx/wool/data/http/HttpDataSource.java
View file @
a3365a7f
...
@@ -8,6 +8,7 @@ import com.phlx.wool.entity.DivisionEntity;
...
@@ -8,6 +8,7 @@ import com.phlx.wool.entity.DivisionEntity;
import
com.phlx.wool.entity.EntryRegistrationEntity
;
import
com.phlx.wool.entity.EntryRegistrationEntity
;
import
com.phlx.wool.entity.Harmless
;
import
com.phlx.wool.entity.Harmless
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.entity.Marke
;
import
com.phlx.wool.entity.Marking
;
import
com.phlx.wool.entity.Marking
;
import
com.phlx.wool.entity.Quarantine
;
import
com.phlx.wool.entity.Quarantine
;
import
com.phlx.wool.entity.Unit
;
import
com.phlx.wool.entity.Unit
;
...
@@ -79,6 +80,11 @@ public interface HttpDataSource {
...
@@ -79,6 +80,11 @@ public interface HttpDataSource {
*/
*/
Observable
<
CattleResponse
<
List
<
DivisionEntity
>>>
getDivisionList
(
@Body
RequestBody
body
);
Observable
<
CattleResponse
<
List
<
DivisionEntity
>>>
getDivisionList
(
@Body
RequestBody
body
);
/**
* 获取牧户打标信息
*/
Observable
<
CattleResponse
<
Marke
>>
getMarkeInfo
(
@Body
RequestBody
body
);
/**
/**
* 上传打标信息
* 上传打标信息
...
...
app/src/main/java/com/phlx/wool/data/http/HttpDataSourceImpl.java
View file @
a3365a7f
...
@@ -8,6 +8,7 @@ import com.phlx.wool.entity.DivisionEntity;
...
@@ -8,6 +8,7 @@ import com.phlx.wool.entity.DivisionEntity;
import
com.phlx.wool.entity.EntryRegistrationEntity
;
import
com.phlx.wool.entity.EntryRegistrationEntity
;
import
com.phlx.wool.entity.Harmless
;
import
com.phlx.wool.entity.Harmless
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.entity.Marke
;
import
com.phlx.wool.entity.Marking
;
import
com.phlx.wool.entity.Marking
;
import
com.phlx.wool.entity.Quarantine
;
import
com.phlx.wool.entity.Quarantine
;
import
com.phlx.wool.entity.Unit
;
import
com.phlx.wool.entity.Unit
;
...
@@ -95,6 +96,11 @@ public class HttpDataSourceImpl implements HttpDataSource {
...
@@ -95,6 +96,11 @@ public class HttpDataSourceImpl implements HttpDataSource {
return
apiService
.
getDivisionList
(
body
);
return
apiService
.
getDivisionList
(
body
);
}
}
@Override
public
Observable
<
CattleResponse
<
Marke
>>
getMarkeInfo
(
RequestBody
body
)
{
return
apiService
.
getMarkeInfo
(
body
);
}
@Override
@Override
public
Observable
<
CattleResponse
<
List
<
Marking
>>>
submitMarking
(
RequestBody
body
)
{
public
Observable
<
CattleResponse
<
List
<
Marking
>>>
submitMarking
(
RequestBody
body
)
{
return
apiService
.
submitMarking
(
body
);
return
apiService
.
submitMarking
(
body
);
...
...
app/src/main/java/com/phlx/wool/entity/Marke.java
0 → 100644
View file @
a3365a7f
package
com
.
phlx
.
wool
.
entity
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
/**
* 打标查看对象 zs_marke
*
* @author phlx
* @date 2020-01-03
*/
public
class
Marke
implements
Parcelable
{
/**
* $column.columnComment
*/
private
String
id
;
/**
* 牧户代码
*/
private
String
pastureunitid
;
/**
* 牧户名称
*/
private
String
pastureunitname
;
/**
* 兽医人员
*/
private
String
farriername
;
/**
* $column.columnComment
*/
private
String
markecount
;
/**
* 出生日期
*/
private
String
birthdatetime
;
/**
* 旗县市名称
*/
private
String
cityname
;
/**
* 旗县市代码
*/
private
String
citycode
;
/**
* 乡镇名称
*/
private
String
townsname
;
/**
* 乡镇代码
*/
private
String
townscode
;
/**
* 村名称
*/
private
String
villagename
;
/**
* 村代码
*/
private
String
villagecode
;
/**
* 身份证
*/
private
String
idcard
;
/**
* 牧户手机号
*/
private
String
pastureunitphone
;
/**
* 时间戳
*/
private
String
inputTime
;
private
String
year
;
/**
* code长度临时字段
*/
private
String
flag
;
public
Marke
()
{
}
protected
Marke
(
Parcel
in
)
{
id
=
in
.
readString
();
pastureunitid
=
in
.
readString
();
pastureunitname
=
in
.
readString
();
farriername
=
in
.
readString
();
markecount
=
in
.
readString
();
birthdatetime
=
in
.
readString
();
cityname
=
in
.
readString
();
citycode
=
in
.
readString
();
townsname
=
in
.
readString
();
townscode
=
in
.
readString
();
villagename
=
in
.
readString
();
villagecode
=
in
.
readString
();
idcard
=
in
.
readString
();
pastureunitphone
=
in
.
readString
();
inputTime
=
in
.
readString
();
year
=
in
.
readString
();
flag
=
in
.
readString
();
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeString
(
id
);
dest
.
writeString
(
pastureunitid
);
dest
.
writeString
(
pastureunitname
);
dest
.
writeString
(
farriername
);
dest
.
writeString
(
markecount
);
dest
.
writeString
(
birthdatetime
);
dest
.
writeString
(
cityname
);
dest
.
writeString
(
citycode
);
dest
.
writeString
(
townsname
);
dest
.
writeString
(
townscode
);
dest
.
writeString
(
villagename
);
dest
.
writeString
(
villagecode
);
dest
.
writeString
(
idcard
);
dest
.
writeString
(
pastureunitphone
);
dest
.
writeString
(
inputTime
);
dest
.
writeString
(
year
);
dest
.
writeString
(
flag
);
}
@Override
public
int
describeContents
()
{
return
0
;
}
public
static
final
Creator
<
Marke
>
CREATOR
=
new
Creator
<
Marke
>()
{
@Override
public
Marke
createFromParcel
(
Parcel
in
)
{
return
new
Marke
(
in
);
}
@Override
public
Marke
[]
newArray
(
int
size
)
{
return
new
Marke
[
size
];
}
};
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getPastureunitid
()
{
return
pastureunitid
;
}
public
void
setPastureunitid
(
String
pastureunitid
)
{
this
.
pastureunitid
=
pastureunitid
;
}
public
String
getPastureunitname
()
{
return
pastureunitname
;
}
public
void
setPastureunitname
(
String
pastureunitname
)
{
this
.
pastureunitname
=
pastureunitname
;
}
public
String
getFarriername
()
{
return
farriername
;
}
public
void
setFarriername
(
String
farriername
)
{
this
.
farriername
=
farriername
;
}
public
String
getMarkecount
()
{
return
markecount
;
}
public
void
setMarkecount
(
String
markecount
)
{
this
.
markecount
=
markecount
;
}
public
String
getBirthdatetime
()
{
return
birthdatetime
;
}
public
void
setBirthdatetime
(
String
birthdatetime
)
{
this
.
birthdatetime
=
birthdatetime
;
}
public
String
getCityname
()
{
return
cityname
;
}
public
void
setCityname
(
String
cityname
)
{
this
.
cityname
=
cityname
;
}
public
String
getCitycode
()
{
return
citycode
;
}
public
void
setCitycode
(
String
citycode
)
{
this
.
citycode
=
citycode
;
}
public
String
getTownsname
()
{
return
townsname
;
}
public
void
setTownsname
(
String
townsname
)
{
this
.
townsname
=
townsname
;
}
public
String
getTownscode
()
{
return
townscode
;
}
public
void
setTownscode
(
String
townscode
)
{
this
.
townscode
=
townscode
;
}
public
String
getVillagename
()
{
return
villagename
;
}
public
void
setVillagename
(
String
villagename
)
{
this
.
villagename
=
villagename
;
}
public
String
getVillagecode
()
{
return
villagecode
;
}
public
void
setVillagecode
(
String
villagecode
)
{
this
.
villagecode
=
villagecode
;
}
public
String
getIdcard
()
{
return
idcard
;
}
public
void
setIdcard
(
String
idcard
)
{
this
.
idcard
=
idcard
;
}
public
String
getPastureunitphone
()
{
return
pastureunitphone
;
}
public
void
setPastureunitphone
(
String
pastureunitphone
)
{
this
.
pastureunitphone
=
pastureunitphone
;
}
public
String
getInputTime
()
{
return
inputTime
;
}
public
void
setInputTime
(
String
inputTime
)
{
this
.
inputTime
=
inputTime
;
}
public
String
getYear
()
{
return
year
;
}
public
void
setYear
(
String
year
)
{
this
.
year
=
year
;
}
public
String
getFlag
()
{
return
flag
;
}
public
void
setFlag
(
String
flag
)
{
this
.
flag
=
flag
;
}
}
app/src/main/java/com/phlx/wool/net/RetrofitClient.java
View file @
a3365a7f
...
@@ -43,15 +43,16 @@ import retrofit2.converter.gson.GsonConverterFactory;
...
@@ -43,15 +43,16 @@ import retrofit2.converter.gson.GsonConverterFactory;
*/
*/
public
class
RetrofitClient
{
public
class
RetrofitClient
{
//超时时间
//超时时间
private
static
final
int
DEFAULT_TIMEOUT
=
1
0
;
private
static
final
int
DEFAULT_TIMEOUT
=
2
0
;
//缓存时间
//缓存时间
private
static
final
int
CACHE_TIMEOUT
=
10
*
1024
*
1024
;
private
static
final
int
CACHE_TIMEOUT
=
10
*
1024
*
1024
;
//服务端根路径
//服务端根路径
public
static
String
baseUrl
=
public
static
String
baseUrl
=
"58.18.92.126"
//阿拉善正式
//
"58.18.92.126"//阿拉善正式
// "39.101.170.186"//锡盟正式
// "39.101.170.186"//锡盟正式
// "192.168.12.105"//锡盟张敏测试
// "192.168.12.105"//锡盟张敏测试
// "192.168.8.189"//张敏
// "192.168.8.189"//张敏
"192.168.8.135"
//董昭阳
;
;
public
static
String
port
=
public
static
String
port
=
"899"
//阿拉善正式
"899"
//阿拉善正式
...
@@ -141,6 +142,7 @@ public class RetrofitClient {
...
@@ -141,6 +142,7 @@ public class RetrofitClient {
)
)
.
connectTimeout
(
DEFAULT_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
connectTimeout
(
DEFAULT_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
writeTimeout
(
DEFAULT_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
writeTimeout
(
DEFAULT_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
DEFAULT_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
connectionPool
(
new
ConnectionPool
(
8
,
15
,
TimeUnit
.
SECONDS
))
.
connectionPool
(
new
ConnectionPool
(
8
,
15
,
TimeUnit
.
SECONDS
))
// 这里你可以根据自己的机型设置同时连接的个数和时间,我这里8个,和每个保持时间为10s
// 这里你可以根据自己的机型设置同时连接的个数和时间,我这里8个,和每个保持时间为10s
.
build
();
.
build
();
...
...
app/src/main/java/com/phlx/wool/ui/inventory/InventoryActivity.java
View file @
a3365a7f
...
@@ -113,6 +113,26 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In
...
@@ -113,6 +113,26 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In
public
void
initViewObservable
()
{
public
void
initViewObservable
()
{
super
.
initViewObservable
();
super
.
initViewObservable
();
viewModel
.
labelSizeDialogEvent
.
observe
(
InventoryActivity
.
this
,
new
Observer
<
Boolean
>()
{
@Override
public
void
onChanged
(
Boolean
b
)
{
new
MaterialDialog
.
Builder
(
InventoryActivity
.
this
).
title
(
"系统提示"
).
content
(
// "标签中含有" + count + "个未记录的标签,是否继续?")
"标签未扫满20,是否跳转?"
)
.
positiveText
(
"确定"
).
negativeText
(
"取消"
).
onAny
(
new
MaterialDialog
.
SingleButtonCallback
()
{
@Override
public
void
onClick
(
@NonNull
MaterialDialog
dialog
,
@NonNull
DialogAction
which
)
{
if
(
which
==
DialogAction
.
POSITIVE
)
{
viewModel
.
farwardNext
();
}
}
}).
show
();
}
});
// InputConnection ic = binding.etInvDesc.getContentDescription()
// InputConnection ic = binding.etInvDesc.getContentDescription()
//
//
binding
.
etInvDesc
.
setOnKeyListener
(
new
View
.
OnKeyListener
()
{
binding
.
etInvDesc
.
setOnKeyListener
(
new
View
.
OnKeyListener
()
{
...
@@ -124,15 +144,12 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In
...
@@ -124,15 +144,12 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In
)
{
)
{
tempCount
++;
tempCount
++;
viewModel
.
setTest
(
tempCount
+
""
);
viewModel
.
setTest
(
tempCount
+
""
);
Log
.
e
(
"why"
,
"tempCount++"
+
tempCount
+
"-"
+
keyEvent
);
}
else
if
(
keyEvent
.
getAction
()
==
KeyEvent
.
ACTION_UP
)
{
}
else
if
(
keyEvent
.
getAction
()
==
KeyEvent
.
ACTION_UP
)
{
temp2Count
++;
temp2Count
++;
viewModel
.
setTest2
(
temp2Count
+
""
);
viewModel
.
setTest2
(
temp2Count
+
""
);
Log
.
e
(
"why"
,
"temp2Count--"
+
temp2Count
+
"-"
+
keyEvent
);
}
else
if
(
keyEvent
.
getAction
()
==
KeyEvent
.
FLAG_LONG_PRESS
){
}
else
if
(
keyEvent
.
getAction
()
==
KeyEvent
.
FLAG_LONG_PRESS
){
temp3Count
++;
temp3Count
++;
viewModel
.
setTest3
(
temp3Count
+
""
);
viewModel
.
setTest3
(
temp3Count
+
""
);
Log
.
e
(
"why"
,
"temp3Count=="
+
temp3Count
+
"-"
+
keyEvent
);
}
}
// if (tempCount > 1) {
// if (tempCount > 1) {
...
...
app/src/main/java/com/phlx/wool/ui/inventory/InventoryVM.java
View file @
a3365a7f
...
@@ -76,6 +76,8 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
...
@@ -76,6 +76,8 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
public
SingleLiveEvent
<
InventoryItem
>
deleteItemLiveData
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
InventoryItem
>
deleteItemLiveData
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
Boolean
>
inventoryBtnEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
Boolean
>
inventoryBtnEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
Label
>
labelCheckEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
Label
>
labelCheckEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
Boolean
>
labelSizeDialogEvent
=
new
SingleLiveEvent
<>();
private
Disposable
inventoryBus
;
private
Disposable
inventoryBus
;
private
int
labelCount
=
0
;
private
int
labelCount
=
0
;
private
ArrayList
<
Label
>
mList
;
private
ArrayList
<
Label
>
mList
;
...
@@ -221,15 +223,23 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
...
@@ -221,15 +223,23 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
public
void
call
()
{
public
void
call
()
{
if
(
mList
!=
null
&&
mList
.
size
()
>
0
)
{
if
(
mList
!=
null
&&
mList
.
size
()
>
0
)
{
if
(
type
.
equals
(
Configs
.
WORK_TYPE_SE
))
if
(
Configs
.
FREQUENCY_CONFIG
.
equals
(
"1"
)
&&
mList
.
size
()
<
20
)
{
clearCacheLabel
();
labelSizeDialogEvent
.
call
();
jumpToActivity
();
}
else
{
farwardNext
();
}
}
else
{
}
else
{
ToastUtils
.
showShort
(
"请扫描耳标"
);
ToastUtils
.
showShort
(
"请扫描耳标"
);
}
}
}
}
});
});
public
void
farwardNext
()
{
if
(
type
.
equals
(
Configs
.
WORK_TYPE_SE
))
clearCacheLabel
();
jumpToActivity
();
}
private
void
checkLabel
(
Label
_label
)
{
private
void
checkLabel
(
Label
_label
)
{
showDialog
(
"正在验证标签..."
);
showDialog
(
"正在验证标签..."
);
...
...
app/src/main/java/com/phlx/wool/ui/main/MainActivity.java
View file @
a3365a7f
...
@@ -21,6 +21,7 @@ import android.widget.Toast;
...
@@ -21,6 +21,7 @@ import android.widget.Toast;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.core.view.GravityCompat
;
import
androidx.core.view.GravityCompat
;
import
androidx.lifecycle.Observer
;
import
androidx.lifecycle.ViewModelProviders
;
import
androidx.lifecycle.ViewModelProviders
;
import
com.afollestad.materialdialogs.DialogAction
;
import
com.afollestad.materialdialogs.DialogAction
;
...
@@ -95,7 +96,9 @@ public class MainActivity extends BaseActivity<ActivityMainBinding, MainVM> {
...
@@ -95,7 +96,9 @@ public class MainActivity extends BaseActivity<ActivityMainBinding, MainVM> {
@Override
@Override
public
void
initViewObservable
()
{
public
void
initViewObservable
()
{
viewModel
.
drawerEvent
.
observe
(
this
,
aBoolean
->
binding
.
drawerLeft
.
openDrawer
(
GravityCompat
.
START
));
viewModel
.
drawerEvent
.
observe
(
this
,
aBoolean
->
binding
.
drawerLeft
.
openDrawer
(
GravityCompat
.
START
));
viewModel
.
nullEvent
.
observe
(
this
,
aBoolean
->
{
viewModel
.
nullEvent
.
observe
(
this
,
aBoolean
->
{
new
MaterialDialog
.
Builder
(
this
).
title
(
"系统信息"
).
content
(
"请先选择养殖场!!!"
)
new
MaterialDialog
.
Builder
(
this
).
title
(
"系统信息"
).
content
(
"请先选择养殖场!!!"
)
.
cancelable
(
false
).
canceledOnTouchOutside
(
false
)
.
cancelable
(
false
).
canceledOnTouchOutside
(
false
)
...
@@ -109,6 +112,26 @@ public class MainActivity extends BaseActivity<ActivityMainBinding, MainVM> {
...
@@ -109,6 +112,26 @@ public class MainActivity extends BaseActivity<ActivityMainBinding, MainVM> {
}).
show
();
}).
show
();
});
});
viewModel
.
markCountEvent
.
observe
(
this
,
s
->
{
new
MaterialDialog
.
Builder
(
this
).
title
(
"系统信息"
).
content
(
s
)
.
cancelable
(
false
).
canceledOnTouchOutside
(
false
)
.
positiveText
(
"确定"
).
onPositive
(
new
MaterialDialog
.
SingleButtonCallback
()
{
@Override
public
void
onClick
(
@NonNull
MaterialDialog
dialog
,
@NonNull
DialogAction
which
)
{
if
(
which
==
DialogAction
.
POSITIVE
)
{
dialog
.
dismiss
();
}
}
}).
show
();
});
viewModel
.
errorEvent
.
observe
(
this
,
new
Observer
<
String
>()
{
@Override
public
void
onChanged
(
String
s
)
{
showTip
(
s
);
}
});
//弹出绒毛购买打印选择
//弹出绒毛购买打印选择
viewModel
.
printEvent
.
observe
(
this
,
aBoolean
->
{
viewModel
.
printEvent
.
observe
(
this
,
aBoolean
->
{
...
@@ -125,7 +148,19 @@ public class MainActivity extends BaseActivity<ActivityMainBinding, MainVM> {
...
@@ -125,7 +148,19 @@ public class MainActivity extends BaseActivity<ActivityMainBinding, MainVM> {
}).
show
();
}).
show
();
});
});
}
private
void
showTip
(
String
content
)
{
new
MaterialDialog
.
Builder
(
this
).
title
(
"系统信息"
).
content
(
content
)
.
cancelable
(
false
).
canceledOnTouchOutside
(
false
)
.
positiveText
(
"退出"
).
onPositive
(
new
MaterialDialog
.
SingleButtonCallback
()
{
@Override
public
void
onClick
(
@NonNull
MaterialDialog
dialog
,
@NonNull
DialogAction
which
)
{
if
(
which
==
DialogAction
.
POSITIVE
)
{
dialog
.
dismiss
();
}
}
}).
show
();
}
}
...
...
app/src/main/java/com/phlx/wool/ui/main/MainVM.java
View file @
a3365a7f
...
@@ -5,9 +5,12 @@ import android.os.Bundle;
...
@@ -5,9 +5,12 @@ import android.os.Bundle;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
com.google.gson.JsonObject
;
import
com.phlx.wool.Configs
;
import
com.phlx.wool.Configs
;
import
com.phlx.wool.data.Repository
;
import
com.phlx.wool.data.Repository
;
import
com.phlx.wool.entity.Marke
;
import
com.phlx.wool.entity.VillusBuyEntity
;
import
com.phlx.wool.entity.VillusBuyEntity
;
import
com.phlx.wool.params.CattleResponse
;
import
com.phlx.wool.ui.base.MainBarVM
;
import
com.phlx.wool.ui.base.MainBarVM
;
import
com.phlx.wool.ui.inventory.InventoryActivity
;
import
com.phlx.wool.ui.inventory.InventoryActivity
;
import
com.phlx.wool.ui.setting.SettingActivity
;
import
com.phlx.wool.ui.setting.SettingActivity
;
...
@@ -23,10 +26,16 @@ import com.printer.sdk.PrinterInstance;
...
@@ -23,10 +26,16 @@ import com.printer.sdk.PrinterInstance;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
io.reactivex.functions.Consumer
;
import
me.goldze.mvvmhabit.binding.command.BindingAction
;
import
me.goldze.mvvmhabit.binding.command.BindingAction
;
import
me.goldze.mvvmhabit.binding.command.BindingCommand
;
import
me.goldze.mvvmhabit.binding.command.BindingCommand
;
import
me.goldze.mvvmhabit.bus.event.SingleLiveEvent
;
import
me.goldze.mvvmhabit.bus.event.SingleLiveEvent
;
import
me.goldze.mvvmhabit.http.ResponseThrowable
;
import
me.goldze.mvvmhabit.utils.KLog
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
import
me.goldze.mvvmhabit.utils.SPUtils
;
import
me.goldze.mvvmhabit.utils.SPUtils
;
import
okhttp3.MediaType
;
import
okhttp3.RequestBody
;
public
class
MainVM
extends
MainBarVM
<
Repository
>
{
public
class
MainVM
extends
MainBarVM
<
Repository
>
{
...
@@ -34,6 +43,8 @@ public class MainVM extends MainBarVM<Repository> {
...
@@ -34,6 +43,8 @@ public class MainVM extends MainBarVM<Repository> {
private
static
String
unitSp
;
private
static
String
unitSp
;
public
SingleLiveEvent
<
Boolean
>
nullEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
Boolean
>
nullEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
String
>
markCountEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
String
>
errorEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
Boolean
>
drawerEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
Boolean
>
drawerEvent
=
new
SingleLiveEvent
<>();
...
@@ -191,4 +202,54 @@ public class MainVM extends MainBarVM<Repository> {
...
@@ -191,4 +202,54 @@ public class MainVM extends MainBarVM<Repository> {
}
}
});
});
public
BindingCommand
OnMarkCountClickCommand
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
unitSp
=
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_UNIT_NAME
,
""
);
if
(
unitSp
.
isEmpty
())
{
nullEvent
.
call
();
}
else
{
queryMarkCount
();
}
}
});
//查询牧户打标数量
private
void
queryMarkCount
()
{
JsonObject
jo
=
new
JsonObject
();
jo
.
addProperty
(
"pastureunitid"
,
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_UNIT_CODE
,
""
));
RequestBody
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_UNIT_CODE
,
""
));
KLog
.
e
(
"marke"
,
jo
.
toString
());
addSubscribe
(
model
.
getMarkeInfo
(
body
)
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在查询牧户打标数据..."
))
.
subscribe
((
Consumer
<
CattleResponse
<
Marke
>>)
response
->
{
dismissDialog
();
if
(
response
.
getCode
()
==
0
)
{
if
(
response
.
getData
()
!=
null
)
{
String
markCountStr
=
"牧户:"
+
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_UNIT_NAME
,
""
)
+
" 打标数量:"
+
response
.
getData
().
getMarkecount
()
+
"个!"
;
markCountEvent
.
setValue
(
markCountStr
);
}
else
{
errorEvent
.
setValue
(
"无此牧户打标数据!!"
);
}
}
else
{
errorEvent
.
setValue
(
"服务器 :"
+
response
.
getMsg
());
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
KLog
.
e
(
throwable
.
message
);
errorEvent
.
setValue
(
"查询牧户打标信息失败"
);
})
);
}
}
}
app/src/main/java/com/phlx/wool/ui/splash/SplashVM.java
View file @
a3365a7f
...
@@ -39,7 +39,7 @@ public class SplashVM extends MainBarVM<Repository> {
...
@@ -39,7 +39,7 @@ public class SplashVM extends MainBarVM<Repository> {
public
SingleLiveEvent
<
String
>
errorEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
String
>
errorEvent
=
new
SingleLiveEvent
<>();
private
int
labelPageIndex
=
1
;
private
int
labelPageIndex
=
1
;
private
int
unitPageIndex
=
0
;
private
int
unitPageIndex
=
1
;
public
SplashVM
(
@NonNull
Application
application
,
Repository
repository
)
{
public
SplashVM
(
@NonNull
Application
application
,
Repository
repository
)
{
super
(
application
,
repository
);
super
(
application
,
repository
);
...
...
app/src/main/java/com/phlx/wool/ui/sync/activity/UploadActivity.java
View file @
a3365a7f
...
@@ -2,8 +2,12 @@ package com.phlx.wool.ui.sync.activity;
...
@@ -2,8 +2,12 @@ package com.phlx.wool.ui.sync.activity;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
androidx.annotation.NonNull
;
import
androidx.lifecycle.Observer
;
import
androidx.lifecycle.ViewModelProviders
;
import
androidx.lifecycle.ViewModelProviders
;
import
com.afollestad.materialdialogs.DialogAction
;
import
com.afollestad.materialdialogs.MaterialDialog
;
import
com.phlx.wool.BR
;
import
com.phlx.wool.BR
;
import
com.phlx.wool.R
;
import
com.phlx.wool.R
;
import
com.phlx.wool.data.VMFactory
;
import
com.phlx.wool.data.VMFactory
;
...
@@ -46,6 +50,28 @@ public class UploadActivity extends BaseActivity<ActivityUploadBinding, UploadVM
...
@@ -46,6 +50,28 @@ public class UploadActivity extends BaseActivity<ActivityUploadBinding, UploadVM
viewModel
.
initToolbar
();
viewModel
.
initToolbar
();
}
}
@Override
public
void
initViewObservable
()
{
super
.
initViewObservable
();
viewModel
.
onShowDialogEvent
.
observe
(
UploadActivity
.
this
,
new
Observer
<
String
>()
{
@Override
public
void
onChanged
(
String
s
)
{
new
MaterialDialog
.
Builder
(
UploadActivity
.
this
)
.
canceledOnTouchOutside
(
false
)
.
title
(
"系统提示"
).
content
(
s
).
positiveText
(
"确定"
).
onAny
(
new
MaterialDialog
.
SingleButtonCallback
()
{
@Override
public
void
onClick
(
@NonNull
MaterialDialog
dialog
,
@NonNull
DialogAction
which
)
{
if
(
which
==
DialogAction
.
POSITIVE
)
{
finish
();
}
}
}).
show
();
}
});
}
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
...
...
app/src/main/java/com/phlx/wool/ui/sync/vm/DownloadVM.java
View file @
a3365a7f
...
@@ -59,8 +59,8 @@ public class DownloadVM extends BackBarVM<Repository> {
...
@@ -59,8 +59,8 @@ public class DownloadVM extends BackBarVM<Repository> {
public
SingleLiveEvent
<
String
>
errorEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
String
>
errorEvent
=
new
SingleLiveEvent
<>();
private
int
labelPageIndex
=
0
;
private
int
labelPageIndex
=
1
;
private
int
unitPageIndex
=
0
;
private
int
unitPageIndex
=
1
;
public
ObservableField
<
Boolean
>
isDownloadLabel
=
new
ObservableField
<
Boolean
>(
false
);
public
ObservableField
<
Boolean
>
isDownloadLabel
=
new
ObservableField
<
Boolean
>(
false
);
public
ObservableField
<
Boolean
>
isDownloadBasic
=
new
ObservableField
<
Boolean
>(
false
);
public
ObservableField
<
Boolean
>
isDownloadBasic
=
new
ObservableField
<
Boolean
>(
false
);
public
ObservableField
<
Boolean
>
isDownloadUnit
=
new
ObservableField
<
Boolean
>(
false
);
public
ObservableField
<
Boolean
>
isDownloadUnit
=
new
ObservableField
<
Boolean
>(
false
);
...
@@ -205,7 +205,7 @@ public class DownloadVM extends BackBarVM<Repository> {
...
@@ -205,7 +205,7 @@ public class DownloadVM extends BackBarVM<Repository> {
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
inputTime
=
result
.
get
(
0
).
getTimestamp
();
inputTime
=
result
.
get
(
0
).
getTimestamp
();
}
}
requestLabel
(
0
,
inputTime
,
100000
);
requestLabel
(
1
,
inputTime
,
100000
);
}
}
@Override
@Override
...
...
app/src/main/java/com/phlx/wool/ui/sync/vm/UploadVM.java
View file @
a3365a7f
...
@@ -41,6 +41,7 @@ import java.util.List;
...
@@ -41,6 +41,7 @@ import java.util.List;
import
io.reactivex.functions.Consumer
;
import
io.reactivex.functions.Consumer
;
import
me.goldze.mvvmhabit.binding.command.BindingCommand
;
import
me.goldze.mvvmhabit.binding.command.BindingCommand
;
import
me.goldze.mvvmhabit.binding.command.BindingConsumer
;
import
me.goldze.mvvmhabit.binding.command.BindingConsumer
;
import
me.goldze.mvvmhabit.bus.event.SingleLiveEvent
;
import
me.goldze.mvvmhabit.http.ResponseThrowable
;
import
me.goldze.mvvmhabit.http.ResponseThrowable
;
import
me.goldze.mvvmhabit.utils.KLog
;
import
me.goldze.mvvmhabit.utils.KLog
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
...
@@ -77,6 +78,11 @@ public class UploadVM extends BackBarVM<Repository> {
...
@@ -77,6 +78,11 @@ public class UploadVM extends BackBarVM<Repository> {
public
ObservableField
<
Boolean
>
isUploadAll
=
new
ObservableField
<
Boolean
>(
false
);
public
ObservableField
<
Boolean
>
isUploadAll
=
new
ObservableField
<
Boolean
>(
false
);
public
ObservableInt
uploadDataVisibility
=
new
ObservableInt
();
public
ObservableInt
uploadDataVisibility
=
new
ObservableInt
();
public
SingleLiveEvent
<
String
>
onShowDialogEvent
=
new
SingleLiveEvent
<>();
//弹窗提示
private
String
succTips
=
""
;
//测试用成功提示
private
long
succCount
,
totalCount
;
//上传结束提示成功数量、总数量
private
boolean
isMarkingUpload
,
isHarmlessUpload
,
isQuarantineUpload
,
isVillusBuyUpload
,
isVillusGaugeUpload
,
isSlaughterEntryUpload
;
private
boolean
isMarkingUpload
,
isHarmlessUpload
,
isQuarantineUpload
,
isVillusBuyUpload
,
isVillusGaugeUpload
,
isSlaughterEntryUpload
;
public
UploadVM
(
@NonNull
Application
application
,
Repository
repository
)
{
public
UploadVM
(
@NonNull
Application
application
,
Repository
repository
)
{
...
@@ -214,8 +220,10 @@ public class UploadVM extends BackBarVM<Repository> {
...
@@ -214,8 +220,10 @@ public class UploadVM extends BackBarVM<Repository> {
}
else
if
(!
""
.
equals
(
toastStr
))
{
}
else
if
(!
""
.
equals
(
toastStr
))
{
ToastUtils
.
showShort
(
toastStr
);
ToastUtils
.
showShort
(
toastStr
);
}
else
{
}
else
{
ToastUtils
.
showShort
(
"上传成功"
);
// ToastUtils.showShort("上传成功");
finish
();
// finish();
succTips
=
"成功上传打标数据:"
+
succCount
+
"条,失败:"
+
(
totalCount
-
succCount
)
+
"条"
;
onShowDialogEvent
.
setValue
(
succTips
);
}
}
}
}
...
@@ -231,6 +239,9 @@ public class UploadVM extends BackBarVM<Repository> {
...
@@ -231,6 +239,9 @@ public class UploadVM extends BackBarVM<Repository> {
isSlaughterEntryUpload
=
false
;
isSlaughterEntryUpload
=
false
;
toastStr
=
""
;
toastStr
=
""
;
succTips
=
""
+
DbUtil
.
getInstance
().
count
(
Marking
.
class
)
+
":"
;
totalCount
=
DbUtil
.
getInstance
().
count
(
Marking
.
class
);
succCount
=
0
;
uploadNext
();
uploadNext
();
});
});
...
@@ -238,11 +249,14 @@ public class UploadVM extends BackBarVM<Repository> {
...
@@ -238,11 +249,14 @@ public class UploadVM extends BackBarVM<Repository> {
private
void
uploadMarking
()
{
private
void
uploadMarking
()
{
QueryBuilder
<
Marking
>
builder
=
QueryBuilder
<
Marking
>
builder
=
DbUtil
.
getInstance
().
getQueryBuilder
(
Marking
.
class
).
DbUtil
.
getInstance
().
getQueryBuilder
(
Marking
.
class
)
where
(
MarkingDao
.
Properties
.
Status
.
eq
(
1
)).
limit
(
100
);
.
where
(
MarkingDao
.
Properties
.
Status
.
eq
(
1
))
.
limit
(
100
)
;
DbUtil
.
getInstance
().
setDbQueryCallBack
(
new
DbQueryCallBack
<
Marking
>()
{
DbUtil
.
getInstance
().
setDbQueryCallBack
(
new
DbQueryCallBack
<
Marking
>()
{
@Override
@Override
public
void
onSuccess
(
List
<
Marking
>
result
)
{
public
void
onSuccess
(
List
<
Marking
>
result
)
{
succTips
+=
result
.
size
()
+
"-"
;
isMarkingUpload
=
true
;
isMarkingUpload
=
true
;
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
...
@@ -260,6 +274,8 @@ public class UploadVM extends BackBarVM<Repository> {
...
@@ -260,6 +274,8 @@ public class UploadVM extends BackBarVM<Repository> {
.
subscribe
((
Consumer
<
CattleResponse
<
List
<
Marking
>>>)
response
->
{
.
subscribe
((
Consumer
<
CattleResponse
<
List
<
Marking
>>>)
response
->
{
KLog
.
e
(
response
.
getCode
()
+
response
.
getMsg
());
KLog
.
e
(
response
.
getCode
()
+
response
.
getMsg
());
if
(
response
.
getCode
()
==
0
)
{
if
(
response
.
getCode
()
==
0
)
{
succCount
+=
result
.
size
();
succTips
+=
"Y:"
;
// for (int i = 0; i < result.size(); i++) {
// for (int i = 0; i < result.size(); i++) {
// result.get(i).setStatus(0);
// result.get(i).setStatus(0);
// }
// }
...
@@ -289,12 +305,14 @@ public class UploadVM extends BackBarVM<Repository> {
...
@@ -289,12 +305,14 @@ public class UploadVM extends BackBarVM<Repository> {
}).
deleteAsyncBatch
(
Marking
.
class
,
result
);
}).
deleteAsyncBatch
(
Marking
.
class
,
result
);
}
else
{
}
else
{
dismissDialog
();
dismissDialog
();
succTips
+=
"N:"
;
toastStr
+=
"marking上传失败;"
;
toastStr
+=
"marking上传失败;"
;
ToastUtils
.
showShort
(
"marking上传失败"
);
ToastUtils
.
showShort
(
"marking上传失败"
);
uploadNext
();
uploadNext
();
}
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
dismissDialog
();
succTips
+=
"N:"
;
ToastUtils
.
showShort
(
throwable
.
message
);
ToastUtils
.
showShort
(
throwable
.
message
);
uploadNext
();
uploadNext
();
})
})
...
...
app/src/main/java/com/phlx/wool/ui/work/mark/MarkingActivity.java
View file @
a3365a7f
...
@@ -4,13 +4,17 @@ import android.app.Dialog;
...
@@ -4,13 +4,17 @@ import android.app.Dialog;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.KeyEvent
;
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.widget.FrameLayout
;
import
android.widget.FrameLayout
;
import
androidx.annotation.NonNull
;
import
androidx.lifecycle.ViewModelProviders
;
import
androidx.lifecycle.ViewModelProviders
;
import
com.afollestad.materialdialogs.DialogAction
;
import
com.afollestad.materialdialogs.MaterialDialog
;
import
com.bigkoo.pickerview.builder.TimePickerBuilder
;
import
com.bigkoo.pickerview.builder.TimePickerBuilder
;
import
com.bigkoo.pickerview.listener.OnTimeSelectChangeListener
;
import
com.bigkoo.pickerview.listener.OnTimeSelectChangeListener
;
import
com.bigkoo.pickerview.listener.OnTimeSelectListener
;
import
com.bigkoo.pickerview.listener.OnTimeSelectListener
;
...
@@ -21,6 +25,7 @@ import com.phlx.wool.data.VMFactory;
...
@@ -21,6 +25,7 @@ import com.phlx.wool.data.VMFactory;
import
com.phlx.wool.databinding.ActivityMarkingBinding
;
import
com.phlx.wool.databinding.ActivityMarkingBinding
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.entity.Veterinary
;
import
com.phlx.wool.entity.Veterinary
;
import
com.phlx.wool.rfid.ModuleManager
;
import
com.phlx.wool.ui.base.BaseActivity
;
import
com.phlx.wool.ui.base.BaseActivity
;
import
com.phlx.wool.ui.search.SearchVeterinaryFragment
;
import
com.phlx.wool.ui.search.SearchVeterinaryFragment
;
import
com.phlx.wool.ui.search.interf.IOnSearchVeterinaryClickListener
;
import
com.phlx.wool.ui.search.interf.IOnSearchVeterinaryClickListener
;
...
@@ -154,4 +159,23 @@ public class MarkingActivity extends BaseActivity<ActivityMarkingBinding, Markin
...
@@ -154,4 +159,23 @@ public class MarkingActivity extends BaseActivity<ActivityMarkingBinding, Markin
viewModel
.
entity
.
setVeterinaryCode
(
veterinary
.
getVeterinaryCode
());
viewModel
.
entity
.
setVeterinaryCode
(
veterinary
.
getVeterinaryCode
());
viewModel
.
entity
.
notifyChange
();
viewModel
.
entity
.
notifyChange
();
}
}
/**
* 监听Back键按下事件
*/
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
new
MaterialDialog
.
Builder
(
this
).
title
(
"系统提示"
).
content
(
"数据尚未保存,是否退出?"
).
positiveText
(
"确定"
).
negativeText
(
"取消"
).
onAny
(
new
MaterialDialog
.
SingleButtonCallback
()
{
@Override
public
void
onClick
(
@NonNull
MaterialDialog
dialog
,
@NonNull
DialogAction
which
)
{
if
(
which
==
DialogAction
.
POSITIVE
)
{
finish
();
}
}
}).
show
();
return
true
;
}
return
super
.
onKeyDown
(
keyCode
,
event
);
}
}
}
app/src/main/res/layout/activity_main.xml
View file @
a3365a7f
...
@@ -92,6 +92,20 @@
...
@@ -92,6 +92,20 @@
binding:layout_constraintTop_toBottomOf=
"@+id/unit_line"
binding:layout_constraintTop_toBottomOf=
"@+id/unit_line"
binding:onClickCommand=
"@{viewModel.OnSelectUnitClickCommand}"
/>
binding:onClickCommand=
"@{viewModel.OnSelectUnitClickCommand}"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/select_mark_count_btn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/dp_40"
android:layout_marginTop=
"@dimen/dp_10"
android:drawableTop=
"@mipmap/ic_marking"
android:drawablePadding=
"@dimen/dp_10"
android:text=
"@string/marke_count"
android:textSize=
"@dimen/main_btn_size"
binding:layout_constraintLeft_toRightOf=
"@+id/select_unit_btn"
binding:layout_constraintTop_toBottomOf=
"@+id/unit_line"
binding:onClickCommand=
"@{viewModel.OnMarkCountClickCommand}"
/>
<View
<View
android:id=
"@+id/data_tip_line"
android:id=
"@+id/data_tip_line"
android:layout_width=
"@dimen/dp_2"
android:layout_width=
"@dimen/dp_2"
...
...
app/src/main/res/values/strings.xml
View file @
a3365a7f
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
<string
name=
"re_login"
>
重新登录
</string>
<string
name=
"re_login"
>
重新登录
</string>
<string
name=
"clear_data"
>
清空数据
</string>
<string
name=
"clear_data"
>
清空数据
</string>
<string
name=
"select_unit"
>
养殖单位
</string>
<string
name=
"select_unit"
>
养殖单位
</string>
<string
name=
"marke_count"
>
打标数量
</string>
<string
name=
"veterinary"
>
兽医
</string>
<string
name=
"veterinary"
>
兽医
</string>
<string
name=
"buy_batch"
>
收购批次
</string>
<string
name=
"buy_batch"
>
收购批次
</string>
<string
name=
"entry_batch"
>
进场批次
</string>
<string
name=
"entry_batch"
>
进场批次
</string>
...
...
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