Selaa lähdekoodia

add to cart 增加date time

Pen Li 9 vuotta sitten
vanhempi
commit
82c2787752

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


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

@@ -2046,17 +2046,18 @@
         
         NSString* sql=nil;
         
+        
         if(_id<0)
         {
             //             NSString* bundle_serialno= [self model_bundle:[arr_id[i] intValue] db:db];
             int item_id=[self product_itemid:[arr_id[i] intValue] db:db];
             
-            sql=[NSString stringWithFormat:@"insert into offline_cart(product_id,so_no,item_count,item_id) values(%@,'%@',%d,%d)",arr_id[i],orderCode,item_qty,item_id];
+            sql=[NSString stringWithFormat:@"insert into offline_cart(product_id,so_no,item_count,item_id,create_time) values(%@,'%@',%d,%d,datetime('now', 'localtime'))",arr_id[i],orderCode,item_qty,item_id];
             
         }
         else
         {
-            sql=[NSString stringWithFormat:@"update offline_cart set item_count=item_count+%d where _id=%d",item_qty,_id];
+            sql=[NSString stringWithFormat:@"update offline_cart set item_count=item_count+%d,create_time = datetime('now', 'localtime') where _id=%d",item_qty,_id];
             
         }
         [iSalesDB execSql:sql db:db];

+ 8 - 8
RedAnt ERP Mobile/common/data_provider/iSalesDB.m

@@ -726,19 +726,19 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
    
     [self alterTable:@"model" columns:@"product" rename:YES db:db];
     
-    [self alterTable:@"product" columns:@"has_bundle integer,is_active integer,item_id integer" rename:NO db:db];
+    [self alterTable:@"product" columns:@"has_bundle integer;is_active integer;item_id integer" rename:NO db:db];
     
-    [self alterTable:@"model_image" columns:@"item_id integer,picture_id integer" rename:NO db:db];
+    [self alterTable:@"model_image" columns:@"item_id integer;picture_id integer" rename:NO db:db];
     
     [self alterTable:@"model_price" columns:@"item_id integer" rename:NO db:db];
     
-    [self alterTable:@"offline_cart" columns:@"orderitem_id integer,item_id integer,str_price text,item_count integer,line_note text,bundle_item text,type integer,create_timer timestamp default (datetime('now', 'localtime'))" rename:NO db:db];
+    [self alterTable:@"offline_cart" columns:@"orderitem_id integer;item_id integer;str_price text;item_count integer;line_note text;bundle_item text;type integer;create_time timestamp" rename:NO db:db];
     
-    [self alterTable:@"offline_contact" columns:@"is_active integer,sync_data text" rename:NO db:db];
+    [self alterTable:@"offline_contact" columns:@"is_active integer;sync_data text" rename:NO db:db];
     
-    [self alterTable:@"offline_login" columns:@"can_update_contact_info integer,sales_code text" rename:NO db:db];
+    [self alterTable:@"offline_login" columns:@"can_update_contact_info integer;sales_code text" rename:NO db:db];
     
-    [self alterTable:@"wishlist" columns:@"qty integer,create_time timestamp default (datetime('now', 'localtime'))" rename:NO db:db];
+    [self alterTable:@"wishlist" columns:@"qty integer;item_id integer" rename:NO db:db];
     
 //    NSString *rename_model_to_product = @"alter model rename to product";
 //    [self execSql:rename_model_to_product db:db];
@@ -1006,7 +1006,7 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
         [self jk_query:check_table_exist db:db close:NO completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
             
             int ct = sqlite3_column_int(stmt, 0);
-            exist = ct ? YES : 0;
+            exist = ct ? YES : NO;
         }];
         
         if (!exist) {
@@ -1016,7 +1016,7 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
         
     } else {
         
-        NSArray *columns = [column_str_or_new_table_name componentsSeparatedByString:@","];
+        NSArray *columns = [column_str_or_new_table_name componentsSeparatedByString:@";"];
         for (NSString *column in columns) {
             
             NSString *name = [[column componentsSeparatedByString:@" "] firstObject];