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

1.修改GATIT、Homer CommonEditor崩溃恢复。

Pen Li 8 лет назад
Родитель
Сommit
a6df38e3b6

+ 26 - 19
RedAnt ERP Mobile/iSales-GATIT/AppDelegate.m

@@ -28,6 +28,7 @@
 #import "GoogleAnalyst.h"
 #import "ERPUtils.h"
 #import "RANetwork.h"
+#import "RAOrderEditorViewController.h"
 
 #define UNZIP_OPEN_FAILED 0
 #define UNZIP_SUCCESS 1
@@ -576,7 +577,6 @@ void UncaughtExceptionHandler(NSException *exception) {
 }
 
 - (void)dealWithUrgencyFile {
-    
     NSDictionary *tmp_urgencyDic = [self readUrgencyCache];
     
     if (tmp_urgencyDic.allKeys.count > 2) {
@@ -617,20 +617,21 @@ void UncaughtExceptionHandler(NSException *exception) {
             NSMutableDictionary *restored_data = [urgencyDic objectForKey:restored_data_key];
             
             dispatch_async(dispatch_get_main_queue(), ^{
-               
+                
                 if ([className isEqualToString:@"CustomerEditViewController"]) {
                     // CustomerEditViewController
                     
                     NSString *contact_id = [urgencyDic objectForKey:@"contact_id"];
+                    BOOL new_customer = [urgencyDic objectForKey:@"new_customer"];
                     
                     NSMutableDictionary *params = [NSMutableDictionary dictionary];
                     
                     [params setValue:contact_id forKey:@"contact_id"];
                     CustomerEditViewController * cuseditVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
                     
-                    cuseditVC.bnewcustomer=false;
-                    cuseditVC.url_type = URL_REMOTE;
-                    cuseditVC.request_url=URL_NEW_CUSTOMER;
+                    cuseditVC.bnewcustomer=new_customer;
+                    cuseditVC.url_type = URL_RESTORE;
+                    cuseditVC.request_url= new_customer ? URL_NEW_CUSTOMER : URL_EDIT_CUSTOMER;
                     
                     cuseditVC.params = params;
                     cuseditVC.content_data_download = restored_data;
@@ -643,7 +644,7 @@ void UncaughtExceptionHandler(NSException *exception) {
                     
                     
                     
-                } else if ([className isEqualToString:@"CreateOrderViewController"]) {
+                } else if ([className isEqualToString:@"CreateOrderViewController"] || [className isEqualToString:@"RAOrderEditorViewController"]) {
                     // CreateOrderViewController
                     
                     NSString *order_code = [urgencyDic objectForKey:@"order_code"];
@@ -670,7 +671,7 @@ void UncaughtExceptionHandler(NSException *exception) {
                                 
                                 self.contact_id=[self.customerInfo valueForKey:@"customer_cid"];
                             }
-                           
+                            
                             
                             [mainVC reloadOrder:true immediately:false];
                             [mainVC reloadCart:true immediately:false];
@@ -686,19 +687,25 @@ void UncaughtExceptionHandler(NSException *exception) {
                     
                     
                     // 再place order
-                    
                     NSMutableDictionary *params = [NSMutableDictionary dictionary];
                     
-                    CreateOrderViewController * orderinfoVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"CreateOrderViewController"];
-                    
-                    orderinfoVC.disable_dropdown_refresh=true;
-                    orderinfoVC.url_type = URL_REMOTE;
-                    orderinfoVC.request_url=URL_CARTDELIVERY;
-                    orderinfoVC.params = params;
-                    orderinfoVC.content_data_download = restored_data;
-                    orderinfoVC.resumeOrder = YES;
-                    
-                    [mainVC.navigationController pushViewController:orderinfoVC animated:true];
+                    if ([className isEqualToString:@"CreateOrderViewController"]) {
+                        CreateOrderViewController * orderinfoVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"CreateOrderViewController"];
+                        
+                        orderinfoVC.disable_dropdown_refresh=true;
+                        orderinfoVC.url_type = URL_RESTORE;
+                        orderinfoVC.request_url=URL_CARTDELIVERY;
+                        orderinfoVC.params = params;
+                        orderinfoVC.content_data_download = restored_data;
+                        orderinfoVC.resumeOrder = YES;
+                        
+                        [mainVC.navigationController pushViewController:orderinfoVC animated:true];
+                    } else if ([className isEqualToString:@"RAOrderEditorViewController"]) {
+                        
+                        RAOrderEditorViewController *orderEditorVC = [mainStoryBoard instantiateViewControllerWithIdentifier:@"RAOrderEditorViewController"];
+                        [orderEditorVC recoveryFromUrgencyDic:urgencyDic];
+                        [mainVC.navigationController pushViewController:orderEditorVC animated:YES];
+                    }
                     
                     
                 } else  if ([className isEqualToString:@"AddressEditorViewController"]) {
@@ -706,7 +713,7 @@ void UncaughtExceptionHandler(NSException *exception) {
                     
                     AddressEditorViewController * addressVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"AddressEditorViewController"];
                     
-                    addressVC.url_type = URL_REMOTE;
+                    addressVC.url_type = URL_RESTORE;
                     addressVC.request_url=URL_ADDRESS_EDOTOR;
                     
                     NSMutableDictionary * params= [[NSMutableDictionary alloc] init];

+ 26 - 18
RedAnt ERP Mobile/iSales-HOMER/AppDelegate.m

@@ -28,6 +28,7 @@
 #import "GoogleAnalyst.h"
 #import "ERPUtils.h"
 #import "RANetwork.h"
+#import "RAOrderEditorViewController.h"
 
 #define UNZIP_OPEN_FAILED 0
 #define UNZIP_SUCCESS 1
@@ -624,20 +625,21 @@ void UncaughtExceptionHandler(NSException *exception) {
             NSMutableDictionary *restored_data = [urgencyDic objectForKey:restored_data_key];
             
             dispatch_async(dispatch_get_main_queue(), ^{
-               
+                
                 if ([className isEqualToString:@"CustomerEditViewController"]) {
                     // CustomerEditViewController
                     
                     NSString *contact_id = [urgencyDic objectForKey:@"contact_id"];
+                    BOOL new_customer = [urgencyDic objectForKey:@"new_customer"];
                     
                     NSMutableDictionary *params = [NSMutableDictionary dictionary];
                     
                     [params setValue:contact_id forKey:@"contact_id"];
                     CustomerEditViewController * cuseditVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
                     
-                    cuseditVC.bnewcustomer=false;
-                    cuseditVC.url_type = URL_REMOTE;
-                    cuseditVC.request_url=URL_NEW_CUSTOMER;
+                    cuseditVC.bnewcustomer=new_customer;
+                    cuseditVC.url_type = URL_RESTORE;
+                    cuseditVC.request_url= new_customer ? URL_NEW_CUSTOMER : URL_EDIT_CUSTOMER;
                     
                     cuseditVC.params = params;
                     cuseditVC.content_data_download = restored_data;
@@ -650,7 +652,7 @@ void UncaughtExceptionHandler(NSException *exception) {
                     
                     
                     
-                } else if ([className isEqualToString:@"CreateOrderViewController"]) {
+                } else if ([className isEqualToString:@"CreateOrderViewController"] || [className isEqualToString:@"RAOrderEditorViewController"]) {
                     // CreateOrderViewController
                     
                     NSString *order_code = [urgencyDic objectForKey:@"order_code"];
@@ -677,7 +679,7 @@ void UncaughtExceptionHandler(NSException *exception) {
                                 
                                 self.contact_id=[self.customerInfo valueForKey:@"customer_cid"];
                             }
-                           
+                            
                             
                             [mainVC reloadOrder:true immediately:false];
                             [mainVC reloadCart:true immediately:false];
@@ -693,19 +695,25 @@ void UncaughtExceptionHandler(NSException *exception) {
                     
                     
                     // 再place order
-                    
                     NSMutableDictionary *params = [NSMutableDictionary dictionary];
                     
-                    CreateOrderViewController * orderinfoVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"CreateOrderViewController"];
-                    
-                    orderinfoVC.disable_dropdown_refresh=true;
-                    orderinfoVC.url_type = URL_REMOTE;
-                    orderinfoVC.request_url=URL_CARTDELIVERY;
-                    orderinfoVC.params = params;
-                    orderinfoVC.content_data_download = restored_data;
-                    orderinfoVC.resumeOrder = YES;
-                    
-                    [mainVC.navigationController pushViewController:orderinfoVC animated:true];
+                    if ([className isEqualToString:@"CreateOrderViewController"]) {
+                        CreateOrderViewController * orderinfoVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"CreateOrderViewController"];
+                        
+                        orderinfoVC.disable_dropdown_refresh=true;
+                        orderinfoVC.url_type = URL_RESTORE;
+                        orderinfoVC.request_url=URL_CARTDELIVERY;
+                        orderinfoVC.params = params;
+                        orderinfoVC.content_data_download = restored_data;
+                        orderinfoVC.resumeOrder = YES;
+                        
+                        [mainVC.navigationController pushViewController:orderinfoVC animated:true];
+                    } else if ([className isEqualToString:@"RAOrderEditorViewController"]) {
+                        
+                        RAOrderEditorViewController *orderEditorVC = [mainStoryBoard instantiateViewControllerWithIdentifier:@"RAOrderEditorViewController"];
+                        [orderEditorVC recoveryFromUrgencyDic:urgencyDic];
+                        [mainVC.navigationController pushViewController:orderEditorVC animated:YES];
+                    }
                     
                     
                 } else  if ([className isEqualToString:@"AddressEditorViewController"]) {
@@ -713,7 +721,7 @@ void UncaughtExceptionHandler(NSException *exception) {
                     
                     AddressEditorViewController * addressVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"AddressEditorViewController"];
                     
-                    addressVC.url_type = URL_REMOTE;
+                    addressVC.url_type = URL_RESTORE;
                     addressVC.request_url=URL_ADDRESS_EDOTOR;
                     
                     NSMutableDictionary * params= [[NSMutableDictionary alloc] init];