| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- //
- // InventoryUnfreezeOrderSearchViewController.m
- // IBOSS
- //
- // Created by 关宏厚 on 2020/5/9.
- // Copyright © 2020 elongtian. All rights reserved.
- //
- #import "InventoryUnfreezeOrderSearchViewController.h"
- @interface InventoryUnfreezeOrderSearchViewController ()
- @end
- @implementation InventoryUnfreezeOrderSearchViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self initUI];
- _unfreezeOrderList=[[NSMutableArray alloc]init];
- [self initSlideSlip];
- }
- -(void)initUI
- {
- self.view.backgroundColor = [UIColor whiteColor];
- _searchView = [[UIView alloc] init];
- _searchView.frame = CGRectMake(15,10,Screen_Width-30,35);
- _searchView.backgroundColor = LineBackgroundColor;
- _searchView.layer.cornerRadius = 10;
- _searchView.layer.masksToBounds = YES;
- UIButton *btnSearch = [UIButton buttonWithType:UIButtonTypeCustom];
- btnSearch.frame = CGRectMake(20,0, Screen_Width-40, 35);
- btnSearch.layer.cornerRadius = 6.0f;
- [btnSearch setTitle:@"库存解冻订单查询" forState:UIControlStateNormal];
- [btnSearch setTitleColor:NavBarUnEnbleItemColor forState:UIControlStateNormal];
- btnSearch.titleLabel.textAlignment = NSTextAlignmentCenter;
- btnSearch.titleLabel.font = [UIFont systemFontOfSize:LabelAndTextFontOfSize];
-
- [btnSearch addTarget:self action:@selector(dataSearch) forControlEvents:UIControlEventTouchUpInside];
- [_searchView addSubview:btnSearch];
- [self.view addSubview:_searchView];
-
- UIView *topSeparator= [UIView new];
- topSeparator.frame=CGRectMake(0,CGRectGetMaxY(_searchView.frame)+10, Screen_Width, 10);
- topSeparator.backgroundColor = LineBackgroundColor;
- [self.view addSubview:topSeparator];
-
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(topSeparator.frame),self.view.frame.size.width, self.view.frame.size.height-rectStatusHeight-rectNavHeight)];
- _tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
- _tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
- _tableView.delegate = self;
- _tableView.dataSource=self;
- [self.view addSubview:_tableView];
- }
- /**
- 抽屉初始化
- */
- - (void)initSlideSlip{
- // 抽屉对象
- __weak typeof(self) weakself = self;
- self.filterController = [[SideSlipFilterController alloc]
- initWithSponsor:self
- resetBlock:^(NSArray *dataList) {
- for (SideSlipModel *model in dataList)
- {
-
- model.selectedItemList = nil;
- model.customDict = nil;
- }
- }
- commitBlock:^(NSArray *dataList) {
- // 查询条件
- SideSlipModel *serviceRegionModel = dataList[0];
-
- InventoryUnfreezeOrderSearchModel *searchModel = [serviceRegionModel.customDict objectForKey:INVENTORY_UNFREEZE_ORDER_SEARCH_MODEL];
- self->_approver=searchModel.approver;
- self->_freezeNo=searchModel.freezeNo;
- self->_unfreezeNo=searchModel.unfreezeNo;
- self->_accountStartDate=searchModel.accountDateFrom;
- self->_accountEndDate=searchModel.accountDateEnd;
- if(self->_unfreezeOrderList!=nil&&self->_unfreezeOrderList.count>0)
- {
- [self->_unfreezeOrderList removeAllObjects];
- [self->_tableView reloadData];
- }
- [self startLoading];
- [self loadData];
- [weakself.filterController dismiss];
-
-
-
-
- }];
- _filterController.animationDuration = AnimationDuration;
- _filterController.hasHeadView = YES;
- _filterController.sideSlipLeading = UIScreenSideSlipLeading*[UIScreen mainScreen].bounds.size.width;
- _filterController.dataList = [self packageDataList];
- }
- -(void)dataSearch
- {
- [_filterController showPagerView:self.cNav];
- }
- -(void)loadData
- {
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetUnFreezeDataIPhone" 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:(_unfreezeNo==nil?@"":_unfreezeNo) forKey:@"UnFreezeNo"];
- [dict setObject:(_approver==nil?@"":_approver) forKey:@"ReviewerName"];
- [dict setObject:(_freezeNo==nil?@"":_freezeNo) forKey:@"FreezeNo"];
- [dict setObject:(_accountStartDate==nil?@"":_accountStartDate) forKey:@"AccountDateFrom"];
- [dict setObject:(_accountEndDate==nil?@"":_accountEndDate) forKey:@"AccountDateEnd"];
- _mDownManager = [[ASIDownManager alloc] init];
- [self startLoading];
- _mDownManager.delegate = self;
- _mDownManager.onRequestSuccess = @selector(onOrderListLoadFinish:);
- _mDownManager.onRequestFail = @selector(onOrderListLoadFail:);
- [_mDownManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
- }
- -(void)onOrderListLoadFinish:(ASIDownManager *)sender {
- [self cancel];
- RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
- int iStatus = resultModel.status;
- // 服务器返回数据消息
- NSString *message = resultModel.message;
-
- if(iStatus==0)
- {
- NSArray *resultArray=(NSArray*)resultModel.result;
- if(resultArray!=nil&&resultArray.count>0)
- {
- for(int i=0;i<resultArray.count;i++)
- {
- NSDictionary *resultDic=[resultArray objectAtIndex:i];
-
- InventoryUnfreezeOrderListModel *orderListModel=[InventoryUnfreezeOrderListModel dk_modelWithDictionary:resultDic];
- [_unfreezeOrderList addObject:orderListModel];
- }
- [_tableView reloadData];
-
- }
- }
- // 服务器返回数据状态值异常
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
-
- [self showReLoginDialog:message];
- }
- else{
-
- [self showAlertViewText:message];
- }
- }
- -(void)onOrderListLoadFail:(ASIDownManager *)sender {
-
- [self cancel];
- [self showAlertViewText:@"网络异常"];
- }
- /**
- 进度条隐藏
- */
- - (void)cancel {
- [self stopLoading];
- }
- /**
- 抽屉数据源
- @return <#return value description#>
- */
- - (NSArray *)packageDataList {
- NSMutableArray *dataArray = [NSMutableArray array];
- SideSlipModel *model = [[SideSlipModel alloc] init];
- model.containerCellClass = @"InventoryUnfreezeOrderSearchCell";
- model.regionTitle = @"查询条件";
-
- [dataArray addObject:model];
- return [dataArray mutableCopy];
- }
- /**
- 单元格cell个数
- @param tableView <#tableView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [_unfreezeOrderList count];
- }
- /**
- table view 分区数
- @param tableView <#tableView description#>
- @return <#return value description#>
- */
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- /**
- cell 高度
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return [self.heights[@(indexPath.row)] doubleValue];;
-
- }
- /**
- 点击单元格事件
- @param tableView tableView description
- @param indexPath indexPath description
- */
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- InventoryUnfreezeOrderListModel *orderListModel= [_unfreezeOrderList objectAtIndex:indexPath.row];
-
- InventoryUnfreezeGoodsDetailViewController *detailVc=[[InventoryUnfreezeGoodsDetailViewController alloc]init];
- detailVc.unfreezeId=orderListModel.unfreezeId;
- [self.cNav pushViewController:detailVc animated:YES];
-
-
- }
- /**
- 高度
-
- @return <#return value description#>
- */
- - (NSMutableDictionary *)heights{
- if (_heights == nil){
- _heights = [NSMutableDictionary dictionary];
- }
- return _heights;
- }
- /**
- 预防高度
-
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- -(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 250;
- }
- -(void)editData:(NSInteger)position
- {
- InventoryUnfreezeOrderListModel *orderModel= [_unfreezeOrderList objectAtIndex:position];
- NewInventoryUnfreezeViewController *newVc=[[NewInventoryUnfreezeViewController alloc]init];
- newVc.unfreezeId=orderModel.unfreezeId;
- newVc.editFlag=YES;
- [self.cNav pushViewController:newVc animated:YES];
- }
- /**
- 每个单元格cell
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *cellIdentifier = @"InventoryUnfreezeOrderListCell";
- InventoryUnfreezeOrderListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier ];
- cell = [[InventoryUnfreezeOrderListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
- cell.selectionStyle=UITableViewCellSelectionStyleNone;
-
- InventoryUnfreezeOrderListModel *orderModel= [_unfreezeOrderList objectAtIndex:indexPath.row];
-
- [cell setInventoryUnfreezeOrderListCell:orderModel];
- cell.position = (int)indexPath.row;
- cell.delegate=self;
- self.heights[@(indexPath.row)] = @(cell.height);
- return cell;
- }
- @end
|