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
0bb33a17
Commit
0bb33a17
authored
May 20, 2020
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
仓库接口完成
parent
8615453b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
172 additions
and
64 deletions
+172
-64
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/Model/WarehouseInterface.swift
GeliBusinessPlatform/Model/WarehouseInterface.swift
+3
-2
GeliBusinessPlatform/Model/WarehouseManageModel/ShopWarehouseDetailModel.swift
...Model/WarehouseManageModel/ShopWarehouseDetailModel.swift
+2
-1
GeliBusinessPlatform/View/AlertView/GLAlertSelectView.swift
GeliBusinessPlatform/View/AlertView/GLAlertSelectView.swift
+49
-20
GeliBusinessPlatform/View/Cell/KuWeiCell.swift
GeliBusinessPlatform/View/Cell/KuWeiCell.swift
+7
-3
GeliBusinessPlatform/View/Cell/KuWeiCell.xib
GeliBusinessPlatform/View/Cell/KuWeiCell.xib
+12
-1
GeliBusinessPlatform/ViewController/仓库管理/WarehoseMangementListVC.swift
...latform/ViewController/仓库管理/WarehoseMangementListVC.swift
+31
-13
GeliBusinessPlatform/ViewController/新增、编辑(查看)仓库/CheckWareHourseViewController.swift
...ontroller/新增、编辑(查看)仓库/CheckWareHourseViewController.swift
+68
-24
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
0bb33a17
No preview for this file type
GeliBusinessPlatform/Model/WarehouseInterface.swift
View file @
0bb33a17
...
...
@@ -70,6 +70,7 @@ func ShopWarehouseAdd(_ params:[String:Any],success:@escaping (_ res:Any)->(),fa
/*
user_token
w_name 仓库名称
w_id 仓库id
w_type 仓库类型,1常温、2冷藏、3冷冻
position_str 库位名,多库位用逗号拼接
w_address 仓库地址
...
...
@@ -82,7 +83,7 @@ is_default 是否默认,1是0非
warehouse_position 仓库库位信息,必须要有一个库位json字符串,字段见下表
*/
func
ShopWarehouseEdit
(
_
params
:[
String
:
Any
],
success
:
@escaping
(
_
res
:
Any
)
->
(),
failture
:
@escaping
(
_
error
:
Error
)
->
())
{
NetworkRequest
.
sharedInstance
.
postRequest
(
"商家仓库
删除
"
,
params
,
{
(
rep
:
DataResponse
<
UpDataModel
>
)
in
NetworkRequest
.
sharedInstance
.
postRequest
(
"商家仓库
修改
"
,
params
,
{
(
rep
:
DataResponse
<
UpDataModel
>
)
in
},
success
:
{
(
data
)
in
success
(
data
)
})
{
(
error
)
in
...
...
@@ -97,7 +98,7 @@ user_token
w_id 仓库id,仓库中有库存则不可删除
*/
func
ShopWarehouseDel
(
_
params
:[
String
:
Any
],
success
:
@escaping
(
_
res
:
Any
)
->
(),
failture
:
@escaping
(
_
error
:
Error
)
->
())
{
NetworkRequest
.
sharedInstance
.
postRequest
(
"商家仓库
修改
"
,
params
,
{
(
rep
:
DataResponse
<
UpDataModel
>
)
in
NetworkRequest
.
sharedInstance
.
postRequest
(
"商家仓库
删除
"
,
params
,
{
(
rep
:
DataResponse
<
UpDataModel
>
)
in
},
success
:
{
(
data
)
in
success
(
data
)
})
{
(
error
)
in
...
...
GeliBusinessPlatform/Model/WarehouseManageModel/ShopWarehouseDetailModel.swift
View file @
0bb33a17
...
...
@@ -81,7 +81,7 @@ class ShopWarehouseDetailDataPositionModel: Mappable {
var
p_name
:
String
?
//库位名
var
is_default
:
Int
?
//是否默认
var
inventory_count
:
Int
?
//库存数
var
status
:
Int
=
1
required
init
?(
map
:
Map
)
{
}
...
...
@@ -91,6 +91,7 @@ class ShopWarehouseDetailDataPositionModel: Mappable {
p_name
<-
map
[
"p_name"
]
is_default
<-
map
[
"is_default"
]
inventory_count
<-
map
[
"inventory_count"
]
status
<-
map
[
"status"
]
}
}
...
...
GeliBusinessPlatform/View/AlertView/GLAlertSelectView.swift
View file @
0bb33a17
...
...
@@ -24,7 +24,7 @@ import IQKeyboardManagerSwift
@objc
optional
func
KuWeiDataArr
(
sender
:
Array
<
Any
>
)
}
class
GLAlertSelectView
:
UIView
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndSelectCellDelegate
,
KuWeiCellCellDelegate
{
class
GLAlertSelectView
:
UIView
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndSelectCellDelegate
,
KuWeiCellCellDelegate
,
UITextFieldDelegate
{
var
isMultipleS
:
Bool
=
false
var
contentView
:
UIView
!
var
delegate
:
GLAlertSelectViewDelegate
?
...
...
@@ -138,9 +138,11 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
selectTbv
.
isScrollEnabled
=
false
ipdVHeight
.
constant
=
0.001
}
func
setKuWeiView
(){
IQKeyboardManager
.
shared
.
resignFirstResponder
()
selectTbv
.
register
(
UINib
(
nibName
:
"KuWeiCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"KuWei"
)
btmVHeight
.
constant
=
0
selectTbv
.
isScrollEnabled
=
true
...
...
@@ -172,13 +174,11 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"KuWei"
)
as!
KuWeiCell
cell
.
delegate
=
self
cell
.
tag
=
indexPath
.
row
cell
.
nameLbl
.
text
=
kuWeiArr
[
indexPath
.
row
]
as!
String
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
cell
.
countLbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
if
selectNum
==
indexPath
.
row
{
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"蓝色字体颜色"
)
cell
.
countLbl
.
textColor
=
UIColor
(
named
:
"蓝色字体颜色"
)
}
let
model
=
kuWeiArr
[
indexPath
.
row
]
as!
ShopWarehouseDetailDataPositionModel
print
(
"3"
,
model
.
p_name
)
cell
.
nameTF
.
text
=
model
.
p_name
cell
.
nameTF
.
delegate
=
self
cell
.
nameTF
.
isUserInteractionEnabled
=
false
return
cell
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"selectTbvCell"
)
as!
TitleAndSelectCell
...
...
@@ -212,7 +212,7 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
HUD
.
flash
(
.
label
(
"
\(
titleLbl
.
text
!
)
"
),
delay
:
1.2
)
return
}
delegate
?
.
GLAlertSelectViewClick
?(
selectNum
:
selectNum
!
,
view
:
self
)
}
else
{
if
selectArray
==
[
99
,
99
,
99
,
99
]
{
...
...
@@ -258,20 +258,48 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
}
}
}
print
(
"sele"
,
selectArray
,
cell
.
tag
)
selectTbv
.
reloadData
()
}
var
cellIdx
:
Int
?
var
tempName
:
String
=
""
//库位
func
editClickAction
(
sender
:
Int
)
{
print
(
sender
)
// delegate?.GLAlertSelectEditAction?(sender: sender)
func
editClickAction
(
sender
:
Int
,
cell
:
KuWeiCell
)
{
cell
.
nameTF
.
isUserInteractionEnabled
=
!
cell
.
nameTF
.
isUserInteractionEnabled
cell
.
isEditing
=
cell
.
nameTF
.
isUserInteractionEnabled
cellIdx
=
cell
.
tag
tempName
=
cell
.
nameTF
.
text
!
}
var
isDoneClick
=
false
func
textFieldShouldReturn
(
_
textField
:
UITextField
)
->
Bool
{
let
item
=
kuWeiArr
[
cellIdx
!
]
as!
ShopWarehouseDetailDataPositionModel
item
.
p_name
=
textField
.
text
item
.
status
=
2
isDoneClick
=
true
selectTbv
.
reloadData
()
return
true
}
func
textFieldDidEndEditing
(
_
textField
:
UITextField
)
{
let
item
=
kuWeiArr
[
cellIdx
!
]
as!
ShopWarehouseDetailDataPositionModel
if
isDoneClick
==
false
{
item
.
p_name
=
tempName
item
.
status
=
1
tempName
=
""
selectTbv
.
reloadData
()
}
isDoneClick
=
false
}
func
deleClickAction
(
sender
:
Int
)
{
print
(
sender
)
dataArr
.
remove
(
at
:
sender
)
print
(
dataArr
)
delegate
?
.
GLAlertSelectDelAction
?(
sender
:
dataArr
)
print
(
"sender == "
,
sender
)
if
(
titleLbl
.
text
?
.
contains
(
"库位"
))
!
{
kuWeiArr
.
remove
(
at
:
sender
)
delegate
?
.
GLAlertSelectDelAction
?(
sender
:
kuWeiArr
)
}
else
{
dataArr
.
remove
(
at
:
sender
)
delegate
?
.
GLAlertSelectDelAction
?(
sender
:
dataArr
)
}
selectTbv
.
reloadData
()
}
//MARK: - 库位输入界面
func
getInputView
()
->
UIView
{
...
...
@@ -375,7 +403,8 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
@objc
func
addKuWei
(){
IQKeyboardManager
.
shared
.
resignFirstResponder
()
if
(
inputTextTF
?
.
text
!.
count
)
!
>
0
{
kuWeiArr
.
append
(
inputTextTF
!.
text
!
)
let
kuWei
=
ShopWarehouseDetailDataPositionModel
(
JSON
:
[
"p_name"
:
inputTextTF
!.
text
!
,
"p_id"
:
0
,
"status"
:
4
])
kuWeiArr
.
append
(
kuWei
!
)
let
tbvH
=
CGFloat
(
kuWeiArr
.
count
)
*
49.0
self
.
btmVHeight
.
constant
=
146.5
+
tbvH
if
self
.
btmVHeight
.
constant
>
fullScreenHeight
*
0.75
{
...
...
GeliBusinessPlatform/View/Cell/KuWeiCell.swift
View file @
0bb33a17
...
...
@@ -8,16 +8,17 @@
import
UIKit
@objc
protocol
KuWeiCellCellDelegate
{
@objc
optional
func
editClickAction
(
sender
:
Int
)
@objc
optional
func
editClickAction
(
sender
:
Int
,
cell
:
KuWeiCell
)
@objc
optional
func
deleClickAction
(
sender
:
Int
)
}
class
KuWeiCell
:
UITableViewCell
{
@IBOutlet
weak
var
nameTF
:
UITextField
!
var
delegate
:
KuWeiCellCellDelegate
?
@IBOutlet
weak
var
nameLbl
:
UILabel
!
@IBOutlet
weak
var
countLbl
:
UILabel
!
@IBAction
func
editClick
(
_
sender
:
Int
)
{
delegate
?
.
editClickAction
?(
sender
:
Int
(
self
.
tag
))
delegate
?
.
editClickAction
?(
sender
:
Int
(
self
.
tag
)
,
cell
:
self
)
}
@IBAction
func
deleClick
(
_
sender
:
Int
)
{
...
...
@@ -26,10 +27,13 @@ class KuWeiCell: UITableViewCell {
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
self
.
selectionStyle
=
.
none
nameTF
.
returnKeyType
=
.
done
// Initialization code
}
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
super
.
setSelected
(
selected
,
animated
:
animated
)
...
...
GeliBusinessPlatform/View/Cell/KuWeiCell.xib
View file @
0bb33a17
...
...
@@ -26,7 +26,7 @@
<color
key=
"textColor"
name=
"标题字颜色"
/>
<nil
key=
"highlightedColor"
/>
</label>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"库位
"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"dMX-NM-Bar"
>
<label
hidden=
"YES"
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"
"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"dMX-NM-Bar"
>
<rect
key=
"frame"
x=
"20"
y=
"0.0"
width=
"95"
height=
"44"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"13"
/>
<color
key=
"textColor"
name=
"标题字颜色"
/>
...
...
@@ -73,8 +73,15 @@
<action
selector=
"editClick:"
destination=
"KGk-i7-Jjw"
eventType=
"touchUpInside"
id=
"c1C-hM-kig"
/>
</connections>
</button>
<textField
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"left"
contentVerticalAlignment=
"center"
minimumFontSize=
"17"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"tl8-dB-OUj"
>
<rect
key=
"frame"
x=
"15"
y=
"0.0"
width=
"110"
height=
"43"
/>
<color
key=
"textColor"
name=
"标题字颜色"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"13"
/>
<textInputTraits
key=
"textInputTraits"
/>
</textField>
</subviews>
<constraints>
<constraint
firstItem=
"nNe-LK-eKR"
firstAttribute=
"leading"
secondItem=
"tl8-dB-OUj"
secondAttribute=
"trailing"
id=
"1Sm-eg-zAW"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"rU2-NE-ybF"
secondAttribute=
"bottom"
id=
"8dH-3M-2TB"
/>
<constraint
firstItem=
"nNe-LK-eKR"
firstAttribute=
"top"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"top"
id=
"E12-W6-amI"
/>
<constraint
firstItem=
"HOv-8K-UgR"
firstAttribute=
"centerX"
secondItem=
"GVg-rI-poz"
secondAttribute=
"centerX"
id=
"FUI-Rz-1nR"
/>
...
...
@@ -82,10 +89,12 @@
<constraint
firstItem=
"HOv-8K-UgR"
firstAttribute=
"top"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"top"
id=
"Nmw-gT-RVZ"
/>
<constraint
firstItem=
"sXc-jH-lU6"
firstAttribute=
"top"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"top"
id=
"Qqs-p9-vbh"
/>
<constraint
firstItem=
"GVg-rI-poz"
firstAttribute=
"centerY"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"centerY"
id=
"Qyd-g3-MEK"
/>
<constraint
firstItem=
"rU2-NE-ybF"
firstAttribute=
"top"
secondItem=
"tl8-dB-OUj"
secondAttribute=
"bottom"
id=
"RWl-So-7x4"
/>
<constraint
firstItem=
"nNe-LK-eKR"
firstAttribute=
"leading"
secondItem=
"dMX-NM-Bar"
secondAttribute=
"trailing"
constant=
"10"
id=
"Rgg-mN-E4u"
/>
<constraint
firstItem=
"rU2-NE-ybF"
firstAttribute=
"top"
secondItem=
"sXc-jH-lU6"
secondAttribute=
"bottom"
id=
"TAW-eu-eZ6"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"nNe-LK-eKR"
secondAttribute=
"bottom"
id=
"VpX-UQ-pX4"
/>
<constraint
firstItem=
"dMX-NM-Bar"
firstAttribute=
"leading"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"leading"
constant=
"20"
id=
"WcJ-f8-2w9"
/>
<constraint
firstItem=
"tl8-dB-OUj"
firstAttribute=
"leading"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"leading"
constant=
"15"
id=
"ZR1-mn-7O1"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"dMX-NM-Bar"
secondAttribute=
"bottom"
id=
"ZTa-MJ-3OP"
/>
<constraint
firstItem=
"sXc-jH-lU6"
firstAttribute=
"centerX"
secondItem=
"0ef-kc-EYn"
secondAttribute=
"centerX"
id=
"eId-dd-z5X"
/>
<constraint
firstItem=
"0ef-kc-EYn"
firstAttribute=
"centerY"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"centerY"
id=
"i8O-Rr-rP6"
/>
...
...
@@ -93,6 +102,7 @@
<constraint
firstAttribute=
"trailing"
secondItem=
"GVg-rI-poz"
secondAttribute=
"trailing"
constant=
"37.5"
id=
"nwM-pw-OdK"
/>
<constraint
firstItem=
"rU2-NE-ybF"
firstAttribute=
"top"
secondItem=
"HOv-8K-UgR"
secondAttribute=
"bottom"
id=
"prA-cF-kvC"
/>
<constraint
firstItem=
"GVg-rI-poz"
firstAttribute=
"leading"
secondItem=
"0ef-kc-EYn"
secondAttribute=
"trailing"
constant=
"23"
id=
"r91-aY-NAQ"
/>
<constraint
firstItem=
"tl8-dB-OUj"
firstAttribute=
"top"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"top"
id=
"s2M-i4-tc4"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"rU2-NE-ybF"
secondAttribute=
"trailing"
id=
"tC8-DB-Znm"
/>
<constraint
firstItem=
"rU2-NE-ybF"
firstAttribute=
"leading"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"leading"
constant=
"15"
id=
"vyy-4j-gnH"
/>
</constraints>
...
...
@@ -101,6 +111,7 @@
<connections>
<outlet
property=
"countLbl"
destination=
"nNe-LK-eKR"
id=
"5zc-sz-Z3z"
/>
<outlet
property=
"nameLbl"
destination=
"dMX-NM-Bar"
id=
"D10-2X-OyL"
/>
<outlet
property=
"nameTF"
destination=
"tl8-dB-OUj"
id=
"1ho-nO-yh6"
/>
</connections>
<point
key=
"canvasLocation"
x=
"131.8840579710145"
y=
"122.54464285714285"
/>
</tableViewCell>
...
...
GeliBusinessPlatform/ViewController/仓库管理/WarehoseMangementListVC.swift
View file @
0bb33a17
...
...
@@ -10,8 +10,10 @@ import UIKit
import
ViewAnimator
import
SwipeCellKit
class
WarehoseMangementListVC
:
BaseViewController
,
UISearchBarDelegate
,
UITableViewDelegate
,
UITableViewDataSource
,
SearchBarViewDelegate
,
SwipeTableViewCellDelegate
{
class
WarehoseMangementListVC
:
BaseViewController
,
UISearchBarDelegate
,
UITableViewDelegate
,
UITableViewDataSource
,
SearchBarViewDelegate
,
SwipeTableViewCellDelegate
,
CheckWareHourseViewControllerDelegate
{
func
CheckWareHourseViewControllerRefresh
()
{
tableV
.
mj_header
?
.
beginRefreshing
()
}
weak
var
searchV
:
SearchBarView
?
=
nil
@IBOutlet
weak
var
contentView
:
UIView
!
@IBOutlet
weak
var
searchView
:
UIView
!
...
...
@@ -70,20 +72,25 @@ class WarehoseMangementListVC: BaseViewController, UISearchBarDelegate, UITableV
}
}
@objc
func
loadMoreData
(){
print
(
"加载更多数据"
)
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
let
dict
=
[
"user_token"
:
UserToken
as
Any
,
"keyword"
:
keyWord
,
"page"
:
page
]
warehouseList
(
dict
,
success
:
{
(
data
)
in
self
.
page
+=
1
let
dataModel
=
data
as!
ShopWarehouseListModel
dataModel
.
data
?
.
forEach
({
(
model
)
in
self
.
warehourseArr
.
append
(
model
)
})
self
.
tableV
.
reloadData
()
self
.
tableV
?
.
mj_header
?
.
endRefreshing
()
if
dataModel
.
data
!.
count
>
0
{
self
.
page
+=
1
dataModel
.
data
?
.
forEach
({
(
model
)
in
self
.
warehourseArr
.
append
(
model
)
})
self
.
tableV
.
reloadData
()
}
self
.
tableV
?
.
mj_footer
?
.
endRefreshing
()
})
{
(
error
)
in
self
.
tableV
?
.
mj_
head
er
?
.
endRefreshing
()
self
.
tableV
?
.
mj_
foot
er
?
.
endRefreshing
()
}
}
//MARK:--搜索按钮代理
...
...
@@ -142,6 +149,8 @@ class WarehoseMangementListVC: BaseViewController, UISearchBarDelegate, UITableV
}
let
vc
=
CheckWareHourseViewController
()
vc
.
titleStr
=
"新增仓库"
vc
.
delegate
=
self
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
false
)
}
...
...
@@ -174,9 +183,9 @@ class WarehoseMangementListVC: BaseViewController, UISearchBarDelegate, UITableV
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"WarehoseMangementCell"
)
as!
WarehoseMangementCell
cell
.
delegate
=
self
let
model
=
warehourseArr
[
indexPath
.
row
]
cell
.
nameLbl
.
text
=
model
.
w_name
cell
.
statusLbl
.
text
=
typeArr
[
model
.
w_type
!
-
1
]
let
model
=
warehourseArr
[
indexPath
.
row
]
cell
.
nameLbl
.
text
=
model
.
w_name
cell
.
statusLbl
.
text
=
typeArr
[
model
.
w_type
!
]
cell
.
adrLbl
.
text
=
model
.
w_address
!
cell
.
kuCunLbl
.
text
=
"
\(
model
.
inventory_count
!
)
"
return
cell
...
...
@@ -188,6 +197,7 @@ class WarehoseMangementListVC: BaseViewController, UISearchBarDelegate, UITableV
let
model
=
warehourseArr
[
indexPath
.
row
]
vc
.
w_id
=
model
.
w_id
vc
.
editIdx
=
indexPath
.
row
vc
.
delegate
=
self
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
false
)
}
...
...
@@ -211,7 +221,15 @@ class WarehoseMangementListVC: BaseViewController, UISearchBarDelegate, UITableV
let
deleteAction
=
SwipeAction
(
style
:
.
destructive
,
title
:
nil
)
{
action
,
indexPath
in
//将对应条目的数据删除
tableView
.
reloadData
()
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
let
model
=
self
.
warehourseArr
[
indexPath
.
row
]
ShopWarehouseDel
([
"user_token"
:
UserToken
,
"w_id"
:
model
.
w_id
],
success
:
{
(
data
)
in
self
.
warehourseArr
.
remove
(
at
:
indexPath
.
row
)
tableView
.
reloadData
()
})
{
(
error
)
in
}
}
deleteAction
.
image
=
UIImage
(
named
:
"shanchuWhite"
)
deleteAction
.
backgroundColor
=
UIColor
(
named
:
"#F57575"
)
...
...
GeliBusinessPlatform/ViewController/新增、编辑(查看)仓库/CheckWareHourseViewController.swift
View file @
0bb33a17
...
...
@@ -10,10 +10,12 @@ import UIKit
import
LGButton
import
IQKeyboardManagerSwift
protocol
CheckWareHourseViewControllerDelegate
{
func
CheckWareHourseViewControllerRefresh
()
}
class
CheckWareHourseViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
WareHouseSpCellDelegate
,
GLAlertSelectViewDelegate
,
UITextFieldDelegate
,
GeliAlertViewDelegate
{
var
delegate
:
CheckWareHourseViewControllerDelegate
?
var
dataModel
:
ShopWarehouseDetailModel
?
var
w_id
:
Int
?
//仓库id
var
editIdx
:
Int
?
...
...
@@ -23,7 +25,7 @@ class CheckWareHourseViewController: BaseViewController,UITableViewDelegate,UITa
let
titleArr
=
[
"仓库名称:"
,
"仓库类型:"
,
"包含库位:"
,
"仓库地址:"
,
"仓库容积:"
,
"仓库面积:"
,
"联系人:"
,
"联系人电话:"
]
let
placeHArr
=
[
"请输入仓库名称"
,
"请选择仓库类型"
,
"请输入库位名"
,
"请输入仓库地址"
,
"请输入仓库容积"
,
"请输入仓库面积"
,
"请输入联系人"
,
"请输入联系人电话"
]
var
kuWeiArr
:
Array
<
Any
>
?
=
[]
var
kuWeiArr
:
Array
<
ShopWarehouseDetailDataPositionModel
>
?
=
[]
var
listArray
=
[
"常温"
,
"冷藏"
,
"冷冻"
]
var
glSelectView
:
GLAlertSelectView
?
...
...
@@ -61,9 +63,11 @@ class CheckWareHourseViewController: BaseViewController,UITableViewDelegate,UITa
make
.
bottom
.
equalTo
(
btnTitleLbl
.
snp_top
)
}
loadData
()
}
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
// Do any additional setup after loading the view.
loadData
()
}
func
loadData
(){
//加载数据
...
...
@@ -71,7 +75,7 @@ class CheckWareHourseViewController: BaseViewController,UITableViewDelegate,UITa
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
WarehouseDetail
([
"user_token"
:
UserToken
as
Any
,
"w_id"
:
w_id
as
Any
],
success
:
{
(
data
)
in
let
dataModel
=
data
as!
ShopWarehouseDetailModel
// self.dataModel = dataModel
self
.
shiFouMoRen
=
false
if
dataModel
.
data
!.
warehouse_res
!.
is_default
!
==
1
{
self
.
shiFouMoRen
=
true
...
...
@@ -88,6 +92,7 @@ class CheckWareHourseViewController: BaseViewController,UITableViewDelegate,UITa
self
.
cangKuAdr
=
dataModel
.
data
!.
warehouse_res
!.
w_address
!
self
.
cangKuName
=
dataModel
.
data
!.
warehouse_res
!.
w_name
!
self
.
warehourseType
=
dataModel
.
data
!.
warehouse_res
!.
w_type
!
self
.
kuWeiArr
=
dataModel
.
data
?
.
position_res
self
.
listView
.
reloadData
()
})
{
(
error
)
in
...
...
@@ -111,7 +116,6 @@ class CheckWareHourseViewController: BaseViewController,UITableViewDelegate,UITa
switch
indexPath
.
row
{
case
0
:
cell
.
detailTF
.
text
=
cangKuName
break
case
1
:
cell
.
hiddenBtn
.
isHidden
=
false
...
...
@@ -120,6 +124,7 @@ class CheckWareHourseViewController: BaseViewController,UITableViewDelegate,UITa
}
break
case
2
:
cell
.
detailTF
.
isUserInteractionEnabled
=
false
cell
.
detailTF
.
text
=
kuWeiName
break
case
3
:
...
...
@@ -214,22 +219,40 @@ class CheckWareHourseViewController: BaseViewController,UITableViewDelegate,UITa
}
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
if
titleStr
==
"新增仓库"
{
let
dict
=
[
"user_token"
:
UserToken
,
"w_name"
:
cangKuName
,
"w_type"
:
warehourseType
,
"position_str"
:
kuWeiName
,
"w_address"
:
cangKuAdr
,
"volume"
:
rj
.
floatValue
,
"area"
:
mj
.
floatValue
,
"contact"
:
lianXiRen
,
"contact_number"
:
phone
,
"mail"
:
""
,
"is_default"
:
num
]
ShopWarehouseAdd
(
dict
,
success
:
{
(
data
)
in
self
.
delegate
!.
CheckWareHourseViewControllerRefresh
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
})
{
(
error
)
in
}
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
{
if
btnTitleLbl
.
text
==
"保存"
{
//
// ShopWarehouseEdit(["user_token":UserToken,"w_name":cangKuName,"w_type":warehourseType,"position_str":kuWeiName,"w_address":cangKuAdr,"volume":rj.floatValue,"area":mj.floatValue,"contact":lianXiRen,"contact_number":phone,"mail":"","is_default":num,"warehouse_position":""], success: { (data) in
//
// }) { (error) in
//
// }
// self.navigationController?.popViewController(animated: true)
var
dataArr
:
Array
<
Any
>
=
[]
kuWeiArr
?
.
forEach
({
(
md
)
in
var
data
:
Dictionary
<
String
,
Any
>
=
[:]
data
.
updateValue
(
md
.
p_name
,
forKey
:
"p_name"
)
data
.
updateValue
(
md
.
p_id
,
forKey
:
"p_id"
)
data
.
updateValue
(
md
.
status
,
forKey
:
"status"
)
dataArr
.
append
(
data
)
})
var
jsonStr
=
""
if
dataArr
.
count
>
0
{
jsonStr
=
dataChangeString
(
sender
:
dataArr
)
}
ShopWarehouseEdit
([
"user_token"
:
UserToken
,
"w_name"
:
cangKuName
,
"w_type"
:
warehourseType
,
"position_str"
:
kuWeiName
,
"w_id"
:
w_id
,
"w_address"
:
cangKuAdr
,
"volume"
:
rj
.
floatValue
,
"area"
:
mj
.
floatValue
,
"contact"
:
lianXiRen
,
"contact_number"
:
phone
,
"mail"
:
""
,
"is_default"
:
num
,
"warehouse_position"
:
jsonStr
],
success
:
{
(
data
)
in
self
.
delegate
?
.
CheckWareHourseViewControllerRefresh
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
})
{
(
error
)
in
}
}
else
{
btnTitleLbl
.
text
=
"保存"
statusStr
=
btnTitleLbl
.
text
!
listView
.
reloadData
()
}
listView
.
reloadData
()
}
}
...
...
@@ -262,16 +285,27 @@ class CheckWareHourseViewController: BaseViewController,UITableViewDelegate,UITa
self
.
view
.
window
?
.
addSubview
(
alertView
)
}
func
sureGeliAlertViewAction
(
sender
:
UIButton
)
{
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
ShopWarehouseDel
([
"user_token"
:
UserToken
,
"w_id"
:
w_id
],
success
:
{
(
data
)
in
self
.
delegate
?
.
CheckWareHourseViewControllerRefresh
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
})
{
(
Error
)
in
}
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
func
sureAction
(
sender
:
UIButton
)
{
print
(
"sureAction"
)
}
@objc
func
removeActin
(
sender
:
UIButton
){
sender
.
superview
?
.
removeFromSuperview
()
}
func
clickAction
(
sender
:
UIButton
)
{
IQKeyboardManager
.
shared
.
resignFirstResponder
()
if
sender
.
tag
==
1
{
...
...
@@ -406,15 +440,25 @@ class CheckWareHourseViewController: BaseViewController,UITableViewDelegate,UITa
IQKeyboardManager
.
shared
.
resignFirstResponder
()
}
func
KuWeiDataArr
(
sender
:
Array
<
Any
>
)
{
kuWeiArr
=
sender
print
(
sender
)
if
kuWeiArr
!.
count
>
0
{
if
(
titleStr
?
.
contains
(
"新增"
))
!
{
}
else
{
//编辑
if
(
titleStr
?
.
contains
(
"新增"
))
!
{
kuWeiArr
=
sender
as!
Array
<
ShopWarehouseDetailDataPositionModel
>
let
arr
=
NSMutableArray
()
for
item
in
kuWeiArr
!
{
arr
.
add
(
item
.
p_name
)
}
kuWeiName
=
arr
.
componentsJoined
(
by
:
","
)
listView
.
reloadData
()
}
else
{
//编辑
kuWeiArr
=
sender
as!
Array
<
ShopWarehouseDetailDataPositionModel
>
let
arr
=
NSMutableArray
()
for
item
in
kuWeiArr
!
{
print
(
"item == "
,
item
.
status
)
arr
.
add
(
item
.
p_name
)
}
kuWeiName
=
arr
.
componentsJoined
(
by
:
","
)
listView
.
reloadData
()
}
glSelectView
!.
removeFromSuperview
()
glSelectView
=
nil
}
...
...
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