BusinessViewController.m 9.96 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
#import "ICRAnnouncementViewController.h"
朱朝吉's avatar
朱朝吉 committed
12 13 14
#import "NewSurveyViewController.h"
#import "SurveyViewController.h"

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

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

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

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

32 33 34 35
#import "GXFDisplayFunction.h"
#import "GXFFunction.h"
#import "GXFFunctionCollectionViewCell.h"
#import "GXFFunctionDB.h"
Sandy's avatar
Sandy committed
36 37 38 39 40 41 42
#import "GXFFunctionDB.h"
#import "GXFFunctionsViewController.h"
#import "GXFListProcessViewController.h"
#import "GXFListProcessViewController.h"
#import "GXFNewProcessViewController.h"
#import "GXFNewProcessViewController.h"
#import "GXFNoticeFunctionTableViewCell.h"
43 44 45
#import "MarketSurveyViewController.h"
#import "NewTransferViewController.h"
#import "NewTransportViewController.h"
Sandy's avatar
Sandy committed
46 47 48 49 50
#import "ReceiveViewController.h"
#import "TransferViewController.h"
#import "TransportViewController.h"
#import "WriteFeedbackViewController.h"
@interface BusinessViewController () <ICRFunctionBaseViewDelegate, UITableViewDataSource, UITableViewDelegate>
freecui's avatar
freecui committed
51 52
@property (nonatomic, strong) ICRFunctionBaseView *c_functionBaseView;
@property (nonatomic, strong) UITableView *c_tableView;
mei's avatar
mei committed
53 54 55 56 57

@end

@implementation BusinessViewController

Sandy's avatar
Sandy committed
58 59
- (void)viewDidLoad
{
mei's avatar
mei committed
60
    [super viewDidLoad];
freecui's avatar
freecui committed
61

mei's avatar
mei committed
62
    [self setupSubviews];
Sandy's avatar
Sandy committed
63
    //    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"收货单" style:UIBarButtonItemStylePlain target:self action:@selector(receiveClick:)];
mei's avatar
mei committed
64
}
Sandy's avatar
Sandy committed
65 66
- (void)didReceiveMemoryWarning
{
mei's avatar
mei committed
67 68 69
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
freecui's avatar
freecui committed
70

Sandy's avatar
Sandy committed
71 72
- (void)setupFunctionBaseView
{
freecui's avatar
freecui committed
73
    NSMutableArray *funtionEntitlesArr = [NSMutableArray array];
Sandy's avatar
Sandy committed
74

freecui's avatar
freecui committed
75 76
    NSArray *arrFunctions = [NSArray arrayWithArray:[[GXFFunctionDB sharedInstance] displayFunctionsHasPermission]];
    for (GXFDisplayFunction *displayFunction in arrFunctions) {
Sandy's avatar
Sandy committed
77
        ICRFunctionEntity *functionEntity = [[ICRFunctionEntity alloc] init];
freecui's avatar
freecui committed
78 79 80 81
        functionEntity.functionName = displayFunction.functionName;
        functionEntity.iconName = displayFunction.functionImgName;
        functionEntity.functionItemTag = displayFunction.functionItemTag;
        [funtionEntitlesArr addObject:functionEntity];
mei's avatar
mei committed
82
    }
Sandy's avatar
Sandy committed
83

freecui's avatar
freecui committed
84
    self.c_functionBaseView = [ICRFunctionBaseView initWithFunctionData:funtionEntitlesArr];
Sandy's avatar
Sandy committed
85
    _c_functionBaseView.frame = (CGRect){.origin.x = 0, .origin.y = 0, .size.width = CGRectGetWidth(self.view.frame), .size.height = _c_functionBaseView.height };// CGRectGetHeight(self.view.frame),};
freecui's avatar
freecui committed
86 87 88 89
    _c_functionBaseView.backgroundColor = [UIColor clearColor];
    _c_functionBaseView.m_delegate = self;
}

Sandy's avatar
Sandy committed
90
- (void)setupSubviews
freecui's avatar
freecui committed
91
{
Sandy's avatar
Sandy committed
92 93

    self.c_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height - 64) style:UITableViewStyleGrouped];
freecui's avatar
freecui committed
94 95 96
    self.c_tableView.delegate = self;
    self.c_tableView.dataSource = self;
    [self.view addSubview:_c_tableView];
mei's avatar
mei committed
97

Sandy's avatar
Sandy committed
98
    [self setupFunctionBaseView];
mei's avatar
mei committed
99
}
朱朝吉's avatar
朱朝吉 committed
100

