GXFProcessMaterialTableViewCell.m 9.07 KB
Newer Older
freecui's avatar
freecui committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

//
//  GXFProcessMaterialTableViewCell.m
//  XFFruit
//
//  Created by freecui on 15/9/4.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#define LeftMargin 13
#define TableHeight 44
#define SmallSize 10
#define SmallWidth 20
#define ContentColor @"444444"
#define ContentSize 16
#define SpaceMargin 1
#define LeftWidth 45
#define RightWidth 30

#define ShowColor @"bbbbbb"
#define ShowSize 13
#define ShowWidth 150
#define ShowHeight 20
#import "GXFProcessMaterialTableViewCell.h"
freecui's avatar
freecui committed
25
#import "GXFProcessMaterial.h"
freecui's avatar
freecui committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
@interface GXFProcessMaterialTableViewCell ()


@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *baseQtyLabel;

@property (nonatomic,strong)UILabel *instockDateLabel;




@property (nonatomic,strong)UILabel *showTitleLabel;
@property (nonatomic,strong)UILabel *showBaseCountLabel;
@property (nonatomic,strong)UILabel *showDateLabel;
@property (nonatomic,strong)UILabel *basebaseQtyLabel;
@property (nonatomic,strong)UILabel *totalbaseQtyLabel;
@property (nonatomic,strong)UILabel *placeLabel;
@property (nonatomic,strong)UILabel *qualityLabel;
@property (nonatomic,strong)UILabel *remarkLabel;

@end
@implementation GXFProcessMaterialTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style
              reuseIdentifier:(NSString *)reuseIdentifier
              processMaterial: (GXFProcessMaterial *)processMaterial {

    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self bulidLayoutWithprocessMaterial: processMaterial];
    }
    return self;
}

- (void)bulidLayoutWithprocessMaterial: (GXFProcessMaterial *)processMaterial
{
    CGFloat headWidth = (ScreenSize.width - LeftWidth*2 - SpaceMargin* (3 -1))/3;
    
    self.smallImageView = [[UIImageView alloc]initWithFrame:CGRectMake(LeftMargin, (TableHeight - SmallSize)/2 , SmallSize, SmallSize)];
    self.smallImageView.image = [UIImage imageNamed:@"arrowright"];
    self.smallImageView.contentMode = UIViewContentModeScaleAspectFit;
    
    self.seqLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.smallImageView.frame), 0, SmallWidth, TableHeight))];
    self.seqLabel.textColor = HexColor(ContentColor);
    self.seqLabel.text = processMaterial.productUuid;//@"13";
    self.seqLabel.font = FontSize(ContentSize);
    
    self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
    self.titleLabel.textAlignment = NSTextAlignmentLeft;
    self.titleLabel.textColor = HexColor(ContentColor);
    self.titleLabel.text = processMaterial.productName;//@"苹果桃子";
    self.titleLabel.font = FontSize(ContentSize);
    
    self.baseQtyLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
    self.baseQtyLabel.textAlignment = NSTextAlignmentLeft;
    self.baseQtyLabel.textColor = HexColor(ContentColor);
    self.baseQtyLabel.text = [NSString stringWithFormat:@"%@",processMaterial.baseQty];
    self.baseQtyLabel.font = FontSize(ContentSize);
    
    
    self.instockDateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.baseQtyLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
    self.instockDateLabel.textAlignment = NSTextAlignmentLeft;
    self.instockDateLabel.text = [NSString stringWithFormat:@"%@",processMaterial.instockDate
                                  ];
    self.instockDateLabel.textColor = HexColor(ContentColor);
    self.instockDateLabel.font = FontSize(ContentSize);
    
    
    self.showView = [[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, ScreenSize.width, 0)];
    //    self.showView.hidden = YES;
    self.showView.clipsToBounds = YES;
    
    self.showTitleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.seqLabel.frame), 0, ShowWidth, ShowHeight))];
    self.showTitleLabel.textAlignment = NSTextAlignmentLeft;
    self.showTitleLabel.textColor = HexColor(ShowColor);
    self.showTitleLabel.text = [NSString stringWithFormat:@"原料:%@",processMaterial.productName];
    self.showTitleLabel.font = FontSize(ShowSize);
    
    self.showBaseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.showTitleLabel.frame), 0, ShowWidth, ShowHeight))];
    self.showBaseCountLabel.textAlignment = NSTextAlignmentLeft;
    self.showBaseCountLabel.textColor = HexColor(ShowColor);
freecui's avatar
freecui committed
106
    self.showBaseCountLabel.text = [NSString stringWithFormat:@"基础数量:%@",processMaterial.baseQty];//@"基础数量:10000";
