BusinessViewController.m 9.31 KB
Newer Older
mei's avatar
mei committed
1 2 3 4 5 6 7 8 9 10
//
//  BusinessViewController.m
//  XFFruit
//
//  Created by mac on 15/8/13.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "BusinessViewController.h"

朱朝吉's avatar
朱朝吉 committed
11 12 13 14

#import "NewSurveyViewController.h"
#import "SurveyViewController.h"

mei's avatar
mei committed
15 16 17 18
#import "ICRFunctionBaseView.h"
#import "ICRFunctionEntity.h"
#import "ICRFunctionBaseView.h"

朱朝吉's avatar
朱朝吉 committed
19 20 21
#import "NewPurchaseNoticeViewController.h"
#import "SeePurchaseNoticeViewController.h"

陈俊俊's avatar
陈俊俊 committed
22 23 24

#import "NewPurchaseViewController.h"
#import "PurchaseViewController.h"
陈俊俊's avatar
陈俊俊 committed
25
#import "NewTransportViewController.h"
陈俊俊's avatar
陈俊俊 committed
26
#import "TransportViewController.h"
zhu's avatar
zhu committed
27 28
#import"PurchaseNoticeViewController.h"

陈俊俊's avatar
陈俊俊 committed
29 30 31 32
#import "NewTransferViewController.h"
#import "TransferViewController.h"
#import "ReceiveViewController.h"

freecui's avatar
freecui committed
33 34
#import "GXFFunctionDB.h"
#import "GXFNewProcessViewController.h"
freecui's avatar
freecui committed
35
#import "GXFListProcessViewController.h"
freecui's avatar
freecui committed
36 37 38
@interface BusinessViewController ()<ICRFunctionBaseViewDelegate,UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, strong) ICRFunctionBaseView *c_functionBaseView;
@property (nonatomic, strong) UITableView *c_tableView;
mei's avatar
mei committed
39 40 41 42 43 44 45

@end

@implementation BusinessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
freecui's avatar
freecui committed
46

mei's avatar
mei committed
47
    [self setupSubviews];
freecui's avatar
freecui committed
48
//    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"收货单" style:UIBarButtonItemStylePlain target:self action:@selector(receiveClick:)];
freecui's avatar
freecui committed
49
    
mei's avatar
mei committed
50 51 52 53 54
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
freecui's avatar
freecui committed
55 56 57

- (void)setupFunctionBaseView {
    NSMutableArray *funtionEntitlesArr = [NSMutableArray array];
mei's avatar
mei committed
58
    
freecui's avatar
freecui committed
59 60 61 62 63 64 65
    NSArray *arrFunctions = [NSArray arrayWithArray:[[GXFFunctionDB sharedInstance] displayFunctionsHasPermission]];
    for (GXFDisplayFunction *displayFunction in arrFunctions) {
        ICRFunctionEntity *functionEntity = [[ICRFunctionEntity alloc]init];
        functionEntity.functionName = displayFunction.functionName;
        functionEntity.iconName = displayFunction.functionImgName;
        functionEntity.functionItemTag = displayFunction.functionItemTag;
        [funtionEntitlesArr addObject:functionEntity];
mei's avatar
mei committed
66 67
    }
    
freecui's avatar
freecui committed
68 69
    self.c_functionBaseView = [ICRFunctionBaseView initWithFunctionData:funtionEntitlesArr];
    _c_functionBaseView.frame = (CGRect){
mei's avatar
mei committed
70 71 72
        .origin.x = 0,
        .origin.y =0,
        .size.width = CGRectGetWidth(self.view.frame),
freecui's avatar
freecui committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
        .size.height = _c_functionBaseView.height};//CGRectGetHeight(self.view.frame),};
    _c_functionBaseView.backgroundColor = [UIColor clearColor];
    _c_functionBaseView.m_delegate = self;
    
}

-(void)setupSubviews
{
    
    self.c_tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height - 64) style:UITableViewStyleGrouped];
    self.c_tableView.delegate = self;
    self.c_tableView.dataSource = self;
    [self.view addSubview:_c_tableView];
    
    [self setupFunctionBaseView];
    
