DispatchRequirementNoReceiptController.m 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. //
  2. // DeliveryRequirementNoReceiptController.m
  3. // IBOSSHSH
  4. //
  5. // Created by ssl on 2018/1/12.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "DispatchRequirementNoReceiptController.h"
  9. #import "DispatchNoReceiptCell.h"
  10. #import "SideSlipModel.h"
  11. #import "DispatchNoReceiptSearchModel.h"
  12. #import "DateFormat.h"
  13. @import CoreLocation;
  14. @import MapKit;
  15. #define receiptTextFont [UIFont systemFontOfSize:14]
  16. @interface DispatchRequirementNoReceiptController ()
  17. {
  18. __block CLLocationCoordinate2D coordinate;
  19. }
  20. @end
  21. @implementation DispatchRequirementNoReceiptController
  22. #pragma mark - 公共函数
  23. /**
  24. 加载视图函数
  25. */
  26. - (void)viewDidLoad {
  27. [super viewDidLoad];
  28. _pageNumber = 1;
  29. _dataList = [[NSMutableArray alloc]init];
  30. NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
  31. _appName = [infoDictionary objectForKey:@"CFBundleDisplayName"];
  32. _urlScheme=@"ibossHJ://";
  33. UIView *searchView=[[UIView alloc]init];
  34. searchView.frame=CGRectMake(0, 0, Screen_Width,55);
  35. [searchView setBackgroundColor:[UIColor whiteColor]];
  36. _btnSearch = [UIButton buttonWithType:UIButtonTypeCustom];
  37. _btnSearch.frame=CGRectMake(15, 10, Screen_Width-30, 35);
  38. [_btnSearch setTitle:@"查询" forState:UIControlStateNormal];
  39. [_btnSearch setBackgroundColor:[UIColor colorWithRed:232.0/255.0 green:233.0/255.0 blue:235.0/255.0 alpha:1]];
  40. [self.view addSubview:searchView];
  41. [searchView addSubview:_btnSearch];
  42. _btnSearch.layer.cornerRadius = 10;
  43. _btnSearch.layer.masksToBounds = YES;
  44. [_btnSearch setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
  45. _btnSearch.titleLabel.font=receiptTextFont;
  46. [_btnSearch addTarget:self action:@selector(searchUnreceiptData)
  47. forControlEvents:UIControlEventTouchUpInside];
  48. [self.view addSubview:_btnSearch];
  49. _tableView = [[RefreshTableView alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(searchView.frame), self.view.frame.size.width - 20, self.view.frame.size.height-55)];
  50. _tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
  51. _tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  52. _tableView.backgroundColor = [UIColor clearColor];
  53. _tableView.mTableView.showsVerticalScrollIndicator = NO;
  54. _tableView.delegate = self;
  55. _tableView.mTableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, 49, 0);
  56. [self.view addSubview:_tableView];
  57. _arrangementNo=@"";
  58. _customerName=@"";
  59. _startDate=@"";
  60. _endDate=@"";
  61. __weak typeof(self) weakself=self;
  62. self.filterController = [[SideSlipFilterController alloc] initWithSponsor:self resetBlock:^(NSArray *dataList) {
  63. for (SideSlipModel *model in dataList) {
  64. model.selectedItemList = nil;
  65. model.customDict = nil;
  66. }
  67. } commitBlock:^(NSArray *dataList) {
  68. SideSlipModel *serviceRegionModel = dataList[0];
  69. _pageNumber=1;
  70. DispatchNoReceiptSearchModel *m = [serviceRegionModel.customDict objectForKey:SEARCH_RANGE_MODEL];
  71. _arrangementNo=m.arrangementNo;
  72. _customerName=m.customerName;
  73. _contactsTelephone=m.customerTelephone;
  74. _startDate=m.startDate;
  75. _endDate=m.endDate;
  76. if(_startDate!=nil&&_endDate!=nil){
  77. NSUInteger result= [DateFormat compareDate:_startDate withDate:_endDate];
  78. if(result == -1){
  79. [self showAlertViewText:@"开始日期不能大于结束日期"];
  80. return;
  81. }
  82. }
  83. if(_dataList!=nil&&_dataList.count>0){
  84. [_dataList removeAllObjects];
  85. [_tableView reloadData];
  86. }
  87. [self initData];
  88. [weakself.filterController dismiss];
  89. }];
  90. _filterController.animationDuration = .3f;
  91. _filterController.hasHeadView = YES;
  92. _filterController.sideSlipLeading = UIScreenSideSlipLeading*[UIScreen mainScreen].bounds.size.width;
  93. _filterController.dataList = [self packageDataList];
  94. [self initData];
  95. }
  96. #pragma mark - 委托函数
  97. -(void)onSaveLoadFinish:(ASIDownManager *)sender {
  98. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  99. [self cancel];
  100. int iStatus = resultModel.status;
  101. NSString *message =resultModel.message;
  102. if (iStatus == 0) {
  103. [self showAlertViewText:@"保存成功"];
  104. if(_dataList!=nil&&_dataList.count>0){
  105. [_dataList removeAllObjects];
  106. [_tableView reloadData];
  107. }
  108. [self initData];
  109. }
  110. else if(iStatus == ActionResultStatusAuthError
  111. ||iStatus == ActionResultStatusNoLogin
  112. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  113. [self showReLoginDialog:message];
  114. return;
  115. }
  116. else{
  117. [self showAlertViewText:message];
  118. [_tableView FinishLoading];
  119. return;
  120. }
  121. }
  122. -(void)onSaveLoadFail:(ASIDownManager *)sender {
  123. [self stopLoading];
  124. [self showAlertViewText:@"网络异常"];
  125. }
  126. /**
  127. 数据加载完成函数
  128. @param sender <#sender description#>
  129. */
  130. - (void)onLoadFinish:(ASIDownManager *)sender {
  131. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  132. [self cancel];
  133. long iNewCount = 0;
  134. int iStatus = resultModel.status;
  135. NSString *message =resultModel.message;
  136. if (iStatus == 0) {
  137. NSArray * infoArr = (NSArray *)resultModel.result;
  138. if(infoArr != nil&&infoArr.count > 0)
  139. {
  140. for(int i=0;i<infoArr.count;i++)
  141. {
  142. DispatchNoReceiptModel *model = [DispatchNoReceiptModel dk_modelWithDictionary:infoArr[i]];
  143. if([model.requirementType intValue]==1)
  144. {
  145. [model setReceiptFlag:@"1"];
  146. }
  147. if([model.requirementType intValue]==2)
  148. {
  149. [model setReceiptFlag:@"2"];
  150. }
  151. if([model.requirementType intValue]==3)
  152. {
  153. if([model.deliveryReceiptFlag intValue]==0&&[model.installReceiptFlag intValue]==0)
  154. {
  155. [model setReceiptFlag:@"3"];
  156. }
  157. if([model.deliveryReceiptFlag intValue]==1&&[model.installReceiptFlag intValue]==0)
  158. {
  159. [model setReceiptFlag:@"2"];
  160. }
  161. }
  162. DispatchNoReceiptFrame *listFrame = [DispatchNoReceiptFrame new];
  163. [listFrame setUnReceiptListFrame:model];
  164. [_dataList addObject:listFrame];
  165. }
  166. iNewCount = infoArr.count;
  167. _tableView.mbMoreHidden = (iNewCount == 0);
  168. [_tableView FinishLoading];
  169. [_tableView reloadData];
  170. }
  171. else{
  172. [_tableView FinishLoading];
  173. if(_pageNumber == 1)
  174. {
  175. [self showAlertViewText:@"未找到匹配结果"];
  176. return;
  177. }
  178. else{
  179. _tableView.mbMoreHidden = 1;
  180. }
  181. }
  182. }
  183. else if(iStatus == ActionResultStatusAuthError
  184. ||iStatus == ActionResultStatusNoLogin
  185. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  186. [self showReLoginDialog:message];
  187. return;
  188. }
  189. else{
  190. [self showAlertViewText:message];
  191. [_tableView FinishLoading];
  192. return;
  193. }
  194. }
  195. -(void)updateTruckNumber:(NSUInteger)position truckNumber:(NSString*)truckNumber
  196. {
  197. DispatchNoReceiptFrame *frame = [_dataList objectAtIndex:position];
  198. [frame.unReceiptListModel setTruckName:truckNumber];
  199. }
  200. /**
  201. 数据加载失败函数
  202. @param sender <#sender description#>
  203. */
  204. - (void)onLoadFail:(ASIDownManager *)sender {
  205. [self cancel];
  206. [_tableView reloadData];
  207. [self showAlertViewText:@"网络异常"];
  208. }
  209. -(void)dialTelephone:(NSString *)telephone{
  210. NSString *callPhone = [NSString stringWithFormat:@"telprompt://%@",telephone];
  211. CGFloat version = [[[UIDevice currentDevice]systemVersion]floatValue];
  212. if (version >= 10.0) {
  213. /// 大于等于10.0系统使用此openURL方法
  214. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone] options:@{} completionHandler:nil];
  215. } else {
  216. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
  217. }
  218. }
  219. /**
  220. 加载更多函数
  221. @param sender <#sender description#>
  222. */
  223. - (void)LoadMoreList:(RefreshTableView *)sender {
  224. _pageNumber++;
  225. [self initData];
  226. }
  227. /**
  228. 上拉刷新函数
  229. @param sender <#sender description#>
  230. */
  231. - (void)ReloadList:(RefreshTableView *)sender{
  232. _pageNumber = 1;
  233. [_dataList removeAllObjects];
  234. [_tableView reloadData];
  235. _tableView.mbMoreHidden=YES;
  236. [self initData];
  237. }
  238. /**
  239. tableview的行数
  240. @param tableView <#tableView description#>
  241. @param section <#section description#>
  242. @return <#return value description#>
  243. */
  244. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  245. {
  246. return 1;
  247. }
  248. /**
  249. tableview的分区数
  250. @param tableView <#tableView description#>
  251. @return <#return value description#>
  252. */
  253. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  254. return [_dataList count] ;
  255. }
  256. /**
  257. 获取tableview cell
  258. @param tableView <#tableView description#>
  259. @param indexPath <#indexPath description#>
  260. @return <#return value description#>
  261. */
  262. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  263. {
  264. static NSString *DeliveryCellIdentifier = @"CellId";
  265. DispatchNoReceiptCell *cell = [tableView dequeueReusableCellWithIdentifier:DeliveryCellIdentifier];
  266. cell = [[DispatchNoReceiptCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:DeliveryCellIdentifier];
  267. cell.telephoneDelegate=self;
  268. NSUInteger row = [indexPath section];
  269. DispatchNoReceiptFrame *frame = [_dataList objectAtIndex:row];
  270. cell.position=row;
  271. cell.receiptFlagDelegate=self;
  272. [cell setUnReceiptListFrame:frame];
  273. return cell;
  274. }
  275. -(void)goNavigation:(NSUInteger)position
  276. {
  277. DispatchNoReceiptFrame *frame = [_dataList objectAtIndex:position];
  278. DispatchNoReceiptModel *noReceiptModel= frame.unReceiptListModel;
  279. if(noReceiptModel.deliveryAddress!=nil&&noReceiptModel.deliveryAddress.length>0)
  280. {
  281. CLGeocoder *myGeocoder = [[CLGeocoder alloc] init];
  282. [myGeocoder geocodeAddressString:noReceiptModel.deliveryAddress completionHandler:^(NSArray *placemarks, NSError *error) {
  283. if ([placemarks count] > 0 && error == nil) {
  284. CLPlacemark *firstPlacemark= [placemarks objectAtIndex:0];
  285. coordinate = CLLocationCoordinate2DMake(firstPlacemark.location.coordinate.latitude, firstPlacemark.location.coordinate.longitude) ;
  286. }
  287. // else if ([placemarks count] == 0 && error == nil) {
  288. //             NSLog(@"Found no placemarks.");
  289. //
  290. // }
  291. //         else if (error != nil) {
  292. //           NSLog(@"An error occurred = %@", error); }
  293. }];
  294. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"选择地图" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  295. //这个判断其实是不需要的
  296. if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"http://maps.apple.com/"]])
  297. {
  298. UIAlertAction *action = [UIAlertAction actionWithTitle:@"苹果地图" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  299. MKMapItem *currentLocation = [MKMapItem mapItemForCurrentLocation];
  300. MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:nil]];
  301. [MKMapItem openMapsWithItems:@[currentLocation, toLocation]
  302. launchOptions:@{MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving,MKLaunchOptionsShowsTrafficKey: [NSNumber numberWithBool:YES]}];
  303. }];
  304. [alert addAction:action];
  305. }
  306. if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"baidumap://"]])
  307. {
  308. UIAlertAction *action = [UIAlertAction actionWithTitle:@"百度地图" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  309. NSString *urlString = [[NSString stringWithFormat:@"baidumap://map/direction?origin={{我的位置}}&destination=latlng:%f,%f|name=目的地&mode=driving&coord_type=gcj02",coordinate.latitude, coordinate.longitude] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  310. NSLog(@"%@",urlString);
  311. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
  312. }];
  313. [alert addAction:action];
  314. }
  315. if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"iosamap://"]])
  316. {
  317. UIAlertAction *action = [UIAlertAction actionWithTitle:@"高德地图" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  318. NSString *urlString = [[NSString stringWithFormat:@"iosamap://navi?sourceApplication=%@&backScheme=%@&lat=%f&lon=%f&dev=0&style=2",_appName,_urlScheme,coordinate.latitude, coordinate.longitude] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  319. NSLog(@"%@",urlString);
  320. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
  321. }];
  322. [alert addAction:action];
  323. }
  324. if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]])
  325. {
  326. UIAlertAction *action = [UIAlertAction actionWithTitle:@"谷歌地图" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  327. NSString *urlString = [[NSString stringWithFormat:@"comgooglemaps://?x-source=%@&x-success=%@&saddr=&daddr=%f,%f&directionsmode=driving",_appName,_urlScheme,coordinate.latitude, coordinate.longitude] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  328. NSLog(@"%@",urlString);
  329. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
  330. }];
  331. [alert addAction:action];
  332. }
  333. UIAlertAction *action = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
  334. [alert addAction:action];
  335. [self presentViewController:alert animated:YES completion:^{
  336. }];
  337. }
  338. }
  339. -(void)saveData:(NSUInteger)position
  340. {
  341. DispatchNoReceiptFrame *frame = [_dataList objectAtIndex:position];
  342. if(frame.unReceiptListModel.truckName==nil||[frame.unReceiptListModel.truckName isEqualToString:@""])
  343. {
  344. [self showAlertViewText:@"车牌号为空,请维护车牌号"];
  345. return;
  346. }
  347. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"确定要保存吗?" preferredStyle:UIAlertControllerStyleAlert];
  348. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  349. }];
  350. UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"确定"
  351. style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  352. DispatchNoReceiptFrame *frame = [_dataList objectAtIndex:position];
  353. [self startLoading];
  354. NSString *urlStr = ServerURL;
  355. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  356. [dict setObject:@"SaveInstallationDemandReceiptDataByID" forKey:@"Action"];
  357. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  358. [dict setObject:kkUserCode forKey:@"UserCode"];
  359. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  360. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  361. [dict setObject:frame.unReceiptListModel.arrangementId forKeyedSubscript:@"ArrangementID"];
  362. [dict setObject:frame.unReceiptListModel.collectDetailId forKeyedSubscript:@"CollectDetailID"];
  363. [dict setObject:frame.unReceiptListModel.customerId forKeyedSubscript:@"CustomerID"];
  364. [dict setObject:frame.unReceiptListModel.receiptFlag forKeyedSubscript:@"RequirementType"];
  365. [dict setObject:frame.unReceiptListModel.truckName forKeyedSubscript:@"truckNumber"];
  366. [dict setObject:kkLicenseCode forKeyedSubscript:@"LicenseCode"];
  367. self.mDownManager = [[ASIDownManager alloc] init];
  368. self.mDownManager.delegate = self;
  369. self.mDownManager.onRequestSuccess = @selector(onSaveLoadFinish:);
  370. self.mDownManager.onRequestFail = @selector(onSaveLoadFail:);
  371. [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  372. }];
  373. UIColor *cancelColor = [UIColor blackColor];
  374. UIColor *sureColor = [UIColor redColor];
  375. [cancelAction setValue:cancelColor forKey:@"titleTextColor"];
  376. [otherAction setValue:sureColor forKey:@"titleTextColor"];
  377. [alertController addAction:cancelAction];
  378. [alertController addAction:otherAction];
  379. [self presentViewController:alertController animated:YES completion:nil];
  380. }
  381. -(void)updateReceiptFlag:(NSUInteger)position receiptFlag:(NSString *)flag
  382. {
  383. DispatchNoReceiptFrame *frame = [_dataList objectAtIndex:position];
  384. [frame.unReceiptListModel setReceiptFlag:flag];
  385. [_tableView reloadData];
  386. }
  387. /**
  388. tableview分区视图
  389. @param tableView <#tableView description#>
  390. @param section <#section description#>
  391. @return <#return value description#>
  392. */
  393. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  394. {
  395. UIView *view = [[UIView alloc] init];
  396. view.backgroundColor = [UIColor clearColor];
  397. return view ;
  398. }
  399. /**
  400. tableview分区的间隔高度
  401. @param tableView <#tableView description#>
  402. @param section <#section description#>
  403. @return <#return value description#>
  404. */
  405. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  406. {
  407. return 10;
  408. }
  409. /**
  410. tableview的高度
  411. @param tableView <#tableView description#>
  412. @param indexPath <#indexPath description#>
  413. @return <#return value description#>
  414. */
  415. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  416. NSUInteger row = [indexPath section];
  417. DispatchNoReceiptFrame *unReceiptListFrame = [_dataList objectAtIndex:row];
  418. NSInteger cellHeight = [unReceiptListFrame cellHeight];
  419. return cellHeight;
  420. }
  421. /**
  422. scrollview滚动代理
  423. @param scrollView <#scrollView description#>
  424. */
  425. - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
  426. if (scrollView.isDragging) {//显示下拉更新
  427. if (_tableView.mRefreshHeader.state == PullRefreshPulling && scrollView.contentOffset.y > -65.0f && scrollView.contentOffset.y < 0.0f && [_tableView CanRefresh]) {
  428. [_tableView.mRefreshHeader setState:PullRefreshNormal];
  429. }
  430. else if (_tableView.mRefreshHeader.state == PullRefreshNormal && scrollView.contentOffset.y < -65.0f && [_tableView CanRefresh]) {
  431. //显示松开更新
  432. [_tableView.mRefreshHeader setState:PullRefreshPulling];
  433. }
  434. }
  435. }
  436. /**
  437. tableview点击函数
  438. @param tableView <#tableView description#>
  439. @param indexPath <#indexPath description#>
  440. */
  441. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  442. {
  443. NewDispatchRequirementHomeController *newDeliveryVC = [[NewDispatchRequirementHomeController alloc] init];
  444. NSUInteger row = [indexPath section];
  445. newDeliveryVC.refreshDelegate = self;
  446. DispatchNoReceiptFrame *frame = [_dataList objectAtIndex:row];
  447. DispatchNoReceiptModel *model = [frame unReceiptListModel];
  448. newDeliveryVC.noReceiptModel = model;
  449. self.cNav.visibleViewController.hidesBottomBarWhenPushed = YES;
  450. [self.cNav pushViewController:newDeliveryVC animated:YES];
  451. }
  452. /**
  453. 刷新数据函数
  454. */
  455. - (void)refreshFollowUpData{
  456. [_dataList removeAllObjects];
  457. _tableView.mbMoreHidden = YES;
  458. [_tableView reloadData];
  459. _pageNumber = 1;
  460. [self initData];
  461. }
  462. /**
  463. 是否能刷新tableview
  464. @param sender <#sender description#>
  465. @return <#return value description#>
  466. */
  467. - (BOOL)CanRefreshTableView:(RefreshTableView *)sender {
  468. return YES;
  469. }
  470. #pragma mark - 私有函数
  471. -(void) refreshData
  472. {
  473. [_dataList removeAllObjects];
  474. _tableView.mbMoreHidden = YES;
  475. [_tableView reloadData];
  476. _pageNumber = 1;
  477. [self initData];
  478. }
  479. /**
  480. 加载数据函数
  481. */
  482. - (void)initData
  483. {
  484. [self startLoading];
  485. NSString *urlStr = ServerURL;
  486. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  487. [dict setObject:@"GetInstallationReceiptNoReceiptIphone" forKey:@"Action"];
  488. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  489. [dict setObject:kkUserCode forKey:@"UserCode"];
  490. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  491. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  492. [dict setObject:_arrangementNo forKeyedSubscript:@"ArrangementNo"];
  493. [dict setObject:_customerName forKeyedSubscript:@"CustomerName"];
  494. [dict setObject:_contactsTelephone forKeyedSubscript:@"Telephone"];
  495. [dict setObject:_startDate forKeyedSubscript:@"BeginTime"];
  496. [dict setObject:_endDate forKeyedSubscript:@"EndTime"];
  497. [dict setObject:[NSString stringWithFormat:@"%d",(int)_pageNumber] forKey:@"PageNum"];
  498. [dict setObject:[NSString stringWithFormat:@"%d",pageSize] forKey:@"PageSize"];
  499. self.mDownManager = [[ASIDownManager alloc] init];
  500. self.mDownManager.delegate = self;
  501. self.mDownManager.onRequestSuccess = @selector(onLoadFinish:);
  502. self.mDownManager.onRequestFail = @selector(onLoadFail:);
  503. [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  504. }
  505. /**
  506. 弹出抽屉
  507. */
  508. -(void)searchUnreceiptData{
  509. [_filterController showPagerView:self.cNav];
  510. }
  511. /**
  512. 抽屉加载布局
  513. @return
  514. */
  515. - (NSArray *)packageDataList {
  516. NSMutableArray *dataArray = [NSMutableArray array];
  517. SideSlipModel *model = [[SideSlipModel alloc] init];
  518. model.containerCellClass = @"DispatchNoReceiptSearchCell";
  519. model.regionTitle = @"查询条件";
  520. [dataArray addObject:model];
  521. return [dataArray mutableCopy];
  522. }
  523. /**
  524. 取消进度条
  525. */
  526. - (void)cancel {
  527. [self stopLoading];
  528. }
  529. @end