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
55a52af1
authored
Jan 21, 2022
by
liangjianmin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
js
parent
b3022af1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
17 deletions
pages/home/index.vue
pages/tag/print.vue
util/base64gb2312.js
util/cpcl-exp.js
util/util.js
pages/home/index.vue
View file @
55a52af1
...
...
@@ -46,17 +46,16 @@
</template>
<
script
>
import
{
API
}
from
'@/util/api.js'
;
import
zyGrid
from
'../../components/zy-grid/zy-grid.vue'
;
import
{
API
}
from
'@/util/api.js'
;
import
zyGrid
from
'../../components/zy-grid/zy-grid.vue'
;
export
default
{
export
default
{
data
()
{
return
{
is_login
:
false
,
userInfo
:
{},
rawData
:
''
,
gridList
:
[
{
gridList
:
[{
name
:
'快递回单上传'
,
iconfont
:
'icon-a-juxing1'
,
tips
:
''
...
...
@@ -100,6 +99,7 @@ export default {
name
:
'补打标签'
,
iconfont
:
'icon-a-juxing4'
,
tips
:
''
}
]
};
...
...
@@ -173,9 +173,9 @@ export default {
components
:
{
zyGrid
}
};
};
</
script
>
<
style
scoped
lang=
"scss"
>
@import
'../../assets/css/home/index.scss'
;
@import
'../../assets/css/home/index.scss'
;
</
style
>
pages/tag/print.vue
View file @
55a52af1
...
...
@@ -35,11 +35,15 @@
</
template
>
<
script
>
import
{
API
}
from
'@/util/api.js'
;
import
{
API
}
from
'@/util/api.js'
;
import
{
getPlatform
}
from
'@/util/util.js'
const
ToBase64
=
require
(
'../../util/base64gb2312.js'
);
const
cpclExp
=
require
(
'../../util/cpcl-exp.js'
);
export
default
{
export
default
{
data
()
{
return
{
num
:
1
,
uuid
:
''
,
deviceId
:
''
,
characteristics
:
''
,
...
...
@@ -50,6 +54,8 @@ export default {
items_erp_order_sn_pre
:
[
'A单号'
,
'B单号'
,
'D单号'
],
items_print_type
:
[
'卡板'
,
'散箱'
],
traySelectOption
:
[],
sendData64
:
''
,
platform
:
'android'
,
form
:
{
erp_order_sn_pre
:
''
,
print_type
:
1
,
...
...
@@ -60,6 +66,7 @@ export default {
};
},
created
()
{
this
.
platform
=
getPlatform
();
this
.
getTraySelectOption
();
},
methods
:
{
...
...
@@ -76,6 +83,8 @@ export default {
this
.
form
.
tray_remark
=
this
.
traySelectOption
[
e
.
target
.
value
].
wstylt_id
;
},
submit
()
{
this
.
openBluetoothAdapter
();
return
false
;
if
(
!
this
.
form
.
erp_order_sn_pre
)
{
uni
.
showToast
({
icon
:
'error'
,
...
...
@@ -123,7 +132,7 @@ export default {
return
false
;
}
this
.
request
(
API
.
printLabel
,
'POST'
,
this
.
form
,
true
).
then
(
res
=>
{
this
.
request
(
API
.
printLabel
,
'POST'
,
this
.
form
,
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
openBluetoothAdapter
();
}
else
{
...
...
@@ -204,6 +213,47 @@ export default {
uni
.
hideLoading
();
that
.
characteristics
=
res
.
characteristics
[
0
].
uuid
;
console
.
log
(
'服务功能'
,
res
);
//包装数据
var
data
=
"! 0 200 200 450 1\r\n"
+
"T 8 0 10 10 入仓号:"
+
new
Date
().
getTime
()
+
"\r\n"
+
"T 8 0 10 56 箱号:01/20\r\n"
+
"T 8 0 10 96 时间:202201101627\r\n"
+
"T 8 0 10 142 仓库代码:HK01\r\n"
+
"B QR 290 10 M 2 U 10\r\n"
+
"MA,SB\r\n"
+
"ENDQR\r\n"
+
"PRINT\r\n"
;
var
arrayBuffer
=
uni
.
base64ToArrayBuffer
(
ToBase64
.
encode64gb2312
(
data
))
that
.
sendData64
=
arrayBuffer
;
that
.
writeBLECharacteristicValue
();
},
fail
:
res
=>
{
console
.
log
(
'失败'
,
res
);
}
});
},
writeBLECharacteristicValue
()
{
let
that
=
this
;
uni
.
writeBLECharacteristicValue
({
deviceId
:
that
.
deviceId
,
serviceId
:
that
.
uuid
,
characteristicId
:
that
.
characteristics
,
value
:
that
.
sendData64
,
success
(
res
)
{
console
.
log
(
'writeBLECharacteristicValue success'
,
res
.
errMsg
)
that
.
num
++
;
if
(
that
.
num
<
3
)
{
uni
.
closeBLEConnection
({
deviceId
:
that
.
deviceId
,
success
(
res
)
{
console
.
log
(
res
)
setTimeout
(
function
()
{
that
.
openBluetoothAdapter
();
},
1000
);
}
})
}
else
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'提交成功,打印中,请查看标签打印机'
,
...
...
@@ -212,16 +262,20 @@ export default {
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
console
.
log
(
'用户点击确定'
);
uni
.
closeBLEConnection
({
deviceId
:
that
.
deviceId
,
success
(
res
)
{
console
.
log
(
res
)
}
})
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
});
},
fail
:
res
=>
{
console
.
log
(
'失败'
,
res
);
}
});
}
})
},
change
(
index
,
type
)
{
if
(
type
==
'erp_order_sn_pre'
)
{
...
...
@@ -247,9 +301,9 @@ export default {
}
}
}
};
};
</
script
>
<
style
scoped
lang=
"scss"
>
@import
'../../assets/css/tag/print.scss'
;
@import
'../../assets/css/tag/print.scss'
;
</
style
>
util/base64gb2312.js
0 → 100644
View file @
55a52af1
This diff is collapsed.
Click to expand it.
util/cpcl-exp.js
0 → 100644
View file @
55a52af1
exports
.
val
=
"! 0 200 200 450 1\r\n"
+
"T 8 0 10 10 入仓号:B00001\r\n"
+
"T 8 0 10 56 箱号:01/20\r\n"
+
"T 8 0 10 96 时间:202201101627\r\n"
+
"T 8 0 10 142 仓库代码:HK01\r\n"
+
"B QR 290 10 M 2 U 10\r\n"
+
"MA,SB\r\n"
+
"ENDQR\r\n"
+
"PRINT\r\n"
;
util/util.js
View file @
55a52af1
...
...
@@ -40,6 +40,24 @@ const request = (url = '', type = 'GET', param = {}, Loading) => {
});
}
/**
* 平台判断
*/
const
getPlatform
=
()
=>
{
let
platform
=
uni
.
getSystemInfoSync
().
platform
if
(
platform
==
'ios'
)
{
platform
=
'ios'
;
}
else
if
(
platform
==
'android'
)
{
platform
=
'android'
;
}
return
platform
;
}
module
.
exports
=
{
request
request
,
getPlatform
}
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