| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747 |
- //
- // SalesSlipSearchListVC.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2018/4/13.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "SalesSlipSearchListVC.h"
- @interface SalesSlipSearchListVC (){
- int pageNumber;
- }
- @end
- @implementation SalesSlipSearchListVC
- @synthesize vCustomTableView;
- #pragma mark 公共函数
- /**
- 视图加载完成函数
- */
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self loadNavStyle];
- [self initUI];
- pageNumber=1;
- _dataList=[[NSMutableArray alloc]init];
- _goodsDetailList=[[NSMutableArray alloc]init];
- [self loadData];
- }
- /**
- 安全区变化函数
- */
- -(void)viewSafeAreaInsetsDidChange{
- vCustomTableView.frame=CGRectMake(0,0,self.view.frame.size.width,self.view.safeAreaLayoutGuide.layoutFrame.size.height-50);
- _bottomView.frame=CGRectMake(0, self.view.safeAreaLayoutGuide.layoutFrame.size.height-50, self.view.frame.size.width, 50);
- [super viewSafeAreaInsetsDidChange];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
-
- }
- #pragma mark 委托函数
- /**
- 销售单数据加载成功回调
- @param sender <#sender description#>
- */
- - (void)onSalesSlipListFinish:(ASIDownManager *)sender {
- NSDictionary *dic = [sender.mWebStr JSONValue];
- vCustomTableView.mTableView.backgroundView = nil;
- [self stopLoading];
- // 服务器返回数据是否正确
- if (dic && [dic isKindOfClass:[NSDictionary class]]) {
- // 服务器返回数据状态值
- int iStatus = [[dic objectForKey:@"Status"] intValue];
- int iNewCount = 0;
- // 服务器返回数据消息
- NSString *message=[dic objectForKey:@"Message"];
- // 服务器返回数据状态值正确
- if (iStatus == 0) {
- NSArray * infoArr=[dic objectForKey:@"Result"];
- // 返回结果
- if(infoArr!=nil&& infoArr.count>0)
- {
- for (int i = 0; i < infoArr.count; i++) {
- NSDictionary * dic=infoArr[i];
- SalesOutStorageSalesSlipModel *salesSlipListModel=[[SalesOutStorageSalesSlipModel alloc]init];
- [salesSlipListModel parseDic:dic];
- [_dataList addObject:salesSlipListModel];
- }
- iNewCount =(int)infoArr.count;
- vCustomTableView.mbMoreHidden = (iNewCount == 0);
- [vCustomTableView FinishLoading];
- [vCustomTableView reloadData];
-
- }
- else{
-
- [vCustomTableView FinishLoading];
- vCustomTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- UIView *noDataView=[[UIView alloc]init];
- noDataView.frame=vCustomTableView.bounds;
- UIImageView *nodataImgView=[[UIImageView alloc] initWithFrame:CGRectMake(noDataView.frame.size.width/2-16,noDataView.frame.size.height/2-16,32,32)];
- [nodataImgView setImage:[UIImage imageNamed:@"icon_no_data"]];
- [noDataView addSubview:nodataImgView];
- UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(noDataView.frame.size.width/2-16-12,CGRectGetMaxY(nodataImgView.frame)+3,70, 25)];
- label.font=[UIFont systemFontOfSize:NoDataFontOfSize];
- label.text = @"无数据";
- label.numberOfLines = 2;
- label.textColor = [UIColor lightGrayColor];
- [noDataView addSubview:label];
-
- // 有刷新数据的时候
- if(_dataList == nil || _dataList.count==0){
- vCustomTableView.mTableView.backgroundView =noDataView;
- [self showAlertViewBackText:@"未找到匹配结果"];
- }
-
-
- }
- }
- // 服务器返回数据状态值异常
- else if(iStatus==ActionResultStatusAuthError
- ||iStatus==ActionResultStatusNoLogin
- ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){
-
- [self showReLoginDialog:message];
- }
- else{
-
- [vCustomTableView FinishLoading];
- [self showAlertViewText:message];
- }
- }
- }
- /**
- 销售单数据加载失败回调
- @param sender <#sender description#>
- */
- - (void)onSalesSlipListFail:(ASIDownManager *)sender {
- [self stopLoading];
- [self showAlertViewText:@"加载失败"];
- }
- /**
- 销售单产品明细加载成功回调
- @param sender <#sender description#>
- */
- - (void)onSalesSlipGoodsDetailLoadFinish:(ASIDownManager *)sender {
- NSDictionary *dic = [sender.mWebStr JSONValue];
- if (dic && [dic isKindOfClass:[NSDictionary class]]) {
- // 服务器返回数据状态值
- int iStatus = [[dic objectForKey:@"Status"] intValue];
- // 服务器返回数据消息
- NSString *message=[dic objectForKey:@"Message"];
- // 服务器返回数据状态值正确
- if (iStatus == 0) {
- NSArray * infoArr=[dic objectForKey:@"Result"];
- // 返回结果
- if(infoArr!=nil&& infoArr.count>0)
- {
- _salesSlipModel.goodsDetailArray=[[NSMutableArray alloc]init];
- for (int i = 0; i < infoArr.count; i++) {
- NSDictionary * dic=infoArr[i];
- SalesOutStorageSalesSlipGoodsListModel *goodsListModel=[[SalesOutStorageSalesSlipGoodsListModel alloc]init];
- [goodsListModel parseDic:dic];
- [goodsListModel setCustomerId:_salesSlipModel.customerId];
- [goodsListModel setCheckedFlag:YES];
- [_salesSlipModel.goodsDetailArray addObject:goodsListModel];
- }
-
- NSString *goodsCountStr= [NSString stringWithFormat:@"共%d件商品", _salesSlipModel.goodsDetailArray.count];
- _salesSlipModel.goodsCount=goodsCountStr;
-
- }
- else{
- NSString *goodsCountStr= @"共0件商品";
- _salesSlipModel.goodsCount=goodsCountStr;
-
- }
- [vCustomTableView reloadData];
- }
- else if(iStatus==ActionResultStatusAuthError
- ||iStatus==ActionResultStatusNoLogin
- ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){
-
- [self showReLoginDialog:message];
- }
- else{
- [self showAlertViewText:message];
- }
- [self stopLoading];
- }
- }
- /**
- 销售单产品明细加载失败回调
- @param sender <#sender description#>
- */
- - (void)onSalesSlipGoodsDetailLoadFail:(ASIDownManager *)sender {
- [self stopLoading];
- [self showAlertViewText:@"加载失败"];
- }
- /**
- 加载更多
-
- @param sender sender description
- */
- - (void)LoadMoreList:(RefreshTableView *)sender {
- pageNumber++;
- [self startLoading];
- [self loadData];
- }
- /**
- 下拉刷新
-
- @param sender <#sender description#>
- */
- - (void)ReloadList:(RefreshTableView *)sender{
- pageNumber = 1;
- [_dataList removeAllObjects];
- [vCustomTableView reloadData];
- vCustomTableView.mbMoreHidden=YES;
- [self startLoading];
- [self loadData];
- }
- /**
- 取消刷新
-
- @param sender sender description
- @return return value description
- */
- - (BOOL)CanRefreshTableView:(RefreshTableView *)sender {
- return YES;
- }
- /**
- 隐藏键盘
-
- @param scrollView <#scrollView description#>
- */
- -(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
- {
- [self.view endEditing:YES];
- }
- /**
- 选中销售单状态
- @param index <#index description#>
- */
- -(void)btnCheckPressed:(NSInteger)index{
- _salesSlipModel= [_dataList objectAtIndex:index];
- _salesSlipModel.checkedFlag=!_salesSlipModel.checkedFlag;
-
- if(_salesSlipModel.checkedFlag){
- if(_salesSlipModel.goodsDetailArray==nil||_salesSlipModel.goodsDetailArray.count==0){
- [self loadGoodsDetailData:_salesSlipModel.salesId];
- }
- else{
- [self updateCheckedStatus:YES];
-
- NSString *goodsCountStr= [NSString stringWithFormat:@"共%lu件商品", (unsigned long)_salesSlipModel.goodsDetailArray.count];
- _salesSlipModel.goodsCount=goodsCountStr;
- }
-
-
- }
- else{
- [self updateCheckedStatus:NO];
- _salesSlipModel.goodsCount=@"";
- }
- [vCustomTableView reloadData];
-
- }
- /**
- 跳转到产品明细页面
- @param index <#index description#>
- */
- -(void)btnGoGoodsDetail:(NSInteger)index{
- _salesSlipModel= [_dataList objectAtIndex:index];
- _dataTempList=[[NSMutableArray alloc] initWithArray:_dataList copyItems:YES];
- SalesOutStorageSalesSlipGoodsListVC *goodsListVc=[[SalesOutStorageSalesSlipGoodsListVC alloc]init];
- goodsListVc.salesSlipModel=_salesSlipModel;
- goodsListVc.position=index;
- goodsListVc.goodsListDelegate=self;
- [self.navigationController pushViewController:goodsListVc animated:YES];
- }
- /**
- 刷新数据
- */
- -(void) recoveryData{
- if(_dataTempList!=nil&&_dataTempList.count>0){
- _dataList =[[NSMutableArray alloc] initWithArray:_dataTempList copyItems:YES];
- }
- }
- /**
- 单元格cell个数
- @param tableView <#tableView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [_dataList count];
- }
- /**
- tableview的分区数
- @param tableView <#tableView description#>
- @return <#return value description#>
- */
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- /**
- 高度
-
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 315;
-
- }
- /**
- 每个单元格cell
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *cellIdentifier = @"SalesSlipListCell";
- SalesSlipSearchListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier ];
- if (!cell) {
- cell=[[SalesSlipSearchListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
- cell.selectionStyle=UITableViewCellSelectionStyleNone;
- }
- else
- //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免
- {
- while ([cell.contentView.subviews lastObject] != nil) {
- [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview];
- }
- }
-
- SalesOutStorageSalesSlipModel *salesSlipModel= [_dataList objectAtIndex:indexPath.row];
- cell.checkDelegate = self;
- cell.cellIndex=indexPath.row;
- [cell setSalesSlipModel:salesSlipModel];
- [cell setCheckBackground:salesSlipModel.checkedFlag];
-
- return cell;
- }
- /**
- 获取选中的产品列表
- @param checkedGoodsList <#checkedGoodsList description#>
- @param pos <#pos description#>
- */
- -(void)btnGetCheckedGoodsList:(NSMutableArray *)checkedGoodsList position:(NSInteger)pos{
- NSMutableArray *tempCheckedGoodsList=[[NSMutableArray alloc] initWithArray:checkedGoodsList copyItems:YES];
- SalesOutStorageSalesSlipModel *salesSlipModel= [_dataList objectAtIndex:pos];
- if(salesSlipModel.goodsDetailArray!=nil&&salesSlipModel.goodsDetailArray.count>0){
- for(SalesOutStorageSalesSlipGoodsListModel *goodsModel in salesSlipModel.goodsDetailArray){
- goodsModel.checkedFlag=NO;
- }
- }
-
- if(tempCheckedGoodsList!=nil&&tempCheckedGoodsList.count>0){
- if((salesSlipModel.goodsDetailArray!=nil&&salesSlipModel.goodsDetailArray.count>0)&&(checkedGoodsList!=nil&&checkedGoodsList.count>0)){
- for(SalesOutStorageSalesSlipGoodsListModel *checkedGoodsModel in tempCheckedGoodsList){
- for(SalesOutStorageSalesSlipGoodsListModel *goodsModel in salesSlipModel.goodsDetailArray){
- if([checkedGoodsModel.detailId integerValue]==[goodsModel.detailId integerValue]){
- if(checkedGoodsModel.checkedFlag){
- goodsModel.checkedFlag=checkedGoodsModel.checkedFlag;
- }
- }
- }
- }
- }
- }
- if(tempCheckedGoodsList.count>0){
- NSString *goodsCountStr= [NSString stringWithFormat:@"共%lu件商品",(unsigned long)tempCheckedGoodsList.count];
- salesSlipModel.goodsCount=goodsCountStr;
- salesSlipModel.checkedFlag=YES;
- }
- else{
- salesSlipModel.checkedFlag=NO;
- salesSlipModel.goodsCount=@"";
- }
-
-
-
- [vCustomTableView reloadData];
- }
- /**
- 显示下拉更新
-
- @param scrollView <#scrollView description#>
- */
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
- if (scrollView.isDragging) {//显示下拉更新
-
- if (vCustomTableView.mRefreshHeader.state == PullRefreshPulling && scrollView.contentOffset.y > -65.0f && scrollView.contentOffset.y < 0.0f && [vCustomTableView CanRefresh]) {
- [vCustomTableView.mRefreshHeader setState:PullRefreshNormal];
- }
- else if (vCustomTableView.mRefreshHeader.state == PullRefreshNormal && scrollView.contentOffset.y < -65.0f && [vCustomTableView CanRefresh]) {//显示松开更新
- [vCustomTableView.mRefreshHeader setState:PullRefreshPulling];
- }
- }
- }
- #pragma mark 私有函数
- /**
- 导航按钮样式
- */
- -(void)loadNavStyle
- {
- self.navigationItem.title=@"销售单列表";
- //返回
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- [button setBackgroundImage:[UIImage imageNamed:@"icon_back"]
- forState:UIControlStateNormal];
- [button addTarget:self action:@selector(goBack)
- forControlEvents:UIControlEventTouchUpInside];
- button.frame = CGRectMake(0, 0, 15, 18);
-
- UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
- self.navigationItem.leftBarButtonItem = menuButton;
-
- }
- /**
- 返回函数
- */
- - (void)goBack
- {
- [self.navigationController popViewControllerAnimated:YES];
- }
- /**
- 初始化UI
- */
- -(void)initUI{
- [self.view setBackgroundColor:[UIColor whiteColor]];
- vCustomTableView = [[RefreshTableView alloc]
- initWithFrame:CGRectMake(0,
- 0,
- self.view.frame.size.width,
- self.view.frame.size.height-50)];
-
- vCustomTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- vCustomTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
- vCustomTableView.backgroundColor = [UIColor whiteColor];
- vCustomTableView.delegate = self;
-
- [self.view addSubview:vCustomTableView];
- self.vCustomTableView.mTableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, 49, 0);
- //保存
- _bottomView=[UIView new];
- _bottomView.frame=CGRectMake(0, self.view.frame.size.height-110, self.view.frame.size.width, 50);
- [self.view addSubview:_bottomView];
-
- //提交结算
- _sureBtn=[UIButton buttonWithType:UIButtonTypeCustom];
- [_sureBtn setTitle:@"确定" forState:UIControlStateNormal];
- [_sureBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- _sureBtn.frame=CGRectMake(20,5,Screen_Width-40,40);
- [_sureBtn setBackgroundColor:[UIColor colorWithRed:189.0/255.0 green:0 blue:7.0/255.0 alpha:1]];
- [_sureBtn addTarget:self action:@selector(submitData) forControlEvents:UIControlEventTouchUpInside];
- [_bottomView addSubview:_sureBtn];
- }
- /**
- 提交数据函数
- */
- -(void)submitData{
- Boolean checkedFlag=[self isCheckedSalesSlip:_dataList];
- if(!checkedFlag){
- [self showAlertViewText:@"请选择销售单"];
- return;
- }
-
-
- NSMutableArray *checkedSalesSlip=[self getSelectedSalesSlip:_dataList];
-
- Boolean isHasGoods=[self isHasGoods:checkedSalesSlip];
-
- if(!isHasGoods){
- [self showAlertViewText:@"销售单下没有商品,请重新选择"];
- return;
- }
- Boolean isSameCustomer= [self isSameCustomer:checkedSalesSlip];
-
- if(!isSameCustomer){
- [self showAlertViewText:@"请选择同样的客户"];
- return;
- }
- if(_goodsDetailVc.goodsList!=nil&&_goodsDetailVc.goodsList.count>0){
- Boolean isCompareSameCustomer= [self compareSameCustomer:checkedSalesSlip goodsList:_goodsDetailVc.goodsList];
-
- if(!isCompareSameCustomer){
- [self showAlertViewText:@"请选择同样的客户"];
- return;
- }
- }
- if(_goodsDetailVc.goodsList!=nil&&_goodsDetailVc.goodsList.count>0){
- Boolean isSameGoods=[self isHasSameGoods:checkedSalesSlip goodsList:_goodsDetailVc.goodsList];
- if(isSameGoods){
- [self showAlertViewText:@"商品重复,请重新选择商品"];
- return;
- }
- }
-
-
-
-
- if([self.salesSlipDelegate respondsToSelector:@selector(getSelectedSalesSlipList: )]){
- [self.salesSlipDelegate getSelectedSalesSlipList:checkedSalesSlip];
- }
- [self.navigationController popViewControllerAnimated:YES];
-
- }
- /**
- 是否是同一种商品
- @param checkedSalesOutStorageList <#checkedSalesOutStorageList description#>
- @param goodsList <#goodsList description#>
- @return <#return value description#>
- */
- -(Boolean) isHasSameGoods:(NSMutableArray*)checkedSalesOutStorageList goodsList:(NSMutableArray*)goodsList{
- Boolean isHasSame;
- for( SalesOutStorageSalesSlipModel *checkedGoodsModel in checkedSalesOutStorageList){
- isHasSame =[self checkSameGoods:checkedGoodsModel.goodsDetailArray goodsList:goodsList];
- if(isHasSame){
- break;
- }
- }
- return isHasSame;
- }
- /**
- 判断是否是同一种商品
- @param checkedGoodsList <#checkedGoodsList description#>
- @param goodsList <#goodsList description#>
- @return <#return value description#>
- */
- -(Boolean) checkSameGoods:(NSMutableArray*)checkedGoodsList goodsList:(NSMutableArray*)goodsList{
- Boolean isHasSame=NO;
- for( SalesOutStorageSalesSlipGoodsListModel *checkedGoodsModel in checkedGoodsList){
- for(SalesOutStorageSalesSlipGoodsListModel *goodsModel in goodsList){
- if([checkedGoodsModel.salesNo isEqualToString:goodsModel.salesNo]&&[checkedGoodsModel.detailId integerValue]==[goodsModel.detailId integerValue]&&checkedGoodsModel.checkedFlag==YES){
- isHasSame=YES;
- break;
- }
- }
-
- }
- return isHasSame;
- }
- /**
- 判断是否是同一个客户
- @param checkedSalesSlipList <#checkedSalesSlipList description#>
- @return <#return value description#>
- */
- -(Boolean) isSameCustomer:(NSMutableArray*)checkedSalesSlipList{
- Boolean isSameCustomer=YES;
- for(int i=0;i<checkedSalesSlipList.count;i++){
- SalesOutStorageSalesSlipModel *outerModel=[checkedSalesSlipList objectAtIndex:i];
- for(int j=i+1;j<checkedSalesSlipList.count;j++){
- SalesOutStorageSalesSlipModel *innerModel=[checkedSalesSlipList objectAtIndex:j];
- if([outerModel.customerId integerValue]!=[innerModel.customerId integerValue]){
- isSameCustomer=NO;
- break;
- }
- }
-
- }
- return isSameCustomer;
- }
- /**
- 判断是否是同一个客户
- @param checkedSalesSlipList <#checkedSalesSlipList description#>
- @param goodsList <#goodsList description#>
- @return <#return value description#>
- */
- -(Boolean) compareSameCustomer:(NSMutableArray*)checkedSalesSlipList goodsList:(NSMutableArray*)goodsList{
- Boolean isSameCustomer=YES;
- for(int i=0;i<checkedSalesSlipList.count;i++){
- SalesOutStorageSalesSlipModel *salesSlipModel=[checkedSalesSlipList objectAtIndex:i];
- for(int j=0;j<goodsList.count;j++){
- SalesOutStorageSalesSlipGoodsListModel *goodsModel=[goodsList objectAtIndex:j];
- if([salesSlipModel.customerId integerValue]!=[goodsModel.customerId integerValue]){
- isSameCustomer=NO;
- break;
- }
- }
-
- }
- return isSameCustomer;
- }
- /**
- 判断是否选中销售出库单
- @param salesSlipList <#salesSlipList description#>
- @return <#return value description#>
- */
- -(Boolean) isCheckedSalesSlip:(NSMutableArray*)salesSlipList{
- Boolean isChecked=NO;
-
- for(SalesOutStorageSalesSlipModel *salesSlipModel in _dataList){
- if(salesSlipModel.checkedFlag){
- isChecked=YES;
- break;
- }
- }
- return isChecked;
- }
- /**
- 判断是否有商品
- @param salesSlipList <#salesSlipList description#>
- @return <#return value description#>
- */
- -(Boolean) isHasGoods:(NSMutableArray*)salesSlipList{
- Boolean isHasGoods=YES;
-
- for(SalesOutStorageSalesSlipModel *salesSlipModel in salesSlipList){
- if(salesSlipModel.goodsDetailArray==nil){
- isHasGoods=NO;
- break;
- }
- }
- return isHasGoods;
- }
- /**
- 获取选中的销售单
- @param salesSlipList <#salesSlipList description#>
- @return <#return value description#>
- */
- -(NSMutableArray*) getSelectedSalesSlip:(NSMutableArray*)salesSlipList{
- NSMutableArray *checkedSalesSlip=[[NSMutableArray alloc]init];
- for(SalesOutStorageSalesSlipModel *salesSlipModel in _dataList){
- if(salesSlipModel.checkedFlag){
- [checkedSalesSlip addObject:salesSlipModel];
- }
- }
-
- return checkedSalesSlip;
- }
- /**
- 加载数据源
- */
- -(void)loadData{
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetSalesDataSearchIphone" 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:_salesNo== nil? @"" : _salesNo forKey:@"SalesNo"];
- [dict setObject:_customerName == nil? @"" : _customerName forKey:@"CustomerName"];
- [dict setObject:_customerCode == nil? @"" : _customerCode forKey:@"CustomerCode"];
- [dict setObject:_address == nil? @"" : _address forKey:@"Address"];
- [dict setObject:_startDate == nil? @"" : _startDate forKey:@"AccountDateFrom"];
- [dict setObject:_endDate == nil? @"" : _endDate forKey:@"AccountDateTo"];
- [dict setObject:_goodsCode == nil? @"" : _goodsCode forKey:@"Code"];
- [dict setObject:_invoiceStatus == nil? @"" : _invoiceStatus forKey:@"InvoiceStatus"];
- [dict setObject:@"20" forKey:@"PageSize"];
- [dict setObject:[NSString stringWithFormat:@"%d",pageNumber] forKey:@"PageNum"];
- [self startLoading];
- _downManager = [[ASIDownManager alloc] init];
- _downManager.delegate = self;
- _downManager.OnImageDown = @selector(onSalesSlipListFinish:);
- _downManager.OnImageFail = @selector(onSalesSlipListFail:);
- [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
- }
- /**
- 更新产品选中的状态
- @param checkedStatus <#checkedStatus description#>
- */
- -(void)updateCheckedStatus:(Boolean) checkedStatus{
- if(_salesSlipModel.goodsDetailArray!=nil&&_salesSlipModel.goodsDetailArray.count>0){
- for(int i=0;i<_salesSlipModel.goodsDetailArray.count;i++){
- SalesOutStorageSalesSlipGoodsListModel *goodsModel=[_salesSlipModel.goodsDetailArray objectAtIndex:i];
- goodsModel.checkedFlag=checkedStatus;
- }
- }
-
- }
- /**
- 加载产品明细数据源
- @param salesId <#salesId description#>
- */
- -(void)loadGoodsDetailData:(NSString*)salesId{
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetSalesDataSearchDetailIphone" 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:salesId== nil? @"" : salesId forKey:@"SalesID"];
-
- [self startLoading];
- _downManager = [[ASIDownManager alloc] init];
- _downManager.delegate = self;
- _downManager.OnImageDown = @selector(onSalesSlipGoodsDetailLoadFinish:);
- _downManager.OnImageFail = @selector(onSalesSlipGoodsDetailLoadFail:);
- [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
- }
- @end
|