| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206 |
- //
- // NewDispatchRequirementGoodsDetailController.m
- // IBOSS-HJ
- //
- // Created by 关宏厚 on 2021/1/28.
- // Copyright © 2021 elongtian. All rights reserved.
- //
- #import "NewDispatchRequirementGoodsDetailController.h"
- #import "NewDeliveryRequirementModel.h"
- @interface NewDispatchRequirementGoodsDetailController ()
- {
- UIScrollView *scroll;
- UIView *contentView;
- UIButton *btnDateArrow;
- UILabel *lblTxtVNextDeliveryDate;
- UILabel *lblTitleDeliveryAddress;
- UIView *line;
- UIView *headerView;
-
- NSIndexPath *_myRow;
- NewDispatchRequirementCell *_myCell;
-
- }
- @end
- @implementation NewDispatchRequirementGoodsDetailController
- @synthesize keyboardShow;
- - (void)viewDidLoad {
- [super viewDidLoad];
- _dataList=[[NSMutableArray alloc]init];
- [self initUI];
-
- }
- -(void)loadData
- {
- double delayInSeconds = 0.5;
- dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
- dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
- [self loadDataSource];
- });
-
-
- }
- /**
- 键盘隐藏回调函数
- @param cell <#cell description#>
- */
- - (void)keyboardWillHide:(NewDispatchRequirementCell *)cell{
- if (cell.cellIndex == _dataList.count - 1) {
- [self keyboardWillHide];
- }
- }
- /**
- 键盘弹出回调函数
- @param cell <#cell description#>
- */
- - (void)keyboardWillShow:(NewDispatchRequirementCell *)cell{
- if (cell.cellIndex == _dataList.count - 1) {
- [self myKeyboardWillShow];
- }
- }
- -(void)loadDataSource
- {
- [self startLoading];
- NSString *urlStr = ServerURL;
- NSMutableDictionary *dict = [NSMutableDictionary new];
- [dict setObject:@"GetInstallationDemandDetailForReceiptIphone" forKey:@"Action"];
- [dict setObject:kkAccountCode forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [dict setObject:_noReceiptModel.collectDetailId forKey:@"CollectDetailID"];
-
- self.mDownManager = [[ASIDownManager alloc] init];
- self.mDownManager.delegate=self;
- self.mDownManager.onRequestSuccess=@selector(onLoadFinish:);
- self.mDownManager.onRequestFail=@selector(onLoadFail:);
- [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
- }
- /**
- 单据数据加载完成函数
- @param sender <#sender description#>
- */
- - (void)onLoadFinish:(ASIDownManager *)sender {
- RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
- [self stopLoading];
- int iStatus =resultModel.status;
- NSString *message = resultModel.message;
- if (iStatus == 0) {
- NSArray * infoArr;
- _sReceiptType= @"1";
- _receiptFlag=@"1";
- infoArr=(NSArray*)resultModel.result;
-
- if(infoArr != nil){
- for (int i = 0; i < infoArr.count; i++) {
- NSDictionary *info = infoArr[i];
- NewDispatchRequirementModel *mod = [NewDispatchRequirementModel dk_modelWithDictionary:info];
- [_dataList addObject:mod];
- }
- }
-
- if([_noReceiptModel.requirementType intValue]==1)
- {
- _receiptFlag=@"1";
- _btnDeliveryType.userInteractionEnabled=YES;
- _btnInstallType.userInteractionEnabled=NO;
- _btnDeliveryInstallType.userInteractionEnabled=NO;
- [_btnDeliveryType selected];
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- datamodel.receiptType=@"1";
- datamodel.receiptTypeName=@"完成";
- datamodel.installReceiptType=@"0";
- datamodel.installReceiptTypeName=@"";
-
- if([datamodel.circulateType intValue] == 1){
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.0f",datamodel.maxReceiptQuantity];
- }
-
- else{
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.6f",datamodel.maxReceiptQuantity];
-
- datamodel.installReceiptQuantity=@"0";
- }
- }
-
- }
-
- if([_noReceiptModel.requirementType intValue]==2)
- {
- _receiptFlag=@"2";
- _btnDeliveryType.userInteractionEnabled=NO;
- _btnInstallType.userInteractionEnabled=YES;
- [_btnInstallType selected];
- _btnDeliveryInstallType.userInteractionEnabled=NO;
-
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- datamodel.installReceiptType=@"1";
- datamodel.installReceiptTypeName=@"完成";
- datamodel.receiptType=@"0";
- datamodel.receiptTypeName=@"";
- datamodel.installReceiptQuantity=datamodel.maxInstallReceiptQuantity;
- datamodel.receiptQuantity=@"0";
-
- }
-
- }
-
- if([_noReceiptModel.requirementType intValue]==3)
- {
-
-
- if([_noReceiptModel.deliveryReceiptFlag intValue]==0&&[_noReceiptModel.installReceiptFlag intValue]==0)
- {
- _receiptFlag=@"3";
- _btnDeliveryType.userInteractionEnabled=YES;
- [_btnDeliveryInstallType selected];
- _btnInstallType.userInteractionEnabled=NO;
- _btnDeliveryInstallType.userInteractionEnabled=YES;
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- datamodel.installReceiptType=@"1";
- datamodel.installReceiptTypeName=@"完成";
- datamodel.receiptType=@"1";
- datamodel.receiptTypeName=@"完成";
- datamodel.installReceiptQuantity=datamodel.maxInstallReceiptQuantity;
- if([datamodel.circulateType intValue] == 1){
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.0f",datamodel.maxReceiptQuantity];
- }
-
- else{
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.6f",datamodel.maxReceiptQuantity];
-
- }
-
- }
-
- }
-
-
- if([_noReceiptModel.deliveryReceiptFlag intValue]==1&&[_noReceiptModel.installReceiptFlag intValue]==0)
- {
- [_btnInstallType selected];
- _btnInstallType.userInteractionEnabled=YES;
- _btnDeliveryType.userInteractionEnabled=NO;
- _btnDeliveryInstallType.userInteractionEnabled=NO;
-
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- datamodel.installReceiptType=@"1";
- datamodel.installReceiptTypeName=@"完成";
- datamodel.receiptType=@"0";
- datamodel.receiptTypeName=@"";
- datamodel.installReceiptQuantity=datamodel.maxInstallReceiptQuantity;
- datamodel.receiptQuantity=@"0";
-
- }
- }
-
-
-
- }
-
-
- self.myTableView.frame=CGRectMake(0,0, self.view.bounds.size.width, [self getDataViewHeight:_dataList]+headerView.bounds.size.height) ;
- [self.myTableView reloadData];
-
- contentView.frame=CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(self.myTableView.frame));
- scroll.contentSize = CGSizeMake(self.view.frame.size.width, CGRectGetMaxY(contentView.frame)+rectStatusHeight+rectNavHeight+200);
-
- }
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
- [self showReLoginDialog:message];
- return;
- }
-
- else {
-
- [self showAlertViewText:message];
- }
-
-
- }
- /**
- 数据加载失败函数
- @param sender <#sender description#>
- */
- - (void)onLoadFail:(ASIDownManager *)sender {
- [self stopLoading];
- [self showAlertViewText:@"网络异常"];
- }
- /**
- 获取table view的高度
- @param soundArray <#soundArray description#>
- @return <#return value description#>
- */
- - (CGFloat)getDataViewHeight:(NSArray *)dataArray {
- // 上下间隔已经在frame上做了
- NSInteger row = dataArray.count;
- return (row *288);
- }
- ///**
- // 键盘弹出函数
- // */
- //- (void)myKeyboardWillShow {
- // if(!_keyboardShow){
- //
- // [UIView animateWithDuration:0.3f animations:^ {
- // self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y - 190, self.view.frame.size.width, self.view.frame.size.height);
- //
- // }];
- // }
- //
- // _keyboardShow=YES;
- //
- //}
- //
- ///**
- // 键盘隐藏函数
- // */
- //- (void)keyboardWillHide {
- // // Animate the current view back to its original position
- // if(_keyboardShow){
- // [UIView animateWithDuration:0.0f animations:^ {
- // self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y + 190, self.view.frame.size.width, self.view.frame.size.height);
- //
- // }];}
- // _keyboardShow=NO;
- //}
- -(void)initUI
- {
- scroll = [UIScrollView new];
- scroll.delegate = self;
- 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);
- }
- int topMargin=10;
- int leftMargin=20;
- int titleWidth=70;
- int titleHeight=25;
- contentView = [[UIView alloc]init];
- contentView.frame=CGRectZero;
- contentView.backgroundColor = [UIColor whiteColor];
- UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide:)];
- //设置成NO表示当前控件响应后会传播到其他控件上,默认为YES。
- tapGestureRecognizer.cancelsTouchesInView = NO;
- // //将触摸事件添加到当前view
- [scroll addGestureRecognizer:tapGestureRecognizer];
- [scroll addSubview:contentView];
-
- headerView = [[UIView alloc]init];
- headerView.frame = CGRectZero;
- // headerView.backgroundColor = [UIColor whiteColor];
-
- //联系电话
- UILabel *lblTitleTelephone = [[UILabel alloc] initWithFrame:CGRectMake(leftMargin,topMargin,titleWidth, 25)];
- lblTitleTelephone.font = kTextFont;
- lblTitleTelephone.text = @"联系电话:";
- [headerView addSubview: lblTitleTelephone];
- _lblTelephone=[UILabel new];
- _lblTelephone.font=kTextFont;
- _lblTelephone.frame=CGRectMake(CGRectGetMaxX(lblTitleTelephone.frame), topMargin,Screen_Width-CGRectGetMaxX(lblTitleTelephone.frame),25);
- [headerView addSubview: _lblTelephone];
-
- lblTitleDeliveryAddress= [[UILabel alloc] initWithFrame:CGRectMake(leftMargin,CGRectGetMaxY(lblTitleTelephone.frame)+topMargin,titleWidth,titleHeight)];
- lblTitleDeliveryAddress.font = kTextFont;
- lblTitleDeliveryAddress.text = @"送货地址:";
- [headerView addSubview: lblTitleDeliveryAddress];
-
- _lbDeliveryAddress = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(lblTitleDeliveryAddress.frame), CGRectGetMaxY(lblTitleTelephone.frame)+topMargin, Screen_Width-CGRectGetMaxX(lblTitleDeliveryAddress.frame),titleHeight)];
- _lbDeliveryAddress.font = kTextFont;
-
- [headerView addSubview: _lbDeliveryAddress];
-
-
-
- _lbDeliveryAddress = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(lblTitleDeliveryAddress.frame), CGRectGetMaxY(lblTitleTelephone.frame)+topMargin, Screen_Width-CGRectGetMaxX(lblTitleDeliveryAddress.frame),titleHeight)];
- _lbDeliveryAddress.font = kTextFont;
-
- [headerView addSubview: _lbDeliveryAddress];
-
-
- _lblTitlePlateNumber= [[UILabel alloc] initWithFrame:CGRectMake(leftMargin,CGRectGetMaxY(lblTitleDeliveryAddress.frame)+topMargin,titleWidth,titleHeight)];
- _lblTitlePlateNumber.font = kTextFont;
- _lblTitlePlateNumber.text = @"车 牌 号:";
- [headerView addSubview: _lblTitlePlateNumber];
-
- _txtPlateNumber=[UITextField new];
- _txtPlateNumber.frame=CGRectMake(CGRectGetMaxX(_lblTitlePlateNumber.frame), CGRectGetMaxY(lblTitleDeliveryAddress.frame)+topMargin, Screen_Width-CGRectGetMaxX(_lblTitlePlateNumber.frame), titleHeight);
- _txtPlateNumber.delegate=self;
- _txtPlateNumber.font = kTextFont;
- _txtPlateNumber.placeholder=@"请输入车牌号";
- [headerView addSubview: _txtPlateNumber];
-
- lblTxtVNextDeliveryDate= [UILabel new];
- lblTxtVNextDeliveryDate.frame = CGRectMake(20, CGRectGetMaxY(_lblTitlePlateNumber.frame)+10, 70, 25);
- lblTxtVNextDeliveryDate.text = @"推迟日期:";
- lblTxtVNextDeliveryDate.font = kTextFont;
- [headerView addSubview:lblTxtVNextDeliveryDate];
- _btnNextDeliveryDate = [UIButton buttonWithType:UIButtonTypeCustom];
- _btnNextDeliveryDate.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
- _btnNextDeliveryDate.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
- _btnNextDeliveryDate.frame = CGRectMake(CGRectGetMaxX(lblTxtVNextDeliveryDate.frame), CGRectGetMaxY(_lblTitlePlateNumber.frame)+10, Screen_Width - CGRectGetMaxX(lblTxtVNextDeliveryDate.frame) - 30, 25);
- _btnNextDeliveryDate.titleLabel.font = kTextFont;
- [_btnNextDeliveryDate setTitle:@"请选择推迟日期" forState:UIControlStateNormal];
- [_btnNextDeliveryDate setTitleColor:[UIColor colorWithWhite:0.5 alpha:0.5] forState:UIControlStateNormal];
- [_btnNextDeliveryDate addTarget:self action:@selector(showNextDeliveryDate) forControlEvents:UIControlEventTouchUpInside];
-
- [headerView addSubview:_btnNextDeliveryDate];
- btnDateArrow= [UIButton buttonWithType:UIButtonTypeCustom];
- btnDateArrow.frame = CGRectMake(Screen_Width-17,CGRectGetMaxY(_lblTitlePlateNumber.frame)+15,7,12);
- [ btnDateArrow setImage:[UIImage imageNamed:@"rightarrow"] forState:UIControlStateNormal];
- [btnDateArrow addTarget:self action:@selector(clearDate) forControlEvents:UIControlEventTouchUpInside];
- [headerView addSubview:btnDateArrow];
-
- UILabel *lblTitleDispatchType = [UILabel new];
- lblTitleDispatchType.frame = CGRectMake(leftMargin,CGRectGetMaxY(lblTxtVNextDeliveryDate.frame)+topMargin,titleWidth,titleHeight);
- lblTitleDispatchType.text = @"派工类型:";
- lblTitleDispatchType.font = kTextFont;
- [headerView addSubview:lblTitleDispatchType];
- _btnDeliveryType= [[MHRadioButton alloc]initWithGroupId:@"group1" atIndex:0];
- _btnInstallType=[[MHRadioButton alloc]initWithGroupId:@"group1" atIndex:1];
- _btnDeliveryInstallType=[[MHRadioButton alloc]initWithGroupId:@"group1" atIndex:2];
- _btnDeliveryType.frame=CGRectMake(CGRectGetMaxX(lblTitleDispatchType.frame),CGRectGetMaxY(lblTxtVNextDeliveryDate.frame)+10, 25, 25);
- [headerView addSubview:_btnDeliveryType];
-
- UILabel *deliveryLabel =[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnDeliveryType.frame)+5, CGRectGetMaxY(lblTxtVNextDeliveryDate.frame)+10, 40, 25)];
- deliveryLabel.backgroundColor = [UIColor clearColor];
- deliveryLabel.text = @"配送";
- deliveryLabel.font = kTextFont;
- [headerView addSubview:deliveryLabel];
-
- _btnInstallType.frame=CGRectMake(CGRectGetMaxX(deliveryLabel.frame),CGRectGetMaxY(lblTxtVNextDeliveryDate.frame)+topMargin, 25, 25);
- [headerView addSubview:_btnInstallType];
-
- UILabel *installLabel =[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnInstallType.frame)+5, CGRectGetMaxY(lblTxtVNextDeliveryDate.frame)+10, 40, 25)];
- installLabel.backgroundColor = [UIColor clearColor];
- installLabel.text = @"安装";
- installLabel.font = kTextFont;
- [headerView addSubview:installLabel];
-
- _btnDeliveryInstallType.frame=CGRectMake(CGRectGetMaxX(installLabel.frame),CGRectGetMaxY(lblTxtVNextDeliveryDate.frame)+topMargin, 25, 25);
-
- [headerView addSubview:_btnDeliveryInstallType];
-
- UILabel *deliveryInstallLabel =[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnDeliveryInstallType.frame)+5, CGRectGetMaxY(lblTxtVNextDeliveryDate.frame)+10, 70, 25)];
- deliveryInstallLabel.backgroundColor = [UIColor clearColor];
- deliveryInstallLabel.text = @"送安一体";
- deliveryInstallLabel.font = kTextFont;
- [headerView addSubview:deliveryInstallLabel];
- [MHRadioButton addObserver:self forFroupId:@"group1"];
-
-
- //分割线
- line = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_btnDeliveryType.frame)+10, Screen_Width, 3)];
- line.backgroundColor = LineBackgroundColor;
- [headerView addSubview:line];
-
- self.myTableView = [[UITableView alloc]init];
- self.myTableView.dataSource = self;
- self.myTableView.delegate = self;
- self.myTableView.scrollEnabled = NO;
- self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
-
- self.myTableView.frame =self.view.bounds ;
- [contentView addSubview:self.myTableView];
-
- headerView.frame = CGRectMake(0,0,_myTableView.bounds.size.width,CGRectGetMaxY(line.frame)+10);
- _myTableView.tableHeaderView = headerView;
-
- contentView.frame=CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(self.myTableView.frame));
- scroll.contentSize = CGSizeMake(self.view.frame.size.width, CGRectGetMaxY(contentView.frame)+rectStatusHeight+rectNavHeight+120);
-
- }
- - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
- //用来判断是否可以继续输入, - range.length是为了判断是否可以删除
- NSInteger currentLength = textField.text.length - range.length + string.length;
- if (currentLength > 7) {
-
- return NO;
- }
-
- return YES;
- }
- -(void)clearDate
- {
- btnDateArrow.frame = CGRectMake(Screen_Width-17,CGRectGetMaxY(_lblTitlePlateNumber.frame)+10,7,12);
- [ btnDateArrow setImage:[UIImage imageNamed:@"rightarrow"] forState:UIControlStateNormal];
-
- [_btnNextDeliveryDate setTitle:@"请选择推迟日期" forState:UIControlStateNormal];
- _sNextDeliveryDate=@"";
- _sReceiptType=@"1";
-
- if([_receiptFlag intValue]==1)
- {
-
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- datamodel.receiptType=@"1";
- datamodel.receiptTypeName=@"完成";
- datamodel.installReceiptType=@"0";
- datamodel.installReceiptTypeName=@"";
-
- if([datamodel.circulateType intValue] == 1){
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.0f",datamodel.maxReceiptQuantity];
- }
-
- else{
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.6f",datamodel.maxReceiptQuantity];
-
-
- }
- datamodel.installReceiptQuantity=@"0";
- }
-
- }
-
- if([_receiptFlag intValue]==2)
- {
-
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- datamodel.installReceiptType=@"1";
- datamodel.installReceiptTypeName=@"完成";
- datamodel.receiptType=@"0";
- datamodel.receiptTypeName=@"";
- datamodel.installReceiptQuantity=datamodel.maxInstallReceiptQuantity;
- datamodel.receiptQuantity=@"0";
-
- }
- }
-
- if([_receiptFlag intValue]==3)
- {
-
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- datamodel.installReceiptType=@"1";
- datamodel.installReceiptTypeName=@"完成";
- datamodel.receiptType=@"1";
- datamodel.receiptTypeName=@"完成";
- datamodel.installReceiptQuantity=datamodel.maxInstallReceiptQuantity;
- if([datamodel.circulateType intValue] == 1){
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.0f",datamodel.maxReceiptQuantity];
- }
-
- else{
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.6f",datamodel.maxReceiptQuantity];
-
-
-
- }
-
-
-
- }
-
- }
-
- [_myTableView reloadData];
-
-
- }
- /**
- 文本值变化回调函数
- @param cell <#cell description#>
- @param txtfield <#txtfield description#>
- @param qualityTxt <#qualityTxt description#>
- @param remark <#remark description#>
- */
- - (void)textValueChange:(NewDispatchRequirementCell *)cell txtField:(UITextField *)txtfield qualityField:(UITextField *)qualityTxt remarkField:(UITextField *)remark{
-
- NewDispatchRequirementModel *model = [_dataList objectAtIndex: cell.cellIndex];
- if(txtfield.tag == 1000){
-
-
- model.receiptQuantity = txtfield.text;
- }
- if(txtfield.tag == 1001){
- model.receiptRemarks = txtfield.text;
- }
- if(txtfield.tag == 2000){
- model.installReceiptQuantity = txtfield.text;
- }
-
- }
- /**
- 出示推迟日期函数
- @return <#return value description#>
- */
- - (void)showNextDeliveryDate{
- [self.view endEditing:YES];
- __weak typeof(self)weakself = self;
- _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_dealDatePicker configureSelectionBlock:^(NSString *date){
- _sNextDeliveryDate = date;
- } andCompletionBlock:^(void){
-
- [weakself.btnNextDeliveryDate setTitle:_sNextDeliveryDate forState:UIControlStateNormal];
- [weakself.btnNextDeliveryDate setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- _sReceiptType=@"2";
- btnDateArrow.frame = CGRectMake(Screen_Width-30,CGRectGetMaxY(_lblTitlePlateNumber.frame)+10,25,25);
- [ btnDateArrow setImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal];
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
- if([_receiptFlag intValue]==1)
- {
- datamodel.installReceiptType=@"0";
- datamodel.installReceiptTypeName=@"";
- datamodel.receiptType=@"2";
- datamodel.receiptTypeName=@"再送";
- datamodel.installReceiptQuantity=@"0";
- datamodel.receiptQuantity=@"0";
- }
-
- if([_receiptFlag intValue]==2)
- {
- datamodel.installReceiptType=@"5";
- datamodel.installReceiptTypeName=@"再安装";
- datamodel.receiptType=@"0";
- datamodel.receiptTypeName=@"";
- datamodel.installReceiptQuantity=@"0";
- datamodel.receiptQuantity=@"0";
- }
-
- if([_receiptFlag intValue]==3)
- {
- datamodel.installReceiptType=@"5";
- datamodel.installReceiptTypeName=@"再安装";
- datamodel.receiptType=@"2";
- datamodel.receiptTypeName=@"再送";
- datamodel.installReceiptQuantity=@"0";
- datamodel.receiptQuantity=@"0";
- }
-
- }
-
- [_myTableView reloadData];
- } andCancelBlock:^(void){
- _sNextDeliveryDate = weakself.btnNextDeliveryDate.titleLabel.text;
- if([_sNextDeliveryDate isEqualToString:@"请选择推迟日期"]){
- _sNextDeliveryDate = @"";
- }
- _sReceiptType=@"1";
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *model = [_dataList objectAtIndex:i];
- model.receiptType = @"1";
- model.receiptTypeName=@"完成";
- if([model.circulateType intValue] == 1){
-
- model.receiptQuantity = [NSString stringWithFormat:@"%.0f",model.maxReceiptQuantity];
-
- }
-
- else{
-
- model.receiptQuantity = [NSString stringWithFormat:@"%.6f",model.maxReceiptQuantity];
-
-
- }
-
- model.installReceiptType=@"1";
- model.installReceiptTypeName=@"完成";
- model.installReceiptQuantity=model.maxInstallReceiptQuantity;
- }
-
- [_myTableView reloadData];
- btnDateArrow.frame = CGRectMake(Screen_Width-17,CGRectGetMaxY(_lblTitlePlateNumber.frame)+10,7,12);
- [ btnDateArrow setImage:[UIImage imageNamed:@"rightarrow"] forState:UIControlStateNormal];
- }];
- [_dealDatePicker show];
-
-
- }
- // 代理方法 监控按钮选中状态的改变
- - (void)radioButtonSelectedAtIndex:(NSUInteger)index inGroup:(NSString *)groupID {
-
- if(index==0)
- {
- _receiptFlag=@"1";
- if([_sReceiptType intValue]==1)
- {
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- datamodel.receiptType=@"1";
- datamodel.receiptTypeName=@"完成";
- datamodel.installReceiptType=@"0";
- datamodel.installReceiptTypeName=@"";
-
- if([datamodel.circulateType intValue] == 1){
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.0f",datamodel.maxReceiptQuantity];
- }
-
- else{
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.6f",datamodel.maxReceiptQuantity];
-
-
- }
-
- datamodel.installReceiptQuantity=@"0";
- }
-
- }
-
- if([_sReceiptType intValue]==2)
- {
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
- if([_receiptFlag intValue]==1)
- {
- datamodel.installReceiptType=@"0";
- datamodel.installReceiptTypeName=@"";
- datamodel.receiptType=@"2";
- datamodel.receiptTypeName=@"再送";
- datamodel.installReceiptQuantity=@"0";
- datamodel.receiptQuantity=@"0";
- }
-
-
-
- }
-
- }
- }
-
- if(index==1)
- {
- _receiptFlag=@"2";
- if([_sReceiptType intValue]==1)
- {
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- datamodel.installReceiptType=@"1";
- datamodel.installReceiptTypeName=@"完成";
- datamodel.receiptType=@"0";
- datamodel.receiptTypeName=@"";
- datamodel.installReceiptQuantity=datamodel.maxInstallReceiptQuantity;
- datamodel.receiptQuantity=@"0";
-
- }
-
- }
-
- if([_sReceiptType intValue]==2)
- {
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
-
- if([_receiptFlag intValue]==2)
- {
- datamodel.installReceiptType=@"5";
- datamodel.installReceiptTypeName=@"再安装";
- datamodel.receiptType=@"0";
- datamodel.receiptTypeName=@"";
- datamodel.installReceiptQuantity=@"0";
- datamodel.receiptQuantity=@"0";
- }
-
-
-
- }
- }
- }
-
- if(index==2)
- {
- _receiptFlag=@"3";
-
- if([_sReceiptType intValue]==1)
- {
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- datamodel.installReceiptType=@"1";
- datamodel.installReceiptTypeName=@"完成";
- datamodel.receiptType=@"1";
- datamodel.receiptTypeName=@"完成";
- datamodel.installReceiptQuantity=datamodel.maxInstallReceiptQuantity;
- if([datamodel.circulateType intValue] == 1){
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.0f",datamodel.maxReceiptQuantity];
- }
-
- else{
-
- datamodel.receiptQuantity = [NSString stringWithFormat:@"%.6f",datamodel.maxReceiptQuantity];
-
-
-
- }
-
- }
-
- }
-
- if([_sReceiptType intValue]==2)
- {
- for(int i=0;i<_dataList.count;i++)
- {
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
-
- if([_receiptFlag intValue]==3)
- {
- datamodel.installReceiptType=@"5";
- datamodel.installReceiptTypeName=@"再安装";
- datamodel.receiptType=@"2";
- datamodel.receiptTypeName=@"再送";
- datamodel.installReceiptQuantity=@"0";
- datamodel.receiptQuantity=@"0";
- }
-
- }
- }
- }
-
-
-
- [_myTableView reloadData];
- }
- //-(void)changeButtonColor
- //{
- // _btnDeliveryMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
- // [_btnDeliveryType setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- //
- // _btnInstallType.layer.borderColor=[UIColor lightGrayColor].CGColor;
- // [_btnInstallType setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- // _btnDeliveryInstallMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
- // [_btnDeliveryInstallType setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- //
- //}
- /**
- 初始化回执类型
- */
- - (void)initStatus2{
- _arrayStatus = [[NSMutableArray alloc]init];
- StatusInfo *s = [[StatusInfo alloc]init];
- s.tagName = @"cell";
- s.statusId = @"0";
- s.name = @"";
- [_arrayStatus addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.tagName = @"cell";
- s.statusId = @"1";
- s.name = @"完成";
- [_arrayStatus addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.tagName = @"cell";
- s.statusId = @"2";
- s.name = @"再送";
- [_arrayStatus addObject:s];
-
-
- }
- /**
- 安装回执状态
-
- @param flag <#flag description#>
- */
- -(void) initStatus3{
- _arrayStatus = [[NSMutableArray alloc]init];
- StatusInfo *s = [[StatusInfo alloc]init];
- s.tagName = @"install";
- s.statusId = @"0";
- s.name = @"";
- [_arrayStatus addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.tagName = @"install";
- s.statusId = @"1";
- s.name = @"完成";
- [_arrayStatus addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.tagName = @"install";
- s.statusId = @"5";
- s.name = @"再安装";
- [_arrayStatus addObject:s];
-
-
- }
- /**
- 安装回执
-
- @param path <#path description#>
- */
- - (void)setInstallReceiptType:(NSIndexPath*) path{
- _myRow= path;
- NewDispatchRequirementModel *mode = _dataList[_myRow.row];
-
- [self initStatus3];
-
- StatusInfoTextVC *tc = [[StatusInfoTextVC alloc] init];
- tc.sdelegate=self;
- [tc.arrFilter addObjectsFromArray: _arrayStatus];
- [self.cNav pushViewController:tc animated:YES];
- self.hidesBottomBarWhenPushed = NO;
- }
- /**
- 回执类型回调函数
- @param s <#s description#>
- */
- - (void)showStatusValue:(StatusInfo *)s{
-
- //选择Cell回执状态回调
- if([s.tagName isEqualToString:@"cell"]){
- NewDispatchRequirementModel *model = _dataList[_myRow.row];
- switch ([s.statusId intValue]) {
- case 0:
-
- model.receiptType = @"0";
- model.receiptTypeName=@"";
- model.receiptQuantity =@"0";
- break;
- case 1:
-
- model.receiptType = @"1";
- model.receiptTypeName=@"完成";
- if([model.circulateType intValue] == 1){
-
- model.receiptQuantity = [NSString stringWithFormat:@"%.0f",model.maxReceiptQuantity];
- }
-
- else{
-
- model.receiptQuantity = [NSString stringWithFormat:@"%.6f",model.maxReceiptQuantity];
-
-
- }
-
- break;
- case 2:
-
- model.receiptType = @"2";
- model.receiptTypeName=@"再送";
- model.receiptQuantity=@"0";
-
- break;
-
- default:
- break;
- }
- }
- if([s.tagName isEqualToString:@"install"]){
- NewDispatchRequirementModel *model1 = _dataList[_myRow.row];
- switch ([s.statusId intValue]) {
- case 0:
- model1.installReceiptType = @"0";
- model1.installReceiptTypeName=@"";
- model1.installReceiptQuantity =@"0";
- break;
-
- case 1:
- model1.installReceiptType = @"1";
- model1.installReceiptTypeName=@"完成";
- model1.installReceiptQuantity=
- model1.installQuantity;
-
- break;
-
- case 5:
- model1.installReceiptType = @"5"
- ;
- model1.installReceiptTypeName = @"再安装";
- model1.installReceiptQuantity =@"0"; ;
- break;
- }
-
- }
- [_myTableView reloadData];
- }
- /**
- Cell回执类型回调函数
- */
- - (void)setDeliveryReceiptType:(NSIndexPath*)path{
- _myRow= path;
- NewDispatchRequirementModel *mode = _dataList[_myRow.row];
-
- [self initStatus2];
-
- StatusInfoTextVC *tc = [[StatusInfoTextVC alloc] init];
- tc.sdelegate=self;
- [tc.arrFilter addObjectsFromArray: _arrayStatus];
- [self.cNav pushViewController:tc animated:YES];
- self.hidesBottomBarWhenPushed = NO;
- }
- //-(void)goDeliveryType:(UIButton*)sender
- //{
- // //[self changeButtonColor];
- // if(sender.tag==100)
- // {
- // _btnDeliveryMaskLayer.strokeColor=[UIColor redColor].CGColor;
- //// [_btnDeliveryType setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
- // receiptFlag=@"1";
- // for(int i=0;i<_dataList.count;i++)
- // {
- // NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
- //
- // datamodel.receiptType=@"1";
- // datamodel.receiptTypeName=@"完成";
- // datamodel.installReceiptType=@"0";
- // datamodel.installReceiptTypeName=@"";
- //
- // if([datamodel.circulateType intValue] == 1){
- //
- // datamodel.receiptQuantity = [NSString stringWithFormat:@"%.0f",datamodel.maxReceiptQuantity];
- // }
- //
- // else{
- //
- // datamodel.receiptQuantity = [NSString stringWithFormat:@"%.6f",datamodel.maxReceiptQuantity];
- //
- // datamodel.installReceiptQuantity=@"0";
- // }
- // }
- //
- // }
- //
- // if(sender.tag==101)
- // {
- // _btnInstallType.layer.borderColor=[UIColor redColor].CGColor;
- //// [_btnInstallType setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
- // receiptFlag=@"2";
- //
- // for(int i=0;i<_dataList.count;i++)
- // {
- // NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
- //
- // datamodel.installReceiptType=@"1";
- // datamodel.installReceiptTypeName=@"完成";
- // datamodel.receiptType=@"0";
- // datamodel.receiptTypeName=@"";
- // datamodel.installReceiptQuantity=datamodel.installQuantity;
- // datamodel.receiptQuantity=@"0";
- //
- // }
- // }
- //
- // if(sender.tag==102)
- // {
- // _btnDeliveryInstallMaskLayer.strokeColor=[UIColor redColor].CGColor;
- //// [_btnDeliveryInstallType setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
- // receiptFlag=@"3";
- //
- // for(int i=0;i<_dataList.count;i++)
- // {
- // NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:i];
- //
- // datamodel.installReceiptType=@"1";
- // datamodel.installReceiptTypeName=@"完成";
- // datamodel.receiptType=@"1";
- // datamodel.receiptTypeName=@"完成";
- // datamodel.installReceiptQuantity=datamodel.installQuantity;
- // if([datamodel.circulateType intValue] == 1){
- //
- // datamodel.receiptQuantity = [NSString stringWithFormat:@"%.0f",datamodel.maxReceiptQuantity];
- // }
- //
- // else{
- //
- // datamodel.receiptQuantity = [NSString stringWithFormat:@"%.6f",datamodel.maxReceiptQuantity];
- //
- // datamodel.installReceiptQuantity=datamodel.installQuantity;
- //
- // }
- //
- // }
- //
- // }
- //}
- //- (void)keyboardWillShow:(NSNotification *)info
- //{
- // CGRect keyboardBounds = [[[info userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
- // _myTableView.contentInset = UIEdgeInsetsMake(_myTableView.contentInset.top, 0, keyboardBounds.size.height, 0);
- //
- //}
- //- (void)keyboardWillHide:(NSNotification *)info
- //{
- // _myTableView.contentInset = UIEdgeInsetsMake(_myTableView.contentInset.top, 0, 0, 0);
- //}
- /**
- 键盘弹出函数
- */
- - (void)myKeyboardWillShow {
- if(!keyboardShow){
-
- [UIView animateWithDuration:0.3f animations:^ {
- self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y - 190, self.view.frame.size.width, self.view.frame.size.height);
-
- }];
- }
-
- keyboardShow=YES;
-
- }
- /**
- 键盘隐藏函数
- */
- - (void)keyboardWillHide {
- // Animate the current view back to its original position
- if(keyboardShow){
- [UIView animateWithDuration:0.0f animations:^ {
- self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y + 190, self.view.frame.size.width, self.view.frame.size.height);
-
- }];}
- keyboardShow=NO;
- }
- /**
- table view的分区数
-
- @param tableView <#tableView description#>
- @return <#return value description#>
- */
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
-
- }
- /**
- table view的行数
- @param tableView <#tableView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [_dataList count];
- }
- /**
- table view的高度
-
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- return 288;
- }
- /**
- 键盘隐藏函数
- @param tap <#tap description#>
- */
- - (void)keyboardHide:(UITapGestureRecognizer*)tap{
- [self.view endEditing:YES];
- }
- /**
- 获取tableview cell
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- NSString *CellIdentifier = @"DataListTableViewCell";
- NewDispatchRequirementCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
-
- cell = [[NewDispatchRequirementCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
- cell.dispatchDelegate = self;
- cell.nddelegate = self;
-
- cell.receiptQuantity.delegate = self;
- cell.receiptQuantity.tag = indexPath.row;
- NewDispatchRequirementModel *datamodel = [_dataList objectAtIndex:indexPath.row];
- cell.myIndexPath = indexPath;
- cell.cellIndex = indexPath.row;
- [cell parseInfoModel:datamodel receiptType:_sReceiptType receiptFlag:_receiptFlag ];
- return cell;
- }
- @end
|