mei's avatar
mei committed
89

mei's avatar
mei committed
90
}
朱朝吉's avatar
朱朝吉 committed
91

freecui's avatar
freecui committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
#pragma UITableViewDataSource 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return _c_functionBaseView.height + 44 ;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellId = @"cellId";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    [cell.contentView addSubview:_c_functionBaseView];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
朱朝吉's avatar
朱朝吉 committed
115 116 117 118 119 120 121 122 123 124 125
#pragma mark - ICRFunctionBaseViewDelegate
- (void)ICRFunctionBaseView:(ICRFunctionItemControl *)imageView {
    /*
     kFunctionAnnouncement = 0,
     kFunctionTaskManagement,
     kFunctionPatrolPlan,
     kFunctionMyShop,
     */
    switch (imageView.tag) {
        case kFunctionNotice://公告
        {
freecui's avatar
freecui committed
126 127
            //            ICRAnnouncementViewController *aVC = [[ICRAnnouncementViewController alloc] init];
            //            [self PushViewController:aVC animated:YES];
朱朝吉's avatar
朱朝吉 committed
128 129 130 131 132
        }
            break;
        case kFunctionNewSurvey://新建行情
        {
            NewSurveyViewController *svc = [[NewSurveyViewController alloc] init];
陈俊俊's avatar
陈俊俊 committed
133
            svc.navTitle = @"新建行情调研";
朱朝吉's avatar
朱朝吉 committed
134 135 136
            [self PushViewController:svc animated:YES];
        }
            break;
freecui's avatar
freecui committed
137
        case kFunctionSeeSurvey://查看行情
朱朝吉's avatar
朱朝吉 committed
138 139 140
        {
            SurveyViewController *svc = [[SurveyViewController alloc] init];
            svc.title = [IBTCommon localizableString:@"Survey"];
freecui's avatar
freecui committed
141
            svc.navigationItem.hidesBackButton = YES;
朱朝吉's avatar
朱朝吉 committed
142 143 144 145 146
            [self PushViewController:svc animated:YES];
        }
            break;
        case kFunctionNewPurchaseNotice://新建采购通知单
        {
朱朝吉's avatar
朱朝吉 committed
147 148
            NewPurchaseNoticeViewController *svc = [[NewPurchaseNoticeViewController alloc] init];
            svc.title = [IBTCommon localizableString:@"Survey2"];
朱朝吉's avatar
朱朝吉 committed
149 150 151 152 153
            [self PushViewController:svc animated:YES];
        }
            break;
        case kFunctionSeePurchaseNotice://查看采购通知单
        {
zhu's avatar
zhu committed
154 155
            PurchaseNoticeViewController *svc =
            [[PurchaseNoticeViewController alloc] init];
朱朝吉's avatar
朱朝吉 committed
156
            svc.title = [IBTCommon localizableString:@"Survey3"];
朱朝吉's avatar
朱朝吉 committed
157 158 159
            [self PushViewController:svc animated:YES];
        }
            break;
freecui's avatar
freecui committed
160 161
            
        case kFunctionNewPurchase://新建采购单
陈俊俊's avatar
陈俊俊 committed
162 163 164 165
        {
            NewPurchaseViewController *nvc = [[NewPurchaseViewController alloc]init];
            nvc.title = @"新建采购单";
            [self PushViewController:nvc animated:YES];
freecui's avatar
freecui committed
166
            
陈俊俊's avatar
陈俊俊 committed
167 168 169 170 171 172 173 174 175
        }
            break;
        case kFunctionSeePurchase:{
            PurchaseViewController *pvc = [[PurchaseViewController alloc]init];
            pvc.title = @"采购单";
            [self PushViewController:pvc animated:YES];
        }
            break;
            
陈俊俊's avatar
陈俊俊 committed
176 177 178
        case kFunctionNewShipment://任务管理
        {
            NewTransportViewController *tVC = [[NewTransportViewController alloc] init];
陈俊俊's avatar
陈俊俊 committed
179 180 181 182 183 184 185 186
            tVC.title = @"新建发运单";
            [self PushViewController:tVC animated:YES];
        }
            break;
        case kFunctionSeeShipment://任务管理
        {
            TransportViewController *tVC = [[TransportViewController alloc] init];
            tVC.title = @"发运单";
陈俊俊's avatar
陈俊俊 committed
187 188 189
            [self PushViewController:tVC animated:YES];
        }
            break;
陈俊俊's avatar
陈俊俊 committed
190 191 192
        case kFunctionExaminePurchase:
        {
            PurchaseViewController *tVC = [[PurchaseViewController alloc] init];
陈俊俊's avatar
陈俊俊 committed
193
            tVC.title = @"供应商确认采购单";
陈俊俊's avatar
陈俊俊 committed
194
            tVC.assessorVendor = [ICRUserUtil sharedInstance].userId;
陈俊俊's avatar
陈俊俊 committed
195 196 197
            [self PushViewController:tVC animated:YES];
        }
            break;
陈俊俊's avatar
陈俊俊 committed
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
            
        case kFunctionNewTransfer://新建转运单
        {
            NewTransferViewController *tVC = [[NewTransferViewController alloc] init];
            tVC.title = @"新建转运单";
            [self PushViewController:tVC animated:YES];
        }
            break;
        case kFunctionSeeTransfer://转运单列表
        {
            TransferViewController *tVC = [[TransferViewController alloc] init];
            tVC.title = @"转运单";
            [self PushViewController:tVC animated:YES];
        }
            break;
freecui's avatar
freecui committed
213
 
freecui's avatar
freecui committed
214 215 216 217 218 219 220
        case kFunctionNewProcessing:{
            GXFNewProcessViewController *pvc = [[GXFNewProcessViewController alloc]init];
            //pvc.title = @"采购单";
            [self PushViewController:pvc animated:YES];
        }
            break;
        case kFunctionSeeProcessing:{
freecui's avatar
freecui committed
221
            GXFListProcessViewController *seeProcessVC= [[GXFListProcessViewController alloc]init];
freecui's avatar
freecui committed
222 223 224
            [self PushViewController:seeProcessVC animated:YES];
        }
            break;
freecui's avatar
freecui committed
225 226 227 228 229 230 231 232 233 234

        case kFunctionSeeReceive://收货单
        {
            ReceiveViewController *tVC = [[ReceiveViewController alloc] init];
            tVC.title = @"收货单";
            [self PushViewController:tVC animated:YES];
        }
            break;
            

朱朝吉's avatar
朱朝吉 committed
235 236 237 238 239
        default:
            return;
            break;
    }
}
陈俊俊's avatar
陈俊俊 committed
240 241 242 243 244
- (void)receiveClick:(UIBarButtonItem *)item{
    ReceiveViewController *tVC = [[ReceiveViewController alloc] init];
    tVC.title = @"收货单";
    [self PushViewController:tVC animated:YES];
}
朱朝吉's avatar
朱朝吉 committed
245

freecui's avatar
freecui committed
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
//-(void)initView
//{
//    NSArray *butArray=[[NSArray alloc]initWithObjects:@"公告", @"新建行情调研",@"查看行情调研",@"填写行情反馈",@"新建采购通知",@"查看采购通知",@"新建采购单",@"查看采购单",@"审核采购单",@"新建发运单",@"查看发运单",@"新建加工单",nil];
//    for (int i=0; i<butArray.count; i++) {
//        UIButton *but=[UIButton buttonWithType:UIButtonTypeCustom];
//        but.frame=CGRectMake(15+i%3*(90+10),10+(i/3)*(100+10) , 90, 90) ;
//        //        but.titleLabel.text=[NSString stringWithFormat:@"%@",[butArray objectAtIndex:i]];
//        NSString *str=[butArray objectAtIndex:i];
//        [but setTitle:str forState:UIControlStateNormal];
//        but.backgroundColor=[UIColor redColor];
//        [self .view addSubview:but];
//        
//    }
//    
//}
mei's avatar
mei committed
261 262

@end