Commit b94eefca authored by freecui's avatar freecui

merge 首页

parents 182b65ff c21d80e7
This diff is collapsed.
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#import "User.h" #import "User.h"
#import "Survey.h" #import "Survey.h"
#import "Vendor.h" #import "Vendor.h"
#import "Warehouse.h"
#define ICR_DB_ERROR_PARAMETER @"Parse Error: Bad Parameter(s)" #define ICR_DB_ERROR_PARAMETER @"Parse Error: Bad Parameter(s)"
...@@ -95,7 +96,7 @@ static NSString *ICRDataBasePath = @""; ...@@ -95,7 +96,7 @@ static NSString *ICRDataBasePath = @"";
[_m_dbQueue inDatabase:^(FMDatabase *db) { [_m_dbQueue inDatabase:^(FMDatabase *db) {
NSArray *tableNameArr = NSArray *tableNameArr =
@[ [Product class],[User class],[Survey class],[Vendor class]]; @[ [Product class],[User class],[Survey class],[Vendor class],[Warehouse class]];
NSMutableArray *sqlBatch = [NSMutableArray array]; NSMutableArray *sqlBatch = [NSMutableArray array];
NSString *sql = nil; NSString *sql = nil;
......
...@@ -225,7 +225,11 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -225,7 +225,11 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
page_size:(NSUInteger)page_size page_size:(NSUInteger)page_size
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
//仓库
- (void)getWarehouseWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end @end
...@@ -77,7 +77,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) { ...@@ -77,7 +77,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
XFFHttp_ResultChart, XFFHttp_ResultChart,
XFFHttp_GetResults, XFFHttp_GetResults,
//供应商 //供应商
XFFHttp_GetVendor XFFHttp_GetVendor,
//仓库
XFFHttp_GetWarehouse
}; };
static NSString * const ICRHTTPInterface[] = { static NSString * const ICRHTTPInterface[] = {
...@@ -127,14 +129,18 @@ static NSString * const ICRHTTPInterface[] = { ...@@ -127,14 +129,18 @@ static NSString * const ICRHTTPInterface[] = {
//行情调研 //行情调研
[XFFHttp_SurveySave] = @"survey/save_survey", [XFFHttp_SurveySave] = @"survey/save_survey",
[XFFHttp_QuerySurvey] = @"survey/query_survey", [XFFHttp_QuerySurvey] = @"survey/query_survey",
[XFFHttp_GetSurvey] = @"survey/get_survey", [XFFHttp_GetSurvey] = @"survey/get_survey",
[XFFHttp_GetProduct] = @"mdata/product/download", [XFFHttp_GetProduct] = @"mdata/product/download",
[XFFHttp_GetUser] = @"user/download", [XFFHttp_GetUser] = @"user/download",
[XFFHttp_SurveyFinish] = @"survey/finish", [XFFHttp_SurveyFinish] = @"survey/finish",
//行情反馈生成图片 //行情反馈生成图片
[XFFHttp_ResultChart] = @"survey/resultchart", [XFFHttp_ResultChart] = @"survey/resultchart",
[XFFHttp_GetResults] = @"survey/get_results", [XFFHttp_GetResults] = @"survey/get_results",
[XFFHttp_GetVendor] = @"mdata/vendor/download" //供应商
[XFFHttp_GetVendor] = @"data/vendor/download",
//仓库
[XFFHttp_GetWarehouse] = @"data/warehouse/download",
}; };
static NSString * const ICRAttachmentTypeValue[] = { static NSString * const ICRAttachmentTypeValue[] = {
...@@ -1643,16 +1649,61 @@ acceptTypeJson:YES ...@@ -1643,16 +1649,61 @@ acceptTypeJson:YES
fail( error ); fail( error );
} }
}; };
NSString *dateStr = @"2015-05-04";
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetVendor] stringByAppendingFormat:@"?start_date=%@&page_number=%@&page_size=%@", [[NSDate date] httpParameterString],@(page_number),@(page_size)]; NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetVendor] stringByAppendingFormat:@"?startDate=%@&pageNumber=%@&pageSize=%@", dateStr,@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 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 parameters:NULL
needToken:NO needToken:NO
acceptTypeJson:YES acceptTypeJson:YES
success:success success:success
failure:failure]; failure:failure];
} }
@end @end
...@@ -56,8 +56,8 @@ ...@@ -56,8 +56,8 @@
[IBTCommon localizableString:@"Survey1"], [IBTCommon localizableString:@"Survey1"],
[IBTCommon localizableString:@"Survey2"], [IBTCommon localizableString:@"Survey2"],
[IBTCommon localizableString:@"Survey3"], [IBTCommon localizableString:@"Survey3"],
[IBTCommon localizableString:@"Survey4"], [IBTCommon localizableString:@"AddPurchase"],
[IBTCommon localizableString:@"Survey5"], [IBTCommon localizableString:@"Purchase"],
[IBTCommon localizableString:@"Survey6"], [IBTCommon localizableString:@"Survey6"],
[IBTCommon localizableString:@"Survey7"], [IBTCommon localizableString:@"Survey7"],
[IBTCommon localizableString:@"Survey8"],[IBTCommon localizableString:@"Survey9"], [IBTCommon localizableString:@"Survey8"],[IBTCommon localizableString:@"Survey9"],
......
//
// 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
//
// 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
//
// 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
...@@ -32,31 +32,25 @@ ...@@ -32,31 +32,25 @@
- (void)initData{ - (void)initData{
self.dataArr = [NSMutableArray array]; self.dataArr = [NSMutableArray array];
self.indexArr = [NSMutableArray array]; self.indexArr = [NSMutableArray array];
Vendor *v = [[Vendor alloc]init]; [self fetchVendorList];
v.name = @"dddd";
v.code = @"1111";
[self.dataArr addObject:v];
// [self fetchVendorList];
// __weak typeof(self)weakSelf = self; __weak typeof(self)weakSelf = self;
// void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
// [IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
// if (data) { if (data) {
// __strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf)strongSelf = weakSelf;
// [strongSelf fetchVendorList]; [strongSelf fetchVendorList];
// }else{ }else{
// [IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
// } }
// }; };
//
// void(^fail)(id) = ^(id data) { void(^fail)(id) = ^(id data) {
// [IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
// [IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
// __strong __typeof(weakSelf)strongSelf = weakSelf; };
// [strongSelf fetchVendorList]; [IBTLoadingView showProgressLabel:@"正在加载..."];
// }; [[ICRHTTPController sharedController] getVendorWithPage_number:0 page_size:100 success:succ failure:fail];
// [IBTLoadingView showProgressLabel:@"正在加载..."];
// [[ICRHTTPController sharedController] getVendorWithPage_number:0 page_size:100 success:succ failure:fail];
} }
#pragma mark -成功 #pragma mark -成功
......
//
// 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
//
// 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
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#import "NewPurchaseViewController.h" #import "NewPurchaseViewController.h"
#import "TopPurchaseView.h" #import "TopPurchaseView.h"
#import "ProductViewController.h" #import "ProductViewController.h"
#import "AddProductViewController.h"
#define TopHeight 284 #define TopHeight 328
#define BottomHeight 300 #define BottomHeight 300
#define SpaceHeight 20 #define SpaceHeight 20
#define BottomViewHeight 60 #define BottomViewHeight 60
...@@ -20,12 +20,13 @@ typedef enum : NSUInteger { ...@@ -20,12 +20,13 @@ typedef enum : NSUInteger {
CommitTag, CommitTag,
} BtnTag; } BtnTag;
@interface NewPurchaseViewController ()<TopPurchaseViewDelegate> @interface NewPurchaseViewController ()<TopPurchaseViewDelegate,ProductViewDelegate>
{ {
UIScrollView *_scrollView; UIScrollView *_scrollView;
TopPurchaseView *_purchaseView; TopPurchaseView *_purchaseView;
UIView *_bottomView; UIView *_bottomView;
ProductViewController *_pvc ; ProductViewController *_pvc ;
AddProductViewController *_avc;
} }
@end @end
...@@ -67,6 +68,7 @@ typedef enum : NSUInteger { ...@@ -67,6 +68,7 @@ typedef enum : NSUInteger {
[_scrollView addSubview:_bottomView]; [_scrollView addSubview:_bottomView];
_pvc = [[ProductViewController alloc]init]; _pvc = [[ProductViewController alloc]init];
_pvc.delegate = self;
_pvc.viewFrame = _bottomView.bounds; _pvc.viewFrame = _bottomView.bounds;
[_bottomView addSubview:_pvc.view]; [_bottomView addSubview:_pvc.view];
...@@ -76,16 +78,30 @@ typedef enum : NSUInteger { ...@@ -76,16 +78,30 @@ typedef enum : NSUInteger {
} }
#pragma mark - TopPurchaseViewDelegate
- (void)pushNextViewController:(id)vc{ - (void)pushNextViewController:(id)vc{
[self PushViewController:vc animated:YES]; [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 - 协议方法 #pragma mark - 协议方法
- (void)hiddenKeyBoard{ - (void)hiddenKeyBoard{
[self keyboardHidden]; [self keyboardHidden];
} }
- (void)keyboardHidden{ - (void)keyboardHidden{
[_purchaseView.purchasePriceFiled resignFirstResponder]; [_purchaseView.otherPriceFiled resignFirstResponder];
[_purchaseView.remarkTextView resignFirstResponder]; [_purchaseView.remarkTextView resignFirstResponder];
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
......
...@@ -7,10 +7,15 @@ ...@@ -7,10 +7,15 @@
// //
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
@protocol ProductViewDelegate <NSObject>
- (void)pushViewController:(id)cvc selfController:(id)avc;
@end
@interface ProductViewController : ICRBaseViewController @interface ProductViewController : ICRBaseViewController
@property (nonatomic,strong)NSMutableArray *productArr; @property (nonatomic,strong)NSMutableArray *productArr;
@property (nonatomic,strong)UITableView *tableView; @property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,assign)CGRect viewFrame; @property (nonatomic,assign)CGRect viewFrame;
@property (nonatomic,assign)BOOL isHiddenEdit; @property (nonatomic,assign)BOOL isHiddenEdit;
@property (nonatomic,weak)id<ProductViewDelegate>delegate;
@end @end
...@@ -10,12 +10,14 @@ ...@@ -10,12 +10,14 @@
#import "FooterCell.h" #import "FooterCell.h"
#import "HeaderCell.h" #import "HeaderCell.h"
#import "ProductCell.h" #import "ProductCell.h"
#import "AddProductViewController.h"
#define TableHeight 44 #define TableHeight 44
@interface ProductViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate> @interface ProductViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate,AddProductViewDelegate>
{ {
CGRect _tableFrame; CGRect _tableFrame;
NSMutableArray *_selectRowArr;//记录当前选中的cell NSMutableArray *_selectRowArr;//记录当前选中的cell
AddProductViewController *_avc;
} }
@end @end
...@@ -60,10 +62,34 @@ ...@@ -60,10 +62,34 @@
self.tableView.tableFooterView = footCell; self.tableView.tableFooterView = footCell;
} }
} }
#pragma mark - footerDelegate
- (void)addClick{ - (void)addClick{
[self.productArr addObject:@"dddd"]; // [self.productArr addObject:@"dddd"];
[self.tableView reloadData]; // [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 - 协议方法 #pragma mark - 协议方法
...@@ -102,6 +128,8 @@ ...@@ -102,6 +128,8 @@
cell.showView.frame = showfrmame; cell.showView.frame = showfrmame;
cell.backgroundColor = [UIColor whiteColor]; cell.backgroundColor = [UIColor whiteColor];
} }
cell.editBtn.tag = indexPath.row;
[cell.editBtn addTarget:self action:@selector(editClick:) forControlEvents:UIControlEventTouchUpInside];
return cell; return cell;
} }
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{ - (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
...@@ -122,14 +150,12 @@ ...@@ -122,14 +150,12 @@
Linefrmame.origin.y = 200-1; Linefrmame.origin.y = 200-1;
showfrmame.size.height = 150; showfrmame.size.height = 150;
// cell.showView.hidden = NO;
cell.backgroundColor = [UIColor whiteColor]; cell.backgroundColor = [UIColor whiteColor];
[_selectRowArr addObject:indexPath]; [_selectRowArr addObject:indexPath];
}else{ }else{
cell.smallImageView.image = [UIImage imageNamed:@"arrowright"]; cell.smallImageView.image = [UIImage imageNamed:@"arrowright"];
Linefrmame.origin.y = TableHeight -1; Linefrmame.origin.y = TableHeight -1;
showfrmame.size.height = 0; showfrmame.size.height = 0;
// cell.showView.hidden = YES;
cell.backgroundColor = [UIColor whiteColor]; cell.backgroundColor = [UIColor whiteColor];
[_selectRowArr removeObject:indexPath]; [_selectRowArr removeObject:indexPath];
} }
...@@ -137,14 +163,20 @@ ...@@ -137,14 +163,20 @@
cell.showView.frame = showfrmame; cell.showView.frame = showfrmame;
[self.tableView reloadData]; [self.tableView reloadData];
} }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if ([self isHaveIndexPath:indexPath]) { if ([self isHaveIndexPath:indexPath]) {
return 200; return 200;
} }
return TableHeight; return TableHeight;
} }
- (void)editClick:(UIButton *)btn{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"哈哈" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
...@@ -11,5 +11,7 @@ ...@@ -11,5 +11,7 @@
@interface PurchaseDetailViewController : ICRBaseViewController @interface PurchaseDetailViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseBill *bill; @property (nonatomic,strong)PurchaseBill *bill;
//模拟三个人员
@property (nonatomic,assign)NSInteger indexPerson;//0.1.2
@end @end
...@@ -10,25 +10,47 @@ ...@@ -10,25 +10,47 @@
#import "ProductViewController.h" #import "ProductViewController.h"
#define BottomHeight 50 #define BottomHeight 50
#define LeftMargin 20 #define LeftMargin 15
#define LeftWidth 100 #define LeftWidth 100
#define LeftHeight 30 #define LeftHeight 30
#define TopMargin 15 #define TopMargin 15
typedef enum : NSUInteger {
CancleTag = 3500,
RejectTag,
PassTag,
SureTag
} BtnTag;
@interface PurchaseDetailViewController () @interface PurchaseDetailViewController ()
{ {
UIScrollView *_scrollView; UIScrollView *_scrollView;
UIView *_purchaseView; UIView *_purchaseView;
UIView *_bottomView; UIView *_bottomView;
ProductViewController *_pvc; ProductViewController *_pvc;
NSArray *_leftArr;
UIButton *_endBtn;
UIButton *_rejectBtn;
} }
@property (nonatomic,strong)UILabel *billNumberLabel; @property (nonatomic,strong)UILabel *billNumberLabel;
@property (nonatomic,strong)UILabel *noticeNumberLabel; @property (nonatomic,strong)UILabel *noticeNumberLabel;
@property (nonatomic,strong)UILabel *createOperNameLabel; @property (nonatomic,strong)UILabel *createOperNameLabel;
@property (nonatomic,strong)UILabel *checkNameLabel; @property (nonatomic,strong)UILabel *checkNameLabel;
@property (nonatomic,strong)UILabel *stateLabel; @property (nonatomic,strong)UILabel *stateLabel;
@property (nonatomic,strong)UILabel *lastModifyNameLabel;
@property (nonatomic,strong)UILabel *typeLabel;
@property (nonatomic,strong)UILabel *vendorNameLabel; @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 *totalPriceLabel;
@property (nonatomic,strong)UILabel *noteLabel; @property (nonatomic,strong)UILabel *noteLabel;
@end @end
@implementation PurchaseDetailViewController @implementation PurchaseDetailViewController
...@@ -48,69 +70,125 @@ ...@@ -48,69 +70,125 @@
_scrollView.showsVerticalScrollIndicator = NO; _scrollView.showsVerticalScrollIndicator = NO;
_scrollView.backgroundColor = HexColor(@"f8f8f8"); _scrollView.backgroundColor = HexColor(@"f8f8f8");
[self.view addSubview:_scrollView]; [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")]; _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]; [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]; _purchaseView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_purchaseView]; [_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)]; UILabel *leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, 10 + LeftHeight *i, LeftWidth, LeftHeight)];
leftLabel.font = FontSize(17); leftLabel.font = FontSize(17);
leftLabel.text = leftArr[i]; leftLabel.text = _leftArr[i];
leftLabel.textColor = HexColor(@"888888"); leftLabel.textColor = HexColor(@"888888");
[_purchaseView addSubview:leftLabel]; [_purchaseView addSubview:leftLabel];
UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), 10 + LeftHeight *i, _purchaseView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)]; UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), 10 + LeftHeight *i, _purchaseView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)];
rightLabel.font = FontSize(17); rightLabel.font = FontSize(17);
rightLabel.textColor = HexColor(@"888888"); rightLabel.textColor = HexColor(@"888888");
if (i == 0) { if (i == 0) {
self.billNumberLabel = rightLabel; self.billNumberLabel = rightLabel;
}else if (i == 1) { }else if (i == 1) {
self.noticeNumberLabel = rightLabel; self.noticeNumberLabel = rightLabel;
}else if(i == 2){ }else if(i == 2){
self.createOperNameLabel = rightLabel; self.createOperNameLabel = rightLabel;
}else if(i == 3){ }else if(i == _leftArr.count - 3){
self.checkNameLabel = rightLabel; self.otherPriceLabel = rightLabel;
}else if(i == 4){ }else if(i == _leftArr.count - 2){
self.stateLabel = rightLabel;
}else if(i == 5){
self.vendorNameLabel = rightLabel;
}else if(i == 6){
self.totalPriceLabel = rightLabel; self.totalPriceLabel = rightLabel;
}else if(i == 7){ }else if(i == _leftArr.count - 1){
rightLabel.numberOfLines = 0; rightLabel.numberOfLines = 0;
self.noteLabel = rightLabel; 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]; [_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{ - (void)fetchtPurchaseDetail{
...@@ -138,8 +216,15 @@ ...@@ -138,8 +216,15 @@
self.createOperNameLabel.text = [IBTCommon checkString:self.bill.create_operName]; self.createOperNameLabel.text = [IBTCommon checkString:self.bill.create_operName];
self.checkNameLabel.text = [IBTCommon checkString:self.bill.vendor_name]; self.checkNameLabel.text = [IBTCommon checkString:self.bill.vendor_name];
self.vendorNameLabel.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.noteLabel.text = [IBTCommon checkString:self.bill.remark];
self.lastModifyNameLabel.text = @"最后修改人";
self.typeLabel.text = @"类型";
self.vendorIsSureLabel.text = @"是否确认";
self.warehouseLabel.text = @"仓库";
self.otherPriceLabel.text = @"其他费用";
[self setNoteHeight]; [self setNoteHeight];
} }
...@@ -151,7 +236,7 @@ ...@@ -151,7 +236,7 @@
noteFrame.size.height = height; noteFrame.size.height = height;
self.noteLabel.frame = noteFrame; self.noteLabel.frame = noteFrame;
CGFloat totalHeight = height + LeftHeight*8; CGFloat totalHeight = height + LeftHeight*_leftArr.count;
CGRect purchaseFrame = _purchaseView.frame; CGRect purchaseFrame = _purchaseView.frame;
purchaseFrame.size.height = totalHeight; purchaseFrame.size.height = totalHeight;
_purchaseView.frame = purchaseFrame; _purchaseView.frame = purchaseFrame;
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
#import "PurchaseBill.h" #import "PurchaseBill.h"
#import "PurchaseDetailViewController.h" #import "PurchaseDetailViewController.h"
#import "SortMaskView.h"
#import "PurchaseBoltView.h"
#define TopMargin 44 #define TopMargin 44
#define TableHeight 120 #define TableHeight 120
#define LeftMargin 20 #define LeftMargin 20
...@@ -23,16 +26,22 @@ typedef enum : NSUInteger { ...@@ -23,16 +26,22 @@ typedef enum : NSUInteger {
BoltTag BoltTag
} BtnTag; } BtnTag;
@interface PurchaseViewController ()<UITableViewDataSource,UITableViewDelegate> @interface PurchaseViewController ()<UITableViewDataSource,UITableViewDelegate,PurchaseViewDelegate,SortMaskViewDelegate>
{ {
UIView *_maskView; UIView *_maskView;
UIButton *currentBtn; UIButton *currentBtn;
SortMaskView *_sortView;
PurchaseBoltView *_boltView;
UIBarButtonItem *_sureBtn; UIBarButtonItem *_sureBtn;
UIButton *_sortBtn; UIButton *_sortBtn;
UIButton *_boltBtn; UIButton *_boltBtn;
} }
@property (nonatomic,strong)NSMutableArray *dataArr; @property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView; @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 @end
@implementation PurchaseViewController @implementation PurchaseViewController
...@@ -48,12 +57,14 @@ typedef enum : NSUInteger { ...@@ -48,12 +57,14 @@ typedef enum : NSUInteger {
for (NSInteger i = 0; i < 6; i++) { for (NSInteger i = 0; i < 6; i++) {
PurchaseBill *bill = [PurchaseBill new]; PurchaseBill *bill = [PurchaseBill new];
bill.billNumber = @"222222222"; bill.billNumber = @"222222222";
bill.noticeNumber = @"134594059654 0504门店补货0002"; bill.noticeNumber = @"134594059654";
bill.create_operName = @"张三"; bill.create_operName = @"创建人";
bill.create_time = @"2013-03-04"; bill.create_time = @"2013-03-04";
bill.vendor_name = @"haha"; bill.vendor_name = @"供应商";
bill.total = @"200元"; bill.total = @"总金额";
bill.remark = @"hahahah"; bill.remark = @"备注";
bill.lastModified_operName = @"最后修改人";
bill.vendorConfirmTime = @"否";
if (i == 0) { if (i == 0) {
bill.state = @"initial"; bill.state = @"initial";
}else if(i == 1){ }else if(i == 1){
...@@ -97,10 +108,158 @@ typedef enum : NSUInteger { ...@@ -97,10 +108,158 @@ typedef enum : NSUInteger {
#pragma mark -按钮事件 #pragma mark -按钮事件
- (void)sortClick:(UIButton *)btn{ - (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 - 确定 #pragma mark - 确定
- (void)sureClick{ - (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 - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1; return 1;
...@@ -127,6 +286,13 @@ typedef enum : NSUInteger { ...@@ -127,6 +286,13 @@ typedef enum : NSUInteger {
PurchaseDetailViewController *pvc = [PurchaseDetailViewController new]; PurchaseDetailViewController *pvc = [PurchaseDetailViewController new];
pvc.title = @"查看采购单"; pvc.title = @"查看采购单";
pvc.bill = _dataArr[indexPath.row]; 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]; [self PushViewController:pvc animated:YES];
} }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
@interface PurchaseBill : IBTModel @interface PurchaseBill : IBTModel
@property (nonatomic,strong)NSString *uuid;//唯一标识 @property (nonatomic,strong)NSString *uuid;//唯一标识
@property (nonatomic,strong)NSString *version;//版本 @property (nonatomic,strong)NSString *version;//版本
@property (nonatomic,strong)NSString *noticeUuid;//采购通知单uuid @property (nonatomic,strong)NSString *noticeUuid;//采购通知单uuid
@property (nonatomic,strong)NSString *noticeNumber;//采购通知单号 @property (nonatomic,strong)NSString *noticeNumber;//采购通知单号
@property (nonatomic,strong)NSString *billNumber;//采购单号 @property (nonatomic,strong)NSString *billNumber;//采购单号
...@@ -28,7 +27,7 @@ ...@@ -28,7 +27,7 @@
@property (nonatomic,strong)NSString *create_operName;//创建人名称 @property (nonatomic,strong)NSString *create_operName;//创建人名称
@property (nonatomic,strong)NSString *lastModified_time;//最后修改时间 @property (nonatomic,strong)NSString *lastModified_time;//最后修改时间
@property (nonatomic,strong)NSString *lastModified_id;//最后修改人代码 @property (nonatomic,strong)NSString *lastModified_id;//最后修改人代码
@property (nonatomic,strong)NSString *astModified_operName;//最后修改人名称 @property (nonatomic,strong)NSString *lastModified_operName;//最后修改人名称
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// //
// Created by 陈俊俊 on 15/8/23. // Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved. // Copyright (c) 2015年 Xummer. All rights reserved.
// // 供应商
#import "IBTModel.h" #import "IBTModel.h"
......
//
// 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
//
// 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
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
- (void)bulidLayout - (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 = [[UIImageView alloc]initWithFrame:CGRectMake(LeftMargin, (TableHeight - SmallSize)/2 , SmallSize, SmallSize)];
self.smallImageView.image = [UIImage imageNamed:@"arrowright"]; self.smallImageView.image = [UIImage imageNamed:@"arrowright"];
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.editBtn setImage:[UIImage imageNamed:@"edit"] forState:UIControlStateNormal]; [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.editBtn.contentMode = UIViewContentModeScaleAspectFit;
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin * 2, 1))];; self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin * 2, 1))];;
......
//
// 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
This diff is collapsed.
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
@property (nonatomic,strong)UILabel *purchaseTypeLabel;//类型 @property (nonatomic,strong)UILabel *purchaseTypeLabel;//类型
@property (nonatomic,strong)UILabel *purchaseSupplierLabel;//供应商 @property (nonatomic,strong)UILabel *purchaseSupplierLabel;//供应商
@property (nonatomic,strong)UILabel *purchaseStoreLabel;//收货仓库 @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,strong)HPGrowingTextView *remarkTextView;//备注
@property (nonatomic,weak)id <TopPurchaseViewDelegate>delegate; @property (nonatomic,weak)id <TopPurchaseViewDelegate>delegate;
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#import "SurveyCell.h" #import "SurveyCell.h"
#import "ChooseVendorViewController.h" #import "ChooseVendorViewController.h"
#import "ChooseTypeViewController.h"
#import "ChooseWarehouseViewController.h"
#import "Vendor.h" #import "Vendor.h"
#define LeftMargin 15 #define LeftMargin 15
#define TopMargin 20 #define TopMargin 20
...@@ -41,7 +43,7 @@ ...@@ -41,7 +43,7 @@
{ {
self.backgroundColor = XXFBgColor; self.backgroundColor = XXFBgColor;
_dataArr = [NSMutableArray array]; _dataArr = [NSMutableArray array];
NSArray *arr = @[@"采购通知:",@"类型:",@"供应商:",@"收货仓库:",@"总金额:",@"备注:"]; NSArray *arr = @[@"采购通知:",@"类型:",@"供应商:",@"收货仓库:",@"其他费用:",@"总金额:",@"备注:"];
[_dataArr addObjectsFromArray:arr]; [_dataArr addObjectsFromArray:arr];
_tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,self.frame.size.width, self.frame.size.height - TopMargin)) style:(UITableViewStylePlain)]; _tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,self.frame.size.width, self.frame.size.height - TopMargin)) style:(UITableViewStylePlain)];
...@@ -65,7 +67,7 @@ ...@@ -65,7 +67,7 @@
cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone; tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.row !=4 && indexPath.row != 5) { if (indexPath.row !=4 && indexPath.row != 5 && indexPath.row != 6) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
} }
[self createViewInCell:cell indexPath:indexPath]; [self createViewInCell:cell indexPath:indexPath];
...@@ -75,18 +77,24 @@ ...@@ -75,18 +77,24 @@
} }
- (void)createViewInCell:(SurveyCell *)cell indexPath:(NSIndexPath *)indexPath{ - (void)createViewInCell:(SurveyCell *)cell indexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 4 ) { if (indexPath.row == 4 ) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)]; UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-30, TableHeight)];
textField.textAlignment = NSTextAlignmentRight; textField.textAlignment = NSTextAlignmentRight;
textField.textColor = HexColor(@"444444"); textField.textColor = HexColor(@"444444");
textField.font = FontSize(15); textField.font = FontSize(15);
textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
textField.returnKeyType = UIReturnKeyDone; textField.returnKeyType = UIReturnKeyDone;
textField.delegate = self; textField.delegate = self;
[cell.contentView addSubview:textField]; [cell.contentView addSubview:textField];
self.purchasePriceFiled = textField; self.otherPriceFiled = textField;
self.purchasePriceFiled.placeholder = @"请输总金额"; 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){ }else if (indexPath.row == _dataArr.count -1){
self.remarkTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)]; self.remarkTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight)];
self.remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0); self.remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
self.remarkTextView.minNumberOfLines = 1; self.remarkTextView.minNumberOfLines = 1;
self.remarkTextView.maxNumberOfLines = 2; self.remarkTextView.maxNumberOfLines = 2;
...@@ -97,7 +105,7 @@ ...@@ -97,7 +105,7 @@
self.remarkTextView.placeholder = @"输入备注内容"; self.remarkTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:self.remarkTextView]; [cell.contentView addSubview:self.remarkTextView];
}else{ }else{
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))]; UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight; contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = HexColor(@"bbbbbb"); contentLabel.textColor = HexColor(@"bbbbbb");
contentLabel.font = FontSize(TitleSize); contentLabel.font = FontSize(TitleSize);
...@@ -117,13 +125,24 @@ ...@@ -117,13 +125,24 @@
}else if(indexPath.row == 3){ }else if(indexPath.row == 3){
contentLabel.text = @"选择收货仓库"; contentLabel.text = @"选择收货仓库";
self.purchaseStoreLabel = contentLabel; 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{ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 2){ if(indexPath.row == 2){
ChooseVendorViewController *cvc = [ChooseVendorViewController new]; ChooseVendorViewController *cvc = [ChooseVendorViewController new];
cvc.title = @"供应商";
cvc.choseVendor = ^(NSArray *vendors){ cvc.choseVendor = ^(NSArray *vendors){
if (vendors.count > 0) { if (vendors.count > 0) {
Vendor *vendor = vendors[0]; Vendor *vendor = vendors[0];
...@@ -134,6 +153,23 @@ ...@@ -134,6 +153,23 @@
}; };
cvc.isMoreChose = NO; cvc.isMoreChose = NO;
[self.delegate pushNextViewController:cvc]; [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{ - (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
...@@ -144,5 +180,10 @@ ...@@ -144,5 +180,10 @@
[self.delegate hiddenKeyBoard]; [self.delegate hiddenKeyBoard];
return YES; return YES;
} }
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[self.delegate hiddenKeyBoard];
}
@end @end
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
self.titleFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(titleLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)]; self.titleFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(titleLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
self.titleFiled.textAlignment = NSTextAlignmentLeft; self.titleFiled.textAlignment = NSTextAlignmentLeft;
self.titleFiled.textColor = HexColor(@"444444"); self.titleFiled.textColor = HexColor(@"444444");
self.titleFiled.placeholder = @"输入标题"; self.titleFiled.placeholder = @"输入类似标题";
self.titleFiled.borderStyle = UITextBorderStyleRoundedRect; self.titleFiled.borderStyle = UITextBorderStyleRoundedRect;
self.titleFiled.font = FontSize(15); self.titleFiled.font = FontSize(15);
self.titleFiled.returnKeyType = UIReturnKeyDone; self.titleFiled.returnKeyType = UIReturnKeyDone;
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
self.billFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(billLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)]; self.billFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(billLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
self.billFiled.textAlignment = NSTextAlignmentLeft; self.billFiled.textAlignment = NSTextAlignmentLeft;
self.billFiled.textColor = HexColor(@"444444"); self.billFiled.textColor = HexColor(@"444444");
self.billFiled.placeholder = @"输入单号"; self.billFiled.placeholder = @"输入类似单号";
self.billFiled.borderStyle = UITextBorderStyleRoundedRect; self.billFiled.borderStyle = UITextBorderStyleRoundedRect;
self.billFiled.font = FontSize(15); self.billFiled.font = FontSize(15);
self.billFiled.returnKeyType = UIReturnKeyDone; self.billFiled.returnKeyType = UIReturnKeyDone;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
if (orderDirection.length >0) { if (orderDirection.length >0) {
if ([orderDirection isEqualToString:@"asc"]) { if ([orderDirection isEqualToString:@"asc"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0]; _currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
}else if ([orderDirection isEqualToString:@"des"]){ }else if ([orderDirection isEqualToString:@"desc"]){
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0]; _currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}else{ }else{
_currentIndexPath = [NSIndexPath indexPathForRow:2 inSection:0]; _currentIndexPath = [NSIndexPath indexPathForRow:2 inSection:0];
......
...@@ -45,6 +45,9 @@ typedef enum : NSUInteger { ...@@ -45,6 +45,9 @@ typedef enum : NSUInteger {
UIDatePicker *_timePicker; UIDatePicker *_timePicker;
BOOL _isClickStart; BOOL _isClickStart;
StartTimeView *_startTimeView; StartTimeView *_startTimeView;
id uuidObject;
id billNumberObject;
NSNumber *version;
} }
@property (nonatomic,strong)NSString *titleStr; @property (nonatomic,strong)NSString *titleStr;
@property (nonatomic,strong)NSString *productCodeStr; @property (nonatomic,strong)NSString *productCodeStr;
...@@ -66,6 +69,7 @@ typedef enum : NSUInteger { ...@@ -66,6 +69,7 @@ typedef enum : NSUInteger {
[self createTableView]; [self createTableView];
} }
- (void)initData{ - (void)initData{
_dataArr = [NSMutableArray array]; _dataArr = [NSMutableArray array];
self.users = [NSMutableArray array]; self.users = [NSMutableArray array];
[_dataArr addObject:@"标题"]; [_dataArr addObject:@"标题"];
...@@ -74,6 +78,9 @@ typedef enum : NSUInteger { ...@@ -74,6 +78,9 @@ typedef enum : NSUInteger {
[_dataArr addObject:@"结束日期"]; [_dataArr addObject:@"结束日期"];
[_dataArr addObject:@"调研人员"]; [_dataArr addObject:@"调研人员"];
[_dataArr addObject:@"备注"]; [_dataArr addObject:@"备注"];
uuidObject = [NSNull null];
billNumberObject = [NSNull null];
version = [NSNumber numberWithInt:0];
} }
- (void)createTableView - (void)createTableView
...@@ -94,7 +101,6 @@ typedef enum : NSUInteger { ...@@ -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")]; 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]; [footView addSubview:commitBtn];
[self.view addSubview:footView];
_tableView.tableFooterView = footView; _tableView.tableFooterView = footView;
[self.view addSubview:_tableView]; [self.view addSubview:_tableView];
} }
...@@ -149,12 +155,6 @@ typedef enum : NSUInteger { ...@@ -149,12 +155,6 @@ typedef enum : NSUInteger {
SurveyViewController *svc = [SurveyViewController new]; SurveyViewController *svc = [SurveyViewController new];
[self PushViewController:svc animated:YES]; [self PushViewController:svc animated:YES];
} }
//
// [self clearAllInformation];
// if (self.survey) {
// [ICRUserUtil sharedInstance].needFresh = YES;
// [self.navigationController popViewControllerAnimated:YES];
// }
}else{ }else{
[IBTLoadingView showTips:message]; [IBTLoadingView showTips:message];
} }
...@@ -164,16 +164,14 @@ typedef enum : NSUInteger { ...@@ -164,16 +164,14 @@ typedef enum : NSUInteger {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data]; [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; uuidObject = self.survey.uuid;
} }
id billNumberObject = [NSNull null]; if (self.survey.billNumber > 0 && billNumberObject == [NSNull null]) {
if (self.survey.billNumber > 0) {
billNumberObject = self.survey.billNumber; billNumberObject = self.survey.billNumber;
} }
NSNumber *version = [NSNumber numberWithLong:0]; if (self.survey && [version integerValue] == 0) {
if (self.survey) {
version = self.survey.version; version = self.survey.version;
} }
NSDictionary *dict = @{@"uuid":uuidObject, NSDictionary *dict = @{@"uuid":uuidObject,
...@@ -243,7 +241,7 @@ typedef enum : NSUInteger { ...@@ -243,7 +241,7 @@ typedef enum : NSUInteger {
- (void)createViewInCell:(SurveyCell *)cell indexPath:(NSIndexPath *)indexPath{ - (void)createViewInCell:(SurveyCell *)cell indexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0) { if (indexPath.row == 0) {
_titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)]; _titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight)];
_titleField.textAlignment = NSTextAlignmentRight; _titleField.textAlignment = NSTextAlignmentRight;
_titleField.textColor = HexColor(@"444444"); _titleField.textColor = HexColor(@"444444");
_titleField.placeholder = @"输入调研标题"; _titleField.placeholder = @"输入调研标题";
...@@ -256,7 +254,7 @@ typedef enum : NSUInteger { ...@@ -256,7 +254,7 @@ typedef enum : NSUInteger {
self.titleStr = [IBTCommon checkString:self.survey.title]; self.titleStr = [IBTCommon checkString:self.survey.title];
} }
}else if (indexPath.row == _dataArr.count -1){ }else if (indexPath.row == _dataArr.count -1){
_noteTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)]; _noteTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight)];
_noteTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0); _noteTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
_noteTextView.minNumberOfLines = 1; _noteTextView.minNumberOfLines = 1;
_noteTextView.maxNumberOfLines = 4; _noteTextView.maxNumberOfLines = 4;
...@@ -274,7 +272,7 @@ typedef enum : NSUInteger { ...@@ -274,7 +272,7 @@ typedef enum : NSUInteger {
lineFrame.origin.y = TableHeight*2-1; lineFrame.origin.y = TableHeight*2-1;
cell.lineLabel.frame = lineFrame; cell.lineLabel.frame = lineFrame;
}else{ }else{
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))]; UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight; contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = HexColor(@"bbbbbb"); contentLabel.textColor = HexColor(@"bbbbbb");
contentLabel.font = FontSize(TitleSize); contentLabel.font = FontSize(TitleSize);
......
...@@ -324,8 +324,6 @@ typedef enum : NSUInteger { ...@@ -324,8 +324,6 @@ typedef enum : NSUInteger {
- (void)hiddenSortMaskView:(BOOL)isHide{ - (void)hiddenSortMaskView:(BOOL)isHide{
currentBtn = nil; currentBtn = nil;
[self checkSortBtnColor]; [self checkSortBtnColor];
// [_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
if (isHide == NO) { if (isHide == NO) {
[_sortView removeFromSuperview]; [_sortView removeFromSuperview];
_sortView = nil; _sortView = nil;
...@@ -345,8 +343,6 @@ typedef enum : NSUInteger { ...@@ -345,8 +343,6 @@ typedef enum : NSUInteger {
- (void)hiddenBoltMaskView:(BOOL)isHide{ - (void)hiddenBoltMaskView:(BOOL)isHide{
currentBtn = nil; currentBtn = nil;
[self checkBoltBtnColor]; [self checkBoltBtnColor];
// [_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
if (isHide == NO) { if (isHide == NO) {
[_boltView removeFromSuperview]; [_boltView removeFromSuperview];
_boltView = nil; _boltView = nil;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
} }
- (void)bulidLayout{ - (void)bulidLayout{
CGFloat headWidth = (ScreenSize.width - LeftWidth - RightWidth - SpaceMargin* (self.arr.count -1))/self.arr.count; CGFloat headWidth = (ScreenSize.width - LeftWidth - LeftWidth - SpaceMargin* (self.arr.count -1))/self.arr.count;
for (NSInteger i = 0; i < self.arr.count; i++) { 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)]; UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i, 0, headWidth, self.frame.size.height)];
label.font = FontSize(TitleSize); label.font = FontSize(TitleSize);
......
...@@ -193,5 +193,7 @@ ...@@ -193,5 +193,7 @@
//行情调研 //行情调研
"AddSurvey" = "新建行情调研"; "AddSurvey" = "新建行情调研";
"AddPurchase" = "新建采购单";
"Purchase" = "采购单";
...@@ -177,5 +177,7 @@ ...@@ -177,5 +177,7 @@
"Announcement Detail" = "公告详情"; "Announcement Detail" = "公告详情";
//行情调研 //行情调研
"Survey" = "行情调研"; "Survey" = "行情调研";
"AddSurvey" = "新建行情调研"; "AddSurvey" = "新建行情调研";
"AddPurchase" = "新建采购单";
"Purchase" = "采购单";
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment