Просмотр исходного кода

160921
Add: offline category, item_search, search add cart marker.

Ray Zhang 9 лет назад
Родитель
Сommit
f127b93568

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


+ 79 - 47
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -154,11 +154,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496051671.689944"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2318"
-            endingLineNumber = "2318"
+            startingLineNumber = "2326"
+            endingLineNumber = "2326"
             landmarkName = "+model_subtotal:count:db:compute_part:"
             landmarkType = "5">
          </BreakpointContent>
@@ -170,11 +170,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496051671.689944"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2433"
-            endingLineNumber = "2433"
+            startingLineNumber = "2441"
+            endingLineNumber = "2441"
             landmarkName = "+offline_requestcart:"
             landmarkType = "5">
          </BreakpointContent>
@@ -186,11 +186,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496051671.689944"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2197"
-            endingLineNumber = "2197"
+            startingLineNumber = "2205"
+            endingLineNumber = "2205"
             landmarkName = "+model_bundle:db:compute_part:"
             landmarkType = "5">
          </BreakpointContent>
@@ -202,11 +202,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496051671.689944"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2299"
-            endingLineNumber = "2299"
+            startingLineNumber = "2307"
+            endingLineNumber = "2307"
             landmarkName = "+model_subtotal:count:db:compute_part:"
             landmarkType = "5">
          </BreakpointContent>
@@ -218,11 +218,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496051671.689944"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3368"
-            endingLineNumber = "3368"
+            startingLineNumber = "3376"
+            endingLineNumber = "3376"
             landmarkName = "+category_img:db:"
             landmarkType = "5">
          </BreakpointContent>
@@ -234,11 +234,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496051671.689944"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3372"
-            endingLineNumber = "3372"
+            startingLineNumber = "3380"
+            endingLineNumber = "3380"
             landmarkName = "+category_img:db:"
             landmarkType = "5">
          </BreakpointContent>
@@ -522,11 +522,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496051671.689944"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2678"
-            endingLineNumber = "2678"
+            startingLineNumber = "2686"
+            endingLineNumber = "2686"
             landmarkName = "+offline_login:"
             landmarkType = "5">
          </BreakpointContent>
@@ -554,11 +554,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496051671.689944"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2680"
-            endingLineNumber = "2680"
+            startingLineNumber = "2688"
+            endingLineNumber = "2688"
             landmarkName = "+offline_login:"
             landmarkType = "5">
          </BreakpointContent>
@@ -650,11 +650,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496051671.689944"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "4206"
-            endingLineNumber = "4206"
+            startingLineNumber = "4214"
+            endingLineNumber = "4214"
             landmarkName = "+offline_contactlist:"
             landmarkType = "5">
          </BreakpointContent>
@@ -666,11 +666,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496051671.689944"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "4389"
-            endingLineNumber = "4389"
+            startingLineNumber = "4397"
+            endingLineNumber = "4397"
             landmarkName = "+offline_contactlist:"
             landmarkType = "5">
          </BreakpointContent>
@@ -1002,11 +1002,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496136428.53706"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "9132"
-            endingLineNumber = "9132"
+            startingLineNumber = "9151"
+            endingLineNumber = "9151"
             landmarkName = "+offline_resetorder:"
             landmarkType = "5">
          </BreakpointContent>
@@ -1066,11 +1066,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496045389.123288"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2060"
-            endingLineNumber = "2060"
+            startingLineNumber = "2068"
+            endingLineNumber = "2068"
             landmarkName = "+offline_editorder:"
             landmarkType = "5">
          </BreakpointContent>
@@ -1094,15 +1094,15 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496136509.008591"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2359"
-            endingLineNumber = "2359"
+            startingLineNumber = "2367"
+            endingLineNumber = "2367"
             landmarkName = "+offline_requestcart:"
             landmarkType = "5">
          </BreakpointContent>
@@ -1110,15 +1110,15 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496136588.038993"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2459"
-            endingLineNumber = "2459"
+            startingLineNumber = "2467"
+            endingLineNumber = "2467"
             landmarkName = "+offline_requestcart:"
             landmarkType = "5">
          </BreakpointContent>
@@ -1130,14 +1130,46 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/OLDataProvider.m"
-            timestampString = "496136900.790909"
+            timestampString = "496139622.991006"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "6797"
-            endingLineNumber = "6797"
+            startingLineNumber = "6816"
+            endingLineNumber = "6816"
             landmarkName = "+offline_cartsetprice:"
             landmarkType = "5">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/Functions/offline/OLDataProvider.m"
