RepairReceiptFrame.m 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. //
  2. // RepairReceiptFrame.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 2017/7/18.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. #import "RepairReceiptFrame.h"
  9. #import "NSString+Tools.h"
  10. #import "DateFormat.h"
  11. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. #define kTitleFont [UIFont systemFontOfSize:14]
  13. @implementation RepairReceiptFrame
  14. #pragma 私有函数
  15. /**
  16. 设置维修已回执frame
  17. @param repairReceiptedModel <#repairReceiptedModel description#>
  18. */
  19. - (void)setRepairReceiptFrame:(RepairReceiptListModel *)repairReceiptedModel{
  20. _repairReceiptModel= repairReceiptedModel;
  21. NSDictionary *repairDict = @{NSFontAttributeName:kTitleFont};
  22. CGFloat xpadding =10;
  23. NSString *receiptNoTitle = @"回执单号:";
  24. CGRect lblReceiptNoFrame = [receiptNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict];
  25. lblReceiptNoFrame.origin.x=xpadding;
  26. lblReceiptNoFrame.origin.y=15;
  27. _lblReceiptNoF= lblReceiptNoFrame;
  28. NSString *receiptNo = [_repairReceiptModel receiptNo ];
  29. if(receiptNo != nil&&receiptNo.length>0){
  30. CGRect receiptNoFrame = [receiptNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict];
  31. receiptNoFrame.origin.x =CGRectGetMaxX(_lblReceiptNoF);
  32. receiptNoFrame.origin.y =15;
  33. _receiptNoF= receiptNoFrame;
  34. }
  35. _separatorF=CGRectMake(0,CGRectGetMaxY( _lblReceiptNoF)+15, Screen_Width, 1);
  36. NSString *arrangementNoTitle = @"安排单号:";
  37. CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict];
  38. lblArrangementNoFrame.origin.x=xpadding;
  39. lblArrangementNoFrame.origin.y=CGRectGetMaxY(_separatorF)+15;
  40. _lblArrangementNoF=lblArrangementNoFrame;
  41. NSString *arrangementNo = [_repairReceiptModel arrangementNo];
  42. if(arrangementNo != nil&&arrangementNo.length>0){
  43. CGRect arrangementNoFrame = [arrangementNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict];
  44. arrangementNoFrame.origin.x =CGRectGetMaxX(_lblArrangementNoF);
  45. arrangementNoFrame.origin.y =CGRectGetMaxY(_separatorF)+15;
  46. _arrangementNoF=arrangementNoFrame;
  47. }
  48. NSString *repairNoTitle = @"维修单号:";
  49. CGRect lblRepairNoFrame = [repairNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict];
  50. lblRepairNoFrame.origin.x=xpadding;
  51. lblRepairNoFrame.origin.y=CGRectGetMaxY(_lblArrangementNoF)+15;
  52. _lblRepairNoF=lblRepairNoFrame;
  53. NSString *repairNo = [_repairReceiptModel repairNo];
  54. if(repairNo != nil&&repairNo.length>0){
  55. CGRect repairNoFrame = [repairNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict];
  56. repairNoFrame.origin.x =CGRectGetMaxX(_lblRepairNoF);
  57. repairNoFrame.origin.y =CGRectGetMaxY(_lblArrangementNoF)+15;
  58. _repairNoF=repairNoFrame;
  59. }
  60. NSString *customerNameTitle = @"客户名称:";
  61. CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict];
  62. lblCustomerNameFrame.origin.x=xpadding;
  63. lblCustomerNameFrame.origin.y=CGRectGetMaxY(_lblRepairNoF)+15;
  64. _lblCustomerNameF=lblCustomerNameFrame;
  65. NSString *customerName = [_repairReceiptModel customerName];
  66. if(customerName != nil&&customerName.length>0){
  67. CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict];
  68. customerNameFrame.origin.x =CGRectGetMaxX(_lblCustomerNameF);
  69. customerNameFrame.origin.y =CGRectGetMaxY(_lblRepairNoF)+15;
  70. _customerNameF=customerNameFrame;
  71. }
  72. NSString *serviceStaffTitle = @"服务员工:";
  73. CGRect lblServiceStaffFrame = [serviceStaffTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict];
  74. lblServiceStaffFrame.origin.x=Screen_Width/2;
  75. lblServiceStaffFrame.origin.y=CGRectGetMaxY(_lblRepairNoF)+15;
  76. _lblServiceStaffF=lblServiceStaffFrame;
  77. NSString *serviceStaffName = [_repairReceiptModel serviceStaffName];
  78. if(serviceStaffName != nil&&serviceStaffName.length>0){
  79. CGRect serviceStaffNameFrame = [serviceStaffName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict];
  80. serviceStaffNameFrame.origin.x =CGRectGetMaxX(_lblServiceStaffF);
  81. serviceStaffNameFrame.origin.y =CGRectGetMaxY(_lblRepairNoF)+15;
  82. _serviceStaffF=serviceStaffNameFrame;
  83. }
  84. NSString *customerAddressTitle = @"客户地址:";
  85. CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict];
  86. lblCustomerAddressFrame.origin.x = xpadding;
  87. lblCustomerAddressFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15;
  88. _lblCustomerAddressF=lblCustomerAddressFrame;
  89. NSString *customerAddress = [_repairReceiptModel customerAddress];
  90. if(customerAddress != nil &&customerAddress.length > 0){
  91. CGRect customerAddressFrame=CGRectMake( CGRectGetMaxX(_lblCustomerAddressF), CGRectGetMaxY(_lblCustomerNameF)+15, Screen_Width- CGRectGetMaxX(_lblCustomerAddressF)-5, 16.7);
  92. _customerAddressF = customerAddressFrame;
  93. }
  94. NSString *customerTelephoneTitle = @"客户电话:";
  95. CGRect lblCustomerTelephoneFrame = [customerTelephoneTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict];
  96. lblCustomerTelephoneFrame.origin.x = xpadding;
  97. lblCustomerTelephoneFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  98. _lblCustomerTelephoneF = lblCustomerTelephoneFrame;
  99. NSString *customerTelephone = [_repairReceiptModel customerTelephone];
  100. if(customerTelephone != nil && customerTelephone.length > 0){
  101. CGRect customerTelephoneFrame=CGRectMake( CGRectGetMaxX(_lblCustomerTelephoneF)+2, CGRectGetMaxY(_lblCustomerAddressF)+15, Screen_Width- CGRectGetMaxX(_lblCustomerTelephoneF)-2-5, 16.7);
  102. _customerTelephoneF = customerTelephoneFrame;
  103. }
  104. NSString *receiptDateTitle = @"回执日期:";
  105. CGRect lblReceiptDateFrame = [receiptDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict];
  106. lblReceiptDateFrame.origin.x=xpadding;
  107. lblReceiptDateFrame.origin.y=CGRectGetMaxY(_lblCustomerTelephoneF)+15;
  108. _lblReceiptDateF=lblReceiptDateFrame;
  109. NSString *receiptDate = [_repairReceiptModel receiptDate];
  110. if(receiptDate != nil&&receiptDate.length>0){
  111. receiptDate= [DateFormat dateFormatSplit:receiptDate];
  112. CGRect receiptDateFrame = [receiptDate textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict];
  113. receiptDateFrame.origin.x =CGRectGetMaxX(_lblReceiptDateF);
  114. receiptDateFrame.origin.y =CGRectGetMaxY(_lblCustomerTelephoneF)+15;
  115. _receiptDateF=receiptDateFrame;
  116. }
  117. NSString *receiptStatusTitle = @"回执状态:";
  118. CGRect lblReceiptStatusFrame = [receiptStatusTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict];
  119. lblReceiptStatusFrame.origin.x=Screen_Width/2;
  120. lblReceiptStatusFrame.origin.y=CGRectGetMaxY(_lblCustomerTelephoneF)+15;
  121. _lblReceiptStatusF=lblReceiptStatusFrame;
  122. NSString *recReceiptType = [_repairReceiptModel recReceiptType];
  123. if(recReceiptType != nil&&recReceiptType.length>0){
  124. if ([recReceiptType isEqualToString:@"1"]) {
  125. recReceiptType = @"完成";
  126. }
  127. if ([recReceiptType isEqualToString:@"0"]) {
  128. recReceiptType = @"再安排";
  129. }
  130. CGRect recReceiptTypeFrame = [recReceiptType textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict];
  131. recReceiptTypeFrame.origin.x =CGRectGetMaxX(_lblReceiptStatusF);
  132. recReceiptTypeFrame.origin.y =CGRectGetMaxY(_lblCustomerTelephoneF)+15;
  133. _receiptStatusF=recReceiptTypeFrame;
  134. }
  135. _cellHeight=CGRectGetMaxY( _lblReceiptDateF)+5;
  136. }
  137. @end