Sfoglia il codice sorgente

修复ERP Mobile 工程的部分警告错误

Ray Zhang 6 anni fa
parent
commit
8b219e7567
20 ha cambiato i file con 594 aggiunte e 576 eliminazioni
  1. 2 1
      RedAnt ERP Mobile/common/AppDelegateBase.m
  2. 4 4
      RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m
  3. 3 2
      RedAnt ERP Mobile/common/Functions/MainViewController.m
  4. 1 1
      RedAnt ERP Mobile/common/Functions/cart/CartViewController.m
  5. 9 9
      RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.m
  6. 5 3
      RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m
  7. 2 1
      RedAnt ERP Mobile/common/Functions/contact/CustomerEditViewController.m
  8. 2 1
      RedAnt ERP Mobile/common/Functions/creditcard/CreditCardEditorViewController.m
  9. 6 4
      RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m
  10. 1 1
      RedAnt ERP Mobile/common/Functions/offline/SelectUploadOrderViewController.h
  11. 3 2
      RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m
  12. 2 1
      RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m
  13. 2 2
      RedAnt ERP Mobile/common/Functions/order/RAOrderPreviewController.m
  14. 2 2
      RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m
  15. 3 2
      RedAnt ERP Mobile/common/Functions/portfolio/TearSheetParamViewController.m
  16. 6 5
      RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m
  17. 135 134
      RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m
  18. 4 2
      RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m
  19. 125 124
      RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m
  20. 277 275
      RedAnt ERP Mobile/common/data_provider/RANetwork.m

+ 2 - 1
RedAnt ERP Mobile/common/AppDelegateBase.m

@@ -1063,9 +1063,10 @@ void UncaughtExceptionHandler(NSException *exception) {
     
     // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
     // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+#if defined(BUILD_NPD) || defined(BUILD_USAI)
     NSTimeInterval timing = [[NSDate date] timeIntervalSinceDate:self.forgroundDate];
     self.forgroundDate = nil;
-#if defined(BUILD_NPD) || defined(BUILD_USAI)
+
     [GoogleAnalyst trackTimingWithCategory:@"foreground" interval:timing name:@"user used time" label:nil];
 #endif
 }

+ 4 - 4
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m

@@ -2825,8 +2825,8 @@
     
     [self.content_data_download setObject:section forKey:[NSString stringWithFormat:@"section_%ld",(long)sender.tag]];
     self.content_data_control = [self translate_json:self.content_data_download changed:self.changed_data];
-    NSRange range = NSMakeRange(sender.tag, 1);
-    NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
+//    NSRange range = NSMakeRange(sender.tag, 1);
+//    NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
 //    [self.editorTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
     [self.editorTable reloadData];
     
@@ -3353,7 +3353,7 @@
                     }
                     else
                     {
-                        __weak typeof(self) weakself = self;
+//                        __weak typeof(self) weakself = self;
                         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                             
                             NSData*  downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url0]];
