Commit 534bb720 authored by n22's avatar n22

采购单详情

parent 27f380e1
......@@ -365,6 +365,10 @@
FE2FCC821B745E1A00BBC6FB /* SurveyDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC811B745E1A00BBC6FB /* SurveyDetailViewController.m */; };
FE2FCC881B7492C500BBC6FB /* ResultDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC871B7492C500BBC6FB /* ResultDetailViewController.m */; };
FE2FCC8B1B74A9EE00BBC6FB /* SurveyResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */; };
FE4678AA1B8D60F900B5EDA3 /* ChooseTypeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4678A91B8D60F900B5EDA3 /* ChooseTypeViewController.m */; };
FE4678AD1B8D636300B5EDA3 /* ChooseWarehouseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4678AC1B8D636300B5EDA3 /* ChooseWarehouseViewController.m */; };
FE4678B01B8D63A100B5EDA3 /* Warehouse.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4678AF1B8D63A100B5EDA3 /* Warehouse.m */; };
FE4678B61B8D986900B5EDA3 /* PurchaseBoltView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4678B51B8D986900B5EDA3 /* PurchaseBoltView.m */; };
FE4F17251B72FAAB00924DED /* ChosePersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */; };
FE7155D91B7B328400595B0A /* Product.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7155D81B7B328400595B0A /* Product.m */; };
FEA2F2FD1B8423B900D64735 /* BottomSheetView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F2FC1B8423B900D64735 /* BottomSheetView.m */; };
......@@ -801,6 +805,14 @@
FE2FCC871B7492C500BBC6FB /* ResultDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultDetailViewController.m; sourceTree = "<group>"; };
FE2FCC891B74A9EE00BBC6FB /* SurveyResultCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SurveyResultCell.h; sourceTree = "<group>"; };
FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveyResultCell.m; sourceTree = "<group>"; };
FE4678A81B8D60F900B5EDA3 /* ChooseTypeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChooseTypeViewController.h; sourceTree = "<group>"; };
FE4678A91B8D60F900B5EDA3 /* ChooseTypeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChooseTypeViewController.m; sourceTree = "<group>"; };
FE4678AB1B8D636300B5EDA3 /* ChooseWarehouseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChooseWarehouseViewController.h; sourceTree = "<group>"; };
FE4678AC1B8D636300B5EDA3 /* ChooseWarehouseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChooseWarehouseViewController.m; sourceTree = "<group>"; };
FE4678AE1B8D63A100B5EDA3 /* Warehouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Warehouse.h; sourceTree = "<group>"; };
FE4678AF1B8D63A100B5EDA3 /* Warehouse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Warehouse.m; sourceTree = "<group>"; };
FE4678B41B8D986900B5EDA3 /* PurchaseBoltView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseBoltView.h; sourceTree = "<group>"; };
FE4678B51B8D986900B5EDA3 /* PurchaseBoltView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseBoltView.m; sourceTree = "<group>"; };
FE4F17231B72FAAB00924DED /* ChosePersonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChosePersonViewController.h; sourceTree = "<group>"; };
FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChosePersonViewController.m; sourceTree = "<group>"; };
FE7155D71B7B328400595B0A /* Product.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Product.h; sourceTree = "<group>"; };
......@@ -989,6 +1001,10 @@
7281A0C11B898A040052B1AC /* PurchaseDetailViewController.m */,
7281A0C31B89BF1C0052B1AC /* ChooseVendorViewController.h */,
7281A0C41B89BF1C0052B1AC /* ChooseVendorViewController.m */,
FE4678A81B8D60F900B5EDA3 /* ChooseTypeViewController.h */,
FE4678A91B8D60F900B5EDA3 /* ChooseTypeViewController.m */,
FE4678AB1B8D636300B5EDA3 /* ChooseWarehouseViewController.h */,
FE4678AC1B8D636300B5EDA3 /* ChooseWarehouseViewController.m */,
);
path = Controllers;
sourceTree = "<group>";
......@@ -1000,6 +1016,8 @@
7281A0BE1B8980E60052B1AC /* PurchaseBill.m */,
7281A0C61B89BFE60052B1AC /* Vendor.h */,
7281A0C71B89BFE60052B1AC /* Vendor.m */,
FE4678AE1B8D63A100B5EDA3 /* Warehouse.h */,
FE4678AF1B8D63A100B5EDA3 /* Warehouse.m */,
);
path = Models;
sourceTree = "<group>";
......@@ -1013,6 +1031,8 @@
7281A0B21B8974120052B1AC /* TopPurchaseView.m */,
7281A0BA1B897EAB0052B1AC /* PurchaseCell.h */,
7281A0BB1B897EAB0052B1AC /* PurchaseCell.m */,
FE4678B41B8D986900B5EDA3 /* PurchaseBoltView.h */,
FE4678B51B8D986900B5EDA3 /* PurchaseBoltView.m */,
);
path = Views;
sourceTree = "<group>";
......@@ -2105,6 +2125,7 @@
C11A344D1B1BE27200079129 /* ICRPatrolAllStoreViewController.m in Sources */,
C10214DD1AD90A3F0024637E /* ICRFunctionEntity.m in Sources */,
FE17F6831B85CA5B0078CE96 /* NewPurchaseNoticeViewController.m in Sources */,
FE4678AA1B8D60F900B5EDA3 /* ChooseTypeViewController.m in Sources */,
30DB92A61ADD039F00271835 /* ICRAnnocementContentView.m in Sources */,
C142D2B21AC3A155000109A7 /* UIFont+Custom.m in Sources */,
C15295CE1B24741400DF60D1 /* ASValuePopUpView.m in Sources */,
......@@ -2166,6 +2187,7 @@
300DD94A1B184B450080EE12 /* ICRPatrolPlan.m in Sources */,
C12C24D11B0BA3C700E1FEBF /* ICRTaskHandleViewController.m in Sources */,
FE7155D91B7B328400595B0A /* Product.m in Sources */,
FE4678B61B8D986900B5EDA3 /* PurchaseBoltView.m in Sources */,
C159188A1AC4615D0013B391 /* ICRHTTPController.m in Sources */,
C123A90D1B25CBAD003C0C36 /* ASStarRatingView.m in Sources */,
C15295AF1B24296500DF60D1 /* ICRQSingleSelectViewController.m in Sources */,
......@@ -2176,6 +2198,7 @@
C1B810AD1ADF4D6A00BBC75A /* ICRAttachmentView.m in Sources */,
C15295C71B2451E900DF60D1 /* ICRQStarViewController.m in Sources */,
C15295D01B24741400DF60D1 /* ASValueTrackingSlider.m in Sources */,
FE4678B01B8D63A100B5EDA3 /* Warehouse.m in Sources */,
7281A0B61B8974120052B1AC /* TopPurchaseView.m in Sources */,
C1E9F5731B2E411900BF1356 /* IBTFileManager.m in Sources */,
C15295B71B24450A00DF60D1 /* ICRQAViewController.m in Sources */,
......@@ -2223,6 +2246,7 @@
300DD94E1B184EA70080EE12 /* ICRQuestion.m in Sources */,
7217E9E81B72364300FE5C1D /* Survey.m in Sources */,
FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */,
FE4678AD1B8D636300B5EDA3 /* ChooseWarehouseViewController.m in Sources */,
7281A0B51B8974120052B1AC /* ProductCell.m in Sources */,
C1FE50561AE3587F00C18080 /* ICRAttachmentUnit.m in Sources */,
30D7494C1ACE340D00C63BA1 /* ICRModifyPwdViewController.m in Sources */,
......
......@@ -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;
......
......@@ -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
......@@ -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] = @"mdata/vendor/download",
//仓库
[XFFHttp_GetWarehouse] = @"data/warehouse/download",
};
static NSString * const ICRAttachmentTypeValue[] = {
......@@ -1643,7 +1649,53 @@ acceptTypeJson:YES
}
};
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=%@", [[NSDate date] httpParameterString],@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST: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 *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetVendor] stringByAppendingFormat:@"?startDate=%@&pageNumber=%@&pageSize=%@", [[NSDate date] httpParameterString],@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:NULL
......@@ -1652,6 +1704,5 @@ acceptTypeJson:YES
success:success
failure:failure];
}
@end
......@@ -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"],
......
//
// ChooseTypeViewController.h
// XFFruit
//
// Created by n22 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;
@end
//
// ChooseTypeViewController.m
// XFFruit
//
// Created by n22 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)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@end
@implementation ChooseTypeViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initData];
[self bulidLayout];
}
- (void)initData{
self.dataArr = [NSMutableArray array];
[self.dataArr addObject:@"普通"];
[self.dataArr addObject:@"紧急"];
}
- (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
......@@ -36,27 +36,25 @@
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 -成功
......
//
// ChooseStoreViewController.h
// XFFruit
//
// Created by n22 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 n22 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
......@@ -10,7 +10,7 @@
#import "TopPurchaseView.h"
#import "ProductViewController.h"
#define TopHeight 284
#define TopHeight 328
#define BottomHeight 300
#define SpaceHeight 20
#define BottomViewHeight 60
......@@ -85,7 +85,7 @@ typedef enum : NSUInteger {
[self keyboardHidden];
}
- (void)keyboardHidden{
[_purchaseView.purchasePriceFiled resignFirstResponder];
[_purchaseView.otherPriceFiled resignFirstResponder];
[_purchaseView.remarkTextView resignFirstResponder];
}
- (void)didReceiveMemoryWarning {
......
......@@ -11,5 +11,7 @@
@interface PurchaseDetailViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseBill *bill;
//模拟三个人员
@property (nonatomic,assign)NSInteger indexPerson;//0.1.2
@end
......@@ -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;
......
......@@ -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];
}
......
......@@ -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 *lastModified_operName;//最后修改人名称
......
......@@ -4,7 +4,7 @@
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
// 供应商
#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
@end
//
// 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 @@
@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;
......
......@@ -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,15 +77,21 @@
}
- (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-10, TableHeight)];
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-30, 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(@"bbbbbb");
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-10, TableHeight)];
......@@ -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(@"bbbbbb");
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,22 @@
};
cvc.isMoreChose = NO;
[self.delegate pushNextViewController:cvc];
}else if(indexPath.row == 1){
ChooseTypeViewController *tvc = [[ChooseTypeViewController alloc]init];
tvc.title = @"类型";
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 +179,10 @@
[self.delegate hiddenKeyBoard];
return YES;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[self.delegate hiddenKeyBoard];
}
@end
......@@ -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;
......
......@@ -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:@"desc"]){
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}else{
_currentIndexPath = [NSIndexPath indexPathForRow:2 inSection:0];
......
......@@ -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;
......@@ -74,6 +77,9 @@ typedef enum : NSUInteger {
[_dataArr addObject:@"结束日期"];
[_dataArr addObject:@"调研人员"];
[_dataArr addObject:@"备注"];
uuidObject = [NSNull null];
billNumberObject = [NSNull null];
version = [NSNumber numberWithInt:0];
}
- (void)createTableView
......@@ -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,
......
......@@ -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;
......
......@@ -193,5 +193,7 @@
//行情调研
"AddSurvey" = "新建行情调研";
"AddPurchase" = "新建采购单";
"Purchase" = "采购单";
......@@ -177,5 +177,7 @@
"Announcement Detail" = "公告详情";
//行情调研
"Survey" = "行情调研";
"Survey" = "行情调研";
"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