Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
warehouse
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
胡懿
warehouse
Commits
91cf88d6
Commit
91cf88d6
authored
Jul 21, 2023
by
anxiaohe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二维码导出
parent
84ef6507
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
38 deletions
+67
-38
DrawQrcodeUtil.java
...jeeplus/modules/warehouse/qrcode/util/DrawQrcodeUtil.java
+2
-2
logic.js
src/main/webapp/webpage/modules/warehouse/goods/logic.js
+65
-36
No files found.
src/main/java/com/jeeplus/modules/warehouse/qrcode/util/DrawQrcodeUtil.java
View file @
91cf88d6
...
@@ -243,7 +243,7 @@ public class DrawQrcodeUtil {
...
@@ -243,7 +243,7 @@ public class DrawQrcodeUtil {
QRcodeSize
qRcodeSize
=
null
;
QRcodeSize
qRcodeSize
=
null
;
qRcodeSize
=
new
QRcodeSize
(
8
,
800
,
1800
,
78
,
800
,
200
,
1600
,
1600
,
new
Color
(
34
,
25
,
21
));
qRcodeSize
=
new
QRcodeSize
(
8
,
800
,
1800
,
78
,
800
,
200
,
1600
,
1600
,
new
Color
(
34
,
25
,
21
));
// BufferedImage bgImage = new BufferedImage(1600, 2400, BufferedImage.TYPE_4BYTE_ABGR);
// BufferedImage bgImage = new BufferedImage(1600, 2400, BufferedImage.TYPE_4BYTE_ABGR);
BufferedImage
bgImage
=
new
BufferedImage
(
3200
,
2400
,
BufferedImage
.
TYPE_
4BYTE_ABGR
);
BufferedImage
bgImage
=
new
BufferedImage
(
3200
,
2400
,
BufferedImage
.
TYPE_
INT_ARGB
);
Graphics2D
g2
=
bgImage
.
createGraphics
();
Graphics2D
g2
=
bgImage
.
createGraphics
();
BufferedImage
qrcodeImage
=
ImageIO
.
read
(
qrcodeFile
);
BufferedImage
qrcodeImage
=
ImageIO
.
read
(
qrcodeFile
);
...
@@ -255,7 +255,7 @@ public class DrawQrcodeUtil {
...
@@ -255,7 +255,7 @@ public class DrawQrcodeUtil {
,
RenderingHints
.
VALUE_ALPHA_INTERPOLATION_QUALITY
);
,
RenderingHints
.
VALUE_ALPHA_INTERPOLATION_QUALITY
);
g2
.
setRenderingHints
(
rh
);
g2
.
setRenderingHints
(
rh
);
Font
font
=
new
Font
(
"
微软雅黑"
,
Font
.
PLAIN
,
15
0
);
Font
font
=
new
Font
(
"
等线"
,
Font
.
PLAIN
,
10
0
);
g2
.
setFont
(
font
);
//设置字体:字体、字号、大小
g2
.
setFont
(
font
);
//设置字体:字体、字号、大小
g2
.
setColor
(
qRcodeSize
.
color
);
//设置背景颜色
g2
.
setColor
(
qRcodeSize
.
color
);
//设置背景颜色
...
...
src/main/webapp/webpage/modules/warehouse/goods/logic.js
View file @
91cf88d6
...
@@ -17,7 +17,7 @@ var defPrintOption = {
...
@@ -17,7 +17,7 @@ var defPrintOption = {
// usb tcp
// usb tcp
protocol
:
printerProtocolMap
.
usb
,
protocol
:
printerProtocolMap
.
usb
,
// 打印机指令
// 打印机指令
printerDirective
:
printerDirectiveMap
.
_thermal_
z
pl_draw_print_
printerDirective
:
printerDirectiveMap
.
_thermal_
ts
pl_draw_print_
}
}
var
device
=
''
;
var
device
=
''
;
...
@@ -73,21 +73,21 @@ var Image_style_letType = {
...
@@ -73,21 +73,21 @@ var Image_style_letType = {
var
pageConfig
=
{
var
pageConfig
=
{
// 纸张宽度
// 纸张宽度
draw_w
:
''
,
draw_w
:
90
,
// 页长
// 页长
draw_h
:
''
,
draw_h
:
72.5
,
// 横向位置
// 横向位置
Image_x
:
''
,
Image_x
:
0
,
// 纵向位置
// 纵向位置
Image_y
:
''
,
Image_y
:
0
,
// 图片宽度
// 图片宽度
Image_w
:
''
,
Image_w
:
84
,
// 图片高度
// 图片高度
Image_h
:
''
,
Image_h
:
63
,
// 图片阈值
// 图片阈值
Image_Threshold
:
''
,
Image_Threshold
:
170
,
// 图片打印模式
// 图片打印模式
Image_style_let
:
'1'
,
Image_style_let
:
3
,
}
}
//绘图打印图片
//绘图打印图片
...
@@ -125,34 +125,63 @@ function printImage (url) {
...
@@ -125,34 +125,63 @@ function printImage (url) {
}
}
}
}
var
pack
=
{
url2Base64
(
url
).
then
(
res
=>
{
command
:
defPrintOption
.
printerDirective
,
var
pack
=
{
device
:
device
,
command
:
defPrintOption
.
printerDirective
,
printdirectly
:
'true'
,
device
:
device
,
measurement_mode
:
'mm'
,
printdirectly
:
'true'
,
canvas_size
:
{
measurement_mode
:
'mm'
,
width
:
pageConfig
.
draw_w
,
canvas_size
:
{
height
:
pageConfig
.
draw_h
width
:
pageConfig
.
draw_w
,
},
height
:
pageConfig
.
draw_h
get_base64_img
:
'false'
,
is_label
:
'false'
,
print
:
[
{
func
:
"PDSetAddImageMode"
,
iMode
:
pageConfig
.
Image_style_let
,
iValueThreshold
:
pageConfig
.
Image_Threshold
},
{
func
:
"PDDrawImage"
,
iX
:
pageConfig
.
Image_x
,
iY
:
pageConfig
.
Image_y
,
iWidth
:
pageConfig
.
Image_w
,
iHeight
:
pageConfig
.
Image_h
,
szImageFile
:
url
},
},
]
get_base64_img
:
'false'
,
}
is_label
:
'false'
,
on_link_device
(
pack
,
onBack
);
print
:
[
{
func
:
"PDSetAddImageMode"
,
iMode
:
pageConfig
.
Image_style_let
,
iValueThreshold
:
pageConfig
.
Image_Threshold
},
{
func
:
"PDDrawImage"
,
iX
:
pageConfig
.
Image_x
,
iY
:
pageConfig
.
Image_y
,
iWidth
:
pageConfig
.
Image_w
,
iHeight
:
pageConfig
.
Image_h
,
szImageFile
:
res
},
]
}
console
.
log
(
pack
)
on_link_device
(
pack
,
onBack
);
})
}
function
url2Base64
(
url
,
type
=
'image/jpeg'
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
img
=
new
Image
()
const
canvas
=
document
.
createElement
(
'canvas'
);
img
.
crossOrigin
=
'*'
;
img
.
onload
=
function
()
{
const
width
=
img
.
width
,
height
=
img
.
height
;
canvas
.
width
=
width
;
canvas
.
height
=
height
;
const
ctx
=
canvas
.
getContext
(
'2d'
);
ctx
.
fillStyle
=
'white'
;
ctx
.
fillRect
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
ctx
.
drawImage
(
img
,
0
,
0
,
width
,
height
);
const
base64
=
canvas
.
toDataURL
(
type
);
resolve
(
base64
);
};
img
.
onerror
=
function
()
{
reject
(
new
Error
(
'message'
));
};
img
.
src
=
url
;
});
}
}
function
on_link_device
(
pack
,
onBack
)
{
function
on_link_device
(
pack
,
onBack
)
{
...
...
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