| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- //
- // InventoryCostCell.m
- // IBOSS
- //
- // Created by 关宏厚 on 2020/11/17.
- // Copyright © 2020 elongtian. All rights reserved.
- //
- #import "InventoryCostCell.h"
- @implementation InventoryCostCell
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- return self;
- }
- -(void)setInventoryCostCell:(InventoryCostModel*)inventoryModel
- {
- CGFloat heightLine = 1;
- CGFloat heightRow = 31;
- CGFloat lblx = 20;
- CGFloat lbly = 0;
- CGFloat lblwidth = 70;
- CGFloat lblsubwidth = 40;
- CGFloat lblheight = 31;
- CGFloat valuex = 90;
- CGFloat valuey = 0;
- CGFloat valuewidth = 120;
- CGFloat valueheight = 31;
- //商品编码 —————————
- UIView *vCode = [UIView new];
- vCode.frame = CGRectMake(0, 8, Screen_Width, heightRow);
- [self.contentView addSubview:vCode];
- UILabel *lblTitleCode = [UILabel new];
- lblTitleCode.frame=CGRectMake(lblx, 0, lblwidth, lblheight);
- lblTitleCode.text = @"商品编码:";
- lblTitleCode.textColor = [UIColor blackColor];
- lblTitleCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCode addSubview:lblTitleCode];
- _lblCode = [UILabel new];
- _lblCode.frame=CGRectMake(valuex, 0, Screen_Width - valuex - lblx, valueheight);
- _lblCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _lblCode.text = inventoryModel.code;
- [vCode addSubview:_lblCode];
-
- //分割线
- UIView *viewBackgroud = [UIView new];
- viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vCode.frame)+8, Screen_Width, heightLine);
- viewBackgroud.backgroundColor = LineBackgroundColor;
- [self.contentView addSubview:viewBackgroud];
-
- //品牌 唯一编码 —————————
- UIView *vOnlyCodeAndBrand = [UIView new];
- vOnlyCodeAndBrand.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vOnlyCodeAndBrand];
-
-
- UIView *vOnlyCode = [UIView new];
- vOnlyCode.frame=CGRectMake(0, 0, Screen_Width/2, heightRow);
- [vOnlyCodeAndBrand addSubview:vOnlyCode];
-
- UILabel *lblTitleOnlyCode = [UILabel new];
- lblTitleOnlyCode.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblTitleOnlyCode.text = @"唯一编码:";
- lblTitleOnlyCode.textColor = LabelGrayTextColor;
- lblTitleOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOnlyCode addSubview:lblTitleOnlyCode];
- _lblOnlyCode = [UILabel new];
- _lblOnlyCode.frame = CGRectMake(CGRectGetMaxX(lblTitleOnlyCode.frame), valuey, Screen_Width/2 - CGRectGetMaxX(lblTitleOnlyCode.frame) - lblx/2, valueheight);
- _lblOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _lblOnlyCode.text = inventoryModel.onlyCode;
- [vOnlyCode addSubview:_lblOnlyCode];
-
- UIView *vBrand = [UIView new];
- vBrand.frame=CGRectMake( Screen_Width/2, 0, Screen_Width/2, heightRow);
- [vOnlyCodeAndBrand addSubview:vBrand];
-
- UILabel *lblTitleBrand = [UILabel new];
- lblTitleBrand.frame=CGRectMake(0, lbly, lblsubwidth, lblheight);
- lblTitleBrand.text = @"品牌:";
- lblTitleBrand.textColor = LabelGrayTextColor;
- lblTitleBrand.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vBrand addSubview:lblTitleBrand];
- _lblBrandName = [UILabel new];
- _lblBrandName.frame=CGRectMake(CGRectGetMaxX(lblTitleBrand.frame), valuey, Screen_Width/2 - CGRectGetWidth(lblTitleBrand.frame), valueheight);
- _lblBrandName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _lblBrandName.text = inventoryModel.brandName;
- [vBrand addSubview:_lblBrandName];
-
- //库区 仓位 —————————
- UIView *vWareAndPos = [UIView new];
- vWareAndPos.frame=CGRectMake(0, CGRectGetMaxY(vOnlyCodeAndBrand.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vWareAndPos];
-
- UIView *vWare = [UIView new];
- vWare.frame=CGRectMake(0, 0, Screen_Width/2, heightRow);
- [vWareAndPos addSubview:vWare];
-
- UILabel *lblTitleWare = [UILabel new];
- lblTitleWare.frame=CGRectMake(lblx, lbly, lblsubwidth, lblheight);
- lblTitleWare.text = @"库区:";
- lblTitleWare.textColor = LabelGrayTextColor;
- lblTitleWare.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vWare addSubview:lblTitleWare];
- _lblWareHouseName = [UILabel new];
- _lblWareHouseName.frame=CGRectMake(CGRectGetMaxX(lblTitleWare.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblTitleWare.frame) , valueheight);
- _lblWareHouseName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _lblWareHouseName.text = inventoryModel.wareHouseName;
- [vWare addSubview:_lblWareHouseName];
-
- UIView *vPos = [UIView new];
- vPos.frame=CGRectMake(Screen_Width/2, 0, Screen_Width/2, heightRow);
- [vWareAndPos addSubview:vPos];
-
- UILabel *lblTitlePos = [UILabel new];
- lblTitlePos.frame=CGRectMake(2, lbly, lblsubwidth, lblheight);
- lblTitlePos.text = @"仓位:";
- lblTitlePos.textColor = LabelGrayTextColor;
- lblTitlePos.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vPos addSubview:lblTitlePos];
- _lblPositionNumber = [UILabel new];
- _lblPositionNumber.frame=CGRectMake(CGRectGetMaxX(lblTitlePos.frame), valuey, valuewidth, valueheight);
- _lblPositionNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _lblPositionNumber.text = inventoryModel.positionNumber;
- [vPos addSubview:_lblPositionNumber];
-
- //色号 规格 等级 —————————
- UIView *vColorAndSpecificationAndGrade = [UIView new];
- vColorAndSpecificationAndGrade.frame=CGRectMake(0, CGRectGetMaxY(vWareAndPos.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vColorAndSpecificationAndGrade];
-
- UIView *vColor = [UIView new];
- vColor.frame=CGRectMake(0, 0, Screen_Width/3, heightRow);
- [vColorAndSpecificationAndGrade addSubview:vColor];
-
- UILabel *lblTitleColor = [UILabel new];
- lblTitleColor.frame=CGRectMake(lblx, lbly, lblsubwidth, lblheight);
- lblTitleColor.text = @"色号:";
- lblTitleColor.textColor = LabelGrayTextColor;
- lblTitleColor.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vColor addSubview:lblTitleColor];
- _lblColorNumber = [UILabel new];
- _lblColorNumber.frame=CGRectMake(CGRectGetMaxX(lblTitleColor.frame), valuey, Screen_Width/3 - CGRectGetMaxX(lblTitleColor.frame), valueheight);
- _lblColorNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _lblColorNumber.text = inventoryModel.colorNumber;
- [vColor addSubview:_lblColorNumber];
-
- UIView *vSpecification = [UIView new];
- vSpecification.frame=CGRectMake(Screen_Width/3, 0, Screen_Width/3, heightRow);
- [vColorAndSpecificationAndGrade addSubview:vSpecification];
-
- UILabel *lblTitleSpecification = [UILabel new];
- lblTitleSpecification.frame=CGRectMake(0, lbly, lblsubwidth, lblheight);
- lblTitleSpecification.text = @"规格:";
- lblTitleSpecification.textColor = LabelGrayTextColor;
- lblTitleSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSpecification addSubview:lblTitleSpecification];
- _lblSpecification = [UILabel new];
- _lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblTitleSpecification.frame), valuey, Screen_Width/3 - CGRectGetMaxX(lblTitleSpecification.frame), valueheight);
- _lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _lblSpecification.text = inventoryModel.specification;
- [vSpecification addSubview:_lblSpecification];
-
- UIView *vGrade = [UIView new];
- vGrade.frame=CGRectMake(Screen_Width*2/3, 0, Screen_Width/3, heightRow);
- [vColorAndSpecificationAndGrade addSubview:vGrade];
-
- UILabel *lblTitleGrade = [UILabel new];
- lblTitleGrade.frame=CGRectMake(0, lbly, lblsubwidth, lblheight);
- lblTitleGrade.text = @"等级:";
- lblTitleGrade.textColor = LabelGrayTextColor;
- lblTitleGrade.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGrade addSubview:lblTitleGrade];
- _lblGradeName= [UILabel new];
- _lblGradeName.frame=CGRectMake(CGRectGetMaxX(lblTitleGrade.frame), valuey, Screen_Width/3 - CGRectGetMaxX(lblTitleGrade.frame)-lblx/2, valueheight);
- _lblGradeName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _lblGradeName.text = inventoryModel.gradeName;
- [vGrade addSubview:_lblGradeName];
- //分割线
- UIView *viewline = [UIView new];
- viewline.frame = CGRectMake(0,CGRectGetMaxY(vColorAndSpecificationAndGrade.frame)+8, Screen_Width, heightLine);
- viewline.backgroundColor = LineBackgroundColor;
- [self.contentView addSubview:viewline];
-
- UIView *vBottom = [UIView new];
- vBottom.frame=CGRectMake(0, CGRectGetMaxY(viewline.frame)+8, Screen_Width, heightRow-1);
- [self.contentView addSubview:vBottom];
- NSString *str = [NSString stringWithFormat:@"(库存成本:%@;库存金额:%@)",inventoryModel.timelyCost,inventoryModel.inventoryAmount];
-
- NSDictionary *attributesDict = @{NSFontAttributeName:[UIFont systemFontOfSize: SubLabelAndTextFontOfSize]};
- CGRect fra = [str textRectWithSize:CGSizeMake(600, MAXFLOAT) attributes:attributesDict];
-
- UILabel *lblInventoryAndPrice = [UILabel new];
- lblInventoryAndPrice.frame=CGRectMake(Screen_Width - 10 - fra.size.width, 0, fra.size.width, lblheight-1);
- lblInventoryAndPrice.text = str;
- lblInventoryAndPrice.textColor = [UIColor blackColor];
- lblInventoryAndPrice.font = [UIFont systemFontOfSize: SubLabelAndTextFontOfSize];
- [vBottom addSubview:lblInventoryAndPrice];
-
- attributesDict = @{NSFontAttributeName:[UIFont systemFontOfSize: TitleFontOfSize]};
- fra = [inventoryModel.inventoryQuantity textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:attributesDict];
-
- UILabel *lblCanSaleQuantity = [UILabel new];
- lblCanSaleQuantity.frame=CGRectMake(CGRectGetMinX(lblInventoryAndPrice.frame) - fra.size.width, 0, fra.size.width, lblheight-1);
- lblCanSaleQuantity.text = inventoryModel.inventoryQuantity;
- lblCanSaleQuantity.textColor = [UIColor redColor];
- lblCanSaleQuantity.font = [UIFont systemFontOfSize: TitleFontOfSize];
- [vBottom addSubview:lblCanSaleQuantity];
-
- NSString *canSalesQuantityTitle = @"可售量:";
- attributesDict = @{NSFontAttributeName:[UIFont systemFontOfSize: SubLabelAndTextFontOfSize]};
- fra = [canSalesQuantityTitle textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:attributesDict];
-
- UILabel *lblCanSaleQuantityTitle = [UILabel new];
- lblCanSaleQuantityTitle.frame=CGRectMake(CGRectGetMinX(lblCanSaleQuantity.frame) - fra.size.width, 0, fra.size.width, lblheight-1);
- lblCanSaleQuantityTitle.text = canSalesQuantityTitle;
- lblCanSaleQuantityTitle.textColor = LabelGrayTextColor;
- lblCanSaleQuantityTitle.font = [UIFont systemFontOfSize: SubLabelAndTextFontOfSize];
- [vBottom addSubview:lblCanSaleQuantityTitle];
-
- //分割线
- viewBackgroud = [UIView new];
- viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vBottom.frame)+8, Screen_Width, 10);
- viewBackgroud.backgroundColor = LineBackgroundColor;
- [self.contentView addSubview:viewBackgroud];
- _cellHeight = CGRectGetMaxY(viewBackgroud.frame);
-
- }
- @end
|