| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- //
- // OtherInStorageGoodsDetailListVC.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2018/4/23.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "OtherInStorageGoodsDetailListVC.h"
- @interface OtherInStorageGoodsDetailListVC ()
- @end
- @implementation OtherInStorageGoodsDetailListVC
- #pragma mark - 公共函数
- /**
- 视图加载完成函数
- */
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self loadNavStyle];
- [self initUI];
- }
- /**
- 修改:2017-9-25
- 适配机型
- 安全区视图发生变化
- */
- -(void)viewSafeAreaInsetsDidChange{
- self.view.backgroundColor = [UIColor whiteColor];
- _vTableView.frame = CGRectMake(0,CGRectGetMaxY(_topSeparatorView.frame),Screen_Width, self.view.safeAreaLayoutGuide.layoutFrame.size.height-CGRectGetMaxY(_topSeparatorView.frame) );
-
- [super viewSafeAreaInsetsDidChange];
- }
- /**
- 内存警告函数
- */
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
-
- }
- #pragma mark - 委托函数
- /**
- 入库列表明细数据加载成功回调
- @param sender <#sender description#>
- */
- - (void)onInStorageListDetailFinish:(ASIDownManager *)sender {
- NSDictionary *dic = [sender.mWebStr JSONValue];
- _vTableView.backgroundView = nil;
- [self stopLoading];
- // 服务器返回数据是否正确
- if (dic && [dic isKindOfClass:[NSDictionary class]]) {
- // 服务器返回数据状态值
- int iStatus = [[dic objectForKey:@"Status"] intValue];
- // 服务器返回数据消息
- NSString *message=[dic objectForKey:@"Message"];
- // 服务器返回数据状态值正确
- if (iStatus == 0) {
- NSArray * infoArr=[dic objectForKey:@"Result"];
- // 返回结果
- if(infoArr!=nil&& infoArr.count>0)
- {
- for(int i=0;i<infoArr.count;i++){
- NSDictionary *dic= infoArr[i];
- OtherInStorageGoodsListDetailModel *goodsListDetailModel=[OtherInStorageGoodsListDetailModel new];
- [goodsListDetailModel parseDic:dic];
- goodsListDetailModel.enterNo=_enterNo;
- [_dataList addObject:goodsListDetailModel];
- }
-
-
- [_vTableView reloadData];
-
- }
- else{
- [self showAlertViewText:@"无数据"];
- return;
- }
-
- }
- // 服务器返回数据状态值异常
- else if(iStatus==ActionResultStatusAuthError
- ||iStatus==ActionResultStatusNoLogin
- ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){
-
- [self showReLoginDialog:message];
- }
- else{
-
- [self showAlertViewText:message];
- }
- }
- }
- /**
- 入库列表明细加载失败回调
- @param sender <#sender description#>
- */
- - (void)onInStorageListDetailFail:(ASIDownManager *)sender {
- [self stopLoading];
- [self showAlertViewText:@"加载失败"];
- }
- /**
- 单元格cell个数
-
- @param tableView <#tableView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [_dataList count];
- }
- /**
- tableview的分区数
- @param tableView <#tableView description#>
- @return <#return value description#>
- */
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- /**
- 高度
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 1184;
-
- }
- /**
- 每个单元格cell
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *CellIdentifier = @"SalesInStorageListDetailCell";
- SalesInStorageListDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier ];
- if (!cell) {
- cell=[[SalesInStorageListDetailCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
- cell.selectionStyle=UITableViewCellSelectionStyleNone;
- }
- else
- //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免
- {
- while ([cell.contentView.subviews lastObject] != nil) {
- [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview];
- }
- }
-
- _goodsListDetailModel= [_dataList objectAtIndex:indexPath.row];
- [cell setSalesInStorageListDetailModel:_goodsListDetailModel];
-
- return cell;
- }
- #pragma mark - 私有函数
- /**
- 导航按钮样式
- */
- -(void)loadNavStyle
- {
- self.navigationItem.title=@"商品明细信息";
- //返回
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- [button setBackgroundImage:[UIImage imageNamed:@"icon_back"]
- forState:UIControlStateNormal];
- [button addTarget:self action:@selector(goBack)
- forControlEvents:UIControlEventTouchUpInside];
- button.frame = CGRectMake(0, 0, 15, 18);
-
- UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
- self.navigationItem.leftBarButtonItem = menuButton;
- }
- /**
- 初始化UI
- */
- -(void)initUI{
- _topSeparatorView= [UIView new];
- _topSeparatorView.frame = CGRectMake(0, 0, Screen_Width, 10);
- _topSeparatorView.backgroundColor=LineBackgroundColor;
- [self.view addSubview:_topSeparatorView];
- _vTableView = [[UITableView alloc]
- initWithFrame:CGRectMake(0,
- CGRectGetMaxY(_topSeparatorView.frame),
- self.view.frame.size.width,
- self.view.frame.size.height)];
-
- _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- _vTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
- _vTableView.backgroundColor = [UIColor whiteColor];
- _vTableView.delegate = self;
- _vTableView.dataSource=self;
- [self.view addSubview: _vTableView];
- _dataList=[[NSMutableArray alloc]init];
- [self loadData];
-
- }
- /**
- 加载数据源
- */
- -(void)loadData{
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetEnterDataDetailIphone" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [dict setObject:_enterId forKey:@"EnterID"];
- _downManager = [[ASIDownManager alloc] init];
- [self startLoading];
- _downManager.delegate = self;
- _downManager.OnImageDown = @selector(onInStorageListDetailFinish:);
- _downManager.OnImageFail = @selector(onInStorageListDetailFail:);
- [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
- }
- /**
- 返回函数
- */
- - (void)goBack
- {
- [self.navigationController popViewControllerAnimated:YES];
- }
- @end
|