| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978 |
- //
- // DeliveryRequirementDetailControllerViewController.m
- // IBOSSHSH
- //
- // Created by ssl on 2018/1/16.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "DispatchRequirementDetailController.h"
- #import "DeliveryImg.h"
- #import "XHImageViewer.h"
- #import "AlbumPhotoCollectionViewCell.h"
- #import "NSString+Tools.h"
- #import "DispatchRequirementDetailHeadModel.h"
- #import "DateFormat.h"
- #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
- @implementation DispatchRequirementDetailController
- @synthesize scroll;
- @synthesize contentView;
- @synthesize mHeight;
- #pragma mark - 公共函数
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- mHeight = 31;
- [self initUI];
- [self initData];
- }
- /**
- 安全区视图发生变化
- */
- -(void)viewSafeAreaInsetsDidChange{
-
- self.tableView.frame=CGRectMake(10,10, self.view.frame.size.width-20,self.view.safeAreaLayoutGuide.layoutFrame.size.height-50) ;
- _btnCancel.frame = CGRectMake(0,
- self.view.safeAreaLayoutGuide.layoutFrame.size.height -40,
- Screen_Width,
- 40);
- [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 *arr2=[approvArr objectForKey:@"Table2"];
-
- if(arr != nil&&arr.count>0){
- NSDictionary *dicValue = arr[0];
- DispatchRequirementDetailHeadModel *model = [DispatchRequirementDetailHeadModel dk_modelWithDictionary:dicValue];
- _lblDispatchNo.text = model.arrangementNo;
- _lblCustomerCode.text=model.customerCode;
- _lblDeliveryArea.text=model.deliveryArea;
- _lblCustomerTelephone.text=model.telephone;
- _lblDeliveryTime.text=model.deliveryPeriod;
- _lblChargeAmount.text=[NSString stringWithFormat:@"%.2f",[model.receivables doubleValue]];
- _lblDeliveryChargeAmount.text=[NSString stringWithFormat:@"%.2f",[model.deliveryReceivables doubleValue]];
- _lblInstallChargeAmount.text=[NSString stringWithFormat:@"%.2f",[model.installationReceivables doubleValue]];
- _lblCollectionAmount.text=[NSString stringWithFormat:@"%.2f",[model.deliveryReceiptAmount doubleValue]];
- _receiptNo.text = model.receiptNo;
- _deliveryNo.text = model.deliveryNo;
- _customerName.text = model.customerName;
- _contacts.text = model.contacts;
- _telephone.text = model.telephone;
- _lbRemarks.text = model.remarks == nil?@"":model.remarks;
- _lbAccountDate.text = model.accountDate;
- _lbCreatetime.text = model.createTime;
- _lblCreater.text=model.createUserName;
- _lbTruckNumber.text=model.truckNumber;
- _deliveryAddress.text = model.deliveryAddress;
- _nextDeliveryDate.text = [DateFormat dateFormatSplit: model.deliveryDate];
-
- }
-
- if(arr1 != nil){
- for (int i = 0; i < [arr1 count]; i++) {
- NSDictionary *infoDic=arr1[i];
- DispatchRequirementListDetailModel *info = [DispatchRequirementListDetailModel dk_modelWithDictionary:infoDic];
- [_infoList addObject:info];
- }
-
-
-
- }
- if(arr2 != nil&&[arr2 count] > 0){
- if(_photoList==nil){
- _photoList = [[NSMutableArray alloc]init];
- }
-
- if(_signList==nil)
- {
- _signList= [[NSMutableArray alloc]init];
- }
- for (int i = 0; i < [arr2 count]; i++) {
- NSDictionary *imgDic = arr2[i];
- int receiptType=[[imgDic objectForKey:@"ReceiptType"]intValue];
- NSString *imgPath = [imgDic objectForKey:@"ThumbnailPath"];
- if(receiptType==1)
- {
- DeliveryImg *img = [DeliveryImg new];
- img.imageName = imgPath;
- [_photoList addObject:img];
- }
-
- if(receiptType==2)
- {
- DeliveryImg *img = [DeliveryImg new];
- img.imageName = imgPath;
- [_signList addObject:img];
- }
- }
-
- }
- if(arr1 != nil){
- self.tableView.frame=CGRectMake(10,10, self.view.frame.size.width - 20,self.view.frame.size.height-90) ;
-
- [self.tableView reloadData];
-
- }
-
-
- if(_photoList != nil&&[_photoList 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(10,0, self.view.bounds.size.width - 20, [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"];
- [_footerView addSubview:self.collectionView];
-
- _footerView.frame = CGRectMake(0,0,self.tableView.bounds.size.width,CGRectGetMaxY(self.collectionView.frame)+10);
-
- if(_signList!=nil&&_signList.count>0)
- {
- _signImgView=[[UIImageView alloc]init];
- _signImgView.frame=CGRectMake(15, CGRectGetMaxY(self.collectionView.frame)+10, 150, 150);
- [_footerView addSubview:_signImgView];
-
- _footerView.frame = CGRectMake(0,0,self.tableView.bounds.size.width,CGRectGetMaxY(_signImgView.frame)+10);
- DeliveryImg *signImg= [_signList objectAtIndex:0];
- NSString *signPath= signImg.imageName;
- if(signPath != nil && [signPath length] > 0){
- NSString *imageUrl = [NSString stringWithFormat:@"http://%@:%@/WebService/%@",kkServerUrl,kkServerPort,signPath];
- NSURL *url = [NSURL URLWithString:imageUrl];
- [_signImgView setImageWithURL:url placeholderImage:nil];
- }
- }
- _tableView.tableFooterView=_footerView;
- }
- else
- {
- if(_signList!=nil&&_signList.count>0)
- {
- _signImgView=[[UIImageView alloc]init];
- _signImgView.frame=CGRectMake(15, 10, 150, 150);
- [_footerView addSubview:_signImgView];
-
- _footerView.frame = CGRectMake(0,0,self.tableView.bounds.size.width,CGRectGetMaxY(_signImgView.frame)+10);
- _tableView.tableFooterView=_footerView;
- DeliveryImg *signImg= [_signList objectAtIndex:0];
- NSString *signPath= signImg.imageName;
- if(signPath != nil && [signPath length] > 0){
- NSString *imageUrl = [NSString stringWithFormat:@"http://%@:%@/WebService/%@",kkServerUrl,kkServerPort,signPath];
- NSURL *url = [NSURL URLWithString:imageUrl];
- [_signImgView setImageWithURL:url placeholderImage:nil];
- }
- }
- }
-
-
-
- }
- }
- 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:@"网络异常"];
- }
- /**
- 请求撤销回执
- @param receiptID <#receiptID description#>
- */
- -(void) requestCancelDeliveryReceipt:(NSString *) receiptID{
- [self startLoading];
- NSString *urlStr = ServerURL;
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"CancelInstallationDemandReceiptIphone" 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:kkLicenseCode forKey:@"LicenseCode"];
- [dict setObject:receiptID forKeyedSubscript:@"ReceiptID"];
- self.mDownManager = [[ASIDownManager alloc] init];
- _mDownManager.delegate = self;
- _mDownManager.onRequestSuccess = @selector(onRequestCancelReceiptFinish:);
- _mDownManager.onRequestFail = @selector(onRequestCancelReceiptFail:);
- [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
- }
- /**
- 请求成功
- @param sender <#sender description#>
- */
- - (void)onRequestCancelReceiptFinish:(ASIDownManager *) sender{
- RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
- [self cancel];
- int iNewCount = 0;
-
- int iStatus = resultModel.status;
- NSString *message = resultModel.message;
- if (iStatus == 0) {
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"撤销成功!" preferredStyle:UIAlertControllerStyleAlert ];
- [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
- if([self.refreshDelegate respondsToSelector:@selector(refreshData)])
- {
- [self.refreshDelegate refreshData];
- [self.navigationController popViewControllerAnimated:YES];
- }
- }]];
- // 3.显示alertController:presentViewController
- [self presentViewController:alert animated:YES completion:nil];
-
- }
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
- [self showReLoginDialog:message];
- return;
- }
-
- else{
- [self showAlertViewText:message];
- return;
-
- }
-
- }
- /**
- 请求失败
- @param sender <#sender description#>
- */
- - (void)onRequestCancelReceiptFail:(ASIDownManager *) sender{
- [self cancel];
- [self showAlertViewText:@"请求失败"];
- }
- /**
- tableview的分区数
-
- @param tableView <#tableView description#>
- @return <#return value description#>
- */
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return [_infoList count];
-
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- return 832;
-
- }
- /**
- 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 = @"DispatchRequirementDetailListCell";
- DispatchRequirementDetailListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
- if(cell==nil)
- {
- NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:cellIdentifier owner:nil options:nil];
- cell = [nibs lastObject];
- }
- NSMutableArray *dataArray = _infoList;
- DispatchRequirementListDetailModel *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.sourceNo.text=model.invoiceNo;
- cell.package.text= model.package;
- 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.lblUnit.text=model.unitName;
- cell.lblDispatchType.text=model.requirementTypeName;
- 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.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;
- 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 setBackgroundImage:[UIImage imageNamed:@"icon_back.png"]
- 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;
- 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 = YES;
- self.tableView.estimatedRowHeight = 44.0f;
- self.tableView.frame = CGRectZero;
- [self.view addSubview:self.tableView];
- _headerView = [[UIView alloc]init];
- _headerView.frame = CGRectZero;
- _headerView.layer.cornerRadius = CornerRadius;
- _headerView.backgroundColor = [UIColor whiteColor];
-
- _footerView = [[UIView alloc]init];
- _footerView.frame = CGRectZero;
- // _footerView.layer.cornerRadius = CornerRadius;
- // _footerView.backgroundColor = [UIColor whiteColor];
-
- //回执单号--------------
- 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 *vTruckNumber = [UIView new];
- vTruckNumber.frame = CGRectMake(0,CGRectGetMaxY(vReceiptNoName.frame), Screen_Width, mHeight);
- [_headerView addSubview:vTruckNumber];
- UILabel *lblTruckNumberTitle = [UILabel new];
- lblTruckNumberTitle.frame = CGRectMake(10,3, 70, 25);
- lblTruckNumberTitle.text = @"车 牌 号:";
- lblTruckNumberTitle.font = kTextFont;
- [vTruckNumber addSubview:lblTruckNumberTitle];
- _lbTruckNumber = [UILabel new];
- _lbTruckNumber.frame = CGRectMake(CGRectGetMaxX(lblTruckNumberTitle.frame),3, 200, 25);
- _lbTruckNumber.font = kTextFont;
- [vTruckNumber addSubview:_lbTruckNumber];
-
- //送货单号--------------
- UIView *vDispatchNo = [UIView new];
- vDispatchNo.frame = CGRectMake(0,CGRectGetMaxY(vTruckNumber.frame), Screen_Width, mHeight);
- [_headerView addSubview:vDispatchNo];
- UILabel *lblDispatchNoTitle = [UILabel new];
- lblDispatchNoTitle.frame = CGRectMake(10,3, 70, 25);
- lblDispatchNoTitle.text = @"派工单号:";
- lblDispatchNoTitle.font = kTextFont;
- [vDispatchNo addSubview:lblDispatchNoTitle];
- _lblDispatchNo = [UILabel new];
- _lblDispatchNo.frame = CGRectMake(CGRectGetMaxX(lblDispatchNoTitle.frame),3, 200, 25);
- _lblDispatchNo.font = kTextFont;
- [vDispatchNo addSubview:_lblDispatchNo];
-
- UIView *vCustomerCode = [UIView new];
- vCustomerCode.frame = CGRectMake(0,CGRectGetMaxY(vDispatchNo.frame), Screen_Width, mHeight);
- [_headerView addSubview:vCustomerCode];
- UILabel *lblCustomerCodeTitle = [UILabel new];
- lblCustomerCodeTitle.frame = CGRectMake(10,3, 70, 25);
- lblCustomerCodeTitle.text = @"客户编码:";
- lblCustomerCodeTitle.font = kTextFont;
- [vCustomerCode addSubview:lblCustomerCodeTitle];
- _lblCustomerCode = [UILabel new];
- _lblCustomerCode.font = kTextFont;
- _lblCustomerCode.frame = CGRectMake(CGRectGetMaxX(lblCustomerCodeTitle.frame),3, 200, 25);
- [vCustomerCode addSubview:_lblCustomerCode];
-
- //客户名称--------------
- UIView *vCustomerName = [UIView new];
- vCustomerName.frame = CGRectMake(0,CGRectGetMaxY(vCustomerCode.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 *vCustomerTelephone = [UIView new];
- vCustomerTelephone.frame = CGRectMake(0,CGRectGetMaxY(vCustomerName.frame), Screen_Width, mHeight);
- [_headerView addSubview:vCustomerTelephone];
- UILabel *lblCustomerTelephoneTitle = [UILabel new];
- lblCustomerTelephoneTitle.frame = CGRectMake(10,3, 70, 25);
- lblCustomerTelephoneTitle.text = @"客户电话:";
- lblCustomerTelephoneTitle.font = kTextFont;
- [vCustomerTelephone addSubview:lblCustomerTelephoneTitle];
- _lblCustomerTelephone = [UILabel new];
- _lblCustomerTelephone.font = kTextFont;
- _lblCustomerTelephone.frame = CGRectMake(CGRectGetMaxX(lblCustomerTelephoneTitle.frame),3, 200, 25);
- [vCustomerTelephone addSubview:_lblCustomerTelephone];
-
- UIView *vDeliveryArea = [UIView new];
- vDeliveryArea.frame = CGRectMake(0,CGRectGetMaxY(vCustomerTelephone.frame), Screen_Width, mHeight);
- [_headerView addSubview:vDeliveryArea];
-
- UILabel *lblDeliveryAreaTitle = [UILabel new];
- lblDeliveryAreaTitle.frame = CGRectMake(10,3, 70, 25);
- lblDeliveryAreaTitle.text = @"送货区域:";
- lblDeliveryAreaTitle.font = kTextFont;
- [vDeliveryArea addSubview:lblDeliveryAreaTitle];
- _lblDeliveryArea= [UILabel new];
- _lblDeliveryArea.font = kTextFont;
- _lblDeliveryArea.frame = CGRectMake(CGRectGetMaxX(lblDeliveryAreaTitle.frame),3, 200, 25);
- [vDeliveryArea addSubview:_lblDeliveryArea];
-
-
- //地址--------------
- UIView *vDeliveryAddress = [UIView new];
- vDeliveryAddress.frame = CGRectMake(0,CGRectGetMaxY(vDeliveryArea.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 *vNextDeliveryDate = [UIView new];
- vNextDeliveryDate.frame = CGRectMake(0,CGRectGetMaxY(vDeliveryAddress.frame), Screen_Width, mHeight);
- [_headerView addSubview:vNextDeliveryDate];
- UILabel *lblvNextDeliveryDate = [UILabel new];
- lblvNextDeliveryDate.frame = CGRectMake(10,3, 70, 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];
-
-
- UIView *vDeliveryTime = [UIView new];
- vDeliveryTime.frame = CGRectMake(0,CGRectGetMaxY(vNextDeliveryDate.frame), Screen_Width, mHeight);
- [_headerView addSubview:vDeliveryTime];
- UILabel *lblDeliveryTimeTitle = [UILabel new];
- lblDeliveryTimeTitle.frame = CGRectMake(10,3, 72, 25);
- lblDeliveryTimeTitle.text = @"配送时段:";
- lblDeliveryTimeTitle.font = kTextFont;
- [vDeliveryTime addSubview:lblDeliveryTimeTitle];
- _lblDeliveryTime = [UILabel new];
- _lblDeliveryTime.font = kTextFont;
- _lblDeliveryTime.frame = CGRectMake(CGRectGetMaxX(lblDeliveryTimeTitle.frame),3, 200, 25);
- [vDeliveryTime addSubview:_lblDeliveryTime];
-
-
-
- UIView *vChargeAmount = [UIView new];
- vChargeAmount.frame = CGRectMake(0,CGRectGetMaxY(vDeliveryTime.frame), Screen_Width, mHeight);
- [_headerView addSubview:vChargeAmount];
-
-
- UILabel *lblChargeAmountTitle = [UILabel new];
- lblChargeAmountTitle.frame = CGRectMake(10,3, 72, 25);
- lblChargeAmountTitle.text = @"收费金额:";
- lblChargeAmountTitle.font = kTextFont;
- [vChargeAmount addSubview:lblChargeAmountTitle];
- _lblChargeAmount = [UILabel new];
- _lblChargeAmount.font = kTextFont;
- _lblChargeAmount.frame = CGRectMake(CGRectGetMaxX(lblChargeAmountTitle.frame),3, 200, 25);
- [vChargeAmount addSubview:_lblChargeAmount];
-
-
- UIView *vDeliveryChargeAmount = [UIView new];
- vDeliveryChargeAmount.frame = CGRectMake(0,CGRectGetMaxY(vChargeAmount.frame), Screen_Width, mHeight);
- [_headerView addSubview:vDeliveryChargeAmount];
-
-
- UILabel *lblDeliveryChargeAmountTitle = [UILabel new];
- lblDeliveryChargeAmountTitle.frame = CGRectMake(10,3,90, 25);
- lblDeliveryChargeAmountTitle.text = @"送货收费金额:";
- lblDeliveryChargeAmountTitle.font = kTextFont;
- [vDeliveryChargeAmount addSubview:lblDeliveryChargeAmountTitle];
- _lblDeliveryChargeAmount = [UILabel new];
- _lblDeliveryChargeAmount.font = kTextFont;
- _lblDeliveryChargeAmount.frame = CGRectMake(CGRectGetMaxX(lblDeliveryChargeAmountTitle.frame),3, 200, 25);
- [vDeliveryChargeAmount addSubview:_lblDeliveryChargeAmount];
-
-
- UIView *vInstallChargeAmount = [UIView new];
- vInstallChargeAmount.frame = CGRectMake(0,CGRectGetMaxY(vDeliveryChargeAmount.frame), Screen_Width, mHeight);
- [_headerView addSubview:vInstallChargeAmount];
-
-
- UILabel *lblInstallChargeAmountTitle = [UILabel new];
- lblInstallChargeAmountTitle.frame = CGRectMake(10,3, 90, 25);
- lblInstallChargeAmountTitle.text = @"安装收费金额:";
- lblInstallChargeAmountTitle.font = kTextFont;
- [vInstallChargeAmount addSubview:lblInstallChargeAmountTitle];
- _lblInstallChargeAmount = [UILabel new];
- _lblInstallChargeAmount.font = kTextFont;
- _lblInstallChargeAmount.frame = CGRectMake(CGRectGetMaxX(lblInstallChargeAmountTitle.frame),3, 200, 25);
- [vInstallChargeAmount addSubview:_lblInstallChargeAmount];
-
- UIView *vCollectionAmount = [UIView new];
- vCollectionAmount.frame = CGRectMake(0,CGRectGetMaxY(vInstallChargeAmount.frame), Screen_Width, mHeight);
- [_headerView addSubview:vCollectionAmount];
-
-
- UILabel *lblCollectionAmountTitle = [UILabel new];
- lblCollectionAmountTitle.frame = CGRectMake(10,3, 72, 25);
- lblCollectionAmountTitle.text = @"收款金额:";
- lblCollectionAmountTitle.font = kTextFont;
- [vCollectionAmount addSubview:lblCollectionAmountTitle];
- _lblCollectionAmount = [UILabel new];
- _lblCollectionAmount.font = kTextFont;
- _lblCollectionAmount.frame = CGRectMake(CGRectGetMaxX(lblCollectionAmountTitle.frame),3, 200, 25);
- [vCollectionAmount addSubview:_lblCollectionAmount];
-
-
- UIView *vAccountDate = [UIView new];
- vAccountDate.frame = CGRectMake(0,CGRectGetMaxY(vCollectionAmount.frame), Screen_Width, mHeight);
- [_headerView addSubview:vAccountDate];
- UILabel *lblAccountDateTitle= [UILabel new];
- lblAccountDateTitle.frame = CGRectMake(10,3,70, 25);
- lblAccountDateTitle.text = @"账务日期:";
- lblAccountDateTitle.font = kTextFont;
- [vAccountDate addSubview:lblAccountDateTitle];
- _lbAccountDate = [UILabel new];
- _lbAccountDate.font = kTextFont;
- _lbAccountDate.frame = CGRectMake(CGRectGetMaxX(lblAccountDateTitle.frame),3, 200, 25);
- [vAccountDate addSubview:_lbAccountDate];
-
-
- UIView *vRemarks = [UIView new];
- vRemarks.frame = CGRectMake(0,CGRectGetMaxY(vAccountDate.frame), Screen_Width, mHeight);
- [_headerView addSubview:vRemarks];
-
- UILabel *lblRemarksTitle= [UILabel new];
- lblRemarksTitle.frame = CGRectMake(10,3,70, 25);
- lblRemarksTitle.text = @"备 注:";
- lblRemarksTitle.font = kTextFont;
- [vRemarks addSubview:lblRemarksTitle];
- _lbRemarks = [UILabel new];
- _lbRemarks.font = kTextFont;
- _lbRemarks.frame = CGRectMake(CGRectGetMaxX(lblRemarksTitle.frame),3, 200, 25);
- [vRemarks addSubview:_lbRemarks];
-
-
- UIView *vCreater = [UIView new];
- vCreater.frame = CGRectMake(0,CGRectGetMaxY(vRemarks.frame), Screen_Width, mHeight);
- [_headerView addSubview:vCreater];
-
- UILabel *lblCreaterTitle= [UILabel new];
- lblCreaterTitle.frame = CGRectMake(10,3,70, 25);
- lblCreaterTitle.text = @"创 建 者:";
- lblCreaterTitle.font = kTextFont;
- [vCreater addSubview:lblCreaterTitle];
- _lblCreater = [UILabel new];
- _lblCreater.font = kTextFont;
- _lblCreater.frame = CGRectMake(CGRectGetMaxX(lblCreaterTitle.frame),3, 200, 25);
- [vCreater addSubview:_lblCreater];
-
-
- UIView *vCreateTime = [UIView new];
- vCreateTime.frame = CGRectMake(0,CGRectGetMaxY(vCreater.frame), Screen_Width, mHeight);
- [_headerView addSubview:vCreateTime];
-
- UILabel *lblCreateTimeTitle= [UILabel new];
- lblCreateTimeTitle.frame = CGRectMake(10,3,70, 25);
- lblCreateTimeTitle.text = @"创建时间:";
- lblCreateTimeTitle.font = kTextFont;
- [vCreateTime addSubview:lblCreateTimeTitle];
- _lbCreatetime = [UILabel new];
- _lbCreatetime.font = kTextFont;
- _lbCreatetime.frame = CGRectMake(CGRectGetMaxX(lblCreateTimeTitle.frame),3, 200, 25);
- [vCreateTime addSubview:_lbCreatetime];
-
- _headerView.frame = CGRectMake(0,0,self.tableView.bounds.size.width,CGRectGetMaxY(vCreateTime.frame)+10);
- _tableView.tableHeaderView = _headerView;
-
-
-
- _btnCancel = [UIButton buttonWithType:UIButtonTypeCustom];
- _btnCancel.frame=CGRectMake(0, Screen_Height- 40- rectStatusHeight-rectNavHeight, Screen_Width,40) ;
- [_btnCancel setTitle:@"撤销" forState:UIControlStateNormal];
- [_btnCancel setBackgroundColor:NavigationBarColor];
- [_btnCancel addTarget:self action:@selector(cancelReceipt) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:_btnCancel];
-
- if([_receiptTypeFlag intValue]!=1)
- {
- _btnCancel.enabled=YES;
- }
- else{
- _btnCancel.enabled=NO;
- }
- if(!_infoList){
- _infoList = [[NSMutableArray alloc]init];
- }
-
- }
- -(void)cancelReceipt
- {
-
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示"
- message:@"是否要撤销回执?" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定"
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction *action){
- [self requestCancelDeliveryReceipt: _receiptID];
- }];
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消"
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction *action){
-
- }];
- UIColor *cancelColor = [UIColor blackColor];
- UIColor *sureColor = [UIColor redColor];
- [cancelAction setValue:cancelColor forKey:@"titleTextColor"];
- [okAction setValue:sureColor forKey:@"titleTextColor"];
- [alert addAction:okAction];
- [alert addAction:cancelAction];
- [self presentViewController:alert animated:YES completion:nil];
- }
- /**
- 数据加载
- */
- - (void)initData{
- [self startLoading];
- NSString *urlStr = ServerURL;
- NSMutableDictionary *dict = [NSMutableDictionary new];
- [dict setObject:@"GetInstallationDemandReceiptDetailIphone" forKey:@"Action"];
- [dict setObject:kkAccountCode forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [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++) {
- CGFloat height=832;
- allheight += height;
- }
- return allheight;
- }
- @end
|