Pen Li 9 лет назад
Родитель
Сommit
957333741e

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


+ 23 - 27
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -3684,7 +3684,6 @@
             price_min = [[priceArray objectAtIndex:0] doubleValue];
             price_max = [[priceArray objectAtIndex:1] doubleValue];
         }
-        DebugLog(@"1、min~max:%lf ~ %lf",price_min,price_max);
         
         // sold_by_qty : Sold in quantities of %@
         [self check:params[@"sold_by_qty"] valueKey:@"qty" inDictionary:filter];
@@ -3697,25 +3696,31 @@
         
         // category
         NSString *category_id = params[@"ctgId"];
-        NSMutableDictionary *cateDic = [[filter objectForKey:@"category"] mutableCopy];
-        for (NSString *key0 in cateDic.allKeys) {
-            
-            if ([key0 containsString:@"category_"]) {
+        
+        if ([category_id isEqualToString:@""] || !category_id) {
+            category_id = @"%";
+        } else {
+            NSMutableDictionary *cateDic = [[filter objectForKey:@"category"] mutableCopy];
+            for (NSString *key0 in cateDic.allKeys) {
                 
-                NSMutableDictionary *category0 = [[cateDic objectForKey:key0] mutableCopy];
-                for (NSString *key1 in category0.allKeys) {
+                if ([key0 containsString:@"category_"]) {
                     
-                    if ([key1 containsString:@"category_"]) {
+                    NSMutableDictionary *category0 = [[cateDic objectForKey:key0] mutableCopy];
+                    for (NSString *key1 in category0.allKeys) {
                         
-                        NSMutableDictionary *category1 = [[category0 objectForKey:key1] mutableCopy];
-                        [category1 setObject:[NSNumber numberWithInteger:0] forKey:@"check"];
-                        if ([[category1 objectForKey:@"cid"] isEqualToString:category_id]) {
+                        if ([key1 containsString:@"category_"]) {
+                            
+                            NSMutableDictionary *category1 = [[category0 objectForKey:key1] mutableCopy];
+                            [category1 setValue:[NSNumber numberWithInteger:0] forKey:@"check"];
+                            if ([[category1 objectForKey:@"cid"] isEqualToString:category_id]) {
+                                
+                                category_id = [category1 objectForKey:@"id"];
+                                [category1 setValue:[NSNumber numberWithInteger:1] forKey:@"check"];
+                                [category0 setValue:category1 forKey:key1];
+                                [cateDic setValue:category0 forKey:key0];
+                                [filter setValue:cateDic forKey:@"category"];
+                            }
                             
-                            category_id = [category1 objectForKey:@"id"];
-                            [category1 setObject:[NSNumber numberWithInteger:1] forKey:@"check"];
-                            [category0 setObject:category1 forKey:key1];
-                            [cateDic setObject:category0 forKey:key0];
-                            [filter setObject:cateDic forKey:@"category"];
                         }
                         
                     }
@@ -3723,9 +3728,8 @@
                 }
                 
             }
-            
+
         }
-        
 
         // where bestseller > 0 order by bestseller desc
         // sql query: alert     availability(int)   best_seller(int)    price    qty
@@ -3791,8 +3795,7 @@
             [item setValue:nsname forKey:@"fash_name"];
             [item setValue:nsdescription forKey:@"description"];
             [item setValue:[NSString stringWithFormat:@"%d",product_id] forKey:@"product_id"];
-//            [items setObject:item forKey:[NSString stringWithFormat:@"item_%d",i]];
-//            i++;
+
             if (price_min == 0 && price_max == 0) {
                 
                 [items setObject:item forKey:[NSString stringWithFormat:@"item_%d",i]];
@@ -3806,8 +3809,6 @@
                 }
                 NSString *enscrypt_price = [NSString stringWithFormat:@"%s",price_ch];
                 double price = [[AESCrypt fastdecrypt:enscrypt_price] doubleValue];
-                DebugLog(@"product price:%lf",price);
-                DebugLog(@"min & max :%lf ~ %lf",price_min,price_max);
                 
                 if (price >= price_min && price <= price_max) {
                     
@@ -3822,14 +3823,9 @@
         [ret setObject:items forKey:@"items"];
         sqlite3_finalize(statement);
     }
-    NSLog(@"count:%d",count);
-    
     
     [iSalesDB close_db:db];
     
-    
-    
-    
     DebugLog(@"data string: %@",[RAUtils dict2string:ret] );
     
     return ret;