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

160921
Modify: change offline submit message.

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

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


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

@@ -26,7 +26,7 @@
     NSMutableArray* ret = [[NSMutableArray alloc] init];
     sqlite3 *db = [iSalesDB get_db];
     
-    NSString *sqlQuery =@"select so_id from offline_order where order_id is null";
+    NSString *sqlQuery =@"select so_id from offline_order where status=-11;";
     sqlite3_stmt * statement;
     
     int dbresult=sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil);

+ 60 - 5
RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m

@@ -142,7 +142,7 @@
     NSString* msg;
     if(appDelegate.offline_mode)
     {
-        msg=@"Are you sure to mark order as ready for submit?";
+        msg=@"Are you sure to mark offline order as ready for submit?";
     }
     else
     {
@@ -726,7 +726,20 @@
                                                                 [appDelegate closeOrder];
                                                                 [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
                                                                 
-                                                                UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Submit successful." message:[NSString stringWithFormat:@"SO#: %@",[editor_json valueForKey:@"so#"]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
+                                                                NSString* title=nil;
+                                                                NSString* msg=nil;
+                                                                if(appDelegate.offline_mode)
+                                                                {
+                                                                    title=TITLE_OFFLINE_SUBMIT;
+                                                                    msg=MSG_OFFLINE_SUBMIT;
+                                                                }
+                                                                else
+                                                                {
+                                                                    title=@"Submit successful.";
+                                                                    msg=[NSString stringWithFormat:@"SO#: %@",[editor_json valueForKey:@"so#"]];
+                                                                }
+                                                                
+                                                                UIAlertView * alert = [[UIAlertView alloc] initWithTitle: title message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                                                                 
                                                                 [alert show];
                                                                 
@@ -831,7 +844,21 @@
                                                             appDelegate.order_code = orderCode;
                                                             appDelegate.order_status = [[editor_json valueForKey:@"orderStatus"] intValue];
                                                             [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-                                                            UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Submit successful." message:[NSString stringWithFormat:@"SO#: %@",[editor_json valueForKey:@"so#"]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
+                                                            
+                                                            NSString* title=nil;
+                                                            NSString* msg=nil;
+                                                            if(appDelegate.offline_mode)
+                                                            {
+                                                                title=TITLE_OFFLINE_SUBMIT;
+                                                                msg=MSG_OFFLINE_SUBMIT;
+                                                            }
+                                                            else
+                                                            {
+                                                                title=@"Submit successful.";
+                                                                msg=[NSString stringWithFormat:@"SO#: %@",[editor_json valueForKey:@"so#"]];
+                                                            }
+                                                            
+                                                            UIAlertView * alert = [[UIAlertView alloc] initWithTitle: title message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                                                             
                                                             [alert show];
                                                             //    //     self.labelContact.text=appDelegate.contact_name;
@@ -919,7 +946,20 @@
                                     [appDelegate closeOrder];
                                     [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
                                     
-                                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Submit successful." message:[NSString stringWithFormat:@"SO#: %@",[editor_json valueForKey:@"so#"]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
+                                    NSString* title=nil;
+                                    NSString* msg=nil;
+                                    if(appDelegate.offline_mode)
+                                    {
+                                        title=TITLE_OFFLINE_SUBMIT;
+                                        msg=MSG_OFFLINE_SUBMIT;
+                                    }
+                                    else
+                                    {
+                                        title=@"Submit successful.";
+                                        msg=[NSString stringWithFormat:@"SO#: %@",[editor_json valueForKey:@"so#"]];
+                                    }
+                                    
+                                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle: title message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                                     
                                     [alert show];
                                     
@@ -1037,7 +1077,22 @@
                                 appDelegate.order_code = orderCode;
                                 appDelegate.order_status = [[editor_json valueForKey:@"orderStatus"] intValue];
                                 [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-                                UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Submit successful." message:[NSString stringWithFormat:@"SO#: %@",[editor_json valueForKey:@"so#"]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
+                                
+                                NSString* title=nil;
+                                NSString* msg=nil;
+                                if(appDelegate.offline_mode)
+                                {
+                                    title=TITLE_OFFLINE_SUBMIT;
+                                    msg=MSG_OFFLINE_SUBMIT;
+                                }
+                                else
+                                {
+                                    title=@"Submit successful.";
+                                    msg=[NSString stringWithFormat:@"SO#: %@",[editor_json valueForKey:@"so#"]];
+                                }
+                                
+                                
+                                UIAlertView * alert = [[UIAlertView alloc] initWithTitle: title message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                                 
                                 [alert show];
                                 //    //     self.labelContact.text=appDelegate.contact_name;

+ 3 - 0
RedAnt ERP Mobile/common/const.h

@@ -91,6 +91,9 @@
 #define MSG_LOGIN_DEVICE @"Account already sign in from another device."
 #define MSG_TIMEOUT @"Request timeout."
 
+#define MSG_OFFLINE_SUBMIT @"Offline order will be submitted when you login online mode and sync with server."
+#define TITLE_OFFLINE_SUBMIT @"Offline Submit"
+
 #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
 
 

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

@@ -721,17 +721,17 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
     
     NSString* create_offline_salesrep=@"CREATE TABLE IF NOT EXISTS offline_salesrep ( _id INTEGER PRIMARY KEY, name text, code text,salesrep_id integer);";
     
-    NSString* create_order_trigger=@"drop trigger if exists offline_order_insert;CREATE TRIGGER  if not exists offline_order_insert after insert on offline_order BEGIN select offline_dirty();  UPDATE offline_order SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;drop trigger if exists offline_order_update; CREATE TRIGGER  if not exists offline_order_update after update on offline_order BEGIN select offline_dirty();  UPDATE offline_order SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;CREATE TRIGGER  if not exists offline_order_delete after delete on offline_order BEGIN select offline_dirty();  END;";
+    NSString* create_order_trigger=@"CREATE TRIGGER  if not exists offline_order_insert after insert on offline_order BEGIN select offline_dirty();  UPDATE offline_order SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;CREATE TRIGGER  if not exists offline_order_update after update on offline_order BEGIN select offline_dirty();  UPDATE offline_order SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;CREATE TRIGGER  if not exists offline_order_delete after delete on offline_order BEGIN select offline_dirty();  END;";
  
     
     
-    NSString* create_contact_trigger=@"drop trigger if exists offline_contact_insert;CREATE TRIGGER  if not exists offline_contact_insert after insert on offline_contact BEGIN select offline_dirty();  UPDATE offline_contact SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;drop trigger if exists offline_contact_update; CREATE TRIGGER  if not exists offline_contact_update after update on offline_contact BEGIN select offline_dirty(); UPDATE offline_contact SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;  END;CREATE TRIGGER  if not exists offline_contact_delete after delete on offline_contact BEGIN select offline_dirty();  END;";
+    NSString* create_contact_trigger=@"CREATE TRIGGER  if not exists offline_contact_insert after insert on offline_contact BEGIN select offline_dirty();  UPDATE offline_contact SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;CREATE TRIGGER  if not exists offline_contact_update after update on offline_contact BEGIN select offline_dirty(); UPDATE offline_contact SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;  END;CREATE TRIGGER  if not exists offline_contact_delete after delete on offline_contact BEGIN select offline_dirty();  END;";
 
     
-    NSString* create_cart_trigger=@"drop trigger if exists offline_cart_insert;CREATE TRIGGER  if not exists offline_cart_insert after insert on offline_cart BEGIN select offline_dirty(); UPDATE offline_cart SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;  END;drop trigger if exists offline_cart_update; CREATE TRIGGER  if not exists offline_cart_update after update on offline_cart BEGIN select offline_dirty(); UPDATE offline_cart SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;  END;CREATE TRIGGER  if not exists offline_cart_delete after delete on offline_cart BEGIN select offline_dirty();  END;";
+    NSString* create_cart_trigger=@"CREATE TRIGGER  if not exists offline_cart_insert after insert on offline_cart BEGIN select offline_dirty(); UPDATE offline_cart SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;  END;CREATE TRIGGER  if not exists offline_cart_update after update on offline_cart BEGIN select offline_dirty(); UPDATE offline_cart SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;  END;CREATE TRIGGER  if not exists offline_cart_delete after delete on offline_cart BEGIN select offline_dirty();  END;";
     
     
-    NSString* create_wishlist_trigger=@"drop trigger if exists wishlist_insert;CREATE TRIGGER  if not exists wishlist_insert after insert on wishlist BEGIN select offline_dirty();  UPDATE wishlist SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;drop trigger if exists wishlist_update;CREATE TRIGGER  if not exists wishlist_update after update on wishlist BEGIN select offline_dirty();  UPDATE wishlist SET modify_time= datetime('now', 'localtime') WHERE _id=new._id; END;CREATE TRIGGER  if not exists wishlist_delete after delete on wishlist BEGIN select offline_dirty();  END;";
+    NSString* create_wishlist_trigger=@"CREATE TRIGGER  if not exists wishlist_insert after insert on wishlist BEGIN select offline_dirty();  UPDATE wishlist SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;CREATE TRIGGER  if not exists wishlist_update after update on wishlist BEGIN select offline_dirty();  UPDATE wishlist SET modify_time= datetime('now', 'localtime') WHERE _id=new._id; END;CREATE TRIGGER  if not exists wishlist_delete after delete on wishlist BEGIN select offline_dirty();  END;";
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
     //if(appDelegate.offline_mode)

+ 48 - 48
RedAnt ERP Mobile/iSales-NPD/AppDelegate.m

@@ -1380,55 +1380,55 @@ void UncaughtExceptionHandler(NSException *exception) {
         NSArray* arr_order=nil;
         arr_order=[OLDataProvider enumOfflineOrder];
         
-        if(arr_order.count>0)
-        {
-            
-            {
-                SelectUploadOrderViewController * vc =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SelectUploadOrderViewController"];
-                vc.returnValue = ^(NSArray* SelectedOrder){
-                    
-                    [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:SelectedOrder];
-                    SyncControlPanelViewController * syncVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SyncControlPanelViewController"];
-                    syncVC.action_string=@"Download";
-                    UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:syncVC] ;
-                    
-                    
-                    
-                    
-                    
-                    //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
-                    
-                    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-                    [parent presentViewController:navi animated:YES completion:^{
-                        
-                        //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
-                        
-                        NSLog(@"about present.........");
-                        
-                        //   self.btop = false;
-                        //  <#code#>
-                    }];
-                };
-                
-                UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:vc] ;
-                
-                
-                
-                
-                
-                
-                navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-                [parent presentViewController:navi animated:YES completion:^{
-                    
-                    
-                }];
-            }
-            
-            
-        }
-        else
+//        if(arr_order.count>0)
+//        {
+//            
+//            {
+//                SelectUploadOrderViewController * vc =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SelectUploadOrderViewController"];
+//                vc.returnValue = ^(NSArray* SelectedOrder){
+//                    
+//                    [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:SelectedOrder];
+//                    SyncControlPanelViewController * syncVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SyncControlPanelViewController"];
+//                    syncVC.action_string=@"Download";
+//                    UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:syncVC] ;
+//                    
+//                    
+//                    
+//                    
+//                    
+//                    //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
+//                    
+//                    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//                    [parent presentViewController:navi animated:YES completion:^{
+//                        
+//                        //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
+//                        
+//                        NSLog(@"about present.........");
+//                        
+//                        //   self.btop = false;
+//                        //  <#code#>
+//                    }];
+//                };
+//                
+//                UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:vc] ;
+//                
+//                
+//                
+//                
+//                
+//                
+//                navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//                [parent presentViewController:navi animated:YES completion:^{
+//                    
+//                    
+//                }];
+//            }
+//            
+//            
+//        }
+//        else
         {
-            [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:nil];
+            [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:arr_order];
             SyncControlPanelViewController * syncVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SyncControlPanelViewController"];
             syncVC.action_string=@"Download";
             UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:syncVC] ;