Commit 76416662 authored by 陈俊俊's avatar 陈俊俊

采购单

parent 3f78b465
This diff is collapsed.
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#import "Product.h" #import "Product.h"
#import "User.h" #import "User.h"
#import "Survey.h" #import "Survey.h"
#import "Vendor.h"
#define ICR_DB_ERROR_PARAMETER @"Parse Error: Bad Parameter(s)" #define ICR_DB_ERROR_PARAMETER @"Parse Error: Bad Parameter(s)"
...@@ -94,7 +95,7 @@ static NSString *ICRDataBasePath = @""; ...@@ -94,7 +95,7 @@ static NSString *ICRDataBasePath = @"";
[_m_dbQueue inDatabase:^(FMDatabase *db) { [_m_dbQueue inDatabase:^(FMDatabase *db) {
NSArray *tableNameArr = NSArray *tableNameArr =
@[ [Product class],[User class],[Survey class]]; @[ [Product class],[User class],[Survey class],[Vendor class]];
NSMutableArray *sqlBatch = [NSMutableArray array]; NSMutableArray *sqlBatch = [NSMutableArray array];
NSString *sql = nil; NSString *sql = nil;
......
...@@ -220,6 +220,12 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -220,6 +220,12 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
//供应商
- (void)getVendorWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end @end
...@@ -75,7 +75,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) { ...@@ -75,7 +75,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
XFFHttp_SurveyFinish, XFFHttp_SurveyFinish,
//行情反馈图片 //行情反馈图片
XFFHttp_ResultChart, XFFHttp_ResultChart,
XFFHttp_GetResults XFFHttp_GetResults,
//供应商
XFFHttp_GetVendor
}; };
static NSString * const ICRHTTPInterface[] = { static NSString * const ICRHTTPInterface[] = {
...@@ -131,7 +133,8 @@ static NSString * const ICRHTTPInterface[] = { ...@@ -131,7 +133,8 @@ static NSString * const ICRHTTPInterface[] = {
[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"
}; };
static NSString * const ICRAttachmentTypeValue[] = { static NSString * const ICRAttachmentTypeValue[] = {
...@@ -1416,7 +1419,7 @@ acceptTypeJson:YES ...@@ -1416,7 +1419,7 @@ acceptTypeJson:YES
}]; }];
} }
}; };
if (responseObject) {
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController]; ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl storageEntities:responseObject[ @"data" ][ @"records" ] [dbCtrl storageEntities:responseObject[ @"data" ][ @"records" ]
objectClass:NSClassFromString( @"Product" ) objectClass:NSClassFromString( @"Product" )
...@@ -1425,6 +1428,7 @@ acceptTypeJson:YES ...@@ -1425,6 +1428,7 @@ acceptTypeJson:YES
complete:complete complete:complete
fail:fail]; fail:fail];
} }
}
else { else {
if (fail) { if (fail) {
fail( nil ); fail( nil );
...@@ -1602,6 +1606,52 @@ acceptTypeJson:YES ...@@ -1602,6 +1606,52 @@ acceptTypeJson:YES
failure:failure]; failure:failure];
} }
//供应商
-(void)getVendorWithPage_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( @"Vendor" )
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:@"?start_date=%@&page_number=%@&page_size=%@", [[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];
}
@end @end
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "edit.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "edit@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#import "NewPurchaseNoticeViewController.h" #import "NewPurchaseNoticeViewController.h"
#import "SeePurchaseNoticeViewController.h" #import "SeePurchaseNoticeViewController.h"
#import "NewPurchaseViewController.h"
#import "PurchaseViewController.h"
@interface BusinessViewController ()<ICRFunctionBaseViewDelegate> @interface BusinessViewController ()<ICRFunctionBaseViewDelegate>
@end @end
...@@ -151,6 +155,22 @@ ...@@ -151,6 +155,22 @@
} }
break; break;
case kFunctionNewPurchase://新建采购单
{
NewPurchaseViewController *nvc = [[NewPurchaseViewController alloc]init];
nvc.title = @"新建采购单";
[self PushViewController:nvc animated:YES];
}
break;
case kFunctionSeePurchase:{
PurchaseViewController *pvc = [[PurchaseViewController alloc]init];
pvc.title = @"采购单";
[self PushViewController:pvc animated:YES];
}
break;
case kFunctionTaskManagement://任务管理 case kFunctionTaskManagement://任务管理
{ {
ICRTaskListViewController *tVC = [[ICRTaskListViewController alloc] init]; ICRTaskListViewController *tVC = [[ICRTaskListViewController alloc] init];
......
//
// ChooseSupplierViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
typedef void(^ChoseVendor)(NSArray *vendor);
@interface ChooseVendorViewController : ICRBaseViewController
@property (nonatomic,assign) BOOL isMoreChose;//是否是多选
@property (nonatomic,copy)ChoseVendor choseVendor;
@end
//
// ChooseSupplierViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ChooseVendorViewController.h"
#import "MaskCell.h"
#import "Vendor.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseVendorViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
{
UITextField *_selectTextFiled;
NSIndexPath *_currentIndexPath;
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *indexArr;
@end
@implementation ChooseVendorViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initData];
[self bulidLayout];
}
- (void)initData{
self.dataArr = [NSMutableArray array];
self.indexArr = [NSMutableArray array];
Vendor *v = [[Vendor alloc]init];
v.name = @"dddd";
v.code = @"1111";
[self.dataArr addObject:v];
// [self fetchVendorList];
// __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];
}
#pragma mark -成功
- (void)fetchVendorList{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Vendor 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:[Vendor class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
}
#pragma mark - 插入数据
- (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.isMoreChose) {
NSMutableArray *arr = [[NSMutableArray alloc]init];
for (NSIndexPath *index in self.indexArr) {
Vendor *vendor = self.dataArr[index.row];
[arr addObject:vendor];
}
self.choseVendor(arr);
}else{
NSMutableArray *arr = [[NSMutableArray alloc]init];
if (self.dataArr.count > 0) {
Vendor *vendor = self.dataArr[_currentIndexPath.row];
[arr addObject:vendor];
self.choseVendor(arr);
}
}
[self PopViewControllerAnimated:YES];
}
- (void)deletePerson {
if (self.isMoreChose) {
[self.indexArr removeAllObjects];
}else{
_currentIndexPath = nil;
}
_selectTextFiled.text = @"";
[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 (self.isMoreChose) {
if ([self isHaveIndexPath:indexPath]) {
cell.Commitbtn.hidden = NO;
}else{
cell.Commitbtn.hidden = YES;
}
}else{
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) {
Vendor *vendor = self.dataArr[indexPath.row];
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
[cell setTitleStr:proStr];
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (self.isMoreChose == YES) {
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
if (![self isHaveIndexPath:indexPath]) {
[self.indexArr addObject:indexPath];
}
NSString *personStr = @"";
for (NSIndexPath *index in self.indexArr) {
Vendor *vendor = self.dataArr[index.row];
if (personStr.length == 0) {
personStr = [personStr stringByAppendingFormat:@"%@",vendor.name];
}else{
personStr = [personStr stringByAppendingFormat:@"、%@",vendor.name];
}
}
_selectTextFiled.text = personStr;
}else{
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:_currentIndexPath];
currentCell.Commitbtn.hidden = YES;
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
Vendor *vendor = self.dataArr[indexPath.row];
_selectTextFiled.text = vendor.name;
}
}
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
for (NSIndexPath *path in self.indexArr) {
if (path.row == indexPath.row) {
return YES;
}
}
return NO;
}
- (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,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#import "NewPurchaseViewController.h" #import "NewPurchaseViewController.h"
#import "TopPurchaseView.h" #import "TopPurchaseView.h"
#import "ProductViewController.h" #import "ProductViewController.h"
#define TopHeight 284 #define TopHeight 284
#define BottomHeight 300 #define BottomHeight 300
#define SpaceHeight 20 #define SpaceHeight 20
...@@ -24,6 +25,7 @@ typedef enum : NSUInteger { ...@@ -24,6 +25,7 @@ typedef enum : NSUInteger {
UIScrollView *_scrollView; UIScrollView *_scrollView;
TopPurchaseView *_purchaseView; TopPurchaseView *_purchaseView;
UIView *_bottomView; UIView *_bottomView;
ProductViewController *_pvc ;
} }
@end @end
...@@ -31,7 +33,6 @@ typedef enum : NSUInteger { ...@@ -31,7 +33,6 @@ typedef enum : NSUInteger {
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"新建采购单";
//布局 //布局
[self bulidLayout]; [self bulidLayout];
} }
...@@ -65,15 +66,18 @@ typedef enum : NSUInteger { ...@@ -65,15 +66,18 @@ typedef enum : NSUInteger {
_bottomView.backgroundColor = [UIColor whiteColor]; _bottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_bottomView]; [_scrollView addSubview:_bottomView];
ProductViewController *pvc = [[ProductViewController alloc]init]; _pvc = [[ProductViewController alloc]init];
pvc.viewFrame = _bottomView.bounds; _pvc.viewFrame = _bottomView.bounds;
[_bottomView addSubview:pvc.view]; [_bottomView addSubview:_pvc.view];
} }
- (void)btnClick:(UIButton *)btn{ - (void)btnClick:(UIButton *)btn{
}
- (void)pushNextViewController:(id)vc{
[self PushViewController:vc animated:YES];
} }
#pragma mark - 协议方法 #pragma mark - 协议方法
......
...@@ -12,4 +12,5 @@ ...@@ -12,4 +12,5 @@
@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;
@end @end
...@@ -27,9 +27,11 @@ ...@@ -27,9 +27,11 @@
self.view.backgroundColor = XXFBgColor; self.view.backgroundColor = XXFBgColor;
[super viewDidLoad]; [super viewDidLoad];
isFirst = YES; isFirst = YES;
_productArr = [NSMutableArray array]; if (!self.productArr) {
[_productArr addObject:@"ffff"]; self.productArr = [NSMutableArray array];
[_productArr addObject:@"fffff"]; }
[self.productArr addObject:@"ffff"];
[self.productArr addObject:@"fffff"];
[self createView]; [self createView];
} }
- (void)setViewFrame:(CGRect)viewFrame{ - (void)setViewFrame:(CGRect)viewFrame{
...@@ -42,16 +44,18 @@ ...@@ -42,16 +44,18 @@
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:self.tableView]; [self.view addSubview:self.tableView];
NSArray *arr = @[@"商品",@"单价",@"包装规格"]; NSArray *arr = @[@"商品",@"单价",@"包装数量"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr]; HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
[self.view addSubview:headCell]; [self.view addSubview:headCell];
self.tableView.tableHeaderView = headCell; self.tableView.tableHeaderView = headCell;
if (!self.isHiddenEdit) {
FooterCell *footCell = [[FooterCell alloc]initWithFrame:CGRectMake(0, 0, _tableFrame.size.width, 50) withTitle:@"+点击添加商品明细"]; FooterCell *footCell = [[FooterCell alloc]initWithFrame:CGRectMake(0, 0, _tableFrame.size.width, 50) withTitle:@"+点击添加商品明细"];
[self.view addSubview:footCell]; [self.view addSubview:footCell];
footCell.delegate = self; footCell.delegate = self;
self.tableView.tableFooterView = footCell; self.tableView.tableFooterView = footCell;
}
} }
- (void)addClick{ - (void)addClick{
...@@ -67,12 +71,14 @@ ...@@ -67,12 +71,14 @@
return self.productArr.count; return self.productArr.count;
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaterialCell"; static NSString *cellID = @"ProductCell";
ProductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; ProductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) { if (cell == nil) {
cell = [[ProductCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; cell = [[ProductCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (self.isHiddenEdit) {
cell.editBtn.hidden = YES;
}
} }
if (indexPath.row != _currentRow) { if (indexPath.row != _currentRow) {
cell.smallImageView.image = [UIImage imageNamed:@"arrowright"]; cell.smallImageView.image = [UIImage imageNamed:@"arrowright"];
......
//
// PurchaseDetailViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "PurchaseBill.h"
@interface PurchaseDetailViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseBill *bill;
@end
//
// PurchaseDetailViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "PurchaseDetailViewController.h"
#import "ProductViewController.h"
#define BottomHeight 50
#define LeftMargin 20
#define LeftWidth 100
#define LeftHeight 30
#define TopMargin 15
@interface PurchaseDetailViewController ()
{
UIScrollView *_scrollView;
UIView *_purchaseView;
UIView *_bottomView;
ProductViewController *_pvc;
}
@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 *vendorNameLabel;
@property (nonatomic,strong)UILabel *totalPriceLabel;
@property (nonatomic,strong)UILabel *noteLabel;
@end
@implementation PurchaseDetailViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self bulidLayout];
}
#pragma mark - 视图初始化
- (void)bulidLayout{
_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height - 64 - BottomHeight)];
_scrollView.showsHorizontalScrollIndicator = NO;
_scrollView.showsVerticalScrollIndicator = NO;
_scrollView.backgroundColor = HexColor(@"f8f8f8");
[self.view addSubview:_scrollView];
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];
_purchaseView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight*8+LeftMargin)];
_purchaseView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_purchaseView];
NSArray *leftArr = @[@"单号:",@"采购通知单:",@"创建人:",@"审核人:",@"状态:",@"供应商:",@"总金额:",@"备注:"];
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.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){
self.totalPriceLabel = rightLabel;
}else if(i == 7){
rightLabel.numberOfLines = 0;
self.noteLabel = 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{
self.billNumberLabel.text = [IBTCommon checkString:self.bill.billNumber];
if ([self.bill.state isEqualToString:@"initial"]) {
self.stateLabel.textColor = [UIColor redColor];
self.stateLabel.text = @"未提交";
}else if ([self.bill.state isEqualToString:@"submitted"]) {
self.stateLabel.textColor = [UIColor greenColor];
self.stateLabel.text = @"已提交";
}else if ([self.bill.state isEqualToString:@"rejected"]) {
self.stateLabel.textColor = [UIColor grayColor];
self.stateLabel.text = @"已拒绝";
}else if ([self.bill.state isEqualToString:@"approved"]) {
self.stateLabel.textColor = [UIColor grayColor];
self.stateLabel.text = @"已审批";
}else if ([self.bill.state isEqualToString:@"shipping"]) {
self.stateLabel.textColor = [UIColor grayColor];
self.stateLabel.text = @"发运中";
}else if ([self.bill.state isEqualToString:@"finished"]) {
self.stateLabel.textColor = [UIColor blackColor];
self.stateLabel.text = @"已完成";
}
self.noticeNumberLabel.text = [IBTCommon checkString:self.bill.noticeNumber];
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.noteLabel.text = [IBTCommon checkString:self.bill.remark];
[self setNoteHeight];
}
- (void)setNoteHeight
{
CGFloat height = [self.noteLabel calculateHeight];
CGRect noteFrame = self.noteLabel.frame;
noteFrame.size.height = height;
self.noteLabel.frame = noteFrame;
CGFloat totalHeight = height + LeftHeight*8;
CGRect purchaseFrame = _purchaseView.frame;
purchaseFrame.size.height = totalHeight;
_purchaseView.frame = purchaseFrame;
CGRect bottomFrame = _bottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_purchaseView.frame) + TopMargin;
_bottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2);
}
- (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
//
// PurchaseViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface PurchaseViewController : ICRBaseViewController
@end
//
// PurchaseViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "PurchaseViewController.h"
#import "PurchaseCell.h"
#import "PurchaseBill.h"
#import "PurchaseDetailViewController.h"
#define TopMargin 44
#define TableHeight 120
#define LeftMargin 20
#define BtnWidth 60
#define BtnHeight 24
#define BtnSize 16
typedef enum : NSUInteger {
SortTag = 3000,
BoltTag
} BtnTag;
@interface PurchaseViewController ()<UITableViewDataSource,UITableViewDelegate>
{
UIView *_maskView;
UIButton *currentBtn;
UIBarButtonItem *_sureBtn;
UIButton *_sortBtn;
UIButton *_boltBtn;
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@end
@implementation PurchaseViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = XXFBgColor;
[self initData];
[self createTableView];
}
- (void)initData{
self.dataArr = [NSMutableArray array];
for (NSInteger i = 0; i < 6; i++) {
PurchaseBill *bill = [PurchaseBill new];
bill.billNumber = @"222222222";
bill.noticeNumber = @"134594059654 0504门店补货0002";
bill.create_operName = @"张三";
bill.create_time = @"2013-03-04";
bill.vendor_name = @"haha";
bill.total = @"200元";
bill.remark = @"hahahah";
if (i == 0) {
bill.state = @"initial";
}else if(i == 1){
bill.state = @"submitted";
}else if(i == 2){
bill.state = @"rejected";
}else if(i == 3){
bill.state = @"approved";
}else if(i == 4){
bill.state = @"shipping";
}else if(i == 5){
bill.state = @"finished";
}
[self.dataArr addObject:bill];
}
}
- (void)createTableView
{
_sureBtn = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
_sortBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:SortTag image:@"black_arrow_down_with_text" title:nil titleColor:HexColor(@"888888") isCorner:NO corner:0 bgColor:nil];
_sortBtn.titleLabel.font = FontSize(BtnSize);
[self.view addSubview:_sortBtn];
_boltBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(ScreenSize.width-BtnWidth - LeftMargin,10,BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:BoltTag image:@"black_filter_with_text" title:nil titleColor:HexColor(@"888888") isCorner:NO corner:0 bgColor:nil];
_boltBtn.titleLabel.font = FontSize(BtnSize);
[self.view addSubview:_boltBtn];
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
_maskView = [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, ScreenSize.height - 64- TopMargin)];
_maskView.backgroundColor = RGBA(0, 0, 0, 0.5);
_maskView.hidden = YES;
[self.view addSubview:_maskView];
}
#pragma mark -按钮事件
- (void)sortClick:(UIButton *)btn{
}
#pragma mark - 确定
- (void)sureClick{
}
#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 = @"SurveyID";
PurchaseCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[PurchaseCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if (self.dataArr.count > 0) {
PurchaseBill *bill = self.dataArr[indexPath.row];
[cell setPurchaseBill:bill];
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
PurchaseDetailViewController *pvc = [PurchaseDetailViewController new];
pvc.title = @"查看采购单";
pvc.bill = _dataArr[indexPath.row];
[self PushViewController:pvc animated:YES];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
/*
#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
//
// PurchaseBill.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@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;//采购单号
@property (nonatomic,strong)NSString *vendor_uuid;//供应商uuid
@property (nonatomic,strong)NSString *vendor_code;//供应商代码
@property (nonatomic,strong)NSString *vendor_name;//供应商姓名
@property (nonatomic,strong)NSString *total;//总金额
@property (nonatomic,strong)NSString *endDate;//调研结束时间
@property (nonatomic,strong)NSString *remark;//备注
@property (nonatomic,strong)NSString *state;// initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
@property (nonatomic,strong)NSString *vendorConfirmTime;//供应商确认时间
@property (nonatomic,strong)NSString *create_time;//创建时间
@property (nonatomic,strong)NSString *create_id;//创建人代码
@property (nonatomic,strong)NSString *create_operName;//创建人名称
@property (nonatomic,strong)NSString *lastModified_time;//最后修改时间
@property (nonatomic,strong)NSString *lastModified_id;//最后修改人代码
@property (nonatomic,strong)NSString *astModified_operName;//最后修改人名称
@end
//
// PurchaseBill.m
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "PurchaseBill.h"
@implementation PurchaseBill
@end
//
// Vendor.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface Vendor : IBTModel
@property (nonatomic,strong)NSString *uuid;//id
@property (nonatomic,strong)NSString *code;//代码
@property (nonatomic,strong)NSString *name;//名称
@property (nonatomic,assign)BOOL enabled;//状态
@end
//
// Vendor.m
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//供应商
#import "Vendor.h"
@implementation Vendor
+ (NSDictionary *)specialKeysAndReplaceKeys {
return @{ @"vID" : [[self class] PrimaryKey], };
}
+ (NSString *)PrimaryKey {
return @"uuid";
}
@end
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
@property (nonatomic,strong)UILabel *seqLabel; @property (nonatomic,strong)UILabel *seqLabel;
@property (nonatomic,strong)UILabel *titleLabel; @property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *priceLabel; @property (nonatomic,strong)UILabel *priceLabel;
@property (nonatomic,strong)UILabel *standardLabel; //@property (nonatomic,strong)UILabel *standardLabel;
@property (nonatomic,strong)UILabel *countLabel; @property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UILabel *lineLabel; @property (nonatomic,strong)UILabel *lineLabel;
......
...@@ -59,18 +59,19 @@ ...@@ -59,18 +59,19 @@
self.priceLabel.text = @"80"; self.priceLabel.text = @"80";
self.priceLabel.font = FontSize(ContentSize); self.priceLabel.font = FontSize(ContentSize);
self.standardLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))]; // self.standardLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.standardLabel.textAlignment = NSTextAlignmentLeft; // self.standardLabel.textAlignment = NSTextAlignmentLeft;
self.standardLabel.text = @"20*20"; // self.standardLabel.text = @"20*20";
self.standardLabel.textColor = HexColor(ContentColor); // self.standardLabel.backgroundColor = [UIColor redColor];
self.standardLabel.font = FontSize(ContentSize); // self.standardLabel.textColor = HexColor(ContentColor);
// self.standardLabel.font = FontSize(ContentSize);
// self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.standardLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
// self.countLabel.textAlignment = NSTextAlignmentLeft; self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
// self.countLabel.text = @"200"; self.countLabel.textAlignment = NSTextAlignmentLeft;
// self.countLabel.textColor = HexColor(ContentColor); self.countLabel.text = @"200";
// self.countLabel.font = FontSize(ContentSize); self.countLabel.textColor = HexColor(ContentColor);
// self.countLabel.font = FontSize(ContentSize);
self.showView = [[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, ScreenSize.width, 0)]; self.showView = [[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, ScreenSize.width, 0)];
self.showView.hidden = YES; self.showView.hidden = YES;
...@@ -127,8 +128,8 @@ ...@@ -127,8 +128,8 @@
self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.editBtn setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal]; [self.editBtn setImage:[UIImage imageNamed:@"edit"] forState:UIControlStateNormal];
self.editBtn.frame = CGRectMake(ScreenSize.width - LeftWidth, 0, LeftWidth, TableHeight); self.editBtn.frame = CGRectMake(ScreenSize.width - RightWidth, 0, RightWidth - LeftMargin, 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))];;
...@@ -138,8 +139,9 @@ ...@@ -138,8 +139,9 @@
[self.contentView addSubview:self.seqLabel]; [self.contentView addSubview:self.seqLabel];
[self.contentView addSubview:self.titleLabel]; [self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.priceLabel]; [self.contentView addSubview:self.priceLabel];
[self.contentView addSubview:self.standardLabel]; // [self.contentView addSubview:self.standardLabel];
// [self.contentView addSubview:self.countLabel]; [self.contentView addSubview:self.countLabel];
[self.contentView addSubview:self.editBtn]; [self.contentView addSubview:self.editBtn];
[self.contentView addSubview:self.showView]; [self.contentView addSubview:self.showView];
......
//
// PurchaseCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "PurchaseBill.h"
@interface PurchaseCell : UITableViewCell
@property (nonatomic,strong)UILabel *billNumberLabel;//采购单号
@property (nonatomic,strong)UILabel *noticeNumberLabel;//采购通知单号
@property (nonatomic,strong)UILabel *createOperNameLabel;//创建人
@property (nonatomic,strong)UILabel *createTimeLabel;//创建时间
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UIButton *stateBtn;
@property (nonatomic,strong)PurchaseBill *purchaseBill;
@end
//
// PurchaseCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/8/23.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "PurchaseCell.h"
#define TitleSize 16
#define ContentSize 14
#define TitleColor @"444444"
#define ContentColor @"aaaaaa"
#define LeftMargin 90
#define TopMargin 10
#define TitleHeight 20
#define TableHeight 120
@implementation PurchaseCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self bulidLayout];
}
return self;
}
- (void)bulidLayout
{
self.stateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.stateBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftMargin - TopMargin*3, 20);
self.stateBtn.titleLabel.font = FontSize(ContentSize);
[self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self.stateBtn.enabled = NO;
self.billNumberLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, TopMargin, ScreenSize.width - LeftMargin, TitleHeight))];
self.billNumberLabel.textColor = HexColor(TitleColor);
self.billNumberLabel.font = FontSize(TitleSize);
self.noticeNumberLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.billNumberLabel.frame), ScreenSize.width - LeftMargin, TitleHeight*2))];
self.noticeNumberLabel.numberOfLines = 0;
self.noticeNumberLabel.textColor = HexColor(ContentColor);
self.noticeNumberLabel.font = FontSize(ContentSize);
self.createOperNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.noticeNumberLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.createOperNameLabel.textColor = HexColor(ContentColor);
self.createOperNameLabel.font = FontSize(ContentSize);
self.createTimeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.createOperNameLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.createTimeLabel.textColor = HexColor(ContentColor);
self.createTimeLabel.font = FontSize(ContentSize);
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin - TopMargin * 2, 1))];;
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
[self.contentView addSubview:self.stateBtn];
[self.contentView addSubview:self.billNumberLabel];
[self.contentView addSubview:self.noticeNumberLabel];
[self.contentView addSubview:self.createOperNameLabel];
[self.contentView addSubview:self.createTimeLabel];
[self.contentView addSubview:self.lineLabel];
}
- (void)setPurchaseBill:(PurchaseBill *)purchaseBill{
self.billNumberLabel.text = [NSString stringWithFormat:@"单号:%@",purchaseBill.billNumber];
self.noticeNumberLabel.text = [NSString stringWithFormat:@"采购通知单:%@",purchaseBill.noticeNumber];
self.createOperNameLabel.text = [NSString stringWithFormat:@"创建人:%@",purchaseBill.create_operName] ;
self.createTimeLabel.text =[NSString stringWithFormat:@"创建时间:%@",purchaseBill.create_time];
NSString *stateStr = @"";
if ([purchaseBill.state isEqualToString:@"initial"]) {
stateStr = @"未提交";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"initial"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:@"submitted"]) {
stateStr = @"已提交";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:@"rejected"]) {
stateStr = @"已拒绝";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:@"approved"]) {
stateStr = @"已审批";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:@"shipping"]) {
stateStr = @"发运中";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:@"finished"]) {
stateStr = @"已完成";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
}
[self.stateBtn setTitle:stateStr forState:UIControlStateNormal];
}
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
@protocol TopPurchaseViewDelegate <NSObject> @protocol TopPurchaseViewDelegate <NSObject>
- (void)hiddenKeyBoard; - (void)hiddenKeyBoard;
- (void)pushNextViewController:(id)vc;
@end @end
@interface TopPurchaseView : UIView @interface TopPurchaseView : UIView
......
...@@ -9,12 +9,14 @@ ...@@ -9,12 +9,14 @@
#import "TopPurchaseView.h" #import "TopPurchaseView.h"
#import "SurveyCell.h" #import "SurveyCell.h"
#import "ChooseVendorViewController.h"
#import "Vendor.h"
#define LeftMargin 15 #define LeftMargin 15
#define TopMargin 20 #define TopMargin 20
#define LeftWidth 80 #define LeftWidth 80
#define TableHeight 44 #define TableHeight 44
#define SpaceHeight 10 #define SpaceHeight 10
#define TitleSize 16 #define TitleSize 15
@interface TopPurchaseView ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate> @interface TopPurchaseView ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate>
{ {
...@@ -119,7 +121,21 @@ ...@@ -119,7 +121,21 @@
} }
} }
} }
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 2){
ChooseVendorViewController *cvc = [ChooseVendorViewController new];
cvc.choseVendor = ^(NSArray *vendors){
if (vendors.count > 0) {
Vendor *vendor = vendors[0];
self.purchaseSupplierLabel.text = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
self.purchaseSupplierLabel.textColor = HexColor(@"444444");
}
};
cvc.isMoreChose = NO;
[self.delegate pushNextViewController:cvc];
}
}
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{ - (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[self.remarkTextView resignFirstResponder]; [self.remarkTextView resignFirstResponder];
return YES; return YES;
......
...@@ -354,7 +354,7 @@ typedef enum : NSUInteger { ...@@ -354,7 +354,7 @@ typedef enum : NSUInteger {
ChosePersonViewController *cvc = [ChosePersonViewController new]; ChosePersonViewController *cvc = [ChosePersonViewController new];
cvc.chosePerson = ^(NSArray *users){ cvc.chosePerson = ^(NSArray *users){
NSString *textStr = @""; NSString *textStr = @"";
if (self.users.count <=0) { if (self.users.count >0) {
[self.users removeAllObjects]; [self.users removeAllObjects];
} }
for (SurveyUser *user in users) { for (SurveyUser *user in users) {
......
...@@ -45,6 +45,10 @@ typedef enum : NSUInteger { ...@@ -45,6 +45,10 @@ typedef enum : NSUInteger {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"行情调研详情"; self.title = @"行情调研详情";
[self bulifLayout]; [self bulifLayout];
[self getDataFromServer];
}
- (void)getDataFromServer{
__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];
...@@ -152,7 +156,7 @@ typedef enum : NSUInteger { ...@@ -152,7 +156,7 @@ typedef enum : NSUInteger {
UILabel *tagLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, 10, LeftWidth*2, LeftHeight)]; UILabel *tagLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, 10, LeftWidth*2, LeftHeight)];
tagLabel.text = @"【调研内容】"; tagLabel.text = @"【调研内容】";
tagLabel.font = FontSize(17); tagLabel.font = FontSize(17);
tagLabel.textColor = [UIColor blueColor]; tagLabel.textColor = HexColor(@"7ebf74");
[_surveyView addSubview:tagLabel]; [_surveyView addSubview:tagLabel];
NSArray *leftArr = @[@"单号:",@"状态:",@"标题:",@"商品:",@"开始日期:",@"截止日期:",@"调研人员:",@"备注:"]; NSArray *leftArr = @[@"单号:",@"状态:",@"标题:",@"商品:",@"开始日期:",@"截止日期:",@"调研人员:",@"备注:"];
...@@ -160,11 +164,12 @@ typedef enum : NSUInteger { ...@@ -160,11 +164,12 @@ typedef enum : NSUInteger {
UILabel *leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, CGRectGetMaxY(tagLabel.frame) + LeftHeight *i, LeftWidth, LeftHeight)]; UILabel *leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, CGRectGetMaxY(tagLabel.frame) + LeftHeight *i, LeftWidth, LeftHeight)];
leftLabel.font = FontSize(17); leftLabel.font = FontSize(17);
leftLabel.text = leftArr[i]; leftLabel.text = leftArr[i];
leftLabel.textColor = HexColor(@"888888");
[_surveyView addSubview:leftLabel]; [_surveyView addSubview:leftLabel];
UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), CGRectGetMaxY(tagLabel.frame) + LeftHeight *i, _surveyView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)]; UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), CGRectGetMaxY(tagLabel.frame) + LeftHeight *i, _surveyView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)];
rightLabel.font = FontSize(17); rightLabel.font = FontSize(17);
rightLabel.textColor = HexColor(@"888888");
if (i == 0) { if (i == 0) {
self.billNumberLabel = rightLabel; self.billNumberLabel = rightLabel;
}else if (i == 1) { }else if (i == 1) {
...@@ -195,13 +200,13 @@ typedef enum : NSUInteger { ...@@ -195,13 +200,13 @@ typedef enum : NSUInteger {
UILabel *resultLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, 10, LeftWidth*2, LeftHeight)]; UILabel *resultLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, 10, LeftWidth*2, LeftHeight)];
resultLabel.text = @"【行情反馈】"; resultLabel.text = @"【行情反馈】";
resultLabel.font = FontSize(17); resultLabel.font = FontSize(17);
resultLabel.textColor = [UIColor blueColor]; resultLabel.textColor = HexColor(@"7ebf74");
[_bottomView addSubview:resultLabel]; [_bottomView addSubview:resultLabel];
_chartImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(resultLabel.frame) + 10, CGRectGetWidth(_bottomView.frame) - 20, CGRectGetHeight(_bottomView.frame) - LeftHeight - 20)]; _chartImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(resultLabel.frame) + 10, CGRectGetWidth(_bottomView.frame) - 20, CGRectGetHeight(_bottomView.frame) - LeftHeight - 20)];
[_bottomView addSubview:_chartImageView]; [_bottomView addSubview:_chartImageView];
UIButton *btn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetWidth(_bottomView.frame) - 100, 10, 100, LeftHeight) target:self sel:@selector(btnClick:) tag:DetailTag image:nil title:@">>查看详情" titleColor:[UIColor blueColor] isCorner:NO corner:0 bgColor:nil]; UIButton *btn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetWidth(_bottomView.frame) - 100, 10, 100, LeftHeight) target:self sel:@selector(btnClick:) tag:DetailTag image:nil title:@">>查看详情" titleColor:HexColor(@"7ebf74") isCorner:NO corner:0 bgColor:nil];
[_bottomView addSubview:btn]; [_bottomView addSubview:btn];
......
...@@ -85,7 +85,6 @@ typedef enum : NSUInteger { ...@@ -85,7 +85,6 @@ typedef enum : NSUInteger {
[IBTLoadingView showProgressLabel:@"正在加载..."]; [IBTLoadingView showProgressLabel:@"正在加载..."];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance]; ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
id orderFieldObject = [NSNull null];
NSMutableArray *orderArr =[NSMutableArray array]; NSMutableArray *orderArr =[NSMutableArray array];
if (self.orderDirection.length > 0) { if (self.orderDirection.length > 0) {
QueryOrder *order = [QueryOrder new]; QueryOrder *order = [QueryOrder new];
......
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