OtherOutStorageListDetailVC.m 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. //
  2. // OtherOutStorageListDetailVC.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/4/27.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "OtherOutStorageListDetailVC.h"
  9. @interface OtherOutStorageListDetailVC ()
  10. @end
  11. @implementation OtherOutStorageListDetailVC
  12. #pragma mark 公共函数
  13. /**
  14. 视图加载完成
  15. */
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. [self loadNavStyle];
  19. [self initUI];
  20. }
  21. /**
  22. 修改:2017-9-25
  23. 适配机型
  24. 安全区视图发生变化
  25. */
  26. -(void)viewSafeAreaInsetsDidChange{
  27. self.view.backgroundColor = [UIColor whiteColor];
  28. _vTableView.frame = CGRectMake(0, 0,Screen_Width, self.view.safeAreaLayoutGuide.layoutFrame.size.height);
  29. [super viewSafeAreaInsetsDidChange];
  30. }
  31. /**
  32. 内存警告函数
  33. */
  34. - (void)didReceiveMemoryWarning {
  35. [super didReceiveMemoryWarning];
  36. }
  37. #pragma mark 委托函数
  38. /**
  39. 加载其它出库列表明细成功回调
  40. @param sender <#sender description#>
  41. */
  42. - (void)onOtherOutStorageListDetailFinish:(ASIDownManager *)sender {
  43. NSDictionary *dic = [sender.mWebStr JSONValue];
  44. _vTableView.backgroundView = nil;
  45. [self stopLoading];
  46. // 服务器返回数据是否正确
  47. if (dic && [dic isKindOfClass:[NSDictionary class]]) {
  48. // 服务器返回数据状态值
  49. int iStatus = [[dic objectForKey:@"Status"] intValue];
  50. // 服务器返回数据消息
  51. NSString *message=[dic objectForKey:@"Message"];
  52. // 服务器返回数据状态值正确
  53. if (iStatus == 0) {
  54. NSArray * infoArr=[dic objectForKey:@"Result"];
  55. // 返回结果
  56. if(infoArr!=nil&& infoArr.count>0)
  57. {
  58. for (int i = 0; i < infoArr.count; i++) {
  59. NSDictionary * dic=infoArr[i];
  60. OtherOutStorageListDetailModel *detailModel=[OtherOutStorageListDetailModel new];
  61. [detailModel parseDic:dic];
  62. detailModel.outStorageNo=_deliveryNo;
  63. [_dataList addObject:detailModel];
  64. }
  65. [_vTableView reloadData];
  66. }
  67. }
  68. // 服务器返回数据状态值异常
  69. else if(iStatus==ActionResultStatusAuthError
  70. ||iStatus==ActionResultStatusNoLogin
  71. ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){
  72. [self showReLoginDialog:message];
  73. }
  74. else{
  75. [self showAlertViewText:message];
  76. }
  77. }
  78. }
  79. /**
  80. 加载其它出库列表明细失败回调
  81. @param sender <#sender description#>
  82. */
  83. - (void)onOtherOutStorageListDetailFail:(ASIDownManager *)sender {
  84. [self stopLoading];
  85. [self showAlertViewText:@"加载失败"];
  86. }
  87. /**
  88. 单元格cell个数
  89. @param tableView <#tableView description#>
  90. @param section <#section description#>
  91. @return <#return value description#>
  92. */
  93. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  94. {
  95. return [_dataList count];
  96. }
  97. /**
  98. <#Description#>
  99. @param tableView <#tableView description#>
  100. @return <#return value description#>
  101. */
  102. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  103. return 1;
  104. }
  105. /**
  106. 高度
  107. @param tableView <#tableView description#>
  108. @param indexPath <#indexPath description#>
  109. @return <#return value description#>
  110. */
  111. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath
  112. *)indexPath{
  113. return 1144;
  114. }
  115. /**
  116. 每个单元格cell
  117. @param tableView <#tableView description#>
  118. @param indexPath <#indexPath description#>
  119. @return <#return value description#>
  120. */
  121. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  122. {
  123. static NSString *cellIdentifier = @"OtherOutStorageListDetailCell";
  124. OtherOutStorageListDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  125. if (!cell) {
  126. cell=[[OtherOutStorageListDetailCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
  127. cell.selectionStyle=UITableViewCellSelectionStyleNone;
  128. }
  129. else
  130. //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免
  131. {
  132. while ([cell.contentView.subviews lastObject] != nil) {
  133. [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview];
  134. }
  135. }
  136. OtherOutStorageListDetailModel *outStorageListDetailModel= [_dataList objectAtIndex:indexPath.row];
  137. [cell setOtherOutStorageListDetailModel:outStorageListDetailModel];
  138. return cell;
  139. }
  140. #pragma mark 私有函数
  141. /**
  142. 导航按钮样式
  143. */
  144. -(void)loadNavStyle
  145. {
  146. self.navigationItem.title=@"商品明细信息";
  147. //返回
  148. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  149. [button setBackgroundImage:[UIImage imageNamed:@"icon_back"]
  150. forState:UIControlStateNormal];
  151. [button addTarget:self action:@selector(goBack)
  152. forControlEvents:UIControlEventTouchUpInside];
  153. button.frame = CGRectMake(0, 0, 15, 18);
  154. UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  155. self.navigationItem.leftBarButtonItem = menuButton;
  156. }
  157. /**
  158. 返回函数
  159. */
  160. - (void)goBack
  161. {
  162. [self.navigationController popViewControllerAnimated:YES];
  163. }
  164. /**
  165. 初始化UI
  166. */
  167. -(void)initUI{
  168. [self.view setBackgroundColor:[UIColor whiteColor]];
  169. _vTableView = [[UITableView alloc]
  170. initWithFrame:CGRectMake(0,
  171. 0,
  172. self.view.frame.size.width,
  173. self.view.frame.size.height)];
  174. _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  175. _vTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  176. _vTableView.backgroundColor = [UIColor whiteColor];
  177. _vTableView.delegate = self;
  178. _vTableView.dataSource=self;
  179. [self.view addSubview: _vTableView];
  180. _dataList=[[NSMutableArray alloc]init];
  181. [self loadData];
  182. }
  183. /**
  184. 加载数据源
  185. */
  186. -(void)loadData{
  187. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  188. [dict setObject:@"GetSalesInventoryDetailIphone" forKey:@"Action"];
  189. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  190. [dict setObject:kkUserCode forKey:@"UserCode"];
  191. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  192. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  193. [dict setObject:_deliveryId forKey:@"DeliveryID"];
  194. _downManager = [[ASIDownManager alloc] init];
  195. [self startLoading];
  196. _downManager.delegate = self;
  197. _downManager.OnImageDown = @selector(onOtherOutStorageListDetailFinish:);
  198. _downManager.OnImageFail = @selector(onOtherOutStorageListDetailFail:);
  199. [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
  200. }
  201. @end