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
825466bc
Commit
825466bc
authored
Mar 24, 2021
by
hywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加打印二维码
parent
cbac1838
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
5 deletions
+84
-5
VillusBuyEntity.java
app/src/main/java/com/phlx/wool/entity/VillusBuyEntity.java
+49
-3
RetrofitClient.java
app/src/main/java/com/phlx/wool/net/RetrofitClient.java
+1
-1
VillusBuyVM.java
...src/main/java/com/phlx/wool/ui/villus/vm/VillusBuyVM.java
+4
-1
PrintLabel.java
app/src/main/java/com/phlx/wool/util/PrintLabel.java
+12
-0
StringUtil.java
app/src/main/java/com/phlx/wool/util/StringUtil.java
+18
-0
No files found.
app/src/main/java/com/phlx/wool/entity/VillusBuyEntity.java
View file @
825466bc
...
@@ -57,6 +57,15 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
...
@@ -57,6 +57,15 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
*/
*/
private
String
personInCharge
;
private
String
personInCharge
;
/** 产品追溯唯一标识 */
private
String
productId
;
/** 标签被打印的次数 */
private
int
printCount
;
/** 二维码被扫描的次数 */
private
int
scanCount
;
/** 创建者 */
/** 创建者 */
private
String
createBy
;
private
String
createBy
;
...
@@ -83,15 +92,18 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
...
@@ -83,15 +92,18 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
buyFactory
=
in
.
readString
();
buyFactory
=
in
.
readString
();
buyDate
=
in
.
readString
();
buyDate
=
in
.
readString
();
personInCharge
=
in
.
readString
();
personInCharge
=
in
.
readString
();
productId
=
in
.
readString
();
printCount
=
in
.
readInt
();
scanCount
=
in
.
readInt
();
createBy
=
in
.
readString
();
createBy
=
in
.
readString
();
createTime
=
in
.
readString
();
createTime
=
in
.
readString
();
status
=
in
.
readInt
();
status
=
in
.
readInt
();
}
}
@Generated
(
hash
=
73546827
)
@Generated
(
hash
=
814397298
)
public
VillusBuyEntity
(
Long
id
,
String
buyBatch
,
String
revision
,
String
buyWeight
,
public
VillusBuyEntity
(
Long
id
,
String
buyBatch
,
String
revision
,
String
buyWeight
,
String
buyFactory
,
String
buyDate
,
String
personInCharge
,
String
createBy
,
String
buyFactory
,
String
buyDate
,
String
personInCharge
,
String
productId
,
String
createTime
,
int
status
)
{
int
printCount
,
int
scanCount
,
String
createBy
,
String
createTime
,
int
status
)
{
this
.
id
=
id
;
this
.
id
=
id
;
this
.
buyBatch
=
buyBatch
;
this
.
buyBatch
=
buyBatch
;
this
.
revision
=
revision
;
this
.
revision
=
revision
;
...
@@ -99,6 +111,9 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
...
@@ -99,6 +111,9 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
this
.
buyFactory
=
buyFactory
;
this
.
buyFactory
=
buyFactory
;
this
.
buyDate
=
buyDate
;
this
.
buyDate
=
buyDate
;
this
.
personInCharge
=
personInCharge
;
this
.
personInCharge
=
personInCharge
;
this
.
productId
=
productId
;
this
.
printCount
=
printCount
;
this
.
scanCount
=
scanCount
;
this
.
createBy
=
createBy
;
this
.
createBy
=
createBy
;
this
.
createTime
=
createTime
;
this
.
createTime
=
createTime
;
this
.
status
=
status
;
this
.
status
=
status
;
...
@@ -118,6 +133,9 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
...
@@ -118,6 +133,9 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
dest
.
writeString
(
buyFactory
);
dest
.
writeString
(
buyFactory
);
dest
.
writeString
(
buyDate
);
dest
.
writeString
(
buyDate
);
dest
.
writeString
(
personInCharge
);
dest
.
writeString
(
personInCharge
);
dest
.
writeString
(
productId
);
dest
.
writeInt
(
printCount
);
dest
.
writeInt
(
scanCount
);
dest
.
writeString
(
createBy
);
dest
.
writeString
(
createBy
);
dest
.
writeString
(
createTime
);
dest
.
writeString
(
createTime
);
dest
.
writeInt
(
status
);
dest
.
writeInt
(
status
);
...
@@ -196,6 +214,30 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
...
@@ -196,6 +214,30 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
this
.
personInCharge
=
personInCharge
;
this
.
personInCharge
=
personInCharge
;
}
}
public
String
getProductId
()
{
return
productId
;
}
public
void
setProductId
(
String
productId
)
{
this
.
productId
=
productId
;
}
public
int
getPrintCount
()
{
return
printCount
;
}
public
void
setPrintCount
(
int
printCount
)
{
this
.
printCount
=
printCount
;
}
public
int
getScanCount
()
{
return
scanCount
;
}
public
void
setScanCount
(
int
scanCount
)
{
this
.
scanCount
=
scanCount
;
}
public
String
getCreateBy
()
{
public
String
getCreateBy
()
{
return
createBy
;
return
createBy
;
}
}
...
@@ -230,9 +272,13 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
...
@@ -230,9 +272,13 @@ public class VillusBuyEntity extends BaseObservable implements Parcelable {
", buyFactory='"
+
buyFactory
+
'\''
+
", buyFactory='"
+
buyFactory
+
'\''
+
", buyDate='"
+
buyDate
+
'\''
+
", buyDate='"
+
buyDate
+
'\''
+
", personInCharge='"
+
personInCharge
+
'\''
+
", personInCharge='"
+
personInCharge
+
'\''
+
", productId='"
+
productId
+
'\''
+
", printCount='"
+
printCount
+
'\''
+
", scanCount='"
+
scanCount
+
'\''
+
", createBy='"
+
createBy
+
'\''
+
", createBy='"
+
createBy
+
'\''
+
", createTime='"
+
createTime
+
'\''
+
", createTime='"
+
createTime
+
'\''
+
", status='"
+
status
+
'\''
+
", status='"
+
status
+
'\''
+
'}'
;
'}'
;
}
}
}
}
app/src/main/java/com/phlx/wool/net/RetrofitClient.java
View file @
825466bc
...
@@ -82,7 +82,7 @@ public class RetrofitClient {
...
@@ -82,7 +82,7 @@ public class RetrofitClient {
if
(
TextUtils
.
isEmpty
(
url
))
{
if
(
TextUtils
.
isEmpty
(
url
))
{
if
(
Configs
.
isAddPort
)
{
if
(
Configs
.
isAddPort
)
{
url
=
"http://"
+
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_APP_IP
,
baseUrl
)
+
":"
+
url
=
"http://"
+
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_APP_IP
,
baseUrl
)
+
":"
+
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_APP_PORT
,
"80"
);
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_APP_PORT
,
port
);
}
else
{
}
else
{
url
=
"http://"
+
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_APP_IP
,
baseUrl
);
url
=
"http://"
+
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_APP_IP
,
baseUrl
);
}
}
...
...
app/src/main/java/com/phlx/wool/ui/villus/vm/VillusBuyVM.java
View file @
825466bc
...
@@ -26,6 +26,7 @@ import com.phlx.wool.ui.base.BackBarVM;
...
@@ -26,6 +26,7 @@ import com.phlx.wool.ui.base.BackBarVM;
import
com.phlx.wool.ui.setting.SettingActivity
;
import
com.phlx.wool.ui.setting.SettingActivity
;
import
com.phlx.wool.ui.villus.VillusBuyActivity
;
import
com.phlx.wool.ui.villus.VillusBuyActivity
;
import
com.phlx.wool.util.PrintLabel
;
import
com.phlx.wool.util.PrintLabel
;
import
com.phlx.wool.util.StringUtil
;
import
com.phlx.wool.widget.ItemData
;
import
com.phlx.wool.widget.ItemData
;
import
com.printer.sdk.PrinterInstance
;
import
com.printer.sdk.PrinterInstance
;
...
@@ -57,7 +58,7 @@ public class VillusBuyVM extends BackBarVM<Repository> {
...
@@ -57,7 +58,7 @@ public class VillusBuyVM extends BackBarVM<Repository> {
public
VillusBuyEntity
entity
;
public
VillusBuyEntity
entity
;
public
List
<
IKeyAndValue
>
superiorPertainItemData
;
public
List
<
IKeyAndValue
>
superiorPertainItemData
;
public
List
<
IKeyAndValue
>
pertainItemData
;
public
List
<
IKeyAndValue
>
pertainItemData
;
private
List
<
String
>
lists
=
new
ArrayList
<>()
;
private
List
<
String
>
lists
;
private
List
<
VillusBuyEntity
>
uploadData
;
private
List
<
VillusBuyEntity
>
uploadData
;
...
@@ -181,6 +182,8 @@ public class VillusBuyVM extends BackBarVM<Repository> {
...
@@ -181,6 +182,8 @@ public class VillusBuyVM extends BackBarVM<Repository> {
entity
.
setCreateBy
(
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_NAME
));
entity
.
setCreateBy
(
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_NAME
));
entity
.
setCreateTime
(
dateFormat
.
format
(
new
Date
()));
entity
.
setCreateTime
(
dateFormat
.
format
(
new
Date
()));
entity
.
setStatus
(
1
);
entity
.
setStatus
(
1
);
entity
.
setProductId
(
StringUtil
.
to32String
(
IdUtil
.
createSnowflake
(
3
,
1
).
nextId
()));
entity
.
setPrintCount
(
0
);
uploadData
.
add
(
entity
);
uploadData
.
add
(
entity
);
KLog
.
e
(
uploadData
.
size
()
+
uploadData
.
toString
());
KLog
.
e
(
uploadData
.
size
()
+
uploadData
.
toString
());
...
...
app/src/main/java/com/phlx/wool/util/PrintLabel.java
View file @
825466bc
...
@@ -5,6 +5,9 @@ import com.phlx.wool.data.Repository;
...
@@ -5,6 +5,9 @@ import com.phlx.wool.data.Repository;
import
com.phlx.wool.db.DbUtil
;
import
com.phlx.wool.db.DbUtil
;
import
com.phlx.wool.entity.DivisionEntity
;
import
com.phlx.wool.entity.DivisionEntity
;
import
com.phlx.wool.entity.VillusBuyEntity
;
import
com.phlx.wool.entity.VillusBuyEntity
;
import
com.phlx.wool.net.RetrofitClient
;
import
com.printer.sdk.Barcode
;
import
com.printer.sdk.PrinterConstants
;
import
com.printer.sdk.PrinterInstance
;
import
com.printer.sdk.PrinterInstance
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -13,6 +16,8 @@ import java.util.List;
...
@@ -13,6 +16,8 @@ import java.util.List;
import
com.printer.sdk.PrinterConstants.Command
;
import
com.printer.sdk.PrinterConstants.Command
;
import
me.goldze.mvvmhabit.utils.SPUtils
;
public
class
PrintLabel
{
public
class
PrintLabel
{
//写绒毛购买打印内容
//写绒毛购买打印内容
...
@@ -52,6 +57,13 @@ public class PrintLabel {
...
@@ -52,6 +57,13 @@ public class PrintLabel {
myPrinter
.
printText
(
"日期:"
+
vbe
.
getBuyDate
()
+
"\r\n"
);
myPrinter
.
printText
(
"日期:"
+
vbe
.
getBuyDate
()
+
"\r\n"
);
myPrinter
.
printText
(
"负责人:"
+
vbe
.
getPersonInCharge
()
+
"\r\n"
);
myPrinter
.
printText
(
"负责人:"
+
vbe
.
getPersonInCharge
()
+
"\r\n"
);
myPrinter
.
printText
(
" "
+
"\r\n"
);
myPrinter
.
printText
(
" "
+
"\r\n"
);
PrinterInstance
.
mPrinter
.
setPrinter
(
Command
.
ALIGN
,
Command
.
ALIGN_CENTER
);
String
url
=
"http://"
+
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_APP_IP
,
RetrofitClient
.
baseUrl
)
+
":"
+
SPUtils
.
getInstance
().
getString
(
Configs
.
SP_APP_PORT
,
RetrofitClient
.
port
)
+
"/xlgl/qrYr/"
+
vbe
.
getProductId
();
Barcode
barcode2
=
new
Barcode
(
PrinterConstants
.
BarcodeType
.
QRCODE
,
2
,
3
,
6
,
url
);
PrinterInstance
.
mPrinter
.
printBarCode
(
barcode2
);
myPrinter
.
setPrinter
(
Command
.
ALIGN
,
Command
.
ALIGN_RIGHT
);
myPrinter
.
setPrinter
(
Command
.
ALIGN
,
Command
.
ALIGN_RIGHT
);
myPrinter
.
setLeftMargin
(
0
);
myPrinter
.
setLeftMargin
(
0
);
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
...
...
app/src/main/java/com/phlx/wool/util/StringUtil.java
View file @
825466bc
package
com
.
phlx
.
wool
.
util
;
package
com
.
phlx
.
wool
.
util
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
/**
/**
* <pre>
* <pre>
* author : lei
* author : lei
...
@@ -11,6 +14,9 @@ package com.phlx.wool.util;
...
@@ -11,6 +14,9 @@ package com.phlx.wool.util;
*/
*/
public
class
StringUtil
{
public
class
StringUtil
{
private
static
String
s36bit_const
=
"0123456789abcdefghijklmnopqrstuvwxyz"
;
/**
/**
* 判断字符串是否为null或全为空白字符
* 判断字符串是否为null或全为空白字符
*
*
...
@@ -27,4 +33,16 @@ public class StringUtil {
...
@@ -27,4 +33,16 @@ public class StringUtil {
}
}
return
true
;
return
true
;
}
}
public
static
String
to32String
(
long
i
)
{
BigDecimal
divide
=
new
BigDecimal
(
32
);
BigDecimal
decimal
=
new
BigDecimal
(
i
);
String
res
=
""
;
while
(
BigDecimal
.
ZERO
.
compareTo
(
decimal
)
!=
0
){
BigDecimal
[]
divRes
=
decimal
.
divideAndRemainder
(
divide
);
decimal
=
divRes
[
0
];
res
=
s36bit_const
.
charAt
(
divRes
[
1
].
intValue
())
+
res
;
}
return
res
;
}
}
}
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