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

表Order、Contact、Cart、Wishlist增加字段Modify_time,Order List、Wish List、Cart Order By Modify_time。
修复Portfolio编辑取消时提示背景重复。

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

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


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

@@ -718,11 +718,11 @@
     NSString *sort_str = @"";
     switch (sort) {
         case 0:{
-            sort_str = @"order by w.create_time desc";
+            sort_str = @"order by w.modify_time desc";
         }
             break;
         case 1:{
-            sort_str = @"order by w.create_time asc";
+            sort_str = @"order by w.modify_time asc";
         }
             break;
         case 2:{
@@ -2360,11 +2360,11 @@
     NSString *sort_str = @"";
     switch (sort) {
         case 0:{
-            sort_str = @"order by c.create_time desc";
+            sort_str = @"order by c.modify_time desc";
         }
             break;
         case 1:{
-            sort_str = @"order by c.create_time asc";
+            sort_str = @"order by c.modify_time asc";
         }
             break;
         case 2:{
@@ -2387,7 +2387,7 @@
     
     
     
-    NSString *sqlQuery =     [ NSString stringWithFormat:@"select c.product_id,c.price,c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id from (select _id,product_id,decrypt(str_price) as price,discount,item_count,line_note,item_id,create_time from offline_cart where so_no='%@') c left join product m on c.product_id=m.product_id %@",orderCode,sort_str ];
+    NSString *sqlQuery =     [ NSString stringWithFormat:@"select c.product_id,c.price,c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id from (select _id,product_id,decrypt(str_price) as price,discount,item_count,line_note,item_id,modify_time from offline_cart where so_no='%@') c left join product m on c.product_id=m.product_id %@",orderCode,sort_str ];
 
     
 //        NSString *sqlQuery =     [ NSString stringWithFormat:@"select c.product_id,decrypt(c.str_price),c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id from offline_cart c  left join product m on c.product_id=m.product_id where c.so_no='%@'",orderCode ];
@@ -6543,7 +6543,7 @@
         }
     }
     
-    NSString*     sqlQuery=[NSString stringWithFormat:@"SELECT o._id,o.so_id,o.status,o.sales_rep,o.create_by,decrypt(c.company_name),o.create_time,o.total_price,o.customer_contact,o.erpOrderStatus,o.order_id is null from offline_order o left join offline_contact c on o.customer_cid=c.contact_id where %@ order by o.create_time desc limit %d offset %d" ,where, limit, offset];
+    NSString*     sqlQuery=[NSString stringWithFormat:@"SELECT o._id,o.so_id,o.status,o.sales_rep,o.create_by,decrypt(c.company_name),o.modify_time,o.total_price,o.customer_contact,o.erpOrderStatus,o.order_id is null from offline_order o left join offline_contact c on o.customer_cid=c.contact_id where %@ order by o.modify_time desc limit %d offset %d" ,where, limit, offset];
     
 //    DebugLog(@"order list sql: %@",sqlQuery);
     

+ 7 - 2
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m

@@ -34,6 +34,7 @@
 
 @property (nonatomic,assign) NSInteger editedRow;
 @property (nonatomic,assign) NSInteger deletedRow;
+@property (strong, nonatomic)  NSIndexPath *deleteIndexPath;// 点击delete action
 
 @end
 
@@ -1247,14 +1248,14 @@
     
     // 添加一个删除按钮
     
-    self.indexPath=indexPath;
+//    self.indexPath=indexPath;
     ModelItemCell * cell = [tableView cellForRowAtIndexPath:indexPath];
     
     
     UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
         
         NSLog(@"delete click");
-        
+        self.deleteIndexPath = indexPath;
         UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Delete confirm", nil) message:NSLocalizedString(@"Are you sure remove model from portfolio?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
         alert.tag = ALERT_DEL;
         // alert.
@@ -1336,6 +1337,7 @@
                         item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
                         self.content_data[[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]]=item_json;
                        // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
+                        self.indexPath=indexPath;
                         [self.itemListTable reloadData];
                     }
                     else
@@ -1448,6 +1450,8 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     {
         if(buttonIndex!=alertView.cancelButtonIndex)
         {
+            self.indexPath = self.deleteIndexPath;
+            
             int count =[[self.content_data valueForKey:@"count"] intValue];
             BOOL delete_last = self.indexPath.row == count - 1 ? YES : NO;
             
@@ -1482,6 +1486,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
             });
             
         }
+        self.deleteIndexPath = nil;
         return;
     }
     

+ 10 - 4
RedAnt ERP Mobile/common/data_provider/iSalesDB.m

