StockingGoodsCell.m 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. //
  2. // StockingGoodsCell.m
  3. // IBOSS
  4. //
  5. // Created by apple on 2017/5/17.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. // 功能描述:盘点商品单元格
  9. //
  10. #import "StockingGoodsCell.h"
  11. @implementation StockingGoodsCell
  12. /**
  13. 后台代码创建单元cell
  14. @param style <#style description#>
  15. @param reuseIdentifier <#reuseIdentifier description#>
  16. @return <#return value description#>
  17. */
  18. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  19. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  20. return self;
  21. }
  22. /**
  23. 通过model设置ui
  24. @param m <#m description#>
  25. */
  26. - (void)setModel:(StockingModel *)m{
  27. CGFloat heightLine = 1;
  28. CGFloat heightRow = 40;
  29. CGFloat lblx = 20;
  30. CGFloat lbly = 8;
  31. CGFloat lblwidth = 80;
  32. CGFloat lblheight = 25;
  33. CGFloat valuex = 90;
  34. CGFloat valuey = 8;
  35. CGFloat valuewidth = 120;
  36. CGFloat valueheight = 25;
  37. //title —————————
  38. UIView *vTitle = [UIView new];
  39. vTitle.frame=CGRectMake(0, 0, Screen_Width, 10);
  40. vTitle.backgroundColor = LineBackgroundColor;
  41. [self.contentView addSubview:vTitle];
  42. //唯一编码 —————————
  43. UIView *vOnlyCode = [UIView new];
  44. vOnlyCode.frame=CGRectMake(0, CGRectGetMaxY(vTitle.frame), Screen_Width, heightRow);
  45. [self.contentView addSubview:vOnlyCode];
  46. UILabel *lblOnlyCode = [UILabel new];
  47. lblOnlyCode.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  48. lblOnlyCode.text = @"唯一编码:";
  49. lblOnlyCode.textColor = [UIColor blackColor];
  50. lblOnlyCode.font = [UIFont systemFontOfSize: TitleFontOfSize];
  51. [vOnlyCode addSubview:lblOnlyCode];
  52. UILabel *lblonlyCodeValue = [UILabel new];
  53. lblonlyCodeValue.frame=CGRectMake(valuex, valuey, Screen_Width-valuex-lblx, valueheight);
  54. lblonlyCodeValue.font = [UIFont systemFontOfSize: TitleFontOfSize];
  55. lblonlyCodeValue.text = m.onlyCode;
  56. [vOnlyCode addSubview:lblonlyCodeValue];
  57. //分割线
  58. UIView *viewBackgroud = [UIView new];
  59. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vOnlyCode.frame), Screen_Width, heightLine);
  60. viewBackgroud.backgroundColor = LineBackgroundColor;
  61. [self.contentView addSubview:viewBackgroud];
  62. //库存数量 等级 —————————
  63. UIView *vCountAndGrade = [UIView new];
  64. vCountAndGrade.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, heightRow);
  65. [self.contentView addSubview:vCountAndGrade];
  66. UIView *vNo = [UIView new];
  67. vNo.frame=CGRectMake(0, 0, Screen_Width/2, heightRow);
  68. [vCountAndGrade addSubview:vNo];
  69. UILabel *lblno = [UILabel new];
  70. lblno.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  71. lblno.text = @"库存数量:";
  72. lblno.textColor = [UIColor blackColor];
  73. lblno.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  74. [vNo addSubview:lblno];
  75. UILabel *lblNoValue = [UILabel new];
  76. lblNoValue.frame=CGRectMake(valuex, valuey, Screen_Width - valuex - lblx, valueheight);
  77. lblNoValue.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  78. lblNoValue.text = m.quantity;
  79. [vNo addSubview:lblNoValue];
  80. UIView *vGrade = [UIView new];
  81. vGrade.frame=CGRectMake(Screen_Width/2, 0, Screen_Width/2, heightRow);
  82. [vCountAndGrade addSubview:vGrade];
  83. UILabel *lblGrade = [UILabel new];
  84. lblGrade.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight);
  85. lblGrade.text = @"等级:";
  86. lblGrade.textColor = [UIColor blackColor];
  87. lblGrade.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  88. [vGrade addSubview:lblGrade];
  89. UILabel *gradeName = [UILabel new];
  90. gradeName.frame=CGRectMake(CGRectGetMaxX(lblGrade.frame), valuey, valuewidth, valueheight);
  91. gradeName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  92. gradeName.text = m.gradeName;
  93. [vGrade addSubview:gradeName];
  94. //色号 规格 —————————
  95. UIView *vColorAndSpecification = [UIView new];
  96. vColorAndSpecification.frame=CGRectMake(0, CGRectGetMaxY(vCountAndGrade.frame), Screen_Width, heightRow);
  97. [self.contentView addSubview:vColorAndSpecification];
  98. UIView *vColor = [UIView new];
  99. vColor.frame=CGRectMake(0, 0, Screen_Width/2, heightRow);
  100. [vColorAndSpecification addSubview:vColor];
  101. UILabel *lblColor = [UILabel new];
  102. lblColor.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight);
  103. lblColor.text = @"色号:";
  104. lblColor.textColor = [UIColor blackColor];
  105. lblColor.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  106. [vColor addSubview:lblColor];
  107. UILabel *lblcolorNumber = [UILabel new];
  108. lblcolorNumber.frame=CGRectMake(CGRectGetMaxX(lblColor.frame), valuey, valuewidth, valueheight);
  109. lblcolorNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  110. lblcolorNumber.text = m.colorNumber;
  111. [vColor addSubview:lblcolorNumber];
  112. UIView *vSpecification = [UIView new];
  113. vSpecification.frame=CGRectMake(Screen_Width/2, 0, Screen_Width/2, heightRow);
  114. [vColorAndSpecification addSubview:vSpecification];
  115. UILabel *lblSpecification = [UILabel new];
  116. lblSpecification.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight);
  117. lblSpecification.text = @"规格:";
  118. lblSpecification.textColor = [UIColor blackColor];
  119. lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  120. [vSpecification addSubview:lblSpecification];
  121. UILabel *specification = [UILabel new];
  122. specification.frame=CGRectMake(CGRectGetMaxX(lblSpecification.frame), valuey, valuewidth, valueheight);
  123. specification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  124. specification.text = m.specification;
  125. [vSpecification addSubview:specification];
  126. //库区 仓位 —————————
  127. UIView *vWareAndPos = [UIView new];
  128. vWareAndPos.frame=CGRectMake(0, CGRectGetMaxY(vColorAndSpecification.frame), Screen_Width, heightRow);
  129. [self.contentView addSubview:vWareAndPos];
  130. UIView *vWare = [UIView new];
  131. vWare.frame=CGRectMake(0, 0, Screen_Width/2, heightRow);
  132. [vWareAndPos addSubview:vWare];
  133. UILabel *lblWare = [UILabel new];
  134. lblWare.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight);
  135. lblWare.text = @"库区:";
  136. lblWare.textColor = [UIColor blackColor];
  137. lblWare.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  138. [vWare addSubview:lblWare];
  139. UILabel *wareHouseName = [UILabel new];
  140. wareHouseName.frame=CGRectMake(CGRectGetMaxX(lblWare.frame), valuey, valuewidth, valueheight);
  141. wareHouseName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  142. wareHouseName.text = m.warehouseName;
  143. [vWare addSubview:wareHouseName];
  144. UIView *vPos = [UIView new];
  145. vPos.frame=CGRectMake(Screen_Width/2, 0, Screen_Width/2, heightRow);
  146. [vWareAndPos addSubview:vPos];
  147. UILabel *lblPos = [UILabel new];
  148. lblPos.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight);
  149. lblPos.text = @"仓位:";
  150. lblPos.textColor = [UIColor blackColor];
  151. lblPos.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  152. [vPos addSubview:lblPos];
  153. UILabel *positionNumber = [UILabel new];
  154. positionNumber.frame=CGRectMake(CGRectGetMaxX(lblPos.frame), valuey, valuewidth, valueheight);
  155. positionNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  156. positionNumber.text = m.positionNumber;
  157. [vPos addSubview:positionNumber];
  158. //分割线
  159. viewBackgroud = [UIView new];
  160. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vWareAndPos.frame), Screen_Width, 10);
  161. viewBackgroud.backgroundColor = LineBackgroundColor;
  162. //[self.contentView addSubview:viewBackgroud];
  163. }
  164. @end