freecui's avatar
freecui committed
107 108 109 110 111
    self.showBaseCountLabel.font = FontSize(ShowSize);
    
    self.showDateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.showTitleLabel.frame), ShowWidth, ShowHeight))];
    self.showDateLabel.textAlignment = NSTextAlignmentLeft;
    self.showDateLabel.textColor = HexColor(ShowColor);
freecui's avatar
freecui committed
112
    self.showDateLabel.text = [NSString stringWithFormat:@"入库时间:%@",processMaterial.instockDate ];//@"入库时间:2015-02-04";
freecui's avatar
freecui committed
113 114 115 116 117
    self.showDateLabel.font = FontSize(ShowSize);
    
    self.basebaseQtyLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showBaseCountLabel.frame), CGRectGetMaxY(self.showTitleLabel.frame), ShowWidth, ShowHeight))];
    self.basebaseQtyLabel.textAlignment = NSTextAlignmentLeft;
    self.basebaseQtyLabel.textColor = HexColor(ShowColor);
freecui's avatar
freecui committed
118
    self.basebaseQtyLabel.text = [NSString stringWithFormat:@"基础单价:%@",processMaterial.basePrice];//@"基础单价:11元";
freecui's avatar
freecui committed
119 120 121 122 123
    self.basebaseQtyLabel.font = FontSize(ShowSize);
    
    self.totalbaseQtyLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.showDateLabel.frame), ShowWidth, ShowHeight))];
    self.totalbaseQtyLabel.textAlignment = NSTextAlignmentLeft;
    self.totalbaseQtyLabel.textColor = HexColor(ShowColor);
freecui's avatar
freecui committed
124
    self.totalbaseQtyLabel.text = [NSString stringWithFormat:@"总金额:%@",processMaterial.total];///@"总金额:1000";
freecui's avatar
freecui committed
125 126 127 128 129
    self.totalbaseQtyLabel.font = FontSize(ShowSize);
    
    self.placeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showBaseCountLabel.frame), CGRectGetMaxY(self.showDateLabel.frame), ShowWidth, ShowHeight))];
    self.placeLabel.textAlignment = NSTextAlignmentLeft;
    self.placeLabel.textColor = HexColor(ShowColor);
freecui's avatar
freecui committed
130
    self.placeLabel.text = [NSString stringWithFormat:@"产地:%@",processMaterial.place];//@"产地:河南省";
freecui's avatar
freecui committed
131 132 133 134 135
    self.placeLabel.font = FontSize(ShowSize);
    
    self.qualityLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.totalbaseQtyLabel.frame), ShowWidth, ShowHeight))];
    self.qualityLabel.textAlignment = NSTextAlignmentLeft;
    self.qualityLabel.textColor = HexColor(ShowColor);
freecui's avatar
freecui committed
136
    self.qualityLabel.text = [NSString stringWithFormat:@"质量:%@",processMaterial.quality];//@"质量:1000";
freecui's avatar
freecui committed
137 138 139 140 141
    self.qualityLabel.font = FontSize(ShowSize);
    
    self.remarkLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.qualityLabel.frame), ShowWidth, ShowHeight))];
    self.remarkLabel.textAlignment = NSTextAlignmentLeft;
    self.remarkLabel.textColor = HexColor(ShowColor);
freecui's avatar
freecui committed
142
    self.remarkLabel.text = [NSString stringWithFormat:@"备注:%@",processMaterial.remark];//@"描述:河南省";
freecui's avatar
freecui committed
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
    self.remarkLabel.font = FontSize(ShowSize);
    
    
    
    
    self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.editBtn setImage:[UIImage imageNamed:@"edit"] forState:UIControlStateNormal];
    self.editBtn.frame = CGRectMake(ScreenSize.width - LeftWidth, 0, LeftWidth , TableHeight);
    self.editBtn.contentMode = UIViewContentModeScaleAspectFit;
    
    self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width  - LeftMargin * 2, 1))];;
    self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
    
    [self.contentView addSubview:self.smallImageView];
    [self.contentView addSubview:self.seqLabel];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.baseQtyLabel];
    //    [self.contentView addSubview:self.standardLabel];
    [self.contentView addSubview:self.instockDateLabel];
    
    
    [self.contentView addSubview:self.editBtn];
    [self.contentView addSubview:self.showView];
    
    [self.showView addSubview:self.showTitleLabel];
    [self.showView addSubview:self.showBaseCountLabel];
    [self.showView addSubview:self.showDateLabel];
    [self.showView addSubview:self.basebaseQtyLabel];
    [self.showView addSubview:self.totalbaseQtyLabel];
    [self.showView addSubview:self.placeLabel];
    [self.showView addSubview:self.qualityLabel];
    [self.showView addSubview:self.remarkLabel];
    [self.contentView addSubview:self.lineLabel];
    
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


@end




@implementation GXFProcessMaterialTableViewCell (Configure)
- (void)updateWithProcessMaterial:(GXFProcessMaterial *)processMaterial {


}
@end