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
80c4a802
Commit
80c4a802
authored
Apr 19, 2021
by
hywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
羊绒购买改版修改;
打标改成添加时单次验证。
parent
2a51e02b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
276 additions
and
186 deletions
+276
-186
build.gradle
app/build.gradle
+2
-2
Configs.java
app/src/main/java/com/phlx/wool/Configs.java
+1
-0
VillusBuyEntity.java
app/src/main/java/com/phlx/wool/entity/VillusBuyEntity.java
+52
-7
InventoryActivity.java
...in/java/com/phlx/wool/ui/inventory/InventoryActivity.java
+7
-4
InventoryVM.java
...src/main/java/com/phlx/wool/ui/inventory/InventoryVM.java
+91
-94
LoginVM.java
app/src/main/java/com/phlx/wool/ui/login/LoginVM.java
+5
-5
MainVM.java
app/src/main/java/com/phlx/wool/ui/main/MainVM.java
+6
-1
SearchVeterinaryFragment.java
...ava/com/phlx/wool/ui/search/SearchVeterinaryFragment.java
+6
-2
VillusBuyActivity.java
.../main/java/com/phlx/wool/ui/villus/VillusBuyActivity.java
+1
-1
VillusBuyVM.java
...src/main/java/com/phlx/wool/ui/villus/vm/VillusBuyVM.java
+27
-20
UnitActivity.java
...rc/main/java/com/phlx/wool/ui/work/unit/UnitActivity.java
+3
-2
PrintLabel.java
app/src/main/java/com/phlx/wool/util/PrintLabel.java
+7
-6
activity_villus_buy.xml
app/src/main/res/layout/activity_villus_buy.xml
+67
-41
strings.xml
app/src/main/res/values/strings.xml
+1
-1
No files found.
app/build.gradle
View file @
80c4a802
...
...
@@ -8,8 +8,8 @@ android {
applicationId
"com.phlx.wool"
minSdkVersion
21
targetSdkVersion
29
versionCode
1
1
versionName
"1.1.
1
"
versionCode
1
3
versionName
"1.1.
3
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
...
...
app/src/main/java/com/phlx/wool/Configs.java
View file @
80c4a802
...
...
@@ -52,6 +52,7 @@ public class Configs {
public
static
final
String
SP_UNIT_PHONE
=
"sp_unit_phone"
;
public
static
final
String
SP_UNIT_ID_CARD
=
"sp_unit_id_card"
;
public
static
final
String
SP_UNIT_VILLAGE_NAME
=
"sp_unit_villag_name"
;
public
static
final
String
SP_UNIT_REVISION
=
"sp_unit_revision"
;
//type inventory页面显示类型
public
static
final
String
WORK_TYPE_M
=
"work_type_mark"
;
public
static
final
String
WORK_TYPE_Q
=
"work_type_quarantine"
;
...
...
app/src/main/java/com/phlx/wool/entity/VillusBuyEntity.java
View file @
80c4a802
...
...
@@ -57,6 +57,15 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
*/
private
String
personInCharge
;
/** 牧户代码 */
private
String
pastureUnitId
;
/** 牧户名称 */
private
String
pastureUnitName
;
/** 牧户手机号 */
private
String
pastureUnitPhone
;
/** 产品追溯唯一标识 */
private
String
productId
;
...
...
@@ -92,6 +101,9 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
buyFactory
=
in
.
readString
();
buyDate
=
in
.
readString
();
personInCharge
=
in
.
readString
();
pastureUnitId
=
in
.
readString
();
pastureUnitName
=
in
.
readString
();
pastureUnitPhone
=
in
.
readString
();
productId
=
in
.
readString
();
printCount
=
in
.
readInt
();
scanCount
=
in
.
readInt
();
...
...
@@ -100,10 +112,11 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
status
=
in
.
readInt
();
}
@Generated
(
hash
=
814397298
)
@Generated
(
hash
=
1651539007
)
public
VillusBuyEntity
(
Long
id
,
String
buyBatch
,
String
revision
,
String
buyWeight
,
String
buyFactory
,
String
buyDate
,
String
personInCharge
,
String
productId
,
int
printCount
,
int
scanCount
,
String
createBy
,
String
createTime
,
int
status
)
{
String
buyFactory
,
String
buyDate
,
String
personInCharge
,
String
pastureUnitId
,
String
pastureUnitName
,
String
pastureUnitPhone
,
String
productId
,
int
printCount
,
int
scanCount
,
String
createBy
,
String
createTime
,
int
status
)
{
this
.
id
=
id
;
this
.
buyBatch
=
buyBatch
;
this
.
revision
=
revision
;
...
...
@@ -111,6 +124,9 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
this
.
buyFactory
=
buyFactory
;
this
.
buyDate
=
buyDate
;
this
.
personInCharge
=
personInCharge
;
this
.
pastureUnitId
=
pastureUnitId
;
this
.
pastureUnitName
=
pastureUnitName
;
this
.
pastureUnitPhone
=
pastureUnitPhone
;
this
.
productId
=
productId
;
this
.
printCount
=
printCount
;
this
.
scanCount
=
scanCount
;
...
...
@@ -133,6 +149,9 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
dest
.
writeString
(
buyFactory
);
dest
.
writeString
(
buyDate
);
dest
.
writeString
(
personInCharge
);
dest
.
writeString
(
pastureUnitId
);
dest
.
writeString
(
pastureUnitName
);
dest
.
writeString
(
pastureUnitPhone
);
dest
.
writeString
(
productId
);
dest
.
writeInt
(
printCount
);
dest
.
writeInt
(
scanCount
);
...
...
@@ -214,6 +233,30 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
this
.
personInCharge
=
personInCharge
;
}
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
getPastureUnitPhone
()
{
return
pastureUnitPhone
;
}
public
void
setPastureUnitPhone
(
String
pastureUnitPhone
)
{
this
.
pastureUnitPhone
=
pastureUnitPhone
;
}
public
String
getProductId
()
{
return
productId
;
}
...
...
@@ -272,13 +315,15 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
", buyFactory='"
+
buyFactory
+
'\''
+
", buyDate='"
+
buyDate
+
'\''
+
", personInCharge='"
+
personInCharge
+
'\''
+
", pastureUnitId='"
+
pastureUnitId
+
'\''
+
", pastureUnitName='"
+
pastureUnitName
+
'\''
+
", pastureUnitPhone='"
+
pastureUnitPhone
+
'\''
+
", productId='"
+
productId
+
'\''
+
", printCount=
'"
+
printCount
+
'\''
+
", scanCount=
'"
+
scanCount
+
'\''
+
", printCount=
"
+
printCount
+
", scanCount=
"
+
scanCount
+
", createBy='"
+
createBy
+
'\''
+
", createTime='"
+
createTime
+
'\''
+
", status=
'"
+
status
+
'\''
+
", status=
"
+
status
+
'}'
;
}
}
app/src/main/java/com/phlx/wool/ui/inventory/InventoryActivity.java
View file @
80c4a802
...
...
@@ -17,6 +17,7 @@ import com.phlx.wool.Configs;
import
com.phlx.wool.R
;
import
com.phlx.wool.data.VMFactory
;
import
com.phlx.wool.databinding.ActivityInventoryBinding
;
import
com.phlx.wool.entity.Label
;
import
com.phlx.wool.rfid.ModuleManager
;
import
com.phlx.wool.ui.base.BaseActivity
;
import
com.uhf.structures.InventoryParams
;
...
...
@@ -132,16 +133,18 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In
});
viewModel
.
labelCheckEvent
.
observe
(
this
,
new
Observer
<
String
>()
{
viewModel
.
labelCheckEvent
.
observe
(
this
,
new
Observer
<
Label
>()
{
@Override
public
void
onChanged
(
String
count
)
{
public
void
onChanged
(
Label
_label
)
{
new
MaterialDialog
.
Builder
(
InventoryActivity
.
this
).
title
(
"系统提示"
).
content
(
"标签中含有"
+
count
+
"个未记录的标签,是否继续?"
).
positiveText
(
"确定"
).
negativeText
(
"取消"
).
onAny
(
new
MaterialDialog
.
SingleButtonCallback
()
{
// "标签中含有" + count + "个未记录的标签,是否继续?")
"标签未记录,是否添加?"
)
.
positiveText
(
"确定"
).
negativeText
(
"取消"
).
onAny
(
new
MaterialDialog
.
SingleButtonCallback
()
{
@Override
public
void
onClick
(
@NonNull
MaterialDialog
dialog
,
@NonNull
DialogAction
which
)
{
if
(
which
==
DialogAction
.
POSITIVE
)
{
viewModel
.
jumpToActivity
(
);
viewModel
.
addLabel
(
_label
);
}
}
}).
show
();
...
...
app/src/main/java/com/phlx/wool/ui/inventory/InventoryVM.java
View file @
80c4a802
...
...
@@ -69,41 +69,13 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
public
ObservableField
<
Integer
>
invBtnVis
=
new
ObservableField
<>(
View
.
GONE
);
public
SingleLiveEvent
<
InventoryItem
>
deleteItemLiveData
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
Boolean
>
inventoryBtnEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
String
>
labelCheckEvent
=
new
SingleLiveEvent
<>();
public
SingleLiveEvent
<
Label
>
labelCheckEvent
=
new
SingleLiveEvent
<>();
private
Disposable
inventoryBus
;
private
int
labelCount
=
0
;
private
ArrayList
<
Label
>
mList
;
private
ArrayList
<
Label
>
checkList
;
private
int
legalCount
;
private
static
Map
<
String
,
Integer
>
map
;
//去重
@SuppressLint
(
"HandlerLeak"
)
private
Handler
handler
=
new
Handler
()
{
@Override
public
void
handleMessage
(
Message
msg
)
{
if
(
msg
.
what
==
0x333
)
{
InventoryData
inventoryData
=
(
InventoryData
)
msg
.
obj
;
if
(
inventoryData
.
dataLength
>
0
&&
inventoryData
.
epcLength
>
0
)
{
String
epc
=
TextUtil
.
byteToHexString
(
inventoryData
.
EPC_Data
,
6
);
String
tid
=
TextUtil
.
byteToHexString
(
inventoryData
.
data
,
inventoryData
.
dataLength
);
String
tag
=
epc
+
tid
;
if
(!
map
.
containsKey
(
tag
))
{
Label
label
=
new
Label
();
label
.
setEpc
(
epc
);
label
.
setTid
(
tid
);
mList
.
add
(
label
);
InventoryItem
itemViewModel
=
new
InventoryItem
(
InventoryVM
.
this
,
label
);
observableList
.
add
(
itemViewModel
);
labelCount
++;
labelNum
.
set
(
String
.
valueOf
(
labelCount
));
soundPool
.
play
(
musicId
.
get
(
1
),
1
,
1
,
0
,
0
,
1
);
map
.
put
(
tag
,
mList
.
size
()
-
1
);
}
}
}
}
};
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
...
...
@@ -162,8 +134,7 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
//给RecyclerView添加ObservableList
public
ObservableList
<
InventoryItem
>
observableList
=
new
ObservableArrayList
<>();
//给RecyclerView添加ItemBinding
public
ItemBinding
<
InventoryItem
>
itemBinding
=
ItemBinding
.
of
(
BR
.
viewModel
,
R
.
layout
.
item_inventory_rv
);
public
ItemBinding
<
InventoryItem
>
itemBinding
=
ItemBinding
.
of
(
BR
.
viewModel
,
R
.
layout
.
item_inventory_rv
);
/**
* 删除条目
...
...
@@ -194,7 +165,7 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
@Override
public
void
call
()
{
if
(
""
.
equals
(
tipDesc
.
get
().
trim
()))
{
if
(
""
.
equals
(
tipDesc
.
get
().
trim
()))
{
ToastUtils
.
showShort
(
"请扫描标签"
);
return
;
}
...
...
@@ -211,13 +182,9 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
Label
label
=
new
Label
();
label
.
setEpc
(
epc
);
label
.
setTid
(
tid
);
mList
.
add
(
label
);
InventoryItem
itemViewModel
=
new
InventoryItem
(
InventoryVM
.
this
,
label
);
observableList
.
add
(
itemViewModel
);
labelCount
++;
labelNum
.
set
(
String
.
valueOf
(
labelCount
));
soundPool
.
play
(
musicId
.
get
(
1
),
1
,
1
,
0
,
0
,
1
);
map
.
put
(
tag
,
mList
.
size
()
-
1
);
checkLabel
(
label
);
}
else
{
ToastUtils
.
showShort
(
"重复标签"
);
}
...
...
@@ -231,42 +198,37 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
public
BindingCommand
onFixedClickCommand
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
//如果是低频
// if ("1".equals(Configs.FREQUENCY_CONFIG)) {
// mList.clear();
// String epcStr = tipDesc.get();
// if (!StringUtils.isEmpty(epcStr)) {
// Label label = new Label();
// label.setEpc(epcStr);
// label.setTid(epcStr);
// mList.add(label);
// }
// }
if
(
mList
!=
null
&&
mList
.
size
()
>
0
)
{
jumpToActivity
();
}
else
{
ToastUtils
.
showShort
(
"请扫描耳标"
);
}
}
});
private
void
checkLabel
(
Label
_label
)
{
showDialog
(
"正在验证标签..."
);
addSubscribe
(
Observable
.
create
((
ObservableOnSubscribe
<
List
<
Label
>
>)
emitter
->
{
addSubscribe
(
Observable
.
create
((
ObservableOnSubscribe
<
Label
>)
emitter
->
{
try
{
checkList
=
new
ArrayList
<>();
legalCount
=
0
;
KLog
.
e
(
mList
.
toString
());
for
(
int
i
=
0
;
i
<
mList
.
size
();
i
++)
{
// checkList = new ArrayList<>();
KLog
.
e
(
_label
.
toString
());
QueryBuilder
<
Label
>
builder
=
DbUtil
.
getInstance
().
getQueryBuilder
(
Label
.
class
)
.
where
(
LabelDao
.
Properties
.
Epc
.
eq
(
mList
.
get
(
i
)
.
getEpc
()));
.
where
(
LabelDao
.
Properties
.
Epc
.
eq
(
_label
.
getEpc
()));
List
<
Label
>
labels
=
DbUtil
.
getInstance
().
queryAll
(
Label
.
class
,
builder
);
legalCount
=
0
;
//合法状态 0 非法 1 合法
if
(
labels
.
size
()
==
0
)
{
mList
.
get
(
i
)
.
setIsLegalStatus
(
"0"
);
_label
.
setIsLegalStatus
(
"0"
);
legalCount
++;
}
else
{
mList
.
get
(
i
)
.
setIsLegalStatus
(
"1"
);
_label
.
setIsLegalStatus
(
"1"
);
}
checkList
.
add
(
mList
.
get
(
i
));
}
emitter
.
onNext
(
checkList
);
// checkList.add(_label);
emitter
.
onNext
(
_label
);
}
catch
(
Exception
e
)
{
emitter
.
onError
(
e
);
}
...
...
@@ -275,27 +237,34 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
.
compose
(
RxUtils
.
schedulersTransformer
()).
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
{
})
.
subscribe
((
Consumer
<
List
<
Label
>
>)
response
->
{
.
subscribe
((
Consumer
<
Label
>)
response
->
{
dismissDialog
();
if
(
legalCount
>
0
)
{
labelCheckEvent
.
setValue
(
""
+
legalCount
);
labelCheckEvent
.
setValue
(
response
);
}
else
{
jumpToActivity
(
);
addLabel
(
_label
);
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
ToastUtils
.
showShort
(
throwable
.
message
);
}));
}
else
{
ToastUtils
.
showShort
(
"请扫描耳标"
);
}
public
void
addLabel
(
Label
_label
)
{
String
tag
=
_label
.
getEpc
()
+
_label
.
getTid
();
mList
.
add
(
_label
);
InventoryItem
itemViewModel
=
new
InventoryItem
(
InventoryVM
.
this
,
_label
);
observableList
.
add
(
itemViewModel
);
labelCount
++;
labelNum
.
set
(
String
.
valueOf
(
labelCount
));
soundPool
.
play
(
musicId
.
get
(
1
),
1
,
1
,
0
,
0
,
1
);
map
.
put
(
tag
,
mList
.
size
()
-
1
);
}
});
public
void
jumpToActivity
()
{
if
(
checkList
!=
null
&&
check
List
.
size
()
>
0
)
{
if
(
mList
!=
null
&&
m
List
.
size
()
>
0
)
{
Bundle
mBundle
=
new
Bundle
();
mBundle
.
putParcelableArrayList
(
"list"
,
check
List
);
mBundle
.
putParcelableArrayList
(
"list"
,
m
List
);
if
(
type
.
equals
(
Configs
.
WORK_TYPE_M
))
{
startActivity
(
MarkingActivity
.
class
,
mBundle
);
}
else
if
(
type
.
equals
(
Configs
.
WORK_TYPE_Q
))
{
...
...
@@ -336,6 +305,34 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
}
});
@SuppressLint
(
"HandlerLeak"
)
private
Handler
handler
=
new
Handler
()
{
@Override
public
void
handleMessage
(
Message
msg
)
{
if
(
msg
.
what
==
0x333
)
{
InventoryData
inventoryData
=
(
InventoryData
)
msg
.
obj
;
if
(
inventoryData
.
dataLength
>
0
&&
inventoryData
.
epcLength
>
0
)
{
String
epc
=
TextUtil
.
byteToHexString
(
inventoryData
.
EPC_Data
,
6
);
String
tid
=
TextUtil
.
byteToHexString
(
inventoryData
.
data
,
inventoryData
.
dataLength
);
String
tag
=
epc
+
tid
;
if
(!
map
.
containsKey
(
tag
))
{
Label
label
=
new
Label
();
label
.
setEpc
(
epc
);
label
.
setTid
(
tid
);
mList
.
add
(
label
);
InventoryItem
itemViewModel
=
new
InventoryItem
(
InventoryVM
.
this
,
label
);
observableList
.
add
(
itemViewModel
);
labelCount
++;
labelNum
.
set
(
String
.
valueOf
(
labelCount
));
soundPool
.
play
(
musicId
.
get
(
1
),
1
,
1
,
0
,
0
,
1
);
map
.
put
(
tag
,
mList
.
size
()
-
1
);
}
}
}
}
};
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
...
...
app/src/main/java/com/phlx/wool/ui/login/LoginVM.java
View file @
80c4a802
...
...
@@ -54,12 +54,12 @@ public class LoginVM extends BackBarVM<Repository> {
public
LoginVM
(
@NonNull
Application
application
,
Repository
repository
)
{
super
(
application
,
repository
);
//
从本地取得数据绑定到View层
//
userName.set(model.getUserName());
//
password.set(model.getPassword());
//
从本地取得数据绑定到View层
userName
.
set
(
model
.
getUserName
());
password
.
set
(
model
.
getPassword
());
userName
.
set
(
"als01"
);
password
.
set
(
"123456"
);
//
userName.set("als01");
//
password.set("123456");
}
//初始化ToolBar
...
...
app/src/main/java/com/phlx/wool/ui/main/MainVM.java
View file @
80c4a802
...
...
@@ -106,8 +106,13 @@ public class MainVM extends MainBarVM<Repository> {
public
BindingCommand
OnVillusBuyClickCommand
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
unitSp
=
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_UNIT_NAME
,
""
);
if
(
unitSp
.
isEmpty
())
{
nullEvent
.
call
();
}
else
{
startActivity
(
VillusBuyActivity
.
class
);
}
}
});
public
BindingCommand
OnVillusGaugeClickCommand
=
new
BindingCommand
(
new
BindingAction
()
{
...
...
app/src/main/java/com/phlx/wool/ui/search/SearchVeterinaryFragment.java
View file @
80c4a802
...
...
@@ -124,6 +124,11 @@ public class SearchVeterinaryFragment extends DialogFragment implements DialogIn
@Override
public
void
onViewCreated
(
@NonNull
View
view
,
@Nullable
Bundle
savedInstanceState
)
{
super
.
onViewCreated
(
view
,
savedInstanceState
);
// QueryBuilder<Veterinary> builder =
// DbUtil.getInstance().getQueryBuilder(Veterinary.class)
// .whereOr(VeterinaryDao.Properties.VeterinaryName.eq(searchKey),
// VeterinaryDao.Properties.VeterinaryPhone.eq(searchKey));
DbUtil
.
getInstance
().
setDbQueryCallBack
(
new
DbQueryCallBack
<
Veterinary
>()
{
@Override
public
void
onSuccess
(
List
<
Veterinary
>
result
)
{
...
...
@@ -258,8 +263,7 @@ public class SearchVeterinaryFragment extends DialogFragment implements DialogIn
DbUtil
.
getInstance
().
getQueryBuilder
(
Veterinary
.
class
)
.
whereOr
(
VeterinaryDao
.
Properties
.
VeterinaryName
.
eq
(
searchKey
),
VeterinaryDao
.
Properties
.
VeterinaryPhone
.
eq
(
searchKey
));
List
<
Veterinary
>
veterinaries
=
DbUtil
.
getInstance
().
queryAll
(
Veterinary
.
class
,
builder
);
List
<
Veterinary
>
veterinaries
=
DbUtil
.
getInstance
().
queryAll
(
Veterinary
.
class
,
builder
);
if
(
veterinaries
==
null
||
veterinaries
.
size
()
==
0
)
{
ToastUtils
.
showShort
(
"未找到符合 "
+
searchKey
+
" 的搜索结果"
);
}
else
{
...
...
app/src/main/java/com/phlx/wool/ui/villus/VillusBuyActivity.java
View file @
80c4a802
...
...
@@ -77,7 +77,7 @@ public class VillusBuyActivity extends BaseActivity<ActivityVillusBuyBinding, Vi
super
.
initViewObservable
();
viewModel
.
buyDay
.
observe
(
this
,
aBoolean
->
{
pvTime
.
show
(
binding
.
b
irt
hDayTv
);
pvTime
.
show
(
binding
.
b
atc
hDayTv
);
});
viewModel
.
changeDivision
.
observe
(
this
,
aBoolean
->
{
...
...
app/src/main/java/com/phlx/wool/ui/villus/vm/VillusBuyVM.java
View file @
80c4a802
...
...
@@ -83,29 +83,36 @@ public class VillusBuyVM extends BackBarVM<Repository> {
if
(
entity
==
null
)
{
entity
=
new
VillusBuyEntity
();
}
//养殖单位
entity
.
setPastureUnitName
(
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_UNIT_NAME
,
""
));
entity
.
setPastureUnitId
(
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_UNIT_CODE
,
""
));
entity
.
setPastureUnitPhone
(
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_UNIT_PHONE
,
""
));
entity
.
setRevision
(
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_UNIT_REVISION
,
""
));
dateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
Date
_date
=
new
Date
();
entity
.
setBuyBatch
(
dateFormat
.
format
(
_date
)
+
"-"
+
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_ID
));
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
superiorPertainItemData
=
new
ArrayList
<>();
List
<
DivisionEntity
>
superiorDivisionEntities
=
model
.
getPertain
(
"152900"
);
if
(
superiorDivisionEntities
!=
null
&&
superiorDivisionEntities
.
size
()
>
0
)
{
for
(
DivisionEntity
divisionEntity
:
superiorDivisionEntities
)
{
superiorPertainItemData
.
add
(
new
ItemData
(
divisionEntity
.
getName
(),
divisionEntity
.
getCode
()));
}
}
//
List<DivisionEntity> superiorDivisionEntities = model.getPertain("152900");
//
if (superiorDivisionEntities != null && superiorDivisionEntities.size() > 0) {
//
for (DivisionEntity divisionEntity : superiorDivisionEntities) {
//
superiorPertainItemData.add(new ItemData(divisionEntity.getName(), divisionEntity.getCode()));
//
}
//
}
pertainItemData
=
new
ArrayList
<>();
lists
=
new
ArrayList
<>();
if
(
superiorDivisionEntities
!=
null
&&
superiorDivisionEntities
.
size
()
>
0
)
{
List
<
DivisionEntity
>
divisionEntities
=
model
.
getPertain
(
superiorDivisionEntities
.
get
(
0
).
getCode
());
if
(
divisionEntities
!=
null
&&
divisionEntities
.
size
()
>
0
)
{
for
(
DivisionEntity
divisionEntity
:
divisionEntities
)
{
pertainItemData
.
add
(
new
ItemData
(
divisionEntity
.
getName
(),
divisionEntity
.
getCode
()));
lists
.
add
(
divisionEntity
.
getName
());
}
}
}
//
lists = new ArrayList<>();
//
if (superiorDivisionEntities != null && superiorDivisionEntities.size() > 0) {
//
List<DivisionEntity> divisionEntities = model.getPertain(superiorDivisionEntities.get(0).getCode());
//
if (divisionEntities != null && divisionEntities.size() > 0) {
//
for (DivisionEntity divisionEntity : divisionEntities) {
//
pertainItemData.add(new ItemData(divisionEntity.getName(), divisionEntity.getCode()));
//
lists.add(divisionEntity.getName());
//
}
//
}
//
}
}
...
...
@@ -165,10 +172,10 @@ public class VillusBuyVM extends BackBarVM<Repository> {
ToastUtils
.
showShort
(
"请选择收购日期"
);
return
;
}
if
(
StringUtils
.
isEmpty
(
entity
.
getRevision
()))
{
ToastUtils
.
showShort
(
"请选择所属苏木"
);
return
;
}
//
if (StringUtils.isEmpty(entity.getRevision())) {
//
ToastUtils.showShort("请选择所属苏木");
//
return;
//
}
if
(
StringUtils
.
isEmpty
(
entity
.
getBuyFactory
()))
{
ToastUtils
.
showShort
(
"请填写收购厂家"
);
return
;
...
...
app/src/main/java/com/phlx/wool/ui/work/unit/UnitActivity.java
View file @
80c4a802
...
...
@@ -117,8 +117,8 @@ public class UnitActivity extends BaseActivity<ActivityUnitBinding, UnitVM> impl
ToastUtils
.
showShort
(
"请选择养殖场"
);
}
else
{
String
contentStr
=
"是否确定将养殖场 "
+
saveUnitName
+
" 更改为 "
+
unitSelected
.
getManagerName
()
+
" 养殖场?"
;
String
[]
keyArray
=
{
saveUnitName
,
unitSelected
.
getManagerName
()};
showTip
(
RichTextUtil
.
matcherSearchTitle
(
new
Integer
(
Color
.
RED
),
contentStr
,
keyArray
));
String
[]
keyArray
=
{
saveUnitName
,
unitSelected
.
getManagerName
()};
showTip
(
RichTextUtil
.
matcherSearchTitle
(
new
Integer
(
Color
.
RED
),
contentStr
,
keyArray
));
}
}
});
...
...
@@ -195,6 +195,7 @@ public class UnitActivity extends BaseActivity<ActivityUnitBinding, UnitVM> impl
SPUtils
.
getInstance
().
put
(
Configs
.
SP_UNIT_PHONE
,
unit
.
getManagerPhone
());
SPUtils
.
getInstance
().
put
(
Configs
.
SP_UNIT_ID_CARD
,
unit
.
getIdCard
());
SPUtils
.
getInstance
().
put
(
Configs
.
SP_UNIT_VILLAGE_NAME
,
unit
.
getVillageName
());
SPUtils
.
getInstance
().
put
(
Configs
.
SP_UNIT_REVISION
,
unit
.
getCityName
()
+
unit
.
getTownsName
()
+
unit
.
getVillageName
());
finish
();
}
...
...
app/src/main/java/com/phlx/wool/util/PrintLabel.java
View file @
80c4a802
...
...
@@ -37,11 +37,11 @@ public class PrintLabel {
if
(
vbe
!=
null
)
{
DivisionEntity
divisionEntity
=
model
.
getPertainForCode
(
vbe
.
getRevision
()).
get
(
0
);
String
pertainName
=
""
;
if
(
divisionEntity
!=
null
)
{
pertainName
=
divisionEntity
.
getName
();
}
//
DivisionEntity divisionEntity = model.getPertainForCode(vbe.getRevision()).get(0);
//
String pertainName = "";
//
if (divisionEntity != null) {
//
pertainName = divisionEntity.getName();
//
}
myPrinter
.
setFont
(
0
,
1
,
1
,
1
,
1
);
myPrinter
.
setPrinter
(
Command
.
ALIGN
,
Command
.
ALIGN_CENTER
);
myPrinter
.
printText
(
"绒毛购买信息\r\n"
);
...
...
@@ -50,7 +50,8 @@ public class PrintLabel {
myPrinter
.
setFont
(
0
,
0
,
0
,
0
,
1
);
// myPrinter.printText(" " + "\r\n");
myPrinter
.
printText
(
"批次:"
+
vbe
.
getBuyBatch
()
+
"\r\n"
);
myPrinter
.
printText
(
"苏木:"
+
pertainName
+
"\r\n"
);
myPrinter
.
printText
(
"所在地:"
+
vbe
.
getRevision
()
+
"\r\n"
);
myPrinter
.
printText
(
"牧户:"
+
vbe
.
getPastureUnitName
()
+
"\r\n"
);
myPrinter
.
printText
(
"重量:"
+
vbe
.
getBuyWeight
()
+
"(千克)\r\n"
);
myPrinter
.
printText
(
"厂家:"
+
vbe
.
getBuyFactory
()
+
"\r\n"
);
...
...
app/src/main/res/layout/activity_villus_buy.xml
View file @
80c4a802
This diff is collapsed.
Click to expand it.
app/src/main/res/values/strings.xml
View file @
80c4a802
<resources>
<string
name=
"app_name"
>
羊毛
追溯系统
</string>
<string
name=
"app_name"
>
追溯系统
</string>
<string
name=
"setting"
>
设置
</string>
<string
name=
"jobNum"
>
工号:
</string>
<string
name=
"pleaseInputUserName"
>
请输入用户名
</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