@@ -4644,7 +4644,7 @@
     
     DebugLog(@"tableView willSelectRowAtIndexPath");
     
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     NSString* control = [item_json valueForKey:@"control"];
     if([control isEqualToString:@"enum"])//||[control isEqualToString:@"ui"])
     {

+ 3 - 2
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -2180,9 +2180,10 @@
     {
         
         
-        UIApplication * app = [UIApplication sharedApplication];
+        
 //
 #ifndef RA_NOTIFICATION
+        UIApplication * app = [UIApplication sharedApplication];
         AppDelegate *appDelegate = (AppDelegate *)[app delegate];
         UIViewController* active_vc = appDelegate.active_controller;
         ScannerSettingViewController * gunVC =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ScannerSettingViewController"];
@@ -2216,7 +2217,7 @@
     else if([title isEqualToString:@"Offline Setting"])
     {
         
-        UIApplication * app = [UIApplication sharedApplication];
+//        UIApplication * app = [UIApplication sharedApplication];
 //        AppDelegate *appDelegate = (AppDelegate *)[app delegate];
         //UIViewController* active_vc = appDelegate.active_controller;
         OfflineSettingViewController * offlineVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"OfflineSettingViewController"];

+ 1 - 1
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -3333,7 +3333,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
                 NSDictionary* newitem = [return_json objectForKey:@"item_0"];
                 NSString* item_id = [newitem valueForKey:@"cart_item_id"];
                 //  bool isnew=false;
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                 //                [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
                 
                 if (self.back_order_flag) {

+ 9 - 9
RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.m

@@ -275,21 +275,21 @@
     
     self.editCount.text =[NSString stringWithFormat:@"%d",count];
 }
-- (void)awakeFromNib
-{
-    // Initialization code
-    
-    
-
-}
+//- (void)awakeFromNib
+//{
+//    // Initialization code
+//    
+//    
+//
+//}
 
 - (IBAction)masterBundleClick:(UIButton *)sender {
     
-    UIViewController* vc=[RAUtils getViewController :self.bundleButton];
+    
     
 
 #if defined(BUILD_HOMER) || defined(BUILD_GATIT)
-    
+    UIViewController* vc=[RAUtils getViewController :self.bundleButton];
     MasterModelViewController *masterModelVC = [MasterModelViewController buildMasterModelViewController];
     masterModelVC.content_data = self.master_items;
     UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:masterModelVC];

+ 5 - 3
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -929,11 +929,12 @@
                 //                    //successed.
                 
                 
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                
                 
                 #ifdef RA_NOTIFICATION
                     [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
                 #else
+                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                     [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
                 #endif
                 
@@ -2028,13 +2029,14 @@
         }
         else
         {
-            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+            
             dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                 
                 NSData*  downloadimg_data = nil;
                 
                 BOOL offline = NO;
 #ifdef OFFLINE_MODE
+                AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
                 offline = appDelegate.offline_mode;
 #endif
                 if (!offline) {
@@ -2483,7 +2485,7 @@
     
     CGRect frame =self.collectionview.frame;
     
-    CGSize size123 =self.collectionview.contentSize;
+//    CGSize size123 =self.collectionview.contentSize;
     
     UICollectionViewFlowLayout *flowLayout =(UICollectionViewFlowLayout*)[self.collectionview collectionViewLayout];
     if(flowLayout.scrollDirection== UICollectionViewScrollDirectionVertical)

+ 2 - 1
RedAnt ERP Mobile/common/Functions/contact/CustomerEditViewController.m

@@ -290,13 +290,14 @@
                 else
                     [weakself.navigationController popToRootViewControllerAnimated:false];
                 
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                
                 
                 
 #ifdef RA_NOTIFICATION
 
                 [ActiveViewController Notify:@"ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
 #else
+                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                 [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
 #endif
                 

+ 2 - 1
RedAnt ERP Mobile/common/Functions/creditcard/CreditCardEditorViewController.m

@@ -117,7 +117,8 @@
 //        
 //    }
 
-    NSMutableDictionary* upparams = [self check_cancommit:true];
+//    NSMutableDictionary* upparams =
+    [self check_cancommit:true];
     if(self.cancommit==false)
         return;
     

+ 6 - 4
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -1145,7 +1145,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
     }
         
     
-    NSDictionary* nsdic = self.detail_data;
+//    NSDictionary* nsdic = self.detail_data;
     NSDictionary* related_json = [self.detail_data objectForKey:@"related_model"];
     if(related_json==nil)
     {
@@ -1353,7 +1353,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
         cell.hmlg_stock_lb.hidden = YES;
         cell.hmlg_stock_count_lb.hidden = YES;
         cell.on_sale_lb.hidden = YES;
-        BOOL is_special_model = [[section_json objectForKey:@"is_special_model"] boolValue];
+        
         if (!appDelegate.user) { // 没有登录时隐藏add to portfolio,使add to cart与add to wishlist对齐
             
             cell.btnaddPortfolio.hidden = YES;
@@ -1361,6 +1361,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
 #if defined(BUILD_HOMER) || defined(BUILD_GATIT)
             //            cell.hmlg_stock_lb.hidden = NO;
             //            cell.hmlg_stock_count_lb.hidden = NO;
+            BOOL is_special_model = [[section_json objectForKey:@"is_special_model"] boolValue];
             id hmlg_stock = [section_json objectForKey:@"hmlg_avalability"];
             if (hmlg_stock == nil) {
                 hmlg_stock = @"";
@@ -1372,7 +1373,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
         } else {
             
 #if defined(BUILD_NPD) || defined(BUILD_USAI) || defined(BUILD_UWAVER)
-            NSString *qtyStr = [section_json valueForKey:@"Availability"];
+//            NSString *qtyStr = [section_json valueForKey:@"Availability"];
             
             __weak typeof(self) weakself = self;
             cell.notifyMeBlock = ^{
@@ -2164,12 +2165,13 @@ dispatch_async(dispatch_get_main_queue(), ^{
             headRect.origin.y = rect.origin.y+headRect.origin.y;
             [self startAnimationWithRect:headRect ImageView:imageView];
             
-            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+            
             
             
 #ifdef RA_NOTIFICATION
             [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
 #else
+            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
             [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
 #endif
         };

+ 1 - 1
RedAnt ERP Mobile/common/Functions/offline/SelectUploadOrderViewController.h

@@ -12,7 +12,7 @@
 
 @property (nonatomic , copy) void (^deleteBlock)(NSString* deleteOrderID);
 
-@property (nonatomic , copy) void (^clearBlock)();
+@property (nonatomic , copy) void (^clearBlock)(void);
 
 @property (nonatomic,copy) void (^mergeBlock)(NSDictionary *dic);// 合并成功
 

+ 3 - 2
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m

@@ -346,7 +346,7 @@
     
 }
 - (void)onDownloadOrderClick:(id)sender {
-    __weak typeof(self) weakself = self;
+//    __weak typeof(self) weakself = self;
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
     RAPDFViewController *ViewController = [[UIStoryboard storyboardWithName:@"wkweb" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
@@ -630,8 +630,9 @@
 -(void) upload_img :(UIImage*) img
 {
     
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
 #ifdef OFFLINE_MODE
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     if(appDelegate.offline_mode)
     {
         

+ 2 - 1
RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m

@@ -1863,7 +1863,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     
     if(indexPath.row==self.content_data.count)
         return UITableViewCellEditingStyleNone;
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
     bool offline_edit =[[self.content_data[indexPath.row] valueForKey:@"offline_edit"] boolValue];
     
 //    NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
@@ -1874,6 +1874,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     {
         BOOL condition = offline_edit;
 #ifdef OFFLINE_MODE
+        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         condition = condition || appDelegate.offline_mode==false;
 #else
         condition = YES;

+ 2 - 2
RedAnt ERP Mobile/common/Functions/order/RAOrderPreviewController.m

@@ -41,7 +41,7 @@
             
             NSString *err_msg = msg;
             UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Attention!!" message:err_msg preferredStyle:UIAlertControllerStyleAlert];
-            __weak typeof(self) weakself = self;
+//            __weak typeof(self) weakself = self;
             UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                 
                 [self.navigationController popToRootViewControllerAnimated:true];
@@ -2794,7 +2794,7 @@
                 
                 NSString* pdf_url = [editor_json valueForKey:@"pdf_url"];
                 NSString* email_content =[editor_json valueForKey:@"email_content"];
-                NSString* soid=[editor_json valueForKey:@"so#"];
+//                NSString* soid=[editor_json valueForKey:@"so#"];
                 {
                     NSMutableDictionary *value = [NSMutableDictionary dictionary];
                     if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.submit_order_logout)

+ 2 - 2
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m

@@ -492,7 +492,7 @@
         NSString* subject;
         //                    if (company.length==0) {
         
-        NSString* cur_time =[RAUtils current_date];
+//        NSString* cur_time =[RAUtils current_date];
         subject =name;//[NSString stringWithFormat:@"NPD Product List %@",cur_time];
         
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
@@ -1542,7 +1542,7 @@
     // 添加一个删除按钮
     
 //    self.indexPath=indexPath;
-    ModelItemCell * cell = [tableView cellForRowAtIndexPath:indexPath];
+//    ModelItemCell * cell = [tableView cellForRowAtIndexPath:indexPath];
     
     
     UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {

+ 3 - 2
RedAnt ERP Mobile/common/Functions/portfolio/TearSheetParamViewController.m

@@ -670,7 +670,7 @@
         else
         {
             saveName = name.text;
-            _savebtn.enabled =false;
+            self.savebtn.enabled =false;
             
             
             UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Processing"];
@@ -692,7 +692,7 @@
                     {
                         
                         
-                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                        
                         
                      //   [RAUtils alert_view:nil title:@"Portfolio saved. You can find it from View Portfolios" ] ;
                         NSString* url = [editor_json valueForKey:@"pdf_path"];
@@ -704,6 +704,7 @@
 #ifdef RA_NOTIFICATION
                             [ActiveViewController Notify:@"PortfolioViewController,PDFListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
 #else
+                            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                             [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:true];
                             [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
 

+ 6 - 5
RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m

@@ -344,9 +344,9 @@
 - (IBAction)onFilterClicked:(id)sender {
     
     
-    UIApplication * app = [UIApplication sharedApplication];
+//    UIApplication * app = [UIApplication sharedApplication];
     
-    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     
     
 //    if(appDelegate.offline_mode)
@@ -1340,7 +1340,7 @@
         
         NSDictionary* return_json = nil;
         if (self.addAll) {
-            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
             return_json = [RANetwork ItemSearch_addall:self.offset limit:20 covertype:self.covertype ctgid:self.ctgid modelname:self.modelname modeldescrip:self.modeldescrip alert:self.alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller orderCode:nil addTo:@"portfolio"];
         } else {
             return_json = [RANetwork add_toPortfolio:ids withScreen:ScreenCodeParticularCategory];
@@ -1355,13 +1355,14 @@
             
             if([[return_json valueForKey:@"result"] intValue]==2)
             {
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                
                 
                 
                 
 #ifdef RA_NOTIFICATION
                 [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
 #else
+                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                 [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
 #endif
                 
@@ -1439,7 +1440,7 @@
         
         NSDictionary* return_json = nil;
         if (self.addAll) {
-            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
             return_json = [RANetwork ItemSearch_addall:self.offset limit:20 covertype:self.covertype ctgid:self.ctgid modelname:self.modelname modeldescrip:self.modeldescrip alert:self.alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller orderCode:nil addTo:@"wishlist"];
         } else {
             return_json = [RANetwork add_toWatchList:ids withScreen:ScreenCodeParticularCategory];

+ 135 - 134
RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m

@@ -534,138 +534,138 @@
 - (IBAction)onAddCartClick:(id)sender {
     [CartUtils add_to_cart:self selectorholder:self selector:@selector(addtocart)];
     return;
-    
-    UIApplication * app = [UIApplication sharedApplication];
-    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-    if(appDelegate.bLogin==false)
-    {
-        
-        LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
-        //        loginvc.delegate = self;
-        //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
-        
-        loginvc.returnValue = ^(bool blogin){
-            
-            
-            //            UIApplication * app = [UIApplication sharedApplication];
-            //            AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-            
-            
-            
-            
-            if(blogin)
-            {
-                if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE*/ true)
-                {
-                    
-                    [main_vc checklogin:false];
-                    if(appDelegate.can_create_order)
-                    {
-                        NSString* msg =@"";
-                        if(appDelegate.contact_id.length>0)
-                        {
-                            msg = [msg stringByAppendingString:@"\n\nCustomer:"];
-                            msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-                            
-                        }
-                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
-                    
-                    
-                    
-                    // alert.
-                    [alert show];
-                    }
-                    else
-                    {
-                        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil), nil];
-                        
-                        // alert.
-                        [alert show];
-                    }
-                }
-                else
-                {
-                    [main_vc checklogin:false];
-                    [self addtocart];
-                }
-            }
-            
-            //            self.offset = 0;
-            //            [self.content_data removeAllObjects];
-            //            [self loadpage];
-            //
-            //            [[self navigationController] setNavigationBarHidden:YES animated:NO];
-            
-        };
-        
-        UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
-        
-        
-        
-        
-        
-        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
-        
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-        [self presentViewController:navi animated:YES completion:^{
-            
-            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
-            
-            DebugLog(@"LoginViewController present.........");
-            
-            //   self.btop = false;
-            //  <#code#>
-        }];
-    }
-    else
-    {
-//        if(appDelegate.user_type==USER_ROLE_EMPLOYEE&&/*appDelegate.contact_id==nil&&appDelegate.order_code==nil)
-        if(appDelegate.order_code==nil)
-        {
-         //   [main_vc checklogin:false];
-            if(appDelegate.can_create_order)
-            {
-                NSString* msg =@"";
-                if(appDelegate.contact_id.length>0)
-                {
-                    msg = [msg stringByAppendingString:@"\n\nCustomer:"];
-                    msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-                    
-                }
-            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
-            
-            // alert.
-            [alert show];
-            }
-            else
-            {
-                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil), nil];
-                
-                // alert.
-                [alert show];
-            }
-        }
-        else
-        {
-            
-            if(appDelegate.order_code==nil)
-                [ self neworder];
-            else
-                [self addtocart];
-            
-            
-            
-        }
-    }
-    
-    
-    
-    
+//    {
+//    UIApplication * app = [UIApplication sharedApplication];
+//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+//    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
+//    if(appDelegate.bLogin==false)
+//    {
+//
+//        LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
+//        //        loginvc.delegate = self;
+//        //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
+//
+//        loginvc.returnValue = ^(bool blogin){
+//
+//
+//            //            UIApplication * app = [UIApplication sharedApplication];
+//            //            AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+//
+//
+//
+//
+//            if(blogin)
+//            {
+//                if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE*/ true)
+//                {
+//
+//                    [main_vc checklogin:false];
+//                    if(appDelegate.can_create_order)
+//                    {
+//                        NSString* msg =@"";
+//                        if(appDelegate.contact_id.length>0)
+//                        {
+//                            msg = [msg stringByAppendingString:@"\n\nCustomer:"];
+//                            msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+//
+//                        }
+//                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
+//
+//
+//
+//                    // alert.
+//                    [alert show];
+//                    }
+//                    else
+//                    {
+//                        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil), nil];
+//
+//                        // alert.
+//                        [alert show];
+//                    }
+//                }
+////                else
+////                {
+////                    [main_vc checklogin:false];
+////                    [self addtocart];
+////                }
+//            }
+//
+//            //            self.offset = 0;
+//            //            [self.content_data removeAllObjects];
+//            //            [self loadpage];
+//            //
+//            //            [[self navigationController] setNavigationBarHidden:YES animated:NO];
+//
+//        };
+//
+//        UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
+//
+//
+//
+//
+//
+//        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
+//
+//        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//        [self presentViewController:navi animated:YES completion:^{
+//
+//            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
+//
+//            DebugLog(@"LoginViewController present.........");
+//
+//            //   self.btop = false;
+//            //  <#code#>
+//        }];
+//    }
+//    else
+//    {
+////        if(appDelegate.user_type==USER_ROLE_EMPLOYEE&&/*appDelegate.contact_id==nil&&appDelegate.order_code==nil)
+//        if(appDelegate.order_code==nil)
+//        {
+//         //   [main_vc checklogin:false];
+//            if(appDelegate.can_create_order)
+//            {
+//                NSString* msg =@"";
+//                if(appDelegate.contact_id.length>0)
+//                {
+//                    msg = [msg stringByAppendingString:@"\n\nCustomer:"];
+//                    msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+//
+//                }
+//            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
+//
+//            // alert.
+//            [alert show];
+//            }
+//            else
+//            {
+//                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil), nil];
+//
+//                // alert.
+//                [alert show];
+//            }
+//        }
+//        else
+//        {
+//
+//            if(appDelegate.order_code==nil)
+//                [ self neworder];
+//            else
+//                [self addtocart];
+//
+//
+//
+//        }
+//    }
+//
+//
+//
+//
+//}
 }
 
 
-
 -(void) neworder
 {
     
@@ -1049,7 +1049,7 @@
         
         NSDictionary* return_json = nil;
         if (self.addAll) {
-            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
             return_json = [RANetwork Search_addall:self.offset limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull orderCode:nil addTo:@"portfolio"];
         } else {
             return_json = [RANetwork add_toPortfolio:ids withScreen:ScreenCodeSearch];
@@ -1065,13 +1065,14 @@
             {
 
                     
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                
 
                 
                 
 #ifdef RA_NOTIFICATION
                 [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
 #else
+                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                 [((MainViewController*)appDelegate.main_vc) reloadPortfolio :true immediately:false];
 #endif
                 
@@ -1155,7 +1156,7 @@
         
         NSDictionary* return_json = nil;
         if (self.addAll) {
-            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
             return_json = [RANetwork Search_addall:self.offset limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull orderCode:nil addTo:@"wishlist"];
         } else {
             return_json = [RANetwork add_toWatchList:ids withScreen:ScreenCodeSearch];
@@ -1585,8 +1586,8 @@
 */
 - (IBAction)onMatchFullChanged:(id)sender {
     
-    NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-    int count =[[item_json valueForKey:@"count"] intValue];
+//    NSDictionary * item_json = [self.category_data objectForKey:@"items"];
+//    int count =[[item_json valueForKey:@"count"] intValue];
     
 //    if(count!=0)
 //    {

+ 4 - 2
RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m

@@ -142,8 +142,9 @@
                     [defaults setBool:self.checkOfflineMode.selected forKey:@"EnableOfflineMode"];
                     
                     [defaults synchronize];
-                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                    
 #ifdef OFFLINE_MODE
+                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                     appDelegate.offline_mode = self.checkOfflineMode.selected;
 #endif
                 }
@@ -163,8 +164,9 @@
             [defaults setBool:self.checkOfflineMode.selected forKey:@"EnableOfflineMode"];
             
             [defaults synchronize];
-            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+            
 #ifdef OFFLINE_MODE
+            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
             appDelegate.offline_mode = self.checkOfflineMode.selected;
 #endif
         }

+ 125 - 124
RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m

@@ -80,129 +80,129 @@
 - (IBAction)onAddtoCart:(id)sender {
     [CartUtils add_to_cart:self selectorholder:self selector:@selector(addtocart)];
     return;
-    
-    UIApplication * app = [UIApplication sharedApplication];
-    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-    if(appDelegate.bLogin==false)
-    {
-        
-        LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
-        //        loginvc.delegate = self;
-        //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
-        
-        loginvc.returnValue = ^(bool blogin){
-            
-            
-            //            UIApplication * app = [UIApplication sharedApplication];
-            //            AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-            
-            
-            
-            
-            if(blogin)
-            {
-                if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE*/ true)
-                {
-                    
-                    [main_vc checklogin:false];
-                    if(appDelegate.can_create_order)
-                    {                NSString* msg =@"";
-                        if(appDelegate.contact_id.length>0)
-                        {
-                            msg = [msg stringByAppendingString:@"\n\nCustomer:"];
-                            msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-                            
-                        }
-                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
-                    
-                    
-                    
-                    // alert.
-                    [alert show];
-                    }
-                    else
-                    {
-                        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil), nil];
-                        
-                        // alert.
-                        [alert show];
-                    }
-                }
-                else
-                {
-                    [main_vc checklogin:true];
-                }
-            }
-            
-            //            self.offset = 0;
-            //            [self.content_data removeAllObjects];
-            //            [self loadpage];
-            //
-            //            [[self navigationController] setNavigationBarHidden:YES animated:NO];
-            
-        };
-        
-        UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
-        
-        
-        
-        
-        
-        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
-        
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-        [self presentViewController:navi animated:YES completion:^{
-            
-            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
-            
-            DebugLog(@"LoginViewController present.........");
-            
-            //   self.btop = false;
-            //  <#code#>
-        }];
-    }
-    else
-    {
-        //if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE&&/*appDelegate.contact_id==nil&&*/appDelegate.order_code==nil)
-        if(appDelegate.order_code==nil)
-        {
-            [main_vc checklogin:false];
-            if(appDelegate.can_create_order)
-            {
-                NSString* msg =@"";
-                if(appDelegate.contact_id.length>0)
-                {
-                    msg = [msg stringByAppendingString:@"\n\nCustomer:"];
-                    msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-                    
-                }
-            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
-            
-            // alert.
-            [alert show];
-            }
-            else
-            {
-                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil), nil];
-                
-                // alert.
-                [alert show];
-            }
-        }
-        else
-        {
-            
-            if(appDelegate.order_code==nil)
-                [ self neworder];
-            else
-                [self addtocart];
-            
-            
-            
-        }
-    }
-
+//
+//    UIApplication * app = [UIApplication sharedApplication];
+//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+//    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
+//    if(appDelegate.bLogin==false)
+//    {
+//
+//        LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
+//        //        loginvc.delegate = self;
+//        //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
+//
+//        loginvc.returnValue = ^(bool blogin){
+//
+//
+//            //            UIApplication * app = [UIApplication sharedApplication];
+//            //            AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+//
+//
+//
+//
+//            if(blogin)
+//            {
+//                if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE*/ true)
+//                {
+//
+//                    [main_vc checklogin:false];
+//                    if(appDelegate.can_create_order)
+//                    {                NSString* msg =@"";
+//                        if(appDelegate.contact_id.length>0)
+//                        {
+//                            msg = [msg stringByAppendingString:@"\n\nCustomer:"];
+//                            msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+//
+//                        }
+//                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
+//
+//
+//
+//                    // alert.
+//                    [alert show];
+//                    }
+//                    else
+//                    {
+//                        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil), nil];
+//
+//                        // alert.
+//                        [alert show];
+//                    }
+//                }
+////                else
+////                {
+////                    [main_vc checklogin:true];
+////                }
+//            }
+//
+//            //            self.offset = 0;
+//            //            [self.content_data removeAllObjects];
+//            //            [self loadpage];
+//            //
+//            //            [[self navigationController] setNavigationBarHidden:YES animated:NO];
+//
+//        };
+//
+//        UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
+//
+//
+//
+//
+//
+//        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
+//
+//        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//        [self presentViewController:navi animated:YES completion:^{
+//
+//            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
+//
+//            DebugLog(@"LoginViewController present.........");
+//
+//            //   self.btop = false;
+//            //  <#code#>
+//        }];
+//    }
+//    else
+//    {
+//        //if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE&&/*appDelegate.contact_id==nil&&*/appDelegate.order_code==nil)
+//        if(appDelegate.order_code==nil)
+//        {
+//            [main_vc checklogin:false];
+//            if(appDelegate.can_create_order)
+//            {
+//                NSString* msg =@"";
+//                if(appDelegate.contact_id.length>0)
+//                {
+//                    msg = [msg stringByAppendingString:@"\n\nCustomer:"];
+//                    msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+//
+//                }
+//            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
+//
+//            // alert.
+//            [alert show];
+//            }
+//            else
+//            {
+//                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil), nil];
+//
+//                // alert.
+//                [alert show];
+//            }
+//        }
+//        else
+//        {
+//
+//            if(appDelegate.order_code==nil)
+//                [ self neworder];
+//            else
+//                [self addtocart];
+//
+//
+//
+//        }
+//    }
+//
 }
 -(void) addtocart
 {
@@ -580,8 +580,9 @@
 
     [[self navigationController] setNavigationBarHidden:YES animated:NO];
     
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    
 #ifdef OFFLINE_MODE
+    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     // 离线隐藏Email
     self.emailBtn.enabled = !appDelegate.offline_mode;
     // 离线隐藏Print

+ 277 - 275
RedAnt ERP Mobile/common/data_provider/RANetwork.m

@@ -111,11 +111,13 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
     NSString* short_version =[infoDict objectForKey:@"CFBundleShortVersionString"];
     [params setValue:short_version forKey:@"app_short_ver"];
     
-    UIDevice * dev = [UIDevice currentDevice];
-    NSUUID* uuid =dev.identifierForVendor;
+    
+    
 #if TARGET_IPHONE_SIMULATOR//模拟器
     [params setValue:@"simulator_uuid" forKey:@"idfv"];
 #elif TARGET_OS_IPHONE//真机
+    UIDevice * dev = [UIDevice currentDevice];
+    NSUUID* uuid =dev.identifierForVendor;
     [params setValue:uuid.UUIDString forKey:@"idfv"];
 #endif
     
@@ -295,280 +297,280 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
     [ERPUtils googleAnalyticsSendRequestString:url WithScreen:screenName Action:userAction Extra:extra];
 #endif
     return [self get_json:url parameters:params file:nil];
-    
-    int retry = 0;
-    
-    __block AppDelegate *appDelegate = nil;
-    
-    dispatch_sync(dispatch_get_main_queue(), ^{
-        //some UI methods ej
-        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
-    });
-    if(appDelegate.user!=nil)
-        [params setValue:appDelegate.user forKey:@"user"];
-    if(appDelegate.password!=nil)
-        [params setValue:appDelegate.password forKey:@"password"];
-    
-    
-    if(appDelegate.ipad_perm!=nil)
-        [params setValue:appDelegate.ipad_perm forKey:@"ipad_perm"];
-    
-    [params setValue:appDelegate.build forKey:@"app_ver"];
-    
-    NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
-    NSString* short_version =[infoDict objectForKey:@"CFBundleShortVersionString"];
-    [params setValue:short_version forKey:@"app_short_ver"];
-    
-    UIDevice * dev = [UIDevice currentDevice];
-    NSUUID* uuid =dev.identifierForVendor;
-#if TARGET_IPHONE_SIMULATOR//模拟器
-    [params setValue:@"simulator_uuid" forKey:@"idfv"];
-#elif TARGET_OS_IPHONE//真机
-    [params setValue:uuid.UUIDString forKey:@"idfv"];
-#endif
-    
-//    NSString *screenName = [params valueForKey:kScreenName];
-//    NSString *userAction = [params valueForKey:kAction];
-//    NSMutableDictionary *extra = [[params valueForKey:kExtra] mutableCopy];
-//    if ([userAction isEqualToString:@"Login"]) {
-//        if (!extra) {
-//            extra = [NSMutableDictionary dictionary];
+//    {
+//    int retry = 0;
+//
+//    __block AppDelegate *appDelegate = nil;
+//
+//    dispatch_sync(dispatch_get_main_queue(), ^{
+//        //some UI methods ej
+//        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    });
+//    if(appDelegate.user!=nil)
+//        [params setValue:appDelegate.user forKey:@"user"];
+//    if(appDelegate.password!=nil)
+//        [params setValue:appDelegate.password forKey:@"password"];
+//
+//
+//    if(appDelegate.ipad_perm!=nil)
+//        [params setValue:appDelegate.ipad_perm forKey:@"ipad_perm"];
+//
+//    [params setValue:appDelegate.build forKey:@"app_ver"];
+//
+//    NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
+//    NSString* short_version =[infoDict objectForKey:@"CFBundleShortVersionString"];
+//    [params setValue:short_version forKey:@"app_short_ver"];
+//
+//    UIDevice * dev = [UIDevice currentDevice];
+//    NSUUID* uuid =dev.identifierForVendor;
+//#if TARGET_IPHONE_SIMULATOR//模拟器
+//    [params setValue:@"simulator_uuid" forKey:@"idfv"];
+//#elif TARGET_OS_IPHONE//真机
+//    [params setValue:uuid.UUIDString forKey:@"idfv"];
+//#endif
+//
+////    NSString *screenName = [params valueForKey:kScreenName];
+////    NSString *userAction = [params valueForKey:kAction];
+////    NSMutableDictionary *extra = [[params valueForKey:kExtra] mutableCopy];
+////    if ([userAction isEqualToString:@"Login"]) {
+////        if (!extra) {
+////            extra = [NSMutableDictionary dictionary];
+////        }
+////        [extra setObject:[params objectForKey:@"user"] forKey:@"user"];
+////    }
+//
+//repeat:
+//    {
+//
+//        //    return [self fake_json:url];
+//
+//        //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//        //分界线的标识符
+//        NSString *TWITTERFON_FORM_BOUNDARY = @"AaB03x";
+//        //根据url初始化request
+//        NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]
+//                                                               cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
+//                                                           timeoutInterval:JSON_TIMEOUT];
+//        //分界线 --AaB03x
+//        NSString *MPboundary=[[NSString alloc]initWithFormat:@"--%@",TWITTERFON_FORM_BOUNDARY];
+//        //结束符 AaB03x--
+//        NSString *endMPboundary=[[NSString alloc]initWithFormat:@"%@--",MPboundary];
+//        //要上传的图片
+//        //    UIImage *image=[params objectForKey:@"pic"];
+//        //得到图片的data
+//        //    NSData* data = UIImagePNGRepresentation(image);
+//        //http body的字符串
+//        NSMutableString *body=[[NSMutableString alloc]init];
+//
+//        //    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+//        //     [params setValue:@"handset_login" forKey:@"action"];
+//        //    [headers setValue:[NSString stringWithFormat:@"%d",dataLength] forKey:@"Content-Length"];
+//
+//        //    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
+//        //   [params setValue:password forKey:@"password"];
+//        //    [params setValue:[NSString stringWithFormat:@"%d",ver]  forKey:@"auth_ver"];
+//
+//
+//
+//        //    [headers setValue:headQuerlString forKey:@"param"];
+//
+//        //参数的集合的所有key的集合
+//        NSArray *keys= [params allKeys];
+//        DebugLog(@"================parms==================");
+//        //遍历keys
+//        for(int i=0;i<[keys count];i++)
+//        {
+//            //得到当前key
+//            NSString *key=[keys objectAtIndex:i];
+//            //如果key不是pic,说明value是字符类型,比如name:Boris
+//            if(![key isEqualToString:@"pic"])
+//            {
+//                //添加分界线,换行
+//                [body appendFormat:@"%@\r\n",MPboundary];
+//                //添加字段名称,换2行
+//                [body appendFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n",key];
+//                //添加字段的值
+//                [body appendFormat:@"%@\r\n",[params objectForKey:key]];
+//                DebugLog(@"parameter: key=%@   value=%@",key,[params objectForKey:key]);
+//            }
 //        }
-//        [extra setObject:[params objectForKey:@"user"] forKey:@"user"];
+//        DebugLog(@"================parms==================");
+//        ////添加分界线,换行
+//        [body appendFormat:@"%@\r\n",MPboundary];
+//        //声明pic字段,文件名为boris.png
+//        [body appendFormat:@"Content-Disposition: form-data; name=\"pic\"; filename=\"boris.png\"\r\n"];
+//        //声明上传文件的格式
+//        [body appendFormat:@"Content-Type: image/png\r\n\r\n"];
+//
+//        //声明结束符:--AaB03x--
+//        NSString *end=[[NSString alloc]initWithFormat:@"\r\n%@",endMPboundary];
+//        //声明myRequestData,用来放入http body
+//        NSMutableData *myRequestData=[NSMutableData data];
+//        //将body字符串转化为UTF8格式的二进制
+//        [myRequestData appendData:[body dataUsingEncoding:NSUTF8StringEncoding]];
+//        //将image的data加入
+//        //    [myRequestData appendData:data];
+//        //加入结束符--AaB03x--
+//        [myRequestData appendData:[end dataUsingEncoding:NSUTF8StringEncoding]];
+//
+//        //设置HTTPHeader中Content-Type的值
+//        NSString *content=[[NSString alloc]initWithFormat:@"multipart/form-data; boundary=%@",TWITTERFON_FORM_BOUNDARY];
+//        //设置HTTPHeader
+//        [request setValue:content forHTTPHeaderField:@"Content-Type"];
+//
+//        // 关闭keep alive
+//        [request setValue:@"close" forHTTPHeaderField:@"Connection"];
+//        //设置Content-Length
+//        [request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[myRequestData length]] forHTTPHeaderField:@"Content-Length"];
+//        //设置http body
+//        [request setHTTPBody:myRequestData];
+//        //http method
+//        [request setHTTPMethod:@"POST"];
+//
+//
+//        NSHTTPURLResponse* urlResponse = nil;
+//
+//        NSError *error = nil;
+//
+//        NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
+//
+//
+//        DebugLog(@"url: %@",url);
+//
+//        DebugLog(@"response: %@",[NSHTTPURLResponse localizedStringForStatusCode:urlResponse.statusCode]);
+//
+//        if (responseData==nil) {
+//
+////            DebugLog(@"response error:%@", [error localizedDescription]);
+//
+//
+//            NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
+//            //#define RESULT_FALSE 0
+//            //#define RESULT_TRUE		 2
+//            //#define RESULT_NET_ERROR			 -3
+//            //#define RESULT_NET_NOTAVAILABLE		  -4
+//            //#define RESULT_ERROR				 -5
+//            //#define RESULT_LOCALFILE_ERROR			 -7
+//            //#define RESULT_USERAUTH_ERROR			 -9
+//            //#define RESULT_UPDATE_USERAUTH_ERROR	 -11
+//            //#define RESULT_SESSION_EXPIRED			  -13
+//            //#define RESULT_VER_LOW
+//
+//            //     NSString * moreinfo = error.description ;
+//
+//            NSString* err_msg = [error localizedDescription];
+//
+//
+//            //-----------------retry 3 times for error code -1005------------------------
+//            if(error.code==-1005&&retry<3)
+//            {
+//                retry++;
+//                goto repeat;
+//
+//            }
+//            //-----------------end retry 3 times for error code -1005------------------------
+//
+//            NSDictionary* error_json = [RAUtils error_dict:error];
+//            [ret setObject:error_json forKey:@"err_obj"];
+//            NSString* resp_msg= nil;
+//
+//            if(err_msg.length==0)
+//            {
+//                err_msg =[NSHTTPURLResponse localizedStringForStatusCode:urlResponse.statusCode];
+//                resp_msg = err_msg;
+//            }
+//            [ret setValue:[NSString stringWithFormat:@"%d",RESULT_NET_ERROR] forKey:@"result"];
+//            [ret setValue:err_msg forKey:@"err_msg"];
+//            [ret setValue:resp_msg forKey:@"resp_msg"];
+//            [ret setValue:[NSString stringWithFormat:@"%ld",(long)urlResponse.statusCode] forKey:@"resp_code"];
+//
+//
+//            NSData *jsonData = [NSJSONSerialization dataWithJSONObject:ret
+//                                                               options:0
+//                                                                 error:nil];
+//            if(![url isEqualToString:URL_ERR_LOG])
+//            {
+//                [RANetwork err_log:[RAUtils base64en:[RAConvertor dict2string:params]] result:[RAUtils base64en:[RAConvertor dict2string:ret]] module:url code:RESULT_NET_ERROR];
+//            }
+//#if defined(BUILD_NPD)// || defined(BUILD_USAI) || defined(BUILD_UWAVER)
+//            [ERPUtils googleAnalyticsSendRequestString:url WithScreen:screenName Action:userAction Extra:extra];
+//#endif
+//            return jsonData;
+//
+//        }
+//        else
+//        {
+//                        NSString* err_msg = [error localizedDescription];
+//            NSMutableString *str = [[NSMutableString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
+//
+//            DebugLog(@"data string: %@",str);
+//            NSError *error1 = nil;
+//
+//            NSMutableDictionary* jsobj = [[NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error1] mutableCopy];
+//
+//            if(jsobj==nil)// 服务器返回不是json
+//            {
+//
+//                jsobj=[[NSMutableDictionary alloc] init];
+//                [jsobj setValue:@"1" forKey:@"result"];
+//
+//            }
+//
+//            int result=[[jsobj valueForKey:@"result"] intValue];
+//            UIApplication * app = [UIApplication sharedApplication];
+//            AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+//            NSString* mode =[jsobj valueForKey:@"mode"];
+//            [appDelegate SetMode:mode];
+//            switch (result) {
+//                case 0:
+//                    [jsobj setValue:MSG_USERAUTH_ERROR forKey:@"err_msg"];
+//                    break;
+//                case 1:
+//                    [jsobj setValue:MSG_ERROR forKey:@"err_msg"];
+//                    break;
+//                case 2:
+//                    [jsobj setValue:MSG_SUCCESS forKey:@"err_msg"];
+//                    break;
+//                case 8:
+//                    [jsobj setValue:[jsobj valueForKey:@"msg"] forKey:@"err_msg"];
+//                    break;
+//                case 9:
+//                    [jsobj setValue:[jsobj valueForKey:@"msg"] forKey:@"err_msg"];
+//                    break;
+//                case 99:
+//                    [jsobj setValue:MSG_TIMEOUT forKey:@"err_msg"];
+//                    break;
+//                default:
+//                    [jsobj setValue:MSG_ERROR forKey:@"err_msg"];
+//                    break;
+//            }
+//
+//
+//            if([appDelegate.build intValue]< [[jsobj valueForKey:@"min_ver"]intValue])
+//            {
+//                [jsobj setValue:@"9" forKey:@"result"];
+//                [jsobj setValue:MSG_VER_LOW forKey:@"err_msg"];
+//            }
+//
+//            if(![url isEqualToString:URL_ERR_LOG]&&![url isEqualToString:URL_DOWNLOAD_OFFLINE]/*&&result!=-3*/&&result!=2&&result!=99)
+//            {
+//                [RANetwork err_log:[RAUtils base64en:[RAConvertor dict2string:params]] result:[RAUtils base64en:str] module:url code:result];
+//            }
+//            NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsobj
+//                                                               options:0
+//                                                                 error:nil];
+//#if defined(BUILD_NPD) || defined(BUILD_USAI) || defined(BUILD_UWAVER)
+//            [ERPUtils googleAnalyticsSendRequestString:url WithScreen:screenName Action:userAction Extra:extra];
+//#endif
+//            return jsonData;
+//
+//        }
+//
+//        return responseData;
 //    }
-    
-repeat:
-    {
-        
-        //    return [self fake_json:url];
-        
-        //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-        //分界线的标识符
-        NSString *TWITTERFON_FORM_BOUNDARY = @"AaB03x";
-        //根据url初始化request
-        NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]
-                                                               cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
-                                                           timeoutInterval:JSON_TIMEOUT];
-        //分界线 --AaB03x
-        NSString *MPboundary=[[NSString alloc]initWithFormat:@"--%@",TWITTERFON_FORM_BOUNDARY];
-        //结束符 AaB03x--
-        NSString *endMPboundary=[[NSString alloc]initWithFormat:@"%@--",MPboundary];
-        //要上传的图片
-        //    UIImage *image=[params objectForKey:@"pic"];
-        //得到图片的data
-        //    NSData* data = UIImagePNGRepresentation(image);
-        //http body的字符串
-        NSMutableString *body=[[NSMutableString alloc]init];
-        
-        //    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
-        //     [params setValue:@"handset_login" forKey:@"action"];
-        //    [headers setValue:[NSString stringWithFormat:@"%d",dataLength] forKey:@"Content-Length"];
-        
-        //    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
-        //   [params setValue:password forKey:@"password"];
-        //    [params setValue:[NSString stringWithFormat:@"%d",ver]  forKey:@"auth_ver"];
-        
-        
-        
-        //    [headers setValue:headQuerlString forKey:@"param"];
-        
-        //参数的集合的所有key的集合
-        NSArray *keys= [params allKeys];
-        DebugLog(@"================parms==================");
-        //遍历keys
-        for(int i=0;i<[keys count];i++)
-        {
-            //得到当前key
-            NSString *key=[keys objectAtIndex:i];
-            //如果key不是pic,说明value是字符类型,比如name:Boris
-            if(![key isEqualToString:@"pic"])
-            {
-                //添加分界线,换行
-                [body appendFormat:@"%@\r\n",MPboundary];
-                //添加字段名称,换2行
-                [body appendFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n",key];
-                //添加字段的值
-                [body appendFormat:@"%@\r\n",[params objectForKey:key]];
-                DebugLog(@"parameter: key=%@   value=%@",key,[params objectForKey:key]);
-            }
-        }
-        DebugLog(@"================parms==================");
-        ////添加分界线,换行
-        [body appendFormat:@"%@\r\n",MPboundary];
-        //声明pic字段,文件名为boris.png
-        [body appendFormat:@"Content-Disposition: form-data; name=\"pic\"; filename=\"boris.png\"\r\n"];
-        //声明上传文件的格式
-        [body appendFormat:@"Content-Type: image/png\r\n\r\n"];
-        
-        //声明结束符:--AaB03x--
-        NSString *end=[[NSString alloc]initWithFormat:@"\r\n%@",endMPboundary];
-        //声明myRequestData,用来放入http body
-        NSMutableData *myRequestData=[NSMutableData data];
-        //将body字符串转化为UTF8格式的二进制
-        [myRequestData appendData:[body dataUsingEncoding:NSUTF8StringEncoding]];
-        //将image的data加入
-        //    [myRequestData appendData:data];
-        //加入结束符--AaB03x--
-        [myRequestData appendData:[end dataUsingEncoding:NSUTF8StringEncoding]];
-        
-        //设置HTTPHeader中Content-Type的值
-        NSString *content=[[NSString alloc]initWithFormat:@"multipart/form-data; boundary=%@",TWITTERFON_FORM_BOUNDARY];
-        //设置HTTPHeader
-        [request setValue:content forHTTPHeaderField:@"Content-Type"];
-        
-        // 关闭keep alive
-        [request setValue:@"close" forHTTPHeaderField:@"Connection"];
-        //设置Content-Length
-        [request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[myRequestData length]] forHTTPHeaderField:@"Content-Length"];
-        //设置http body
-        [request setHTTPBody:myRequestData];
-        //http method
-        [request setHTTPMethod:@"POST"];
-        
-        
-        NSHTTPURLResponse* urlResponse = nil;
-        
-        NSError *error = nil;
-        
-        NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
-        
-        
-        DebugLog(@"url: %@",url);
-
-        DebugLog(@"response: %@",[NSHTTPURLResponse localizedStringForStatusCode:urlResponse.statusCode]);
-        
-        if (responseData==nil) {
-            
-//            DebugLog(@"response error:%@", [error localizedDescription]);
-            
-            
-            NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
-            //#define RESULT_FALSE 0
-            //#define RESULT_TRUE		 2
-            //#define RESULT_NET_ERROR			 -3
-            //#define RESULT_NET_NOTAVAILABLE		  -4
-            //#define RESULT_ERROR				 -5
-            //#define RESULT_LOCALFILE_ERROR			 -7
-            //#define RESULT_USERAUTH_ERROR			 -9
-            //#define RESULT_UPDATE_USERAUTH_ERROR	 -11
-            //#define RESULT_SESSION_EXPIRED			  -13
-            //#define RESULT_VER_LOW
-            
-            //     NSString * moreinfo = error.description ;
-            
-            NSString* err_msg = [error localizedDescription];
-            
-            
-            //-----------------retry 3 times for error code -1005------------------------
-            if(error.code==-1005&&retry<3)
-            {
-                retry++;
-                goto repeat;
-                
-            }
-            //-----------------end retry 3 times for error code -1005------------------------
-            
-            NSDictionary* error_json = [RAUtils error_dict:error];
-            [ret setObject:error_json forKey:@"err_obj"];
-            NSString* resp_msg= nil;
-            
-            if(err_msg.length==0)
-            {
-                err_msg =[NSHTTPURLResponse localizedStringForStatusCode:urlResponse.statusCode];
-                resp_msg = err_msg;
-            }
-            [ret setValue:[NSString stringWithFormat:@"%d",RESULT_NET_ERROR] forKey:@"result"];
-            [ret setValue:err_msg forKey:@"err_msg"];
-            [ret setValue:resp_msg forKey:@"resp_msg"];
-            [ret setValue:[NSString stringWithFormat:@"%ld",(long)urlResponse.statusCode] forKey:@"resp_code"];
-            
-            
-            NSData *jsonData = [NSJSONSerialization dataWithJSONObject:ret
-                                                               options:0
-                                                                 error:nil];
-            if(![url isEqualToString:URL_ERR_LOG])
-            {
-                [RANetwork err_log:[RAUtils base64en:[RAConvertor dict2string:params]] result:[RAUtils base64en:[RAConvertor dict2string:ret]] module:url code:RESULT_NET_ERROR];
-            }
-#if defined(BUILD_NPD)// || defined(BUILD_USAI) || defined(BUILD_UWAVER)
-            [ERPUtils googleAnalyticsSendRequestString:url WithScreen:screenName Action:userAction Extra:extra];
-#endif
-            return jsonData;
-            
-        }
-        else
-        {
-                        NSString* err_msg = [error localizedDescription];
-            NSMutableString *str = [[NSMutableString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
-            
-            DebugLog(@"data string: %@",str);
-            NSError *error1 = nil;
-            
-            NSMutableDictionary* jsobj = [[NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error1] mutableCopy];
-            
-            if(jsobj==nil)// 服务器返回不是json
-            {
-                
-                jsobj=[[NSMutableDictionary alloc] init];
-                [jsobj setValue:@"1" forKey:@"result"];
-                
-            }
-            
-            int result=[[jsobj valueForKey:@"result"] intValue];
-            UIApplication * app = [UIApplication sharedApplication];
-            AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-            NSString* mode =[jsobj valueForKey:@"mode"];
-            [appDelegate SetMode:mode];
-            switch (result) {
-                case 0:
-                    [jsobj setValue:MSG_USERAUTH_ERROR forKey:@"err_msg"];
-                    break;
-                case 1:
-                    [jsobj setValue:MSG_ERROR forKey:@"err_msg"];
-                    break;
-                case 2:
-                    [jsobj setValue:MSG_SUCCESS forKey:@"err_msg"];
-                    break;
-                case 8:
-                    [jsobj setValue:[jsobj valueForKey:@"msg"] forKey:@"err_msg"];
-                    break;
-                case 9:
-                    [jsobj setValue:[jsobj valueForKey:@"msg"] forKey:@"err_msg"];
-                    break;
-                case 99:
-                    [jsobj setValue:MSG_TIMEOUT forKey:@"err_msg"];
-                    break;
-                default:
-                    [jsobj setValue:MSG_ERROR forKey:@"err_msg"];
-                    break;
-            }
-            
-            
-            if([appDelegate.build intValue]< [[jsobj valueForKey:@"min_ver"]intValue])
-            {
-                [jsobj setValue:@"9" forKey:@"result"];
-                [jsobj setValue:MSG_VER_LOW forKey:@"err_msg"];
-            }
-            
-            if(![url isEqualToString:URL_ERR_LOG]&&![url isEqualToString:URL_DOWNLOAD_OFFLINE]/*&&result!=-3*/&&result!=2&&result!=99)
-            {
-                [RANetwork err_log:[RAUtils base64en:[RAConvertor dict2string:params]] result:[RAUtils base64en:str] module:url code:result];
-            }
-            NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsobj
-                                                               options:0
-                                                                 error:nil];
-#if defined(BUILD_NPD) || defined(BUILD_USAI) || defined(BUILD_UWAVER)
-            [ERPUtils googleAnalyticsSendRequestString:url WithScreen:screenName Action:userAction Extra:extra];
-#endif
-            return jsonData;
-            
-        }
-
-        return responseData;
-    }
+//}
 }
 
-
 +(NSString*)DataTOjsonString:(id)object
 {
     NSString *jsonString = nil;
@@ -4322,7 +4324,7 @@ repeat:
         //        NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
         //        NSString* versionNum =[infoDict valueForKey:@"CFBundleVersion"];
         //        versionNum = [NSString stringWithFormat:@"A%@",versionNum];
-        int ibadge = [[objheader valueForKey:@"badge"] intValue];
+//        int ibadge = [[objheader valueForKey:@"badge"] intValue];
         
         //        if([ibadge isEqual:[NSNull null]])
         //            strbadge=@"0";
@@ -5414,7 +5416,7 @@ repeat:
         //        NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
         //        NSString* versionNum =[infoDict valueForKey:@"CFBundleVersion"];
         //        versionNum = [NSString stringWithFormat:@"A%@",versionNum];
-        int ibadge = [[objheader valueForKey:@"badge"] intValue];
+//        int ibadge = [[objheader valueForKey:@"badge"] intValue];
         
         //        if([ibadge isEqual:[NSNull null]])
         //            strbadge=@"0";
@@ -7707,7 +7709,7 @@ repeat:
 //    {
 //    if(![self IsNetworkAvailable])
 //        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
-//    
+//
 //    json=[self get_json:URL_COPY_ORDER parameters:params];
 //    }
 //    if(json!=nil)