Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
梁建民
/
wmsMin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8aa09097
authored
2 years ago
by
liangjianmin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
bug
parent
92718ac9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
31 deletions
pages/mine/login.vue
pages/tag/print.vue
pages/tag/repairPrint.vue
pages/mine/login.vue
View file @
8aa09097
...
...
@@ -23,8 +23,8 @@ import { API } from '@/util/api.js';
export
default
{
data
()
{
return
{
account
:
'
admin@ichunt.com
'
,
passwd
:
'
123456789
'
account
:
''
,
passwd
:
''
};
},
onLoad
(
options
)
{},
...
...
This diff is collapsed.
Click to expand it.
pages/tag/print.vue
View file @
8aa09097
...
...
@@ -219,7 +219,7 @@ export default {
data
.
push
(
'T 8 0 10 220 仓库代码:'
+
this
.
printLabelData
[
this
.
print_number
].
warehouse_code
+
'\r\n'
);
data
.
push
(
'T 8 0 10 260 流水号:'
+
this
.
printLabelData
[
this
.
print_number
].
wstyptll_id_sn
+
'\r\n'
);
data
.
push
(
'B QR 280 110 M 2 U 8\r\n'
);
data
.
push
(
'MA,'
+
this
.
printLabelData
[
this
.
print_number
][
'
box_code
'
]
+
'|\r\n'
);
data
.
push
(
'MA,'
+
this
.
printLabelData
[
this
.
print_number
][
'
erp_order_sn
'
]
+
'|\r\n'
);
data
.
push
(
'ENDQR\r\n'
);
data
.
push
(
'FORM\r\n'
);
data
.
push
(
'PRINT\r\n'
);
...
...
This diff is collapsed.
Click to expand it.
pages/tag/repairPrint.vue
View file @
8aa09097
...
...
@@ -64,6 +64,8 @@ export default {
};
},
onLoad
(
option
)
{
this
.
platform
=
getPlatform
();
//停止搜索,节省系统资源
uni
.
stopBluetoothDevicesDiscovery
({
success
:
res
=>
{
...
...
@@ -187,7 +189,7 @@ export default {
uni
.
showLoading
({
title
:
'打印中...'
});
console
.
log
(
'第'
+
this
.
print_number
+
'次
打印
'
);
console
.
log
(
'第'
+
this
.
print_number
+
'次
开始打印start...
'
);
let
data
=
[];
if
(
this
.
printLabelData
.
length
>
0
)
{
data
.
push
(
'! 60 200 200 300 1\r\n'
);
...
...
@@ -204,15 +206,13 @@ export default {
data
.
push
(
'T 8 0 10 220 仓库代码:'
+
this
.
printLabelData
[
this
.
print_number
].
warehouse_code
+
'\r\n'
);
data
.
push
(
'T 8 0 10 260 流水号:'
+
this
.
printLabelData
[
this
.
print_number
].
wstyptll_id_sn
+
'\r\n'
);
data
.
push
(
'B QR 280 110 M 2 U 8\r\n'
);
data
.
push
(
'MA,'
+
this
.
printLabelData
[
this
.
print_number
].
box_code
+
'|\r\n'
);
data
.
push
(
'MA,'
+
this
.
printLabelData
[
this
.
print_number
].
erp_order_sn
+
'|\r\n'
);
data
.
push
(
'ENDQR\r\n'
);
data
.
push
(
'FORM\r\n'
);
data
.
push
(
'PRINT\r\n'
);
}
let
arrayBuffer
=
uni
.
base64ToArrayBuffer
(
ToBase64
.
encode64gb2312
(
data
.
join
(
''
)));
this
.
sendData64
=
arrayBuffer
;
this
.
writeBLECharacteristicValue
();
console
.
log
(
data
.
join
(
''
));
this
.
cutCommand
(
data
.
join
(
''
));
}
catch
(
e
)
{
uni
.
hideLoading
();
uni
.
showModal
({
...
...
@@ -224,57 +224,78 @@ export default {
}
},
/**
* 分批传输数据
*/
cutCommand
:
function
(
data
)
{
var
packageLength
=
15
;
//安卓不超过20个字节传输
var
sendData64
=
[];
if
(
this
.
platform
==
'ios'
)
{
packageLength
=
40
;
}
console
.
log
(
'package长度:'
+
packageLength
);
for
(
let
i
=
0
;
i
<
Math
.
ceil
(
data
.
length
/
packageLength
);
i
++
)
{
sendData64
[
i
]
=
uni
.
base64ToArrayBuffer
(
ToBase64
.
encode64gb2312
(
data
.
substr
(
i
*
packageLength
,
packageLength
)));
}
this
.
sendData64
=
sendData64
;
console
.
log
(
sendData64
);
this
.
writeBLECharacteristicValue
(
1
);
},
/**
* 写入二进制数据
*/
writeBLECharacteristicValue
()
{
let
that
=
this
;
uni
.
writeBLECharacteristicValue
({
deviceId
:
this
.
deviceId
,
serviceId
:
this
.
serviceId
,
characteristicId
:
this
.
characteristics
,
value
:
this
.
sendData64
,
success
:
res
=>
{
this
.
print_number
++
;
console
.
log
(
'打印张数:'
+
this
.
print_number
);
if
(
this
.
print_number
<
this
.
printLabelData
.
length
)
{
this
.
sendDataChange
();
}
else
{
writeBLECharacteristicValue
(
times
)
{
var
sendData64
=
this
.
sendData64
;
if
(
sendData64
.
length
>=
times
)
{
uni
.
writeBLECharacteristicValue
({
deviceId
:
this
.
deviceId
,
serviceId
:
this
.
serviceId
,
characteristicId
:
this
.
characteristics
,
value
:
sendData64
[
times
-
1
],
success
:
res
=>
{
this
.
writeBLECharacteristicValue
(
++
times
);
},
fail
()
{
uni
.
hideLoading
();
//清空数据
that
.
print_number
=
0
;
that
.
printLabelData
=
[];
that
.
sendData64
=
''
;
uni
.
showModal
({
title
:
'提示'
,
content
:
'打印
成功,请查看标签
打印机'
,
content
:
'打印
失败,请检查
打印机'
,
showCancel
:
false
,
confirmText
:
'关闭'
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
console
.
log
(
'用户点击确定'
);
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
});
}
},
fail
()
{
});
}
else
{
this
.
print_number
++
;
console
.
log
(
'第'
+
this
.
print_number
+
'次传输完成end'
);
if
(
this
.
print_number
<
this
.
printLabelData
.
length
)
{
this
.
sendDataChange
();
}
else
{
uni
.
hideLoading
();
//清空数据
this
.
print_number
=
0
;
this
.
printLabelData
=
[];
this
.
sendData64
=
''
;
uni
.
showModal
({
title
:
'提示'
,
content
:
'打印
失败,请检查
打印机'
,
content
:
'打印
成功,请查看标签
打印机'
,
showCancel
:
false
,
confirmText
:
'关闭'
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
console
.
log
(
'用户点击确定'
);
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
});
}
}
);
}
},
change
(
index
,
type
)
{
if
(
type
==
'erp_order_sn_pre'
)
{
...
...
This diff is collapsed.
Click to expand it.
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