@@ -696,17 +696,17 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
     
     NSString* create_offline_login=@"CREATE TABLE IF NOT EXISTS offline_login ( _id INTEGER PRIMARY KEY, username VARCHAR(40),password VARCHAR(40), can_show_price integer ,can_see_price integer,contact_id VARCHAR(20),user_type integer,can_cancel_order integer,can_set_cart_price integer,can_create_portfolio integer, can_delete_order integer,can_submit_order integer,can_set_tearsheet_price integer,can_create_order integer, can_update_contact_info integer, mode VARCHAR(20), default_price text, price text, user_id integer,sales_code text);";
     
-    NSString* create_offline_order=@"CREATE TABLE IF NOT EXISTS offline_order ( _id INTEGER PRIMARY KEY,so_id text, order_id text ,status integer, submit_as integer,general_notes TEXT ,internal_notes text,sales_rep TEXT,create_by TEXT, total_price float, erpOrderStatus integer, logist text, lift_gate integer, logistic_note text, paymentType text, credit_card_first_name text, credit_card_last_name text, credit_card_address1 text, credit_card_address2 text, credit_card_zipcode text, credit_card_type text, credit_card_number text, credit_card_security_code text, credit_card_expiration_month text , credit_card_expiration_year text,credit_card_city text, credit_card_state text,customer_cid text,customer_contact text,customer_email text,customer_phone text,customer_fax text,receive_cid text,receive_name text,receive_ext text,receive_contact text, receive_phone text,receive_fax text,receive_email text,sender_cid text,sender_name text,sender_ext text,sender_contact text, sender_phone text,sender_fax text,sender_email text,shipping_billto_cid text,shipping_billto_name text,shipping_billto_ext text,shipping_billto_contact text, shipping_billto_phone text,shipping_billto_fax text,shipping_billto_email text,billing_cid text,billing_name text,billing_ext text,billing_contact text, billing_phone text,billing_fax text,billing_email text,returnto_cid text,returnto_name text,returnto_ext text,returnto_contact text, returnto_phone text,returnto_fax text,returnto_email text, must_call int,poNumber text,comments text,comments_ext text,paymentsAndCredits float,shipping float,lift_gate_value float,handling_fee_value float,sign_picpath text,sync_data text,ship_via text,create_time TIMESTAMP default (datetime('now', 'localtime')));";
+    NSString* create_offline_order=@"CREATE TABLE IF NOT EXISTS offline_order ( _id INTEGER PRIMARY KEY,so_id text, order_id text ,status integer, submit_as integer,general_notes TEXT ,internal_notes text,sales_rep TEXT,create_by TEXT, total_price float, erpOrderStatus integer, logist text, lift_gate integer, logistic_note text, paymentType text, credit_card_first_name text, credit_card_last_name text, credit_card_address1 text, credit_card_address2 text, credit_card_zipcode text, credit_card_type text, credit_card_number text, credit_card_security_code text, credit_card_expiration_month text , credit_card_expiration_year text,credit_card_city text, credit_card_state text,customer_cid text,customer_contact text,customer_email text,customer_phone text,customer_fax text,receive_cid text,receive_name text,receive_ext text,receive_contact text, receive_phone text,receive_fax text,receive_email text,sender_cid text,sender_name text,sender_ext text,sender_contact text, sender_phone text,sender_fax text,sender_email text,shipping_billto_cid text,shipping_billto_name text,shipping_billto_ext text,shipping_billto_contact text, shipping_billto_phone text,shipping_billto_fax text,shipping_billto_email text,billing_cid text,billing_name text,billing_ext text,billing_contact text, billing_phone text,billing_fax text,billing_email text,returnto_cid text,returnto_name text,returnto_ext text,returnto_contact text, returnto_phone text,returnto_fax text,returnto_email text, must_call int,poNumber text,comments text,comments_ext text,paymentsAndCredits float,shipping float,lift_gate_value float,handling_fee_value float,sign_picpath text,sync_data text,ship_via text,create_time TIMESTAMP default (datetime('now', 'localtime')),modify_time TIMESTAMP default (datetime('now', 'localtime')));";
     
     
     
     
-    NSString* create_offline_cart=@"CREATE TABLE IF NOT EXISTS offline_cart ( _id INTEGER PRIMARY KEY, orderitem_id integer,product_id INTEGER,item_id integer,str_price text , discount float , so_no VARCHAR(40), item_count integer,line_note text,bundle_item text,type integer,create_time TIMESTAMP default (datetime('now', 'localtime')));";
+    NSString* create_offline_cart=@"CREATE TABLE IF NOT EXISTS offline_cart ( _id INTEGER PRIMARY KEY, orderitem_id integer,product_id INTEGER,item_id integer,str_price text , discount float , so_no VARCHAR(40), item_count integer,line_note text,bundle_item text,type integer,create_time TIMESTAMP default (datetime('now', 'localtime')),modify_time TIMESTAMP default (datetime('now', 'localtime')));";
 //    NSString* create_offline_wish=@"CREATE TABLE IF NOT EXISTS offline_wishlist ( _id INTEGER PRIMARY KEY, product_id INTEGER,qty integer,item_id integer, create_time TIMESTAMP default (datetime('now', 'localtime')));";