Sandy's avatar
Sandy committed
101 102 103
#pragma UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
freecui's avatar
freecui committed
104 105
    return 1;
}
Sandy's avatar
Sandy committed
106 107
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
freecui's avatar
freecui committed
108 109
    return 1;
}
Sandy's avatar
Sandy committed
110 111
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
freecui's avatar
freecui committed
112 113
    return 1;
}
Sandy's avatar
Sandy committed
114 115 116
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return _c_functionBaseView.height + 44;
freecui's avatar
freecui committed
117
}
Sandy's avatar
Sandy committed
118 119
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
freecui's avatar
freecui committed
120 121 122
    static NSString *cellId = @"cellId";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (!cell) {
Sandy's avatar
Sandy committed
123
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
freecui's avatar
freecui committed
124 125 126 127 128
    }
    [cell.contentView addSubview:_c_functionBaseView];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
朱朝吉's avatar
朱朝吉 committed
129
#pragma mark - ICRFunctionBaseViewDelegate
Sandy's avatar
Sandy committed
130 131
- (void)ICRFunctionBaseView:(ICRFunctionItemControl *)imageView
{
朱朝吉's avatar
朱朝吉 committed
132 133 134 135 136 137 138 139 140
    /*
     kFunctionAnnouncement = 0,
     kFunctionTaskManagement,
     kFunctionPatrolPlan,
     kFunctionMyShop,
     */
    switch (imageView.tag) {
        case kFunctionNotice://公告
        {
陈俊俊's avatar
陈俊俊 committed
141 142
            ICRAnnouncementViewController *aVC = [[ICRAnnouncementViewController alloc] init];
            [self PushViewController:aVC animated:YES];
Sandy's avatar
Sandy committed
143
        } break;
朱朝吉's avatar
朱朝吉 committed
144 145 146
        case kFunctionNewSurvey://新建行情
        {
            NewSurveyViewController *svc = [[NewSurveyViewController alloc] init];
陈俊俊's avatar
陈俊俊 committed
147
            svc.navTitle = @"新建行情调研";
朱朝吉's avatar
朱朝吉 committed
148
            [self PushViewController:svc animated:YES];
Sandy's avatar
Sandy committed
149 150
        } break;
        case kFunctionFeedBackSurvey://填写行情反馈3
151 152 153
        {
            MarketSurveyViewController *marketSurveyVC = [[MarketSurveyViewController alloc] init];
            marketSurveyVC.title = @"调研中";
Sandy's avatar
Sandy committed
154 155 156

            // WriteFeedbackViewController *svc = [[WriteFeedbackViewController alloc] init];

157
            [self PushViewController:marketSurveyVC animated:YES];
Sandy's avatar
Sandy committed
158
        } break;
freecui's avatar
freecui committed
159
        case kFunctionSeeSurvey://查看行情
朱朝吉's avatar
朱朝吉 committed
160 161 162
        {
            SurveyViewController *svc = [[SurveyViewController alloc] init];
            svc.title = [IBTCommon localizableString:@"Survey"];
freecui's avatar
freecui committed
163
            svc.navigationItem.hidesBackButton = YES;
朱朝吉's avatar
朱朝吉 committed
164
            [self PushViewController:svc animated:YES];
Sandy's avatar
Sandy committed
165
        } break;
朱朝吉's avatar
朱朝吉 committed
166 167
        case kFunctionNewPurchaseNotice://新建采购通知单
        {
朱朝吉's avatar
朱朝吉 committed
168 169
            NewPurchaseNoticeViewController *svc = [[NewPurchaseNoticeViewController alloc] init];
            svc.title = [IBTCommon localizableString:@"Survey2"];
朱朝吉's avatar
朱朝吉 committed
170
            [self PushViewController:svc animated:YES];
Sandy's avatar
Sandy committed
171
        } break;
朱朝吉's avatar
朱朝吉 committed
172 173
        case kFunctionSeePurchaseNotice://查看采购通知单
        {
Sandy's avatar
Sandy committed
174
            PurchaseNoticeViewController *svc = [[PurchaseNoticeViewController alloc] init];
朱朝吉's avatar
朱朝吉 committed
175
            svc.title = [IBTCommon localizableString:@"Survey3"];
朱朝吉's avatar
朱朝吉 committed
176
            [self PushViewController:svc animated:YES];
Sandy's avatar
Sandy committed
177 178
        } break;

freecui's avatar
freecui committed
179
        case kFunctionNewPurchase://新建采购单
陈俊俊's avatar
陈俊俊 committed
180
        {
Sandy's avatar
Sandy committed
181
            NewPurchaseViewController *nvc = [[NewPurchaseViewController alloc] init];
陈俊俊's avatar
陈俊俊 committed
182 183
            nvc.title = @"新建采购单";
            [self PushViewController:nvc animated:YES];
Sandy's avatar
Sandy committed
184 185 186 187

        } break;
        case kFunctionSeePurchase: {//查看采购单
            PurchaseViewController *pvc = [[PurchaseViewController alloc] init];
陈俊俊's avatar
陈俊俊 committed
188 189
            pvc.title = @"采购单";
            [self PushViewController:pvc animated:YES];
Sandy's avatar
Sandy committed
190 191
        } break;

陈俊俊's avatar
陈俊俊 committed
192 193 194
        case kFunctionNewShipment://任务管理
        {
            NewTransportViewController *tVC = [[NewTransportViewController alloc] init];
陈俊俊's avatar
陈俊俊 committed
195 196
            tVC.title = @"新建发运单";
            [self PushViewController:tVC animated:YES];
Sandy's avatar
Sandy committed
197
        } break;
陈俊俊's avatar
陈俊俊 committed
198 199 200 201
        case kFunctionSeeShipment://任务管理
        {
            TransportViewController *tVC = [[TransportViewController alloc] init];
            tVC.title = @"发运单";
陈俊俊's avatar
陈俊俊 committed
202
            [self PushViewController:tVC animated:YES];
Sandy's avatar
Sandy committed
203 204
        } break;

205
        case kFunctionExaminePurchase://供应商确认采购单
陈俊俊's avatar
陈俊俊 committed
206 207
        {
            PurchaseViewController *tVC = [[PurchaseViewController alloc] init];
陈俊俊's avatar
陈俊俊 committed
208
            tVC.title = @"供应商确认采购单";
陈俊俊's avatar
陈俊俊 committed
209
            tVC.assessorVendor = [ICRUserUtil sharedInstance].userId;
陈俊俊's avatar
陈俊俊 committed
210
            [self PushViewController:tVC animated:YES];
Sandy's avatar
Sandy committed
211 212
        } break;

陈俊俊's avatar
陈俊俊 committed
213 214 215 216 217
        case kFunctionNewTransfer://新建转运单
        {
            NewTransferViewController *tVC = [[NewTransferViewController alloc] init];
            tVC.title = @"新建转运单";
            [self PushViewController:tVC animated:YES];
Sandy's avatar
Sandy committed
218
        } break;
陈俊俊's avatar
陈俊俊 committed
219 220 221 222 223
        case kFunctionSeeTransfer://转运单列表
        {
            TransferViewController *tVC = [[TransferViewController alloc] init];
            tVC.title = @"转运单";
            [self PushViewController:tVC animated:YES];
Sandy's avatar
Sandy committed
224 225 226 227 228
        } break;

        case kFunctionNewProcessing: {
            GXFNewProcessViewController *pvc = [[GXFNewProcessViewController alloc] init];
            // pvc.title = @"采购单";
freecui's avatar
freecui committed
229
            [self PushViewController:pvc animated:YES];
Sandy's avatar
Sandy committed
230 231 232
        } break;
        case kFunctionSeeProcessing: {
            GXFListProcessViewController *seeProcessVC = [[GXFListProcessViewController alloc] init];
freecui's avatar
freecui committed
233
            [self PushViewController:seeProcessVC animated:YES];
Sandy's avatar
Sandy committed
234
        } break;
freecui's avatar
freecui committed
235 236 237 238 239 240

        case kFunctionSeeReceive://收货单
        {
            ReceiveViewController *tVC = [[ReceiveViewController alloc] init];
            tVC.title = @"收货单";
            [self PushViewController:tVC animated:YES];
Sandy's avatar
Sandy committed
241
        } break;
freecui's avatar
freecui committed
242

Sandy's avatar
Sandy committed
243
        default: return; break;
朱朝吉's avatar
朱朝吉 committed
244 245
    }
}
Sandy's avatar
Sandy committed
246 247
- (void)receiveClick:(UIBarButtonItem *)item
{
陈俊俊's avatar
陈俊俊 committed
248 249 250 251
    ReceiveViewController *tVC = [[ReceiveViewController alloc] init];
    tVC.title = @"收货单";
    [self PushViewController:tVC animated:YES];
}
朱朝吉's avatar
朱朝吉 committed
252

freecui's avatar
freecui committed
253 254
//-(void)initView
//{
Sandy's avatar
Sandy committed
255 256
//    NSArray *butArray=[[NSArray alloc]initWithObjects:@"公告",
//    @"新建行情调研",@"查看行情调研",@"填写行情反馈",@"新建采购通知",@"查看采购通知",@"新建采购单",@"查看采购单",@"审核采购单",@"新建发运单",@"查看发运单",@"新建加工单",nil];
freecui's avatar
freecui committed
257 258 259 260 261 262 263 264
//    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];
Sandy's avatar
Sandy committed
265
//
freecui's avatar
freecui committed
266
//    }
Sandy's avatar
Sandy committed
267
//
freecui's avatar
freecui committed
268
//}
mei's avatar
mei committed
269 270

@end