Эх сурвалжийг харах

修复wish list删除之后红心依旧存在。
修复cart move to wishlist之后wishlist badge value不对。

Pen Li 9 жил өмнө
parent
commit
06647548ce

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


+ 19 - 16
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -1792,10 +1792,10 @@
     
     NSString *sqlQuery = nil;
     if(exactMatch )
-        sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from product m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where lower(name) like'%@%%' and m.is_active = 1  and (w.is_delete is NULL or w.is_delete != 1) order by m.name %@;",appDelegate.order_code, keyword,limit_str]; // select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where lower(name) like'%@%%' order by m.name limit %d offset %d ;
+        sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id,w.is_delete from product m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where lower(name) like'%@%%' and m.is_active = 1   order by m.name %@;",appDelegate.order_code, keyword,limit_str]; // select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where lower(name) like'%@%%' order by m.name limit %d offset %d ;
     else
         
-        sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from product m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where (lower(name) like'%%%@%%' or lower(description) like'%%%@%%') and m.is_active = 1 and (w.is_delete is NULL or w.is_delete != 1) order by m.name %@ ;",appDelegate.order_code, keyword,keyword,limit_str];// select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where lower(name) like'%%%@%%' or
+        sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id,w.is_delete from product m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where (lower(name) like'%%%@%%' or lower(description) like'%%%@%%') and m.is_active = 1 order by m.name %@ ;",appDelegate.order_code, keyword,keyword,limit_str];// select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where lower(name) like'%%%@%%' or
     
     DebugLog(@"offline_search sql:%@",sqlQuery);
     sqlite3_stmt * statement;
@@ -1833,12 +1833,13 @@
             int wid = sqlite3_column_int(statement, 3);
             int closeout = sqlite3_column_int(statement, 4);
             int cid = sqlite3_column_int(statement, 5);
+            int wisdelete = sqlite3_column_int(statement, 6);
             NSMutableDictionary* imgjson=[self category_img:product_id  db:db];
             
-            if(wid==0)
-                [item setValue:@"false" forKey:@"wish_exists"];
-            else
+            if(wid !=0 && wisdelete != 1)
                 [item setValue:@"true" forKey:@"wish_exists"];
+            else
+                [item setValue:@"false" forKey:@"wish_exists"];
             
             if(closeout==0)
                 [item setValue:@"false" forKey:@"is_closeout"];
@@ -5476,7 +5477,7 @@
     NSString *where = [NSString stringWithFormat:@"category like'%%#%@#%%' and is_active = 1",category];
     
     
-    NSString *sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from product m left join wishlist w on m.product_id=w.product_id left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id  where m.category like'%%#%@#%%' and m.is_active = 1 and (w.is_delete is NULL or w.is_delete != 1) order by m.name %@ ;",appDelegate.order_code, category,limit_str];
+    NSString *sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id,w.is_delete from product m left join wishlist w on m.product_id=w.product_id left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id  where m.category like'%%#%@#%%' and m.is_active = 1 order by m.name %@ ;",appDelegate.order_code, category,limit_str];
     
     
     double price_min = 0;
@@ -5564,7 +5565,7 @@
         // where bestseller > 0 order by bestseller desc
         // sql query: alert     availability(int)   best_seller(int)    price    qty
         
-        sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from (select name,description,product_id,closeout,best_seller from product where %@ %@ %@ %@ %@ %@ and is_active = 1) m left join wishlist w on m.product_id=w.product_id left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where w.is_delete is NULL or w.is_delete != 1 order by %@ %@;",cateWhere,best_seller,alert,available_condition,qty,price,appDelegate.order_code,order_best_seller,limit_str];
+        sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id,w.is_delete from (select name,description,product_id,closeout,best_seller from product where %@ %@ %@ %@ %@ %@ and is_active = 1) m left join wishlist w on m.product_id=w.product_id left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id order by %@ %@;",cateWhere,best_seller,alert,available_condition,qty,price,appDelegate.order_code,order_best_seller,limit_str];
         
         
         where =[NSString stringWithFormat:@"%@ %@ %@ %@ %@ %@ and is_active = 1",cateWhere,best_seller,alert,available_condition,qty,price];
@@ -5612,12 +5613,13 @@
             int wid = sqlite3_column_int(statement, 3);
             int closeout = sqlite3_column_int(statement, 4);
             int cid = sqlite3_column_int(statement, 5);
+            int wisdelete = sqlite3_column_int(statement, 6);
             NSMutableDictionary* imgjson=[self category_img:product_id  db:db];
             
-            if(wid==0)
-                [item setValue:@"false" forKey:@"wish_exists"];
-            else
+            if(wid !=0 && wisdelete != 1)
                 [item setValue:@"true" forKey:@"wish_exists"];
+            else
+                [item setValue:@"false" forKey:@"wish_exists"];
             
             if(closeout==0)
                 [item setValue:@"false" forKey:@"is_closeout"];
@@ -5729,7 +5731,7 @@
     
     NSString *sqlQuery = nil;
     where = [where stringByAppendingString:@" and m.is_active = 1"];
-    sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from product m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where %@ order by %@ %@;",appDelegate.order_code, where,orderby,limit_str];
+    sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id,w.is_delete from product m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where %@ order by %@ %@;",appDelegate.order_code, where,orderby,limit_str];
     
     
     double price_min = 0;
@@ -5871,7 +5873,7 @@
         // where bestseller > 0 order by bestseller desc
         // sql query: alert     availability(int)   best_seller(int)    price    qty
         
-        sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from (select name,description,product_id,closeout,best_seller from product where %@ %@ %@ %@ %@ %@ and is_active = 1) m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where w.is_delete is NULL or w.is_delete != 1 order by %@ %@;", cateWhere,best_seller,alert,available_condition,qty,price,appDelegate.order_code,order_best_seller,limit_str];
+        sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id,w.is_delete from (select name,description,product_id,closeout,best_seller from product where %@ %@ %@ %@ %@ %@ and is_active = 1) m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id order by %@ %@;", cateWhere,best_seller,alert,available_condition,qty,price,appDelegate.order_code,order_best_seller,limit_str];
         
         
         // count
@@ -5924,12 +5926,13 @@
             int wid = sqlite3_column_int(statement, 3);
             int closeout = sqlite3_column_int(statement, 4);
             int cid = sqlite3_column_int(statement, 5);
+            int wisdelete = sqlite3_column_int(statement, 6);
             NSMutableDictionary* imgjson=[self category_img:product_id db:db];
             
-            if(wid==0)
-                [item setValue:@"false" forKey:@"wish_exists"];
-            else
+            if(wid !=0 && wisdelete != 1)
                 [item setValue:@"true" forKey:@"wish_exists"];
+            else
+                [item setValue:@"false" forKey:@"wish_exists"];
             
             if(closeout==0)
                 [item setValue:@"false" forKey:@"is_closeout"];
@@ -6967,7 +6970,7 @@
     
     sqlite3 *db1 = [iSalesDB get_db];
     
-    int wish_count = [iSalesDB get_recordcount:db1 table:@"wishlist" where:@"1=1"];
+    int wish_count = [iSalesDB get_recordcount:db1 table:@"wishlist" where:@"is_delete is  NULL or is_delete != 1"];
 
     [dic setValue:@"Regular Mode" forKey:@"mode"];