-    NSString* create_wishlist=@"CREATE TABLE IF NOT EXISTS wishlist ( _id INTEGER PRIMARY KEY, user_id INTEGER,  product_id integer ,item_id integer , qty integer,create_time TIMESTAMP default (datetime('now', 'localtime')));";
+    NSString* create_wishlist=@"CREATE TABLE IF NOT EXISTS wishlist ( _id INTEGER PRIMARY KEY, user_id INTEGER,  product_id integer ,item_id integer , qty integer,create_time TIMESTAMP default (datetime('now', 'localtime')),modify_time TIMESTAMP default (datetime('now', 'localtime')));";
 
     
-    NSString* create_offline_contact=@"CREATE TABLE IF NOT EXISTS offline_contact (_id INTEGER, country VARCHAR(40,0), company_name VARCHAR(40,0), contact_id VARCHAR(20,0), addr_1 text, addr_2 text, addr_3 text, addr_4 text, zipcode varchar(20,0), state VARCHAR(40,0), city VARCHAR(40,0), first_name VARCHAR(40,0), last_name VARCHAR(40,0), phone VARCHAR(40,0), fax VARCHAR(40,0), email VARCHAR(40,0), notes text, price_type VARCHAR(40,0), sales_rep VARCHAR(40,0), type VARCHAR(40,0), create_time timestamp default (datetime('now', 'localtime')), editable integer, contact_name text, addr text, Sales_Order_Customer integer, Sales_Order_Freight_Bill_To integer, Sales_Order_Ship_From integer, Sales_Order_Merchandise_Bill_To integer, Contact_Return_To integer, Sales_Order_Ship_To integer,img_0 TEXT,img_1 TEXT,img_2 TEXT,related_cid VARCHAR(20,0),is_active integer,sync_data text, PRIMARY KEY(_id) );";
+    NSString* create_offline_contact=@"CREATE TABLE IF NOT EXISTS offline_contact (_id INTEGER, country VARCHAR(40,0), company_name VARCHAR(40,0), contact_id VARCHAR(20,0), addr_1 text, addr_2 text, addr_3 text, addr_4 text, zipcode varchar(20,0), state VARCHAR(40,0), city VARCHAR(40,0), first_name VARCHAR(40,0), last_name VARCHAR(40,0), phone VARCHAR(40,0), fax VARCHAR(40,0), email VARCHAR(40,0), notes text, price_type VARCHAR(40,0), sales_rep VARCHAR(40,0), type VARCHAR(40,0), create_time timestamp default (datetime('now', 'localtime')), editable integer, contact_name text, addr text, Sales_Order_Customer integer, Sales_Order_Freight_Bill_To integer, Sales_Order_Ship_From integer, Sales_Order_Merchandise_Bill_To integer, Contact_Return_To integer, Sales_Order_Ship_To integer,img_0 TEXT,img_1 TEXT,img_2 TEXT,related_cid VARCHAR(20,0),is_active integer,sync_data text,modify_time TIMESTAMP default (datetime('now', 'localtime')), PRIMARY KEY(_id) );";
     
 //    NSString* create_contact_image=@"CREATE TABLE IF NOT EXISTS contact_image ( _id INTEGER PRIMARY KEY, name VARCHAR(20), url VARCHAR(256), contact_id VARCHAR(20));";
     
@@ -781,18 +781,24 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
     [self alterTable:@"product" columns:@"has_bundle integer;is_active integer;item_id integer" rename:NO db:db];
     [self alterTable:@"product" columns:@"ship_via text" 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_time timestamp" rename:NO db:db];
+    [self alterTable:@"offline_cart" columns:@"modify_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:@"modify_time TIMESTAMP" 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;item_id integer" rename:NO db:db];
+    [self alterTable:@"wishlist" columns:@"modify_time TIMESTAMP" rename:NO db:db];
+    
     
+    [self alterTable:@"offline_order" columns:@"modify_time TIMESTAMP" rename:NO db:db];
 //    NSString *rename_model_to_product = @"alter model rename to product";
 //    [self execSql:rename_model_to_product db:db];
 //