UnReceiptListFrame.m 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. //
  2. // UnReceiptListFrame.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 16/4/14.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. // 功能描述:配送未回执frame
  9. #import "UnReceiptListFrame.h"
  10. #import "UnReceiptListModel.h"
  11. #import "NSString+Tools.h"
  12. #import "DateFormat.h"
  13. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  14. #define kTitleFont [UIFont systemFontOfSize:14]
  15. @implementation UnReceiptListFrame
  16. #pragma mark - 私有函数
  17. /**
  18. 设置未回执frame
  19. @param unReceiptListModel <#unReceiptListModel description#>
  20. */
  21. - (void)setUnReceiptListFrame:(UnReceiptListModel *)unReceiptListModel{
  22. _unReceiptListModel=unReceiptListModel;
  23. NSDictionary *unReceiptDict = @{NSFontAttributeName:kTitleFont};
  24. CGFloat xpadding = 10;
  25. NSString *deliveryNoTitle = @"送货单号:";
  26. CGRect lblDeliveryNoFrame = [deliveryNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  27. lblDeliveryNoFrame.origin.x = xpadding;
  28. lblDeliveryNoFrame.origin.y = 15;
  29. _lblDeliveryNoF = lblDeliveryNoFrame;
  30. NSString *deliveryNo = [unReceiptListModel deliveryNo];
  31. if(deliveryNo != nil && deliveryNo.length > 0){
  32. CGRect deliveryNoFrame = CGRectMake(CGRectGetMaxX(_lblDeliveryNoF), 15, SCREENWIDTH - 20 -CGRectGetMaxX(_lblDeliveryNoF), 16);
  33. _deliveryNoF = deliveryNoFrame;
  34. }
  35. _btnDialTelephoneF=CGRectMake(Screen_Width-56,8,32,32);
  36. _separatorF=CGRectMake(0,CGRectGetMaxY(_lblDeliveryNoF)+15, Screen_Width, 1);
  37. NSString *arrangementNoTitle = @"安排单号:";
  38. CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  39. lblArrangementNoFrame.origin.x = xpadding;
  40. lblArrangementNoFrame.origin.y = CGRectGetMaxY(_separatorF) + 15;
  41. _lblArrangementNoF = lblArrangementNoFrame;
  42. NSString *arrangementNo = [unReceiptListModel arrangementNo];
  43. if(arrangementNo != nil && arrangementNo.length>0){
  44. CGRect arrangementNoFrame = [arrangementNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  45. arrangementNoFrame.origin.x = CGRectGetMaxX(_lblArrangementNoF);
  46. arrangementNoFrame.origin.y = CGRectGetMaxY(_separatorF) + 15;
  47. _arrangementNoF= arrangementNoFrame;
  48. }
  49. NSString *customerNameTitle = @"客户名称:";
  50. CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  51. lblCustomerNameFrame.origin.x = xpadding;
  52. lblCustomerNameFrame.origin.y = CGRectGetMaxY(_lblArrangementNoF) + 15;
  53. _lblCustomerNameF = lblCustomerNameFrame;
  54. NSString *customerName = [unReceiptListModel customerName];
  55. if(customerName != nil && customerName.length > 0){
  56. CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  57. customerNameFrame.origin.x = CGRectGetMaxX(_lblCustomerNameF);
  58. customerNameFrame.origin.y = CGRectGetMaxY(_lblArrangementNoF) + 15;
  59. _customerNameF = customerNameFrame;
  60. }
  61. NSString *telephponeTitle = @"客户电话:";
  62. CGRect lblTelephoneFrame = [telephponeTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  63. lblTelephoneFrame.origin.x = xpadding;
  64. lblTelephoneFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15;
  65. _lblCustomerTelephoneF = lblTelephoneFrame;
  66. NSString *telephone = [unReceiptListModel telephone];
  67. if(telephone != nil && telephone.length > 0){
  68. CGRect telephoneFrame = [telephone textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  69. telephoneFrame.origin.x = CGRectGetMaxX(_lblCustomerTelephoneF);
  70. telephoneFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15;
  71. _customerTelephoneF = telephoneFrame;
  72. }
  73. NSString *deliveryDateTitle = @"送货日期:";
  74. CGRect lblDeliveryDateFrame = [deliveryDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  75. lblDeliveryDateFrame.origin.x = xpadding;
  76. lblDeliveryDateFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
  77. _lblDeliveryDateF=lblDeliveryDateFrame;
  78. NSString *deliveryDate = [unReceiptListModel deliveryDate];
  79. deliveryDate= [DateFormat dateFormatSplit:deliveryDate];
  80. if(deliveryDate != nil && deliveryDate.length > 0){
  81. CGRect deliveryDateFrame = [deliveryDate textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  82. deliveryDateFrame.origin.x = CGRectGetMaxX(lblDeliveryDateFrame);
  83. deliveryDateFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
  84. _deliveryDateF = deliveryDateFrame;
  85. }
  86. NSString *truckNameTitle = @"车牌号码:";
  87. CGRect lblTruckNameFrame = [truckNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  88. lblTruckNameFrame.origin.x = Screen_Width / 2;
  89. lblTruckNameFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
  90. _lblTruckNameF = lblTruckNameFrame;
  91. NSString *truckName = [unReceiptListModel truckName];
  92. if(truckName != nil && truckName.length > 0){
  93. CGRect truckNameFrame = [truckName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  94. truckNameFrame.origin.x = CGRectGetMaxX(_lblTruckNameF);
  95. truckNameFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
  96. _truckNameF = truckNameFrame;
  97. }
  98. NSString *customerAddressTitle = @"客户地址:";
  99. CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  100. lblCustomerAddressFrame.origin.x = xpadding;
  101. lblCustomerAddressFrame.origin.y = CGRectGetMaxY(lblDeliveryDateFrame) + 15;
  102. _lblCustomerAddressF = lblCustomerAddressFrame;
  103. NSString *customerAddress = [unReceiptListModel deliveryAddress];
  104. if(customerAddress!=nil&&customerAddress.length>0){
  105. CGRect customerAddressFrame = [customerAddress textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  106. customerAddressFrame.origin.x = CGRectGetMaxX(_lblCustomerAddressF);
  107. customerAddressFrame.origin.y = CGRectGetMaxY(_lblDeliveryDateF) + 15;
  108. _customerAddressF = customerAddressFrame;
  109. }
  110. NSString *staffName =[unReceiptListModel staffName];
  111. NSString *organizationName = [unReceiptListModel organizationName];
  112. if((organizationName==nil||[organizationName isEqualToString:@""])&&(staffName==nil||[staffName isEqualToString:@""])){
  113. _cellHeight = CGRectGetMaxY(_lblCustomerAddressF)+5;
  114. }
  115. else{
  116. NSString *organizationNameTitle = @"业务部门:";
  117. CGRect lblOrganizationNameFrame = [organizationNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  118. lblOrganizationNameFrame.origin.x = xpadding;
  119. lblOrganizationNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  120. _lblOrganizationNameF = lblOrganizationNameFrame;
  121. if(organizationName!=nil&&organizationName.length>0){
  122. CGRect organizationNameFrame = [organizationName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  123. organizationNameFrame.origin.x = CGRectGetMaxX(_lblOrganizationNameF);
  124. organizationNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  125. if(organizationNameFrame.size.width>Screen_Width/2-lblOrganizationNameFrame.size.width){
  126. organizationNameFrame.size.width=Screen_Width/2-lblOrganizationNameFrame.size.width-3;
  127. }
  128. _organizationNameF = organizationNameFrame;
  129. }
  130. NSString *staffNameTitle = @"业 务 员:";
  131. CGRect lblStaffNameFrame = [staffNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  132. lblStaffNameFrame.origin.x = Screen_Width/2;
  133. lblStaffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  134. _lblStaffNameF = lblStaffNameFrame;
  135. if(staffName!=nil&&staffName.length>0){
  136. CGRect staffNameFrame = [staffName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  137. staffNameFrame.origin.x = CGRectGetMaxX(_lblStaffNameF);
  138. staffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  139. _staffNameF = staffNameFrame;
  140. }
  141. _cellHeight = CGRectGetMaxY(_lblOrganizationNameF)+5;
  142. }
  143. }
  144. @end