ProcurementApplyListDetailCell.m 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. //
  2. // ProcurementApplyListDetailCell.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 2018/7/24.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "ProcurementApplyListDetailCell.h"
  9. @implementation ProcurementApplyListDetailCell
  10. -(void)setProcurementApplyListDetailCell:(ProcurementApplyListDetailModel*)detailModel{
  11. _procurementDetailModel=detailModel;
  12. if(_procurementDetailModel==nil){
  13. return;
  14. }
  15. CGFloat heightLine = 1;
  16. CGFloat heightRow = 31;
  17. CGFloat lblx = 20;
  18. CGFloat lbly = 0;
  19. CGFloat lblwidth = 70;
  20. CGFloat lblheight = 31;
  21. CGFloat valuex = 85;
  22. CGFloat valuey = 0;
  23. CGFloat valueheight = 31;
  24. CGFloat xpadding=20;
  25. NSString *orderNo= _procurementDetailModel.orderNo;
  26. NSString *applyNo=_procurementDetailModel.applyNo;
  27. if([orderNo isEqualToString:@"小计"]||[applyNo isEqualToString:@"小计"]){
  28. UIView *vCount = [UIView new];
  29. vCount.frame=CGRectMake(0,10, Screen_Width, heightRow);
  30. [self.contentView addSubview:vCount];
  31. UILabel *lblCountTitle = [UILabel new];
  32. lblCountTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  33. lblCountTitle.text = @"小计";
  34. lblCountTitle.textColor = [UIColor redColor];
  35. lblCountTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  36. [vCount addSubview:lblCountTitle];
  37. _middleSeparator = [[UIView alloc]init];
  38. _middleSeparator.frame=CGRectMake(0,CGRectGetMaxY(vCount.frame)+10, Screen_Width, heightLine);
  39. _middleSeparator.backgroundColor=LineBackgroundColor;
  40. [self.contentView addSubview:_middleSeparator];
  41. }
  42. else
  43. {
  44. UIView *vOrderNo = [UIView new];
  45. vOrderNo.frame=CGRectMake(0,10, Screen_Width, heightRow);
  46. [self.contentView addSubview:vOrderNo];
  47. UILabel *lblOrderNoTitle = [UILabel new];
  48. lblOrderNoTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  49. lblOrderNoTitle.text = @"订单单号:";
  50. lblOrderNoTitle.textColor = [UIColor blackColor];
  51. lblOrderNoTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  52. [vOrderNo addSubview:lblOrderNoTitle];
  53. _lblOrderNo = [UILabel new];
  54. _lblOrderNo.frame=CGRectMake(valuex, valuey, Screen_Width-CGRectGetMaxX(lblOrderNoTitle.frame)-5, valueheight);
  55. _lblOrderNo.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  56. [vOrderNo addSubview:_lblOrderNo];
  57. _lblOrderNo.text = orderNo;
  58. UIView *vCodeAndOnlyCode = [UIView new];
  59. vCodeAndOnlyCode.frame=CGRectMake(0, CGRectGetMaxY(vOrderNo.frame), Screen_Width, heightRow);
  60. [self.contentView addSubview:vCodeAndOnlyCode];
  61. UIView *vCode = [UIView new];
  62. vCode.frame=CGRectMake(0, 0, Screen_Width/2, heightRow);
  63. [vCodeAndOnlyCode addSubview:vCode];
  64. UILabel *lblCodeTitle = [UILabel new];
  65. lblCodeTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  66. lblCodeTitle.text = @"商品编码:";
  67. lblCodeTitle.textColor = [UIColor blackColor];
  68. lblCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  69. [vCode addSubview:lblCodeTitle];
  70. _lblCode = [UILabel new];
  71. _lblCode.frame=CGRectMake(valuex, valuey, Screen_Width/2 - valuex, valueheight);
  72. _lblCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  73. [vCode addSubview:_lblCode];
  74. _lblCode.text = _procurementDetailModel.code;
  75. UIView *vOnlyCode = [UIView new];
  76. vOnlyCode.frame=CGRectMake(Screen_Width / 2, 0, Screen_Width / 2, heightRow);
  77. [vCodeAndOnlyCode addSubview:vOnlyCode];
  78. UILabel *lblOnlyCodeTitle = [UILabel new];
  79. lblOnlyCodeTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  80. lblOnlyCodeTitle.text = @"唯一编码:";
  81. lblOnlyCodeTitle.textColor = [UIColor blackColor];
  82. lblOnlyCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  83. [vOnlyCode addSubview:lblOnlyCodeTitle];
  84. _lblOnlyCode = [UILabel new];
  85. _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblOnlyCodeTitle.frame), valuey, Screen_Width/2 - valuex , valueheight);
  86. _lblOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  87. [vOnlyCode addSubview:_lblOnlyCode];
  88. _lblOnlyCode.text = _procurementDetailModel.onlyCode;
  89. UIView *vSpecificationAndGrade = [UIView new];
  90. vSpecificationAndGrade.frame=CGRectMake(0, CGRectGetMaxY(vCodeAndOnlyCode.frame), Screen_Width, heightRow);
  91. [self.contentView addSubview:vSpecificationAndGrade];
  92. UIView *vSpecification = [UIView new];
  93. vSpecification.frame=CGRectMake(0, 0, Screen_Width/2, heightRow);
  94. [vSpecificationAndGrade addSubview:vSpecification];
  95. UILabel *lblSpecificationTitle = [UILabel new];
  96. lblSpecificationTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  97. lblSpecificationTitle.text = @"商品规格:";
  98. lblSpecificationTitle.textColor = [UIColor blackColor];
  99. lblSpecificationTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  100. [vSpecification addSubview:lblSpecificationTitle];
  101. _lblSpecification = [UILabel new];
  102. _lblSpecification.frame=CGRectMake(valuex, valuey, Screen_Width/2 - valuex, valueheight);
  103. _lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  104. [vSpecification addSubview:_lblSpecification];
  105. _lblSpecification.text = _procurementDetailModel.goodsSpecification;
  106. UIView *vGrade = [UIView new];
  107. vGrade.frame=CGRectMake(Screen_Width / 2, 0, Screen_Width / 2, heightRow);
  108. [vSpecificationAndGrade addSubview:vGrade];
  109. UILabel *lblGradeTitle = [UILabel new];
  110. lblGradeTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  111. lblGradeTitle.text = @"商品等级:";
  112. lblGradeTitle.textColor = [UIColor blackColor];
  113. lblGradeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  114. [vGrade addSubview:lblGradeTitle];
  115. _lblGrade = [UILabel new];
  116. _lblGrade.frame=CGRectMake(CGRectGetMaxX(lblGradeTitle.frame), valuey, Screen_Width/2 - valuex , valueheight);
  117. _lblGrade.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  118. [vGrade addSubview:_lblGrade];
  119. _lblGrade.text = _procurementDetailModel.gradeName;
  120. UIView *vApplyDepartment = [UIView new];
  121. vApplyDepartment.frame=CGRectMake(0,CGRectGetMaxY(vSpecificationAndGrade.frame), Screen_Width, heightRow);
  122. [self.contentView addSubview:vApplyDepartment];
  123. UILabel *lblApplyDepartmentTitle = [UILabel new];
  124. lblApplyDepartmentTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  125. lblApplyDepartmentTitle.text = @"申请部门:";
  126. lblApplyDepartmentTitle.textColor = [UIColor blackColor];
  127. lblApplyDepartmentTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  128. [vApplyDepartment addSubview:lblApplyDepartmentTitle];
  129. _lblApplyDepartment = [UILabel new];
  130. _lblApplyDepartment.frame=CGRectMake(valuex, valuey, Screen_Width-CGRectGetMaxX(lblApplyDepartmentTitle.frame)-5, valueheight);
  131. _lblApplyDepartment.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  132. [vApplyDepartment addSubview:_lblApplyDepartment];
  133. _lblApplyDepartment.text = _procurementDetailModel.organizationName;
  134. _middleSeparator = [[UIView alloc]init];
  135. _middleSeparator.frame=CGRectMake(0,CGRectGetMaxY(vApplyDepartment.frame)+8, Screen_Width, heightLine);
  136. _middleSeparator.backgroundColor=LineBackgroundColor;
  137. [self.contentView addSubview:_middleSeparator];
  138. }
  139. NSDictionary *procurementDict = @{NSFontAttributeName:[UIFont systemFontOfSize:SubLabelAndTextFontOfSize]};
  140. _lblProcurementQuantity= [[UILabel alloc]init];
  141. _lblProcurementQuantity.font = [UIFont systemFontOfSize:SubLabelAndTextFontOfSize];
  142. _lblProcurementQuantity.textAlignment=NSTextAlignmentLeft;
  143. NSString *procurementQuantity= [NSString stringWithFormat:@"请购数量:%@;核准数量:%@",_procurementDetailModel.applyQuantity,_procurementDetailModel.approvedQuantity];
  144. _lblProcurementQuantity.text=procurementQuantity;
  145. CGRect procurementQuantityFrame = [procurementQuantity textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:procurementDict];
  146. procurementQuantityFrame.origin.x =Screen_Width-xpadding-procurementQuantityFrame.size.width;
  147. procurementQuantityFrame.origin.y =CGRectGetMaxY(_middleSeparator.frame)+ 10;
  148. _lblProcurementQuantity.frame=procurementQuantityFrame;
  149. [self.contentView addSubview:_lblProcurementQuantity];
  150. UIView *bottomSeparator = [[UIView alloc]init];
  151. bottomSeparator.frame=CGRectMake(0,CGRectGetMaxY(_lblProcurementQuantity.frame)+10, Screen_Width, 10);
  152. bottomSeparator.backgroundColor=LineBackgroundColor;
  153. [self.contentView addSubview:bottomSeparator];
  154. _height=CGRectGetMaxY(bottomSeparator.frame);
  155. }
  156. @end