ChooseWarehouseViewController.m 3.35 KB
Newer Older
n22's avatar
n22 committed
1 2 3 4
//
//  ChooseStoreViewController.m
//  XFFruit
//
n22's avatar
n22 committed
5
//  Created by 陈俊俊 on 15/8/26.
n22's avatar
n22 committed
6 7 8 9 10 11
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "ChooseWarehouseViewController.h"
#define TopMargin 50
#define TableHeight 50
陈俊俊's avatar
陈俊俊 committed
12
@interface ChooseWarehouseViewController ()
陈俊俊's avatar
陈俊俊 committed
13

n22's avatar
n22 committed
14 15 16 17 18 19
@end

@implementation ChooseWarehouseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
陈俊俊's avatar
陈俊俊 committed
20 21 22
    //记录更新时间
    self.tableView.header.lastUpdatedTimeKey = ChooseWarehouseUpdateDate;
    self.title = @"选择仓库";
陈俊俊's avatar
陈俊俊 committed
23
    [self fetchDataList:@"" tableStr:GXF_BASECLASS_WAREHOUSE];
n22's avatar
n22 committed
24
}
陈俊俊's avatar
陈俊俊 committed
25 26

- (void)getBaseDataFromServer{
n22's avatar
n22 committed
27 28 29 30 31
    __weak typeof(self)weakSelf = self;
    void(^succ)(id) = ^(id data) {
        [IBTLoadingView hideHUDWithText:nil];
        if (data) {
            __strong __typeof(weakSelf)strongSelf = weakSelf;
陈俊俊's avatar
陈俊俊 committed
32
            [self endRefreshing];
陈俊俊's avatar
陈俊俊 committed
33
            [strongSelf fetchDataList:@"" tableStr:GXF_BASECLASS_WAREHOUSE];
n22's avatar
n22 committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
        }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 - 协议方法
- (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;
    }
    
陈俊俊's avatar
陈俊俊 committed
58 59
    if (self.currentIndexPath) {
        if (indexPath.row == self.currentIndexPath.row) {
n22's avatar
n22 committed
60 61 62 63 64 65 66 67
            cell.Commitbtn.hidden = NO;
        }else{
            cell.Commitbtn.hidden = YES;
        }
    }else{
        cell.Commitbtn.hidden = YES;
    }
    if (self.dataArr.count > 0) {
陈俊俊's avatar
陈俊俊 committed
68 69 70 71 72 73 74 75 76 77
        if (indexPath.row == 0) {
            NSString *dateStr = [self.dataArr[indexPath.row] httpParameterString];
            cell.titleLabel.textColor = GXF_CONTENT_COLOR;
            [cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
        }else{
            Warehouse *warehouse = self.dataArr[indexPath.row];
            NSString *proStr = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code];
            
            [cell setTitleStr:proStr];
        }
n22's avatar
n22 committed
78 79 80 81
    }
    return cell;
}

陈俊俊's avatar
陈俊俊 committed
82 83
- (void)boxValueChanged:(NSNotification *)fication{
    NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
陈俊俊's avatar
陈俊俊 committed
84
    [self fetchDataList:tilkeStr tableStr:GXF_BASECLASS_WAREHOUSE];
n22's avatar
n22 committed
85
}
陈俊俊's avatar
陈俊俊 committed
86

陈俊俊's avatar
陈俊俊 committed
87

n22's avatar
n22 committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
- (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