Przeglądaj źródła

修复从item search、category、search全选加入到wish list、portfolio、cart提示数量错误

Pen Li 9 lat temu
rodzic
commit
eff16186da

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 49 - 22
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -660,15 +660,24 @@
                     //                    appDelegate.order_code = order_code;
                     [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
                     NSString * msg = nil;
-                    if(checked.count==1)
-                    {
-                        msg=@"1 item added to Cart";
-                    }
-                    else
-                    {
-                        msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
+                    if (self.addAll) {
+                        
+                        unsigned long checkedCount = [return_json[@"count"] integerValue];
+                        
+                         msg=[NSString stringWithFormat:@"%lu items added to Cart",checkedCount];
+                    } else {
+                        
+                        if(checked.count==1)
+                        {
+                            msg=@"1 item added to Cart";
+                        }
+                        else
+                        {
+                            msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
+                        }
+
+                        
                     }
-                    
                     [RAUtils message_alert:nil title:msg controller:self] ;
                     
                     [self end_select:2];
@@ -753,13 +762,22 @@
                 
                 [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
                 NSString * msg = nil;
-                if(checked.count==1)
-                {
-                    msg=@"1 item added to Portfolio";
-                }
-                else
-                {
-                    msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
+                
+                if (self.addAll) {
+                    
+                    unsigned long checkedCount = [return_json[@"count"] integerValue];
+                    
+                    msg=[NSString stringWithFormat:@"%lu items added to Portfolio",checkedCount];
+                } else {
+                
+                    if(checked.count==1)
+                    {
+                        msg=@"1 item added to Portfolio";
+                    }
+                    else
+                    {
+                        msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
+                    }
                 }
                 
                 [RAUtils message_alert:nil title:msg controller:self] ;
@@ -839,13 +857,22 @@
                 
                 
                 NSString * msg = nil;
-                if(checked.count==1)
-                {
-                    msg=@"1 item added to \nWish List";
-                }
-                else
-                {
-                    msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
+                
+                if (self.addAll) {
+                    
+                    unsigned long checkedCount = [return_json[@"count"] integerValue];
+                    
+                    msg=[NSString stringWithFormat:@"%lu items added to \nWish List",checkedCount];
+                } else {
+                
+                    if(checked.count==1)
+                    {
+                        msg=@"1 item added to \nWish List";
+                    }
+                    else
+                    {
+                        msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
+                    }
                 }
                 
                 [RAUtils message_alert:nil title:msg controller:self] ;

+ 9 - 1
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -3502,6 +3502,11 @@
                                         @"orderCode"  : order_code
                                         };
             ret = [self offline_add2cart:newParams.mutableCopy];
+            
+            NSMutableDictionary *retDic = [[NSJSONSerialization JSONObjectWithData:ret options:NSJSONReadingMutableContainers error:nil] mutableCopy];
+            [retDic setValue:[NSNumber numberWithInteger:count] forKey:@"count"];
+            
+            ret = [RAUtils dict2data:retDic];
         }
         
         
@@ -3511,7 +3516,10 @@
                                     @"product_id" : product_id_str
                                     };
         
-        ret = [RAUtils dict2data:[self offline_add2wishlist:newParams.mutableCopy]];
+        NSMutableDictionary *retDic = [self offline_add2wishlist:newParams.mutableCopy].mutableCopy;
+        [retDic setValue:[NSNumber numberWithInteger:count] forKey:@"count"];
+        
+        ret = [RAUtils dict2data:retDic];
         
         
     } else if([add_to isEqualToString:@"portfolio"]) {

+ 50 - 21
RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m

@@ -1058,13 +1058,23 @@
                 [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
                 
                 NSString * msg = nil;
-                if(checked.count==1)
-                {
-                    msg=@"1 item added to Cart";
-                }
-                else
-                {
-                    msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
+                
+                if (self.addAll) {
+                    
+                    unsigned long checkedCount = [return_json[@"count"] integerValue];
+                    
+                    msg=[NSString stringWithFormat:@"%lu items added to Cart",checkedCount];
+                } else {
+
+                
+                    if(checked.count==1)
+                    {
+                        msg=@"1 item added to Cart";
+                    }
+                    else
+                    {
+                        msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
+                    }
                 }
                 
                 
@@ -1149,13 +1159,22 @@
                 
                 
                 NSString * msg = nil;
-                if(checked.count==1)
-                {
-                    msg=@"1 item added to Portfolio";
-                }
-                else
-                {
-                    msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
+                
+                if (self.addAll) {
+                    
+                    unsigned long checkedCount = [return_json[@"count"] integerValue];
+                    
+                    msg=[NSString stringWithFormat:@"%lu items added to Portfolio",checkedCount];
+                } else {
+                
+                    if(checked.count==1)
+                    {
+                        msg=@"1 item added to Portfolio";
+                    }
+                    else
+                    {
+                        msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
+                    }
                 }
                 
                     [RAUtils message_alert:nil title:msg controller:self] ;
@@ -1230,13 +1249,23 @@
                 
                 
                 NSString * msg = nil;
-                if(checked.count==1)
-                {
-                    msg=@"1 item added to \nWish List";
-                }
-                else
-                {
-                    msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
+                
+                if (self.addAll) {
+                    
+                    unsigned long checkedCount = [return_json[@"count"] integerValue];
+                    
+                    msg=[NSString stringWithFormat:@"%lu items added to \nWish List",checkedCount];
+                } else {
+
+                
+                    if(checked.count==1)
+                    {
+                        msg=@"1 item added to \nWish List";
+                    }
+                    else
+                    {
+                        msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
+                    }
                 }
                 
                     [RAUtils message_alert:nil title:msg controller:self] ;

+ 48 - 21
RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m

@@ -873,13 +873,22 @@
                 
                 
                 NSString * msg = nil;
-                if(checked.count==1)
-                {
-                    msg=@"1 item added to Cart";
-                }
-                else
-                {
-                    msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
+                
+                if (self.addAll) {
+                    
+                    unsigned long checkedCount = [return_json[@"count"] integerValue];
+                    
+                    msg=[NSString stringWithFormat:@"%lu items added to Cart",checkedCount];
+                } else {
+                
+                    if(checked.count==1)
+                    {
+                        msg=@"1 item added to Cart";
+                    }
+                    else
+                    {
+                        msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
+                    }
                 }
                 
                     [RAUtils message_alert:nil title:msg controller:self] ;
@@ -964,13 +973,22 @@
                 
                 
                 NSString * msg = nil;
-                if(checked.count==1)
-                {
-                    msg=@"1 item added to Portfolio";
-                }
-                else
-                {
-                    msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
+                
+                if (self.addAll) {
+                    
+                    unsigned long checkedCount = [return_json[@"count"] integerValue];
+                    
+                    msg=[NSString stringWithFormat:@"%lu items added to Portfolio",checkedCount];
+                } else {
+                
+                    if(checked.count==1)
+                    {
+                        msg=@"1 item added to Portfolio";
+                    }
+                    else
+                    {
+                        msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
+                    }
                 }
                 
                     [RAUtils message_alert:nil title:msg controller:self] ;
@@ -1046,13 +1064,22 @@
                 
                 
                 NSString * msg = nil;
-                if(checked.count==1)
-                {
-                    msg=@"1 item added to \nWish List";
-                }
-                else
-                {
-                    msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
+                
+                if (self.addAll) {
+                    
+                    unsigned long checkedCount = [return_json[@"count"] integerValue];
+                    
+                    msg=[NSString stringWithFormat:@"%lu items added to \nWish List",checkedCount];
+                } else {
+                
+                    if(checked.count==1)
+                    {
+                        msg=@"1 item added to \nWish List";
+                    }
+                    else
+                    {
+                        msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
+                    }
                 }
                 
                     [RAUtils message_alert:nil title:@" Multiple items added to \nWish List" controller:self] ;