|
|
@@ -532,7 +532,7 @@ void UncaughtExceptionHandler(NSException *exception) {
|
|
|
[self readUrgencyCache];
|
|
|
|
|
|
NSLog(@"urgencyDic: %@",self.urgencyDic);
|
|
|
- if (self.urgencyDic.allKeys.count) {
|
|
|
+ if (self.urgencyDic.allKeys.count > 2) {
|
|
|
|
|
|
MainViewController *mainVC = [self.window.rootViewController.childViewControllers lastObject];
|
|
|
UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
|
|
|
@@ -547,96 +547,106 @@ void UncaughtExceptionHandler(NSException *exception) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- NSString *firstClassName = [self.urgencyDic objectForKey:@"firt_class_name"];
|
|
|
-
|
|
|
- NSString *changed_data_key = [NSString stringWithFormat:@"%@_changed_data",firstClassName];
|
|
|
- NSMutableDictionary *changed_data = [self.urgencyDic objectForKey:changed_data_key];
|
|
|
-
|
|
|
- if ([firstClassName isEqualToString:@"CustomerEditViewController"]) {
|
|
|
- // CustomerEditViewController
|
|
|
-
|
|
|
- NSString *contact_id = [self.urgencyDic objectForKey:@"contact_id"];
|
|
|
-
|
|
|
- NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
|
|
-
|
|
|
- [params setValue:contact_id forKey:@"contact_id"];
|
|
|
- CustomerEditViewController * cuseditVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
|
|
|
-
|
|
|
- cuseditVC.bnewcustomer=false;
|
|
|
- cuseditVC.url_type = URL_RESTORE;
|
|
|
- cuseditVC.request_url=URL_EDIT_CUSTOMER;
|
|
|
-
|
|
|
- cuseditVC.params = params;
|
|
|
- cuseditVC.content_data_download = changed_data;
|
|
|
-
|
|
|
-// cuseditVC.delegate=self;
|
|
|
-
|
|
|
-
|
|
|
- [[mainVC navigationController] setNavigationBarHidden:NO animated:NO];
|
|
|
- [mainVC.navigationController pushViewController:cuseditVC animated:false];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- } else if ([firstClassName isEqualToString:@"CreateOrderViewController"]) {
|
|
|
- // CreateOrderViewController
|
|
|
-
|
|
|
- NSString *order_code = [self.urgencyDic objectForKey:@"order_code"];
|
|
|
- int order_status = [[self.urgencyDic objectForKey:@"order_status"] intValue];
|
|
|
- NSString *order_customer_id = [self.urgencyDic objectForKey:@"order_customer_id"];
|
|
|
-
|
|
|
- self.order_customer_id = order_customer_id;
|
|
|
-
|
|
|
- // 首先通过order code 打开订单
|
|
|
- NSDictionary* order_json = [iSalesNetwork open_Order:order_code];
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
-// [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
- if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
+ id count = [self.urgencyDic objectForKey:@"count"];
|
|
|
+ int level_count = count ? [count integerValue] : 0;
|
|
|
|
|
|
- self.order_code = order_code;
|
|
|
- self.order_status = order_status;
|
|
|
- [self SetSo:order_code];
|
|
|
-
|
|
|
-
|
|
|
- self.customerInfo = [iSalesNetwork request_CustomerInfo:order_customer_id].mutableCopy;
|
|
|
-
|
|
|
- self.contact_id=[self.customerInfo valueForKey:@"customer_cid"];
|
|
|
-
|
|
|
- [mainVC reloadOrder:true immediately:false];
|
|
|
- [mainVC reloadCart:true immediately:false];
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:mainVC] ;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 再place order
|
|
|
+ if (!level_count) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < level_count; i++) {
|
|
|
|
|
|
- NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
|
|
-
|
|
|
- CreateOrderViewController * orderinfoVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"CreateOrderViewController"];
|
|
|
+ NSString *level_key = [NSString stringWithFormat:@"level_%d",i];
|
|
|
|
|
|
- orderinfoVC.disable_dropdown_refresh=true;
|
|
|
- orderinfoVC.url_type = URL_RESTORE;
|
|
|
- orderinfoVC.request_url=URL_CARTDELIVERY;
|
|
|
- orderinfoVC.params = params;
|
|
|
- orderinfoVC.content_data_download = changed_data;
|
|
|
- orderinfoVC.resumeOrder = YES;
|
|
|
+ NSDictionary *urgencyDic = [self.urgencyDic objectForKey:level_key];
|
|
|
|
|
|
- [mainVC.navigationController pushViewController:orderinfoVC animated:true];
|
|
|
+ NSString *className = [urgencyDic objectForKey:@"class_name"];
|
|
|
|
|
|
+ NSString *restored_data_key = [NSString stringWithFormat:@"%@_restored_data",className];
|
|
|
|
|
|
- NSString *second_class_name = [self.urgencyDic objectForKey:@"second_class_name"];
|
|
|
- NSString *second_changed_data_key = [NSString stringWithFormat:@"%@_changed_data",second_class_name];
|
|
|
- NSMutableDictionary *second_changed_data = [self.urgencyDic objectForKey:second_changed_data_key];
|
|
|
+ NSMutableDictionary *restored_data = [urgencyDic objectForKey:restored_data_key];
|
|
|
|
|
|
- if ([second_class_name isEqualToString:@"AddressEditorViewController"]) {
|
|
|
+ if ([className isEqualToString:@"CustomerEditViewController"]) {
|
|
|
+ // CustomerEditViewController
|
|
|
+
|
|
|
+ NSString *contact_id = [urgencyDic objectForKey:@"contact_id"];
|
|
|
+
|
|
|
+ NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
|
|
+
|
|
|
+ [params setValue:contact_id forKey:@"contact_id"];
|
|
|
+ CustomerEditViewController * cuseditVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
|
|
|
+
|
|
|
+ cuseditVC.bnewcustomer=false;
|
|
|
+ cuseditVC.url_type = URL_RESTORE;
|
|
|
+ cuseditVC.request_url=URL_EDIT_CUSTOMER;
|
|
|
+
|
|
|
+ cuseditVC.params = params;
|
|
|
+ cuseditVC.content_data_download = restored_data;
|
|
|
+
|
|
|
+ // cuseditVC.delegate=self;
|
|
|
+
|
|
|
+
|
|
|
+ [[mainVC navigationController] setNavigationBarHidden:NO animated:NO];
|
|
|
+ [mainVC.navigationController pushViewController:cuseditVC animated:false];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ } else if ([className isEqualToString:@"CreateOrderViewController"]) {
|
|
|
+ // CreateOrderViewController
|
|
|
+
|
|
|
+ NSString *order_code = [urgencyDic objectForKey:@"order_code"];
|
|
|
+ int order_status = [[urgencyDic objectForKey:@"order_status"] intValue];
|
|
|
+ NSString *order_customer_id = [urgencyDic objectForKey:@"order_customer_id"];
|
|
|
+
|
|
|
+ self.order_customer_id = order_customer_id;
|
|
|
+
|
|
|
+ // 首先通过order code 打开订单
|
|
|
+ NSDictionary* order_json = [iSalesNetwork open_Order:order_code];
|
|
|
+
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ // [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+ if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+
|
|
|
+ self.order_code = order_code;
|
|
|
+ self.order_status = order_status;
|
|
|
+ [self SetSo:order_code];
|
|
|
+
|
|
|
+
|
|
|
+ self.customerInfo = [iSalesNetwork request_CustomerInfo:order_customer_id].mutableCopy;
|
|
|
+
|
|
|
+ self.contact_id=[self.customerInfo valueForKey:@"customer_cid"];
|
|
|
+
|
|
|
+ [mainVC reloadOrder:true immediately:false];
|
|
|
+ [mainVC reloadCart:true immediately:false];
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:mainVC] ;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 再place order
|
|
|
+
|
|
|
+ NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
|
|
+
|
|
|
+ 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:@"AddressEditorViewController"]) {
|
|
|
// AddressEditorViewController
|
|
|
|
|
|
AddressEditorViewController * addressVC =[mainStoryBoard instantiateViewControllerWithIdentifier:@"AddressEditorViewController"];
|
|
|
@@ -644,25 +654,16 @@ void UncaughtExceptionHandler(NSException *exception) {
|
|
|
addressVC.url_type = URL_RESTORE;
|
|
|
addressVC.request_url=URL_ADDRESS_EDOTOR;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
|
|
|
|
|
|
params[@"is_subaction"]=@"true";
|
|
|
-// params[@"subaction_tag"]= [NSString stringWithFormat:@"%ld",(long)sender.tag];
|
|
|
addressVC.params = params;
|
|
|
- addressVC.content_data_download = second_changed_data;
|
|
|
-
|
|
|
+ addressVC.content_data_download = restored_data;
|
|
|
|
|
|
-// addressVC.from = indexPath;
|
|
|
|
|
|
[mainVC.navigationController pushViewController:addressVC animated:true];
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- } else {
|
|
|
+ }// class_name
|
|
|
|
|
|
}
|
|
|
|