+            timestampString = "496139622.991006"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "5427"
+            endingLineNumber = "5427"
+            landmarkName = "+categoryList:limited:"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/Functions/offline/OLDataProvider.m"
+            timestampString = "496139622.991006"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "5249"
+            endingLineNumber = "5249"
+            landmarkName = "+categoryList:limited:"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

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

@@ -1724,12 +1724,15 @@
     int count = [iSalesDB get_recordcount:db table:@"product" where:[NSString stringWithFormat:@"(lower(name) like'%%%@%%' or lower(description) like'%%%@%%') and is_active = 1",keyword,keyword]];
     
     
+    UIApplication * app = [UIApplication sharedApplication];
+    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+    
     NSString *sqlQuery = nil;
     if(exactMatch )
-        sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from product m left join wishlist w on m.product_id=w.product_id where lower(name) like'%@%%' and m.is_active = 1 order by m.name %@;",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 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 from product m left join wishlist w on m.product_id=w.product_id where (lower(name) like'%%%@%%' or lower(description) like'%%%@%%') and m.is_active = 1 order by m.name %@ ;",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 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;
@@ -1766,7 +1769,7 @@
             
             int wid = sqlite3_column_int(statement, 3);
             int closeout = sqlite3_column_int(statement, 4);
-            
+            int cid = sqlite3_column_int(statement, 5);
             NSMutableDictionary* imgjson=[self category_img:product_id  db:db];
             
             if(wid==0)
@@ -1779,6 +1782,11 @@
             else
                 [item setValue:@"true" forKey:@"is_closeout"];
             
+            if(cid==0)
+                [item setValue:@"false" forKey:@"cart_exists"];
+            else
+                [item setValue:@"true" forKey:@"cart_exists"];
+            
             [item addEntriesFromDictionary:imgjson];
             
             
@@ -5267,7 +5275,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 from product m left join wishlist w on m.product_id=w.product_id where m.category like'%%#%@#%%' and m.is_active = 1 order by m.name %@ ;",category,limit_str];
+    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 order by m.name %@ ;",appDelegate.order_code, category,limit_str];
     
     
     double price_min = 0;
@@ -5355,7 +5363,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 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 order by %@ %@;",cateWhere,best_seller,alert,available_condition,qty,price,order_best_seller,limit_str];
+        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 order by %@ %@;",cateWhere,best_seller,alert,available_condition,qty,price,order_best_seller,limit_str];
         
         
         where =[NSString stringWithFormat:@"%@ %@ %@ %@ %@ %@ and is_active = 1",cateWhere,best_seller,alert,available_condition,qty,price];
@@ -5402,7 +5410,7 @@
             
             int wid = sqlite3_column_int(statement, 3);
             int closeout = sqlite3_column_int(statement, 4);
-            
+            int cid = sqlite3_column_int(statement, 5);
             NSMutableDictionary* imgjson=[self category_img:product_id  db:db];
             
             if(wid==0)
@@ -5415,6 +5423,12 @@
             else
                 [item setValue:@"true" forKey:@"is_closeout"];
             
+            
+            if(cid==0)
+                [item setValue:@"false" forKey:@"cart_exists"];
+            else
+                [item setValue:@"true" forKey:@"cart_exists"];
+            
             [item addEntriesFromDictionary:imgjson];
             
             
@@ -5514,7 +5528,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 from product m left join wishlist w on m.product_id=w.product_id where %@ order by %@ %@;",where,orderby,limit_str];
+    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];
     
     
     double price_min = 0;
@@ -5656,7 +5670,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 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 order by %@ %@;",cateWhere,best_seller,alert,available_condition,qty,price,order_best_seller,limit_str];
+        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 order by %@ %@;",appDelegate.order_code, cateWhere,best_seller,alert,available_condition,qty,price,order_best_seller,limit_str];
         
         
         // count
@@ -5708,7 +5722,7 @@
             
             int wid = sqlite3_column_int(statement, 3);
             int closeout = sqlite3_column_int(statement, 4);
-            
+            int cid = sqlite3_column_int(statement, 5);
             NSMutableDictionary* imgjson=[self category_img:product_id db:db];
             
             if(wid==0)
@@ -5721,6 +5735,11 @@
             else
                 [item setValue:@"true" forKey:@"is_closeout"];
             
+            if(cid==0)
+                [item setValue:@"false" forKey:@"cart_exists"];
+            else
+                [item setValue:@"true" forKey:@"cart_exists"];
+            
             [item addEntriesFromDictionary:imgjson];