Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GeliBusinessPlatform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljy
GeliBusinessPlatform
Commits
9cdffb8c
Commit
9cdffb8c
authored
May 13, 2021
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asdfasdfasdf23322323
parent
295ca6c3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
164 additions
and
67 deletions
+164
-67
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/ViewController/1.1入库&出库/出库/NewCKVc.swift
...BusinessPlatform/ViewController/1.1入库&出库/出库/NewCKVc.swift
+67
-54
GeliBusinessPlatform/ViewController/分销订单管理/RetailListMgVC.swift
...sinessPlatform/ViewController/分销订单管理/RetailListMgVC.swift
+74
-6
GeliBusinessPlatform/ViewController/分销订单管理/RetailManageViewController.swift
...rm/ViewController/分销订单管理/RetailManageViewController.swift
+2
-1
GeliBusinessPlatform/ViewController/分销订单管理/RetailManageViewController.xib
...form/ViewController/分销订单管理/RetailManageViewController.xib
+15
-5
GeliBusinessPlatform/ViewController/蓝牙连接/BtViewController.h
GeliBusinessPlatform/ViewController/蓝牙连接/BtViewController.h
+1
-0
GeliBusinessPlatform/ViewController/蓝牙连接/BtViewController.m
GeliBusinessPlatform/ViewController/蓝牙连接/BtViewController.m
+5
-1
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
9cdffb8c
No preview for this file type
GeliBusinessPlatform/ViewController/1.1入库&出库/出库/NewCKVc.swift
View file @
9cdffb8c
...
...
@@ -30,10 +30,17 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
}
let
printBG
=
UI
View
()
let
printBG
=
UI
Button
()
let
title_Lbl
=
UILabel
()
let
print_list
=
UITableView
()
var
printData
:
Array
<
Dictionary
<
String
,
Any
>>
=
[]
@objc
func
closeAction
(){
printData
.
removeAll
()
printIdx
=
0
title_Lbl
.
removeFromSuperview
()
print_list
.
removeFromSuperview
()
printBG
.
removeFromSuperview
()
}
func
Print_Gprinter_View_Print
(
data
:
Array
<
Dictionary
<
String
,
Any
>>
)
{
printData
.
removeAll
()
data
.
forEach
{
(
dict
)
in
...
...
@@ -43,6 +50,7 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
printBG
.
backgroundColor
=
UIColor
.
black
printBG
.
alpha
=
0.4
printBG
.
addTarget
(
self
,
action
:
#selector(
closeAction
)
,
for
:
.
touchUpInside
)
self
.
view
.
addSubview
(
printBG
)
printBG
.
snp
.
makeConstraints
{
(
make
)
in
make
.
top
.
left
.
right
.
bottom
.
equalToSuperview
()
...
...
@@ -71,23 +79,23 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
make
.
left
.
right
.
bottom
.
equalTo
(
0
)
make
.
top
.
equalTo
(
title_Lbl
.
snp_bottom
)
}
printData
(
idx
:
printIdx
)
}
var
wkWebView
:
WKWebView
?
func
printData
(
idx
:
Int
){
let
model
=
printData
[
idx
][
"goods_data"
]
as!
GetGoodBatchDataModel
//测试
//
let urlStr = "http://z.gelifood.com/static/url/label.html?goods_name=\(printData[idx]["goods_name"] as! String)&spec_str=\(printData[idx]["spec_str"] as! String)&batch_sn=\(model.batch_sn!)&batch_id=\(model.batch_id!)&iscs=1"
let
urlStr
=
"http://z.gelifood.com/static/url/label.html?goods_name=
\(
printData
[
idx
][
"goods_name"
]
as!
String
)
&spec_str=
\(
printData
[
idx
][
"spec_str"
]
as!
String
)
&batch_sn=
\(
model
.
batch_sn
!
)
&batch_id=
\(
model
.
batch_id
!
)
&iscs=1"
//online
let
urlStr
=
"http://zx.gelifood.com/static/url/label.html?goods_name=
\(
printData
[
idx
][
"goods_name"
]
as!
String
)
&spec_str=
\(
printData
[
idx
][
"spec_str"
]
as!
String
)
&batch_sn=
\(
model
.
batch_sn
!
)
&batch_id=
\(
model
.
batch_id
!
)
&iscs=0"
let
urlString
=
urlStr
.
addingPercentEncoding
(
withAllowedCharacters
:
.
urlQueryAllowed
)
!
let
url
=
URL
(
string
:
urlString
)
//
let urlStr = "http://zx.gelifood.com/static/url/label.html?goods_name=\(printData[idx]["goods_name"] as! String)&spec_str=\(printData[idx]["spec_str"] as! String)&batch_sn=\(model.batch_sn!)&batch_id=\(model.batch_id!)&iscs=0"
let
urlString
=
urlStr
.
addingPercentEncoding
(
withAllowedCharacters
:
.
urlQueryAllowed
)
!
let
url
=
URL
(
string
:
urlString
)
if
wkWebView
==
nil
{
wkWebView
=
WKWebView
()
}
let
request
=
URLRequest
.
init
(
url
:
url
!
,
cachePolicy
:
.
reloadRevalidatingCacheData
,
timeoutInterval
:
10
)
let
request
=
URLRequest
.
init
(
url
:
url
!
,
cachePolicy
:
.
reloadRevalidatingCacheData
,
timeoutInterval
:
10
)
wkWebView
!.
navigationDelegate
=
self
wkWebView
!.
load
(
request
)
wkWebView
!.
bounds
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
230
,
height
:
230*0.75
)
...
...
@@ -247,42 +255,42 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
var
goodsInfoArr
:
Array
<
Any
>
=
[]
@IBOutlet
weak
var
gm_view
:
UIView
!
//
// 页面加载完成之后调用
func
webView
(
_
webView
:
WKWebView
,
didFinish
navigation
:
WKNavigation
!
){
print
(
"页面加载完成..."
)
webView
.
takeScreenshotOfFullContent
{[
self
]
(
img
)
in
let
command
=
TscCommand
()
command
.
addSize
(
40
,
30
)
command
.
addGap
(
withM
:
2
,
withN
:
0
)
command
.
addReference
(
0
,
0
)
command
.
addTear
(
"ON"
)
command
.
addQueryPrinterStatus
(
Response
(
rawValue
:
1
)
!
)
command
.
addCls
()
command
.
addBitmapwithX
(
0
,
withY
:
0
,
withMode
:
0
,
withWidth
:
400
,
with
:
img
)
let
num
=
printData
[
printIdx
][
"print_counts"
]
as!
Int
command
.
addPrint
(
Int32
(
num
),
1
)
ConnecterManager
.
sharedInstance
()?
.
write
(
command
.
getCommand
(),
progress
:
{
(
total
,
part
)
in
let
cell
=
print_list
.
cellForRow
(
at
:
IndexPath
(
row
:
printIdx
,
section
:
0
))
as!
NewPrintItemCell
cell
.
progress
.
progress
=
Float
(
part
)
/
Float
(
total
)
if
Float
(
part
)
/
Float
(
total
)
==
1
{
printIdx
+=
1
if
printIdx
<=
printData
.
count
-
1
{
printData
(
idx
:
printIdx
)
print_list
.
reloadData
()
webView
.
removeFromSuperview
()
}
else
{
printIdx
=
0
title_Lbl
.
removeFromSuperview
()
print_list
.
removeFromSuperview
()
printBG
.
removeFromSuperview
()
}
//
// 页面加载完成之后调用
func
webView
(
_
webView
:
WKWebView
,
didFinish
navigation
:
WKNavigation
!
){
print
(
"页面加载完成..."
)
webView
.
takeScreenshotOfFullContent
{[
self
]
(
img
)
in
let
command
=
TscCommand
()
command
.
addSize
(
40
,
30
)
command
.
addGap
(
withM
:
2
,
withN
:
0
)
command
.
addReference
(
0
,
0
)
command
.
addTear
(
"ON"
)
command
.
addQueryPrinterStatus
(
Response
(
rawValue
:
1
)
!
)
command
.
addCls
()
command
.
addBitmapwithX
(
0
,
withY
:
0
,
withMode
:
0
,
withWidth
:
400
,
with
:
img
)
let
num
=
printData
[
printIdx
][
"print_counts"
]
as!
Int
command
.
addPrint
(
Int32
(
num
),
1
)
ConnecterManager
.
sharedInstance
()?
.
write
(
command
.
getCommand
(),
progress
:
{
(
total
,
part
)
in
let
cell
=
print_list
.
cellForRow
(
at
:
IndexPath
(
row
:
printIdx
,
section
:
0
))
as!
NewPrintItemCell
cell
.
progress
.
progress
=
Float
(
part
)
/
Float
(
total
)
if
Float
(
part
)
/
Float
(
total
)
==
1
{
printIdx
+=
1
if
printIdx
<=
printData
.
count
-
1
{
printData
(
idx
:
printIdx
)
print_list
.
reloadData
()
webView
.
removeFromSuperview
()
}
else
{
printIdx
=
0
title_Lbl
.
removeFromSuperview
()
print_list
.
removeFromSuperview
()
printBG
.
removeFromSuperview
()
}
}
)
}
}
}
)
}
}
@IBAction
func
ck_action
(
_
sender
:
UIButton
)
{
if
isGm
{
if
typeSelect
==
nil
{
...
...
@@ -349,14 +357,19 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
"goods_info"
:
dataChangeString
(
sender
:
goodsInfoArr
)
as
Any
]
let
appdelegate
=
UIApplication
.
shared
.
delegate
as!
AppDelegate
if
sender
.
tag
==
1
{
//打印
print
(
remark
)
print
(
"连接打印机"
)
let
vc
=
Print_Gprinter_View
(
frame
:
self
.
view
.
bounds
)
vc
.
delegate
=
self
vc
.
rkSelectArr
=
rkSelectArr
vc
.
piCiArr
=
piCiArr
self
.
view
.
addSubview
(
vc
)
if
appdelegate
.
blueToothVC
.
isLink
{
let
vc
=
Print_Gprinter_View
(
frame
:
self
.
view
.
bounds
)
vc
.
delegate
=
self
vc
.
rkSelectArr
=
rkSelectArr
vc
.
piCiArr
=
piCiArr
self
.
view
.
addSubview
(
vc
)
}
else
{
HUD
.
flash
(
.
label
(
"请连接打印机"
),
onView
:
self
.
view
,
delay
:
1.2
)
{
(
data
)
in
self
.
navigationController
?
.
pushViewController
(
appdelegate
.
blueToothVC
,
animated
:
true
)
}
}
}
else
{
HUD
.
show
(
.
progress
)
GoodsOutput
(
dict
,
success
:
{
(
data
)
in
...
...
@@ -464,7 +477,7 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
cell
.
btn
.
setTitleColor
(
UIColor
(
named
:
"#F57575"
),
for
:
.
normal
)
cell
.
btn
.
isUserInteractionEnabled
=
true
}
else
{
// cell.progress.progress = 1
// cell.progress.progress = 1
cell
.
status_lbl
.
isHidden
=
true
cell
.
btn
.
setTitle
(
"正在打印"
,
for
:
.
normal
)
cell
.
btn
.
isUserInteractionEnabled
=
false
...
...
@@ -640,10 +653,10 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
if
tableView
==
print_list
{
return
printData
.
count
}
else
{
if
section
==
0
{
return
titleArr
.
count
}
return
rkSelectArr
.
count
if
section
==
0
{
return
titleArr
.
count
}
return
rkSelectArr
.
count
}
}
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
...
...
GeliBusinessPlatform/ViewController/分销订单管理/RetailListMgVC.swift
View file @
9cdffb8c
...
...
@@ -14,12 +14,12 @@ class RetailListMgVC: BaseViewController,PagingViewControllerDelegate, UISearchB
@IBOutlet
weak
var
contentV
:
UIView
!
fileprivate
let
cities
=
[
"
我的分销
订单"
,
"
代销
订单"
"
分销价商品
订单"
,
"
供货价商品
订单"
]
let
viewControllers
=
[
RetailManageViewController
(
title
:
"
我的分销
订单"
),
RetailManageViewController
(
title
:
"
代销
订单"
)
RetailManageViewController
(
title
:
"
分销价商品
订单"
),
RetailManageViewController
(
title
:
"
供货价商品
订单"
)
]
//头部滚动视图
weak
var
pagingVC
:
PagingViewController
?
...
...
@@ -56,12 +56,51 @@ class RetailListMgVC: BaseViewController,PagingViewControllerDelegate, UISearchB
var
keyword
=
""
let
SearchBarContentV
=
UIView
()
var
btn_view
=
UIView
()
var
btn_line_view
=
UIView
()
func
initSearchBar
()
{
contentV
.
addSubview
(
btn_view
)
btn_view
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
right
.
equalToSuperview
()
make
.
top
.
equalTo
(
50
)
make
.
height
.
equalTo
(
40
)
}
contentV
.
addSubview
(
btn_line_view
)
let
titles
=
[
"全部"
,
"待付款"
,
"待发货"
,
"已收货"
,
"交易关闭"
]
for
i
in
0
..<
titles
.
count
{
let
btn
=
UIButton
()
btn_view
.
addSubview
(
btn
)
btn
.
tag
=
i
if
i
==
0
{
btn
.
isSelected
=
true
}
btn
.
setTitle
(
titles
[
i
],
for
:
.
normal
)
btn
.
setTitleColor
(
UIColor
.
black
,
for
:
.
normal
)
btn
.
setTitleColor
(
UIColor
(
named
:
"蓝色字体颜色"
),
for
:
.
selected
)
btn
.
titleLabel
?
.
font
=
UIFont
.
init
(
name
:
"PingFang SC"
,
size
:
14
)
btn
.
addTarget
(
self
,
action
:
#selector(
top_btn_click(btn:)
)
,
for
:
.
touchUpInside
)
btn
.
snp
.
makeConstraints
{
(
make
)
in
make
.
width
.
equalTo
(
ScreenWidth
*
0.2
)
make
.
height
.
equalTo
(
40
)
make
.
top
.
equalTo
(
0
)
make
.
left
.
equalTo
(
CGFloat
(
i
)
*
ScreenWidth
*
0.2
)
}
}
btn_line_view
.
backgroundColor
=
UIColor
(
named
:
"蓝色字体颜色"
)
btn_line_view
.
snp
.
makeConstraints
{
(
make
)
in
make
.
width
.
equalTo
(
ScreenWidth
*
0.2
*
0.33
)
make
.
height
.
equalTo
(
3
)
make
.
left
.
equalTo
(
ScreenWidth
*
0.2
*
0.33
)
make
.
bottom
.
equalTo
(
btn_view
.
snp_bottom
)
}
SearchBarContentV
.
backgroundColor
=
UIColor
.
white
contentV
.
addSubview
(
SearchBarContentV
)
SearchBarContentV
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
right
.
equalToSuperview
()
make
.
top
.
equalTo
(
5
0
)
make
.
top
.
equalTo
(
9
0
)
make
.
height
.
equalTo
(
45
)
}
let
searchBr
=
SearchBarView
.
init
()
...
...
@@ -77,6 +116,35 @@ class RetailListMgVC: BaseViewController,PagingViewControllerDelegate, UISearchB
searchBr
.
delegate
=
self
searchBr
.
delegateL
=
self
}
@objc
func
top_btn_click
(
btn
:
UIButton
){
btn_view
.
subviews
.
forEach
{
(
item
)
in
if
item
.
isKind
(
of
:
UIButton
.
self
)
{
let
button
=
item
as!
UIButton
if
btn
.
tag
==
button
.
tag
{
button
.
isSelected
=
true
let
idx
=
CGFloat
(
button
.
tag
)
let
x
=
ScreenWidth
*
0.2
*
0.33
let
offset
=
idx
*
CGFloat
(
ScreenWidth
)
*
0.2
btn_line_view
.
snp
.
updateConstraints
{
(
make
)
in
make
.
width
.
equalTo
(
ScreenWidth
*
0.2
*
0.33
)
make
.
height
.
equalTo
(
3
)
make
.
left
.
equalTo
(
x
+
offset
)
make
.
bottom
.
equalTo
(
btn_view
.
snp_bottom
)
}
viewControllers
.
forEach
{
(
vc
)
in
vc
.
order_status
=
button
.
tag
vc
.
isUpData
=
false
}
let
vc
=
viewControllers
[
selectIndex
]
vc
.
listView
.
mj_header
?
.
beginRefreshing
()
}
else
{
button
.
isSelected
=
false
}
}
}
}
func
clearSearchAction
()
{
}
...
...
@@ -130,7 +198,7 @@ class RetailListMgVC: BaseViewController,PagingViewControllerDelegate, UISearchB
}
//MARK:--HeaderSelectView
let
changeBgView
=
UIView
()
weak
var
selectV
:
HeaderSelectView
!
=
nil
var
showSelectvIndex
=
0
var
selectIndexArr
=
[
0
,
0
,
0
]
...
...
GeliBusinessPlatform/ViewController/分销订单管理/RetailManageViewController.swift
View file @
9cdffb8c
...
...
@@ -9,7 +9,8 @@
import
UIKit
class
RetailManageViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
RetailManageFooterViewDelagte
,
GeliAlertViewDelegate
{
var
order_status
=
0
var
page
:
Int
=
0
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
var
startTime
:
Int
?
=
0
...
...
GeliBusinessPlatform/ViewController/分销订单管理/RetailManageViewController.xib
View file @
9cdffb8c
...
...
@@ -24,39 +24,49 @@
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"9De-Db-9oa"
>
<rect
key=
"frame"
x=
"0.0"
y=
"
4
4"
width=
"414"
height=
"50"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"
8
4"
width=
"414"
height=
"50"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"50"
id=
"Ypr-rF-zvE"
/>
</constraints>
</view>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Dne-dW-uPU"
>
<rect
key=
"frame"
x=
"0.0"
y=
"
9
4"
width=
"414"
height=
"45"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"
13
4"
width=
"414"
height=
"45"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"45"
id=
"6Ma-LE-6Vg"
/>
</constraints>
</view>
<tableView
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
alwaysBounceVertical=
"YES"
showsHorizontalScrollIndicator=
"NO"
showsVerticalScrollIndicator=
"NO"
style=
"grouped"
separatorStyle=
"default"
rowHeight=
"-1"
estimatedRowHeight=
"-1"
sectionHeaderHeight=
"18"
sectionFooterHeight=
"18"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"rD1-9Z-Grg"
>
<rect
key=
"frame"
x=
"0.0"
y=
"1
39"
width=
"414"
height=
"75
7"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"1
79"
width=
"414"
height=
"71
7"
/>
<color
key=
"backgroundColor"
name=
"app底色"
/>
</tableView>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"iug-aS-oaH"
userLabel=
"topView"
>
<rect
key=
"frame"
x=
"0.0"
y=
"44"
width=
"414"
height=
"40"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"40"
id=
"yzo-Cy-25E"
/>
</constraints>
</view>
</subviews>
<viewLayoutGuide
key=
"safeArea"
id=
"fnl-2z-Ty3"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<constraints>
<constraint
firstItem=
"9De-Db-9oa"
firstAttribute=
"top"
secondItem=
"
fnl-2z-Ty3"
secondAttribute=
"top
"
id=
"6Zw-tb-D5v"
/>
<constraint
firstItem=
"9De-Db-9oa"
firstAttribute=
"top"
secondItem=
"
iug-aS-oaH"
secondAttribute=
"bottom
"
id=
"6Zw-tb-D5v"
/>
<constraint
firstItem=
"fnl-2z-Ty3"
firstAttribute=
"trailing"
secondItem=
"rD1-9Z-Grg"
secondAttribute=
"trailing"
id=
"I3i-6b-ylF"
/>
<constraint
firstItem=
"9De-Db-9oa"
firstAttribute=
"leading"
secondItem=
"fnl-2z-Ty3"
secondAttribute=
"leading"
id=
"IMa-9D-pY4"
/>
<constraint
firstItem=
"Dne-dW-uPU"
firstAttribute=
"leading"
secondItem=
"i5M-Pr-FkT"
secondAttribute=
"leading"
id=
"RTk-rs-WuV"
/>
<constraint
firstItem=
"iug-aS-oaH"
firstAttribute=
"leading"
secondItem=
"fnl-2z-Ty3"
secondAttribute=
"leading"
id=
"VvU-oF-agO"
/>
<constraint
firstItem=
"fnl-2z-Ty3"
firstAttribute=
"trailing"
secondItem=
"iug-aS-oaH"
secondAttribute=
"trailing"
id=
"ZGC-v1-LXH"
/>
<constraint
firstItem=
"rD1-9Z-Grg"
firstAttribute=
"leading"
secondItem=
"fnl-2z-Ty3"
secondAttribute=
"leading"
id=
"aEw-6L-Zh2"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"rD1-9Z-Grg"
secondAttribute=
"bottom"
id=
"eeT-2r-TnA"
/>
<constraint
firstItem=
"fnl-2z-Ty3"
firstAttribute=
"trailing"
secondItem=
"Dne-dW-uPU"
secondAttribute=
"trailing"
id=
"iCd-pX-M1p"
/>
<constraint
firstItem=
"fnl-2z-Ty3"
firstAttribute=
"trailing"
secondItem=
"9De-Db-9oa"
secondAttribute=
"trailing"
id=
"iEb-Y0-FwM"
/>
<constraint
firstItem=
"iug-aS-oaH"
firstAttribute=
"top"
secondItem=
"fnl-2z-Ty3"
secondAttribute=
"top"
id=
"lii-zd-KXr"
/>
<constraint
firstItem=
"rD1-9Z-Grg"
firstAttribute=
"top"
secondItem=
"Dne-dW-uPU"
secondAttribute=
"bottom"
id=
"vjO-k6-gBs"
/>
<constraint
firstItem=
"Dne-dW-uPU"
firstAttribute=
"top"
secondItem=
"9De-Db-9oa"
secondAttribute=
"bottom"
id=
"xzt-pE-zLt"
/>
</constraints>
<point
key=
"canvasLocation"
x=
"-586
"
y=
"-21
"
/>
<point
key=
"canvasLocation"
x=
"-586
.95652173913049"
y=
"-21.428571428571427
"
/>
</view>
</objects>
<resources>
...
...
GeliBusinessPlatform/ViewController/蓝牙连接/BtViewController.h
View file @
9cdffb8c
...
...
@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface
BtViewController
:
UIViewController
@property
(
nonatomic
,
copy
)
ConnectDeviceState
state
;
@property
(
nonatomic
,
assign
)
BOOL
isLink
;
@end
NS_ASSUME_NONNULL_END
GeliBusinessPlatform/ViewController/蓝牙连接/BtViewController.m
View file @
9cdffb8c
...
...
@@ -45,7 +45,7 @@
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
_isLink
=
NO
;
// Do any additional setup after loading the view from its nib.
if
(
!
_selectArray
)
{
_selectArray
=
[
NSMutableArray
array
];
...
...
@@ -68,6 +68,7 @@
break
;
case
CBCentralManagerStatePoweredOff
:
NSLog
(
@"Bluetooth is currently powered off."
);
[
SVProgressHUD
showErrorWithStatus
:
@"请打开蓝牙"
];
break
;
case
CBCentralManagerStatePoweredOn
:
[
self
startScane
];
...
...
@@ -128,7 +129,9 @@
CBPeripheral
*
peripheral
=
[
self
.
dicts
objectForKey
:[
self
.
dicts
allKeys
][
indexPath
.
row
]];
[
self
connectDevice
:
peripheral
];
}
else
{
_isLink
=
NO
;
[
SVProgressHUD
showErrorWithStatus
:
@"断开连接"
];
[
self
startScane
];
}
...
...
@@ -143,6 +146,7 @@
[
_tableView
reloadData
];
}
[
SVProgressHUD
showSuccessWithStatus
:
@"连接成功"
];
_isLink
=
YES
;
}
if
(
state
==
5
){
[
SVProgressHUD
showErrorWithStatus
:
@"连接失败"
];
...
...
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