| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773 |
- //
- // DeliveryRequirementDetailControllerViewController.m
- // IBOSSHSH
- //
- // Created by ssl on 2018/1/16.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "DeliveryRequirementDetailController.h"
- #import "DeliveryImg.h"
- #import "XHImageViewer.h"
- #import "AlbumPhotoCollectionViewCell.h"
- #import "NSString+Tools.h"
- #import "DeliveryRequirementDetailHeadModel.h"
- #import "DateFormat.h"
- #import "DeliveryRequirementListDetailModel.h"
- #import "DeliveryRequirementDetailListCell.h"
- #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
- @implementation DeliveryRequirementDetailController
- @synthesize scroll;
- @synthesize contentView;
- @synthesize mHeight;
- #pragma mark - 公共函数
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- mHeight = 31;
- [self initUI];
- [self initData];
- }
- /**
- 安全区视图发生变化
- */
- -(void)viewSafeAreaInsetsDidChange{
- scroll.frame = self.view.safeAreaLayoutGuide.layoutFrame;
- [super viewSafeAreaInsetsDidChange];
- }
- #pragma mark - 回调函数
- /**
- 数据加载完成方法
- @param sender <#sender description#>
- */
- - (void)onLoadFinish:(ASIDownManager *)sender {
- RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
- [self cancel];
- // 服务器返回数据状态值
- int iStatus = resultModel.status;
- // 服务器返回数据消息
- NSString *message = resultModel.message;
- if (iStatus == 0) {
- NSDictionary * approvArr=(NSDictionary *)resultModel.result;
- if(approvArr != nil&&approvArr.count>0)
- {
- NSArray *arr = [approvArr objectForKey:@"Table"];
- NSArray *arr1 = [approvArr objectForKey:@"Table1"];
- NSArray *imagePathArr = [approvArr objectForKey:@"ImagePath"];
- NSArray *positionArr = [approvArr objectForKey:@"Position"];
- if(arr != nil&&arr.count>0){
- NSDictionary *dicValue = arr[0];
- DeliveryRequirementDetailHeadModel *model = [DeliveryRequirementDetailHeadModel dk_modelWithDictionary:dicValue];
- _arrangementNo.text = model.arrangementNo;
- _receiptNo.text = model.receiptNo;
- _deliveryNo.text = model.deliveryNo;
- _recReceiptType.text = model.recReceiptType;
- _customerName.text = model.customerName;
- _contacts.text = model.contacts;
- _telephone.text = model.telephone;
- _lbRemarks.text = [NSString stringWithFormat:@"回执备注: %@",model.remarks == nil?@"":model.remarks];
- _lbAccountDate.text = [NSString stringWithFormat:@"账务日期: %@",model.accountDate];
- _lbCreatetime.text = [NSString stringWithFormat:@"创建日期: %@",model.createTime];
- _lbServiceStaffName.text =[NSString stringWithFormat:@"配送人员: %@",model.serviceStaffName == nil?@"":model.serviceStaffName ];
-
- _deliveryAddress.text = model.deliveryAddress;
- _receivables.text = [NSString stringWithFormat:@"%.2f",[model.receivables doubleValue]];
- _completeReceivables.text = [NSString stringWithFormat:@"%.2f",[model.completeReceivables doubleValue]];
- _receiptAmount.text = [NSString stringWithFormat:@"%.2f",[model.receiptAmount doubleValue]];
- _receivablesType.text = model.receivablesType;
- if([model.receiptType intValue] == 1){
- _receiptType.text = @"完成";
- }else if([model.receiptType intValue] == 2){
- _receiptType.text =@"推迟送安";
- }
-
- _nextDeliveryDate.text = [DateFormat dateFormatSplit: model.deliveryDate];
-
-
- }
-
- if(arr1 != nil){
- for (int i = 0; i < [arr1 count]; i++) {
- NSDictionary *infoDic=arr1[i];
- DeliveryRequirementListDetailModel *info = [DeliveryRequirementListDetailModel dk_modelWithDictionary:infoDic];
- [_infoList addObject:info];
- }
-
- }
- if(imagePathArr != nil&&[imagePathArr count] > 0){
- if( ! _photoList){
- _photoList = [[NSMutableArray alloc]init];
- }
- for (int i = 0; i < [imagePathArr count]; i++) {
- NSDictionary *imgDic = imagePathArr[i];
- NSString *imgPath = [imgDic objectForKey:@"ImagePath"];
- DeliveryImg *img = [DeliveryImg new];
- img.imageName = imgPath;
- [_photoList addObject:img];
- }
-
- }
- if(arr1 != nil){
- self.tableView.frame=CGRectMake(10,10, self.view.bounds.size.width - 20, [self getArrayViewHeight:self.infoList] + _headerView.bounds.size.height) ;
-
- contentView.frame = CGRectMake(0,0,self.view.bounds.size.width,self.tableView.bounds.size.height);
- scroll.contentSize=CGSizeMake(self.view.frame.size.width, contentView.frame.size.height + rectStatusHeight +rectNavHeight + 50);
-
-
- }
- [self.tableView reloadData];
-
- if(imagePathArr != nil&&[imagePathArr count] > 0){
- UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
- flowLayout.itemSize = CGSizeMake(85, 85);
- flowLayout.minimumInteritemSpacing = 5;
- flowLayout.minimumLineSpacing = 10;
- flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
- flowLayout.sectionInset = UIEdgeInsetsMake(7, 20, 0, 20);
- self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(20,CGRectGetMaxY(self.tableView.frame), self.view.bounds.size.width - 40, [Util getPhotoCollectionViewHeightWithPhotos:self.photoList]) collectionViewLayout:flowLayout];
- self.collectionView.backgroundColor = [UIColor clearColor];
- self.collectionView.dataSource = self;
- self.collectionView.delegate = self;
- self.collectionView.scrollEnabled = NO;
- [self.collectionView registerClass:[AlbumPhotoCollectionViewCell class] forCellWithReuseIdentifier:@"PhotoCollectionViewCellIdentifier"];
- [contentView addSubview:self.collectionView];
- contentView.frame = CGRectMake(0,0,self.view.bounds.size.width,CGRectGetMaxY(self.collectionView.frame));
- scroll.contentSize = CGSizeMake(self.view.frame.size.width, contentView.frame.size.height + rectStatusHeight + rectNavHeight + 50);
-
- }
-
-
- if(positionArr != nil && [positionArr count] > 0){
- NSDictionary *d1 = positionArr[0];
-
- //位置信息--------------
- UIView *vLocation = [UIView new];
- if(imagePathArr != nil&&[imagePathArr count] > 0){
- vLocation.frame = CGRectMake(0, CGRectGetMaxY(self.collectionView.frame), Screen_Width, mHeight);
- }
- else{
- vLocation.frame = CGRectMake(0, CGRectGetMaxY(self.tableView.frame), Screen_Width, mHeight);
- }
- [contentView addSubview:vLocation];
- UIImageView *positionImg = [[UIImageView alloc]init];
- positionImg.frame = CGRectMake(20,16, 13, 15);
- [positionImg setImage:[UIImage imageNamed:@"icon_position"]];
- [vLocation addSubview:positionImg];
- _location = [UILabel new];
- _location.frame = CGRectMake(CGRectGetMaxX(positionImg.frame) + 3, 11, Screen_Width - 105, 25);
- _location.font = kTextFont;
- [vLocation addSubview:_location];
- _location.text = [d1 objectForKey:@"Position"];
- if(_location.text != nil){
- [vLocation setHidden:NO];
- }else{
- [vLocation setHidden:YES];
- }
-
- contentView.frame = CGRectMake(0,0,self.view.bounds.size.width,CGRectGetMaxY(vLocation.frame));
- scroll.contentSize = CGSizeMake(self.view.frame.size.width, contentView.frame.size.height + rectStatusHeight + rectNavHeight + 50);
-
-
- }
-
-
- }
- }
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
- [self showReLoginDialog:message];
- return;
- }
- else {
- [self.tableView reloadData];
- [self showAlertViewText:message];
- }
-
-
-
- }
- /**
- 数据加载失败方法
-
- @param sender <#sender description#>
- */
- - (void)onLoadFail:(ASIDownManager *)sender {
- [self cancel];
- [self.tableView reloadData];
- [self showAlertViewText:@"网络异常"];
- }
- /**
- tableview的分区数
-
- @param tableView <#tableView description#>
- @return <#return value description#>
- */
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return [_infoList count];
-
- }
- /**
- tableview 分区的间隔高度
-
- @param tableView <#tableView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- return 10;
- }
- /**
- tableview的分区视图
- @param tableView <#tableView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- {
- UIView* myView = [[UIView alloc]init];
- myView.backgroundColor = [UIColor clearColor];
- return myView;
- }
- /**
- tableview每个分区的行数
- @param tableView <#tableView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return 1;
- }
- /**
- 获取tableview cell
-
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
-
- NSString *cellIdentifier = @"DeliveryRequirementDetailListCell";
- DeliveryRequirementDetailListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
- if(!cell)
- {
- NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:cellIdentifier owner:nil options:nil];
- cell = [nibs lastObject];
- self.tableView.rowHeight = UITableViewAutomaticDimension;
- cell.frame = CGRectMake(cell.frame.origin.x, cell.frame.origin.y,self.view.bounds.size.width , cell.frame.size.height);
- }
- NSMutableArray *dataArray = _infoList;
- DeliveryRequirementListDetailModel *model = [dataArray objectAtIndex:indexPath.section];
- cell.layer.cornerRadius = CornerRadius;
- cell.layer.backgroundColor = [UIColor whiteColor].CGColor;
- cell.layer.masksToBounds = YES;
- cell.brandName.text = model.brandName;
- cell.seriesName.text= model.seriesName;
-
- cell.fackage.text= model.fackage;
- cell.acreage.text= model.acreage;
- cell.sourceFromName.text= model.sourceFromName;
- if([model.installationReceiptFlag intValue] == 0){
- cell.installationReceiptFlag.text= @"否";
- }else{
- cell.installationReceiptFlag.text= @"是";
- }
-
-
- cell.deliveryQuantity.text= model.deliveryQuantity;
-
- cell.gradeName.text= model.gradeName;
- cell.weight.text= model.weight;
- if([model.installationReceiptType intValue] == 1){
- cell.installationReceiptType.text= @"完成";
- }else if([model.installationReceiptType intValue] == 5){
- cell.installationReceiptType.text= @"再安装";
- }
- cell.warehouseName.text= model.warehouseName;
- cell.code.text= model.code;
- cell.kindName.text= model.kindName;
-
- cell.colorNumber.text= model.colorNumber;
-
- cell.installationQuantity.text= model.installationQuantity;
-
-
- cell.installationReceiptQuantity.text= model.installationReceiptQuantity;
-
- cell.returnQuantity.text= model.returnQuantity;
-
- cell.onlyCode.text= model.onlyCode;;
- cell.positionNumber.text= model.positionNumber;;
- if([model.circulateType intValue] == 1){
- cell.circulateType.text= @"按整数流通";
- }else if([model.circulateType intValue] == 2){
- cell.circulateType.text= @"按平米流通";
- }else if([model.circulateType intValue] == 3){
- cell.circulateType.text= @"按延米流通";
- }
- cell.varietyName.text= model.varietyName;;
- cell.outQuantity.text= model.outQuantity;;
-
- cell.recoverQuantity.text=model.recoverQuantity;
- cell.deliveryReceiptQuantity.text= model.deliveryReceiptQuantity;;
- if([model.deliveryReceiptFlag intValue] == 0){
- cell.deliveryReceiptFlag.text= @"否";
- }else{
- cell.deliveryReceiptFlag.text= @"是";
- }
- cell.remarks.text= (model.remarks == nil || [model.remarks isEqualToString: @""])?@" ":model.remarks;
- cell.goodsName.text= model.goodsName;
-
- cell.specification.text= model.specification;
- int type2 = [model.deliveryReceiptType intValue];
- switch (type2) {
- case 1:
- cell.deliveryReceiptType.text = @"完成";
- break;
- case 2:
- cell.deliveryReceiptType.text = @"再送";
- break;
- case 3:
- cell.deliveryReceiptType.text = @"换货";
- break;
- case 4:
- cell.deliveryReceiptType.text = @"退货";
- break;
- default:
- break;
- }
- return cell;
- }
- /**
- cellection view的列表项
- @param collectionView <#collectionView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
- return self.photoList.count;
- }
- /**
- collection view的cell
- @param collectionView <#collectionView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
-
- static NSString *PhotoCollectionViewCellIdentifier = @"PhotoCollectionViewCellIdentifier";
- AlbumPhotoCollectionViewCell *cell1 = [collectionView dequeueReusableCellWithReuseIdentifier:PhotoCollectionViewCellIdentifier forIndexPath:indexPath];
- NSArray *Infoarray = _photoList;
- cell1.indexPath = indexPath;
- DeliveryImg *image1 = [Infoarray objectAtIndex:indexPath.row];
- NSString *imagepath = [image1 imageName];
- if(imagepath != nil && [imagepath length] > 0){
- NSString *imageUrl = [NSString stringWithFormat:@"http://%@:%@/WebService/%@",kkServerUrl,kkServerPort,imagepath];
- NSURL *url = [NSURL URLWithString:imageUrl];
- [cell1.photoImageView setImageWithURL:url placeholderImage:nil];
- }
-
- return cell1;
- };
- /**
- 定义collectionview cell的大小
- @param collectionView <#collectionView description#>
- @param collectionViewLayout <#collectionViewLayout description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
- {
- return CGSizeMake(85, 85);
- }
- /**
- 定义每个collectionview cell的间距
- @param collectionView <#collectionView description#>
- @param collectionViewLayout <#collectionViewLayout description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
- {
- return UIEdgeInsetsMake(5, 5, 5, 5);
- }
- /**
- 放大图片
- @param collectionView <#collectionView description#>
- @param indexPath <#indexPath description#>
- */
- - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
-
- [self showImageViewerAtIndexPath:indexPath];
- }
- /**
- 放大图片委托
- @param indexPath <#indexPath description#>
- */
- - (void)showImageViewerAtIndexPath:(NSIndexPath *)indexPath {
- AlbumPhotoCollectionViewCell *cell = (AlbumPhotoCollectionViewCell *)[self.collectionView cellForItemAtIndexPath:indexPath];
- NSMutableArray *imageViews = [NSMutableArray array];
- NSArray *visibleCell = [self.collectionView visibleCells];
- NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"indexPath" ascending:YES];
- visibleCell = [visibleCell sortedArrayUsingDescriptors:[NSArray arrayWithObject:sort]];
- [visibleCell enumerateObjectsUsingBlock:^(AlbumPhotoCollectionViewCell *cell, NSUInteger idx, BOOL *stop) {
- [imageViews addObject:[[cell.contentView subviews] lastObject]];
- }];
-
- XHImageViewer *imageViewer = [[XHImageViewer alloc] init];
- [imageViewer showWithImageViews:imageViews selectedView:[[cell.contentView subviews] lastObject]];
- }
- /**
- 返回collection view是否可以被选择
- @param collectionView <#collectionView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath
- {
- return YES;
- }
- #pragma mark - 私有函数
- /**
- 返回函数
- */
- - (void)goBack
- {
- [self.navigationController popViewControllerAnimated:YES];
- }
- /**
- 初始化ui
- */
- - (void)initUI{
- self.navigationItem.title = @"送安回执明细";
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- [button setImage:[UIImage imageNamed:@"icon_back.png"] forState:UIControlStateNormal];
- [button addTarget:self action:@selector(goBack)
- forControlEvents:UIControlEventTouchUpInside];
- button.frame = CGRectMake(0, 0,45,22);
- UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
- self.navigationItem.leftBarButtonItem = menuButton;
- contentView = [[UIView alloc]init];
- contentView.frame = CGRectZero;
- contentView.backgroundColor = [UIColor clearColor];
- self.tableView = [UITableView new];
- self.tableView.rowHeight = UITableViewAutomaticDimension;
- self.tableView.dataSource = self;
- self.tableView.delegate = self;
- self.tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
- self.tableView.backgroundColor = [UIColor clearColor];
- self.tableView.scrollEnabled = NO;
- self.tableView.estimatedRowHeight = 44.0f;
- self.tableView.frame = CGRectZero;
- [contentView addSubview:self.tableView];
- scroll = [UIScrollView new];
- scroll.frame = self.view.bounds;
- scroll.tag = 1000;
- [self.view addSubview:scroll];
- if(Screen_Height2 <= 480){
- scroll.contentSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height + 80);
- }
- _headerView = [[UIView alloc]init];
- _headerView.frame = CGRectZero;
- _headerView.layer.cornerRadius = CornerRadius;
- _headerView.backgroundColor = [UIColor whiteColor];
- [scroll addSubview:contentView];
-
- //回执单号--------------
- UIView *vReceiptNoName = [UIView new];
- vReceiptNoName.frame = CGRectMake(0, 1, Screen_Width, 51);
- [_headerView addSubview:vReceiptNoName];
- UILabel *lblTxtCast = [UILabel new];
- lblTxtCast.frame = CGRectMake(10, 16,70, 25);
- lblTxtCast.text = @"回执单号:";
- lblTxtCast.font = kTextFont;
- [vReceiptNoName addSubview:lblTxtCast];
- _receiptNo = [UILabel new];
- _receiptNo.frame = CGRectMake(CGRectGetMaxX(lblTxtCast.frame), 16, 200, 25);
- _receiptNo.font = kTextFont;
- [vReceiptNoName addSubview:_receiptNo];
- UIImageView *separatorImg = [[UIImageView alloc]initWithFrame:CGRectMake(0,50,Screen_Width, 1)];
- [separatorImg setImage:[UIImage imageNamed:@"titlebotton"]];
- [vReceiptNoName addSubview:separatorImg];
- //安排单号--------------
- UIView *vArrangementNo = [UIView new];
- vArrangementNo.frame = CGRectMake(0,CGRectGetMaxY(vReceiptNoName.frame), Screen_Width, mHeight);
- [_headerView addSubview:vArrangementNo];
- UILabel *lblTxtArrangementNo = [UILabel new];
- lblTxtArrangementNo.frame = CGRectMake(10, 3, 70, 25);
- lblTxtArrangementNo.text = @"安排单号:";
- lblTxtArrangementNo.font = kTextFont;
- [vArrangementNo addSubview:lblTxtArrangementNo];
- _arrangementNo = [UILabel new];
- _arrangementNo.frame = CGRectMake(CGRectGetMaxX(lblTxtArrangementNo.frame),3, 200, 25);
- _arrangementNo.font = kTextFont;
- [vArrangementNo addSubview:_arrangementNo];
-
- //送货单号--------------
- UIView *vDeliveryNo = [UIView new];
- vDeliveryNo.frame = CGRectMake(0,CGRectGetMaxY(vArrangementNo.frame), Screen_Width, mHeight);
- [_headerView addSubview:vDeliveryNo];
- UILabel *lblvDeliveryNo = [UILabel new];
- lblvDeliveryNo.frame = CGRectMake(10,3, 70, 25);
- lblvDeliveryNo.text = @"送安单号:";
- lblvDeliveryNo.font = kTextFont;
- [vDeliveryNo addSubview:lblvDeliveryNo];
- _deliveryNo = [UILabel new];
- _deliveryNo.frame = CGRectMake(CGRectGetMaxX(lblvDeliveryNo.frame),3, 200, 25);
- _deliveryNo.font = kTextFont;
- [vDeliveryNo addSubview:_deliveryNo];
-
- //回执类型--------------
- UIView *vRecReceiptType = [UIView new];
- vRecReceiptType.frame = CGRectMake(0,CGRectGetMaxY(vDeliveryNo.frame), Screen_Width, mHeight);
- [_headerView addSubview:vRecReceiptType];
- UILabel *lblRecReceiptType = [UILabel new];
- lblRecReceiptType.frame = CGRectMake(10,3, 70, 25);
- lblRecReceiptType.text = @"回执类型:";
- lblRecReceiptType.font = kTextFont;
- [vRecReceiptType addSubview:lblRecReceiptType];
- _recReceiptType = [UILabel new];
- _recReceiptType.frame = CGRectMake(CGRectGetMaxX(lblRecReceiptType.frame),3, 200, 25);
- _recReceiptType.font = kTextFont;
- [vRecReceiptType addSubview:_recReceiptType];
-
- //客户名称--------------
- UIView *vCustomerName = [UIView new];
- vCustomerName.frame = CGRectMake(0,CGRectGetMaxY(vRecReceiptType.frame), Screen_Width, mHeight);
- [_headerView addSubview:vCustomerName];
- UILabel *lblCustomerName = [UILabel new];
- lblCustomerName.frame = CGRectMake(10,3, 70, 25);
- lblCustomerName.text = @"客户名称:";
- lblCustomerName.font = kTextFont;
- [vCustomerName addSubview:lblCustomerName];
- _customerName = [UILabel new];
- _customerName.font = kTextFont;
- _customerName.frame = CGRectMake(CGRectGetMaxX(lblCustomerName.frame),3, 200, 25);
- [vCustomerName addSubview:_customerName];
-
- //联系人--------------
- UIView *vContacts = [UIView new];
- vContacts.frame = CGRectMake(0,CGRectGetMaxY(vCustomerName.frame), Screen_Width, mHeight);
- [_headerView addSubview:vContacts];
- UILabel *lblContacts = [UILabel new];
- lblContacts.frame = CGRectMake(10,3,70, 25);
- lblContacts.text = @"联 系 人:";
- lblContacts.font = kTextFont;
- [vContacts addSubview:lblContacts];
- _contacts = [UILabel new];
- _contacts.font = kTextFont;
- _contacts.frame = CGRectMake(CGRectGetMaxX(lblContacts.frame),3, 200, 25);
- [vContacts addSubview:_contacts];
-
- //电话--------------
- UIView *vTelephone = [UIView new];
- vTelephone.frame = CGRectMake(0,CGRectGetMaxY(vContacts.frame), Screen_Width, mHeight);
- [_headerView addSubview:vTelephone];
- UILabel *lblvTelephone = [UILabel new];
- lblvTelephone.frame = CGRectMake(10,3,70, 25);
- lblvTelephone.font = kTextFont;
- lblvTelephone.text = @"联系电话:";
- [vTelephone addSubview:lblvTelephone];
- _telephone = [UILabel new];
- _telephone.font = kTextFont;
- _telephone.frame=CGRectMake(CGRectGetMaxX(lblvTelephone.frame),3, 200, 25);
- [vTelephone addSubview:_telephone];
-
-
- //地址--------------
- UIView *vDeliveryAddress = [UIView new];
- vDeliveryAddress.frame = CGRectMake(0,CGRectGetMaxY(vTelephone.frame), Screen_Width, mHeight);
- [_headerView addSubview:vDeliveryAddress];
- UILabel *lblvDeliveryAddress = [UILabel new];
- lblvDeliveryAddress.frame = CGRectMake(10,3,70, 25);
- lblvDeliveryAddress.text = @"送安地址:";
- lblvDeliveryAddress.font = kTextFont;
- [vDeliveryAddress addSubview:lblvDeliveryAddress];
- _deliveryAddress = [UILabel new];
- _deliveryAddress.frame = CGRectMake(CGRectGetMaxX(lblvDeliveryAddress.frame),3, 200, 25);
- _deliveryAddress.font = kTextFont;
- [vDeliveryAddress addSubview:_deliveryAddress];
-
- //应收金额--------------
- UIView *vReceivables = [UIView new];
- vReceivables.frame = CGRectMake(0,CGRectGetMaxY(vDeliveryAddress.frame), Screen_Width, mHeight);
- [_headerView addSubview:vReceivables];
- UILabel *lblvReceivables = [UILabel new];
- lblvReceivables.frame = CGRectMake(10,3,70, 25);
- lblvReceivables.text = @"应收金额:";
- lblvReceivables.font = kTextFont;
- [vReceivables addSubview:lblvReceivables];
- _receivables = [UILabel new];
- _receivables.font = kTextFont;
- _receivables.frame = CGRectMake(CGRectGetMaxX(lblvReceivables.frame),3, 200, 25);
- [vReceivables addSubview:_receivables];
-
- //已回执金额--------------
- UIView *vCompleteReceivables = [UIView new];
- vCompleteReceivables.frame = CGRectMake(0,CGRectGetMaxY(vReceivables.frame), Screen_Width, mHeight);
- [_headerView addSubview:vCompleteReceivables];
- UILabel *lblCompleteReceivables = [UILabel new];
- lblCompleteReceivables.frame = CGRectMake(10,3,85, 25);
- lblCompleteReceivables.font = kTextFont;
- lblCompleteReceivables.text = @"已回执金额:";
- [vCompleteReceivables addSubview:lblCompleteReceivables];
- _completeReceivables = [UILabel new];
- _completeReceivables.font = kTextFont;
- _completeReceivables.frame = CGRectMake(CGRectGetMaxX(lblCompleteReceivables.frame),3, 200, 25);
- [vCompleteReceivables addSubview:_completeReceivables];
-
-
- //送货单回执类型--------------
- UIView *vReceiptType = [UIView new];
- vReceiptType.frame = CGRectMake(0,CGRectGetMaxY(vCompleteReceivables.frame), Screen_Width, mHeight);
- [_headerView addSubview:vReceiptType];
- UILabel *lblvReceiptType = [UILabel new];
- lblvReceiptType.frame = CGRectMake(10,3,110, 25);
- lblvReceiptType.text = @"送安单回执类型:";
- lblvReceiptType.font = kTextFont;
- [vReceiptType addSubview:lblvReceiptType];
- _receiptType = [UILabel new];
- _receiptType.font = kTextFont;
- _receiptType.frame = CGRectMake(CGRectGetMaxX(lblvReceiptType.frame),3, 200, 25);
- [vReceiptType addSubview:_receiptType];
-
- //推迟送货日期--------------
- UIView *vNextDeliveryDate = [UIView new];
- vNextDeliveryDate.frame = CGRectMake(0,CGRectGetMaxY(vReceiptType.frame), Screen_Width, mHeight);
- [_headerView addSubview:vNextDeliveryDate];
- UILabel *lblvNextDeliveryDate = [UILabel new];
- lblvNextDeliveryDate.frame = CGRectMake(10,3, 72, 25);
- lblvNextDeliveryDate.text = @"送安日期:";
- lblvNextDeliveryDate.font = kTextFont;
- [vNextDeliveryDate addSubview:lblvNextDeliveryDate];
- _nextDeliveryDate = [UILabel new];
- _nextDeliveryDate.font = kTextFont;
- _nextDeliveryDate.frame = CGRectMake(CGRectGetMaxX(lblvNextDeliveryDate.frame),3, 200, 25);
- [vNextDeliveryDate addSubview:_nextDeliveryDate];
-
-
- _lbAccountDate = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(vNextDeliveryDate.frame)+5, SCREENWIDTH-30, 17)];
- _lbAccountDate.text = @"账务日期:";
- _lbAccountDate.font = kTextFont;
- [_headerView addSubview:_lbAccountDate];
-
- _lbServiceStaffName = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(_lbAccountDate.frame)+10, SCREENWIDTH-30, 17)];
- _lbServiceStaffName.text = @"配送人员:";
- _lbServiceStaffName.font = kTextFont;
- [_headerView addSubview:_lbServiceStaffName];
-
- _lbRemarks = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(_lbServiceStaffName.frame)+10, SCREENWIDTH-30, 17)];
- _lbRemarks.text = @"回执备注:";
- _lbRemarks.font = kTextFont;
- [_headerView addSubview:_lbRemarks];
-
- _lbCreatetime = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(_lbRemarks.frame)+10, SCREENWIDTH-30, 17)];
- _lbCreatetime.text = @"创建时间:";
- _lbCreatetime.font = kTextFont;
- [_headerView addSubview:_lbCreatetime];
-
- _headerView.frame = CGRectMake(0,0,self.tableView.bounds.size.width,CGRectGetMaxY(_lbCreatetime.frame)+10);
- _tableView.tableHeaderView = _headerView;
- contentView.frame = CGRectMake(0,0,self.tableView.bounds.size.width, self.tableView.bounds.size.height);
- if(!_infoList){
- _infoList = [[NSMutableArray alloc]init];
- }
-
- }
- /**
- 数据加载
- */
- - (void)initData{
- [self startLoading];
- NSString *urlStr = ServerURL;
- NSMutableDictionary *dict = [NSMutableDictionary new];
- [dict setObject:@"GetDeliveryRequirementReceiptDetailIphone" forKey:@"Action"];
- [dict setObject:kkAccountCode forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [dict setObject:_deliveryId forKey:@"DeliveryID"];
- [dict setObject:_recReceiptNo forKey:@"ReceiptNo"];
- [dict setObject:_receiptID forKey:@"ReceiptID"];
- self.mDownManager = [[ASIDownManager alloc] init];
- _mDownManager.delegate = self;
- _mDownManager.onRequestSuccess = @selector(onLoadFinish:);
- _mDownManager.onRequestFail = @selector(onLoadFail:);
- [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
- }
- /**
- 取消进度条
- */
- - (void)cancel {
- [self stopLoading];
- }
- /**
- 获取tableview的高度
- @param Array <#Array description#>
- @return <#return value description#>
- */
- - (CGFloat)getArrayViewHeight:(NSArray *)Array {
- // 上下间隔已经在frame上做了
- NSInteger row = Array.count;
- CGFloat allheight = 0;
- for (int i = 0; i < Array.count; i++) {
- DeliveryRequirementListDetailModel *info = Array[i];
- if([info.remarks isEqualToString:@""]){
- //不加空格计算不出备注的高度
- info.remarks = @" ";
- }
- CGFloat height = [info.remarks sizeWithFont:[UIFont systemFontOfSize:13] constrainedToSize:CGSizeMake(SCREENWIDTH-110, MAXFLOAT)].height + 800;
- allheight += height;
- }
- return allheight;
- }
- @end
|