| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- //
- // InventoryGoodsSearchCell.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2018/2/2.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "InventoryGoodsSearchCell.h"
- @implementation InventoryGoodsSearchCell
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
-
- return self;
- }
- - (void)setInventoryGoods:(InventoryListModel *)inventoryGoodsModel{
- int xPadding=10;
- int yPadding=10;
- int titleWidth=70;
- CGFloat valueheight = 25;
- NSDictionary *orderDict = @{NSFontAttributeName:orderTextFont};
- _inventoryModel=inventoryGoodsModel;
- _btnCheck=[UIButton buttonWithType:UIButtonTypeCustom];
- _btnCheck.frame=CGRectMake(xPadding, yPadding, 25, 25);
- [_btnCheck addTarget:self action:@selector(btnGoCheck) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:_btnCheck];
-
- _lblGoodsName=[[UILabel alloc]init];
- _lblGoodsName.frame=CGRectMake(CGRectGetMaxX(_btnCheck.frame)+3, yPadding, Screen_Width-CGRectGetMaxX(_btnCheck.frame)-10, valueheight);
-
- _lblGoodsName.text=inventoryGoodsModel.goodsName;
- _lblGoodsName.font=orderTextFont;
- [self.contentView addSubview:_lblGoodsName];
- _topSeparator=[UIView new];
- _topSeparator.frame = CGRectMake(0, CGRectGetMaxY(_btnCheck.frame)+yPadding, Screen_Width, 1);
- UIButton *btnLine = [UIButton buttonWithType:UIButtonTypeCustom];
- [btnLine setBackgroundImage:[UIImage imageNamed:@"dash"] forState:UIControlStateNormal];
- btnLine.frame = CGRectMake(0 ,0 , Screen_Width,1);
- [_topSeparator addSubview:btnLine];
-
- NSString *goodsCodeTitle=@"商品编码:";
- UILabel *lblGoodsCodeTitle=[[UILabel alloc]init];
- lblGoodsCodeTitle.frame=CGRectMake(xPadding,CGRectGetMaxY(_topSeparator.frame)+yPadding, titleWidth, valueheight);
- lblGoodsCodeTitle.textColor=LabelGrayTextColor;
- lblGoodsCodeTitle.font=orderTextFont;
- lblGoodsCodeTitle.text=goodsCodeTitle;
- [self.contentView addSubview:lblGoodsCodeTitle];
- NSString *code=inventoryGoodsModel.code;
- _lblGoodsCode=[[UILabel alloc]init];
- _lblGoodsCode.frame=CGRectMake(CGRectGetMaxX(lblGoodsCodeTitle.frame)+3,CGRectGetMaxY(_topSeparator.frame)+yPadding,Screen_Width/2-CGRectGetMaxX(lblGoodsCodeTitle.frame)-3, valueheight);
- _lblGoodsCode.font=orderTextFont;
- _lblGoodsCode.text=code;
- [self.contentView addSubview:_lblGoodsCode];
-
- NSString *onlyCodeTitle=@"唯一编码:";
- UILabel *lblOnlyCodeTitle=[[UILabel alloc]init];
- lblOnlyCodeTitle.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(_topSeparator.frame)+yPadding, titleWidth, valueheight);
- lblOnlyCodeTitle.textColor=LabelGrayTextColor;
- lblOnlyCodeTitle.font=orderTextFont;
- lblOnlyCodeTitle.text=onlyCodeTitle;
- [self.contentView addSubview:lblOnlyCodeTitle];
-
- NSString *onlyCode=inventoryGoodsModel.onlyCode;
- _lblOnlyCode=[[UILabel alloc]init];
- _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblOnlyCodeTitle.frame)+3,CGRectGetMaxY(_topSeparator.frame)+yPadding,Screen_Width/2-lblOnlyCodeTitle.frame.size.width-3, valueheight);
- _lblOnlyCode.font=orderTextFont;
- _lblOnlyCode.text=onlyCode;
- [self.contentView addSubview:_lblOnlyCode];
-
- NSString *colorNumberTitle=@"色号:";
- UILabel *lblColorNumberTitle=[[UILabel alloc]init];
- lblColorNumberTitle.frame=CGRectMake(xPadding,CGRectGetMaxY(lblGoodsCodeTitle.frame)+yPadding, 40, valueheight);
- lblColorNumberTitle.textColor=LabelGrayTextColor;
- lblColorNumberTitle.text=colorNumberTitle;
- lblColorNumberTitle.font=orderTextFont;
- [self.contentView addSubview:lblColorNumberTitle];
-
- NSString *colorNumber=inventoryGoodsModel.colorNumber;
- _lblColorNumber=[[UILabel alloc]init];
- _lblColorNumber.frame=CGRectMake(CGRectGetMaxX(lblColorNumberTitle.frame)+3,CGRectGetMaxY(lblGoodsCodeTitle.frame)+yPadding,Screen_Width/3-CGRectGetMaxX(lblColorNumberTitle.frame)-3, valueheight);
- _lblColorNumber.font=orderTextFont;
- _lblColorNumber.text=colorNumber;
- [self.contentView addSubview:_lblColorNumber];
-
-
- NSString *specificationTitle=@"规格:";
- UILabel *lblSpecificationTitle=[[UILabel alloc]init];
- lblSpecificationTitle.frame=CGRectMake(Screen_Width/3,CGRectGetMaxY(lblGoodsCodeTitle.frame)+yPadding,40, valueheight);
- lblSpecificationTitle.textColor=LabelGrayTextColor;
- lblSpecificationTitle.font=orderTextFont;
- lblSpecificationTitle.text=specificationTitle;
- [self.contentView addSubview:lblSpecificationTitle];
-
- NSString *specification=inventoryGoodsModel.specification;
- _lblSpecification=[[UILabel alloc]init];
- _lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblSpecificationTitle.frame)+3,CGRectGetMaxY(lblGoodsCodeTitle.frame)+yPadding,Screen_Width/3-lblSpecificationTitle.frame.size.width-3, valueheight);
- _lblSpecification.font=orderTextFont;
- _lblSpecification.text=specification;
- [self.contentView addSubview:_lblSpecification];
-
- NSString *gradeTitle=@"等级:";
- UILabel *lblGradeTitle=[[UILabel alloc]init];
- lblGradeTitle.frame=CGRectMake(Screen_Width/3*2,CGRectGetMaxY(lblGoodsCodeTitle.frame)+yPadding,40, valueheight);
- lblGradeTitle.textColor=LabelGrayTextColor;
- lblGradeTitle.font=orderTextFont;
- lblGradeTitle.text=gradeTitle;
- [self.contentView addSubview:lblGradeTitle];
-
- NSString *grade=inventoryGoodsModel.gradeName;
- _lblGrade=[[UILabel alloc]init];
- _lblGrade.frame=CGRectMake(CGRectGetMaxX(lblGradeTitle.frame)+3,CGRectGetMaxY(lblGoodsCodeTitle.frame)+yPadding,Screen_Width/3-lblGradeTitle.frame.size.width-3, valueheight);
- _lblGrade.font=orderTextFont;
- _lblGrade.text=grade;
- [self.contentView addSubview:_lblGrade];
-
- NSString *warehouseAreaTitle=@"库区:";
- UILabel *lblWarehouseAreaTitle=[[UILabel alloc]init];
- lblWarehouseAreaTitle.frame=CGRectMake(xPadding,CGRectGetMaxY(lblColorNumberTitle.frame)+yPadding,40, valueheight);
- lblWarehouseAreaTitle.textColor=LabelGrayTextColor;
- lblWarehouseAreaTitle.font=orderTextFont;
- lblWarehouseAreaTitle.text=warehouseAreaTitle;
- [self.contentView addSubview:lblWarehouseAreaTitle];
-
- NSString *warehouseAreaName=inventoryGoodsModel.wareHouseName;
- _lblWarehouseArea=[[UILabel alloc]init];
- _lblWarehouseArea.frame=CGRectMake(CGRectGetMaxX(lblWarehouseAreaTitle.frame)+3,CGRectGetMaxY(lblColorNumberTitle.frame)+yPadding,Screen_Width-CGRectGetMaxX(lblWarehouseAreaTitle.frame)-3, valueheight);
- _lblWarehouseArea.font=orderTextFont;
- _lblWarehouseArea.text=warehouseAreaName;
- [self.contentView addSubview:_lblWarehouseArea];
-
- _middleSeparator=[UIView new];
- _middleSeparator.frame = CGRectMake(0, CGRectGetMaxY(lblWarehouseAreaTitle.frame)+yPadding, Screen_Width, 1);
- _middleSeparator.backgroundColor=LineBackgroundColor;
- [self.contentView addSubview:_middleSeparator];
- NSString *inventoryQuantity=inventoryGoodsModel.inventoryQuantity;
- _lblEndStocking=[[UILabel alloc]init];
- CGRect endStockingFrame = [inventoryQuantity textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:orderDict];
- endStockingFrame.origin.x =Screen_Width-endStockingFrame.size.width-10;
- endStockingFrame.origin.y = CGRectGetMaxY(_middleSeparator.frame)+yPadding;
- _lblEndStocking.frame=endStockingFrame;
- _lblEndStocking.textColor=LabelGrayTextColor;
- _lblEndStocking.text=inventoryQuantity;
- _lblEndStocking.font=orderTextFont;
- _lblEndStocking.font=orderTextFont;
- [self.contentView addSubview:_lblEndStocking];
-
- NSString *inventoryQuantityTitle=@"结存量:";
- UILabel *lblEndStockingTitle=[[UILabel alloc]init];
- CGRect endStockingTitleFrame = [inventoryQuantityTitle textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict];
- endStockingTitleFrame.origin.x =CGRectGetMinX(_lblEndStocking.frame)-endStockingTitleFrame.size.width-10;
- endStockingTitleFrame.origin.y = CGRectGetMaxY(_middleSeparator.frame)+yPadding;
- lblEndStockingTitle.frame=endStockingTitleFrame;
- lblEndStockingTitle.textColor=LabelGrayTextColor;
- lblEndStockingTitle.text=inventoryQuantityTitle;
- lblEndStockingTitle.font=orderTextFont;
- [self.contentView addSubview:lblEndStockingTitle];
-
-
- NSString *canSalesQuantity=inventoryGoodsModel.canSaleQuantity;
- _lblPermitSalesQuantity=[[UILabel alloc]init];
- CGRect permitSalesQuantityFrame = [canSalesQuantity textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:orderDict];
- permitSalesQuantityFrame.origin.x =CGRectGetMinX(lblEndStockingTitle.frame)-permitSalesQuantityFrame.size.width-3;
- permitSalesQuantityFrame.origin.y = CGRectGetMaxY(_middleSeparator.frame)+yPadding;
- _lblPermitSalesQuantity.frame=permitSalesQuantityFrame;
- _lblPermitSalesQuantity.text=canSalesQuantity;
- _lblPermitSalesQuantity.textColor=LabelGrayTextColor;
- _lblPermitSalesQuantity.font=orderTextFont;
- [self.contentView addSubview:_lblPermitSalesQuantity];
-
- NSString *canSalesQuantityTitle=@"可售量:";
- UILabel *lblCanSalesQuantityTitle=[[UILabel alloc]init];
- CGRect canSalesQuantityTitleFrame = [canSalesQuantityTitle textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict];
- canSalesQuantityTitleFrame.origin.x =CGRectGetMinX(_lblPermitSalesQuantity.frame)-canSalesQuantityTitleFrame.size.width-3;
- canSalesQuantityTitleFrame.origin.y = CGRectGetMaxY(_middleSeparator.frame)+yPadding;
-
- lblCanSalesQuantityTitle.frame=canSalesQuantityTitleFrame;
- lblCanSalesQuantityTitle.font=orderTextFont;
- lblCanSalesQuantityTitle.textColor=LabelGrayTextColor;
- lblCanSalesQuantityTitle.text=canSalesQuantityTitle;
- [self.contentView addSubview:lblCanSalesQuantityTitle];
-
- _bottomSeparator=[UIView new];
- _bottomSeparator.frame = CGRectMake(0, CGRectGetMaxY(lblCanSalesQuantityTitle.frame)+yPadding, Screen_Width, 10);
- _bottomSeparator.backgroundColor=LineBackgroundColor;
- [self.contentView addSubview:_bottomSeparator];
-
-
- }
- //checkbox切换函数
- -(void)btnGoCheck
- {
- if([self.delegate respondsToSelector:@selector(btnInventoryListCheckPressed:)])
- {
-
- [self.delegate btnInventoryListCheckPressed:self];
-
- }
- }
- //设置checkbox背景图片
- - (void) setCheckBackground: (BOOL) checked
- { if(!checked)
- {
-
- [_btnCheck setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
-
-
- }
- else
- {
- [_btnCheck setImage:[UIImage imageNamed:@"order_checked"] forState:UIControlStateNormal];
-
- }
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- @end
|