Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
Project
Project
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
张杰
xffruit
Commits
b94eefca
Commit
b94eefca
authored
Aug 29, 2015
by
freecui
Browse files
Options
Browse Files
Download
Plain Diff
merge 首页
parents
182b65ff
c21d80e7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
1589 additions
and
134 deletions
+1589
-134
project.pbxproj
XFFruit.xcodeproj/project.pbxproj
+30
-0
ICRDataBaseController.m
...it/Controllers/DataBaseController/ICRDataBaseController.m
+2
-1
ICRHTTPController.h
XFFruit/Controllers/HTTPController/ICRHTTPController.h
+5
-1
ICRHTTPController.m
XFFruit/Controllers/HTTPController/ICRHTTPController.m
+59
-8
BusinessViewController.m
XFFruit/ViewControllers/Business/BusinessViewController.m
+2
-2
AddProductViewController.h
...ntrollers/Purchase/Controllers/AddProductViewController.h
+32
-0
AddProductViewController.m
...ntrollers/Purchase/Controllers/AddProductViewController.m
+284
-0
ChooseTypeViewController.h
...ntrollers/Purchase/Controllers/ChooseTypeViewController.h
+15
-0
ChooseTypeViewController.m
...ntrollers/Purchase/Controllers/ChooseTypeViewController.m
+144
-0
ChooseVendorViewController.m
...rollers/Purchase/Controllers/ChooseVendorViewController.m
+18
-24
ChooseWarehouseViewController.h
...lers/Purchase/Controllers/ChooseWarehouseViewController.h
+15
-0
ChooseWarehouseViewController.m
...lers/Purchase/Controllers/ChooseWarehouseViewController.m
+194
-0
NewPurchaseViewController.m
...trollers/Purchase/Controllers/NewPurchaseViewController.m
+20
-4
ProductViewController.h
...wControllers/Purchase/Controllers/ProductViewController.h
+6
-1
ProductViewController.m
...wControllers/Purchase/Controllers/ProductViewController.m
+40
-8
PurchaseDetailViewController.h
...llers/Purchase/Controllers/PurchaseDetailViewController.h
+2
-0
PurchaseDetailViewController.m
...llers/Purchase/Controllers/PurchaseDetailViewController.m
+125
-40
PurchaseViewController.m
...Controllers/Purchase/Controllers/PurchaseViewController.m
+172
-6
PurchaseBill.h
XFFruit/ViewControllers/Purchase/Models/PurchaseBill.h
+1
-2
Vendor.h
XFFruit/ViewControllers/Purchase/Models/Vendor.h
+1
-1
Warehouse.h
XFFruit/ViewControllers/Purchase/Models/Warehouse.h
+16
-0
Warehouse.m
XFFruit/ViewControllers/Purchase/Models/Warehouse.m
+19
-0
ProductCell.m
XFFruit/ViewControllers/Purchase/Views/ProductCell.m
+2
-2
PurchaseBoltView.h
XFFruit/ViewControllers/Purchase/Views/PurchaseBoltView.h
+28
-0
PurchaseBoltView.m
XFFruit/ViewControllers/Purchase/Views/PurchaseBoltView.m
+283
-0
TopPurchaseView.h
XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.h
+2
-1
TopPurchaseView.m
XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.m
+49
-8
BoltMaskView.m
XFFruit/ViewControllers/Survey/Views/BoltMaskView.m
+2
-2
SortMaskView.m
XFFruit/ViewControllers/Survey/Views/SortMaskView.m
+1
-1
NewSurveyViewController.m
...wControllers/Survey/controllers/NewSurveyViewController.m
+14
-16
SurveyViewController.m
...ViewControllers/Survey/controllers/SurveyViewController.m
+0
-4
HeaderCell.m
XFFruit/ViewControllers/WorkSheet/Views/HeaderCell.m
+1
-1
Localizable.strings
XFFruit/en.lproj/Localizable.strings
+2
-0
Localizable.strings
XFFruit/zh-Hans.lproj/Localizable.strings
+3
-1
No files found.
XFFruit.xcodeproj/project.pbxproj
View file @
b94eefca
This diff is collapsed.
Click to expand it.
XFFruit/Controllers/DataBaseController/ICRDataBaseController.m
View file @
b94eefca
...
...
@@ -24,6 +24,7 @@
#import "User.h"
#import "Survey.h"
#import "Vendor.h"
#import "Warehouse.h"
#define ICR_DB_ERROR_PARAMETER @"Parse Error: Bad Parameter(s)"
...
...
@@ -95,7 +96,7 @@ static NSString *ICRDataBasePath = @"";
[
_m_dbQueue
inDatabase
:
^
(
FMDatabase
*
db
)
{
NSArray
*
tableNameArr
=
@[
[
Product
class
],[
User
class
],[
Survey
class
],[
Vendor
class
]];
@[
[
Product
class
],[
User
class
],[
Survey
class
],[
Vendor
class
]
,[
Warehouse
class
]
];
NSMutableArray
*
sqlBatch
=
[
NSMutableArray
array
];
NSString
*
sql
=
nil
;
...
...
XFFruit/Controllers/HTTPController/ICRHTTPController.h
View file @
b94eefca
...
...
@@ -225,7 +225,11 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
page_size
:(
NSUInteger
)
page_size
success
:(
void
(
^
)(
id
))
succ
failure
:(
void
(
^
)(
id
))
fail
;
//仓库
-
(
void
)
getWarehouseWithPage_number
:(
NSUInteger
)
page_number
page_size
:(
NSUInteger
)
page_size
success
:(
void
(
^
)(
id
))
succ
failure
:(
void
(
^
)(
id
))
fail
;
@end
XFFruit/Controllers/HTTPController/ICRHTTPController.m
View file @
b94eefca
...
...
@@ -77,7 +77,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
XFFHttp_ResultChart
,
XFFHttp_GetResults
,
//供应商
XFFHttp_GetVendor
XFFHttp_GetVendor
,
//仓库
XFFHttp_GetWarehouse
};
static
NSString
*
const
ICRHTTPInterface
[]
=
{
...
...
@@ -127,14 +129,18 @@ static NSString * const ICRHTTPInterface[] = {
//行情调研
[
XFFHttp_SurveySave
]
=
@"survey/save_survey"
,
[
XFFHttp_QuerySurvey
]
=
@"survey/query_survey"
,
[
XFFHttp_GetSurvey
]
=
@"survey/get_survey"
,
[
XFFHttp_GetSurvey
]
=
@"survey/get_survey"
,
[
XFFHttp_GetProduct
]
=
@"mdata/product/download"
,
[
XFFHttp_GetUser
]
=
@"user/download"
,
[
XFFHttp_SurveyFinish
]
=
@"survey/finish"
,
//行情反馈生成图片
[
XFFHttp_ResultChart
]
=
@"survey/resultchart"
,
[
XFFHttp_GetResults
]
=
@"survey/get_results"
,
[
XFFHttp_GetVendor
]
=
@"mdata/vendor/download"
[
XFFHttp_GetResults
]
=
@"survey/get_results"
,
//供应商
[
XFFHttp_GetVendor
]
=
@"data/vendor/download"
,
//仓库
[
XFFHttp_GetWarehouse
]
=
@"data/warehouse/download"
,
};
static
NSString
*
const
ICRAttachmentTypeValue
[]
=
{
...
...
@@ -1643,16 +1649,61 @@ acceptTypeJson:YES
fail
(
error
);
}
};
NSString
*
urlStr
=
[[[
self
class
]
UrlForPluginHTTPAction
:
XFFHttp_GetVendor
]
stringByAppendingFormat
:
@"?start
_date=%@&page_number=%@&page_size=%@"
,
[[
NSDate
date
]
httpParameterString
]
,
@
(
page_number
),
@
(
page_size
)];
NSString
*
dateStr
=
@"2015-05-04"
;
NSString
*
urlStr
=
[[[
self
class
]
UrlForPluginHTTPAction
:
XFFHttp_GetVendor
]
stringByAppendingFormat
:
@"?start
Date=%@&pageNumber=%@&pageSize=%@"
,
dateStr
,
@
(
page_number
),
@
(
page_size
)];
NSString
*
encodeUrlStr
=
[
urlStr
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
[
self
POST
:
encodeUrlStr
[
self
GET
:
encodeUrlStr
parameters
:
NULL
needToken
:
NO
acceptTypeJson
:
YES
success
:
success
failure
:
failure
];
}
//仓库
-
(
void
)
getWarehouseWithPage_number
:
(
NSUInteger
)
page_number
page_size
:
(
NSUInteger
)
page_size
success
:
(
void
(
^
)(
id
))
succ
failure
:
(
void
(
^
)(
id
))
fail
{
void
(
^
success
)(
AFHTTPRequestOperation
*
operation
,
id
responseObject
)
=
^
(
AFHTTPRequestOperation
*
operation
,
id
responseObject
)
{
CLog
(
@"%@"
,
responseObject
);
if
(
IsDictObject
(
responseObject
))
{
void
(
^
complete
)(
void
)
=
^
(
void
){
if
(
succ
)
{
[
IBTCommon
runOnMainThreadWithoutDeadlocking
:
^
{
succ
(
responseObject
);
}];
}
};
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
[
dbCtrl
storageEntities
:
responseObject
[
@"data"
][
@"records"
]
objectClass
:
NSClassFromString
(
@"Warehouse"
)
deleteLocal
:
YES
handleData
:
NULL
complete
:
complete
fail
:
fail
];
}
else
{
if
(
fail
)
{
fail
(
nil
);
}
}
};
void
(
^
failure
)(
AFHTTPRequestOperation
*
operation
,
NSError
*
error
)
=
^
(
AFHTTPRequestOperation
*
operation
,
NSError
*
error
)
{
CLog
(
@"%@"
,
error
);
if
(
fail
)
{
fail
(
error
);
}
};
NSString
*
dateStr
=
@"2015-05-04"
;
NSString
*
urlStr
=
[[[
self
class
]
UrlForPluginHTTPAction
:
XFFHttp_GetWarehouse
]
stringByAppendingFormat
:
@"?startDate=%@&pageNumber=%@&pageSize=%@"
,
dateStr
,
@
(
page_number
),
@
(
page_size
)];
NSString
*
encodeUrlStr
=
[
urlStr
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
[
self
GET
:
encodeUrlStr
parameters
:
NULL
needToken
:
NO
acceptTypeJson
:
YES
success
:
success
failure
:
failure
];
}
@end
XFFruit/ViewControllers/Business/BusinessViewController.m
View file @
b94eefca
...
...
@@ -56,8 +56,8 @@
[
IBTCommon
localizableString
:
@"Survey1"
],
[
IBTCommon
localizableString
:
@"Survey2"
],
[
IBTCommon
localizableString
:
@"Survey3"
],
[
IBTCommon
localizableString
:
@"
Survey4
"
],
[
IBTCommon
localizableString
:
@"
Survey5
"
],
[
IBTCommon
localizableString
:
@"
AddPurchase
"
],
[
IBTCommon
localizableString
:
@"
Purchase
"
],
[
IBTCommon
localizableString
:
@"Survey6"
],
[
IBTCommon
localizableString
:
@"Survey7"
],
[
IBTCommon
localizableString
:
@"Survey8"
],[
IBTCommon
localizableString
:
@"Survey9"
],
...
...
XFFruit/ViewControllers/Purchase/Controllers/AddProductViewController.h
0 → 100644
View file @
b94eefca
//
// AddProductViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "HPGrowingTextView.h"
@protocol
AddProductViewDelegate
<
NSObject
>
-
(
void
)
dissmiss
;
-
(
void
)
pushViewController
:(
id
)
cvc
;
@end
@interface
AddProductViewController
:
ICRBaseViewController
@property
(
nonatomic
,
assign
)
CGRect
viewFrame
;
@property
(
nonatomic
,
strong
)
UILabel
*
productNameLabel
;
//商品
@property
(
nonatomic
,
strong
)
UILabel
*
productTypeLabel
;
//单位
@property
(
nonatomic
,
strong
)
UITextField
*
productStandFiled
;
//规格
@property
(
nonatomic
,
strong
)
UITextField
*
productCountFiled
;
//包装数量
@property
(
nonatomic
,
strong
)
UITextField
*
baseCountFiled
;
//基础数量
@property
(
nonatomic
,
strong
)
UITextField
*
basePriceFiled
;
//基础单价
@property
(
nonatomic
,
strong
)
UITextField
*
productPriceFiled
;
//包装单价
@property
(
nonatomic
,
strong
)
UITextField
*
totalPriceFiled
;
//总价格
@property
(
nonatomic
,
strong
)
HPGrowingTextView
*
remarkTextView
;
//备注
@property
(
nonatomic
,
weak
)
id
<
AddProductViewDelegate
>
delegate
;
@end
XFFruit/ViewControllers/Purchase/Controllers/AddProductViewController.m
0 → 100644
View file @
b94eefca
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/ChooseTypeViewController.h
0 → 100644
View file @
b94eefca
//
// ChooseTypeViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/26.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
typedef
void
(
^
ChoseType
)(
NSString
*
type
);
@interface
ChooseTypeViewController
:
ICRBaseViewController
@property
(
nonatomic
,
copy
)
ChoseType
choseType
;
@property
(
nonatomic
,
copy
)
NSArray
*
dataArr
;
@end
XFFruit/ViewControllers/Purchase/Controllers/ChooseTypeViewController.m
0 → 100644
View file @
b94eefca
//
// ChooseTypeViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/8/26.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ChooseTypeViewController.h"
#import "MaskCell.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChooseTypeViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
>
{
UITextField
*
_selectTextFiled
;
NSIndexPath
*
_currentIndexPath
;
}
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@end
@implementation
ChooseTypeViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
bulidLayout
];
}
-
(
void
)
bulidLayout
{
self
.
view
.
backgroundColor
=
HexColor
(
@"f8f8f8"
);
_selectTextFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
20
,
5
,
ScreenSize
.
width
-
40
,
TopMargin
-
10
)];
_selectTextFiled
.
textAlignment
=
NSTextAlignmentLeft
;
_selectTextFiled
.
background
=
[
UIImage
imageNamed
:
@"textFiled"
];
_selectTextFiled
.
delegate
=
self
;
_selectTextFiled
.
font
=
FontSize
(
15
);
[
self
.
view
addSubview
:
_selectTextFiled
];
UIImageView
*
leftView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
35
,
40
)];
leftView
.
image
=
[
UIImage
imageNamed
:
@"search"
];
_selectTextFiled
.
leftView
=
leftView
;
_selectTextFiled
.
leftViewMode
=
UITextFieldViewModeAlways
;
UIButton
*
rightView
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
rightView
setImage
:[
UIImage
imageNamed
:
@"delete"
]
forState
:
UIControlStateNormal
];
rightView
.
frame
=
CGRectMake
(
0
,
0
,
35
,
40
);
[
rightView
addTarget
:
self
action
:
@selector
(
deletePerson
)
forControlEvents
:
UIControlEventTouchUpInside
];
_selectTextFiled
.
rightView
=
rightView
;
_selectTextFiled
.
rightViewMode
=
UITextFieldViewModeAlways
;
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
self
.
tableView
];
UIBarButtonItem
*
rightItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
self
.
navigationItem
.
rightBarButtonItem
=
rightItem
;
}
-
(
void
)
sureClick
{
if
(
self
.
dataArr
.
count
>
0
)
{
NSString
*
type
=
self
.
dataArr
[
_currentIndexPath
.
row
];
self
.
choseType
(
type
);
}
[
self
PopViewControllerAnimated
:
YES
];
}
-
(
void
)
deletePerson
{
_selectTextFiled
.
text
=
@""
;
_currentIndexPath
=
nil
;
[
self
.
tableView
reloadData
];
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
self
.
dataArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"MaskCell"
;
MaskCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
if
(
cell
==
nil
)
{
cell
=
[[
MaskCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
totalWidth
:
ScreenSize
.
width
totalHeight
:
TableHeight
];
tableView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
cell
.
Commitbtn
.
hidden
=
YES
;
}
if
(
_currentIndexPath
)
{
if
(
indexPath
.
row
==
_currentIndexPath
.
row
)
{
cell
.
Commitbtn
.
hidden
=
NO
;
}
else
{
cell
.
Commitbtn
.
hidden
=
YES
;
}
}
else
{
cell
.
Commitbtn
.
hidden
=
YES
;
}
if
(
self
.
dataArr
.
count
>
0
)
{
NSString
*
type
=
self
.
dataArr
[
indexPath
.
row
];
[
cell
setTitleStr
:
type
];
}
return
cell
;
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
MaskCell
*
currentCell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
_currentIndexPath
];
currentCell
.
Commitbtn
.
hidden
=
YES
;
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
_currentIndexPath
=
indexPath
;
NSString
*
type
=
self
.
dataArr
[
indexPath
.
row
];
_selectTextFiled
.
text
=
type
;
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
TableHeight
;
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.m
View file @
b94eefca
...
...
@@ -32,31 +32,25 @@
-
(
void
)
initData
{
self
.
dataArr
=
[
NSMutableArray
array
];
self
.
indexArr
=
[
NSMutableArray
array
];
Vendor
*
v
=
[[
Vendor
alloc
]
init
];
v
.
name
=
@"dddd"
;
v
.
code
=
@"1111"
;
[
self
.
dataArr
addObject
:
v
];
// [self fetchVendorList];
[
self
fetchVendorList
];
// __weak typeof(self)weakSelf = self;
// void(^succ)(id) = ^(id data) {
// [IBTLoadingView hideHUDWithText:nil];
// if (data) {
// __strong __typeof(weakSelf)strongSelf = weakSelf;
// [strongSelf fetchVendorList];
// }else{
// [IBTLoadingView showTips:data];
// }
// };
//
// void(^fail)(id) = ^(id data) {
// [IBTLoadingView hideHUDWithText:nil];
// [IBTLoadingView showTips:data];
// __strong __typeof(weakSelf)strongSelf = weakSelf;
// [strongSelf fetchVendorList];
// };
// [IBTLoadingView showProgressLabel:@"正在加载..."];
// [[ICRHTTPController sharedController] getVendorWithPage_number:0 page_size:100 success:succ failure:fail];
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
if
(
data
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
fetchVendorList
];
}
else
{
[
IBTLoadingView
showTips
:
data
];
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
[[
ICRHTTPController
sharedController
]
getVendorWithPage_number
:
0
page_size
:
100
success
:
succ
failure
:
fail
];
}
#pragma mark -成功
...
...
XFFruit/ViewControllers/Purchase/Controllers/ChooseWarehouseViewController.h
0 → 100644
View file @
b94eefca
//
// ChooseStoreViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/26.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "Warehouse.h"
typedef
void
(
^
ChoseWarehouse
)(
Warehouse
*
warehouse
);
@interface
ChooseWarehouseViewController
:
ICRBaseViewController
@property
(
nonatomic
,
copy
)
ChoseWarehouse
choseWarehouse
;
@end
XFFruit/ViewControllers/Purchase/Controllers/ChooseWarehouseViewController.m
0 → 100644
View file @
b94eefca
//
// ChooseStoreViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/8/26.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ChooseWarehouseViewController.h"
#import "MaskCell.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChooseWarehouseViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
>
{
UITextField
*
_selectTextFiled
;
NSIndexPath
*
_currentIndexPath
;
}
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@end
@implementation
ChooseWarehouseViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
initData
];
[
self
bulidLayout
];
}
-
(
void
)
initData
{
self
.
dataArr
=
[
NSMutableArray
array
];
[
self
fetchWarehouseList
];
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
if
(
data
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
fetchWarehouseList
];
}
else
{
[
IBTLoadingView
showTips
:
data
];
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
[[
ICRHTTPController
sharedController
]
getWarehouseWithPage_number
:
0
page_size
:
100
success
:
succ
failure
:
fail
];
}
#pragma mark -成功
-
(
void
)
fetchWarehouseList
{
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
NSString
*
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ ORDER BY %@"
,
[
Warehouse
TableName
],
@"uuid"
];
return
[
db
executeQuery
:
sql
];
};
__weak
typeof
(
self
)
weakSelf
=
self
;
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
.
dataArr
removeAllObjects
];
[
strongSelf
.
dataArr
addObjectsFromArray
:
fetchedObjects
];
[
strongSelf
.
tableView
reloadData
];
};
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
[
dbCtrl
runFetchForClass
:[
Warehouse
class
]
fetchBlock
:
fetchBlk
fetchResultsBlock
:
fetchResultsBlk
];
}
-
(
void
)
bulidLayout
{
self
.
view
.
backgroundColor
=
HexColor
(
@"f8f8f8"
);
_selectTextFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
20
,
5
,
ScreenSize
.
width
-
40
,
TopMargin
-
10
)];
_selectTextFiled
.
textAlignment
=
NSTextAlignmentLeft
;
_selectTextFiled
.
background
=
[
UIImage
imageNamed
:
@"textFiled"
];
_selectTextFiled
.
delegate
=
self
;
_selectTextFiled
.
font
=
FontSize
(
15
);
[
self
.
view
addSubview
:
_selectTextFiled
];
UIImageView
*
leftView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
35
,
40
)];
leftView
.
image
=
[
UIImage
imageNamed
:
@"search"
];
_selectTextFiled
.
leftView
=
leftView
;
_selectTextFiled
.
leftViewMode
=
UITextFieldViewModeAlways
;
UIButton
*
rightView
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
rightView
setImage
:[
UIImage
imageNamed
:
@"delete"
]
forState
:
UIControlStateNormal
];
rightView
.
frame
=
CGRectMake
(
0
,
0
,
35
,
40
);
[
rightView
addTarget
:
self
action
:
@selector
(
deletePerson
)
forControlEvents
:
UIControlEventTouchUpInside
];
_selectTextFiled
.
rightView
=
rightView
;
_selectTextFiled
.
rightViewMode
=
UITextFieldViewModeAlways
;
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
self
.
tableView
];
UIBarButtonItem
*
rightItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
self
.
navigationItem
.
rightBarButtonItem
=
rightItem
;
}
-
(
void
)
sureClick
{
if
(
self
.
dataArr
.
count
>
0
)
{
Warehouse
*
warehouse
=
self
.
dataArr
[
_currentIndexPath
.
row
];
self
.
choseWarehouse
(
warehouse
);
}
[
self
PopViewControllerAnimated
:
YES
];
}
-
(
void
)
deletePerson
{
_selectTextFiled
.
text
=
@""
;
_currentIndexPath
=
nil
;
[
self
.
tableView
reloadData
];
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
self
.
dataArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"MaskCell"
;
MaskCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
if
(
cell
==
nil
)
{
cell
=
[[
MaskCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
totalWidth
:
ScreenSize
.
width
totalHeight
:
TableHeight
];
tableView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
cell
.
Commitbtn
.
hidden
=
YES
;
}
if
(
_currentIndexPath
)
{
if
(
indexPath
.
row
==
_currentIndexPath
.
row
)
{
cell
.
Commitbtn
.
hidden
=
NO
;
}
else
{
cell
.
Commitbtn
.
hidden
=
YES
;
}
}
else
{
cell
.
Commitbtn
.
hidden
=
YES
;
}
if
(
self
.
dataArr
.
count
>
0
)
{
Warehouse
*
warehouse
=
self
.
dataArr
[
indexPath
.
row
];
NSString
*
proStr
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
warehouse
.
name
,
warehouse
.
code
];
[
cell
setTitleStr
:
proStr
];
}
return
cell
;
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
MaskCell
*
currentCell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
_currentIndexPath
];
currentCell
.
Commitbtn
.
hidden
=
YES
;
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
_currentIndexPath
=
indexPath
;
Warehouse
*
warehouse
=
self
.
dataArr
[
indexPath
.
row
];
_selectTextFiled
.
text
=
warehouse
.
name
;
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
TableHeight
;
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
XFFruit/ViewControllers/Purchase/Controllers/NewPurchaseViewController.m
View file @
b94eefca
...
...
@@ -9,8 +9,8 @@
#import "NewPurchaseViewController.h"
#import "TopPurchaseView.h"
#import "ProductViewController.h"
#define TopHeight
284
#import "AddProductViewController.h"
#define TopHeight
328
#define BottomHeight 300
#define SpaceHeight 20
#define BottomViewHeight 60
...
...
@@ -20,12 +20,13 @@ typedef enum : NSUInteger {
CommitTag
,
}
BtnTag
;
@interface
NewPurchaseViewController
()
<
TopPurchaseViewDelegate
>
@interface
NewPurchaseViewController
()
<
TopPurchaseViewDelegate
,
ProductViewDelegate
>
{
UIScrollView
*
_scrollView
;
TopPurchaseView
*
_purchaseView
;
UIView
*
_bottomView
;
ProductViewController
*
_pvc
;
AddProductViewController
*
_avc
;
}
@end
...
...
@@ -67,6 +68,7 @@ typedef enum : NSUInteger {
[
_scrollView
addSubview
:
_bottomView
];
_pvc
=
[[
ProductViewController
alloc
]
init
];
_pvc
.
delegate
=
self
;
_pvc
.
viewFrame
=
_bottomView
.
bounds
;
[
_bottomView
addSubview
:
_pvc
.
view
];
...
...
@@ -76,16 +78,30 @@ typedef enum : NSUInteger {
}
#pragma mark - TopPurchaseViewDelegate
-
(
void
)
pushNextViewController
:
(
id
)
vc
{
[
self
PushViewController
:
vc
animated
:
YES
];
}
#pragma mark - ProductViewDelegate
-
(
void
)
pushViewController
:
(
id
)
cvc
selfController
:
(
id
)
avc
{
_avc
=
avc
;
[
self
PushViewController
:
cvc
animated
:
YES
];
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
if
(
_avc
)
{
[
AppWindow
addSubview
:
_avc
.
view
];
}
}
#pragma mark - 协议方法
-
(
void
)
hiddenKeyBoard
{
[
self
keyboardHidden
];
}
-
(
void
)
keyboardHidden
{
[
_purchaseView
.
purchase
PriceFiled
resignFirstResponder
];
[
_purchaseView
.
other
PriceFiled
resignFirstResponder
];
[
_purchaseView
.
remarkTextView
resignFirstResponder
];
}
-
(
void
)
didReceiveMemoryWarning
{
...
...
XFFruit/ViewControllers/Purchase/Controllers/ProductViewController.h
View file @
b94eefca
...
...
@@ -7,10 +7,15 @@
//
#import "ICRBaseViewController.h"
@protocol
ProductViewDelegate
<
NSObject
>
-
(
void
)
pushViewController
:
(
id
)
cvc
selfController
:
(
id
)
avc
;
@end
@interface
ProductViewController
:
ICRBaseViewController
@property
(
nonatomic
,
strong
)
NSMutableArray
*
productArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
assign
)
CGRect
viewFrame
;
@property
(
nonatomic
,
assign
)
BOOL
isHiddenEdit
;
@property
(
nonatomic
,
weak
)
id
<
ProductViewDelegate
>
delegate
;
@end
XFFruit/ViewControllers/Purchase/Controllers/ProductViewController.m
View file @
b94eefca
...
...
@@ -10,12 +10,14 @@
#import "FooterCell.h"
#import "HeaderCell.h"
#import "ProductCell.h"
#import "AddProductViewController.h"
#define TableHeight 44
@interface
ProductViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
FooterCellDelegate
>
@interface
ProductViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
FooterCellDelegate
,
AddProductViewDelegate
>
{
CGRect
_tableFrame
;
NSMutableArray
*
_selectRowArr
;
//记录当前选中的cell
AddProductViewController
*
_avc
;
}
@end
...
...
@@ -60,10 +62,34 @@
self
.
tableView
.
tableFooterView
=
footCell
;
}
}
#pragma mark - footerDelegate
-
(
void
)
addClick
{
[
self
.
productArr
addObject
:
@"dddd"
];
[
self
.
tableView
reloadData
];
// [self.productArr addObject:@"dddd"];
// [self.tableView reloadData];
if
(
_avc
==
nil
)
{
_avc
=
[[
AddProductViewController
alloc
]
init
];
_avc
.
delegate
=
self
;
_avc
.
view
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
.
5
);
[
AppWindow
addSubview
:
_avc
.
view
];
}
}
#pragma mark - addProductViewDelegate
-
(
void
)
dissmiss
{
if
(
_avc
)
{
[
_avc
.
view
removeFromSuperview
];
_avc
=
nil
;
}
}
-
(
void
)
pushViewController
:
(
id
)
cvc
{
if
(
_avc
)
{
[
_avc
.
view
removeFromSuperview
];
}
if
([
self
.
delegate
respondsToSelector
:
@selector
(
pushViewController
:
selfController
:
)])
{
[
self
.
delegate
pushViewController
:
cvc
selfController
:
_avc
];
}
}
#pragma mark - 协议方法
...
...
@@ -102,6 +128,8 @@
cell
.
showView
.
frame
=
showfrmame
;
cell
.
backgroundColor
=
[
UIColor
whiteColor
];
}
cell
.
editBtn
.
tag
=
indexPath
.
row
;
[
cell
.
editBtn
addTarget
:
self
action
:
@selector
(
editClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
return
cell
;
}
-
(
BOOL
)
isHaveIndexPath
:
(
NSIndexPath
*
)
indexPath
{
...
...
@@ -122,14 +150,12 @@
Linefrmame
.
origin
.
y
=
200
-
1
;
showfrmame
.
size
.
height
=
150
;
// cell.showView.hidden = NO;
cell
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_selectRowArr
addObject
:
indexPath
];
}
else
{
cell
.
smallImageView
.
image
=
[
UIImage
imageNamed
:
@"arrowright"
];
Linefrmame
.
origin
.
y
=
TableHeight
-
1
;
showfrmame
.
size
.
height
=
0
;
// cell.showView.hidden = YES;
cell
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_selectRowArr
removeObject
:
indexPath
];
}
...
...
@@ -137,14 +163,20 @@
cell
.
showView
.
frame
=
showfrmame
;
[
self
.
tableView
reloadData
];
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
([
self
isHaveIndexPath
:
indexPath
])
{
return
200
;
}
return
TableHeight
;
}
-
(
void
)
editClick
:
(
UIButton
*
)
btn
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@""
message
:
@"哈哈"
delegate
:
self
cancelButtonTitle
:
@"确定"
otherButtonTitles
:
nil
,
nil
];
[
alert
show
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
...
...
XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.h
View file @
b94eefca
...
...
@@ -11,5 +11,7 @@
@interface
PurchaseDetailViewController
:
ICRBaseViewController
@property
(
nonatomic
,
strong
)
PurchaseBill
*
bill
;
//模拟三个人员
@property
(
nonatomic
,
assign
)
NSInteger
indexPerson
;
//0.1.2
@end
XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.m
View file @
b94eefca
...
...
@@ -10,25 +10,47 @@
#import "ProductViewController.h"
#define BottomHeight 50
#define LeftMargin
20
#define LeftMargin
15
#define LeftWidth 100
#define LeftHeight 30
#define TopMargin 15
typedef
enum
:
NSUInteger
{
CancleTag
=
3500
,
RejectTag
,
PassTag
,
SureTag
}
BtnTag
;
@interface
PurchaseDetailViewController
()
{
UIScrollView
*
_scrollView
;
UIView
*
_purchaseView
;
UIView
*
_bottomView
;
ProductViewController
*
_pvc
;
NSArray
*
_leftArr
;
UIButton
*
_endBtn
;
UIButton
*
_rejectBtn
;
}
@property
(
nonatomic
,
strong
)
UILabel
*
billNumberLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
noticeNumberLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
createOperNameLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
checkNameLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
stateLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
lastModifyNameLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
typeLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
vendorNameLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
vendorIsSureLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
warehouseLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
otherPriceLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
totalPriceLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
noteLabel
;
@end
@implementation
PurchaseDetailViewController
...
...
@@ -48,69 +70,125 @@
_scrollView
.
showsVerticalScrollIndicator
=
NO
;
_scrollView
.
backgroundColor
=
HexColor
(
@"f8f8f8"
);
[
self
.
view
addSubview
:
_scrollView
];
[
self
createBtn
];
[
self
createPurchaseView
];
[
self
createBottomView
];
if
([
self
.
bill
.
state
isEqualToString
:
@"finished"
])
{
_endBtn
.
hidden
=
YES
;
_rejectBtn
.
hidden
=
YES
;
CGRect
scrollViewFrame
=
_scrollView
.
frame
;
scrollViewFrame
.
size
.
height
=
ScreenSize
.
height
-
64
;
_scrollView
.
frame
=
scrollViewFrame
;
}
[
self
fetchtPurchaseDetail
];
}
-
(
void
)
createBtn
{
UIButton
*
endBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
ScreenSize
.
width
-
LeftMargin
*
2
,
40
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
3000
image
:
nil
title
:
@"结束"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
8
bgColor
:
HexColor
(
@"f69100"
)];
[
self
.
view
addSubview
:
endBtn
];
_endBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
ScreenSize
.
width
-
LeftMargin
*
2
,
40
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
0
image
:
nil
title
:
@"作废"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
5
bgColor
:
HexColor
(
@"f69100"
)];
[
self
.
view
addSubview
:
_endBtn
];
if
(
self
.
indexPerson
==
0
)
{
_endBtn
.
tag
=
CancleTag
;
[
_endBtn
setTitle
:
@"作废"
forState
:
UIControlStateNormal
];
}
else
if
(
self
.
indexPerson
==
1
){
_rejectBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
40
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
RejectTag
image
:
nil
title
:
@"拒绝"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
5
bgColor
:
HexColor
(
@"50bd62"
)];
[
self
.
view
addSubview
:
_rejectBtn
];
_endBtn
.
frame
=
CGRectMake
(
CGRectGetMaxX
(
_rejectBtn
.
frame
)
+
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
40
);
[
_endBtn
setTitle
:
@"审核通过"
forState
:
UIControlStateNormal
];
_endBtn
.
tag
=
PassTag
;
}
else
{
_endBtn
.
tag
=
SureTag
;
[
_endBtn
setTitle
:
@"确认"
forState
:
UIControlStateNormal
];
}
}
-
(
void
)
createBottomView
{
_bottomView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
CGRectGetMaxY
(
_purchaseView
.
frame
)
+
TopMargin
,
ScreenSize
.
width
,
200
)];
_bottomView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_scrollView
addSubview
:
_bottomView
];
_purchaseView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
LeftHeight
*
8
+
LeftMargin
)];
_pvc
=
[[
ProductViewController
alloc
]
init
];
[
self
addChildViewController
:
_pvc
];
_pvc
.
viewFrame
=
_bottomView
.
bounds
;
_pvc
.
isHiddenEdit
=
YES
;
[
_bottomView
addSubview
:
_pvc
.
view
];
}
-
(
void
)
createPurchaseView
{
if
(
self
.
indexPerson
==
0
)
{
_leftArr
=
@[
@"单号:"
,
@"采购通知单:"
,
@"创建人:"
,
@"最后修改人:"
,
@"状态:"
,
@"类型:"
,
@"供应商:"
,
@"供应商确认:"
,
@"收货仓库:"
,
@"其他费用:"
,
@"总金额:"
,
@"备注:"
];
}
else
if
(
self
.
indexPerson
==
1
)
{
_leftArr
=
@[
@"单号:"
,
@"采购通知单:"
,
@"创建人:"
,
@"审核人:"
,
@"状态:"
,
@"类型:"
,
@"供应商:"
,
@"供应商确认:"
,
@"收货仓库:"
,
@"其他费用:"
,
@"总金额:"
,
@"备注:"
];
}
else
{
_leftArr
=
@[
@"单号:"
,
@"采购通知单:"
,
@"创建人:"
,
@"审核人:"
,
@"状态:"
,
@"供应商:"
,
@"其他费用:"
,
@"总金额:"
,
@"备注:"
];
}
_purchaseView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
LeftHeight
*
_leftArr
.
count
+
LeftMargin
)];
_purchaseView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_scrollView
addSubview
:
_purchaseView
];
NSArray
*
leftArr
=
@[
@"单号:"
,
@"采购通知单:"
,
@"创建人:"
,
@"审核人:"
,
@"状态:"
,
@"供应商:"
,
@"总金额:"
,
@"备注:"
];
for
(
NSInteger
i
=
0
;
i
<
leftArr
.
count
;
i
++
)
{
for
(
NSInteger
i
=
0
;
i
<
_leftArr
.
count
;
i
++
)
{
UILabel
*
leftLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
10
+
LeftHeight
*
i
,
LeftWidth
,
LeftHeight
)];
leftLabel
.
font
=
FontSize
(
17
);
leftLabel
.
text
=
leftArr
[
i
];
leftLabel
.
text
=
_
leftArr
[
i
];
leftLabel
.
textColor
=
HexColor
(
@"888888"
);
[
_purchaseView
addSubview
:
leftLabel
];
UILabel
*
rightLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
CGRectGetMaxX
(
leftLabel
.
frame
),
10
+
LeftHeight
*
i
,
_purchaseView
.
frame
.
size
.
width
-
LeftMargin
-
LeftWidth
,
LeftHeight
)];
rightLabel
.
font
=
FontSize
(
17
);
rightLabel
.
textColor
=
HexColor
(
@"888888"
);
if
(
i
==
0
)
{
self
.
billNumberLabel
=
rightLabel
;
}
else
if
(
i
==
1
)
{
self
.
noticeNumberLabel
=
rightLabel
;
}
else
if
(
i
==
2
){
self
.
createOperNameLabel
=
rightLabel
;
}
else
if
(
i
==
3
){
self
.
checkNameLabel
=
rightLabel
;
}
else
if
(
i
==
4
){
self
.
stateLabel
=
rightLabel
;
}
else
if
(
i
==
5
){
self
.
vendorNameLabel
=
rightLabel
;
}
else
if
(
i
==
6
){
}
else
if
(
i
==
_leftArr
.
count
-
3
){
self
.
otherPriceLabel
=
rightLabel
;
}
else
if
(
i
==
_leftArr
.
count
-
2
){
self
.
totalPriceLabel
=
rightLabel
;
}
else
if
(
i
==
7
){
}
else
if
(
i
==
_leftArr
.
count
-
1
){
rightLabel
.
numberOfLines
=
0
;
self
.
noteLabel
=
rightLabel
;
}
if
(
self
.
indexPerson
==
0
||
self
.
indexPerson
==
1
)
{
if
(
self
.
indexPerson
==
0
)
{
if
(
i
==
3
)
{
self
.
lastModifyNameLabel
=
rightLabel
;
}
}
else
{
if
(
i
==
3
)
{
self
.
checkNameLabel
=
rightLabel
;
}
}
if
(
i
==
4
){
self
.
stateLabel
=
rightLabel
;
}
else
if
(
i
==
5
){
self
.
typeLabel
=
rightLabel
;
}
else
if
(
i
==
6
){
self
.
vendorNameLabel
=
rightLabel
;
}
else
if
(
i
==
7
){
self
.
vendorIsSureLabel
=
rightLabel
;
}
else
if
(
i
==
8
){
self
.
warehouseLabel
=
rightLabel
;
}
}
else
{
if
(
i
==
3
){
self
.
checkNameLabel
=
rightLabel
;
}
else
if
(
i
==
4
){
self
.
stateLabel
=
rightLabel
;
}
else
if
(
i
==
5
){
self
.
vendorNameLabel
=
rightLabel
;
}
}
[
_purchaseView
addSubview
:
rightLabel
];
}
_bottomView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
CGRectGetMaxY
(
_purchaseView
.
frame
)
+
TopMargin
,
ScreenSize
.
width
,
200
)];
_bottomView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_scrollView
addSubview
:
_bottomView
];
_pvc
=
[[
ProductViewController
alloc
]
init
];
[
self
addChildViewController
:
_pvc
];
_pvc
.
viewFrame
=
_bottomView
.
bounds
;
_pvc
.
isHiddenEdit
=
YES
;
[
_bottomView
addSubview
:
_pvc
.
view
];
if
([
self
.
bill
.
state
isEqualToString
:
@"finished"
])
{
endBtn
.
hidden
=
YES
;
CGRect
scrollViewFrame
=
_scrollView
.
frame
;
scrollViewFrame
.
size
.
height
=
ScreenSize
.
height
-
64
;
_scrollView
.
frame
=
scrollViewFrame
;
}
[
self
fetchtPurchaseDetail
];
}
-
(
void
)
fetchtPurchaseDetail
{
...
...
@@ -138,8 +216,15 @@
self
.
createOperNameLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
create_operName
];
self
.
checkNameLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
vendor_name
];
self
.
vendorNameLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
vendor_name
];
self
.
totalPriceLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
total
];
self
.
totalPriceLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
total
];
self
.
noteLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
remark
];
self
.
lastModifyNameLabel
.
text
=
@"最后修改人"
;
self
.
typeLabel
.
text
=
@"类型"
;
self
.
vendorIsSureLabel
.
text
=
@"是否确认"
;
self
.
warehouseLabel
.
text
=
@"仓库"
;
self
.
otherPriceLabel
.
text
=
@"其他费用"
;
[
self
setNoteHeight
];
}
...
...
@@ -151,7 +236,7 @@
noteFrame
.
size
.
height
=
height
;
self
.
noteLabel
.
frame
=
noteFrame
;
CGFloat
totalHeight
=
height
+
LeftHeight
*
8
;
CGFloat
totalHeight
=
height
+
LeftHeight
*
_leftArr
.
count
;
CGRect
purchaseFrame
=
_purchaseView
.
frame
;
purchaseFrame
.
size
.
height
=
totalHeight
;
_purchaseView
.
frame
=
purchaseFrame
;
...
...
XFFruit/ViewControllers/Purchase/Controllers/PurchaseViewController.m
View file @
b94eefca
...
...
@@ -11,6 +11,9 @@
#import "PurchaseBill.h"
#import "PurchaseDetailViewController.h"
#import "SortMaskView.h"
#import "PurchaseBoltView.h"
#define TopMargin 44
#define TableHeight 120
#define LeftMargin 20
...
...
@@ -23,16 +26,22 @@ typedef enum : NSUInteger {
BoltTag
}
BtnTag
;
@interface
PurchaseViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
>
@interface
PurchaseViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
PurchaseViewDelegate
,
SortMaskViewDelegate
>
{
UIView
*
_maskView
;
UIButton
*
currentBtn
;
SortMaskView
*
_sortView
;
PurchaseBoltView
*
_boltView
;
UIBarButtonItem
*
_sureBtn
;
UIButton
*
_sortBtn
;
UIButton
*
_boltBtn
;
}
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSString
*
noticeLike
;
@property
(
nonatomic
,
strong
)
NSString
*
state
;
//未提交=initial已提交=submitted调研中=insurvey已完成=finished
@property
(
nonatomic
,
strong
)
NSString
*
billLike
;
@property
(
nonatomic
,
strong
)
NSString
*
orderDirection
;
//asc(升序),desc(降序)
@end
@implementation
PurchaseViewController
...
...
@@ -48,12 +57,14 @@ typedef enum : NSUInteger {
for
(
NSInteger
i
=
0
;
i
<
6
;
i
++
)
{
PurchaseBill
*
bill
=
[
PurchaseBill
new
];
bill
.
billNumber
=
@"222222222"
;
bill
.
noticeNumber
=
@"134594059654
0504门店补货0002
"
;
bill
.
create_operName
=
@"
张三
"
;
bill
.
noticeNumber
=
@"134594059654"
;
bill
.
create_operName
=
@"
创建人
"
;
bill
.
create_time
=
@"2013-03-04"
;
bill
.
vendor_name
=
@"haha"
;
bill
.
total
=
@"200元"
;
bill
.
remark
=
@"hahahah"
;
bill
.
vendor_name
=
@"供应商"
;
bill
.
total
=
@"总金额"
;
bill
.
remark
=
@"备注"
;
bill
.
lastModified_operName
=
@"最后修改人"
;
bill
.
vendorConfirmTime
=
@"否"
;
if
(
i
==
0
)
{
bill
.
state
=
@"initial"
;
}
else
if
(
i
==
1
){
...
...
@@ -97,10 +108,158 @@ typedef enum : NSUInteger {
#pragma mark -按钮事件
-
(
void
)
sortClick
:
(
UIButton
*
)
btn
{
_maskView
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
.
5
);
_maskView
.
hidden
=
NO
;
if
(
btn
.
tag
==
SortTag
)
{
if
(
_boltView
){
[
self
hiddenBoltMaskView
:
NO
];
}
if
(
currentBtn
==
btn
)
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"black_arrow_down_with_text"
]
forState
:
UIControlStateNormal
];
[
self
hiddenSortMaskView
:
YES
];
currentBtn
=
nil
;
self
.
navigationItem
.
rightBarButtonItem
=
nil
;
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"select_arrow_up_text"
]
forState
:
UIControlStateNormal
];
if
(
_sortView
==
nil
)
{
_sortView
=
[[
SortMaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
105
,
ScreenSize
.
width
,
150
)
withOrderDirection
:
self
.
orderDirection
];
_sortView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"按时间顺序"
,
@"按时间逆序"
,
@"默认排序"
,
nil
];
_sortView
.
delegate
=
self
;
[
_maskView
addSubview
:
_sortView
];
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
CGRect
sortFrame
=
_sortView
.
frame
;
sortFrame
.
origin
.
y
=
0
;
_sortView
.
frame
=
sortFrame
;
}];
}
self
.
navigationItem
.
rightBarButtonItem
=
_sureBtn
;
currentBtn
=
btn
;
}
}
else
if
(
btn
.
tag
==
BoltTag
){
if
(
_sortView
)
{
[
self
hiddenSortMaskView
:
NO
];
}
if
(
currentBtn
==
btn
)
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"black_filter_with_text"
]
forState
:
UIControlStateNormal
];
[
self
hiddenBoltMaskView
:
YES
];
currentBtn
=
nil
;
self
.
navigationItem
.
rightBarButtonItem
=
nil
;
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"selected-filter_with_text"
]
forState
:
UIControlStateNormal
];
if
(
_boltView
==
nil
)
{
_boltView
=
[[
PurchaseBoltView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
105
,
ScreenSize
.
width
,
274
)
state
:
self
.
state
billNumber
:
self
.
billLike
noticeNumber
:
self
.
noticeLike
];
_boltView
.
backgroundColor
=
HexColor
(
@"f8f8f8"
);
_boltView
.
delegate
=
self
;
//initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
_boltView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"未提交"
,
@"已提交"
,
@"已拒绝"
,
@"已审批"
,
@"发运中"
,
@"已完成"
,
nil
];
[
_maskView
addSubview
:
_boltView
];
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
CGRect
sortFrame
=
_boltView
.
frame
;
sortFrame
.
origin
.
y
=
0
;
_boltView
.
frame
=
sortFrame
;
}];
currentBtn
=
btn
;
self
.
navigationItem
.
rightBarButtonItem
=
_sureBtn
;
}
}
}
}
-
(
void
)
hiddenSortMaskView
:
(
BOOL
)
isHide
{
currentBtn
=
nil
;
[
self
checkSortBtnColor
];
if
(
isHide
==
NO
)
{
[
_sortView
removeFromSuperview
];
_sortView
=
nil
;
}
else
{
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
CGRect
sortFrame
=
_sortView
.
frame
;
sortFrame
.
origin
.
y
=
-
105
;
_sortView
.
frame
=
sortFrame
;
_maskView
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
);
}
completion
:^
(
BOOL
finished
)
{
[
_sortView
removeFromSuperview
];
_sortView
=
nil
;
_maskView
.
hidden
=
YES
;
}];
}
}
-
(
void
)
hiddenBoltMaskView
:
(
BOOL
)
isHide
{
currentBtn
=
nil
;
[
self
checkBoltBtnColor
];
if
(
isHide
==
NO
)
{
[
_boltView
removeFromSuperview
];
_boltView
=
nil
;
}
else
{
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
CGRect
sortFrame
=
_boltView
.
frame
;
sortFrame
.
origin
.
y
=
-
105
;
_boltView
.
frame
=
sortFrame
;
_maskView
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
);
}
completion
:^
(
BOOL
finished
)
{
[
_boltView
removeFromSuperview
];
_boltView
=
nil
;
_maskView
.
hidden
=
YES
;
}];
}
}
//检测排序的颜色
-
(
void
)
checkSortBtnColor
{
if
(
self
.
orderDirection
.
length
>
0
)
{
[
_sortBtn
setImage
:[
UIImage
imageNamed
:
@"select_arrow_up_text"
]
forState
:
UIControlStateNormal
];
}
else
{
[
_sortBtn
setImage
:[
UIImage
imageNamed
:
@"black_arrow_down_with_text"
]
forState
:
UIControlStateNormal
];
}
}
-
(
void
)
checkBoltBtnColor
{
if
(
self
.
state
.
length
>
0
||
self
.
noticeLike
.
length
>
0
||
self
.
billLike
.
length
>
0
)
{
[
_boltBtn
setImage
:[
UIImage
imageNamed
:
@"selected-filter_with_text"
]
forState
:
UIControlStateNormal
];
}
else
{
[
_boltBtn
setImage
:[
UIImage
imageNamed
:
@"black_filter_with_text"
]
forState
:
UIControlStateNormal
];
}
}
#pragma mark - 确定
-
(
void
)
sureClick
{
}
#pragma mark - sortDelegate
-
(
void
)
getSortValueSelectRow
:
(
NSString
*
)
state
{
if
(
state
.
length
>
0
)
{
self
.
orderDirection
=
state
;
NSLog
(
@"%@"
,
state
);
}
}
#pragma mark - boltDelegate
-
(
void
)
getBoltValueSelectRow
:
(
NSString
*
)
state
{
self
.
state
=
state
;
NSLog
(
@"%@"
,
state
);
}
-
(
void
)
getbillLike
:
(
NSString
*
)
billLike
{
self
.
billLike
=
billLike
;
NSLog
(
@"%@"
,
billLike
);
}
-
(
void
)
getnoticeLike
:
(
NSString
*
)
noticeLike
{
self
.
noticeLike
=
noticeLike
;
NSLog
(
@"%@"
,
noticeLike
);
}
-
(
void
)
clearBoltInformation
{
//清空所有条件
if
(
self
.
billLike
.
length
>
0
)
{
self
.
billLike
=
@""
;
}
if
(
self
.
noticeLike
.
length
>
0
)
{
self
.
noticeLike
=
@""
;
}
if
(
self
.
state
.
length
>
0
)
{
self
.
state
=
@""
;
}
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
...
...
@@ -127,6 +286,13 @@ typedef enum : NSUInteger {
PurchaseDetailViewController
*
pvc
=
[
PurchaseDetailViewController
new
];
pvc
.
title
=
@"查看采购单"
;
pvc
.
bill
=
_dataArr
[
indexPath
.
row
];
if
(
indexPath
.
row
==
0
){
pvc
.
indexPerson
=
0
;
}
else
if
(
indexPath
.
row
==
1
){
pvc
.
indexPerson
=
1
;
}
else
if
(
indexPath
.
row
==
2
){
pvc
.
indexPerson
=
2
;
}
[
self
PushViewController
:
pvc
animated
:
YES
];
}
...
...
XFFruit/ViewControllers/Purchase/Models/PurchaseBill.h
View file @
b94eefca
...
...
@@ -11,7 +11,6 @@
@interface
PurchaseBill
:
IBTModel
@property
(
nonatomic
,
strong
)
NSString
*
uuid
;
//唯一标识
@property
(
nonatomic
,
strong
)
NSString
*
version
;
//版本
@property
(
nonatomic
,
strong
)
NSString
*
noticeUuid
;
//采购通知单uuid
@property
(
nonatomic
,
strong
)
NSString
*
noticeNumber
;
//采购通知单号
@property
(
nonatomic
,
strong
)
NSString
*
billNumber
;
//采购单号
...
...
@@ -28,7 +27,7 @@
@property
(
nonatomic
,
strong
)
NSString
*
create_operName
;
//创建人名称
@property
(
nonatomic
,
strong
)
NSString
*
lastModified_time
;
//最后修改时间
@property
(
nonatomic
,
strong
)
NSString
*
lastModified_id
;
//最后修改人代码
@property
(
nonatomic
,
strong
)
NSString
*
astModified_operName
;
//最后修改人名称
@property
(
nonatomic
,
strong
)
NSString
*
l
astModified_operName
;
//最后修改人名称
...
...
XFFruit/ViewControllers/Purchase/Models/Vendor.h
View file @
b94eefca
...
...
@@ -4,7 +4,7 @@
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
//
供应商
#import "IBTModel.h"
...
...
XFFruit/ViewControllers/Purchase/Models/Warehouse.h
0 → 100644
View file @
b94eefca
//
// Warehouse.h
// XFFruit
//
// Created by n22 on 15/8/26.
// Copyright (c) 2015年 Xummer. All rights reserved.
// 仓库
#import "IBTModel.h"
@interface
Warehouse
:
IBTModel
@property
(
nonatomic
,
strong
)
NSString
*
uuid
;
//id
@property
(
nonatomic
,
strong
)
NSString
*
code
;
//代码
@property
(
nonatomic
,
strong
)
NSString
*
name
;
//名称
@property
(
nonatomic
,
assign
)
BOOL
enabled
;
//状态
@end
XFFruit/ViewControllers/Purchase/Models/Warehouse.m
0 → 100644
View file @
b94eefca
//
// Warehouse.m
// XFFruit
//
// Created by n22 on 15/8/26.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "Warehouse.h"
@implementation
Warehouse
+
(
NSDictionary
*
)
specialKeysAndReplaceKeys
{
return
@{
@"wID"
:
[[
self
class
]
PrimaryKey
],
};
}
+
(
NSString
*
)
PrimaryKey
{
return
@"uuid"
;
}
@end
XFFruit/ViewControllers/Purchase/Views/ProductCell.m
View file @
b94eefca
...
...
@@ -36,7 +36,7 @@
-
(
void
)
bulidLayout
{
CGFloat
headWidth
=
(
ScreenSize
.
width
-
LeftWidth
-
RightWidth
-
SpaceMargin
*
(
3
-
1
))
/
3
;
CGFloat
headWidth
=
(
ScreenSize
.
width
-
LeftWidth
*
2
-
SpaceMargin
*
(
3
-
1
))
/
3
;
self
.
smallImageView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
(
TableHeight
-
SmallSize
)
/
2
,
SmallSize
,
SmallSize
)];
self
.
smallImageView
.
image
=
[
UIImage
imageNamed
:
@"arrowright"
];
...
...
@@ -130,7 +130,7 @@
self
.
editBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
self
.
editBtn
setImage
:[
UIImage
imageNamed
:
@"edit"
]
forState
:
UIControlStateNormal
];
self
.
editBtn
.
frame
=
CGRectMake
(
ScreenSize
.
width
-
RightWidth
,
0
,
RightWidth
-
LeftMargin
,
TableHeight
);
self
.
editBtn
.
frame
=
CGRectMake
(
ScreenSize
.
width
-
LeftWidth
,
0
,
LeftWidth
,
TableHeight
);
self
.
editBtn
.
contentMode
=
UIViewContentModeScaleAspectFit
;
self
.
lineLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
LeftMargin
,
TableHeight
-
1
,
ScreenSize
.
width
-
LeftMargin
*
2
,
1
))];;
...
...
XFFruit/ViewControllers/Purchase/Views/PurchaseBoltView.h
0 → 100644
View file @
b94eefca
//
// PurchaseBoltView.h
// XFFruit
//
// Created by n22 on 15/8/26.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol
PurchaseViewDelegate
<
NSObject
>
-
(
void
)
getBoltValueSelectRow
:
(
NSString
*
)
state
;
-
(
void
)
getbillLike
:(
NSString
*
)
billLike
;
-
(
void
)
getnoticeLike
:(
NSString
*
)
noticeLike
;
-
(
void
)
clearBoltInformation
;
@end
@interface
PurchaseBoltView
:
UIView
<
UITableViewDataSource
,
UITableViewDelegate
>
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
weak
)
id
<
PurchaseViewDelegate
>
delegate
;
@property
(
nonatomic
,
strong
)
UITextField
*
billFiled
;
//采购单号类似于
@property
(
nonatomic
,
strong
)
UITextField
*
noticeFiled
;
//通知单号类似于
@property
(
nonatomic
,
strong
)
UITextField
*
vendorFiled
;
//供应商uuid类似于
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
state
:(
NSString
*
)
state
billNumber
:(
NSString
*
)
billNumber
noticeNumber
:(
NSString
*
)
noticeNumber
;
@end
XFFruit/ViewControllers/Purchase/Views/PurchaseBoltView.m
0 → 100644
View file @
b94eefca
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.h
View file @
b94eefca
...
...
@@ -20,7 +20,8 @@
@property
(
nonatomic
,
strong
)
UILabel
*
purchaseTypeLabel
;
//类型
@property
(
nonatomic
,
strong
)
UILabel
*
purchaseSupplierLabel
;
//供应商
@property
(
nonatomic
,
strong
)
UILabel
*
purchaseStoreLabel
;
//收货仓库
@property
(
nonatomic
,
strong
)
UITextField
*
purchasePriceFiled
;
//总金额
@property
(
nonatomic
,
strong
)
UITextField
*
otherPriceFiled
;
//其他费用
@property
(
nonatomic
,
strong
)
UILabel
*
purchasePriceLabel
;
//总金额
@property
(
nonatomic
,
strong
)
HPGrowingTextView
*
remarkTextView
;
//备注
@property
(
nonatomic
,
weak
)
id
<
TopPurchaseViewDelegate
>
delegate
;
...
...
XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.m
View file @
b94eefca
...
...
@@ -10,6 +10,8 @@
#import "SurveyCell.h"
#import "ChooseVendorViewController.h"
#import "ChooseTypeViewController.h"
#import "ChooseWarehouseViewController.h"
#import "Vendor.h"
#define LeftMargin 15
#define TopMargin 20
...
...
@@ -41,7 +43,7 @@
{
self
.
backgroundColor
=
XXFBgColor
;
_dataArr
=
[
NSMutableArray
array
];
NSArray
*
arr
=
@[
@"采购通知:"
,
@"类型:"
,
@"供应商:"
,
@"收货仓库:"
,
@"总金额:"
,
@"备注:"
];
NSArray
*
arr
=
@[
@"采购通知:"
,
@"类型:"
,
@"供应商:"
,
@"收货仓库:"
,
@"
其他费用:"
,
@"
总金额:"
,
@"备注:"
];
[
_dataArr
addObjectsFromArray
:
arr
];
_tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
self
.
frame
.
size
.
width
,
self
.
frame
.
size
.
height
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
...
...
@@ -65,7 +67,7 @@
cell
=
[[
SurveyCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
];
tableView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
if
(
indexPath
.
row
!=
4
&&
indexPath
.
row
!=
5
)
{
if
(
indexPath
.
row
!=
4
&&
indexPath
.
row
!=
5
&&
indexPath
.
row
!=
6
)
{
cell
.
accessoryType
=
UITableViewCellAccessoryDisclosureIndicator
;
}
[
self
createViewInCell
:
cell
indexPath
:
indexPath
];
...
...
@@ -75,18 +77,24 @@
}
-
(
void
)
createViewInCell
:
(
SurveyCell
*
)
cell
indexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
4
)
{
UITextField
*
textField
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
0
,
TableHeight
)];
UITextField
*
textField
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
3
0
,
TableHeight
)];
textField
.
textAlignment
=
NSTextAlignmentRight
;
textField
.
textColor
=
HexColor
(
@"444444"
);
textField
.
font
=
FontSize
(
15
);
textField
.
keyboardType
=
UIKeyboardTypeNumbersAndPunctuation
;
textField
.
returnKeyType
=
UIReturnKeyDone
;
textField
.
delegate
=
self
;
[
cell
.
contentView
addSubview
:
textField
];
self
.
purchasePriceFiled
=
textField
;
self
.
purchasePriceFiled
.
placeholder
=
@"请输总金额"
;
self
.
otherPriceFiled
=
textField
;
self
.
otherPriceFiled
.
placeholder
=
@"请输入其他费用"
;
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
CGRectGetMaxX
(
textField
.
frame
)
+
5
,
0
,
20
,
TableHeight
)];
label
.
text
=
@"元"
;
label
.
textColor
=
HexColor
(
@"444444"
);
label
.
font
=
FontSize
(
TitleSize
);
[
cell
.
contentView
addSubview
:
label
];
}
else
if
(
indexPath
.
row
==
_dataArr
.
count
-
1
){
self
.
remarkTextView
=
[[
HPGrowingTextView
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
0
,
TableHeight
)];
self
.
remarkTextView
=
[[
HPGrowingTextView
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
5
,
TableHeight
)];
self
.
remarkTextView
.
contentInset
=
UIEdgeInsetsMake
(
5
,
5
,
5
,
0
);
self
.
remarkTextView
.
minNumberOfLines
=
1
;
self
.
remarkTextView
.
maxNumberOfLines
=
2
;
...
...
@@ -97,7 +105,7 @@
self
.
remarkTextView
.
placeholder
=
@"输入备注内容"
;
[
cell
.
contentView
addSubview
:
self
.
remarkTextView
];
}
else
{
UILabel
*
contentLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
0
,
TableHeight
))];
UILabel
*
contentLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
5
,
TableHeight
))];
contentLabel
.
textAlignment
=
NSTextAlignmentRight
;
contentLabel
.
textColor
=
HexColor
(
@"bbbbbb"
);
contentLabel
.
font
=
FontSize
(
TitleSize
);
...
...
@@ -117,13 +125,24 @@
}
else
if
(
indexPath
.
row
==
3
){
contentLabel
.
text
=
@"选择收货仓库"
;
self
.
purchaseStoreLabel
=
contentLabel
;
}
else
if
(
indexPath
.
row
==
5
){
contentLabel
.
text
=
@"0"
;
contentLabel
.
frame
=
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
30
,
TableHeight
);
contentLabel
.
textColor
=
[
UIColor
redColor
];
self
.
purchasePriceLabel
=
contentLabel
;
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
CGRectGetMaxX
(
contentLabel
.
frame
)
+
5
,
0
,
20
,
TableHeight
)];
label
.
text
=
@"元"
;
label
.
textColor
=
HexColor
(
@"444444"
);
label
.
font
=
FontSize
(
TitleSize
);
[
cell
.
contentView
addSubview
:
label
];
}
}
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
2
){
ChooseVendorViewController
*
cvc
=
[
ChooseVendorViewController
new
];
cvc
.
title
=
@"供应商"
;
cvc
.
choseVendor
=
^
(
NSArray
*
vendors
){
if
(
vendors
.
count
>
0
)
{
Vendor
*
vendor
=
vendors
[
0
];
...
...
@@ -134,6 +153,23 @@
};
cvc
.
isMoreChose
=
NO
;
[
self
.
delegate
pushNextViewController
:
cvc
];
}
else
if
(
indexPath
.
row
==
1
){
ChooseTypeViewController
*
tvc
=
[[
ChooseTypeViewController
alloc
]
init
];
tvc
.
title
=
@"类型"
;
tvc
.
dataArr
=
@[
@"普通"
,
@"紧急"
];
tvc
.
choseType
=
^
(
NSString
*
type
){
self
.
purchaseTypeLabel
.
text
=
type
;
self
.
purchaseTypeLabel
.
textColor
=
HexColor
(
@"444444"
);
};
[
self
.
delegate
pushNextViewController
:
tvc
];
}
else
if
(
indexPath
.
row
==
3
){
ChooseWarehouseViewController
*
wvc
=
[[
ChooseWarehouseViewController
alloc
]
init
];
wvc
.
title
=
@"仓库"
;
wvc
.
choseWarehouse
=
^
(
Warehouse
*
warehouse
){
self
.
purchaseStoreLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
warehouse
.
name
,
warehouse
.
code
];
self
.
purchaseStoreLabel
.
textColor
=
HexColor
(
@"444444"
);
};
[
self
.
delegate
pushNextViewController
:
wvc
];
}
}
-
(
BOOL
)
growingTextViewShouldReturn
:
(
HPGrowingTextView
*
)
growingTextView
{
...
...
@@ -144,5 +180,10 @@
[
self
.
delegate
hiddenKeyBoard
];
return
YES
;
}
-
(
void
)
touchesEnded
:
(
NSSet
*
)
touches
withEvent
:
(
UIEvent
*
)
event
{
[
self
.
delegate
hiddenKeyBoard
];
}
@end
XFFruit/ViewControllers/Survey/Views/BoltMaskView.m
View file @
b94eefca
...
...
@@ -108,7 +108,7 @@
self
.
titleFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
10
,
CGRectGetMaxY
(
titleLabel
.
frame
)
+
10
,
(
ScreenSize
.
width
-
LeftMargin
-
10
*
2
),
30
)];
self
.
titleFiled
.
textAlignment
=
NSTextAlignmentLeft
;
self
.
titleFiled
.
textColor
=
HexColor
(
@"444444"
);
self
.
titleFiled
.
placeholder
=
@"输入标题"
;
self
.
titleFiled
.
placeholder
=
@"输入
类似
标题"
;
self
.
titleFiled
.
borderStyle
=
UITextBorderStyleRoundedRect
;
self
.
titleFiled
.
font
=
FontSize
(
15
);
self
.
titleFiled
.
returnKeyType
=
UIReturnKeyDone
;
...
...
@@ -127,7 +127,7 @@
self
.
billFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
10
,
CGRectGetMaxY
(
billLabel
.
frame
)
+
10
,
(
ScreenSize
.
width
-
LeftMargin
-
10
*
2
),
30
)];
self
.
billFiled
.
textAlignment
=
NSTextAlignmentLeft
;
self
.
billFiled
.
textColor
=
HexColor
(
@"444444"
);
self
.
billFiled
.
placeholder
=
@"输入单号"
;
self
.
billFiled
.
placeholder
=
@"输入
类似
单号"
;
self
.
billFiled
.
borderStyle
=
UITextBorderStyleRoundedRect
;
self
.
billFiled
.
font
=
FontSize
(
15
);
self
.
billFiled
.
returnKeyType
=
UIReturnKeyDone
;
...
...
XFFruit/ViewControllers/Survey/Views/SortMaskView.m
View file @
b94eefca
...
...
@@ -28,7 +28,7 @@
if
(
orderDirection
.
length
>
0
)
{
if
([
orderDirection
isEqualToString
:
@"asc"
])
{
_currentIndexPath
=
[
NSIndexPath
indexPathForRow
:
0
inSection
:
0
];
}
else
if
([
orderDirection
isEqualToString
:
@"des"
]){
}
else
if
([
orderDirection
isEqualToString
:
@"des
c
"
]){
_currentIndexPath
=
[
NSIndexPath
indexPathForRow
:
1
inSection
:
0
];
}
else
{
_currentIndexPath
=
[
NSIndexPath
indexPathForRow
:
2
inSection
:
0
];
...
...
XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.m
View file @
b94eefca
...
...
@@ -45,6 +45,9 @@ typedef enum : NSUInteger {
UIDatePicker
*
_timePicker
;
BOOL
_isClickStart
;
StartTimeView
*
_startTimeView
;
id
uuidObject
;
id
billNumberObject
;
NSNumber
*
version
;
}
@property
(
nonatomic
,
strong
)
NSString
*
titleStr
;
@property
(
nonatomic
,
strong
)
NSString
*
productCodeStr
;
...
...
@@ -66,6 +69,7 @@ typedef enum : NSUInteger {
[
self
createTableView
];
}
-
(
void
)
initData
{
_dataArr
=
[
NSMutableArray
array
];
self
.
users
=
[
NSMutableArray
array
];
[
_dataArr
addObject
:
@"标题"
];
...
...
@@ -74,6 +78,9 @@ typedef enum : NSUInteger {
[
_dataArr
addObject
:
@"结束日期"
];
[
_dataArr
addObject
:
@"调研人员"
];
[
_dataArr
addObject
:
@"备注"
];
uuidObject
=
[
NSNull
null
];
billNumberObject
=
[
NSNull
null
];
version
=
[
NSNumber
numberWithInt
:
0
];
}
-
(
void
)
createTableView
...
...
@@ -94,7 +101,6 @@ typedef enum : NSUInteger {
UIButton
*
commitBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
saveBtn
.
frame
.
origin
.
x
+
saveBtn
.
frame
.
size
.
width
+
LeftMargin
,
10
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
BtnHeight
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
CommitTag
image
:
nil
title
:
@"提交"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
CornerRadius
bgColor
:
HexColor
(
@"f69100"
)];
[
footView
addSubview
:
commitBtn
];
[
self
.
view
addSubview
:
footView
];
_tableView
.
tableFooterView
=
footView
;
[
self
.
view
addSubview
:
_tableView
];
}
...
...
@@ -149,12 +155,6 @@ typedef enum : NSUInteger {
SurveyViewController
*
svc
=
[
SurveyViewController
new
];
[
self
PushViewController
:
svc
animated
:
YES
];
}
//
// [self clearAllInformation];
// if (self.survey) {
// [ICRUserUtil sharedInstance].needFresh = YES;
// [self.navigationController popViewControllerAnimated:YES];
// }
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
...
...
@@ -164,16 +164,14 @@ typedef enum : NSUInteger {
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
id
uuidObject
=
[
NSNull
null
];
if
(
self
.
survey
.
uuid
.
length
>
0
){
if
(
self
.
survey
.
uuid
.
length
>
0
&&
uuidObject
==
[
NSNull
null
]
){
uuidObject
=
self
.
survey
.
uuid
;
}
id
billNumberObject
=
[
NSNull
null
];
if
(
self
.
survey
.
billNumber
>
0
)
{
if
(
self
.
survey
.
billNumber
>
0
&&
billNumberObject
==
[
NSNull
null
])
{
billNumberObject
=
self
.
survey
.
billNumber
;
}
NSNumber
*
version
=
[
NSNumber
numberWithLong
:
0
];
if
(
self
.
survey
)
{
if
(
self
.
survey
&&
[
version
integerValue
]
==
0
)
{
version
=
self
.
survey
.
version
;
}
NSDictionary
*
dict
=
@{
@"uuid"
:
uuidObject
,
...
...
@@ -243,7 +241,7 @@ typedef enum : NSUInteger {
-
(
void
)
createViewInCell
:
(
SurveyCell
*
)
cell
indexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
0
)
{
_titleField
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
0
,
TableHeight
)];
_titleField
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
5
,
TableHeight
)];
_titleField
.
textAlignment
=
NSTextAlignmentRight
;
_titleField
.
textColor
=
HexColor
(
@"444444"
);
_titleField
.
placeholder
=
@"输入调研标题"
;
...
...
@@ -256,7 +254,7 @@ typedef enum : NSUInteger {
self
.
titleStr
=
[
IBTCommon
checkString
:
self
.
survey
.
title
];
}
}
else
if
(
indexPath
.
row
==
_dataArr
.
count
-
1
){
_noteTextView
=
[[
HPGrowingTextView
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
0
,
TableHeight
)];
_noteTextView
=
[[
HPGrowingTextView
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
5
,
TableHeight
)];
_noteTextView
.
contentInset
=
UIEdgeInsetsMake
(
5
,
5
,
5
,
0
);
_noteTextView
.
minNumberOfLines
=
1
;
_noteTextView
.
maxNumberOfLines
=
4
;
...
...
@@ -274,7 +272,7 @@ typedef enum : NSUInteger {
lineFrame
.
origin
.
y
=
TableHeight
*
2
-
1
;
cell
.
lineLabel
.
frame
=
lineFrame
;
}
else
{
UILabel
*
contentLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
0
,
TableHeight
))];
UILabel
*
contentLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
1
5
,
TableHeight
))];
contentLabel
.
textAlignment
=
NSTextAlignmentRight
;
contentLabel
.
textColor
=
HexColor
(
@"bbbbbb"
);
contentLabel
.
font
=
FontSize
(
TitleSize
);
...
...
XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m
View file @
b94eefca
...
...
@@ -324,8 +324,6 @@ typedef enum : NSUInteger {
-
(
void
)
hiddenSortMaskView
:
(
BOOL
)
isHide
{
currentBtn
=
nil
;
[
self
checkSortBtnColor
];
// [_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
if
(
isHide
==
NO
)
{
[
_sortView
removeFromSuperview
];
_sortView
=
nil
;
...
...
@@ -345,8 +343,6 @@ typedef enum : NSUInteger {
-
(
void
)
hiddenBoltMaskView
:
(
BOOL
)
isHide
{
currentBtn
=
nil
;
[
self
checkBoltBtnColor
];
// [_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
if
(
isHide
==
NO
)
{
[
_boltView
removeFromSuperview
];
_boltView
=
nil
;
...
...
XFFruit/ViewControllers/WorkSheet/Views/HeaderCell.m
View file @
b94eefca
...
...
@@ -31,7 +31,7 @@
}
-
(
void
)
bulidLayout
{
CGFloat
headWidth
=
(
ScreenSize
.
width
-
LeftWidth
-
Righ
tWidth
-
SpaceMargin
*
(
self
.
arr
.
count
-
1
))
/
self
.
arr
.
count
;
CGFloat
headWidth
=
(
ScreenSize
.
width
-
LeftWidth
-
Lef
tWidth
-
SpaceMargin
*
(
self
.
arr
.
count
-
1
))
/
self
.
arr
.
count
;
for
(
NSInteger
i
=
0
;
i
<
self
.
arr
.
count
;
i
++
)
{
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
LeftWidth
+
(
SpaceMargin
+
headWidth
)
*
i
,
0
,
headWidth
,
self
.
frame
.
size
.
height
)];
label
.
font
=
FontSize
(
TitleSize
);
...
...
XFFruit/en.lproj/Localizable.strings
View file @
b94eefca
...
...
@@ -193,5 +193,7 @@
//行情调研
"AddSurvey" = "新建行情调研";
"AddPurchase" = "新建采购单";
"Purchase" = "采购单";
XFFruit/zh-Hans.lproj/Localizable.strings
View file @
b94eefca
...
...
@@ -177,5 +177,7 @@
"Announcement Detail" = "公告详情";
//行情调研
"Survey" = "行情调研";
"Survey"
= "行情调研";
"AddSurvey" = "新建行情调研";
"AddPurchase" = "新建采购单";
"Purchase" = "采购单";
\ No newline at end of file
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